Browse Source

设备信息和设备参数临时界面

pull/1/head
ljlong_2630 1 year ago
parent
commit
4581b8b996
  1. 53
      src/api/model/device.js
  2. 53
      src/api/model/params.js
  3. 485
      src/views/flowable/params/index.vue
  4. 618
      src/views/model/device/index.vue
  5. 2
      src/views/model/devicemodel/addmodel.vue
  6. 26
      src/views/model/devicemodel/index.vue
  7. 518
      src/views/model/params/index.vue

53
src/api/model/device.js

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询设备信息列表
export function listDevice(query) {
return request({
url: '/model/dcBaseDeviceinfo/list',
method: 'get',
params: query
})
}
// 查询设备信息详细
export function getDevice(id) {
return request({
url: '/model/dcBaseDeviceinfo/' + id,
method: 'get'
})
}
// 新增设备信息
export function addDevice(data) {
return request({
url: '/model/dcBaseDeviceinfo',
method: 'post',
data: data
})
}
// 修改设备信息
export function updateDevice(data) {
return request({
url: '/model/dcBaseDeviceinfo',
method: 'put',
data: data
})
}
// 删除设备信息
export function delDevice(id) {
return request({
url: '/model/dcBaseDeviceinfo/' + id,
method: 'delete'
})
}
// 导出设备信息
export function exportDevice(query) {
return request({
url: '/${baseUrl}/export',
method: 'get',
params: query
})
}

53
src/api/model/params.js

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询设备参数明细列表
export function listParams(query) {
return request({
url: '/model/dcBaseDeviceParam/list',
method: 'get',
params: query
})
}
// 查询设备参数明细详细
export function getParams(id) {
return request({
url: '/model/dcBaseDeviceParam/' + id,
method: 'get'
})
}
// 新增设备参数明细
export function addParams(data) {
return request({
url: '/model/dcBaseDeviceParam',
method: 'post',
data: data
})
}
// 修改设备参数明细
export function updateParams(data) {
return request({
url: '/model/dcBaseDeviceParam',
method: 'put',
data: data
})
}
// 删除设备参数明细
export function delParams(id) {
return request({
url: '/model/dcBaseDeviceParam/' + id,
method: 'delete'
})
}
// 导出设备参数明细
export function exportParams(query) {
return request({
url: '/${baseUrl}/export',
method: 'get',
params: query
})
}

485
src/views/flowable/params/index.vue

