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
}
});
}

View File

@@ -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>

View File

@@ -93,6 +93,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: formData.value.tagName,
}
}

View File

@@ -19,7 +19,7 @@
/>
</el-select>
</el-form-item>
<el-form-item v-if="checkFormPrem('deadline')" label="截止时间" prop="deadline">
<el-form-item label="截止时间" prop="deadline">
<el-config-provider>
<el-date-picker
v-model="formData.deadline"
@@ -59,7 +59,7 @@
<file-upload v-if="checkFormPrem('fileList')" @getFile="getFile"/>
<fvTable style="width: 100%;max-height: 600px;height: 600px" v-if="showTable"
:tableConfig="tableConfig" :data="formData.fileList"
:isSettingCol="false" :pagination="false">
:isSettingCol="false" :pagination="false" perm="EDIT">
<template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template>
@@ -217,11 +217,11 @@ const compositeParam = (item) => {
url: item.url,
processNodeTag: null,
tag: tag,
newFile: true,
userId: authStore.userinfo.userId
}
}
const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false
let fileObj = compositeParam(val)
formData.value.fileList.push(fileObj)

View File

@@ -3,22 +3,22 @@
<el-form :model="formData" ref="demandForm" label-width="auto" :rules="rules">
<baseTitle title="需求征集详情"></baseTitle>
<el-row>
<el-col :span="12" v-if="checkFormPrem('requirementName')">
<el-col :span="12">
<el-form-item label="名称">
<span>{{ formData.requirementName }}</span>
</el-form-item>
</el-col>
<el-col :span="12" v-if="checkFormPrem('companyIds')">
<el-col :span="12">
<el-form-item label="所属公司">
<span>{{ formData.companyIds }}</span>
</el-form-item>
</el-col>
<el-col :span="12" v-if="checkFormPrem('collectType')">
<el-col :span="12">
<el-form-item label="征集类型">
<span>{{ formData.collectType }}</span>
</el-form-item>
</el-col>
<el-col :span="12" v-if="checkFormPrem('deadline')">
<el-col :span="12">
<el-form-item label="截止时间">
<span>{{ formData.deadline }}</span>
</el-form-item>
@@ -29,7 +29,7 @@
</el-form-item>
</el-col>
<baseTitle title="征集说明"></baseTitle>
<el-col :span="24" v-if="checkFormPrem('collectExplain')">
<el-col :span="24">
<el-form-item>
<el-card style="width: 100%">
<div v-html="formData.collectExplain">
@@ -37,11 +37,13 @@
</el-card>
</el-form-item>
</el-col>
<baseTitle title="附件列表"></baseTitle>
<el-col :span="24" v-if="checkFormPrem('collectExplain')">
<baseTitle v-if="fileListShow === 'READ' || fileListShow === 'EDIT'" title="附件列表"></baseTitle>
<el-col :span="24" v-if="fileListShow === 'READ' || fileListShow === 'EDIT'">
<el-form-item>
<file-upload v-if="fileListShow === 'EDIT'" @getFile="getFile"/>
<fvTable style="width: 100%;max-height: 600px;height: 600px" v-if="showTable" :tableConfig="tableConfig"
:data="formData.fileList" :isSettingCol="false" :pagination="false">
:data="formData.fileList" :isSettingCol="false"
:pagination="false">
<template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template>
@@ -84,13 +86,15 @@
import OperationRender from '@/views/workflow/common/OperationRender.vue'
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'
import {useProcessStore} from '@/stores/processStore.js';
import {getInfo, agreeTask, rejectTask, downloadFile} from "@/api/project-demand/index.js";
import {getInfo, agreeTask, rejectTask,
deleteFile,downloadFile} from "@/api/project-demand/index.js";
import {getSubCompOpt} from '@/api/user/user.js'
import {ElNotification} from "element-plus";
import {ElMessage, ElMessageBox, ElNotification} from "element-plus";
import {useTagsView} from '@/stores/tagsview.js'
import {matterTree} from '@/utils/matterTree.js';
import {getFundOption} from "@/api/special-fund";
const tagsViewStore = useTagsView()
const router = useRouter()
const route = useRoute()
@@ -100,8 +104,8 @@ const demandForm = ref()
const processStore = useProcessStore()
const companyOption = ref([])
const specialFundOption = ref([])
const formPermMap = ref(new Map());
const processInstanceData = ref({})
const fileListShow = ref("READ")
const showTable = ref(false)
const processDiagramViewer = ref(false)
const processTree = ref()
@@ -139,29 +143,34 @@ 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>
)
}
}
]
})
const checkFormPrem = (formKey) => {
if (formPermMap.value.hasOwnProperty(formKey)) {
let formItem = formPermMap.value[formKey];
return formItem.perm === 'READ'
} else {
return true;
}
}
const fromPrem = (formKey) => {
let formItem = formPermMap.value[formKey];
return formItem.perm
}
const handleSubmit = () => {
let approve = {
@@ -242,9 +251,9 @@ const init = async () => {
let data = res.data
formData.value = data.formData;
data.formData.companyIds = getCompanyOptionItem(data.formData.companyIds)
if(data.formData.specialFund){
if (data.formData.specialFund) {
specialFundOption.value.forEach(item => {
if(data.formData.specialFund==item.value){
if (data.formData.specialFund == item.value) {
data.formData.specialFund = item.label
}
})
@@ -259,6 +268,9 @@ const init = async () => {
nextTick(() => {
processDiagramViewer.value = true
showTable.value = true
if (data.formPermMap["fileList"]) {
fileListShow.value = data.formPermMap["fileList"].perm
}
})
})
}
@@ -266,15 +278,66 @@ onMounted(async () => {
loading.value = true
await init()
})
const getFile = (val) => {
showTable.value = false
let fileObj = compositeParam(val)
formData.value.fileList.push(fileObj)
nextTick(() => {
showTable.value = true
})
}
const compositeParam = (item) => {
let tag = ''
if (!formData.value.collectType && routerName.value === 'Requirement/add') {
tag = '需求征集'
}else if(!formData.value.collectType &&routerName.value === 'Requirement/edit'){
tag = '需求征集'
}if (formData.value.collectType) {
tag = formData.value.collectType
}
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
processNodeTag: null,
newFile: true,
tag: tag,
}
}
const handleDelete = (row) => {
ElMessageBox.confirm(`确认删除名称为${row.originalFileName}的表格吗?`, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteFile(row.fileId).then(res => {
if (res.code === 1000) {
ElMessage.success("删除成功");
formData.value.fileList.splice(formData.value.fileList.findIndex((item) => item.id === row.fileId), 1);
}
});
}).catch(() => {
ElMessage.warning("用户取消删除! ");
})
}
</script>
<style lang="scss" scoped>
:deep(.el-empty__description) {
margin-top: 0;
}
:deep(.el-table--fit ){
:deep(.el-table--fit ) {
height: 600px;
}
.detail-block {
overflow: hidden;
padding-right: 10px;

View File

@@ -82,6 +82,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag:'需求征集'
}
}

View File

@@ -318,6 +318,7 @@ const compositeParam = (item, type) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: tag
}
}

