2023-08-10 16:52:47 +08:00
|
|
|
|
<template>
|
2023-08-28 10:47:05 +08:00
|
|
|
|
<div class="app-container">
|
|
|
|
|
<!-- 搜索工作栏 -->
|
2023-08-28 14:56:56 +08:00
|
|
|
|
<SearchBar
|
|
|
|
|
:formConfigs="searchBarFormConfig"
|
|
|
|
|
ref="search-bar"
|
|
|
|
|
@headBtnClick="handleSearchBarBtnClick" />
|
2023-08-10 16:52:47 +08:00
|
|
|
|
|
2023-08-28 10:47:05 +08:00
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<base-table
|
|
|
|
|
:table-props="tableProps"
|
|
|
|
|
:page="queryParams.pageNo"
|
|
|
|
|
:limit="queryParams.pageSize"
|
|
|
|
|
:table-data="list"
|
|
|
|
|
@emitFun="handleEmitFun">
|
|
|
|
|
<method-btn
|
|
|
|
|
v-if="tableBtn.length"
|
|
|
|
|
slot="handleBtn"
|
|
|
|
|
label="操作"
|
|
|
|
|
:method-list="tableBtn"
|
|
|
|
|
@clickBtn="handleTableBtnClick" />
|
|
|
|
|
</base-table>
|
2023-08-10 16:52:47 +08:00
|
|
|
|
|
2023-08-28 10:47:05 +08:00
|
|
|
|
<!-- 分页组件 -->
|
|
|
|
|
<pagination
|
|
|
|
|
v-show="total > 0"
|
|
|
|
|
:total="total"
|
|
|
|
|
:page.sync="queryParams.pageNo"
|
|
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
|
|
@pagination="getList" />
|
2023-08-10 16:52:47 +08:00
|
|
|
|
|
2023-08-28 10:47:05 +08:00
|
|
|
|
<!-- 对话框(添加 / 修改) -->
|
|
|
|
|
<base-dialog
|
|
|
|
|
:dialogTitle="title"
|
|
|
|
|
:dialogVisible="open"
|
2023-08-28 14:56:56 +08:00
|
|
|
|
width="736px"
|
2023-08-28 10:47:05 +08:00
|
|
|
|
@close="cancel"
|
|
|
|
|
@cancel="cancel"
|
|
|
|
|
@confirm="submitForm">
|
|
|
|
|
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
|
|
|
|
|
</base-dialog>
|
|
|
|
|
</div>
|
2023-08-10 16:52:47 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2023-08-28 10:47:05 +08:00
|
|
|
|
import {
|
|
|
|
|
createEquipmentGroupAlarm,
|
|
|
|
|
updateEquipmentGroupAlarm,
|
|
|
|
|
deleteEquipmentGroupAlarm,
|
|
|
|
|
getEquipmentGroupAlarm,
|
|
|
|
|
getEquipmentGroupAlarmPage,
|
|
|
|
|
exportEquipmentGroupAlarmExcel,
|
|
|
|
|
} from '@/api/base/equipmentGroupAlarm';
|
|
|
|
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
|
|
|
|
import moment from 'moment';
|
2023-08-28 14:56:56 +08:00
|
|
|
|
import { publicFormatter } from '@/utils/dict';
|
2023-08-10 16:52:47 +08:00
|
|
|
|
|
|
|
|
|
export default {
|
2023-08-28 10:47:05 +08:00
|
|
|
|
name: 'EquipmentGroupAlarm',
|
|
|
|
|
components: {},
|
|
|
|
|
mixins: [basicPageMixin],
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
searchBarKeys: [''],
|
|
|
|
|
tableBtn: [
|
|
|
|
|
this.$auth.hasPermi('base:equipment-group-alarm:update')
|
|
|
|
|
? {
|
|
|
|
|
type: 'edit',
|
|
|
|
|
btnName: '修改',
|
|
|
|
|
}
|
|
|
|
|
: undefined,
|
|
|
|
|
this.$auth.hasPermi('base:equipment-group-alarm:delete')
|
|
|
|
|
? {
|
|
|
|
|
type: 'delete',
|
|
|
|
|
btnName: '删除',
|
|
|
|
|
}
|
|
|
|
|
: undefined,
|
|
|
|
|
].filter((v) => v),
|
|
|
|
|
tableProps: [
|
|
|
|
|
{
|
|
|
|
|
prop: 'createTime',
|
|
|
|
|
label: '添加时间',
|
|
|
|
|
fixed: true,
|
|
|
|
|
width: 180,
|
|
|
|
|
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
|
|
|
|
},
|
|
|
|
|
{ prop: 'code', label: '报警编码', align: 'center' },
|
|
|
|
|
{ prop: 'type', label: '报警类型', align: 'center' },
|
2023-08-28 14:56:56 +08:00
|
|
|
|
{
|
|
|
|
|
prop: 'grade',
|
|
|
|
|
label: '报警级别',
|
|
|
|
|
align: 'center',
|
|
|
|
|
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
|
|
|
|
|
},
|
2023-08-28 10:47:05 +08:00
|
|
|
|
{ prop: 'alarmCode', label: '设备报警编码', align: 'center' },
|
|
|
|
|
{ prop: 'plcParamName', label: '参数列名', align: 'center' },
|
|
|
|
|
{ prop: 'alarmContent', label: '报警内容', align: 'center' },
|
|
|
|
|
],
|
|
|
|
|
searchBarFormConfig: [
|
|
|
|
|
{
|
|
|
|
|
type: 'input',
|
|
|
|
|
label: '设备分组编码',
|
|
|
|
|
placeholder: '/',
|
|
|
|
|
param: 'equipmentGroupCode',
|
2023-08-28 14:56:56 +08:00
|
|
|
|
defaultSelect: null,
|
|
|
|
|
disabled: true,
|
2023-08-28 10:47:05 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'input',
|
|
|
|
|
label: '设备分组名称',
|
|
|
|
|
placeholder: '/',
|
|
|
|
|
param: 'equipmentGroupName',
|
2023-08-28 14:56:56 +08:00
|
|
|
|
defaultSelect: null,
|
|
|
|
|
disabled: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: this.$auth.hasPermi('base:equipment-group-alarm:create')
|
|
|
|
|
? 'button'
|
|
|
|
|
: '',
|
|
|
|
|
btnName: '新增',
|
|
|
|
|
name: 'add',
|
|
|
|
|
plain: true,
|
|
|
|
|
color: 'success',
|
2023-08-28 10:47:05 +08:00
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
rows: [
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
input: true,
|
|
|
|
|
label: '报警编码', // 自动生成
|
|
|
|
|
prop: 'code',
|
2023-08-28 14:56:56 +08:00
|
|
|
|
url: '/base/equipment-group-alarm/getCode',
|
2023-08-28 10:47:05 +08:00
|
|
|
|
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
|
|
|
|
},
|
|
|
|
|
{
|
2023-08-28 14:56:56 +08:00
|
|
|
|
select: true,
|
2023-08-28 10:47:05 +08:00
|
|
|
|
label: '报警类型', // 固定选项
|
|
|
|
|
prop: 'type',
|
|
|
|
|
options: [
|
2023-08-28 14:56:56 +08:00
|
|
|
|
{ label: '布尔型', value: 2 },
|
2023-08-28 10:47:05 +08:00
|
|
|
|
{ label: '字符型', value: 1 },
|
|
|
|
|
],
|
2023-08-28 14:56:56 +08:00
|
|
|
|
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
2023-08-28 10:47:05 +08:00
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
select: true,
|
|
|
|
|
label: '报警级别', // 字典
|
|
|
|
|
prop: 'grade',
|
|
|
|
|
options: this.getDictDatas(this.DICT_TYPE.EQU_ALARM_LEVEL),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
input: true,
|
|
|
|
|
label: '设备报警编码', // 对应到设备实际的报警编码
|
|
|
|
|
prop: 'alarmCode',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
input: true,
|
|
|
|
|
label: '参数列名', // 在实时数据库的列名
|
|
|
|
|
prop: 'plcParamName',
|
|
|
|
|
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
input: true,
|
|
|
|
|
label: '报警内容',
|
|
|
|
|
prop: 'alarmContent',
|
|
|
|
|
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
// 是否显示弹出层
|
|
|
|
|
open: false,
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
equipmentGroupId: null,
|
|
|
|
|
},
|
|
|
|
|
// 表单参数
|
2023-08-28 14:56:56 +08:00
|
|
|
|
form: {
|
|
|
|
|
id: undefined,
|
|
|
|
|
equipmentGroupId: undefined,
|
|
|
|
|
code: undefined,
|
|
|
|
|
type: undefined,
|
|
|
|
|
grade: undefined,
|
|
|
|
|
alarmCode: undefined,
|
|
|
|
|
alarmContent: undefined,
|
|
|
|
|
plcParamName: undefined,
|
|
|
|
|
},
|
2023-08-28 10:47:05 +08:00
|
|
|
|
// // 表单校验
|
|
|
|
|
// rules: {
|
|
|
|
|
// equipmentGroupId: [{ required: true, message: "设备分组ID,关联base_equipment_group不能为空", trigger: "blur" }],
|
|
|
|
|
// type: [{ required: true, message: "报警类型:1.字符型,2.布尔型不能为空", trigger: "change" }],
|
|
|
|
|
// alarmContent: [{ required: true, message: "报警内容 该条报警具体的解释不能为空", trigger: "blur" }],
|
|
|
|
|
// plcParamName: [{ required: true, message: "关联编码,对应到plc_param_name的编码,用于链接数采不能为空", trigger: "blur" }],
|
|
|
|
|
// }
|
|
|
|
|
};
|
|
|
|
|
},
|
2023-08-28 14:56:56 +08:00
|
|
|
|
// watch: {
|
|
|
|
|
// $route(value) {
|
|
|
|
|
// console.log('new route info', value)
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// created() {
|
|
|
|
|
// this.getList();
|
|
|
|
|
// },
|
|
|
|
|
activated() {
|
|
|
|
|
// 设置顶部搜索栏信息
|
|
|
|
|
const { equipmentGroupName, equipmentGroupCode, equipmentGroupId } =
|
|
|
|
|
this.$route.params;
|
|
|
|
|
this.setSearchBarFormValue('equipmentGroupName', equipmentGroupName);
|
|
|
|
|
this.setSearchBarFormValue('equipmentGroupCode', equipmentGroupCode);
|
|
|
|
|
this.queryParams.equipmentGroupId = equipmentGroupId;
|
|
|
|
|
// if (!equipmentGroupId) this.getList(); // 拦截
|
2023-08-28 10:47:05 +08:00
|
|
|
|
this.getList();
|
|
|
|
|
},
|
2023-08-28 14:56:56 +08:00
|
|
|
|
deactivated() {
|
|
|
|
|
this.setSearchBarFormValue('equipmentGroupName', null);
|
|
|
|
|
this.setSearchBarFormValue('equipmentGroupCode', null);
|
|
|
|
|
this.queryParams.equipmentGroupId = null;
|
|
|
|
|
},
|
2023-08-28 10:47:05 +08:00
|
|
|
|
methods: {
|
2023-08-28 14:56:56 +08:00
|
|
|
|
/** 设置 searchBarForm 的默认值 - 用得比较少 */
|
|
|
|
|
setSearchBarFormValue(param, value) {
|
|
|
|
|
this.searchBarFormConfig.forEach((config) => {
|
|
|
|
|
if (config.param == param) {
|
|
|
|
|
config.defaultSelect = value;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2023-08-28 10:47:05 +08:00
|
|
|
|
/** 查询列表 */
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
// 执行查询
|
|
|
|
|
getEquipmentGroupAlarmPage(this.queryParams).then((response) => {
|
|
|
|
|
this.list = response.data.list;
|
|
|
|
|
this.total = response.data.total;
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 取消按钮 */
|
|
|
|
|
cancel() {
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
|
|
|
|
/** 表单重置 */
|
|
|
|
|
reset() {
|
|
|
|
|
this.form = {
|
|
|
|
|
id: undefined,
|
|
|
|
|
equipmentGroupId: undefined,
|
|
|
|
|
code: undefined,
|
|
|
|
|
type: undefined,
|
|
|
|
|
grade: undefined,
|
|
|
|
|
alarmCode: undefined,
|
|
|
|
|
alarmContent: undefined,
|
|
|
|
|
plcParamName: undefined,
|
|
|
|
|
};
|
|
|
|
|
this.resetForm('form');
|
|
|
|
|
},
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.queryParams.pageNo = 1;
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
resetQuery() {
|
|
|
|
|
this.resetForm('queryForm');
|
|
|
|
|
this.handleQuery();
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
handleAdd() {
|
2023-08-28 14:56:56 +08:00
|
|
|
|
if (this.queryParams.equipmentGroupId == null)
|
|
|
|
|
return this.$message.error('没有检测到设备分组信息');
|
2023-08-28 10:47:05 +08:00
|
|
|
|
this.reset();
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = '添加设备分组报警明细';
|
|
|
|
|
},
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
this.reset();
|
|
|
|
|
const id = row.id;
|
|
|
|
|
getEquipmentGroupAlarm(id).then((response) => {
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = '修改设备分组报警明细';
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
this.$refs['form'].validate((valid) => {
|
|
|
|
|
if (!valid) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 修改的提交
|
|
|
|
|
if (this.form.id != null) {
|
2023-08-28 14:56:56 +08:00
|
|
|
|
updateEquipmentGroupAlarm({
|
|
|
|
|
...this.form,
|
|
|
|
|
equipmentGroupId: this.queryParams.equipmentGroupId,
|
|
|
|
|
}).then((response) => {
|
2023-08-28 10:47:05 +08:00
|
|
|
|
this.$modal.msgSuccess('修改成功');
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 添加的提交
|
2023-08-28 14:56:56 +08:00
|
|
|
|
createEquipmentGroupAlarm({
|
|
|
|
|
...this.form,
|
|
|
|
|
equipmentGroupId: this.queryParams.equipmentGroupId,
|
|
|
|
|
}).then((response) => {
|
2023-08-28 10:47:05 +08:00
|
|
|
|
this.$modal.msgSuccess('新增成功');
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
const id = row.id;
|
|
|
|
|
this.$modal
|
|
|
|
|
.confirm('是否确认删除设备分组报警明细编号为"' + id + '"的数据项?')
|
|
|
|
|
.then(function () {
|
|
|
|
|
return deleteEquipmentGroupAlarm(id);
|
|
|
|
|
})
|
|
|
|
|
.then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess('删除成功');
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
handleExport() {
|
|
|
|
|
// 处理查询参数
|
|
|
|
|
let params = { ...this.queryParams };
|
|
|
|
|
params.pageNo = undefined;
|
|
|
|
|
params.pageSize = undefined;
|
|
|
|
|
this.$modal
|
|
|
|
|
.confirm('是否确认导出所有设备分组报警明细数据项?')
|
|
|
|
|
.then(() => {
|
|
|
|
|
this.exportLoading = true;
|
|
|
|
|
return exportEquipmentGroupAlarmExcel(params);
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
this.$download.excel(response, '设备分组报警明细.xls');
|
|
|
|
|
this.exportLoading = false;
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
},
|
2023-08-10 16:52:47 +08:00
|
|
|
|
};
|
|
|
|
|
</script>
|