From fd01b20f0591a68b4fe95772633c95ec229e086a Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Mon, 22 Sep 2025 16:11:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E4=BA=A4=E9=97=AE=E9=A2=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/filesTransfer/issue/index.vue | 10 +- .../filesTransfer/issue/prop/issueForm.vue | 135 +++++------------- 2 files changed, 40 insertions(+), 105 deletions(-) diff --git a/src/views/filesTransfer/issue/index.vue b/src/views/filesTransfer/issue/index.vue index 116a436..501b45d 100644 --- a/src/views/filesTransfer/issue/index.vue +++ b/src/views/filesTransfer/issue/index.vue @@ -95,12 +95,10 @@ export default { }, // 详情 handleDetail(row) { - this.$router.push({ - name: 'DetailData', - query: { - id: encryptWithSM4(row.id ?? '0'), - } - }) + this.title = "详情"; + this.isAdd = 'detail'; + this.row = row; + this.isflag = true; }, /* 搜索操作 */ handleQuery() { diff --git a/src/views/filesTransfer/issue/prop/issueForm.vue b/src/views/filesTransfer/issue/prop/issueForm.vue index 6ff738b..70b42f6 100644 --- a/src/views/filesTransfer/issue/prop/issueForm.vue +++ b/src/views/filesTransfer/issue/prop/issueForm.vue @@ -5,24 +5,32 @@
- - + + + + + noResultsText="没有搜索结果" :disabled="isRead"/> + + +
取消 确认 + @click="submitForm('ruleForm')" v-if="!isRead">确认 @@ -63,21 +71,15 @@ export default { proId: [ { required: true, message: '请选择项目', trigger: 'change' } ], - checkTreeData: [ - { - validator: (rule, value, callback) => { - if (!this.checkTreeData || this.checkTreeData.length === 0) { - callback(new Error('请选择移交档案')); - } else { - callback(); - } - }, - trigger: 'change' - } - ], deptId: [ { required: true, message: '请选择接收组织', trigger: 'change' } ], + issue: [ + { required: true, message: '请输入移交问题', trigger: 'blur' } + ], + transferTime: [ + { required: true, message: '请选择移交时间', trigger: 'blur' } + ], }, fileTreeTitle: "", isflag: false, @@ -87,6 +89,11 @@ export default { created() { this.initFormData(); }, + computed: { + isRead() { + return this.isAdd === 'detail'; + } + }, methods: { /** 初始化表单数据 */ async initFormData() { @@ -98,50 +105,27 @@ export default { }); - if (this.isAdd === 'edit' && this.rowData) { + if ((this.isAdd === 'edit' || this.isAdd === 'detail') && this.rowData) { // 编辑模式:填充表单数据 this.form = { id: this.rowData.id || null, proId: this.rowData.proId || undefined, deptId: this.rowData.deptId || undefined, + transferTime: this.rowData.transferTime || undefined, + issue: this.rowData.issue || null, }; - const res = await getTransferApplyFilesByApplyIdApi({ id: this.rowData.id }); - if (Array.isArray(res.data) && res.data.length > 0) { - res.data.map(item => { - const newFile = { - proFilesContentsId: item.id, - parParentName: item.parParentName, - parentName: item.parentName, - fileName: item.fileName, - proId: item.proId, - fileSourceId: item.fileId, - filePath: item.filePath - }; - this.checkTreeData.push(newFile); - }) - } + } else { // 新增模式:重置表单 this.form = { proId: undefined, deptId: undefined, + transferTime: null, + issue: null, }; } }, - handleProChange(value) { - console.log(value); - this.checkTreeData = []; - }, - // 选择移交档案 - handleAddFile() { - if (!this.form.proId) { - return this.$modal.msgError('请选择项目'); - } - const proId = this.form.proId; - this.fileTreeTitle = "选择"; - this.fileTreeRow = { proId }; - this.isflag = true; - }, + closeDialog() { this.isflag = false; }, @@ -167,9 +151,10 @@ export default { /**重置表单*/ reset() { this.form = { - id: null, proId: undefined, - deptId: undefined + deptId: undefined, + transferTime: null, + issue: null, }; this.resetForm("ruleForm"); this.checkTreeData = []; @@ -191,14 +176,7 @@ export default { background: 'rgba(0,0,0,0.5)', target: this.$el.querySelector('.el-dialog') || document.body }) - let params = _.cloneDeep(this.form); - // 获取单项工程名称 - let proObj = this.proList.find(item => item.id === params.proId); - params.singleProName = proObj.name; - // 获取接收组织名称 - const obj = this.findNodeById(this.treeDataList, this.form.deptId); - params.deptName = obj?.label || ''; - params.transferFileDtos = this.checkTreeData; + console.log(params); if (this.isAdd === 'add') { @@ -251,54 +229,13 @@ export default { return node }) }, - findNodeById(nodes, id) { - for (const node of nodes) { - if (node.id === id) return node; - if (node.children) { - const found = this.findNodeById(node.children, id); - if (found) return found; - } - } - return null; - }, - // 获取选中的节点 - async getTreeData(nodeId) { - this.checkTreeData = []; - const res = await getTransferApplyFilesApi({ proId: this.form.proId, id: nodeId }); - if (Array.isArray(res.data) && res.data.length > 0) { - res.data.map(item => { - const newFile = { - proFilesContentsId: item.id, - parParentName: item.parParentName, - parentName: item.parentName, - fileName: item.fileName, - proId: item.proId, - fileSourceId: item.fileId, - filePath: item.filePath - }; - this.checkTreeData.push(newFile); - }) - } - - // 触发表单验证 - this.$nextTick(() => { - this.$refs.ruleForm.validateField('checkTreeData'); - }); - }, - // 删除文件 - removeFile(index) { - this.checkTreeData.splice(index, 1); - // 触发表单验证 - this.$nextTick(() => { - this.$refs.ruleForm.validateField('checkTreeData'); - }); - } + } };