projects/mes-lb #56
@ -277,7 +277,6 @@ export default {
|
||||
} else if (opt.url) {
|
||||
// 如果有 depends,则暂时先不获取,注册一个watcher
|
||||
if (opt.depends) {
|
||||
console.log('[handleOptions] setting watch');
|
||||
this.$watch(
|
||||
() => this.form[opt.depends],
|
||||
(id) => {
|
||||
@ -300,7 +299,7 @@ export default {
|
||||
});
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
immediate: false,
|
||||
}
|
||||
);
|
||||
return;
|
||||
|
@ -32,9 +32,28 @@ export default {
|
||||
updateUrl: '',
|
||||
addUrl: '',
|
||||
pageUrl: '',
|
||||
infoUrl: '',
|
||||
basePath: '',
|
||||
form: {}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
addPath() {
|
||||
return this.basePath + '/create'
|
||||
},
|
||||
updatePath() {
|
||||
return this.basePath + '/update'
|
||||
},
|
||||
deletePath() {
|
||||
return this.basePath + '/delete'
|
||||
},
|
||||
infoPath() {
|
||||
return this.basePath + '/get'
|
||||
},
|
||||
pagePath() {
|
||||
return this.basePath + '/page'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// utils
|
||||
http(url, method, payload) {
|
||||
@ -46,16 +65,16 @@ export default {
|
||||
})
|
||||
},
|
||||
put(payload) {
|
||||
return this.http(this.updateUrl, 'put', payload);
|
||||
return this.http(this.updateUrl == '' ? this.updatePath : this.updateUrl, 'put', payload);
|
||||
},
|
||||
post(payload) {
|
||||
return this.http(this.addUrl, 'post', payload);
|
||||
return this.http(this.addUrl == '' ? this.addPath : this.addUrl, 'post', payload);
|
||||
},
|
||||
recv(payload) {
|
||||
return this.http(this.pageUrl, 'get', payload);
|
||||
return this.http(this.pageUrl == '' ? this.pagePath : this.pageUrl, 'get', payload);
|
||||
},
|
||||
info(payload) {
|
||||
return this.http(this.infoUrl, 'get', payload);
|
||||
return this.http(this.infoUrl == '' ? this.infoPath : this.infoUrl, 'get', payload);
|
||||
},
|
||||
|
||||
|
||||
|
@ -1,22 +1,48 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
|
||||
<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="操作" :width="120" :method-list="tableBtn"
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
:width="120"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog :dialogTitle="title" :dialogVisible="open" @close="cancel" @cancel="cancel" @confirm="submitForm">
|
||||
<DialogForm v-if="open" ref="form" v-model="form" :has-files="true" :rows="rows" />
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm
|
||||
v-if="open"
|
||||
ref="form"
|
||||
v-model="form"
|
||||
:has-files="false"
|
||||
:rows="rows" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
@ -25,32 +51,24 @@
|
||||
import moment from 'moment';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
|
||||
import {
|
||||
createEquipmentType,
|
||||
updateEquipmentType,
|
||||
deleteEquipmentType,
|
||||
getEquipmentType,
|
||||
getEquipmentTypePage,
|
||||
exportEquipmentTypeExcel,
|
||||
} from '@/api/base/equipmentType';
|
||||
|
||||
// import { getAccessToken } from '@/utils/auth';
|
||||
|
||||
export default {
|
||||
name: 'EquipmentType',
|
||||
name: 'EquipmentLineBind',
|
||||
components: {},
|
||||
mixins: [basicPageMixin],
|
||||
data() {
|
||||
return {
|
||||
searchBarKeys: ['name'],
|
||||
basePath: '/base/core-equipment-bind-section',
|
||||
searchBarKeys: ['equipmentName', 'productionLineId'],
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:core-equipment-type:update')
|
||||
this.$auth.hasPermi('base:core-equipment-bind-section:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:core-equipment-type:delete')
|
||||
this.$auth.hasPermi('base:core-equipment-bind-section:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
@ -65,24 +83,38 @@ export default {
|
||||
width: 180,
|
||||
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
},
|
||||
{ prop: 'name', label: '设备类型名称' },
|
||||
{ prop: 'code', label: '检测类型编码' },
|
||||
{ prop: 'remark', label: '备注' },
|
||||
{ prop: 'productionLineName', label: '产线名称' },
|
||||
{ prop: 'workshopSectionName', label: '工段名称' },
|
||||
{ prop: 'equipmentName', label: '设备名称' },
|
||||
{ prop: 'sort', label: '工段中排序' },
|
||||
{
|
||||
prop: 'lineDataType',
|
||||
label: '产线统计类型',
|
||||
filter: (val) =>
|
||||
val != null ? ['无类型', '进片数量统计', '出片数量统计'][val] : '',
|
||||
},
|
||||
{
|
||||
prop: 'sectionDataType',
|
||||
label: '工段统计类型',
|
||||
filter: (val) =>
|
||||
val != null ? ['无类型', '进片数量统计', '出片数量统计'][val] : '',
|
||||
},
|
||||
// { prop: 'remark', label: '备注' },
|
||||
],
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
label: '产线',
|
||||
placeholder: '请选择产线',
|
||||
param: 'lineId',
|
||||
param: 'productionLineId',
|
||||
selectOptions: [],
|
||||
filterable: true
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: '设备名',
|
||||
placeholder: '请输入设备名称',
|
||||
param: 'name',
|
||||
param: 'equipmentName',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
@ -94,7 +126,7 @@ export default {
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:core-equipment-type:create')
|
||||
type: this.$auth.hasPermi('base:core-equipment-bind-section:create')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '新增',
|
||||
@ -114,38 +146,61 @@ export default {
|
||||
rows: [
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '设备类型名称',
|
||||
prop: 'name',
|
||||
select: true,
|
||||
label: '产线',
|
||||
prop: 'productionLineId',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
// bind: {
|
||||
// disabled: true, // some condition, like detail mode...
|
||||
// }
|
||||
url: '/base/core-production-line/listAll',
|
||||
bind: { clearable: true, filterable: true },
|
||||
// watch: 'workshopSectionId'
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '设备类型编码',
|
||||
prop: 'code',
|
||||
url: '/base/core-equipment-type/getCode',
|
||||
select: true,
|
||||
label: '工段',
|
||||
prop: 'workshopSectionId',
|
||||
depends: 'productionLineId',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
bind: { clearable: true, filterable: true },
|
||||
url: '/base/core-workshop-section/listByParentId',
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '父类',
|
||||
prop: 'parentId',
|
||||
url: '/base/core-equipment-type/page?pageNo=1&pageSize=100',
|
||||
label: '设备',
|
||||
prop: 'equipmentId',
|
||||
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
bind: { clearable: true, filterable: true },
|
||||
url: '/base/core-equipment/listAll',
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '工段排序',
|
||||
prop: 'sort',
|
||||
},
|
||||
{},
|
||||
],
|
||||
[
|
||||
{
|
||||
upload: true,
|
||||
label: '上传资料',
|
||||
prop: 'files',
|
||||
select: true,
|
||||
options: [
|
||||
{ label: '无类型', value: 0 },
|
||||
{ label: '进片数量统计', value: 1 },
|
||||
{ label: '出片数量统计', value: 2 },
|
||||
],
|
||||
label: '产线统计类型',
|
||||
prop: 'lineDataType',
|
||||
},
|
||||
{
|
||||
select: true,
|
||||
options: [
|
||||
{ label: '无类型', value: 0 },
|
||||
{ label: '进片数量统计', value: 1 },
|
||||
{ label: '出片数量统计', value: 2 },
|
||||
],
|
||||
label: '工段统计类型',
|
||||
prop: 'sectionDataType',
|
||||
},
|
||||
],
|
||||
[{ input: true, label: '备注', prop: 'remark' }],
|
||||
],
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
@ -153,22 +208,15 @@ export default {
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: '',
|
||||
equipmentName: null,
|
||||
productionLineId: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// form: {
|
||||
// handler: function (val, oldVal) {
|
||||
// console.log('[watch:form]', val, oldVal);
|
||||
// },
|
||||
// deep: true,
|
||||
// },
|
||||
},
|
||||
created() {
|
||||
this.initSearchOptions()
|
||||
this.initSearchOptions();
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
@ -191,11 +239,18 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getEquipmentTypePage(this.queryParams).then((response) => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.recv(this.queryParams).then(({ code, data }) => {
|
||||
// if (code == 0) {
|
||||
this.list = data.list;
|
||||
this.total = data.total;
|
||||
this.loading = false;
|
||||
// }
|
||||
});
|
||||
// .catch(err => {
|
||||
// this.list = [];
|
||||
// this.total = 0;
|
||||
// this.loading = false;
|
||||
// })
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
@ -206,10 +261,17 @@ export default {
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
parentId: undefined,
|
||||
remark: undefined,
|
||||
productionLineId: undefined,
|
||||
// 工段
|
||||
workshopSectionId: undefined,
|
||||
// 设备
|
||||
equipmentId: undefined,
|
||||
// 工段排序
|
||||
sort: undefined,
|
||||
// 产线统计类型
|
||||
lineDataType: undefined,
|
||||
// 工段统计类型
|
||||
sectionDataType: undefined,
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
@ -227,16 +289,16 @@ export default {
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = '添加设备类型';
|
||||
this.title = '添加设备工段绑定';
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getEquipmentType(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.info({ id }).then(({ code, data }) => {
|
||||
this.form = data;
|
||||
this.open = true;
|
||||
this.title = '修改设备类型';
|
||||
this.title = '修改设备工段绑定';
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
@ -247,16 +309,15 @@ export default {
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateEquipmentType(this.form).then((response) => {
|
||||
this.put(this.form).then(({ code, data }) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createEquipmentType(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.post(this.form).then(({ code, data }) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
@ -266,7 +327,7 @@ export default {
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal
|
||||
.confirm('是否确认删除设备类型"' + row.name + '"?')
|
||||
.confirm('是否确认删除绑定"' + row.name + '"?')
|
||||
.then(function () {
|
||||
return deleteEquipmentType(id);
|
||||
})
|
||||
@ -283,13 +344,13 @@ export default {
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal
|
||||
.confirm('是否确认导出所有设备类型数据项?')
|
||||
.confirm('是否确认导出所有设备工段绑定?')
|
||||
.then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportEquipmentTypeExcel(params);
|
||||
// return exportEquipmentTypeExcel(params);
|
||||
})
|
||||
.then((response) => {
|
||||
this.$download.excel(response, '设备类型.xls');
|
||||
this.$download.excel(response, '设备工段绑定.xls');
|
||||
this.exportLoading = false;
|
||||
})
|
||||
.catch(() => {});
|
||||
|
@ -21,7 +21,7 @@
|
||||
:disabled="disabled"
|
||||
v-model="dataForm.code"
|
||||
@change="$emit('update', dataForm)"
|
||||
placeholder="请输入工段排序" />
|
||||
placeholder="请输入报警编码" />
|
||||
</el-form-item>
|
||||
<!--
|
||||
<el-form-item
|
@ -58,7 +58,7 @@
|
||||
queryParams: { id: alarmForm.id },
|
||||
},
|
||||
{
|
||||
name: '属性列表',
|
||||
name: '报警明细',
|
||||
key: 'attrs',
|
||||
props: drawerListProps,
|
||||
url: '/base/equipment-group-alarm/page',
|
||||
@ -72,13 +72,13 @@
|
||||
pageSize: 10,
|
||||
},
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:equipment-group:update')
|
||||
this.$auth.hasPermi('equipment:alarm-group:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:equipment-group:delete')
|
||||
this.$auth.hasPermi('equipment:alarm-group:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
@ -119,19 +119,19 @@ export default {
|
||||
editMode: '',
|
||||
searchBarKeys: ['name', 'code'],
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:equipment-group:update')
|
||||
this.$auth.hasPermi('equipment:alarm-group:update')
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '查看报警',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:equipment-group:update')
|
||||
this.$auth.hasPermi('equipment:alarm-group:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:equipment-group:delete')
|
||||
this.$auth.hasPermi('equipment:alarm-group:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
@ -193,8 +193,8 @@ export default {
|
||||
label: '设备分组编码',
|
||||
prop: 'code',
|
||||
// url: '/base/core-equipment/getCode',
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
],
|
||||
drawerListProps: [
|
||||
{
|
||||
@ -250,7 +250,7 @@ export default {
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:equipment-group:create')
|
||||
type: this.$auth.hasPermi('equipment:alarm-group:create')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '新增',
|
||||
@ -259,7 +259,7 @@ export default {
|
||||
color: 'success',
|
||||
},
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:equipment-group:export') ? 'button' : '',
|
||||
// type: this.$auth.hasPermi('equipment:alarm-group:export') ? 'button' : '',
|
||||
// btnName: '导出',
|
||||
// name: 'export',
|
||||
// color: 'warning',
|
||||
@ -375,7 +375,7 @@ export default {
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = '添加设备分组(用于同类型不同厂家的设备区分)';
|
||||
this.title = '添加设备分组';
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
@ -384,7 +384,7 @@ export default {
|
||||
getEquipmentGroup(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = '修改设备分组(用于同类型不同厂家的设备区分)';
|
||||
this.title = '修改设备分组';
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
@ -445,18 +445,13 @@ export default {
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal
|
||||
.confirm(
|
||||
'是否确认导出所有设备分组(用于同类型不同厂家的设备区分)数据项?'
|
||||
)
|
||||
.confirm('是否确认导出所有设备分组数据项?')
|
||||
.then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportEquipmentGroupExcel(params);
|
||||
})
|
||||
.then((response) => {
|
||||
this.$download.excel(
|
||||
response,
|
||||
'设备分组(用于同类型不同厂家的设备区分).xls'
|
||||
);
|
||||
this.$download.excel(response, '设备分组.xls');
|
||||
this.exportLoading = false;
|
||||
})
|
||||
.catch(() => {});
|
@ -118,19 +118,19 @@ export default {
|
||||
return {
|
||||
searchBarKeys: ['groupId', 'equipmentName'],
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:equipment-bind-group:update')
|
||||
this.$auth.hasPermi('equipment:bind-group:update')
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '查看报警',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:equipment-bind-group:update')
|
||||
this.$auth.hasPermi('equipment:bind-group:update')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '修改',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:equipment-bind-group:delete')
|
||||
this.$auth.hasPermi('equipment:bind-group:delete')
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
@ -199,7 +199,7 @@ export default {
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:equipment-bind-group:create')
|
||||
type: this.$auth.hasPermi('equipment:bind-group:create')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '新增',
|
187
src/views/equipment/base/config/deprecated/dialogForm.vue
Normal file
187
src/views/equipment/base/config/deprecated/dialogForm.vue
Normal file
@ -0,0 +1,187 @@
|
||||
<!--
|
||||
filename: dialogForm.vue
|
||||
author: liubin
|
||||
date: 2023-09-11 15:55:13
|
||||
description: DialogForm for equipmentBindSection only
|
||||
-->
|
||||
|
||||
<template>
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="dataForm"
|
||||
label-width="100px"
|
||||
v-loading="formLoading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="报警编码"
|
||||
prop="code"
|
||||
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-input
|
||||
:disabled="disabled"
|
||||
v-model="dataForm.code"
|
||||
@change="$emit('update', dataForm)"
|
||||
placeholder="请输入工段排序" />
|
||||
</el-form-item>
|
||||
<!--
|
||||
<el-form-item
|
||||
label="报警编码"
|
||||
prop="code"
|
||||
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-select
|
||||
v-model="dataForm.code"
|
||||
placeholder="请选择产线"
|
||||
@change="handleProductlineChange">
|
||||
<el-option
|
||||
v-for="opt in productionLineList"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="报警类型"
|
||||
prop="type"
|
||||
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-select
|
||||
v-model="dataForm.type"
|
||||
:disabled="disabled"
|
||||
placeholder="请选择报警类型"
|
||||
@change="$emit('update', dataForm)">
|
||||
<el-option
|
||||
v-for="opt in [
|
||||
{ label: '布尔型', value: 2 },
|
||||
{ label: '字符型', value: 1 },
|
||||
]"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="报警级别"
|
||||
prop="grade"
|
||||
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-select
|
||||
:disabled="disabled"
|
||||
v-model="dataForm.grade"
|
||||
placeholder="请选择报警级别"
|
||||
@change="$emit('update', dataForm)">
|
||||
<el-option
|
||||
v-for="opt in getDictDatas(DICT_TYPE.EQU_ALARM_LEVEL)"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
v-if="+dataForm.type == 1"
|
||||
label="设备报警编码"
|
||||
prop="alarmCode">
|
||||
<el-input
|
||||
:disabled="disabled"
|
||||
v-model="dataForm.alarmCode"
|
||||
@change="$emit('update', dataForm)"
|
||||
placeholder="请输入设备报警编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="参数列名"
|
||||
prop="plcParamName"
|
||||
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-input
|
||||
:disabled="disabled"
|
||||
v-model="dataForm.plcParamName"
|
||||
placeholder="请输入参数列名"
|
||||
@change="$emit('update', dataForm)"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="报警内容"
|
||||
prop="alarmContent"
|
||||
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
||||
<el-input
|
||||
:disabled="disabled"
|
||||
v-model="dataForm.alarmContent"
|
||||
placeholder="请输入报警内容"
|
||||
@change="$emit('update', dataForm)"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DialogForm',
|
||||
model: {
|
||||
prop: 'dataForm',
|
||||
event: 'update',
|
||||
},
|
||||
emits: ['update'],
|
||||
components: {},
|
||||
props: {
|
||||
dataForm: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formLoading: true,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getCode('/base/equipment-group-alarm/getCode').then((code) => {
|
||||
this.formLoading = false;
|
||||
this.$emit('update', {
|
||||
...this.dataForm,
|
||||
code,
|
||||
});
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 模拟透传 ref */
|
||||
validate(cb) {
|
||||
return this.$refs.form.validate(cb);
|
||||
},
|
||||
resetFields(args) {
|
||||
return this.$refs.form.resetFields(args);
|
||||
},
|
||||
async handleProductlineChange(id) {
|
||||
await this.getWorksectionList(id);
|
||||
this.dataForm.workshopSectionId = null;
|
||||
this.$emit('update', this.dataForm);
|
||||
},
|
||||
async getCode(url) {
|
||||
const response = await this.$axios(url);
|
||||
return response.data;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-date-editor,
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
361
src/views/equipment/base/config/deprecated/index.vue
Normal file
361
src/views/equipment/base/config/deprecated/index.vue
Normal file
@ -0,0 +1,361 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBar
|
||||
:formConfigs="searchBarFormConfig"
|
||||
ref="search-bar"
|
||||
@headBtnClick="handleSearchBarBtnClick" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<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="操作"
|
||||
:width="120"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleTableBtnClick" />
|
||||
</base-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
width="736px"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
createEquipmentGroupAlarm,
|
||||
updateEquipmentGroupAlarm,
|
||||
deleteEquipmentGroupAlarm,
|
||||
getEquipmentGroupAlarm,
|
||||
getEquipmentGroupAlarmPage,
|
||||
exportEquipmentGroupAlarmExcel,
|
||||
} from '@/api/base/equipmentGroupAlarm';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import moment from 'moment';
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
import DialogForm from './dialogForm.vue';
|
||||
|
||||
export default {
|
||||
name: 'EquipmentGroupAlarm',
|
||||
components: { DialogForm },
|
||||
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'),
|
||||
},
|
||||
{ width: 240, prop: 'code', label: '报警编码' },
|
||||
{
|
||||
prop: 'type',
|
||||
label: '报警类型',
|
||||
filter: (val) =>
|
||||
val != null ? ['-', '字符型', '布尔型', '-'][val] : '-',
|
||||
},
|
||||
{
|
||||
prop: 'grade',
|
||||
label: '报警级别',
|
||||
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
|
||||
},
|
||||
{ prop: 'alarmCode', label: '设备报警编码' },
|
||||
{ prop: 'plcParamName', label: '参数列名' },
|
||||
{ prop: 'alarmContent', label: '报警内容' },
|
||||
],
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '设备分组编码',
|
||||
width: '220',
|
||||
placeholder: '/',
|
||||
param: 'equipmentGroupCode',
|
||||
defaultSelect: null,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: '设备分组名称',
|
||||
placeholder: '/',
|
||||
param: 'equipmentGroupName',
|
||||
defaultSelect: null,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:equipment-group-alarm:create')
|
||||
? 'button'
|
||||
: '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
plain: true,
|
||||
color: 'success',
|
||||
},
|
||||
],
|
||||
rows: [
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '报警编码', // 自动生成
|
||||
prop: 'code',
|
||||
url: '/base/equipment-group-alarm/getCode',
|
||||
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: {
|
||||
id: null,
|
||||
equipmentGroupId: null,
|
||||
code: null,
|
||||
type: null,
|
||||
grade: null,
|
||||
alarmCode: null,
|
||||
alarmContent: null,
|
||||
plcParamName: null,
|
||||
},
|
||||
// // 表单校验
|
||||
// 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" }],
|
||||
// }
|
||||
};
|
||||
},
|
||||
// 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;
|
||||
// 执行查询
|
||||
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: null,
|
||||
equipmentGroupId: null,
|
||||
code: null,
|
||||
type: null,
|
||||
grade: null,
|
||||
alarmCode: null,
|
||||
alarmContent: null,
|
||||
plcParamName: null,
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm');
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
if (this.queryParams.equipmentGroupId == null)
|
||||
return this.$message.error('没有检测到设备分组信息');
|
||||
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,
|
||||
equipmentGroupId: this.queryParams.equipmentGroupId,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createEquipmentGroupAlarm({
|
||||
...this.form,
|
||||
equipmentGroupId: this.queryParams.equipmentGroupId,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal
|
||||
.confirm('是否确认删除该报警?')
|
||||
.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>
|
Loading…
Reference in New Issue
Block a user