diff --git a/src/views/tcZz/netWorkYq/sslx/index.vue b/src/views/tcZz/netWorkYq/sslx/index.vue index 9548fb2..a921501 100644 --- a/src/views/tcZz/netWorkYq/sslx/index.vue +++ b/src/views/tcZz/netWorkYq/sslx/index.vue @@ -38,7 +38,7 @@ @keyup.enter.native="handleQuery" /> --> - + - - - + @@ -360,6 +382,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -374,7 +437,7 @@ import { isStatusYqbg, importYqbg, } from "@/api/tcZz/netWorkYq/yqbg"; -import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; export default { name: "Yqbg", @@ -442,18 +505,45 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + type: [{ required: true, message: "请选择类型", trigger: "blur" }], + title: [{ required: true, message: "请输入标题", trigger: "blur" }], + isStatus: [ + { required: true, message: "请选择启动/禁用", trigger: "blur" }, + ], + }, fileNameS: [], //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { this.getList(); }, methods: { + //下载模板 + importTemplate() { + this.download( + "/tcZz/netWorkYq/yqbg/importTemplate", + {}, + `舆情报告模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, //导入 handleBeforeUpload(file) { // 校检文件类型 @@ -464,36 +554,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importYqbg(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -520,6 +601,31 @@ export default { }) .catch(() => {}); }, + //添加表格 + addFile() { + if (this.fileNameS.length <= 0) { + this.fileNameS.push({ + fileName: "", + fileUrl: "", + }); + } else { + if ( + this.fileNameS[this.fileNameS.length - 1].fileUrl != "" && + this.fileNameS[this.fileNameS.length - 1].fileName != "" + ) { + this.fileNameS.push({ + fileName: "", + fileUrl: "", + }); + } else { + this.$modal.msgError("请完整填写上一条"); + } + } + }, + //删除表格 + removeFile(index) { + this.fileNameS.splice(index, 1); + }, /** 查询舆情报告列表 */ getList(e) { this.loading = true; @@ -557,7 +663,7 @@ export default { areaId: null, - isStatus: 0, + isStatus: 1, type: null, @@ -610,7 +716,12 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); - this.fileNameS = []; + this.fileNameS = [ + { + fileName: "", + fileUrl: "", + }, + ]; this.open = true; this.title = "添加舆情报告"; }, @@ -626,8 +737,8 @@ export default { let arr2 = response.data.fileUrl.split(","); arr1.forEach((value, index) => { this.fileNameS.push({ - name: value, - url: arr2[index], + fileName: value, + fileUrl: arr2[index], }); }); } @@ -657,8 +768,10 @@ export default { console.log(this.fileNameS); if (this.fileNameS.length > 0) { this.fileNameS.forEach((value) => { - arr1.push(value.name); - arr2.push(value.url); + if (value.fileName && value.fileUrl) { + arr1.push(value.fileName); + arr2.push(value.fileUrl); + } }); this.form.fileName = arr1.join(","); this.form.fileUrl = arr2.join(","); @@ -724,3 +837,55 @@ export default { }, }; + diff --git a/src/views/tcZz/netWorkYq/yqxxltj/index.vue b/src/views/tcZz/netWorkYq/yqxxltj/index.vue index cb62bfa..fcba284 100644 --- a/src/views/tcZz/netWorkYq/yqxxltj/index.vue +++ b/src/views/tcZz/netWorkYq/yqxxltj/index.vue @@ -108,20 +108,10 @@ v-hasPermi="['tcZz/netWorkYq:yqxxltj:export']" >导出 - 导入 - 导入 - 启用 @@ -344,6 +334,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -358,7 +389,7 @@ import { isStatusYqxxltj, importYqxxltj, } from "@/api/tcZz/netWorkYq/yqxxltj"; -import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; export default { name: "Yqxxltj", @@ -430,17 +461,44 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + type: [{ required: true, message: "请选择类型", trigger: "blur" }], + title: [{ required: true, message: "标题不能为空", trigger: "blur" }], + isStatus: [ + { required: true, message: "请选择启动/禁用", trigger: "blur" }, + ], + }, //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { this.getList(); }, methods: { + //下载模板 + importTemplate() { + this.download( + "/tcZz/netWorkYq/yqxxltj/importTemplate", + {}, + `舆情信息量统计明細模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, //导入 handleBeforeUpload(file) { // 校检文件类型 @@ -451,36 +509,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importYqxxltj(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -548,7 +597,7 @@ export default { areaId: null, - isStatus: 0, + isStatus: 1, type: null, diff --git a/src/views/tcZz/netWorkYq/yqyj/index.vue b/src/views/tcZz/netWorkYq/yqyj/index.vue index 69b69b0..3f454ac 100644 --- a/src/views/tcZz/netWorkYq/yqyj/index.vue +++ b/src/views/tcZz/netWorkYq/yqyj/index.vue @@ -174,20 +174,7 @@ v-hasPermi="['tcZz/netWorkYq:yqyj:export']" >导出 - - 导入 - + 导入 启用 @@ -327,7 +314,7 @@ >
- + + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -406,8 +434,7 @@ import { isStatusYqyj, importYqyj, } from "@/api/tcZz/netWorkYq/yqyj"; -import { Loading } from "element-ui"; - +import { getToken } from "@/utils/auth"; export default { name: "Yqyj", //注释字典 @@ -476,17 +503,43 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + title: [{ required: true, message: "标题不能为空", trigger: "blur" }], + content: [{ required: true, message: "内容不能为空", trigger: "blur" }], + isStatus: [{ required: true, message: "请选择启动/禁用", trigger: "blur" }], + }, //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { this.getList(); }, methods: { + //下载模板 + importTemplate() { + this.download( + "/tcZz/netWorkYq/yqyj/importTemplate", + {}, + `舆情预警模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, + //导入 handleBeforeUpload(file) { // 校检文件类型 const fileName = file.name.split("."); @@ -496,36 +549,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importYqyj(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -593,7 +637,7 @@ export default { areaId: null, - isStatus: 0, + isStatus: 1, title: null, diff --git a/src/views/tcZz/netWorkYq/yqzs/index.vue b/src/views/tcZz/netWorkYq/yqzs/index.vue index 551f05a..7053e04 100644 --- a/src/views/tcZz/netWorkYq/yqzs/index.vue +++ b/src/views/tcZz/netWorkYq/yqzs/index.vue @@ -32,87 +32,30 @@ />
- - - + + style="width: 240px" + value-format="yyyy-MM-dd" + type="daterange" + range-separator="-" + start-placeholder="开始日期" + end-placeholder="结束日期" + > - - + - + style="width: 240px" + value-format="yyyy-MM-dd" + type="daterange" + range-separator="-" + start-placeholder="开始日期" + end-placeholder="结束日期" + > +
--> - - - + + + + @@ -376,8 +406,7 @@ import { isStatusZbxq, importZbxq, } from "@/api/tcZz/netWorkYq/zbxq"; -import { Loading } from "element-ui"; - +import { getToken } from "@/utils/auth"; export default { name: "Zbxq", //注释字典 @@ -442,16 +471,42 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + isStatus: [{ required: true, message: "请选择启动/禁用", trigger: "blur" }], + yqTitle: [{ required: true, message: "舆情标题不能为空", trigger: "blur" }], + depName: [{ required: true, message: "部门名称", trigger: "blur" }], + yqState: [{ required: true, message: "请输入舆情状态", trigger: "blur" }], + }, fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { this.getList(); }, methods: { + //下载模板 + importTemplate() { + this.download( + "/tcZz/netWorkYq/zbxq/importTemplate", + {}, + `转办量、转办详情模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, //导入 handleBeforeUpload(file) { // 校检文件类型 @@ -462,36 +517,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importZbxq(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -555,7 +601,7 @@ export default { areaId: null, - isStatus: 0, + isStatus: 1, yqTitle: null, diff --git a/src/views/tcZz/networkSecurity/bmtb/index.vue b/src/views/tcZz/networkSecurity/bmtb/index.vue index 1302817..9b3bafd 100644 --- a/src/views/tcZz/networkSecurity/bmtb/index.vue +++ b/src/views/tcZz/networkSecurity/bmtb/index.vue @@ -79,20 +79,9 @@ v-hasPermi="['tcZz/networkSecurity:bmtb:export']" >导出 - 导入 - 导入 - 启用 @@ -190,20 +179,55 @@ class="dialog-from" > - + + + 启用 + 禁用 + - +
+
+
文件名称
+
文件路径(完整路径)
+
+
+ +
+
+
+
+
+ +
+
+ +
+
+
+ +
+
@@ -252,6 +276,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -266,7 +331,8 @@ import { isStatusBmtb, importBmtb, } from "@/api/tcZz/networkSecurity/bmtb"; -import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; +// import { Loading } from "element-ui"; export default { name: "Bmtb", @@ -330,12 +396,18 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + depName: [{ required: true, message: "部门名称不能为空", trigger: "blur" }], + isStatus: [{ required: true, message: "请选择启动/禁用", trigger: "blur" }], + }, fileNameS: [], //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -348,6 +420,24 @@ export default { this.$modal.msgSuccess("修改成功"); }); }, + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/bmtb/importTemplate", + {}, + `部门通报模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, //导入 handleBeforeUpload(file) { // 校检文件类型 @@ -358,36 +448,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importBmtb(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -413,6 +494,31 @@ export default { this.getList(e); }) .catch(() => {}); + }, + //添加表格 + addFile() { + if (this.fileNameS.length <= 0) { + this.fileNameS.push({ + fileName: "", + fileUrl: "", + }); + } else { + if ( + this.fileNameS[this.fileNameS.length - 1].fileUrl != "" && + this.fileNameS[this.fileNameS.length - 1].fileName != "" + ) { + this.fileNameS.push({ + fileName: "", + fileUrl: "", + }); + } else { + this.$modal.msgError("请完整填写上一条"); + } + } + }, + //删除表格 + removeFile(index) { + this.fileNameS.splice(index, 1); }, /** 查询部门通报列表 */ getList(e) { @@ -449,7 +555,7 @@ export default { this.form = { id: null, - isStatus: null, + isStatus: 1, depName: null, @@ -500,7 +606,12 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); - this.fileNameS = []; + this.fileNameS = [ + { + fileName: "", + fileUrl: "", + }, + ]; this.open = true; this.title = "添加部门通报"; }, @@ -516,8 +627,8 @@ export default { let arr2 = response.data.fileUrl.split(","); arr1.forEach((value, index) => { this.fileNameS.push({ - name: value, - url: arr2[index], + fileName: value, + fileUrl: arr2[index], }); }); } @@ -531,8 +642,10 @@ export default { let arr2 = []; if (this.fileNameS.length > 0) { this.fileNameS.forEach((value) => { - arr1.push(value.name); - arr2.push(value.url); + if (value.fileName && value.fileUrl) { + arr1.push(value.fileName); + arr2.push(value.fileUrl); + } }); this.form.fileName = arr1.join(","); this.form.fileUrl = arr2.join(","); @@ -598,3 +711,55 @@ export default { }, }; + diff --git a/src/views/tcZz/networkSecurity/cybersecurity/index.vue b/src/views/tcZz/networkSecurity/cybersecurity/index.vue index ffa5f0e..8b9b175 100644 --- a/src/views/tcZz/networkSecurity/cybersecurity/index.vue +++ b/src/views/tcZz/networkSecurity/cybersecurity/index.vue @@ -85,20 +85,9 @@ v-hasPermi="['tcZz/networkSecurity:cybersecurity:export']" >导出 - 导入 - 导入 - 启用 @@ -209,14 +198,10 @@
- - - + + 启用 + 禁用 + @@ -248,10 +233,7 @@ /> - + @@ -348,6 +330,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -362,7 +385,7 @@ import { isStatusCybersecurity, importCybersecurity, } from "@/api/tcZz/networkSecurity/cybersecurity"; -import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; export default { name: "Cybersecurity", @@ -446,11 +469,16 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + isStatus: [{ required: true, message: "请选择启动/禁用", trigger: "blur" }], + }, //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -463,8 +491,26 @@ export default { this.$modal.msgSuccess("修改成功"); }); }, - //导入 - handleBeforeUpload(file) { + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/cybersecurity/importTemplate", + {}, + `网络监测模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, + //导入 + handleBeforeUpload(file) { // 校检文件类型 const fileName = file.name.split("."); const fileExt = fileName[fileName.length - 1]; @@ -473,36 +519,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importCybersecurity(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -570,7 +607,7 @@ export default { areaId: null, - isStatus: null, + isStatus: 1, startTime: null, diff --git a/src/views/tcZz/networkSecurity/dbdw/index.vue b/src/views/tcZz/networkSecurity/dbdw/index.vue index 88bf33b..054b8c9 100644 --- a/src/views/tcZz/networkSecurity/dbdw/index.vue +++ b/src/views/tcZz/networkSecurity/dbdw/index.vue @@ -103,20 +103,10 @@ v-hasPermi="['tcZz/networkSecurity:dbdw:export']" >导出 - 导入 - 导入 - 启用 @@ -225,6 +215,12 @@ >
+ + + 启用 + 禁用 + + @@ -285,16 +281,7 @@ placeholder="请输入单位责任人—电子邮件" /> - - - - - + @@ -390,6 +377,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -404,7 +432,8 @@ import { isStatusDbdw, importDbdw, } from "@/api/tcZz/networkSecurity/dbdw"; -import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; + export default { name: "Dbdw", @@ -492,11 +521,16 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + isStatus: [{ required: true, message: "请选择启动/禁用", trigger: "blur" }], + }, //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -509,6 +543,24 @@ export default { this.$modal.msgSuccess("修改成功"); }); }, + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/dbdw/importTemplate", + {}, + `等保单位模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, //导入 handleBeforeUpload(file) { // 校检文件类型 @@ -519,36 +571,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importDbdw(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -640,7 +683,7 @@ export default { fzrEmail: null, - isStatus: null, + isStatus: 1, createBy: null, diff --git a/src/views/tcZz/networkSecurity/dbxt/index.vue b/src/views/tcZz/networkSecurity/dbxt/index.vue index 8b4d8bf..7c4c99d 100644 --- a/src/views/tcZz/networkSecurity/dbxt/index.vue +++ b/src/views/tcZz/networkSecurity/dbxt/index.vue @@ -79,20 +79,9 @@ v-hasPermi="['tcZz/networkSecurity:dbxt:export']" >导出 - 导入 - 导入 - 启用 @@ -203,6 +192,20 @@ > + + + + 启用 + 禁用 + + @@ -285,16 +288,7 @@ - - - - - + @@ -402,6 +396,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -416,7 +451,7 @@ import { isStatusDbxt, importDbxt, } from "@/api/tcZz/networkSecurity/dbxt"; -import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; export default { name: "Dbxt", @@ -510,17 +545,42 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + isStatus: [ + { required: true, message: "请选择启动/禁用", trigger: "blur" }, + ], + }, //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { this.getList(); }, methods: { + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/dbxt/importTemplate", + {}, + `等保系统模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, //导入 handleBeforeUpload(file) { // 校检文件类型 @@ -531,36 +591,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importDbxt(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -664,7 +715,7 @@ export default { systemState: null, - isStatus: null, + isStatus: 1, createBy: null, diff --git a/src/views/tcZz/networkSecurity/idcdw/index.vue b/src/views/tcZz/networkSecurity/idcdw/index.vue index 1ea64e1..51f8943 100644 --- a/src/views/tcZz/networkSecurity/idcdw/index.vue +++ b/src/views/tcZz/networkSecurity/idcdw/index.vue @@ -103,20 +103,9 @@ v-hasPermi="['tcZz/networkSecurity:idcdw:export']" >导出 - 导入 - 导入 - 启用 @@ -224,14 +213,10 @@ - - - + + 启用 + 禁用 + @@ -286,6 +271,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -300,8 +326,7 @@ import { isStatusIdcdw, importIdcdw, } from "@/api/tcZz/networkSecurity/idcdw"; -import { Loading } from "element-ui"; - +import { getToken } from "@/utils/auth"; export default { name: "Idcdw", //注释字典 @@ -364,11 +389,16 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + isStatus: [{ required: true, message: "请选择启动/禁用", trigger: "blur" }], + }, //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -380,6 +410,24 @@ export default { this.getList(); this.$modal.msgSuccess("修改成功"); }); + }, + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/idcdw/importTemplate", + {}, + `IDC单位模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; }, //导入 handleBeforeUpload(file) { @@ -391,36 +439,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importIdcdw(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -484,7 +523,7 @@ export default { areaId: null, - isStatus: null, + isStatus: 1, ldcName: null, diff --git a/src/views/tcZz/networkSecurity/jgdw/index.vue b/src/views/tcZz/networkSecurity/jgdw/index.vue index 675d1c6..f7a72a1 100644 --- a/src/views/tcZz/networkSecurity/jgdw/index.vue +++ b/src/views/tcZz/networkSecurity/jgdw/index.vue @@ -103,20 +103,9 @@ v-hasPermi="['tcZz/networkSecurity:jgdw:export']" >导出 - 导入 - 导入 - 启用 @@ -230,9 +219,15 @@
- + + 启用 + 禁用 + + + + - - - - - + @@ -337,6 +323,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -351,7 +378,7 @@ import { isStatusJgdw, importJgdw, } from "@/api/tcZz/networkSecurity/jgdw"; -import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; export default { name: "Jgdw", //注释字典 @@ -424,11 +451,17 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + type: [{ required: true, message: "请选择记录类型", trigger: "blur" }], + isStatus: [{ required: true, message: "请选择启动/禁用", trigger: "blur" }], + }, //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -440,6 +473,24 @@ export default { this.getList(); this.$modal.msgSuccess("修改成功"); }); + }, + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/jgdw/importTemplate", + {}, + `监管单位、网站监测模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; }, //导入 handleBeforeUpload(file) { @@ -451,36 +502,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importJgdw(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -544,7 +586,7 @@ export default { areaId: null, - isStatus: null, + isStatus: 1, unitName: null, diff --git a/src/views/tcZz/networkSecurity/ryz/index.vue b/src/views/tcZz/networkSecurity/ryz/index.vue index 78e025c..6fcf5ef 100644 --- a/src/views/tcZz/networkSecurity/ryz/index.vue +++ b/src/views/tcZz/networkSecurity/ryz/index.vue @@ -99,20 +99,9 @@ v-hasPermi="['tcZz/networkSecurity:ryz:export']" >导出 - 导入 - 导入 - 启用 @@ -236,14 +225,18 @@ - + + + 启用 + 禁用 + @@ -323,6 +316,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -337,8 +371,7 @@ import { isStatusRyz, importRyz, } from "@/api/tcZz/networkSecurity/ryz"; -import { registerLoading } from "echarts"; -import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; export default { name: "Ryz", //注释字典 @@ -409,11 +442,19 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + type: [{ required: true, message: "请选择类型", trigger: "blur" }], + isStatus: [ + { required: true, message: "请选择启动/禁用", trigger: "blur" }, + ], + }, //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -451,6 +492,24 @@ export default { this.$modal.msgSuccess("修改成功"); }); }, + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/ryz/importTemplate", + {}, + `硬指针、软指针模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, //导入 handleBeforeUpload(file) { // 校检文件类型 @@ -461,36 +520,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importRyz(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -531,7 +581,7 @@ export default { type: null, - isStatus: null, + isStatus: 1, zcName: null, diff --git a/src/views/tcZz/networkSecurity/sdtb/index.vue b/src/views/tcZz/networkSecurity/sdtb/index.vue index eef1dd7..6f225cc 100644 --- a/src/views/tcZz/networkSecurity/sdtb/index.vue +++ b/src/views/tcZz/networkSecurity/sdtb/index.vue @@ -86,20 +86,10 @@ v-hasPermi="['tcZz/networkSecurity:sdtb:export']" >导出 - 导入 - 导入 - 启用 @@ -211,17 +201,52 @@
- + + + 启用 + 禁用 + - +
+
+
文件名称
+
文件路径(完整路径)
+
+
+ +
+
+
+
+
+ +
+
+ +
+
+
+ +
+
@@ -271,6 +296,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -285,7 +351,8 @@ import { isStatusSdtb, importSdtb, } from "@/api/tcZz/networkSecurity/sdtb"; -import { Loading } from "element-ui"; +// import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; export default { name: "Sdtb", @@ -349,13 +416,20 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + area: [{ required: true, message: "请选择区域", trigger: "blur" }], + isStatus: [ + { required: true, message: "请选择启动/禁用", trigger: "blur" }, + ], + }, //文件 fileNameS: [], //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -368,8 +442,26 @@ export default { this.$modal.msgSuccess("修改成功"); }); }, - //导入 - handleBeforeUpload(file) { + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/sdtb/importTemplate", + {}, + `属地通报模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, + //导入 + handleBeforeUpload(file) { // 校检文件类型 const fileName = file.name.split("."); const fileExt = fileName[fileName.length - 1]; @@ -378,36 +470,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importSdtb(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -434,6 +517,31 @@ export default { }) .catch(() => {}); }, + //添加表格 + addFile() { + if (this.fileNameS.length <= 0) { + this.fileNameS.push({ + fileName: "", + fileUrl: "", + }); + } else { + if ( + this.fileNameS[this.fileNameS.length - 1].fileUrl != "" && + this.fileNameS[this.fileNameS.length - 1].fileName != "" + ) { + this.fileNameS.push({ + fileName: "", + fileUrl: "", + }); + } else { + this.$modal.msgError("请完整填写上一条"); + } + } + }, + //删除表格 + removeFile(index) { + this.fileNameS.splice(index, 1); + }, /** 查询属地通报列表 */ getList(e) { this.loading = true; @@ -471,7 +579,7 @@ export default { area: null, - isStatus: null, + isStatus: 1, fileName: null, @@ -520,7 +628,12 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); - this.fileNameS = []; + this.fileNameS = [ + { + fileName: "", + fileUrl: "", + }, + ]; this.open = true; this.title = "添加属地通报"; }, @@ -536,8 +649,8 @@ export default { let arr2 = response.data.fileUrl.split(","); arr1.forEach((value, index) => { this.fileNameS.push({ - name: value, - url: arr2[index], + fileName: value, + fileUrl: arr2[index], }); }); } @@ -551,8 +664,10 @@ export default { let arr2 = []; if (this.fileNameS.length > 0) { this.fileNameS.forEach((value) => { - arr1.push(value.name); - arr2.push(value.url); + if (value.fileName && value.fileUrl) { + arr1.push(value.fileName); + arr2.push(value.fileUrl); + } }); this.form.fileName = arr1.join(","); this.form.fileUrl = arr2.join(","); @@ -618,3 +733,55 @@ export default { }, }; + diff --git a/src/views/tcZz/networkSecurity/tbcz/index.vue b/src/views/tcZz/networkSecurity/tbcz/index.vue index 4719b1e..72c17ba 100644 --- a/src/views/tcZz/networkSecurity/tbcz/index.vue +++ b/src/views/tcZz/networkSecurity/tbcz/index.vue @@ -103,20 +103,9 @@ v-hasPermi="['tcZz/networkSecurity:tbcz:export']" >导出 - 导入 - 导入 - 启用 @@ -225,14 +214,44 @@
- - - + + 启用 + 禁用 + + + +
+
+
文件名称
+
文件路径(完整路径)
+
+
+ +
+
+
+
+
+ +
+
+ +
+
+
+ +
+
@@ -243,9 +262,7 @@ - - - + @@ -305,6 +322,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -319,8 +377,7 @@ import { isStatusTbcz, importTbcz, } from "@/api/tcZz/networkSecurity/tbcz"; -import { Loading } from "element-ui"; - +import { getToken } from "@/utils/auth"; export default { name: "Tbcz", //注释字典 @@ -389,12 +446,20 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + isStatus: [{ required: true, message: "请选择启动/禁用", trigger: "blur" }], + unitName: [{ required: true, message: "单位名称不能为空", trigger: "blur" }], + ipAddress: [{ required: true, message: "目标IP/域名不能为空", trigger: "blur" }], + czState: [{ required: true, message: "处置情况不能为空", trigger: "blur" }], + }, fileNameS: [], //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -407,8 +472,26 @@ export default { this.$modal.msgSuccess("修改成功"); }); }, - //导入 - handleBeforeUpload(file) { + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/tbcz/importTemplate", + {}, + `通报处置模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, + //导入 + handleBeforeUpload(file) { // 校检文件类型 const fileName = file.name.split("."); const fileExt = fileName[fileName.length - 1]; @@ -417,36 +500,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importTbcz(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -472,6 +546,31 @@ export default { this.getList(e); }) .catch(() => {}); + }, + //添加表格 + addFile() { + if (this.fileNameS.length <= 0) { + this.fileNameS.push({ + fileName: "", + fileUrl: "", + }); + } else { + if ( + this.fileNameS[this.fileNameS.length - 1].fileUrl != "" && + this.fileNameS[this.fileNameS.length - 1].fileName != "" + ) { + this.fileNameS.push({ + fileName: "", + fileUrl: "", + }); + } else { + this.$modal.msgError("请完整填写上一条"); + } + } + }, + //删除表格 + removeFile(index) { + this.fileNameS.splice(index, 1); }, /** 查询通报处置列表 */ getList(e) { @@ -510,7 +609,7 @@ export default { areaId: null, - isStatus: null, + isStatus: 1, unitName: null, @@ -565,7 +664,12 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); - this.fileNameS = []; + this.fileNameS = [ + { + fileName: "", + fileUrl: "", + }, + ]; this.open = true; this.title = "添加通报处置"; }, @@ -581,8 +685,8 @@ export default { let arr2 = response.data.fileUrl.split(","); arr1.forEach((value, index) => { this.fileNameS.push({ - name: value, - url: arr2[index], + fileName: value, + fileUrl: arr2[index], }); }); } @@ -596,8 +700,10 @@ export default { let arr2 = []; if (this.fileNameS.length > 0) { this.fileNameS.forEach((value) => { - arr1.push(value.name); - arr2.push(value.url); + if (value.fileName && value.fileUrl) { + arr1.push(value.fileName); + arr2.push(value.fileUrl); + } }); this.form.fileName = arr1.join(","); this.form.fileUrl = arr2.join(","); @@ -663,3 +769,55 @@ export default { }, }; + diff --git a/src/views/tcZz/networkSecurity/tbwc/index.vue b/src/views/tcZz/networkSecurity/tbwc/index.vue index f4b47d8..4bb62dd 100644 --- a/src/views/tcZz/networkSecurity/tbwc/index.vue +++ b/src/views/tcZz/networkSecurity/tbwc/index.vue @@ -26,24 +26,6 @@ @keyup.enter.native="handleQuery" />
- - - - - - - - + + + + + @@ -322,9 +356,9 @@ import { updateXtjc, exportXtjc, isStatusXtjc, - importXtjc + importXtjc, } from "@/api/tcZz/networkSecurity/xtjc"; -import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; export default { name: "Xtjc", @@ -386,11 +420,18 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + isStatus: [ + { required: true, message: "请选择启动/禁用", trigger: "blur" }, + ], + }, //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -403,6 +444,24 @@ export default { this.$modal.msgSuccess("修改成功"); }); }, + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/xtjc/importTemplate", + {}, + `系统监测模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, //导入 handleBeforeUpload(file) { // 校检文件类型 @@ -413,36 +472,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importXtjc(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -506,7 +556,7 @@ export default { areaId: null, - isStatus: null, + isStatus: 1, unitName: null, diff --git a/src/views/tcZz/networkSecurity/zfwz/index.vue b/src/views/tcZz/networkSecurity/zfwz/index.vue index d3fa3c5..4f5414e 100644 --- a/src/views/tcZz/networkSecurity/zfwz/index.vue +++ b/src/views/tcZz/networkSecurity/zfwz/index.vue @@ -95,20 +95,10 @@ v-hasPermi="['tcZz/networkSecurity:zfwz:export']" >导出 - 导入 - 导入 - 启用 @@ -217,14 +207,10 @@ - - - + + 启用 + 禁用 + @@ -289,6 +275,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -303,7 +330,7 @@ import { isStatusZfwz, importZfwz, } from "@/api/tcZz/networkSecurity/zfwz"; -import { Loading } from "element-ui"; +import { getToken } from "@/utils/auth"; export default { name: "Zfwz", //注释字典 @@ -368,11 +395,16 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + isStatus: [{ required: true, message: "请选择启动/禁用", trigger: "blur" }], + }, //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -385,8 +417,26 @@ export default { this.$modal.msgSuccess("修改成功"); }); }, - //导入 - handleBeforeUpload(file) { + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/zfwz/importTemplate", + {}, + `政府网站模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, + //导入 + handleBeforeUpload(file) { // 校检文件类型 const fileName = file.name.split("."); const fileExt = fileName[fileName.length - 1]; @@ -395,36 +445,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importZfwz(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -488,7 +529,7 @@ export default { areaId: null, - isStatus: null, + isStatus: 1, webUrl: null, diff --git a/src/views/tcZz/networkSecurity/zxyh/index.vue b/src/views/tcZz/networkSecurity/zxyh/index.vue index c323981..97b43b8 100644 --- a/src/views/tcZz/networkSecurity/zxyh/index.vue +++ b/src/views/tcZz/networkSecurity/zxyh/index.vue @@ -103,20 +103,9 @@ v-hasPermi="['tcZz/networkSecurity:zxyh:export']" >导出 - 导入 - 导入 - 启用 @@ -225,14 +214,44 @@
- - - + + 启用 + 禁用 + + + +
+
+
文件名称
+
文件路径(完整路径)
+
+
+ +
+
+
+
+
+ +
+
+ +
+
+
+ +
+
@@ -246,9 +265,7 @@ - - - + @@ -312,6 +329,47 @@ }} + + +
导入
+ + +
将文件拖到此处,或点击上传
+
+ 仅允许导入xls、xlsx格式文件。 + 下载模板 +
+
+ +
@@ -326,8 +384,7 @@ import { isStatusZxyh, importZxyh, } from "@/api/tcZz/networkSecurity/zxyh"; -import { Loading } from "element-ui"; - +import { getToken } from "@/utils/auth"; export default { name: "Zxyh", //注释字典 @@ -398,12 +455,27 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + unitName: [ + { required: true, message: "单位名称不能为空", trigger: "blur" }, + ], + yhName: [ + { required: true, message: "隐患名称不能为空", trigger: "blur" }, + ], + areaId: [{ required: true, message: "请选择区域", trigger: "blur" }], + + isStatus: [ + { required: true, message: "请选择启动/禁用", trigger: "blur" }, + ], + }, fileNameS: [], //=========== fileList: [], limit: 1, accept: ".xls,.xlsx", + fileOpen: false, + headers: { Authorization: "Bearer " + getToken() }, }; }, created() { @@ -416,8 +488,26 @@ export default { this.$modal.msgSuccess("修改成功"); }); }, - //导入 - handleBeforeUpload(file) { + //下载模板 + importTemplate() { + this.download( + "/tcZz/networkSecurity/zxyh/importTemplate", + {}, + `最新隐患模板.xlsx` + ); + }, + //导入 + importFiles() { + this.fileOpen = true; + }, + submitFile() { + this.$refs.upload.submit(); + }, + cancelFile() { + this.fileOpen = false; + }, + //导入 + handleBeforeUpload(file) { // 校检文件类型 const fileName = file.name.split("."); const fileExt = fileName[fileName.length - 1]; @@ -426,36 +516,27 @@ export default { this.$modal.msgError(`文件格式不正确, 请上传${this.accept}格式文件!`); return false; } - // 校检文件大小 - const isLt = file.size / 1024 / 1024 < 5; - if (!isLt) { - this.$modal.msgError(`上传文件大小不能超过5 MB!`); - return false; - } }, handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, handleFile(data) { - let downloadLoadingInstance = Loading.service({ - text: "正在导入数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + this.$modal.loading(); let form = new FormData(); form.append("file", data.file); importZxyh(form) .then((res) => { - this.getList(); - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); this.$modal.msgSuccess("导入成功"); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }) .catch(() => { - downloadLoadingInstance.close(); + this.fileOpen = false; + this.$modal.closeLoading(); + this.$refs.upload.clearFiles(); this.getList(); - this.fileList = []; }); }, //批量启用 @@ -481,6 +562,31 @@ export default { this.getList(e); }) .catch(() => {}); + }, + //添加表格 + addFile() { + if (this.fileNameS.length <= 0) { + this.fileNameS.push({ + fileName: "", + fileUrl: "", + }); + } else { + if ( + this.fileNameS[this.fileNameS.length - 1].fileUrl != "" && + this.fileNameS[this.fileNameS.length - 1].fileName != "" + ) { + this.fileNameS.push({ + fileName: "", + fileUrl: "", + }); + } else { + this.$modal.msgError("请完整填写上一条"); + } + } + }, + //删除表格 + removeFile(index) { + this.fileNameS.splice(index, 1); }, /** 查询最新隐患列表 */ getList(e) { @@ -519,7 +625,7 @@ export default { areaId: null, - isStatus: null, + isStatus: 1, unitName: null, @@ -576,7 +682,12 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); - this.fileNameS = []; + this.fileNameS = [ + { + fileName: "", + fileUrl: "", + }, + ]; this.open = true; this.title = "添加最新隐患"; }, @@ -592,8 +703,8 @@ export default { let arr2 = response.data.fileUrl.split(","); arr1.forEach((value, index) => { this.fileNameS.push({ - name: value, - url: arr2[index], + fileName: value, + fileUrl: arr2[index], }); }); } @@ -607,8 +718,10 @@ export default { let arr2 = []; if (this.fileNameS.length > 0) { this.fileNameS.forEach((value) => { - arr1.push(value.name); - arr2.push(value.url); + if (value.fileName && value.fileUrl) { + arr1.push(value.fileName); + arr2.push(value.fileUrl); + } }); this.form.fileName = arr1.join(","); this.form.fileUrl = arr2.join(","); @@ -674,3 +787,55 @@ export default { }, }; + \ No newline at end of file