diff --git a/src/components/AttachmentUpload.vue b/src/components/AttachmentUpload.vue
index fa2cc3c..bdbf8aa 100644
--- a/src/components/AttachmentUpload.vue
+++ b/src/components/AttachmentUpload.vue
@@ -10,7 +10,8 @@
删除
-
+
@@ -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 (
-
-
handleDownload(row)}>下载
+
+ {
+ btn.map(item => (
+ item.func()}
+ link
+ >
+ {item.label}
+
+ ))
+ }
)
}
}
-
- //
deleteOtherFile(row)}>删除
]
})
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
}
});
}
diff --git a/src/components/DetailComponent/SummaryDetail.vue b/src/components/DetailComponent/SummaryDetail.vue
index 0d98534..845b756 100644
--- a/src/components/DetailComponent/SummaryDetail.vue
+++ b/src/components/DetailComponent/SummaryDetail.vue
@@ -124,8 +124,9 @@
-
+
+
@@ -148,7 +149,7 @@
-
+
{
+ let btn = []
+ btn.push({label: '下载', func: () => handleDownload(row), type: 'primary'})
+ if (row.newFile){
+ btn.push({label: '删除', func: () => handleDelete(row), type: 'primary'})
+ }
return (
- handleDownload(row)}>下载
+
+ {
+ btn.map(item => (
+ item.func()}
+ link>
+ {item.label}
+
+ ))
+ }
+
)
}
}
@@ -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()
diff --git a/src/components/TagAndFileUpload.vue b/src/components/TagAndFileUpload.vue
index d29dac5..56ce3c2 100644
--- a/src/components/TagAndFileUpload.vue
+++ b/src/components/TagAndFileUpload.vue
@@ -93,6 +93,7 @@ const compositeParam = (item) => {
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
+ newFile: true,
tag: formData.value.tagName,
}
}
diff --git a/src/views/project-demand/requirement/add.vue b/src/views/project-demand/requirement/add.vue
index 9ae3ca5..9457f07 100644
--- a/src/views/project-demand/requirement/add.vue
+++ b/src/views/project-demand/requirement/add.vue
@@ -19,7 +19,7 @@
/>
-
+
+ :isSettingCol="false" :pagination="false" perm="EDIT">
@@ -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)
diff --git a/src/views/project-demand/requirement/detail.vue b/src/views/project-demand/requirement/detail.vue
index 783f02c..e15918c 100644
--- a/src/views/project-demand/requirement/detail.vue
+++ b/src/views/project-demand/requirement/detail.vue
@@ -3,22 +3,22 @@
-
+
{{ formData.requirementName }}
-
+
{{ formData.companyIds }}
-
+
{{ formData.collectType }}
-
+
{{ formData.deadline }}
@@ -29,7 +29,7 @@
-
+
@@ -37,11 +37,13 @@
-
-
+
+
+
+ :data="formData.fileList" :isSettingCol="false"
+ :pagination="false">
@@ -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 (
- handleDownload(row)}>下载
+
+ {
+ btn.map(item => (
+ item.func()}
+ link
+ >
+ {item.label}
+
+ ))
+ }
+
)
}
}
]
})
-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("用户取消删除! ");
+ })
+}