add 设备分组报警
This commit is contained in:
förälder
573192d27a
incheckning
3656a92f63
@ -1,246 +1,290 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
|
||||
<!-- @headBtnClick="handleSearchBarBtnClick" /> -->
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="设备分组ID,关联base_equipment_group" prop="equipmentGroupId">
|
||||
<el-input v-model="queryParams.equipmentGroupId" placeholder="请输入设备分组ID,关联base_equipment_group" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 列表 -->
|
||||
<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>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['base:equipment-group-alarm:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['base:equipment-group-alarm:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="设备分组ID,关联base_equipment_group" align="center" prop="equipmentGroupId" />
|
||||
<el-table-column label="编码" align="center" prop="code" />
|
||||
<el-table-column label="报警类型:1.字符型,2.布尔型" align="center" prop="type" />
|
||||
<el-table-column label="报警级别 字典表关联label_value" align="center" prop="grade">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.EQU_ALARM_LEVEL" :value="scope.row.grade" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="字符型用 对应到设备实际的报警编码 布尔型不用填写" align="center" prop="alarmCode" />
|
||||
<el-table-column label="报警内容 该条报警具体的解释" align="center" prop="alarmContent" />
|
||||
<el-table-column label="关联编码,对应到plc_param_name的编码,用于链接数采" align="center" prop="plcParamName" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['base:equipment-group-alarm:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['base:equipment-group-alarm:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="设备分组ID,关联base_equipment_group" prop="equipmentGroupId">
|
||||
<el-input v-model="form.equipmentGroupId" placeholder="请输入设备分组ID,关联base_equipment_group" />
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="报警类型:1.字符型,2.布尔型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择报警类型:1.字符型,2.布尔型">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="报警级别 字典表关联label_value" prop="grade">
|
||||
<el-select v-model="form.grade" placeholder="请选择报警级别 字典表关联label_value">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.EQU_ALARM_LEVEL)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="字符型用 对应到设备实际的报警编码 布尔型不用填写" prop="alarmCode">
|
||||
<el-input v-model="form.alarmCode" placeholder="请输入字符型用 对应到设备实际的报警编码 布尔型不用填写" />
|
||||
</el-form-item>
|
||||
<el-form-item label="报警内容 该条报警具体的解释" prop="alarmContent">
|
||||
<el-input v-model="form.alarmContent" placeholder="请输入报警内容 该条报警具体的解释" />
|
||||
</el-form-item>
|
||||
<el-form-item label="关联编码,对应到plc_param_name的编码,用于链接数采" prop="plcParamName">
|
||||
<el-input v-model="form.plcParamName" placeholder="请输入关联编码,对应到plc_param_name的编码,用于链接数采" />
|
||||
</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>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
width="500px"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createEquipmentGroupAlarm, updateEquipmentGroupAlarm, deleteEquipmentGroupAlarm, getEquipmentGroupAlarm, getEquipmentGroupAlarmPage, exportEquipmentGroupAlarmExcel } from "@/api/base/equipmentGroupAlarm";
|
||||
import {
|
||||
createEquipmentGroupAlarm,
|
||||
updateEquipmentGroupAlarm,
|
||||
deleteEquipmentGroupAlarm,
|
||||
getEquipmentGroupAlarm,
|
||||
getEquipmentGroupAlarmPage,
|
||||
exportEquipmentGroupAlarmExcel,
|
||||
} from '@/api/base/equipmentGroupAlarm';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import moment from 'moment';
|
||||
|
||||
export default {
|
||||
name: "EquipmentGroupAlarm",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备分组报警明细列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
equipmentGroupId: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
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" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
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() {
|
||||
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) {
|
||||
updateEquipmentGroupAlarm(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createEquipmentGroupAlarm(this.form).then(response => {
|
||||
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(() => {});
|
||||
}
|
||||
}
|
||||
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' },
|
||||
{ prop: 'grade', label: '报警级别', align: 'center' },
|
||||
{ prop: 'alarmCode', label: '设备报警编码', align: 'center' },
|
||||
{ prop: 'plcParamName', label: '参数列名', align: 'center' },
|
||||
{ prop: 'alarmContent', label: '报警内容', align: 'center' },
|
||||
],
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '设备分组编码',
|
||||
placeholder: '/',
|
||||
param: 'equipmentGroupCode',
|
||||
defaultSelect: '1',
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: '设备分组名称',
|
||||
placeholder: '/',
|
||||
param: 'equipmentGroupName',
|
||||
defaultSelect: '2',
|
||||
},
|
||||
],
|
||||
rows: [
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '报警编码', // 自动生成
|
||||
prop: 'code',
|
||||
url: '',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
},
|
||||
{
|
||||
select: true,
|
||||
label: '报警类型', // 固定选项
|
||||
prop: 'type',
|
||||
options: [
|
||||
{ label: '布尔型', value: 2 },
|
||||
{ label: '字符型', value: 1 },
|
||||
],
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
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,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// // 表单校验
|
||||
// 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" }],
|
||||
// }
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
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() {
|
||||
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) {
|
||||
updateEquipmentGroupAlarm(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createEquipmentGroupAlarm(this.form).then((response) => {
|
||||
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(() => {});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Laddar…
Referens i nytt ärende
Block a user