From 4f866f85f0bbbf3ffa6ae5752e1e981b946959ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AE=8F=E6=9D=B0?= <1943105267@qq.com> Date: Tue, 15 Aug 2023 15:21:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8A=A8=E6=80=81=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/netManage/workDynamic/index.vue | 76 ++++++++++++++++------- src/views/netSecurity/SafetyYh/index.vue | 2 +- 2 files changed, 56 insertions(+), 22 deletions(-) diff --git a/src/views/netManage/workDynamic/index.vue b/src/views/netManage/workDynamic/index.vue index 620793c..3a7e848 100644 --- a/src/views/netManage/workDynamic/index.vue +++ b/src/views/netManage/workDynamic/index.vue @@ -82,7 +82,11 @@ @selection-change="handleSelectionChange" > - + + + - - - - - + + @@ -259,6 +247,7 @@ export default { //注释字典 data() { return { + fileList: [], tableHeigth: 0, //查看详情 infoOpen: false, @@ -355,6 +344,7 @@ export default { remark: null, }; + this.fileList = []; this.resetForm("form"); }, /** 搜索按钮操作 */ @@ -378,6 +368,12 @@ export default { this.reset(); const id = row.id || this.ids; getDongtai(id).then((response) => { + this.filterFile( + 2, + response.data.materialsFileName, + response.data.materialsFileUrl + ); + this.form = response.data; this.infoOpen = true; this.infoTitle = "查看工作动态详情"; @@ -394,15 +390,53 @@ export default { this.reset(); const id = row.id || this.ids; getDongtai(id).then((response) => { + this.filterFile( + 2, + response.data.materialsFileName, + response.data.materialsFileUrl + ); + this.form = response.data; this.open = true; this.title = "修改工作动态"; }); }, + filterFile(state, fileName, fileUrl) { + //1.提交 else 查看 + if (state == 1) { + let fileName = []; + let fileUrl = []; + if (this.fileList.length > 0) { + this.fileList.forEach((item) => { + fileName.push(item.name); + fileUrl.push(item.url); + }); + this.form.materialsFileName = fileName.join(","); + this.form.materialsFileUrl = fileUrl.join(","); + } else { + this.form.materialsFileName = ""; + this.form.materialsFileUrl = ""; + } + } else { + if (fileName || fileUrl) { + fileName = fileName.split(","); + fileUrl = fileUrl.split(","); + fileName.forEach((item, index) => { + this.fileList.push({ + name: item, + url: fileUrl[index], + }); + }); + } else { + this.fileList = []; + } + } + }, /** 提交按钮 */ submitForm() { this.$refs["form"].validate((valid) => { if (valid) { + this.filterFile(1); if (this.form.id != null) { updateDongtai(this.form).then((response) => { this.$modal.msgSuccess("修改成功"); diff --git a/src/views/netSecurity/SafetyYh/index.vue b/src/views/netSecurity/SafetyYh/index.vue index 1197394..cf16ea8 100644 --- a/src/views/netSecurity/SafetyYh/index.vue +++ b/src/views/netSecurity/SafetyYh/index.vue @@ -542,7 +542,7 @@ export default { this.form.fileUrl = ""; } } else { - if (fileName != "" || fileUrl != "") { + if (fileName || fileUrl) { fileName = fileName.split(","); fileUrl = fileUrl.split(","); fileName.forEach((item, index) => {