test #47

Merged
gtz217 merged 273 commits from test into master 2023-10-17 08:53:54 +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: { form: {
get() { get() {
if (this.dataLoaded) return this.dataForm; // if (this.dataLoaded) return this.dataForm;
else return {} // else return {}
return this.dataForm;
}, },
set(val) { set(val) {
console.log('set form', val); console.log('set form', val);
@ -228,6 +229,7 @@ export default {
})) }))
); );
} else if (opt.input) { } else if (opt.input) {
console.log('setting code: ', response.data)
// //
this.form[opt.prop] = response.data; this.form[opt.prop] = response.data;
} }

View File

@ -88,7 +88,10 @@ export const DICT_TYPE = {
PRODUCT_TYPE: 'product_type', PRODUCT_TYPE: 'product_type',
// ============== ENERGY - 能源模块 ============= // ============== 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: 'code', label: '检测分组编码', align: 'center' },
{ prop: 'remark', label: '备注', align: 'center' }, { prop: 'remark', label: '备注', align: 'center' },
{ {
action: 'show-alert', _action: 'equipment-group-show-alert',
label: '报警', label: '报警',
align: 'center', align: 'center',
subcomponent: { subcomponent: {
@ -103,8 +103,9 @@ export default {
click: function () { click: function () {
console.log('inejctdata', _this.injectData); console.log('inejctdata', _this.injectData);
_this.$emit('emitData', { _this.$emit('emitData', {
action: _this.injectData.action, action: _this.injectData._action,
value: _this.injectData.id, // value: _this.injectData.id,
value: _this.injectData,
}); });
}, },
}, },
@ -202,6 +203,27 @@ export default {
this.getList(); this.getList();
}, },
methods: { 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() { getList() {
this.loading = true; this.loading = true;

View File

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