feat : 需求上报fileLie 权限控制
This commit is contained in:
@@ -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
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -124,8 +124,9 @@
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-col :span="24" v-if="fileListShow === 'READ' || fileListShow === 'EDIT'">
|
||||
<el-form-item label="需求上报附件">
|
||||
<file-upload @getFile="getOtherFile" v-if="fileListShow === 'EDIT'"/>
|
||||
<fvTable style="width: 100%;max-height: 400px;" v-if="processViewer" :tableConfig="tableConfig"
|
||||
:data="localFormData.fileList" :isSettingCol="false" :pagination="false">
|
||||
<template #empty>
|
||||
@@ -148,7 +149,7 @@
|
||||
<!-- </div>-->
|
||||
<!-- </el-col>-->
|
||||
</el-row>
|
||||
<div class="approval-record">
|
||||
<div class="approval-record" >
|
||||
<baseTitle title="审批记录"></baseTitle>
|
||||
<div class="process">
|
||||
<operation-render v-if="processViewer" :operation-list="data.operationList"
|
||||
@@ -187,7 +188,12 @@ const props = defineProps({
|
||||
processViewer: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}, loading: {
|
||||
},
|
||||
fileListShow:{
|
||||
type: String,
|
||||
default: 'READ'
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
@@ -222,9 +228,26 @@ const tableConfig = reactive({
|
||||
prop: 'oper',
|
||||
label: '操作',
|
||||
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 (
|
||||
<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>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -273,10 +296,33 @@ const handleDownload = (row) => {
|
||||
a.click()
|
||||
})
|
||||
}
|
||||
const getOtherFile = (val) => {
|
||||
props.processViewer = false
|
||||
let fileObj = compositeParam(val)
|
||||
localFormData.value.fileList.push(fileObj)
|
||||
nextTick(() => {
|
||||
props.processViewer = true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const compositeParam = (item, type) => {
|
||||
return {
|
||||
fileId: item.id,
|
||||
size: item.size,
|
||||
originalFileName: item.originalFilename,
|
||||
fileType: item.fileType,
|
||||
url: item.url,
|
||||
newFile: true,
|
||||
tag: '需求上报'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
watch(() => props.processViewer, (newVal) => {
|
||||
props.processViewer = newVal
|
||||
}, {deep: true})
|
||||
|
||||
watch(() => props.loading, (newVal) => {
|
||||
props.loading = newVal
|
||||
}, {deep: true})
|
||||
@@ -284,6 +330,7 @@ watch(() => props.loading, (newVal) => {
|
||||
watchEffect(() => {
|
||||
return Object.keys(props.formData).length && (localFormData.value = props.formData)
|
||||
})
|
||||
|
||||
getFundOptions()
|
||||
</script>
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ const compositeParam = (item) => {
|
||||
originalFileName: item.originalFilename,
|
||||
fileType: item.fileType,
|
||||
url: item.url,
|
||||
newFile: true,
|
||||
tag: formData.value.tagName,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user