2023-08-21 11:12:23 +08:00
|
|
|
<template>
|
2024-04-02 16:54:36 +08:00
|
|
|
<div class="app-container">
|
|
|
|
<!-- 搜索工作栏 -->
|
|
|
|
<search-bar
|
|
|
|
:formConfigs="formConfig"
|
|
|
|
ref="searchBarForm"
|
|
|
|
@headBtnClick="buttonClick" />
|
|
|
|
<!-- 列表 -->
|
|
|
|
<base-table
|
|
|
|
:page="queryParams.pageNo"
|
|
|
|
:limit="queryParams.pageSize"
|
|
|
|
:table-props="tableProps"
|
|
|
|
:table-data="list"
|
|
|
|
:max-height="tableH">
|
|
|
|
<method-btn
|
|
|
|
v-if="tableBtn.length"
|
|
|
|
slot="handleBtn"
|
|
|
|
:width="160"
|
|
|
|
label="操作"
|
|
|
|
:method-list="tableBtn"
|
|
|
|
@clickBtn="handleClick" />
|
|
|
|
</base-table>
|
|
|
|
<pagination
|
|
|
|
:page.sync="queryParams.pageNo"
|
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
|
:total="total"
|
|
|
|
@pagination="getList" />
|
|
|
|
<!-- 新增 -->
|
|
|
|
<base-dialog
|
|
|
|
:dialogTitle="addOrEditTitle"
|
|
|
|
:dialogVisible="centervisible"
|
|
|
|
@cancel="handleCancel"
|
|
|
|
@confirm="handleConfirm"
|
|
|
|
:before-close="handleCancel"
|
|
|
|
width="30%">
|
|
|
|
<energy-plc-connect-add
|
|
|
|
ref="energyPlcConnect"
|
|
|
|
:objList="objList"
|
|
|
|
@successSubmit="successSubmit" />
|
|
|
|
</base-dialog>
|
|
|
|
<!-- 参数绑定/查看 -->
|
|
|
|
<energy-plc-param
|
|
|
|
v-if="paramVisible"
|
|
|
|
ref="plcParam"
|
|
|
|
@closeDrawer="closeDrawer"
|
|
|
|
:energyTypeList="energyTypeList"></energy-plc-param>
|
|
|
|
</div>
|
2023-08-21 11:12:23 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-04-02 16:54:36 +08:00
|
|
|
import {
|
|
|
|
getEnergyPlcConnectPage,
|
|
|
|
deleteEnergyPlcConnect,
|
|
|
|
} from '@/api/base/energyPlcConnect';
|
2023-08-21 11:12:23 +08:00
|
|
|
// import { publicFormatter } from '@/utils/dict'
|
2024-04-02 16:54:36 +08:00
|
|
|
import { getTree } from '@/api/analysis/energyAnalysis';
|
|
|
|
import { getEnergyTypeListAll } from '@/api/base/energyType';
|
|
|
|
import EnergyPlcConnectAdd from './components/energyPlcConnectAdd';
|
|
|
|
import EnergyPlcParam from './components/energyPlcParam';
|
2024-04-08 10:41:43 +08:00
|
|
|
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
2023-08-21 11:12:23 +08:00
|
|
|
const tableProps = [
|
2024-04-02 16:54:36 +08:00
|
|
|
{
|
|
|
|
prop: 'objName',
|
|
|
|
label: '对象',
|
2024-04-08 10:41:43 +08:00
|
|
|
minWidth: 130,
|
|
|
|
showOverflowtooltip: true,
|
2024-04-02 16:54:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'objCode',
|
|
|
|
label: '对象编码',
|
2024-04-08 10:41:43 +08:00
|
|
|
minWidth: 150,
|
2024-04-02 16:54:36 +08:00
|
|
|
showOverflowtooltip: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'plcTableName',
|
|
|
|
label: '关联表名',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'plcTableCode',
|
|
|
|
label: '关联表编码',
|
|
|
|
minWidth: 150,
|
|
|
|
showOverflowtooltip: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'cnName',
|
|
|
|
label: '标识名',
|
|
|
|
minWidth: 150,
|
|
|
|
showOverflowtooltip: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'varNum',
|
|
|
|
label: '绑定参数数量',
|
2024-04-08 10:41:43 +08:00
|
|
|
width: 110,
|
2024-04-02 16:54:36 +08:00
|
|
|
},
|
|
|
|
];
|
2023-08-21 11:12:23 +08:00
|
|
|
export default {
|
2024-04-02 16:54:36 +08:00
|
|
|
name: 'EnergyPlcConnect',
|
|
|
|
components: { EnergyPlcConnectAdd, EnergyPlcParam },
|
2024-04-08 10:41:43 +08:00
|
|
|
mixins: [tableHeightMixin],
|
2024-04-02 16:54:36 +08:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
formConfig: [
|
|
|
|
{
|
|
|
|
type: 'input',
|
|
|
|
label: '标识名',
|
|
|
|
placeholder: '标识名',
|
|
|
|
param: 'cnName',
|
|
|
|
},
|
|
|
|
{
|
2024-04-10 17:36:37 +08:00
|
|
|
type: this.$auth.hasPermi('base:energy-plc-connect:query')
|
|
|
|
? 'button'
|
|
|
|
: '',
|
2024-04-02 16:54:36 +08:00
|
|
|
btnName: '查询',
|
|
|
|
name: 'search',
|
|
|
|
color: 'primary',
|
|
|
|
},
|
|
|
|
{
|
2024-04-10 17:36:37 +08:00
|
|
|
type: this.$auth.hasPermi('base:energy-plc-connect:create')
|
|
|
|
? 'separate'
|
|
|
|
: '',
|
2024-04-02 16:54:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
type: this.$auth.hasPermi('base:energy-plc-connect:create')
|
|
|
|
? 'button'
|
|
|
|
: '',
|
|
|
|
btnName: '新增',
|
|
|
|
name: 'add',
|
|
|
|
color: 'success',
|
|
|
|
plain: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
tableProps,
|
|
|
|
tableBtn: [
|
2024-04-10 17:36:37 +08:00
|
|
|
this.$auth.hasPermiAnd([
|
|
|
|
'base:energy-plc-param:query',
|
|
|
|
'base:energy-type:query',
|
|
|
|
])
|
2024-04-02 16:54:36 +08:00
|
|
|
? {
|
|
|
|
type: 'connect',
|
|
|
|
btnName: '绑定',
|
|
|
|
}
|
|
|
|
: undefined,
|
2024-04-10 17:36:37 +08:00
|
|
|
this.$auth.hasPermi('base:energy-plc-param:query')
|
|
|
|
? {
|
|
|
|
type: 'detail',
|
|
|
|
btnName: '详情',
|
|
|
|
}
|
|
|
|
: undefined,
|
|
|
|
this.$auth.hasPermiAnd([
|
|
|
|
'base:energy-plc-connect:update',
|
|
|
|
'base:energy-plc-connect:query',
|
|
|
|
])
|
2024-04-02 16:54:36 +08:00
|
|
|
? {
|
|
|
|
type: 'edit',
|
|
|
|
btnName: '编辑',
|
|
|
|
}
|
|
|
|
: undefined,
|
|
|
|
this.$auth.hasPermi('base:energy-plc-connect:delete')
|
|
|
|
? {
|
|
|
|
type: 'delete',
|
|
|
|
btnName: '删除',
|
|
|
|
}
|
|
|
|
: undefined,
|
|
|
|
].filter((v) => v),
|
|
|
|
// 总条数
|
|
|
|
total: 0,
|
|
|
|
// 班次基础信息列表
|
|
|
|
list: [],
|
|
|
|
// 弹出层标题
|
|
|
|
addOrEditTitle: '',
|
|
|
|
// 是否显示弹出层
|
|
|
|
centervisible: false,
|
|
|
|
// 查询参数
|
|
|
|
queryParams: {
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 20,
|
|
|
|
cnName: null,
|
|
|
|
},
|
|
|
|
paramVisible: false,
|
|
|
|
energyTypeList: [],
|
|
|
|
objList: [],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.getList();
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
// 获取能源列表
|
|
|
|
this.getEnergyTypeList();
|
|
|
|
// 获取对象树形结构
|
|
|
|
this.getObjTree();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
buttonClick(val) {
|
|
|
|
switch (val.btnName) {
|
|
|
|
case 'search':
|
|
|
|
this.queryParams.pageNo = 1;
|
|
|
|
this.queryParams.cnName = val.cnName;
|
|
|
|
this.getList();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
this.addOrEditTitle = '新增';
|
|
|
|
this.centervisible = true;
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.energyPlcConnect.init();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/** 查询列表 */
|
|
|
|
getList() {
|
|
|
|
getEnergyPlcConnectPage(this.queryParams).then((response) => {
|
|
|
|
let arr = response.data.list || [];
|
|
|
|
this.list = arr;
|
|
|
|
this.total = response.data.total;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleClick(val) {
|
|
|
|
console.log(val);
|
|
|
|
switch (val.type) {
|
|
|
|
case 'edit':
|
|
|
|
this.addOrEditTitle = '编辑';
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.energyPlcConnect.init(val.data.id);
|
|
|
|
});
|
|
|
|
this.centervisible = true;
|
|
|
|
break;
|
|
|
|
case 'delete':
|
|
|
|
this.handleDelete(val.data);
|
|
|
|
break;
|
|
|
|
case 'detail':
|
|
|
|
this.paramVisible = true;
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.plcParam.init(val.data, 'detail');
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
this.paramVisible = true;
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.plcParam.init(val.data, 'connect');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handleCancel() {
|
|
|
|
this.$refs.energyPlcConnect.formClear();
|
|
|
|
this.centervisible = false;
|
|
|
|
this.addOrEditTitle = '';
|
|
|
|
},
|
|
|
|
handleConfirm() {
|
|
|
|
this.$refs.energyPlcConnect.submitForm();
|
|
|
|
},
|
|
|
|
successSubmit() {
|
|
|
|
this.handleCancel();
|
|
|
|
this.getList();
|
|
|
|
},
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
handleDelete(row) {
|
|
|
|
this.$modal
|
|
|
|
.confirm('是否确认删除对象为"' + row.objName + '"的数据项?')
|
|
|
|
.then(function () {
|
|
|
|
return deleteEnergyPlcConnect(row.id);
|
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
this.queryParams.pageNo = 1;
|
|
|
|
this.getList();
|
|
|
|
this.$modal.msgSuccess('删除成功');
|
|
|
|
})
|
|
|
|
.catch(() => {});
|
|
|
|
},
|
|
|
|
closeDrawer() {
|
|
|
|
this.getList();
|
|
|
|
},
|
|
|
|
getEnergyTypeList() {
|
|
|
|
getEnergyTypeListAll().then((res) => {
|
|
|
|
this.energyTypeList = res.data || [];
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getObjTree() {
|
|
|
|
getTree().then((res) => {
|
|
|
|
this.objList = res.data || [];
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
2023-08-21 11:12:23 +08:00
|
|
|
};
|
|
|
|
</script>
|