diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index 6c583cf..b444326 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -29,7 +29,7 @@
  • - {{ getFileName(file.name) }} + {{ file.name }}
    删除 @@ -60,7 +60,7 @@ export default { // 文件类型, 例如['png', 'jpg', 'jpeg'] fileType: { type: Array, - default: () => ["doc", "xls", "ppt", "txt", "pdf"], + default: () => ["doc", "docx", "pdf"], }, // 是否显示提示 isShowTip: { @@ -147,7 +147,7 @@ export default { // 上传成功回调 handleUploadSuccess(res, file) { if (res.code === 200) { - this.uploadList.push({ name: res.fileName, url: res.fileName }); + this.uploadList.push({ name: res.originalFilename, url: res.fileName }); this.uploadedSuccessfully(); } else { this.number--; @@ -160,7 +160,7 @@ export default { // 删除文件 handleDelete(index) { this.fileList.splice(index, 1); - this.$emit("input", this.listToString(this.fileList)); + this.$emit("input", this.fileList); }, // 上传结束处理 uploadedSuccessfully() { @@ -168,7 +168,7 @@ export default { this.fileList = this.fileList.concat(this.uploadList); this.uploadList = []; this.number = 0; - this.$emit("input", this.listToString(this.fileList)); + this.$emit("input", this.fileList); this.$modal.closeLoading(); } }, diff --git a/src/views/tcZz/networkSecurity/bmtb/index.vue b/src/views/tcZz/networkSecurity/bmtb/index.vue index 7f06e14..2db3375 100644 --- a/src/views/tcZz/networkSecurity/bmtb/index.vue +++ b/src/views/tcZz/networkSecurity/bmtb/index.vue @@ -177,14 +177,8 @@ - - - - - + + @@ -308,6 +302,7 @@ export default { form: {}, // 表单校验 rules: {}, + fileNameS: [], }; }, created() { @@ -401,21 +396,46 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); + this.fileNameS = []; this.open = true; this.title = "添加部门通报"; }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); + this.fileNameS = []; const id = row.id || this.ids; getBmtb(id).then((response) => { this.form = response.data; + if (response.data.fileName && response.data.fileUrl) { + let arr1 = response.data.fileName.split(","); + let arr2 = response.data.fileUrl.split(","); + arr1.forEach((value, index) => { + this.fileNameS.push({ + name: value, + url: arr2[index], + }); + }); + } this.open = true; this.title = "修改部门通报"; }); }, /** 提交按钮 */ submitForm() { + let arr1 = []; + let arr2 = []; + if (this.fileNameS.length > 0) { + this.fileNameS.forEach((value) => { + arr1.push(value.name); + arr2.push(value.url); + }); + this.form.fileName = arr1.join(","); + this.form.fileUrl = arr2.join(","); + } else { + this.form.fileName = ""; + this.form.fileUrl = ""; + } this.$refs["form"].validate((valid) => { if (valid) { if (this.form.id != null) { diff --git a/src/views/tcZz/networkSecurity/sdtb/index.vue b/src/views/tcZz/networkSecurity/sdtb/index.vue index c80b6bf..2a7390a 100644 --- a/src/views/tcZz/networkSecurity/sdtb/index.vue +++ b/src/views/tcZz/networkSecurity/sdtb/index.vue @@ -181,15 +181,10 @@ > - - - - - + + + @@ -312,6 +307,8 @@ export default { form: {}, // 表单校验 rules: {}, + //文件 + fileNameS: [], }; }, created() { @@ -405,21 +402,46 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); + this.fileNameS = []; this.open = true; this.title = "添加属地通报"; }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); + this.fileNameS = []; const id = row.id || this.ids; getSdtb(id).then((response) => { this.form = response.data; + if (response.data.fileName && response.data.fileUrl) { + let arr1 = response.data.fileName.split(","); + let arr2 = response.data.fileUrl.split(","); + arr1.forEach((value, index) => { + this.fileNameS.push({ + name: value, + url: arr2[index], + }); + }); + } this.open = true; this.title = "修改属地通报"; }); }, /** 提交按钮 */ submitForm() { + let arr1 = []; + let arr2 = []; + if (this.fileNameS.length > 0) { + this.fileNameS.forEach((value) => { + arr1.push(value.name); + arr2.push(value.url); + }); + this.form.fileName = arr1.join(","); + this.form.fileUrl = arr2.join(","); + } else { + this.form.fileName = ""; + this.form.fileUrl = ""; + } this.$refs["form"].validate((valid) => { if (valid) { if (this.form.id != null) { diff --git a/src/views/tcZz/networkSecurity/tbcz/index.vue b/src/views/tcZz/networkSecurity/tbcz/index.vue index 05d1f9a..7cf974a 100644 --- a/src/views/tcZz/networkSecurity/tbcz/index.vue +++ b/src/views/tcZz/networkSecurity/tbcz/index.vue @@ -218,14 +218,8 @@ - - - - - + + @@ -367,6 +361,8 @@ export default { form: {}, // 表单校验 rules: {}, + fileNameS: [], + }; }, created() { @@ -466,21 +462,46 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); + this.fileNameS = []; this.open = true; this.title = "添加通报处置"; }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); + this.fileNameS = []; const id = row.id || this.ids; getTbcz(id).then((response) => { this.form = response.data; + if (response.data.fileName && response.data.fileUrl) { + let arr1 = response.data.fileName.split(","); + let arr2 = response.data.fileUrl.split(","); + arr1.forEach((value, index) => { + this.fileNameS.push({ + name: value, + url: arr2[index], + }); + }); + } this.open = true; this.title = "修改通报处置"; }); }, /** 提交按钮 */ submitForm() { + let arr1 = []; + let arr2 = []; + if (this.fileNameS.length > 0) { + this.fileNameS.forEach((value) => { + arr1.push(value.name); + arr2.push(value.url); + }); + this.form.fileName = arr1.join(","); + this.form.fileUrl = arr2.join(","); + } else { + this.form.fileName = ""; + this.form.fileUrl = ""; + } this.$refs["form"].validate((valid) => { if (valid) { if (this.form.id != null) { diff --git a/src/views/tcZz/networkSecurity/zxyh/index.vue b/src/views/tcZz/networkSecurity/zxyh/index.vue index e8d3bc5..0f67afc 100644 --- a/src/views/tcZz/networkSecurity/zxyh/index.vue +++ b/src/views/tcZz/networkSecurity/zxyh/index.vue @@ -221,14 +221,8 @@ - - - - - + + @@ -376,6 +370,8 @@ export default { form: {}, // 表单校验 rules: {}, + fileNameS: [], + }; }, created() { @@ -477,21 +473,46 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); + this.fileNameS = []; this.open = true; this.title = "添加最新隐患"; }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); + this.fileNameS = []; const id = row.id || this.ids; getZxyh(id).then((response) => { this.form = response.data; + if (response.data.fileName && response.data.fileUrl) { + let arr1 = response.data.fileName.split(","); + let arr2 = response.data.fileUrl.split(","); + arr1.forEach((value, index) => { + this.fileNameS.push({ + name: value, + url: arr2[index], + }); + }); + } this.open = true; this.title = "修改最新隐患"; }); }, /** 提交按钮 */ submitForm() { + let arr1 = []; + let arr2 = []; + if (this.fileNameS.length > 0) { + this.fileNameS.forEach((value) => { + arr1.push(value.name); + arr2.push(value.url); + }); + this.form.fileName = arr1.join(","); + this.form.fileUrl = arr2.join(","); + } else { + this.form.fileName = ""; + this.form.fileUrl = ""; + } this.$refs["form"].validate((valid) => { if (valid) { if (this.form.id != null) {