|
|
|
|
@ -13,29 +13,37 @@
|
|
|
|
|
:on-success="successHandle"
|
|
|
|
|
:before-upload="uploadBefore"
|
|
|
|
|
:before-remove="beforeRemove"
|
|
|
|
|
accept=".jpg,.png,.gif"
|
|
|
|
|
accept=".jpg,.jpeg,.png,.gif,.PDF,.pdf, .doc, .docx, .xls, .xlsx"
|
|
|
|
|
:action="action"
|
|
|
|
|
:file-list="fileList"
|
|
|
|
|
:on-remove="removeHande"
|
|
|
|
|
:limit="100"
|
|
|
|
|
list-type="picture"
|
|
|
|
|
:headers="{
|
|
|
|
|
Authorization: `Bearer ${getToken()}`,
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<template #file="{ file }">
|
|
|
|
|
<div style="display: flex;align-items: center;">
|
|
|
|
|
<i :style="{ 'color': file.status === 'success' ? 'green' : '' }" :class="{ 'el-icon-circle-check': file.status === 'success','el-icon-loading': file.status === 'uploading' }"></i>
|
|
|
|
|
<a href="javascript:" style="flex: 1;margin-left: 6px;" @click="openDownload(file)">{{ file.name }}</a>
|
|
|
|
|
<i class="el-icon-close" @click="deleteFile(file)"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<el-button slot="trigger" size="small" type="primary"
|
|
|
|
|
>选取文件
|
|
|
|
|
</el-button
|
|
|
|
|
>
|
|
|
|
|
<div slot="tip" class="el-upload__tip">
|
|
|
|
|
只能上传jpg/png/gif文件,
|
|
|
|
|
<br/>单个文件不能超过50M
|
|
|
|
|
</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
|
|
|
|
|
</Modal>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { save, index, destroy } from '@/api/system/baseForm'
|
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
props: {},
|
|
|
|
|
@ -69,10 +77,11 @@ export default {
|
|
|
|
|
message: '请上传文件'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getToken,
|
|
|
|
|
show() {
|
|
|
|
|
this.isShow = true
|
|
|
|
|
},
|
|
|
|
|
@ -127,7 +136,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
uploadBefore(file) {
|
|
|
|
|
console.log(file)
|
|
|
|
|
if (file.size / 1000 > 50 * 1024) {
|
|
|
|
|
if ((file.size / 1000) > (50 * 1024)) {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'warning',
|
|
|
|
|
message: '上传图片大小超过50M!'
|
|
|
|
|
@ -165,6 +174,7 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.$integrateData(this.form, res)
|
|
|
|
|
console.log(this.fileList)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
submit(response) {
|
|
|
|
|
@ -182,6 +192,30 @@ export default {
|
|
|
|
|
message: '附件上传成功'
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
openDownload (file) {
|
|
|
|
|
window.open(file.url)
|
|
|
|
|
},
|
|
|
|
|
deleteFile (file) {
|
|
|
|
|
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (file.response?.id) {
|
|
|
|
|
destroy({
|
|
|
|
|
table_name: "asset_file_files",
|
|
|
|
|
id: file.response.id
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: '删除成功'
|
|
|
|
|
})
|
|
|
|
|
this.getDetail()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
|