fix : 修复页面细节功能及附件上传组件

This commit is contained in:
2024-05-20 00:29:31 +08:00
parent 1f4389eb5e
commit 9661cdbb2b
10 changed files with 268 additions and 157 deletions

View File

@@ -3,15 +3,20 @@
<el-row>
<el-col :span="24">
<el-form-item :label="label" prop="attachment">
<file-upload @getFile="getAttachment" :showFileList="showFileList" @delete="deleteAttachment"/>
<template v-if="preview">
<el-button type="primary" link @click="handleDownload(singleFile)" style="font-size: 18px">{{ singleFile?.originalFileName }}</el-button>
</template>
<template v-else>
<file-upload @getFile="getAttachment" :showFileList="showFileList" :maxSize="0" @delete="deleteAttachment"/>
</template>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="其他文件">
<el-card style="width: 100%">
<file-upload @getFile="getOtherFile" :showFileList="false"/>
<file-upload @getFile="getOtherFile"/>
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="otherFileList" :isSettingCol="false" :pagination="false">
:data="allFileList" :isSettingCol="false" :pagination="false">
<template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template>
@@ -75,6 +80,8 @@ const rules = reactive({
attachment: [{required: true, message: '请上传附件', trigger: ['blur','change']}],
})
const applyForm=ref()
const singleFile=ref()
const allFileList=ref([])
const props = defineProps({
showFileList: {
type: Boolean,
@@ -85,16 +92,32 @@ const props = defineProps({
}, showTable: {
type: Boolean,
default: true
}, preview: {
type: Boolean,
default: false
},otherFileList: {
type: Array,
default: []
},formData: {
type: Array,
default: []
}
})
watch(() => props.showTable, (newVal) => {
props.showTable = newVal
}, {deep: true})
watch(() => props.otherFileList, (newVal) => {
props.otherFileList = newVal
newVal.forEach(item=>{
allFileList.value.push(item)
})
}, {deep: true})
watch(() => props.formData.fileList, (newVal) => {
newVal.forEach(item=>{
allFileList.value.push(item)
})
}, {deep: true})
watch(() => props.formData.singleFile, (newVal) => {
singleFile.value = newVal
}, {deep: true})
const getAttachment = (val) => {
emit('getAttachment', val)
@@ -140,7 +163,9 @@ defineExpose({
},
clearValidate(){
return applyForm.value.clearValidate()
}
},
allFileList,
singleFile
})
</script>