View File

@@ -4,7 +4,7 @@
<collection-detail v-show="showActive == '00'" :formData="summaryData.formData" :data="summaryData"
:processViewer="summaryProcessViewer" :loading="loading"/>
<summary-detail v-show="showActive == '10'" :formData="summaryData.formData" :data="summaryData"
:processViewer="summaryProcessViewer" :loading="loading"/>
:processViewer="summaryProcessViewer" :loading="loading" :fileListShow="fileListShow"/>
<ApprovalDetail v-show="showActive == '20'" :formData="summaryData.formData" :data="summaryData" :processViewer="summaryProcessViewer" :loading="loading"></ApprovalDetail>
<ApprovalDetail type="execute" v-show="showActive == '40'" :formData="summaryData.formData" :data="summaryData"
:processViewer="summaryProcessViewer" :loading="loading"></ApprovalDetail>
@@ -27,6 +27,7 @@ const route = useRoute()
const summaryData = ref({})
const summaryProcessViewer = ref(true)
const loading = ref(false)
const fileListShow = ref('READ')
const processStore = useProcessStore()
const active = ref(route.query.state)
const showActive = ref()
@@ -47,6 +48,9 @@ const getInfo = async (state) => {
processStore.passList.value = data.passList;
nextTick(() => {
summaryProcessViewer.value = true
if (data.formPermMap["fileList"]) {
fileListShow.value = data.formPermMap["fileList"].perm
}
})
}else {
ElNotification({

View File

@@ -82,6 +82,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag:'需求上报',
}
}

View File

@@ -104,6 +104,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: tag
}
}

View File

@@ -82,6 +82,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: '项目归档',
}
}

View File

@@ -56,6 +56,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: tag
}
}

View File

@@ -47,6 +47,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: tag
}
}

View File

@@ -121,6 +121,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: formData.value.tagName,
}
}

View File

@@ -101,6 +101,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: tag
}
}

View File

@@ -115,6 +115,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: tag
}
}