From c55c9c18c3dea5a38f7badd6e6b985bb6d683579 Mon Sep 17 00:00:00 2001 From: dhy1725534722 <1725534722@qq.com> Date: Thu, 19 Oct 2023 10:48:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=20=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/tcZz/netWorkYq/cy.js | 2 +- src/api/tcZz/networkSecurity/ryz.js | 16 + src/views/tcZz/netWorkYq/yqxxltj/index.vue | 6 +- src/views/tcZz/netWorkYq/yqyj/index.vue | 885 ++++++++++--------- src/views/tcZz/networkSecurity/ryz/index.vue | 115 ++- 5 files changed, 620 insertions(+), 404 deletions(-) diff --git a/src/api/tcZz/netWorkYq/cy.js b/src/api/tcZz/netWorkYq/cy.js index 1b5a122..3224249 100644 --- a/src/api/tcZz/netWorkYq/cy.js +++ b/src/api/tcZz/netWorkYq/cy.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询词云列表 export function listCy(query) { return request({ - url: '/tcZz/netWorkYq/cy/list', + url: '/tcZz/netWorkYq/cy/ListNoToken', method: 'get', params: query }) diff --git a/src/api/tcZz/networkSecurity/ryz.js b/src/api/tcZz/networkSecurity/ryz.js index 315aa22..ac1b762 100644 --- a/src/api/tcZz/networkSecurity/ryz.js +++ b/src/api/tcZz/networkSecurity/ryz.js @@ -42,3 +42,19 @@ export function delRyz(id) { method: 'delete' }) } +//批量启用禁用 +export function isStatusRyz(params) { + return request({ + url: '/tcZz/networkSecurity/ryz/isStatus', + method: 'get', + params + }) +} +//通用导入信息 +export function importRyz(data) { + return request({ + url: '/tcZz/networkSecurity/ryz/common/importExcel', + method: 'post', + data + }) +} \ No newline at end of file diff --git a/src/views/tcZz/netWorkYq/yqxxltj/index.vue b/src/views/tcZz/netWorkYq/yqxxltj/index.vue index bc1c6d9..8f8b8b2 100644 --- a/src/views/tcZz/netWorkYq/yqxxltj/index.vue +++ b/src/views/tcZz/netWorkYq/yqxxltj/index.vue @@ -333,7 +333,11 @@ - + diff --git a/src/views/tcZz/netWorkYq/yqyj/index.vue b/src/views/tcZz/netWorkYq/yqyj/index.vue index 1a0f6d8..d6d7d3b 100644 --- a/src/views/tcZz/netWorkYq/yqyj/index.vue +++ b/src/views/tcZz/netWorkYq/yqyj/index.vue @@ -1,8 +1,14 @@ diff --git a/src/views/tcZz/networkSecurity/ryz/index.vue b/src/views/tcZz/networkSecurity/ryz/index.vue index 491a4a8..3d2f351 100644 --- a/src/views/tcZz/networkSecurity/ryz/index.vue +++ b/src/views/tcZz/networkSecurity/ryz/index.vue @@ -99,6 +99,31 @@ v-hasPermi="['tcZz/networkSecurity:ryz:export']" >导出 + + 导入 + + 启用 + 禁用 {{ - selectDictLabel(dict.type.tc_area,form.areaId) + selectDictLabel(dict.type.tc_area, form.areaId) }} {{ - selectDictLabel(dict.type.tc_yrtzlx,form.type) + selectDictLabel(dict.type.tc_yrtzlx, form.type) }} {{ - selectDictLabel(dict.type.tc_start,form.isStatus) + selectDictLabel(dict.type.tc_start, form.isStatus) }} {{ @@ -309,8 +334,11 @@ import { addRyz, updateRyz, exportRyz, + isStatusRyz, + importRyz, } from "@/api/tcZz/networkSecurity/ryz"; import { registerLoading } from "echarts"; +import { Loading } from "element-ui"; export default { name: "Ryz", //注释字典 @@ -382,6 +410,11 @@ export default { form: {}, // 表单校验 rules: {}, + //=========== + uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传文件服务器地址 + fileList: [], + limit: 1, + accept: ".xls,.xlsx", }; }, created() { @@ -389,7 +422,7 @@ export default { }, methods: { /** 查询硬探针、软探针列表 */ - getList() { + getList(e) { this.loading = true; this.queryParams.params = {}; if (null != this.daterangeCreateTime && "" != this.daterangeCreateTime) { @@ -406,6 +439,11 @@ export default { this.ryzList = response.rows; this.total = response.total; this.loading = false; + if (e == 1) { + this.$modal.msgSuccess("启动成功"); + } else if (e == 2) { + this.$modal.msgSuccess("禁用成功"); + } }); }, alter(e) { @@ -414,6 +452,73 @@ export default { this.$modal.msgSuccess("修改成功"); }); }, + //导入 + handleBeforeUpload(file) { + // 校检文件类型 + const fileName = file.name.split("."); + const fileExt = fileName[fileName.length - 1]; + const isTypeOk = this.accept.includes(fileExt); + if (!isTypeOk) { + 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)", + }); + let form = new FormData(); + form.append("file", data.file); + importRyz(form) + .then((res) => { + this.getList(); + downloadLoadingInstance.close(); + this.fileList = []; + this.$modal.msgSuccess("导入成功"); + this.getList(); + }) + .catch(() => { + downloadLoadingInstance.close(); + this.fileList = []; + this.$modal.msgSuccess("导入失败"); + this.getList(); + }); + }, + //批量启用 + enable(row) { + this.isStatusFuc(row, 1); + }, + //批量禁用 + banned(row) { + this.isStatusFuc(row, 2); + }, + isStatusFuc(row, e) { + const ids = row.id || this.ids.join(","); + const src = e == 1 ? "启动" : "禁用"; + this.$confirm("是否确认" + src + '编号为"' + ids + '"的数据项?', "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(function () { + return isStatusRyz({ ids: ids, isStatus: e }); + }) + .then(() => { + this.getList(e); + }) + .catch(() => {}); + }, // 取消按钮 cancel() { this.open = false; @@ -529,7 +634,7 @@ export default { }) .then(() => { this.getList(); - this.msgSuccess("删除成功"); + this.$modal.msgSuccess("删除成功"); }) .catch(() => {}); },