From 41b983675955f52ac3778c0115ac6d16f0de1cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AE=8F=E6=9D=B0?= <1943105267@qq.com> Date: Wed, 16 Aug 2023 16:38:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/zongzhi/netSecurity/tb/index.js | 53 +++ src/assets/styles/element-variables.scss | 2 +- src/views/netSecurity/tb/index.vue | 495 ++++++++++++++++++++++- 3 files changed, 545 insertions(+), 5 deletions(-) diff --git a/src/api/zongzhi/netSecurity/tb/index.js b/src/api/zongzhi/netSecurity/tb/index.js index e69de29..2a402e6 100644 --- a/src/api/zongzhi/netSecurity/tb/index.js +++ b/src/api/zongzhi/netSecurity/tb/index.js @@ -0,0 +1,53 @@ +import request from "@/utils/request"; + +// 查询通报列表 +export function listTb(query) { + return request({ + url: "/zongzhi/tb/list", + method: "get", + params: query, + }); +} + +// 查询通报详细 +export function getTb(id) { + return request({ + url: "/zongzhi/tb/" + id, + method: "get", + }); +} + +// 新增通报 +export function addTb(data) { + return request({ + url: "/zongzhi/tb", + method: "post", + data: data, + }); +} + +// 修改通报 +export function updateTb(data) { + return request({ + url: "/zongzhi/tb", + method: "put", + data: data, + }); +} + +// 删除通报 +export function delTb(id) { + return request({ + url: "/zongzhi/tb/" + id, + method: "delete", + }); +} + +// 导出通报 +export function exportTb(data) { + return request({ + url: "/zongzhi/tb/export", + method: "post", + data, + }); +} diff --git a/src/assets/styles/element-variables.scss b/src/assets/styles/element-variables.scss index 1572dc3..3849c5d 100644 --- a/src/assets/styles/element-variables.scss +++ b/src/assets/styles/element-variables.scss @@ -8,7 +8,7 @@ $--color-primary: #1890ff; $--color-success: #13ce66; $--color-warning: #ffba00; $--color-danger: #ff4949; -$--color-info: #1e1e1e; +// $--color-info: #1e1e1e; $--button-font-weight: 400; diff --git a/src/views/netSecurity/tb/index.vue b/src/views/netSecurity/tb/index.vue index f4f306c..02f83ac 100644 --- a/src/views/netSecurity/tb/index.vue +++ b/src/views/netSecurity/tb/index.vue @@ -1,9 +1,496 @@ +import { mapGetters } from "vuex"; +import { + listTb, + getTb, + delTb, + addTb, + updateTb, + exportTb, +} from "@/api/zongzhi/netSecurity/tb/index.js"; +export default { + computed: { + ...mapGetters(["townList"]), + }, + name: "Tb", + //注释字典 + dicts: ["tc_tb_type"], + data() { + return { + tableHeigth: 0, + //查看详情 + infoOpen: false, + //详情标题 + infoTitle: "", + // 遮罩层 + loading: true, + // 导出遮罩层 + exportLoading: false, + // 选中数组 + ids: [], + // 非单个禁用 + single: true, + // 非多个禁用 + multiple: true, + // 显示搜索条件 + showSearch: true, + // 总条数 + total: 0, + // 通报表格数据 + tbList: [], + // 弹出层标题 + title: "", + // 是否显示弹出层 + open: false, + // 查询参数 + queryParams: { + pageNum: 1, + pageSize: 10, + depName: null, + + locationName: null, + + tbType: null, + + tbTime: null, + }, + // 表单参数 + form: {}, + // 表单校验 + rules: {}, + }; + }, + created() { + // //给表格一个固定值 + this.$nextTick(() => { + this.tableHeigth = + this.$refs.main.offsetHeight - + (this.$refs.topSearch.offsetHeight + + this.$refs.tableTool.offsetHeight) - + 46; + this.getList(); + }); + }, + methods: { + /** 查询通报列表 */ + getList() { + this.loading = true; + listTb(this.queryParams).then((response) => { + this.tbList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 取消按钮 + cancel() { + this.open = false; + this.reset(); + }, + // 表单重置 + reset() { + this.form = { + id: null, - + areaId: null, + + depName: null, + + locationName: null, + + tbType: null, + + tbTime: null, + + createId: null, + + createBy: null, + + createTime: null, + + updateId: null, + + updateBy: null, + + updateTime: null, + + remark: null, + }; + this.resetForm("form"); + }, + /** 搜索按钮操作 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 多选框选中数据 + handleSelectionChange(selection) { + this.ids = selection.map((item) => item.id); + this.single = selection.length !== 1; + this.multiple = !selection.length; + }, + /**查看按钮操作 */ + handleInfo(row) { + this.reset(); + const id = row.id || this.ids; + getTb(id).then((response) => { + this.form = response.data; + this.infoOpen = true; + this.infoTitle = "查看通报详情"; + }); + }, + /** 新增按钮操作 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "添加通报"; + }, + /** 修改按钮操作 */ + handleUpdate(row) { + this.reset(); + const id = row.id || this.ids; + getTb(id).then((response) => { + this.form = response.data; + this.open = true; + this.title = "修改通报"; + }); + }, + /** 提交按钮 */ + submitForm() { + this.$refs["form"].validate((valid) => { + if (valid) { + if (this.form.id != null) { + updateTb(this.form).then((response) => { + this.$modal.msgSuccess("修改成功"); + this.open = false; + this.getList(); + }); + } else { + addTb(this.form).then((response) => { + this.$modal.msgSuccess("新增成功"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 删除按钮操作 */ + handleDelete(row) { + const ids = row.id || this.ids; + this.$confirm('是否确认删除通报编号为"' + ids + '"的数据项?', "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(function () { + return delTb(ids); + }) + .then(() => { + this.getList(); + this.msgSuccess("删除成功"); + }) + .catch(() => {}); + }, + /** 导出按钮操作 */ + handleExport() { + const queryParams = this.queryParams; + this.$confirm("是否确认导出所有通报数据项?", "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + this.download( + "/zongzhi/tb/export", + { + ...this.queryParams, + }, + "通报_" + new Date().getTime() + ".xlsx" + ); + this.exportLoading = false; + }) + .catch(() => {}); + }, + }, +}; +