@ -0,0 +1,485 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="中台设备UUID" prop="deviceUuid">
<el-input
v-model="queryParams.deviceUuid"
placeholder="请输入中台设备UUID"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="参数名称" prop="paramName">
<el-input
v-model="queryParams.paramName"
placeholder="请输入参数名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="参数编码" prop="paramCode">
<el-input
v-model="queryParams.paramCode"
placeholder="请输入参数编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<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-form-item label="是否可控" prop="contrlFlag">
<el-select v-model="queryParams.contrlFlag" placeholder="请选择是否可控" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<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-form-item label="是否有效" prop="enabled">
<el-select v-model="queryParams.enabled" placeholder="请选择是否有效" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="设置值" prop="setDefautvalue">
<el-input
v-model="queryParams.setDefautvalue"
placeholder="请输入设置值"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="偏移量" prop="setAdjustvalue">
<el-input
v-model="queryParams.setAdjustvalue"
placeholder="请输入偏移量"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="验证范围;0.0-100.00" prop="validateScope">
<el-input
v-model="queryParams.validateScope"
placeholder="请输入验证范围;0.0-100.00"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="全局统一编码" prop="globalCode">
<el-input
v-model="queryParams.globalCode"
placeholder="请输入全局统一编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<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-form-item label="分区(字典)" prop="partion">
<el-select v-model="queryParams.partion" placeholder="请选择分区(字典)" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="plc地址" prop="plcAdr">
<el-input
v-model="queryParams.plcAdr"
placeholder="请输入plc地址"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="是/否可控制" prop="controllab">
<el-select v-model="queryParams.controllab" placeholder="请选择是/否可控制" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</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 v-loading="loading" :data="paramsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="中台设备UUID" align="center" prop="deviceUuid" />
<el-table-column label="参数名称" align="center" prop="paramName" />
<el-table-column label="参数编码" align="center" prop="paramCode" />
<el-table-column label="数据类型" align="center" prop="paramType">
<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" />
<el-table-column label="参数单位" align="center" prop="contrlType">
<template #default="scope">
<dict-tag :options="dc_param_uint_type" :value="scope.row.contrlType"/>
</template>
</el-table-column>
<el-table-column label="是否有效" align="center" prop="enabled" />
<el-table-column label="设置值" align="center" prop="setDefautvalue" />
<el-table-column label="偏移量" align="center" prop="setAdjustvalue" />
<el-table-column label="验证范围;0.0-100.00" align="center" prop="validateScope" />
<el-table-column label="全局统一编码" align="center" prop="globalCode" />
<el-table-column label="参数模版ID" align="center" prop="paramModelId" />
<el-table-column label="分区(字典)" align="center" prop="partion" />
<el-table-column label="plc地址" align="center" prop="plcAdr" />
<el-table-column label="是/否可控制" align="center" prop="controllab" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<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="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改设备参数明细对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="paramsRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="中台设备UUID" prop="deviceUuid">
<el-input v-model="form.deviceUuid" placeholder="请输入中台设备UUID" />
</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="paramCode">
<el-input v-model="form.paramCode" placeholder="请输入参数编码" />
</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 label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数单位" prop="contrlType">
<el-select v-model="form.contrlType" placeholder="请选择参数单位">
<el-option
v-for="dict in dc_param_uint_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="enabled">
<el-select v-model="form.enabled" placeholder="请选择是否有效">
<el-option label="请选择字典生成" value="" />
</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="验证范围;0.0-100.00" prop="validateScope">
<el-input v-model="form.validateScope" placeholder="请输入验证范围;0.0-100.00" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="全局统一编码" prop="globalCode">
<el-input v-model="form.globalCode" placeholder="请输入全局统一编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数模版ID" prop="paramModelId">
<el-select v-model="form.paramModelId" placeholder="请选择参数模版ID">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分区(字典)" prop="partion">
<el-select v-model="form.partion" placeholder="请选择分区(字典)">
<el-option label="请选择字典生成" value="" />
</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-col :span="12">
<el-form-item label="是/否可控制" prop="controllab">
<el-select v-model="form.controllab" placeholder="请选择是/否可控制">
<el-option label="请选择字典生成" value="" />
</el-select>
</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>
<script setup name="Params">
import { listParams, getParams, delParams, addParams, updateParams } from "@/api/model/params";
const { proxy } = getCurrentInstance();
const { dc_param_uint_type, dc_param_value_type } = proxy.useDict('dc_param_uint_type', 'dc_param_value_type');
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 data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
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,
controllab: null
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询设备参数明细列表 */
function getList() {
loading.value = true;
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,
controllab: null
};
proxy.resetForm("paramsRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加设备参数明细";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getParams(_id).then(response => {
form.value = response.data;
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/params/export', {
...queryParams.value
}, `params_${new Date().getTime()}.xlsx`)
}
getList();
</script>

618
src/views/model/device/index.vue

