lb #19

Merged
g7hoo merged 80 commits from lb into test 2023-09-11 15:05:16 +08:00
4 changed files with 111 additions and 20 deletions
Showing only changes of commit 4ad325c02c - Show all commits

View File

@ -126,8 +126,9 @@ export default {
},
form: {
get() {
if (this.dataLoaded) return this.dataForm;
else return {}
// if (this.dataLoaded) return this.dataForm;
// else return {}
return this.dataForm;
},
set(val) {
console.log('set form', val);
@ -228,6 +229,7 @@ export default {
}))
);
} else if (opt.input) {
console.log('setting code: ', response.data)
//
this.form[opt.prop] = response.data;
}

View File

@ -88,7 +88,10 @@ export const DICT_TYPE = {
PRODUCT_TYPE: 'product_type',
// ============== ENERGY - 能源模块 =============
ENERGY_UNIT: 'energy_unit'
ENERGY_UNIT: 'energy_unit',
// ============== ENERGY - 能源模块 =============
EQU_ALARM_LEVEL: 'equ_alarm_level'
}
/**

View File

@ -88,7 +88,7 @@ export default {
{ prop: 'code', label: '检测分组编码', align: 'center' },
{ prop: 'remark', label: '备注', align: 'center' },
{
action: 'show-alert',
_action: 'equipment-group-show-alert',
label: '报警',
align: 'center',
subcomponent: {
@ -103,8 +103,9 @@ export default {
click: function () {
console.log('inejctdata', _this.injectData);
_this.$emit('emitData', {
action: _this.injectData.action,
value: _this.injectData.id,
action: _this.injectData._action,
// value: _this.injectData.id,
value: _this.injectData,
});
},
},
@ -202,6 +203,27 @@ export default {
this.getList();
},
methods: {
/** 覆盖 handleEmitFun 的默认实现 */
handleEmitFun({ action, value }) {
const {
id: equipmentGroupId,
name: equipmentGroupName,
code: equipmentGroupCode,
} = value;
switch (action) {
case 'equipment-group-show-alert':
// this.$router.push({ path: '/equipment/base/equipment-group-alarm' });
this.$router.push({
name: 'EquipmentGroupAlarm',
params: {
equipmentGroupId,
equipmentGroupCode,
equipmentGroupName,
},
});
break;
}
},
/** 查询列表 */
getList() {
this.loading = true;

View File

@ -1,8 +1,10 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
<!-- @headBtnClick="handleSearchBarBtnClick" /> -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
@ -31,7 +33,7 @@
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="500px"
width="736px"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
@ -51,6 +53,7 @@ import {
} from '@/api/base/equipmentGroupAlarm';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import moment from 'moment';
import { publicFormatter } from '@/utils/dict';
export default {
name: 'EquipmentGroupAlarm',
@ -83,7 +86,12 @@ export default {
},
{ prop: 'code', label: '报警编码', align: 'center' },
{ prop: 'type', label: '报警类型', align: 'center' },
{ prop: 'grade', label: '报警级别', align: 'center' },
{
prop: 'grade',
label: '报警级别',
align: 'center',
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
},
{ prop: 'alarmCode', label: '设备报警编码', align: 'center' },
{ prop: 'plcParamName', label: '参数列名', align: 'center' },
{ prop: 'alarmContent', label: '报警内容', align: 'center' },
@ -94,14 +102,25 @@ export default {
label: '设备分组编码',
placeholder: '/',
param: 'equipmentGroupCode',
defaultSelect: '1',
defaultSelect: null,
disabled: true,
},
{
type: 'input',
label: '设备分组名称',
placeholder: '/',
param: 'equipmentGroupName',
defaultSelect: '2',
defaultSelect: null,
disabled: true,
},
{
type: this.$auth.hasPermi('base:equipment-group-alarm:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
],
rows: [
@ -110,7 +129,7 @@ export default {
input: true,
label: '报警编码', //
prop: 'code',
url: '',
url: '/base/equipment-group-alarm/getCode',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
{
@ -161,7 +180,16 @@ export default {
equipmentGroupId: null,
},
//
form: {},
form: {
id: undefined,
equipmentGroupId: undefined,
code: undefined,
type: undefined,
grade: undefined,
alarmCode: undefined,
alarmContent: undefined,
plcParamName: undefined,
},
// //
// rules: {
// equipmentGroupId: [{ required: true, message: "IDbase_equipment_group", trigger: "blur" }],
@ -171,10 +199,38 @@ export default {
// }
};
},
created() {
// 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(); //
this.getList();
},
deactivated() {
this.setSearchBarFormValue('equipmentGroupName', null);
this.setSearchBarFormValue('equipmentGroupCode', null);
this.queryParams.equipmentGroupId = null;
},
methods: {
/** 设置 searchBarForm 的默认值 - 用得比较少 */
setSearchBarFormValue(param, value) {
this.searchBarFormConfig.forEach((config) => {
if (config.param == param) {
config.defaultSelect = value;
}
});
},
/** 查询列表 */
getList() {
this.loading = true;
@ -216,6 +272,8 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
if (this.queryParams.equipmentGroupId == null)
return this.$message.error('没有检测到设备分组信息');
this.reset();
this.open = true;
this.title = '添加设备分组报警明细';
@ -238,7 +296,10 @@ export default {
}
//
if (this.form.id != null) {
updateEquipmentGroupAlarm(this.form).then((response) => {
updateEquipmentGroupAlarm({
...this.form,
equipmentGroupId: this.queryParams.equipmentGroupId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
@ -246,7 +307,10 @@ export default {
return;
}
//
createEquipmentGroupAlarm(this.form).then((response) => {
createEquipmentGroupAlarm({
...this.form,
equipmentGroupId: this.queryParams.equipmentGroupId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();