feat : 需求上报fileLie 权限控制

This commit is contained in:
clay
2024-06-02 17:37:53 +08:00
parent e9592920e7
commit 3ed5068dee
16 changed files with 206 additions and 62 deletions

View File

@@ -10,7 +10,8 @@
<el-button type="danger" link @click="deleteOtherFile(singleFile,1)">删除</el-button>
</template>
<template v-else-if="!preview||JSON.stringify(singleFile) === '{}'||singleFile==null">
<file-upload @getFile="getAttachment" :showFileList="showFileList" :multiple="false" :maxSize="1" :disabled="isSingleFile" @delete="deleteAttachment"/>
<file-upload @getFile="getAttachment" :showFileList="showFileList" :multiple="false" :maxSize="1"
:disabled="isSingleFile" @delete="deleteAttachment"/>
</template>
</el-form-item>
</el-col>
@@ -69,15 +70,28 @@ const tableConfig = reactive({
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = []
btn.push({label: '下载', func: () => handleDownload(row), type: 'primary'})
if (row.newFile){
btn.push({label: '删除', func: () => handleDelete(row), type: 'primary'})
}
return (
<div>
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
<div style={{width: '100%'}}>
{
btn.map(item => (
<el-button
type={item.type}
onClick={() => item.func()}
link
>
{item.label}
</el-button>
))
}
</div>
)
}
}
// <el-button type="primary" size="large" link onClick={() => deleteOtherFile(row)}>删除</el-button>
]
})
const rules = reactive({
@@ -91,19 +105,24 @@ const props = defineProps({
showFileList: {
type: Boolean,
default: false
}, label: {
},
label: {
type: String,
default: '项目附件'
}, showTable: {
},
showTable: {
type: Boolean,
default: true
}, preview: {
},
preview: {
type: Boolean,
default: false
}, otherFileList: {
},
otherFileList: {
type: Array,
default: []
}, formData: {
},
formData: {
type: Array,
default: []
}
@@ -112,34 +131,34 @@ watch(() => props.showTable, (newVal) => {
props.showTable = newVal
}, {deep: true})
watch(() => props.otherFileList, (newVal) => {
console.log('newotherFileList',newVal)
console.log('newotherFileList', newVal)
if (props.preview) {
if(props.formData.fileList==null){
allFileList.value=newVal
}else {
if (props.formData.fileList == null) {
allFileList.value = newVal
} else {
newVal?.forEach(item => {
allFileList.value.push(item)
})
}
}else {
allFileList.value=newVal
} else {
allFileList.value = newVal
}
}, {deep: true})
watch(() => props.formData.fileList, (newVal) => {
console.log('newVal-fileList',newVal)
console.log('newVal-fileList', newVal)
if (props.preview) {
newVal?.forEach(item => {
allFileList.value.push(item)
})
newVal?.forEach(item => {
allFileList.value.push(item)
})
}
}, {deep: true})
watch(() => props.formData.singleFile, (newVal) => {
console.log('singleFile',newVal)
console.log('singleFile', newVal)
singleFile.value = newVal
}, {deep: true})
const getAttachment = (val) => {
isSingleFile.value=true
isSingleFile.value = true
emit('getAttachment', val)
}
const getOtherFile = (val) => {
@@ -150,10 +169,10 @@ const deleteAttachment = (val) => {
if (res.code === 1000) {
ElNotification({
title: '提示',
message:"删除成功",
type:'success'
message: "删除成功",
type: 'success'
})
isSingleFile.value=false
isSingleFile.value = false
}
});
}