@ -0,0 +1,618 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="120px">
<el-form-item label="中台设备编码" prop="centerDeviceCode">
<el-input
v-model="queryParams.centerDeviceCode"
placeholder="请输入中台设备编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="通讯来源类型" prop="deviceSource">
<el-input
v-model="queryParams.deviceSource"
placeholder="请输入通讯来源类型"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="通讯来源设备ID" prop="deviceSourceId">
<el-input
v-model="queryParams.deviceSourceId"
placeholder="请输入通讯来源设备ID"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="是否可用" prop="enabledFlag">
<el-select v-model="queryParams.enabledFlag" placeholder="请选择是否可用" clearable>
<el-option
v-for="dict in enabledFlag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="queryParams.deviceType" placeholder="请选择设备类型" clearable>
<el-option
v-for="dict in dc_device_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="所属组织编码" prop="orgCode">
<el-input
v-model="queryParams.orgCode"
placeholder="请输入所属组织编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="所属组织名称" prop="orgName">
<el-input
v-model="queryParams.orgName"
placeholder="请输入所属组织名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="位置编码" prop="locationCode">
<el-input
v-model="queryParams.locationCode"
placeholder="请输入位置编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="位置名称" prop="locationName">
<el-input
v-model="queryParams.locationName"
placeholder="请输入位置名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备应用范围" prop="deviceClass">
<el-input
v-model="queryParams.deviceClass"
placeholder="请输入设备应用范围"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="接口名称" prop="apiName">
<el-input
v-model="queryParams.apiName"
placeholder="请输入接口名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="服务器地址" prop="serverIp">
<el-input
v-model="queryParams.serverIp"
placeholder="请输入服务器地址"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="从属网关ID" prop="gatewayId">
<el-input
v-model="queryParams.gatewayId"
placeholder="请输入从属网关ID"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="纬度" prop="latValue">
<el-input
v-model="queryParams.latValue"
placeholder="请输入纬度"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="经度" prop="lagValue">
<el-input
v-model="queryParams.lagValue"
placeholder="请输入经度"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="是否告警" prop="alertEnabled">
<el-select v-model="queryParams.alertEnabled" placeholder="请选择设备类型" clearable>
<el-option
v-for="dict in alertEnabled"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="设备模型" prop="deviceModelId">
<el-select v-model="queryParams.deviceModelId" placeholder="请选择设备模型id" clearable>
<el-option label="请选择设备模型" value="deviceModelId" />
</el-select>
</el-form-item>
<el-form-item label="租户号" prop="tentantId">
<el-input
v-model="queryParams.tentantId"
placeholder="请输入租户号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备分组" prop="deviceGroupId">
<el-select v-model="queryParams.deviceGroupId" placeholder="请选择设备分组ID" clearable>
<el-option label="请添加设备分组" value="" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</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 v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="中台设备编码" align="center" prop="centerDeviceCode" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="通讯来源类型" align="center" prop="deviceSource" />
<el-table-column label="通讯来源设备ID" align="center" prop="deviceSourceId" />
<el-table-column label="是否可用" align="center" prop="enabledFlag" >
<template #default="scope">
<dict-tag :options="enabledFlag" :value="scope.row.enabledFlag"/>
</template>
</el-table-column>
<el-table-column label="设备类型" align="center" prop="deviceType">
<template #default="scope">
<dict-tag :options="dc_device_type" :value="scope.row.deviceType"/>
</template>
</el-table-column>
<el-table-column label="所属组织编码" align="center" prop="orgCode" />
<el-table-column label="所属组织名称" align="center" prop="orgName" />
<el-table-column label="位置编码" align="center" prop="locationCode" />
<el-table-column label="位置名称" align="center" prop="locationName" />
<el-table-column label="设备应用范围" align="center" prop="deviceClass" />
<el-table-column label="接口名称" align="center" prop="apiName" />
<el-table-column label="服务器地址" align="center" prop="serverIp" />
<el-table-column label="从属网关ID" align="center" prop="gatewayId" />
<el-table-column label="纬度" align="center" prop="latValue" />
<el-table-column label="经度" align="center" prop="lagValue" />
<el-table-column label="是否告警" align="center" prop="alertEnabled" >
<template #default="scope">
<dict-tag :options="alert_enabled" :value="scope.row.alertEnabled"/>
</template>
</el-table-column>
<el-table-column label="设备模型" align="center" prop="deviceModelId" >
</el-table-column>
<el-table-column label="租户号" align="center" prop="tentantId" />
<el-table-column label="设备分组" align="center" prop="deviceGroupId" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
type="text"
icon="Edit"
@click="handleParams(scope.row)"
>维护设备参数</el-button>
<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="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改设备信息对话框 -->
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
<el-form ref="deviceRef" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="中台设备编码" prop="centerDeviceCode">
<el-input v-model="form.centerDeviceCode" placeholder="请输入中台设备编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="通讯来源类型" prop="deviceSource">
<el-input v-model="form.deviceSource" placeholder="请输入通讯来源类型;ThingsDB/KingIO/Tk" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="通讯来源设备ID" prop="deviceSourceId">
<el-input v-model="form.deviceSourceId" placeholder="请输入通讯来源设备ID" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否可用" prop="enabledFlag">
<el-select v-model="form.enabledFlag" placeholder="请选择是否可用">
<el-option
v-for="dict in enabledFlag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="form.deviceType" placeholder="请选择设备类型">
<el-option
v-for="dict in dc_device_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="orgCode">
<el-input v-model="form.orgCode" placeholder="请输入所属组织编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属组织名称" prop="orgName">
<el-input v-model="form.orgName" placeholder="请输入所属组织名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="位置编码" prop="locationCode">
<el-input v-model="form.locationCode" placeholder="请输入位置编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="位置名称" prop="locationName">
<el-input v-model="form.locationName" placeholder="请输入位置名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备应用范围" prop="deviceClass">
<el-input v-model="form.deviceClass" placeholder="请输入设备应用范围" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="接口名称" prop="apiName">
<el-input v-model="form.apiName" placeholder="请输入接口名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="服务器地址" prop="serverIp">
<el-input v-model="form.serverIp" placeholder="请输入服务器地址" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="从属网关ID" prop="gatewayId">
<el-input v-model="form.gatewayId" placeholder="请输入从属网关ID" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="纬度" prop="latValue">
<el-input v-model="form.latValue" placeholder="请输入纬度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="经度" prop="lagValue">
<el-input v-model="form.lagValue" placeholder="请输入经度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否告警" prop="alertEnabled">
<el-select v-model="form.alertEnabled" placeholder="请选择是否告警">
<el-option
v-for="dict in alertEnabled"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备模型" prop="deviceModelId">
<el-select v-model="form.deviceModelId" placeholder="请选择设备模型id">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="租户号" prop="tentantId">
<el-input v-model="form.tentantId" placeholder="请输入租户号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备分组" prop="deviceGroupId">
<el-select v-model="form.deviceGroupId" placeholder="请选择设备分组ID">
<el-option label="请选择字典生成" value="" />
</el-select>
</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>
<script setup name="Device">
import { listDevice, getDevice, delDevice, addDevice, updateDevice } from "@/api/model/device";
const { proxy } = getCurrentInstance();
const { dc_device_type } = proxy.useDict('dc_device_type');
const router = useRouter();
const deviceList = 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 enabledFlag = ref([
{label: '可用', value: 'true', elTagType: 'default', elTagClass: null},
{label: '不可用', value: 'false', elTagType: 'default', elTagClass: null}
]);
const alert_enabled = ref([
{label: '告警', value: 'true', elTagType: 'default', elTagClass: null},
{label: '不告警', value: 'false', elTagType: 'default', elTagClass: null}
]);
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
centerDeviceCode: null,
deviceName: null,
deviceSource: null,
deviceSourceId: null,
enabledFlag: null,
deviceType: null,
orgCode: null,
orgName: null,
locationCode: null,
locationName: null,
deviceClass: null,
apiName: null,
serverIp: null,
gatewayId: null,
latValue: null,
lagValue: null,
uuid: null,
alertEnabled: null,
deviceModelId: null,
tentantId: null,
deviceGroupId: null
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询设备信息列表 */
function getList() {
loading.value = true;
listDevice(queryParams.value).then(response => {
deviceList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
centerDeviceCode: null,
deviceName: null,
deviceSource: null,
deviceSourceId: null,
enabledFlag: null,
deviceType: null,
orgCode: null,
orgName: null,
locationCode: null,
locationName: null,
deviceClass: null,
apiName: null,
serverIp: null,
gatewayId: null,
latValue: null,
lagValue: null,
uuid: null,
alertEnabled: null,
deviceModelId: null,
tentantId: null,
version: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
deptId: null,
userId: null,
deleteBy: null,
deleteTime: null,
id: null,
deviceGroupId: null
};
proxy.resetForm("deviceRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加设备信息";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getDevice(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改设备信息";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["deviceRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateDevice(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addDevice(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 delDevice(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/device/export', {
...queryParams.value
}, `device_${new Date().getTime()}.xlsx`)
}
onMounted(() => {
// debugger
console.log("-------------"+queryParams.deviceType);
queryParams.deviceType = queryParams.deviceType;
//
//
// form.value.pid=tempPid;
});
function handleParams(row){
const path = "params";
router.push({
path: path,
query: {
deviceUuid: row.uuid
}
});
}
getList();
</script>

2
src/views/model/devicemodel/addmodel.vue

@ -186,8 +186,6 @@ const updateModelSubmit = ref([]);
const operateModelIds = ref([]); const operateModelIds = ref([]);
const updateModelIds = ref([]); const updateModelIds = ref([]);
const deleteModelIds = ref([]); const deleteModelIds = ref([]);
console.log(router);
console.log(proxy);
const tempPid = router.currentRoute._value.query.pid; const tempPid = router.currentRoute._value.query.pid;
const data = reactive({ const data = reactive({
form: { form: {

26
src/views/model/devicemodel/index.vue

@ -38,16 +38,6 @@
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="是否是叶节点" prop="isLeaf">
<el-select v-model="queryParams.isLeaf" placeholder="请选择是否是叶节点" clearable>
<el-option
v-for="dict in dc_is_leaf"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否可用" prop="vailable"> <el-form-item label="是否可用" prop="vailable">
<el-select v-model="queryParams.vailable" placeholder="请选择是否可用" clearable> <el-select v-model="queryParams.vailable" placeholder="请选择是否可用" clearable>
<el-option <el-option
@ -104,11 +94,6 @@
</el-table-column> </el-table-column>
<el-table-column label="上级id" align="center" prop="pid" /> <el-table-column label="上级id" align="center" prop="pid" />
<el-table-column label="备注" align="center" prop="note" /> <el-table-column label="备注" align="center" prop="note" />
<el-table-column label="是否是叶节点" align="center" prop="isLeaf">
<template #default="scope">
<dict-tag :options="dc_is_leaf" :value="scope.row.isLeaf"/>
</template>
</el-table-column>
<el-table-column label="是否可用" align="center" prop="vailable"> <el-table-column label="是否可用" align="center" prop="vailable">
<template #default="scope"> <template #default="scope">
<dict-tag :options="available" :value="scope.row.vailable"/> <dict-tag :options="available" :value="scope.row.vailable"/>
@ -144,7 +129,7 @@
<el-form-item label="排序" prop="sort"> <el-form-item label="排序" prop="sort">
<el-input v-model="form.sort" placeholder="请输入排序" /> <el-input v-model="form.sort" placeholder="请输入排序" />
</el-form-item> </el-form-item>
<el-form-item label="模型类别Id" prop="modelTypeId"> <el-form-item label="模型类别" prop="modelTypeId">
<el-select v-model="form.modelTypeId" placeholder="请选择模型类别Id"> <el-select v-model="form.modelTypeId" placeholder="请选择模型类别Id">
<el-option label="请选择字典生成" value="" /> <el-option label="请选择字典生成" value="" />
</el-select> </el-select>
@ -206,8 +191,13 @@ const title = ref("");
const isExpandAll = ref(true); const isExpandAll = ref(true);
const refreshTable = ref(true); const refreshTable = ref(true);
const router = useRouter(); const router = useRouter();
const available = [
{label: '可用', value: 'true', elTagType: 'default', elTagClass: null},
{label: '不可用', value: 'false', elTagType: 'default', elTagClass: null}
];
const data = reactive({ const data = reactive({
form: {}, form: {
},
queryParams: { queryParams: {
modelName: null, modelName: null,
modelCode: null, modelCode: null,
@ -264,7 +254,7 @@ function getTreeselect() {
devicemodelOptions.value.push(data); devicemodelOptions.value.push(data);
}); });
} }
// //
function cancel() { function cancel() {
open.value = false; open.value = false;

518
src/views/model/params/index.vue

@ -0,0 +1,518 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="120px">
<el-form-item label="中台设备UUID" prop="deviceUuid">
<el-input
v-model="queryParams.deviceUuid"
placeholder="请输入中台设备UUID"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="参数名称" prop="paramName">
<el-input
v-model="queryParams.paramName"
placeholder="请输入参数名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="参数编码" prop="paramCode">
<el-input
v-model="queryParams.paramCode"
placeholder="请输入参数编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<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-form-item label="是否可控" prop="contrlFlag">
<el-select v-model="queryParams.contrlFlag" placeholder="请选择是否可控" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<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-form-item label="是否有效" prop="enabled">
<el-select v-model="queryParams.enabled" placeholder="请选择是否有效" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="设置值" prop="setDefautvalue">
<el-input
v-model="queryParams.setDefautvalue"
placeholder="请输入设置值"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="偏移量" prop="setAdjustvalue">
<el-input
v-model="queryParams.setAdjustvalue"
placeholder="请输入偏移量"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="验证范围" prop="validateScope">
<el-input
v-model="queryParams.validateScope"
placeholder="请输入验证范围"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="全局统一编码" prop="globalCode">
<el-input
v-model="queryParams.globalCode"
placeholder="请输入全局统一编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<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-form-item label="分区(字典)" prop="partion">
<el-select v-model="queryParams.partion" placeholder="请选择分区(字典)" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="plc地址" prop="plcAdr">
<el-input
v-model="queryParams.plcAdr"
placeholder="请输入plc地址"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="是/否可控制" prop="controllab">
<el-select v-model="queryParams.controllab" placeholder="请选择是/否可控制" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</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 v-loading="loading" :data="paramsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="中台设备UUID" align="center" prop="deviceUuid" />
<el-table-column label="参数名称" align="center" prop="paramName" />
<el-table-column label="参数编码" align="center" prop="paramCode" />
<el-table-column label="数据类型" align="center" prop="paramType">
<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">
<template #default="scope">
<dict-tag :options="contrlFlag" :value="scope.row.contrlFlag"/>
</template>
</el-table-column>
<el-table-column label="参数单位" align="center" prop="contrlType">
<template #default="scope">
<dict-tag :options="dc_param_uint_type" :value="scope.row.contrlType"/>
</template>
</el-table-column>
<el-table-column label="是否有效" align="center" prop="enabled">
<template #default="scope">
<dict-tag :options="enabled" :value="scope.row.enabled"/>
</template>
</el-table-column>
<el-table-column label="设置值" align="center" prop="setDefautvalue" />
<el-table-column label="偏移量" align="center" prop="setAdjustvalue" />
<el-table-column label="验证范围" align="center" prop="validateScope" />
<el-table-column label="全局统一编码" align="center" prop="globalCode" />
<el-table-column label="参数模版ID" align="center" prop="paramModelId" />
<el-table-column label="分区(字典)" align="center" prop="partion" />
<el-table-column label="plc地址" align="center" prop="plcAdr" />
<el-table-column label="是/否可控制" align="center" prop="controllab" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<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="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改设备参数明细对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="paramsRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="中台设备UUID" prop="deviceUuid">
<el-input v-model="form.deviceUuid" placeholder="请输入中台设备UUID" />
</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="paramCode">
<el-input v-model="form.paramCode" placeholder="请输入参数编码" />
</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 label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数单位" prop="contrlType">
<el-select v-model="form.contrlType" placeholder="请选择参数单位">
<el-option
v-for="dict in dc_param_uint_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="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="请输入全局统一编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数模版ID" prop="paramModelId">
<el-select v-model="form.paramModelId" placeholder="请选择参数模版ID">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分区(字典)" prop="partion">
<el-select v-model="form.partion" placeholder="请选择分区(字典)">
<el-option label="请选择字典生成" value="" />
</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-col :span="12">
<el-form-item label="是/否可控制" prop="controllab">
<el-select v-model="form.controllab" placeholder="请选择是/否可控制">
<el-option label="请选择字典生成" value="" />
</el-select>
</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>
<script setup name="Params">
import { listParams, getParams, delParams, addParams, updateParams } from "@/api/model/params";
const { proxy } = getCurrentInstance();
const router = useRouter();
const { dc_param_uint_type, dc_param_value_type } = proxy.useDict('dc_param_uint_type', 'dc_param_value_type');
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 deviceUuid = router.currentRoute._value.query.deviceUuid;
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 data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
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,
controllab: null
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询设备参数明细列表 */
function getList() {
loading.value = true;
debugger
if(deviceUuid != null && deviceUuid != undefined && deviceUuid != ""){
queryParams.value.deviceUuid = deviceUuid;
listParams(queryParams.value).then(response => {
paramsList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}else{
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,
controllab: null
};
proxy.resetForm("paramsRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加设备参数明细";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getParams(_id).then(response => {
form.value = response.data;
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/params/export', {
...queryParams.value
}, `params_${new Date().getTime()}.xlsx`)
}
getList();
</script>
Loading…
Cancel
Save