|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="120px" class="my-custom-form">
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="4">
|
|
|
|
<el-form-item label="中台设备UUID" prop="deviceUuid">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.deviceUuid"
|
|
|
|
placeholder="请输入中台设备UUID"
|
|
|
|
:disabled="uuidDisabled"
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4">
|
|
|
|
<el-form-item label="参数名称" prop="paramName">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.paramName"
|
|
|
|
placeholder="请输入参数名称"
|
|
|
|
clearable
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4">
|
|
|
|
<el-form-item label="参数编码" prop="paramCode">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.paramCode"
|
|
|
|
placeholder="请输入参数编码"
|
|
|
|
clearable
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4">
|
|
|
|
<el-form-item label="参数编码" prop="paramCode">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.paramCode"
|
|
|
|
placeholder="请输入参数编码"
|
|
|
|
clearable
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="数据类型" prop="paramType">
|
|
|
|
<el-select v-model="queryParams.paramType" placeholder="请选择数据类型" clearable>
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dc_param_value_type"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="是否可控" prop="contrlFlag">
|
|
|
|
<el-select v-model="queryParams.contrlFlag" placeholder="请选择是否可控" clearable>
|
|
|
|
<el-option label="请选择字典生成" value="" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="参数单位" prop="contrlType">
|
|
|
|
<el-select v-model="queryParams.contrlType" placeholder="请选择参数单位" clearable>
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dc_param_uint_type"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="是否有效" prop="enabled">
|
|
|
|
<el-select v-model="queryParams.enabled" placeholder="请选择是否有效" clearable>
|
|
|
|
<el-option label="请选择字典生成" value="" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="设置值" prop="setDefautvalue">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.setDefautvalue"
|
|
|
|
placeholder="请输入设置值"
|
|
|
|
clearable
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="偏移量" prop="setAdjustvalue">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.setAdjustvalue"
|
|
|
|
placeholder="请输入偏移量"
|
|
|
|
clearable
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="验证范围" prop="validateScope">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.validateScope"
|
|
|
|
placeholder="请输入验证范围"
|
|
|
|
clearable
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="全局统一编码" prop="globalCode">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.globalCode"
|
|
|
|
placeholder="请输入全局统一编码"
|
|
|
|
clearable
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="参数模版ID" prop="paramModelId">
|
|
|
|
<el-select v-model="queryParams.paramModelId" placeholder="请选择参数模版ID" clearable>
|
|
|
|
<el-option label="请选择字典生成" value="" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="分区(字典)" prop="partion">
|
|
|
|
<el-select v-model="queryParams.partion" placeholder="请选择分区(字典)" clearable>
|
|
|
|
<el-option label="请选择字典生成" value="" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4" v-show="collapseVisible">
|
|
|
|
<el-form-item label="plc地址" prop="plcAdr">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.plcAdr"
|
|
|
|
placeholder="请输入plc地址"
|
|
|
|
clearable
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="6">
|
|
|
|
<el-form-item class="childTextAlignCenter">
|
|
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
<el-button @click="toggleCollapse">{{editName}}</el-button>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="success"
|
|
|
|
icon="Plus"
|
|
|
|
@click="handleAdd"
|
|
|
|
>新增</el-button>
|
|
|
|
</el-col>
|
|
|
|
<!-- <el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="success"
|
|
|
|
icon="Edit"
|
|
|
|
@click="handleUpdate"
|
|
|
|
>修改</el-button>
|
|
|
|
</el-col> -->
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="success"
|
|
|
|
icon="Delete"
|
|
|
|
@click="handleDelete"
|
|
|
|
>删除</el-button>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="warning"
|
|
|
|
icon="Download"
|
|
|
|
@click="handleExport"
|
|
|
|
>导出</el-button>
|
|
|
|
</el-col>
|
|
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-table ref="deviceParamTable" v-loading="loading" :data="paramsList" @selection-change="handleSelectionChange" @sort-change="sortChange" @filter-change="filterChange" :max-height="tableHeight" :border="true" :column-width-draggable="true">
|
|
|
|
<el-table-column type="selection" width="55" align="center" fixed="left"/>
|
|
|
|
<!-- <el-table-column label="主键" align="center" prop="id" />
|
|
|
|
<el-table-column label="中台设备UUID" align="center" prop="deviceUuid" :width="120"/> -->
|
|
|
|
<el-table-column label="参数名称" align="center" prop="paramName" :width="130" sortable/>
|
|
|
|
<el-table-column label="参数编码" align="center" prop="paramCode" :width="120" sortable/>
|
|
|
|
<el-table-column label="数据类型" align="center" prop="paramType" column-key="paramType" filter-placement="bottom-end"
|
|
|
|
:filters="getfilterNameItem('paramType')" :filter-method="filterMethod" :width="120" sortable>
|
|
|
|
<template #default="scope">
|
|
|
|
<dict-tag :options="dc_param_value_type" :value="scope.row.paramType"/>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="是否可控" align="center" prop="contrlFlag" column-key="contrlFlag" filter-placement="bottom-end"
|
|
|
|
:filters="getfilterNameItem('contrlFlag')" :filter-method="filterMethod" :width="120" sortable>
|
|
|
|
<template #default="scope">
|
|
|
|
<dict-tag :options="contrlFlagTable" :value="scope.row.contrlFlag"/>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="是否有效" align="center" prop="enabled" column-key="enabled" filter-placement="bottom-end"
|
|
|
|
:filters="getfilterNameItem('enabled')" :filter-method="filterMethod" :width="120" sortable>
|
|
|
|
<template #default="scope">
|
|
|
|
<dict-tag :options="enabledTable" :value="scope.row.enabled"/>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="设置值" align="center" prop="setDefautvalue" :width="120" sortable/>
|
|
|
|
<el-table-column label="偏移量" align="center" prop="setAdjustvalue" :width="120" sortable/>
|
|
|
|
<el-table-column label="验证范围" align="center" prop="validateScope" :width="120" sortable/>
|
|
|
|
<el-table-column label="全局统一编码" align="center" prop="globalCode" :width="150" sortable/>
|
|
|
|
<el-table-column label="参数模版" align="center" prop="paramModelId" column-key="paramModelId" filter-placement="bottom-end"
|
|
|
|
:filters="getfilterNameItem('paramModelId')" :filter-method="filterMethod" :width="120" sortable>
|
|
|
|
<template #default="scope">
|
|
|
|
<span>{{ getParamModelName(scope.row.paramModelId) }}</span>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="分区(字典)" align="center" prop="partion" column-key="partion" filter-placement="bottom-end"
|
|
|
|
:filters="getfilterNameItem('partion')" :filter-method="filterMethod" :width="130" sortable>
|
|
|
|
<template #default="scope">
|
|
|
|
<dict-tag :options="dc_device_partion" :value="scope.row.partion"/>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="plc地址" align="center" prop="plcAdr" :width="120" sortable/>
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" :width="200" :fixed="fixedColumns?'right':false">
|
|
|
|
<template #header>
|
|
|
|
<div class="fixed-column-header" style="text-align: center;display: block;" @dblclick="toggleFixedColumns">
|
|
|
|
<span style="text-align: center;display: block;">操作<img style="width:10px;margin-left:5px" v-show="fixedColumns" :src="lock" alt="Image"/></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #default="scope">
|
|
|
|
<el-button
|
|
|
|
type="text"
|
|
|
|
icon="Edit"
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
>修改</el-button>
|
|
|
|
<el-button
|
|
|
|
type="text"
|
|
|
|
icon="Delete"
|
|
|
|
@click="handleDelete(scope.row)"
|
|
|
|
>删除</el-button>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
<pagination
|
|
|
|
v-show="total>0"
|
|
|
|
:total="total"
|
|
|
|
v-model:page="params.pageNum"
|
|
|
|
v-model:limit="params.pageSize"
|
|
|
|
@pagination="getList"
|
|
|
|
class="paddingBothLeftRight"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<!-- 添加或修改设备参数明细对话框 -->
|
|
|
|
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
|
|
|
|
<el-form ref="paramsRef" :model="form" :rules="rules" label-width="120px">
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="中台设备ID" prop="deviceUuid">
|
|
|
|
<el-input v-model="form.deviceUuid" placeholder="请输入中台设备ID" :disabled="deviceUuidDisabled"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="参数名称" prop="paramName">
|
|
|
|
<el-input v-model="form.paramName" placeholder="请输入参数名称" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="参数模版" prop="paramModelId">
|
|
|
|
<el-select :disabled="paramModelDisabled" v-model="form.paramModelId" placeholder="请选择参数模版ID" @change="checkedParamModel">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in paramClassList"
|
|
|
|
:label="dict.paramClassName"
|
|
|
|
:value=dict.id>
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="参数编码" prop="paramCode">
|
|
|
|
<el-input v-model="form.paramCode" :placeholder="hintMessage" disabled/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="数据类型" prop="paramType">
|
|
|
|
<el-select v-model="form.paramType" placeholder="请选择数据类型">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dc_param_value_type"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value">
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="是否可控" prop="contrlFlag">
|
|
|
|
<el-select v-model="form.contrlFlag" placeholder="请选择是否可控">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in contrlFlag"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value">
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="是否有效" prop="enabled">
|
|
|
|
<el-select v-model="form.enabled" placeholder="请选择是否有效">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in enabled"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value">
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="设置值" prop="setDefautvalue">
|
|
|
|
<el-input v-model="form.setDefautvalue" placeholder="请输入设置值" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="偏移量" prop="setAdjustvalue">
|
|
|
|
<el-input v-model="form.setAdjustvalue" placeholder="请输入偏移量" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="验证范围" prop="validateScope">
|
|
|
|
<el-input v-model="form.validateScope" placeholder="请输入验证范围" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="全局统一编码" prop="globalCode">
|
|
|
|
<el-input v-model="form.globalCode" :placeholder="hintMessage" disabled/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="分区(字典)" prop="partion">
|
|
|
|
<el-select :disabled="partionDisabled" v-model="form.partion" placeholder="请选择分区(字典)" @change="partionChange">
|
|
|
|
<el-option
|
|
|
|
v-for="dict in dc_device_partion"
|
|
|
|
:key="dict.value"
|
|
|
|
:label="dict.label"
|
|
|
|
:value="dict.value">
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="plc地址" prop="plcAdr">
|
|
|
|
<el-input v-model="form.plcAdr" placeholder="请输入plc地址" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
<template #footer>
|
|
|
|
<div class="dialog-footer">
|
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<style lang="scss" >
|
|
|
|
@import "@/assets/styles/self-defined.scss";
|
|
|
|
</style>
|
|
|
|
<script setup name="Params">
|
|
|
|
import { listParams, getParams, delParams, addParams, updateParams,listWithFilterColumn } from "@/api/model/params";
|
|
|
|
import { listParamclass } from "@/api/model/paramclass";
|
|
|
|
import lock from "@/assets/icons/svg/lock.svg";
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
const router = useRouter();
|
|
|
|
const { dc_param_uint_type, dc_param_value_type, dc_device_partion } = proxy.useDict('dc_param_uint_type', 'dc_param_value_type', 'dc_device_partion');
|
|
|
|
const paramsList = ref([]);
|
|
|
|
const open = ref(false);
|
|
|
|
const loading = ref(true);
|
|
|
|
const showSearch = ref(true);
|
|
|
|
const ids = ref([]);
|
|
|
|
const single = ref(true);
|
|
|
|
const multiple = ref(true);
|
|
|
|
const total = ref(0);
|
|
|
|
const title = ref("");
|
|
|
|
const paramClassList = ref([]);
|
|
|
|
const collapseVisible = ref(false);
|
|
|
|
const uuidDisabled = (router.currentRoute._value.query.deviceUuid !== undefined&&router.currentRoute._value.query.deviceUuid !== null&&router.currentRoute._value.query.deviceUuid !=="")?router.currentRoute._value.query.deviceUuid:false;
|
|
|
|
const editName = ref("更多筛选项");
|
|
|
|
const hintMessage = ref("请先选择参数模版");
|
|
|
|
const paramModelDisabled = ref(false);
|
|
|
|
const partionDisabled = ref(false);
|
|
|
|
const paramClassCodeSeleted = ref("");
|
|
|
|
const deviceUuid = router.currentRoute._value.query.deviceUuid;
|
|
|
|
const deviceUuidDisabled = ref(true);
|
|
|
|
const fixedColumns = ref(false);
|
|
|
|
const tableHeight = ref("0px");
|
|
|
|
const sortItemMap = ref({});
|
|
|
|
const queryParamFilter = ref({});
|
|
|
|
const sortProps = ref([]);
|
|
|
|
const contrlFlag = ref([
|
|
|
|
{label: '可控', value: true, elTagType: 'default', elTagClass: null},
|
|
|
|
{label: '不可控', value: false, elTagType: 'default', elTagClass: null}
|
|
|
|
]);
|
|
|
|
const enabled = ref([
|
|
|
|
{label: '有效', value: true, elTagType: 'default', elTagClass: null},
|
|
|
|
{label: '无效', value: false, elTagType: 'default', elTagClass: null}
|
|
|
|
]);
|
|
|
|
const contrlFlagTable = ref([
|
|
|
|
{label: '可控', value: 'true', elTagType: 'default', elTagClass: null},
|
|
|
|
{label: '不可控', value: 'false', elTagType: 'default', elTagClass: null}
|
|
|
|
]);
|
|
|
|
const enabledTable = ref([
|
|
|
|
{label: '有效', value: 'true', elTagType: 'default', elTagClass: null},
|
|
|
|
{label: '无效', value: 'false', elTagType: 'default', elTagClass: null}
|
|
|
|
]);
|
|
|
|
const data = reactive({
|
|
|
|
form: {
|
|
|
|
contrlFlag:contrlFlag,
|
|
|
|
enabled:enabled,
|
|
|
|
},
|
|
|
|
params: {
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
},
|
|
|
|
queryParams: {
|
|
|
|
deviceUuid: null,
|
|
|
|
paramName: null,
|
|
|
|
paramCode: null,
|
|
|
|
paramType: null,
|
|
|
|
contrlFlag: null,
|
|
|
|
contrlType: null,
|
|
|
|
enabled: null,
|
|
|
|
setDefautvalue: null,
|
|
|
|
setAdjustvalue: null,
|
|
|
|
validateScope: null,
|
|
|
|
globalCode: null,
|
|
|
|
paramModelId: null,
|
|
|
|
partion: null,
|
|
|
|
plcAdr: null
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
deviceUuid: [
|
|
|
|
{ required: true, message: "中台设备UUID不能为空", trigger: "blur" }
|
|
|
|
],
|
|
|
|
paramName: [
|
|
|
|
{ required: true, message: "参数名称不能为空", trigger: "blur" }
|
|
|
|
],
|
|
|
|
paramCode: [
|
|
|
|
{ required: true, message: "参数编码不能为空", trigger: "blur" }
|
|
|
|
],
|
|
|
|
paramType: [
|
|
|
|
{ required: true, message: "数据类型不能为空", trigger: "change" }
|
|
|
|
],
|
|
|
|
contrlFlag: [
|
|
|
|
{ required: true, message: "是否可控不能为空", trigger: "change" }
|
|
|
|
],
|
|
|
|
contrlType: [
|
|
|
|
{ required: true, message: "参数单位不能为空", trigger: "change" }
|
|
|
|
],
|
|
|
|
enabled: [
|
|
|
|
{ required: true, message: "是否有效不能为空", trigger: "change" }
|
|
|
|
],
|
|
|
|
globalCode: [
|
|
|
|
{ required: true, message: "全局统一编码不能为空", trigger: "blur" }
|
|
|
|
],
|
|
|
|
paramModelId: [
|
|
|
|
{ required: true, message: "参数模版ID不能为空", trigger: "change" }
|
|
|
|
],
|
|
|
|
partion: [
|
|
|
|
{ required: true, message: "分区(字典)不能为空", trigger: "change" }
|
|
|
|
],
|
|
|
|
plcAdr: [
|
|
|
|
{ required: true, message: "plc地址不能为空", trigger: "blur" }
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const { queryParams, form, rules, params } = toRefs(data);
|
|
|
|
|
|
|
|
/** 查询设备参数明细列表 */
|
|
|
|
function getList() {
|
|
|
|
loading.value = true;
|
|
|
|
if(deviceUuid != null && deviceUuid != undefined && deviceUuid != ""){
|
|
|
|
queryParams.value.deviceUuid = deviceUuid;
|
|
|
|
let param = {
|
|
|
|
"obj":queryParams.value,
|
|
|
|
"params":queryParamFilter.value,
|
|
|
|
"sort":sortProps.value,
|
|
|
|
"pageNum": params.value.pageNum,
|
|
|
|
"pageSize": params.value.pageSize,
|
|
|
|
}
|
|
|
|
listWithFilterColumn(param).then(response => {
|
|
|
|
paramsList.value = response.data.tableData.rows;
|
|
|
|
total.value = response.data.tableData.total;
|
|
|
|
sortItemMap.value = response.data.filter;
|
|
|
|
queryParamFilter.value = new Object();
|
|
|
|
loading.value = false;
|
|
|
|
});
|
|
|
|
// listParams(queryParams.value).then(response => {
|
|
|
|
// paramsList.value = response.rows;
|
|
|
|
// total.value = response.total;
|
|
|
|
// loading.value = false;
|
|
|
|
// });
|
|
|
|
}else{
|
|
|
|
let param = {
|
|
|
|
"obj":queryParams.value,
|
|
|
|
"params":queryParamFilter.value,
|
|
|
|
"sort":sortProps.value,
|
|
|
|
"pageNum": params.value.pageNum,
|
|
|
|
"pageSize": params.value.pageSize,
|
|
|
|
}
|
|
|
|
listWithFilterColumn(param).then(response => {
|
|
|
|
paramsList.value = response.data.tableData.rows;
|
|
|
|
total.value = response.data.tableData.total;
|
|
|
|
sortItemMap.value = response.data.filter;
|
|
|
|
queryParamFilter.value = new Object();
|
|
|
|
loading.value = false;
|
|
|
|
});
|
|
|
|
// listParams(queryParams.value).then(response => {
|
|
|
|
// paramsList.value = response.rows;
|
|
|
|
// total.value = response.total;
|
|
|
|
// loading.value = false;
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 取消按钮
|
|
|
|
function cancel() {
|
|
|
|
open.value = false;
|
|
|
|
reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
// 表单重置
|
|
|
|
function reset() {
|
|
|
|
form.value = {
|
|
|
|
tentantId: null,
|
|
|
|
version: null,
|
|
|
|
createBy: null,
|
|
|
|
createTime: null,
|
|
|
|
updateBy: null,
|
|
|
|
updateTime: null,
|
|
|
|
deptId: null,
|
|
|
|
userId: null,
|
|
|
|
deleteBy: null,
|
|
|
|
deleteTime: null,
|
|
|
|
id: null,
|
|
|
|
deviceUuid: null,
|
|
|
|
paramName: null,
|
|
|
|
paramCode: null,
|
|
|
|
paramType: null,
|
|
|
|
contrlFlag: null,
|
|
|
|
contrlType: null,
|
|
|
|
enabled: null,
|
|
|
|
setDefautvalue: null,
|
|
|
|
setAdjustvalue: null,
|
|
|
|
validateScope: null,
|
|
|
|
globalCode: null,
|
|
|
|
paramModelId: null,
|
|
|
|
partion: null,
|
|
|
|
plcAdr: null
|
|
|
|
};
|
|
|
|
proxy.resetForm("paramsRef");
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
function handleQuery() {
|
|
|
|
params.value.pageNum = 1;
|
|
|
|
getList();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
function resetQuery() {
|
|
|
|
proxy.resetForm("queryRef");
|
|
|
|
proxy.$refs.deviceParamTable.clearSort();
|
|
|
|
proxy.$refs.deviceParamTable.clearFilter();
|
|
|
|
queryParamFilter.value = new Object();
|
|
|
|
sortProps.value = new Array();
|
|
|
|
handleQuery();
|
|
|
|
}
|
|
|
|
|
|
|
|
// 多选框选中数据
|
|
|
|
function handleSelectionChange(selection) {
|
|
|
|
ids.value = selection.map(item => item.id);
|
|
|
|
single.value = selection.length != 1;
|
|
|
|
multiple.value = !selection.length;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
function handleAdd() {
|
|
|
|
reset();
|
|
|
|
form.value.deviceUuid = deviceUuid;
|
|
|
|
paramClassCodeSeleted.value = "";
|
|
|
|
paramModelDisabled.value = false;
|
|
|
|
partionDisabled.value = false;
|
|
|
|
open.value = true;
|
|
|
|
title.value = "添加设备参数明细";
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
function handleUpdate(row) {
|
|
|
|
reset();
|
|
|
|
const _id = row.id || ids.value
|
|
|
|
getParams(_id).then(response => {
|
|
|
|
form.value = response.data;
|
|
|
|
paramModelDisabled.value = true;
|
|
|
|
partionDisabled.value = true;
|
|
|
|
open.value = true;
|
|
|
|
title.value = "修改设备参数明细";
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
function submitForm() {
|
|
|
|
proxy.$refs["paramsRef"].validate(valid => {
|
|
|
|
if (valid) {
|
|
|
|
if (form.value.id != null) {
|
|
|
|
updateParams(form.value).then(response => {
|
|
|
|
proxy.$modal.msgSuccess("修改成功");
|
|
|
|
open.value = false;
|
|
|
|
getList();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
addParams(form.value).then(response => {
|
|
|
|
proxy.$modal.msgSuccess("新增成功");
|
|
|
|
open.value = false;
|
|
|
|
getList();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
function handleDelete(row) {
|
|
|
|
const _ids = row.id || ids.value;
|
|
|
|
proxy.$modal.confirm('是否确认删除设备参数明细编号为"' + _ids + '"的数据项?').then(function() {
|
|
|
|
return delParams(_ids);
|
|
|
|
}).then(() => {
|
|
|
|
getList();
|
|
|
|
proxy.$modal.msgSuccess("删除成功");
|
|
|
|
}).catch(() => {});
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
function handleExport() {
|
|
|
|
proxy.download('model/dcBaseDeviceParam/export', {
|
|
|
|
...queryParams.value
|
|
|
|
}, `params_${new Date().getTime()}.xlsx`)
|
|
|
|
}
|
|
|
|
|
|
|
|
function getParamModel() {
|
|
|
|
listParamclass({}).then(response => {
|
|
|
|
paramClassList.value = response.rows;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function getParamModelName(id){
|
|
|
|
paramClassList.value.forEach(item=>{
|
|
|
|
if(item.id == id){
|
|
|
|
return item.getParamModelName;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkedParamModel(val){
|
|
|
|
paramClassList.value.forEach(item=>{
|
|
|
|
if(item.id == val){
|
|
|
|
paramClassCodeSeleted.value = item.paramClassCode;
|
|
|
|
if(form.value.partion !== undefined && form.value.partion !== null && form.value.partion !== ""){
|
|
|
|
form.value.paramCode = form.value.partion+form.value.deviceUuid+paramClassCodeSeleted.value;
|
|
|
|
form.value.globalCode = form.value.deviceUuid + "-" + form.value.partion + form.value.deviceUuid + paramClassCodeSeleted.value;
|
|
|
|
}else{
|
|
|
|
hintMessage.value = "请选择分区";
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleCollapse() {
|
|
|
|
collapseVisible.value = !collapseVisible.value;
|
|
|
|
if(collapseVisible.value){
|
|
|
|
editName.value = "折叠筛选项";
|
|
|
|
}else{
|
|
|
|
editName.value = "更多筛选项"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function partionChange(val){
|
|
|
|
if(paramClassCodeSeleted.value !== ""){
|
|
|
|
form.value.paramCode = form.value.partion+form.value.deviceUuid+paramClassCodeSeleted.value;
|
|
|
|
form.value.globalCode = form.value.deviceUuid + "-" + form.value.partion + form.value.deviceUuid + paramClassCodeSeleted.value;
|
|
|
|
}else{
|
|
|
|
hintMessage.value = "请选择参数模版";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function avilileEdit(){
|
|
|
|
if( deviceUuid === undefined || deviceUuid === null){
|
|
|
|
deviceUuidDisabled.value = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleFixedColumns() {
|
|
|
|
fixedColumns.value = !fixedColumns.value;
|
|
|
|
}
|
|
|
|
|
|
|
|
onMounted(()=>{
|
|
|
|
calculateTableHeight();
|
|
|
|
window.addEventListener('resize', calculateTableHeight);
|
|
|
|
window.onresize = () => {
|
|
|
|
return (() => {
|
|
|
|
calculateTableHeight();
|
|
|
|
})()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
window.removeEventListener('resize', calculateTableHeight);
|
|
|
|
});
|
|
|
|
watch(
|
|
|
|
[collapseVisible,showSearch],
|
|
|
|
() => {
|
|
|
|
calculateTableHeight();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
const calculateTableHeight = () => {
|
|
|
|
nextTick(() => {
|
|
|
|
const heightForm = proxy.$refs.queryRef?.$el.clientHeight||0;
|
|
|
|
const windowHeight = window.innerHeight;
|
|
|
|
const paginationHeight = 60;
|
|
|
|
const tableHeaderHeight = 40;
|
|
|
|
const tableMargin = 20;
|
|
|
|
const remainingHeight = windowHeight - paginationHeight - tableHeaderHeight - tableMargin - heightForm - 100;
|
|
|
|
tableHeight.value = remainingHeight + 'px';
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
function getfilterNameItem(value){
|
|
|
|
let result = '';
|
|
|
|
let resultItem = new Object();
|
|
|
|
if(value==='paramType'){
|
|
|
|
if(sortItemMap.value[value]?.length>0){
|
|
|
|
result = sortItemMap.value[value].map(element=>{
|
|
|
|
dc_param_value_type.value.forEach(item=>{
|
|
|
|
if(item.value===element.text){
|
|
|
|
resultItem = item.label;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
text: resultItem,
|
|
|
|
value: element.value,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}else if(value==='contrlFlag'){
|
|
|
|
if(sortItemMap.value[value]?.length>0 && sortItemMap.value[value].value != undefined && sortItemMap.value[value].value != null){
|
|
|
|
result = sortItemMap.value[value].map(element=>{
|
|
|
|
contrlFlag.value.forEach(item=>{
|
|
|
|
if(item.value===element.text){
|
|
|
|
resultItem = item.label;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
text: resultItem,
|
|
|
|
value: element.value,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}else if(value==='enabled'){
|
|
|
|
if(sortItemMap.value[value]?.length>0){
|
|
|
|
result = sortItemMap.value[value].map(element=>{
|
|
|
|
enabled.value.forEach(item=>{
|
|
|
|
if(item.value===element.text){
|
|
|
|
resultItem = item.label;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
text: resultItem,
|
|
|
|
value: element.value,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}else if(value==='paramModelId'){
|
|
|
|
if(sortItemMap.value[value]?.length>0 && sortItemMap.value[value].value != undefined && sortItemMap.value[value].value != null){
|
|
|
|
result = sortItemMap.value[value].map(element=>{
|
|
|
|
debugger
|
|
|
|
return {
|
|
|
|
text: getParamModelName(element.value),
|
|
|
|
value: element.value,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}else if(value==='partion'){
|
|
|
|
if(sortItemMap.value[value]?.length>0){
|
|
|
|
result = sortItemMap.value[value].map(element=>{
|
|
|
|
dc_device_partion.value.forEach(item=>{
|
|
|
|
if(item.value===String(element.text)){
|
|
|
|
resultItem = item.label;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
text: resultItem,
|
|
|
|
value: element.value,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
result = sortItemMap.value[value];
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function filterChange(filterItem) {
|
|
|
|
const outerObjectKeys = Object.keys(filterItem);
|
|
|
|
if(outerObjectKeys.length===1){
|
|
|
|
queryParamFilter.value[outerObjectKeys[0]] = filterItem[outerObjectKeys[0]];
|
|
|
|
}
|
|
|
|
|
|
|
|
loading.value = true;
|
|
|
|
let param = {
|
|
|
|
"obj":queryParams.value,
|
|
|
|
"params":queryParamFilter.value,
|
|
|
|
"sort":sortProps.value,
|
|
|
|
"pageNum": params.value.pageNum,
|
|
|
|
"pageSize": params.value.pageSize,
|
|
|
|
}
|
|
|
|
listWithFilterColumn(param).then(response => {
|
|
|
|
paramsList.value = response.data.tableData.rows;
|
|
|
|
total.value = response.data.tableData.total;
|
|
|
|
sortItemMap.value = response.data.filter;
|
|
|
|
queryParamFilter.value = new Object();
|
|
|
|
loading.value = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function filterMethod(value, row, column){
|
|
|
|
if(column==null){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(queryParamFilter.value[column.property] == null || queryParamFilter.value[column.property].length==0){
|
|
|
|
queryParamFilter.value[column.property]=[];
|
|
|
|
queryParamFilter.value[column.property].push(value);
|
|
|
|
}else{
|
|
|
|
let flag = false;
|
|
|
|
queryParamFilter.value[column.property].forEach(item=>{
|
|
|
|
if(item==value){
|
|
|
|
flag = true;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if(!flag){
|
|
|
|
queryParamFilter.value[column.property].push(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function sortChange({column, prop, order }){
|
|
|
|
if(column==null){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sortProps.value = sortProps.value.filter(item => item.prop !== prop);
|
|
|
|
if(order!=null){
|
|
|
|
sortProps.value.push({prop:prop,order:order});
|
|
|
|
}
|
|
|
|
getList();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getList();
|
|
|
|
getParamModel();
|
|
|
|
avilileEdit();
|
|
|
|
</script>
|