<template> <div class="app-container"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" > <el-form-item label="数据类型" prop="type"> <el-select v-model="queryParams.type" placeholder="请选择数据类型" clearable filterable > <el-option v-for="dict in typeList" :key="dict.value + 'typeList'" :label="dict.label" :value="dict.value" /> </el-select> </el-form-item> <el-form-item label="状态" prop="status"> <el-select v-model="queryParams.status" placeholder="请选择状态" clearable filterable > <el-option v-for="dict in statusList" :key="dict.value + 'statusList'" :label="dict.label" :value="dict.value" /> </el-select> </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" >搜索</el-button > <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" >重置</el-button > </el-form-item> </el-form> <el-row :gutter="10" class="mb8"> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" ></right-toolbar> </el-row> <el-table :data="GATHERWARNINGList" @selection-change="handleSelectionChange" > <!-- <el-table-column type="selection" width="55" align="center" /> --> <el-table-column label="数据类型" align="center" prop="type"> <template slot-scope="scope"> <span v-if="scope.row.type == 0">量化指标数据</span> <span v-else-if="scope.row.type == 1">月报表数据</span> </template> </el-table-column> <el-table-column label="异常数据名称" align="center" prop="gatherFeeName"> <template slot-scope="scope"> {{ scope.row.gatherFeeName }} </template> </el-table-column> <el-table-column label="异常详细数据值" align="center" prop="errValue"> <template slot-scope="scope"> {{ scope.row.errValue }} </template> </el-table-column> <el-table-column label="处置人" align="center" prop="dealBy"> <template slot-scope="scope"> {{ scope.row.dealBy }} </template> </el-table-column> <el-table-column label="处置时间" align="center" prop="dealTime"> <template slot-scope="scope"> {{ scope.row.dealTime }} </template> </el-table-column> <el-table-column label="状态" align="center" prop="cancelBy"> <template slot-scope="scope"> <el-tag v-if="scope.row.status == 0" type="danger">预警</el-tag> <el-tag v-else-if="scope.row.status == 1" type="success">已解除</el-tag> <el-tag v-else-if="scope.row.status == 2" type="info">已取消</el-tag> </template> </el-table-column> <el-table-column label="取消人" align="center" prop="cancelBy"> <template slot-scope="scope"> {{ scope.row.cancelBy }} </template> </el-table-column> <el-table-column label="取消时间" align="center" prop="cancelTime"> <template slot-scope="scope"> {{ scope.row.cancelTime }} </template> </el-table-column> <el-table-column label="备注" align="center" prop="remark"> <template slot-scope="scope"> {{ scope.row.remark }} </template> </el-table-column> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" > <!-- 状态是“已解除”时不显示 --> <template slot-scope="scope" v-if="scope.row.status != '1'"> <el-popconfirm title="确定处理吗?" @confirm="handleDeal(scope.row)"> <el-button size="mini" type="text" slot="reference" v-hasPermi="['business:GATHERWARNING:edit']" >处理</el-button > </el-popconfirm> <el-popconfirm title="确定取消吗?" @confirm="handleCancel(scope.row)" > <el-button style="margin-left: 5px;" size="mini" type="text" slot="reference" v-hasPermi="['business:GATHERWARNING:remove']" >取消</el-button > </el-popconfirm> </template> </el-table-column> </el-table> <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> <!-- 添加或修改数据采集预警对话框 --> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <!-- <el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form-item label="数据类型(0=量化指标数据,1=月报表数据)" prop="type"> <el-select v-model="form.type" placeholder="请选择数据类型(0=量化指标数据,1=月报表数据)" filterable> <el-option v-for="dict in dict.type.${dictType}" :key="dict.value" :label="dict.label" :value="dict.value" ></el-option> </el-select> </el-form-item> </el-form> --> <div slot="footer" class="dialog-footer"> <el-button type="primary" @click="submitForm">确 定</el-button> <el-button @click="cancel">取 消</el-button> </div> </el-dialog> </div> </template> <script> import { listGATHERWARNING, getGATHERWARNING, delGATHERWARNING, addGATHERWARNING, updateGATHERWARNING, deal, cancel, } from "@/api/portal/GATHERWARNING/GATHERWARNING.js"; export default { name: "GATHERWARNING", data() { return { typeList: [ { label: "量化指标数据", value: "0" }, { label: "月报表数据", value: "1" }, ], //状态(0=预警,1=已解除,2已取消) statusList: [ { label: "预警", value: "0" }, { label: "已解除", value: "1" }, { label: "已取消", value: "2" }, ], // 根路径 baseURL: process.env.VUE_APP_BASE_API, // 遮罩层 loading: true, // 选中数组 ids: [], // 非单个禁用 single: true, // 非多个禁用 multiple: true, // 显示搜索条件 showSearch: true, // 总条数 total: 0, // 数据采集预警表格数据 GATHERWARNINGList: [], // 弹出层标题 title: "", // 是否显示弹出层 open: false, // 查询参数 queryParams: { pageNum: 1, pageSize: 10, id: null, createTime: null, createBy: null, updateTime: null, updateBy: null, delFlag: null, deptId: null, type: null, getherId: null, getherfeeId: null, errValue: null, dealBy: null, dealTime: null, cancelBy: null, cancelTime: null, remark: null, }, // 表单参数 form: {}, // 表单校验 rules: { id: [{ required: true, message: "$comment不能为空", trigger: "blur" }], delFlag: [ { required: true, message: "删除标识不能为空", trigger: "blur" }, ], deptId: [ { required: true, message: "部门id不能为空", trigger: "blur" }, ], type: [ { required: true, message: "数据类型(0=量化指标数据,1=月报表数据)不能为空", trigger: "change", }, ], getherId: [ { required: true, message: "异常数据id不能为空", trigger: "blur" }, ], getherfeeId: [ { required: true, message: "异常详细数据id不能为空", trigger: "blur", }, ], errValue: [ { required: true, message: "异常详细数据值不能为空", trigger: "blur", }, ], dealBy: [ { required: true, message: "处置人不能为空", trigger: "blur" }, ], dealTime: [ { required: true, message: "处置时间不能为空", trigger: "blur" }, ], cancelBy: [ { required: true, message: "取消人不能为空", trigger: "blur" }, ], cancelTime: [ { required: true, message: "取消时间不能为空", trigger: "blur" }, ], remark: [{ required: true, message: "备注不能为空", trigger: "blur" }], }, }; }, created() { this.getList(); }, methods: { /** 查询数据采集预警列表 */ getList() { this.loading = true; listGATHERWARNING(this.queryParams).then((response) => { this.GATHERWARNINGList = response.rows; this.total = response.total; this.loading = false; }); }, //处理预警 handleDeal(row) { deal(row.id).then((res) => { this.$modal.msgSuccess("处理成功"); this.getList(); }); }, //取消预警 handleCancel(row) { cancel(row.id).then((res) => { this.$modal.msgSuccess("取消成功"); this.getList(); }); }, // 取消按钮 cancel() { this.open = false; this.reset(); }, // 表单重置 reset() { this.form = { id: null, delFlag: null, deptId: null, type: null, getherId: null, getherfeeId: null, errValue: null, dealBy: null, dealTime: null, cancelBy: null, cancelTime: 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; }, /** 新增按钮操作 */ handleAdd() { this.reset(); this.open = true; this.title = "添加数据采集预警"; }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); const id = row.id || this.ids; getGATHERWARNING(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) { updateGATHERWARNING(this.form).then((response) => { this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addGATHERWARNING(this.form).then((response) => { this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); } } }); }, /** 删除按钮操作 */ handleDelete(row) { const ids = row.id || this.ids; this.$modal .confirm('是否确认删除数据采集预警编号为"' + ids + '"的数据项?') .then(function () { return delGATHERWARNING(ids); }) .then(() => { this.getList(); this.$modal.msgSuccess("删除成功"); }) .catch(() => {}); }, /** 导出按钮操作 */ handleExport() { this.download( "business/GATHERWARNING/export", { ...this.queryParams, }, `GATHERWARNING_${new Date().getTime()}.xlsx` ); }, }, }; </script>