refactor(iot): 重构设备类型相关功能,改成在线
- 添加设备类型管理列表 - 修改设备类型相关的条件判断,使用新的设备类型代码 - 更新设备类型列表的获取方式,使用 listDeviceType接口 - 调整参数列表的传递方式,从 typeKeys 改为 paramList - 优化设备类型选择后的参数列表加载逻辑
This commit is contained in:
parent
682fa7e458
commit
d25b3e1e6b
|
@ -0,0 +1,44 @@
|
||||||
|
import request from "@/utils/request";
|
||||||
|
|
||||||
|
// 查询设备类型列表
|
||||||
|
export function listDeviceType(query) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/category/list",
|
||||||
|
method: "get",
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询设备类型详细
|
||||||
|
export function getDeviceType(id) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/category/" + id,
|
||||||
|
method: "get"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增设备类型
|
||||||
|
export function addDeviceType(data) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/category",
|
||||||
|
method: "post",
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改设备类型
|
||||||
|
export function updateDeviceType(data) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/category",
|
||||||
|
method: "put",
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除设备类型
|
||||||
|
export function delDeviceType(id) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/category/" + id,
|
||||||
|
method: "delete"
|
||||||
|
});
|
||||||
|
}
|
|
@ -47,7 +47,7 @@
|
||||||
import { getTypeParam } from "@/basedata/typeParams";
|
import { getTypeParam } from "@/basedata/typeParams";
|
||||||
export default {
|
export default {
|
||||||
name: "DeviceParam",
|
name: "DeviceParam",
|
||||||
props: ["typeKeys"],
|
props: ["paramList"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [],
|
list: [],
|
||||||
|
@ -57,7 +57,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
getParams() {
|
getParams() {
|
||||||
this.list = [];
|
this.list = [];
|
||||||
const newArr = getTypeParam(this.typeKeys);
|
const newArr = getTypeParam(this.paramList);
|
||||||
if (newArr) {
|
if (newArr) {
|
||||||
newArr.forEach((v) => {
|
newArr.forEach((v) => {
|
||||||
this.list.push(Object.assign({}, v));
|
this.list.push(Object.assign({}, v));
|
||||||
|
@ -73,9 +73,12 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
typeKeys(val) {
|
paramList(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.getParams();
|
// this.getParams();
|
||||||
|
this.list = val;
|
||||||
|
}else{
|
||||||
|
this.list = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
@change="handleQuery"
|
@change="handleQuery"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:key="vals"
|
:key="item.id"
|
||||||
:label="keys"
|
:label="item.categoryName"
|
||||||
:value="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -214,10 +214,10 @@
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:key="vals"
|
:key="item.id"
|
||||||
:label="keys"
|
:label="item.categoryName"
|
||||||
:value="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -280,6 +280,7 @@ import {
|
||||||
import { listDeviceTypeList } from "@/api/iot/device";
|
import { listDeviceTypeList } from "@/api/iot/device";
|
||||||
import { listUser } from "@/api/system/user";
|
import { listUser } from "@/api/system/user";
|
||||||
import DialogTemplate from "@/components/DialogTemplate/index";
|
import DialogTemplate from "@/components/DialogTemplate/index";
|
||||||
|
import { listDeviceType } from '../../../../api/iot/deviceType'
|
||||||
// import { selectedProdmodel } from "@/api/device/prodmodel";
|
// import { selectedProdmodel } from "@/api/device/prodmodel";
|
||||||
const alarmDivideType = {
|
const alarmDivideType = {
|
||||||
ALARM: "报警",
|
ALARM: "报警",
|
||||||
|
@ -355,8 +356,12 @@ export default {
|
||||||
},
|
},
|
||||||
// 查询设备类型列表
|
// 查询设备类型列表
|
||||||
getDeviceTypeList() {
|
getDeviceTypeList() {
|
||||||
listDeviceTypeList().then((response) => {
|
listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => {
|
||||||
this.deviceTypeList = response.data;
|
if(response.rows){
|
||||||
|
this.deviceTypeList = response.rows || [];
|
||||||
|
}else{
|
||||||
|
this.deviceTypeList = [];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
sortChange(column) {
|
sortChange(column) {
|
||||||
|
|
|
@ -261,7 +261,7 @@ export default {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
modelId: "",
|
modelId: "",
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
deviceType: "GATEWAY_CONTROLLER"
|
deviceType: "10001"
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
|
|
@ -206,7 +206,7 @@
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.deviceType === 'MINIATURE_BREAKER'" label="父设备:" prop="parentId">
|
<el-form-item v-if="form.deviceType === '10002'" label="父设备:" prop="parentId">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.parentName"
|
v-model="form.parentName"
|
||||||
placeholder="点击选择父设备"
|
placeholder="点击选择父设备"
|
||||||
|
@ -214,7 +214,7 @@
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item v-if="form.deviceType === 'MINIATURE_BREAKER'" label="线路类型:" prop="lineType">
|
<el-form-item v-if="form.deviceType === '10002'" label="线路类型:" prop="lineType">
|
||||||
<el-select v-model="form.lineType" clearable placeholder="请选择线路类型" style="width: 100%;">
|
<el-select v-model="form.lineType" clearable placeholder="请选择线路类型" style="width: 100%;">
|
||||||
<el-option v-for="(keys, vals) in lineTypeOpt" :key="vals" :label="keys" :value="vals" />
|
<el-option v-for="(keys, vals) in lineTypeOpt" :key="vals" :label="keys" :value="vals" />
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -416,7 +416,7 @@ export default {
|
||||||
params: {
|
params: {
|
||||||
protocolType: "",
|
protocolType: "",
|
||||||
modelName: "",
|
modelName: "",
|
||||||
deviceType: 'GATEWAY_CONTROLLER'
|
deviceType: '10001'
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -543,7 +543,7 @@ export default {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
modelId: "",
|
modelId: "",
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
deviceType: "GATEWAY_CONTROLLER"
|
deviceType: "10001"
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -704,7 +704,7 @@ export default {
|
||||||
this.selectTableShow = false;
|
this.selectTableShow = false;
|
||||||
},
|
},
|
||||||
deviceTypeChange(val) {
|
deviceTypeChange(val) {
|
||||||
if (val !== "MINIATURE_BREAKER") {
|
if (val !== "10002") {
|
||||||
this.form.parentId = 0;
|
this.form.parentId = 0;
|
||||||
this.form.parentName = "";
|
this.form.parentName = "";
|
||||||
} else if (!val) {
|
} else if (!val) {
|
||||||
|
@ -722,7 +722,7 @@ export default {
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listDevice(Object.assign(this.queryParams , {
|
listDevice(Object.assign(this.queryParams , {
|
||||||
deviceType: 'GATEWAY_CONTROLLER'
|
deviceType: '10001'
|
||||||
})).then(response => {
|
})).then(response => {
|
||||||
this.deviceList = response.rows;
|
this.deviceList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
|
@ -785,7 +785,7 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.form.paramList = this.$refs.paramWrap.getResult();
|
this.form.paramList = this.$refs.paramWrap.getResult();
|
||||||
this.form.lineType =
|
this.form.lineType =
|
||||||
this.form.deviceType === "MINIATURE_BREAKER"
|
this.form.deviceType === "10002"
|
||||||
? this.form.lineType
|
? this.form.lineType
|
||||||
: undefined;
|
: undefined;
|
||||||
if (this.form.deviceId != null) {
|
if (this.form.deviceId != null) {
|
||||||
|
|
|
@ -106,10 +106,10 @@
|
||||||
@change="handleQuery"
|
@change="handleQuery"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:key="vals"
|
:key="item.id"
|
||||||
:label="keys"
|
:label="item.categoryName"
|
||||||
:value="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -263,7 +263,7 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-search"
|
icon="el-icon-search"
|
||||||
v-if="scope.row.deviceType === 'GATEWAY_CONTROLLER'"
|
v-if="scope.row.deviceType === '10001'"
|
||||||
@click="handleDetails(scope.row)"
|
@click="handleDetails(scope.row)"
|
||||||
>子设备管理</el-button> -->
|
>子设备管理</el-button> -->
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -441,19 +441,18 @@
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:key="vals"
|
:key="item.id"
|
||||||
:label="keys"
|
:label="item.categoryName"
|
||||||
:value="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="
|
v-if="
|
||||||
form.deviceType === 'MINIATURE_BREAKER' ||
|
form.deviceType === '10002' ||
|
||||||
form.deviceType === 'MOLDED_BREAKER' ||
|
form.deviceType === '10013' ||
|
||||||
form.deviceType === 'DOOR_SENSOR'
|
form.deviceType === '10008'
|
||||||
"
|
"
|
||||||
label="父设备:"
|
label="父设备:"
|
||||||
prop="parentId"
|
prop="parentId"
|
||||||
|
@ -471,7 +470,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="form.deviceType === 'MINIATURE_BREAKER'"
|
v-if="form.deviceType === '10002'"
|
||||||
label="线路类型:"
|
label="线路类型:"
|
||||||
prop="lineType"
|
prop="lineType"
|
||||||
>
|
>
|
||||||
|
@ -507,8 +506,8 @@
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="
|
v-if="
|
||||||
form.deviceType !== 'VIDEO_CONTROLLER' &&
|
form.deviceType !== '10012' &&
|
||||||
form.deviceType !== 'GATEWAY_CONTROLLER'
|
form.deviceType !== '10001'
|
||||||
"
|
"
|
||||||
label="设备标签:"
|
label="设备标签:"
|
||||||
prop="deviceTag"
|
prop="deviceTag"
|
||||||
|
@ -586,6 +585,7 @@ import EDialogTableInput from "@/components/EDialogTableInput";
|
||||||
import DialogTemplate from "@/components/DialogTemplate";
|
import DialogTemplate from "@/components/DialogTemplate";
|
||||||
import JsBarcode from "jsbarcode";
|
import JsBarcode from "jsbarcode";
|
||||||
import { getProjectGroupList, listProject } from "@/api/tenant/project";
|
import { getProjectGroupList, listProject } from "@/api/tenant/project";
|
||||||
|
import { listDeviceType } from '../../../api/iot/deviceType'
|
||||||
|
|
||||||
const deviceStatusOpt = {
|
const deviceStatusOpt = {
|
||||||
ONLINE: "在线",
|
ONLINE: "在线",
|
||||||
|
@ -723,7 +723,7 @@ const selectDeviceTable = {
|
||||||
labelWidth: "68px",
|
labelWidth: "68px",
|
||||||
params: {
|
params: {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
deviceType: "GATEWAY_CONTROLLER"
|
deviceType: "10001"
|
||||||
},
|
},
|
||||||
inline: true,
|
inline: true,
|
||||||
queryChilds: [
|
queryChilds: [
|
||||||
|
@ -880,7 +880,7 @@ export default {
|
||||||
// { required: true, message: "设备标签不能为空", trigger: "change" }
|
// { required: true, message: "设备标签不能为空", trigger: "change" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
deviceTypeList: {},
|
deviceTypeList: [],
|
||||||
deviceTagList: [],
|
deviceTagList: [],
|
||||||
imgPath: "",
|
imgPath: "",
|
||||||
};
|
};
|
||||||
|
@ -986,7 +986,7 @@ export default {
|
||||||
handleDetails(row) {
|
handleDetails(row) {
|
||||||
this.sourceId = row.deviceId;
|
this.sourceId = row.deviceId;
|
||||||
this.componectVal =
|
this.componectVal =
|
||||||
row.deviceType === "GATEWAY_CONTROLLER"
|
row.deviceType === "10001"
|
||||||
? "GatewayDetail"
|
? "GatewayDetail"
|
||||||
: "DetailsWrap";
|
: "DetailsWrap";
|
||||||
},
|
},
|
||||||
|
@ -1004,7 +1004,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deviceTypeChange(val) {
|
deviceTypeChange(val) {
|
||||||
if (val !== "MINIATURE_BREAKER") {
|
if (val !== "10002") {
|
||||||
this.form.parentId = 0;
|
this.form.parentId = 0;
|
||||||
this.form.parentName = "";
|
this.form.parentName = "";
|
||||||
} else if (!val) {
|
} else if (!val) {
|
||||||
|
@ -1014,8 +1014,15 @@ export default {
|
||||||
},
|
},
|
||||||
// 查询设备类型列表
|
// 查询设备类型列表
|
||||||
getDeviceTypeList() {
|
getDeviceTypeList() {
|
||||||
listDeviceTypeList().then(response => {
|
// listDeviceTypeList().then(response => {
|
||||||
this.deviceTypeList = response.data;
|
// this.deviceTypeList = response.data;
|
||||||
|
// });
|
||||||
|
listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => {
|
||||||
|
if(response.rows){
|
||||||
|
this.deviceTypeList = response.rows || [];
|
||||||
|
}else{
|
||||||
|
this.deviceTypeList = [];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 查询设备列表 */
|
/** 查询设备列表 */
|
||||||
|
@ -1091,7 +1098,7 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.form.paramList = this.$refs.paramWrap.getResult();
|
this.form.paramList = this.$refs.paramWrap.getResult();
|
||||||
this.form.lineType =
|
this.form.lineType =
|
||||||
this.form.deviceType === "MINIATURE_BREAKER"
|
this.form.deviceType === "10002"
|
||||||
? this.form.lineType
|
? this.form.lineType
|
||||||
: undefined;
|
: undefined;
|
||||||
if (this.form.deviceId != null) {
|
if (this.form.deviceId != null) {
|
||||||
|
|
|
@ -110,10 +110,10 @@
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
:label="keys"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:value="vals"
|
:key="item.id"
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
:label="item.categoryName"
|
||||||
:key="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -202,6 +202,7 @@ import { listModel, getModel } from "@/api/iot/model";
|
||||||
import SelectTableWrap from "@/components/SelectTable/index";
|
import SelectTableWrap from "@/components/SelectTable/index";
|
||||||
import ParamWrap from "@/components/ParamWrap/deviceParam";
|
import ParamWrap from "@/components/ParamWrap/deviceParam";
|
||||||
import DialogTemplate from "@/components/DialogTemplate";
|
import DialogTemplate from "@/components/DialogTemplate";
|
||||||
|
import { listDeviceType } from '../../../../api/iot/deviceType'
|
||||||
|
|
||||||
const lineTypeOpt = {
|
const lineTypeOpt = {
|
||||||
MAIN:'总路',
|
MAIN:'总路',
|
||||||
|
@ -341,7 +342,7 @@ export default {
|
||||||
params: {
|
params: {
|
||||||
modelName: "",
|
modelName: "",
|
||||||
modelCode: "",
|
modelCode: "",
|
||||||
deviceType: 'MINIATURE_BREAKER',
|
deviceType: '10002',
|
||||||
protocolType: ''
|
protocolType: ''
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
|
@ -457,8 +458,12 @@ export default {
|
||||||
},
|
},
|
||||||
// 查询设备类型列表
|
// 查询设备类型列表
|
||||||
getDeviceTypeList() {
|
getDeviceTypeList() {
|
||||||
listDeviceTypeList().then(response => {
|
listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => {
|
||||||
this.deviceTypeList = response.data;
|
if(response.rows){
|
||||||
|
this.deviceTypeList = response.rows || [];
|
||||||
|
}else{
|
||||||
|
this.deviceTypeList = [];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
|
@ -528,7 +533,7 @@ export default {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.form.paramList = this.$refs.paramWrap.getResult();
|
this.form.paramList = this.$refs.paramWrap.getResult();
|
||||||
this.form.lineType = this.form.deviceType === 'MINIATURE_BREAKER' ? this.form.lineType : undefined;
|
this.form.lineType = this.form.deviceType === '10002' ? this.form.lineType : undefined;
|
||||||
if (this.form.deviceId != null) {
|
if (this.form.deviceId != null) {
|
||||||
updateDevice(this.form).then(response => {
|
updateDevice(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
|
@ -553,7 +558,7 @@ export default {
|
||||||
parentName: this.pDevcieInfo.deviceName,
|
parentName: this.pDevcieInfo.deviceName,
|
||||||
parentId: this.pDevcieInfo.deviceId,
|
parentId: this.pDevcieInfo.deviceId,
|
||||||
deviceName: '',
|
deviceName: '',
|
||||||
deviceType: 'MINIATURE_BREAKER',
|
deviceType: '10002',
|
||||||
paramList: [],
|
paramList: [],
|
||||||
deviceKey: "",
|
deviceKey: "",
|
||||||
lineType: ''
|
lineType: ''
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane v-if="infoData.deviceType === 'GATEWAY_CONTROLLER'" label="子设备" name="child">
|
<el-tab-pane v-if="infoData.deviceType === '10001'" label="子设备" name="child">
|
||||||
<div class="tabs-body">
|
<div class="tabs-body">
|
||||||
<child-device
|
<child-device
|
||||||
v-if="activeName === 'child'"
|
v-if="activeName === 'child'"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="function-list-box">
|
<div class="function-list-box">
|
||||||
<div v-if="deviceInfo.deviceType === 'DOOR_SENSOR'" class="function-list">
|
<div v-if="deviceInfo.deviceType === '10008'" class="function-list">
|
||||||
<div class="function-item">
|
<div class="function-item">
|
||||||
<div class="function-item-label">开锁</div>
|
<div class="function-item-label">开锁</div>
|
||||||
<div class="function-item-main">
|
<div class="function-item-main">
|
||||||
|
|
|
@ -150,7 +150,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="infoData.deviceType === 'MINIATURE_BREAKER' || infoData.deviceType === 'MOLDED_BREAKER'" class="group-list-info" style="margin-top: 15px;">
|
<div v-if="infoData.deviceType === '10002' || infoData.deviceType === '10013'" class="group-list-info" style="margin-top: 15px;">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div class="top-label">
|
<div class="top-label">
|
||||||
<svg-icon icon-class="system" style="margin-right: 2px; height: 20px; width: 20px;" />告警配置
|
<svg-icon icon-class="system" style="margin-right: 2px; height: 20px; width: 20px;" />告警配置
|
||||||
|
@ -158,12 +158,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="infoData.deviceType === 'MINIATURE_BREAKER' || infoData.deviceType === 'MOLDED_BREAKER'" class="group-list-table" style="border: 0;">
|
<div v-if="infoData.deviceType === '10002' || infoData.deviceType === '10013'" class="group-list-table" style="border: 0;">
|
||||||
<device-alarm-config v-if="infoData.deviceType === 'MINIATURE_BREAKER' || infoData.deviceType === 'MOLDED_BREAKER'" :deviceId="infoData.deviceId" :deviceKey="infoData.deviceKey" />
|
<device-alarm-config v-if="infoData.deviceType === '10002' || infoData.deviceType === '10013'" :deviceId="infoData.deviceId" :deviceKey="infoData.deviceKey" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div v-if="infoData.deviceType === 'MINIATURE_BREAKER'" class="group-list-info" style="margin-top: 15px;">
|
<div v-if="infoData.deviceType === '10002'" class="group-list-info" style="margin-top: 15px;">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div class="top-label">
|
<div class="top-label">
|
||||||
<svg-icon icon-class="A_product1" style="margin-right: 2px; height: 20px; width: 20px;" />定时器
|
<svg-icon icon-class="A_product1" style="margin-right: 2px; height: 20px; width: 20px;" />定时器
|
||||||
|
@ -171,8 +171,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="infoData.deviceType === 'MINIATURE_BREAKER'" class="group-list-table" style="border: 0;">
|
<div v-if="infoData.deviceType === '10002'" class="group-list-table" style="border: 0;">
|
||||||
<device-timing-config v-if="infoData.deviceType === 'MINIATURE_BREAKER'" :deviceId="infoData.deviceId" :deviceKey="infoData.deviceKey" />
|
<device-timing-config v-if="infoData.deviceType === '10002'" :deviceId="infoData.deviceId" :deviceKey="infoData.deviceKey" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 添加或修改设备对话框 -->
|
<!-- 添加或修改设备对话框 -->
|
||||||
|
|
|
@ -0,0 +1,214 @@
|
||||||
|
<template>
|
||||||
|
<div class="params-wrap">
|
||||||
|
<el-table :data="paramList" style="width: 100%;" height="350" empty-text="暂无参数">
|
||||||
|
<el-table-column align="center" label="序号" type="index" width="60"></el-table-column>
|
||||||
|
<el-table-column label="参数标识" prop="paramKey" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model="scope.row.paramKey"
|
||||||
|
placeholder="请输入参数标识"
|
||||||
|
size="small"
|
||||||
|
:class="{ 'is-error': scope.row.paramKeyError }"
|
||||||
|
></el-input>
|
||||||
|
<div v-if="scope.row.paramKeyError" class="el-form-item__error">
|
||||||
|
{{ scope.row.paramKeyError }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="参数名称" prop="paramName" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model="scope.row.paramName"
|
||||||
|
placeholder="请输入参数名称"
|
||||||
|
size="small"
|
||||||
|
:class="{ 'is-error': scope.row.paramNameError }"
|
||||||
|
></el-input>
|
||||||
|
<div v-if="scope.row.paramNameError" class="el-form-item__error">
|
||||||
|
{{ scope.row.paramNameError }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="不锁定" prop="canModify" align="center" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.canModify"
|
||||||
|
:active-value="true"
|
||||||
|
:inactive-value="false"
|
||||||
|
active-color="#13ce66"
|
||||||
|
inactive-color="#dcdfe6"
|
||||||
|
></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="操作" width="60">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
style="color: red"
|
||||||
|
@click="removeParam(scope.$index)"
|
||||||
|
></el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div class="add-btn">
|
||||||
|
<el-button type="primary" style="width: 100%;" icon="el-icon-plus" size="small" @click="addParam">添加参数</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "ParamWrap",
|
||||||
|
props: {
|
||||||
|
list: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
paramList: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
list: {
|
||||||
|
handler(newVal, oldVal) {
|
||||||
|
this.paramList = newVal;
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addParam() {
|
||||||
|
this.paramList.push({
|
||||||
|
paramKey: "",
|
||||||
|
paramVal: "",
|
||||||
|
paramName: "",
|
||||||
|
canModify: true,
|
||||||
|
paramKeyError: "",
|
||||||
|
paramNameError: ""
|
||||||
|
});
|
||||||
|
},
|
||||||
|
removeParam(index) {
|
||||||
|
this.paramList.splice(index, 1);
|
||||||
|
},
|
||||||
|
setList(data) {
|
||||||
|
// 清空当前列表
|
||||||
|
// this.paramList.splice(0, this.paramList.length);
|
||||||
|
let paramList = [];
|
||||||
|
// 添加新数据
|
||||||
|
if (data && data.length > 0) {
|
||||||
|
data.forEach(item => {
|
||||||
|
const newItem = Object.assign({}, item);
|
||||||
|
// 添加错误提示字段
|
||||||
|
newItem.paramKeyError = "";
|
||||||
|
newItem.paramNameError = "";
|
||||||
|
paramList.push(newItem);
|
||||||
|
});
|
||||||
|
this.paramList = paramList
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 验证参数标识是否符合规则(只能由数字、字母、下划线、中划线组成)
|
||||||
|
validateParamKey(paramKey) {
|
||||||
|
const pattern = /^[a-zA-Z0-9_\-]+$/;
|
||||||
|
return pattern.test(paramKey);
|
||||||
|
},
|
||||||
|
// 清除所有错误提示
|
||||||
|
clearErrors() {
|
||||||
|
this.paramList.forEach(item => {
|
||||||
|
item.paramKeyError = "";
|
||||||
|
item.paramNameError = "";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 验证所有参数
|
||||||
|
validateParams() {
|
||||||
|
let isValid = true;
|
||||||
|
// 清除之前的错误提示
|
||||||
|
this.clearErrors();
|
||||||
|
|
||||||
|
// 检查每个参数
|
||||||
|
this.paramList.forEach((item, index) => {
|
||||||
|
// 验证参数标识
|
||||||
|
if (!item.paramKey) {
|
||||||
|
item.paramKeyError = "参数标识不能为空";
|
||||||
|
isValid = false;
|
||||||
|
} else if (!this.validateParamKey(item.paramKey)) {
|
||||||
|
item.paramKeyError = "参数标识只能由数字、字母、下划线、中划线组成";
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证参数名称
|
||||||
|
if (!item.paramName) {
|
||||||
|
item.paramNameError = "参数名称不能为空";
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return isValid;
|
||||||
|
},
|
||||||
|
getResult() {
|
||||||
|
// 先验证参数
|
||||||
|
if (!this.validateParams()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回处理后的参数列表(去除错误提示字段)
|
||||||
|
return this.paramList.map(item => {
|
||||||
|
const { paramKeyError, paramNameError, ...rest } = item;
|
||||||
|
return rest;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.params-wrap {
|
||||||
|
width: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 10px 0;
|
||||||
|
|
||||||
|
.no-data {
|
||||||
|
text-align: center;
|
||||||
|
color: #909399;
|
||||||
|
padding: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-btn {
|
||||||
|
margin-top: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-wrap::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
height: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-wrap::-webkit-scrollbar-thumb {
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: inset 0 0 5px #c4c4c4;
|
||||||
|
background: #dededea6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-wrap::-webkit-scrollbar-track {
|
||||||
|
box-shadow: inset 0 0 5px #f6f6f6;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加错误样式
|
||||||
|
:deep(.is-error input) {
|
||||||
|
border-color: #f56c6c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-form-item__error {
|
||||||
|
color: #f56c6c;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1;
|
||||||
|
padding-top: 4px;
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,383 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
v-show="showSearch"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
:model="queryParams"
|
||||||
|
class="main-search-card"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="类型标识" prop="categoryKey">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.categoryKey"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入类型标识"
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="类型名称" prop="categoryName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.categoryName"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入类型名称"
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in statusOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="dict.dictValue"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
@click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<div class="main-content-card">
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['iot:deviceType:add']"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
plain
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
@click="handleAdd"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="deviceTypeList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
:index="indexFormatter"
|
||||||
|
align="center"
|
||||||
|
label="序号"
|
||||||
|
type="index"
|
||||||
|
width="60px"
|
||||||
|
></el-table-column>
|
||||||
|
<!-- <el-table-column align="center" label="类型ID" prop="id" />-->
|
||||||
|
<el-table-column align="center" label="类型标识" prop="categoryKey" />
|
||||||
|
<el-table-column align="center" label="类型名称" prop="categoryName" />
|
||||||
|
<el-table-column align="center" label="状态" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="scope.row.status === '0' ? 'success' : 'info'">
|
||||||
|
{{ scope.row.status === '0' ? '启用' : '停用' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="备注" prop="remark" />
|
||||||
|
<el-table-column align="center" label="操作" width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
v-hasPermi="['iot:deviceType:edit']"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<!-- <el-button-->
|
||||||
|
<!-- v-hasPermi="['iot:deviceType:remove']"-->
|
||||||
|
<!-- icon="el-icon-delete"-->
|
||||||
|
<!-- size="mini"-->
|
||||||
|
<!-- type="text"-->
|
||||||
|
<!-- @click="handleDelete(scope.row)"-->
|
||||||
|
<!-- >删除</el-button-->
|
||||||
|
<!-- >-->
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:total="total"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加或修改设备类型对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="open"
|
||||||
|
width="750px"
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="类型标识" prop="categoryKey">
|
||||||
|
<el-input v-model="form.categoryKey" placeholder="请输入类型标识" :disabled="form.id != null" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="类型名称" prop="categoryName">
|
||||||
|
<el-input v-model="form.categoryName" placeholder="请输入类型名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in statusOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictValue"
|
||||||
|
>{{ dict.dictLabel }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="参数配置" prop="params">
|
||||||
|
<param-wrap ref="paramWrap" :list="paramList"></param-wrap>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button size="mini" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button size="mini" @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listDeviceType,
|
||||||
|
getDeviceType,
|
||||||
|
addDeviceType,
|
||||||
|
updateDeviceType,
|
||||||
|
delDeviceType
|
||||||
|
} from "@/api/iot/deviceType";
|
||||||
|
import ParamWrap from "./ParamWrap";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "DeviceType",
|
||||||
|
components: {
|
||||||
|
ParamWrap
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: false,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 设备类型表格数据
|
||||||
|
deviceTypeList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 状态选项
|
||||||
|
statusOptions: [
|
||||||
|
{ dictLabel: "启用", dictValue: "0" },
|
||||||
|
{ dictLabel: "停用", dictValue: "1" }
|
||||||
|
],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
categoryName: undefined,
|
||||||
|
categoryKey: undefined,
|
||||||
|
status: undefined
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 参数列表
|
||||||
|
paramList: [],
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
categoryKey: [
|
||||||
|
{ required: true, message: "类型标识不能为空", trigger: "blur" },
|
||||||
|
{
|
||||||
|
pattern: /^[a-zA-Z0-9_\-]+$/,
|
||||||
|
message: "类型标识只能由数字、字母、下划线、中划线组成",
|
||||||
|
trigger: "blur"
|
||||||
|
},
|
||||||
|
],
|
||||||
|
categoryName: [
|
||||||
|
{ required: true, message: "类型名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
status: [
|
||||||
|
{ required: true, message: "状态不能为空", trigger: "change" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询设备类型列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listDeviceType(this.queryParams).then(response => {
|
||||||
|
this.deviceTypeList = response.rows || response.data || [];
|
||||||
|
this.total = response.total || this.deviceTypeList.length || 0;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 序号格式化
|
||||||
|
indexFormatter(val) {
|
||||||
|
return val + 1 + (this.queryParams.pageNum - 1) * this.queryParams.pageSize;
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
categoryKey: undefined,
|
||||||
|
categoryName: undefined,
|
||||||
|
status: "0",
|
||||||
|
remark: undefined,
|
||||||
|
categoryParam: undefined
|
||||||
|
};
|
||||||
|
this.paramList = [];
|
||||||
|
this.resetForm("form");
|
||||||
|
if (this.$refs.paramWrap) {
|
||||||
|
this.$refs.paramWrap.setList([]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加设备类型";
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id);
|
||||||
|
this.single = selection.length !== 1;
|
||||||
|
this.multiple = !selection.length;
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || row.categoryKey;
|
||||||
|
getDeviceType(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
if (this.form.categoryParam) {
|
||||||
|
try {
|
||||||
|
const parsedParams = JSON.parse(this.form.categoryParam);
|
||||||
|
if (Array.isArray(parsedParams)) {
|
||||||
|
this.paramList = parsedParams;
|
||||||
|
} else {
|
||||||
|
this.paramList = [];
|
||||||
|
console.error('Parsed categoryParam is not an array:', parsedParams);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.paramList = [];
|
||||||
|
console.error('Failed to parse categoryParam:', e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.paramList = [];
|
||||||
|
}
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改设备类型";
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.$refs.paramWrap) {
|
||||||
|
this.$refs.paramWrap.setList(this.paramList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
// 获取参数配置
|
||||||
|
const paramList = this.$refs.paramWrap.getResult();
|
||||||
|
|
||||||
|
// 如果参数验证失败,paramList将返回false
|
||||||
|
if (paramList === false) {
|
||||||
|
this.$message.error("请检查参数配置是否填写正确");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.form.categoryParam = JSON.stringify(paramList);
|
||||||
|
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateDeviceType(this.form).then(response => {
|
||||||
|
this.$message.success("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addDeviceType(this.form).then(response => {
|
||||||
|
this.$message.success("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const id = row.id || row.categoryKey;
|
||||||
|
this.$confirm("是否确认删除设备类型?")
|
||||||
|
.then(function() {
|
||||||
|
return delDeviceType(id);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$message.success("删除成功");
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.param-item {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.param-item .el-input {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -316,12 +316,13 @@
|
||||||
placeholder="请选择设备类型"
|
placeholder="请选择设备类型"
|
||||||
size="small"
|
size="small"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
|
@change="handleDeviceTypeChange"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:key="vals"
|
:key="item.id"
|
||||||
:label="keys"
|
:label="item.categoryName"
|
||||||
:value="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -335,7 +336,7 @@
|
||||||
<div class="form-params-wrap">
|
<div class="form-params-wrap">
|
||||||
<param-wrap
|
<param-wrap
|
||||||
ref="paramWrap"
|
ref="paramWrap"
|
||||||
:typeKeys="form.deviceType"
|
:paramList="form.paramList"
|
||||||
></param-wrap>
|
></param-wrap>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -470,6 +471,7 @@ import groupForm from "@/views/profile/attribute/groupForm";
|
||||||
import paramsJson from "@/views/profile/attribute/paramsJson";
|
import paramsJson from "@/views/profile/attribute/paramsJson";
|
||||||
import { listModelSeries, getModelSeries } from "@/api/iot/modelSeries";
|
import { listModelSeries, getModelSeries } from "@/api/iot/modelSeries";
|
||||||
import ParamsJsonWrap from "@/views/profile/attribute/paramsJson";
|
import ParamsJsonWrap from "@/views/profile/attribute/paramsJson";
|
||||||
|
import { listDeviceType } from '../../../api/iot/deviceType'
|
||||||
|
|
||||||
const deviceStartsOpt = {
|
const deviceStartsOpt = {
|
||||||
0: "禁用",
|
0: "禁用",
|
||||||
|
@ -612,9 +614,25 @@ export default {
|
||||||
},
|
},
|
||||||
// 查询设备类型列表
|
// 查询设备类型列表
|
||||||
getDeviceTypeList() {
|
getDeviceTypeList() {
|
||||||
listDeviceTypeList().then(response => {
|
listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => {
|
||||||
this.deviceTypeList = response.data;
|
if(response.rows){
|
||||||
|
this.deviceTypeList = response.rows.map(item => {
|
||||||
|
let categoryParamList = [];
|
||||||
|
if(item.categoryParam){
|
||||||
|
categoryParamList = JSON.parse(item.categoryParam) || []
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
categoryParamList
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
this.deviceTypeList = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDeviceTypeChange(e){
|
||||||
|
this.form.paramList = this.deviceTypeList.find(item => item.categoryKey === e).categoryParamList || [];
|
||||||
},
|
},
|
||||||
openProductTableSelectDialog() {
|
openProductTableSelectDialog() {
|
||||||
this.selectResult = {};
|
this.selectResult = {};
|
||||||
|
|
|
@ -217,12 +217,13 @@
|
||||||
placeholder="请选择设备类型"
|
placeholder="请选择设备类型"
|
||||||
size="small"
|
size="small"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
|
@change="handleDeviceTypeChange"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:key="vals"
|
:key="item.id"
|
||||||
:label="keys"
|
:label="item.categoryName"
|
||||||
:value="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -236,7 +237,7 @@
|
||||||
<div class="form-params-wrap">
|
<div class="form-params-wrap">
|
||||||
<param-wrap
|
<param-wrap
|
||||||
ref="paramWrap"
|
ref="paramWrap"
|
||||||
:typeKeys="form.deviceType"
|
:paramList="form.paramList"
|
||||||
></param-wrap>
|
></param-wrap>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -325,6 +326,7 @@ import paramsJson from "@/views/profile/attribute/paramsJson";
|
||||||
import ParamWrap from "@/components/ParamWrap/deviceParam";
|
import ParamWrap from "@/components/ParamWrap/deviceParam";
|
||||||
import AttributeView from "@/views/profile/attribute/index";
|
import AttributeView from "@/views/profile/attribute/index";
|
||||||
import ParamsJsonWrap from "@/views/profile/attribute/paramsJson";
|
import ParamsJsonWrap from "@/views/profile/attribute/paramsJson";
|
||||||
|
import { listDeviceType } from '../../../api/iot/deviceType'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ModelSeries",
|
name: "ModelSeries",
|
||||||
|
@ -457,9 +459,25 @@ export default {
|
||||||
},
|
},
|
||||||
// 查询设备类型列表
|
// 查询设备类型列表
|
||||||
getDeviceTypeList() {
|
getDeviceTypeList() {
|
||||||
listDeviceTypeList().then((response) => {
|
listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => {
|
||||||
this.deviceTypeList = response.data;
|
if(response.rows){
|
||||||
|
this.deviceTypeList = response.rows.map(item => {
|
||||||
|
let categoryParamList = [];
|
||||||
|
if(item.categoryParam){
|
||||||
|
categoryParamList = JSON.parse(item.categoryParam) || []
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
categoryParamList
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
this.deviceTypeList = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDeviceTypeChange(e){
|
||||||
|
this.form.paramList = this.deviceTypeList.find(item => item.categoryKey === e).categoryParamList || [];
|
||||||
},
|
},
|
||||||
sortChange(column) {
|
sortChange(column) {
|
||||||
const sort = {
|
const sort = {
|
||||||
|
|
|
@ -451,7 +451,7 @@ const selectDeviceTable = {
|
||||||
params: {
|
params: {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
deviceType: "MINIATURE_BREAKER",
|
deviceType: "10002",
|
||||||
},
|
},
|
||||||
inline: true,
|
inline: true,
|
||||||
queryChilds: [
|
queryChilds: [
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
v-if="scope.row.deviceType !== 'MINIATURE_BREAKER'"
|
v-if="scope.row.deviceType !== '10002'"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -163,7 +163,7 @@ export default {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
modelId: "",
|
modelId: "",
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
deviceType: "GATEWAY_CONTROLLER"
|
deviceType: "10001"
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="150">
|
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="150">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.deviceType !== 'MINIATURE_BREAKER' && infoData && infoData.projectRole !== 'personal'"
|
v-if="scope.row.deviceType !== '10002' && infoData && infoData.projectRole !== 'personal'"
|
||||||
v-hasPermi="['iot:label:edit']"
|
v-hasPermi="['iot:label:edit']"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="150">
|
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="150">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.deviceType !== 'MINIATURE_BREAKER' && infoData.projectRole !== 'personal'"
|
v-if="scope.row.deviceType !== '10002' && infoData.projectRole !== 'personal'"
|
||||||
v-hasPermi="['project:device:relieve']"
|
v-hasPermi="['project:device:relieve']"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -167,7 +167,7 @@ export default {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
modelId: "",
|
modelId: "",
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
deviceType: "GATEWAY_CONTROLLER"
|
deviceType: "10001"
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="150">
|
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="150">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.deviceType !== 'MINIATURE_BREAKER' && tagData.isDefault !=='Y' && infoData && infoData.projectRole !== 'personal'"
|
v-if="scope.row.deviceType !== '10002' && tagData.isDefault !=='Y' && infoData && infoData.projectRole !== 'personal'"
|
||||||
v-hasPermi="['iot:label:edit']"
|
v-hasPermi="['iot:label:edit']"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -181,7 +181,7 @@ export default {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
projectId: this.projectId,
|
projectId: this.projectId,
|
||||||
labelType: this.tagData.labelType,
|
labelType: this.tagData.labelType,
|
||||||
deviceType: "GATEWAY_CONTROLLER"
|
deviceType: "10001"
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
v-if="scope.row.deviceType !== 'MINIATURE_BREAKER'"
|
v-if="scope.row.deviceType !== '10002'"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -163,7 +163,7 @@ export default {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
modelId: "",
|
modelId: "",
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
deviceType: "GATEWAY_CONTROLLER"
|
deviceType: "10001"
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
|
|
@ -494,7 +494,7 @@ const selectDevieTable = {
|
||||||
labelWidth: "68px",
|
labelWidth: "68px",
|
||||||
params: {
|
params: {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
deviceType: "VIDEO_MONITOR",
|
deviceType: "10007",
|
||||||
},
|
},
|
||||||
inline: true,
|
inline: true,
|
||||||
queryChilds: [
|
queryChilds: [
|
||||||
|
|
|
@ -277,7 +277,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deviceTypeChange(val) {
|
deviceTypeChange(val) {
|
||||||
if (val !== "MINIATURE_BREAKER") {
|
if (val !== "10002") {
|
||||||
this.form.parentId = 0;
|
this.form.parentId = 0;
|
||||||
this.form.parentName = "";
|
this.form.parentName = "";
|
||||||
} else if (!val) {
|
} else if (!val) {
|
||||||
|
@ -295,7 +295,7 @@ export default {
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listDevice(Object.assign(this.queryParams , {
|
listDevice(Object.assign(this.queryParams , {
|
||||||
deviceType: 'GATEWAY_CONTROLLER'
|
deviceType: '10001'
|
||||||
})).then(response => {
|
})).then(response => {
|
||||||
this.deviceList = response.rows;
|
this.deviceList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
|
@ -358,7 +358,7 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.form.paramList = this.$refs.paramWrap.getResult();
|
this.form.paramList = this.$refs.paramWrap.getResult();
|
||||||
this.form.lineType =
|
this.form.lineType =
|
||||||
this.form.deviceType === "MINIATURE_BREAKER"
|
this.form.deviceType === "10002"
|
||||||
? this.form.lineType
|
? this.form.lineType
|
||||||
: undefined;
|
: undefined;
|
||||||
if (this.form.deviceId != null) {
|
if (this.form.deviceId != null) {
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
<el-form-item label="设备类型" prop="deviceType">
|
<el-form-item label="设备类型" prop="deviceType">
|
||||||
<el-select v-model="queryParams.deviceType" clearable placeholder="请选择设备类型" size="small">
|
<el-select v-model="queryParams.deviceType" clearable placeholder="请选择设备类型" size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:key="vals"
|
:key="item.id"
|
||||||
:label="keys"
|
:label="item.categoryName"
|
||||||
:value="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -130,6 +130,7 @@ import {
|
||||||
// import { listDeviceTypeList } from "@/api/tenant/device";
|
// import { listDeviceTypeList } from "@/api/tenant/device";
|
||||||
import DetailsWrap from "./profile/details";
|
import DetailsWrap from "./profile/details";
|
||||||
import GatewayDetail from '@/views/profile/DeviceDetailsView/index'
|
import GatewayDetail from '@/views/profile/DeviceDetailsView/index'
|
||||||
|
import { listDeviceType } from '../../../api/iot/deviceType'
|
||||||
const deviceStatusOpt = {
|
const deviceStatusOpt = {
|
||||||
ONLINE: "在线",
|
ONLINE: "在线",
|
||||||
OFFLINE: "离线",
|
OFFLINE: "离线",
|
||||||
|
@ -185,7 +186,7 @@ export default {
|
||||||
isAsc: "desc"
|
isAsc: "desc"
|
||||||
},
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
deviceTypeList: {}
|
deviceTypeList: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -219,14 +220,14 @@ export default {
|
||||||
},
|
},
|
||||||
handleDetails(row) {
|
handleDetails(row) {
|
||||||
this.sourceId = row.deviceId;
|
this.sourceId = row.deviceId;
|
||||||
this.componectVal = row.deviceType === 'GATEWAY_CONTROLLER'? 'GatewayDetail' : "DetailsWrap";
|
this.componectVal = row.deviceType === '10001'? 'GatewayDetail' : "DetailsWrap";
|
||||||
},
|
},
|
||||||
// 跳转详情页
|
// 跳转详情页
|
||||||
toTableClick() {
|
toTableClick() {
|
||||||
this.componectVal = "";
|
this.componectVal = "";
|
||||||
},
|
},
|
||||||
deviceTypeChange(val) {
|
deviceTypeChange(val) {
|
||||||
if (val !== "MINIATURE_BREAKER") {
|
if (val !== "10002") {
|
||||||
this.form.parentId = 0;
|
this.form.parentId = 0;
|
||||||
this.form.parentName = "";
|
this.form.parentName = "";
|
||||||
} else if (!val) {
|
} else if (!val) {
|
||||||
|
@ -236,8 +237,12 @@ export default {
|
||||||
},
|
},
|
||||||
// 查询设备类型列表
|
// 查询设备类型列表
|
||||||
getDeviceTypeList() {
|
getDeviceTypeList() {
|
||||||
listDeviceTypeList().then(response => {
|
listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => {
|
||||||
this.deviceTypeList = response.data;
|
if(response.rows){
|
||||||
|
this.deviceTypeList = response.rows || [];
|
||||||
|
}else{
|
||||||
|
this.deviceTypeList = [];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 查询设备列表 */
|
/** 查询设备列表 */
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<info-wrap :infoData="infoData" @updateInfo="updateInfo($event)" />
|
<info-wrap :infoData="infoData" @updateInfo="updateInfo($event)" />
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane v-if="infoData.deviceType === 'GATEWAY_CONTROLLER'" label="子设备" name="child">
|
<el-tab-pane v-if="infoData.deviceType === '10001'" label="子设备" name="child">
|
||||||
<div class="tabs-body">
|
<div class="tabs-body">
|
||||||
<child-device
|
<child-device
|
||||||
v-if="activeName === 'child'"
|
v-if="activeName === 'child'"
|
||||||
|
|
|
@ -516,7 +516,7 @@ export default {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
modelId: "",
|
modelId: "",
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
// deviceType: "GATEWAY_CONTROLLER",
|
// deviceType: "10001",
|
||||||
deviceType: "",
|
deviceType: "",
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
|
|
|
@ -167,10 +167,10 @@
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
:label="keys"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:value="vals"
|
:key="item.id"
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
:label="item.categoryName"
|
||||||
:key="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -213,8 +213,8 @@
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="设备标签:"
|
label="设备标签:"
|
||||||
v-if="
|
v-if="
|
||||||
form.deviceType !== 'VIDEO_CONTROLLER' &&
|
form.deviceType !== '10012' &&
|
||||||
form.deviceType !== 'GATEWAY_CONTROLLER'
|
form.deviceType !== '10001'
|
||||||
"
|
"
|
||||||
prop="deviceTag"
|
prop="deviceTag"
|
||||||
>
|
>
|
||||||
|
@ -337,6 +337,7 @@ import { listModel, getModel } from "@/api/iot/model";
|
||||||
import SelectTableWrap from "@/components/SelectTable/index";
|
import SelectTableWrap from "@/components/SelectTable/index";
|
||||||
import SelectTableBox from "@/components/SelectTable/checkbox"
|
import SelectTableBox from "@/components/SelectTable/checkbox"
|
||||||
import ParamWrap from "@/components/ParamWrap/deviceParam";
|
import ParamWrap from "@/components/ParamWrap/deviceParam";
|
||||||
|
import { listDeviceType } from '../../../api/iot/deviceType'
|
||||||
const lineTypeOpt = {
|
const lineTypeOpt = {
|
||||||
MAIN: "总路",
|
MAIN: "总路",
|
||||||
BRANCH: "支路",
|
BRANCH: "支路",
|
||||||
|
@ -508,7 +509,7 @@ export default {
|
||||||
params: {
|
params: {
|
||||||
modelName: "",
|
modelName: "",
|
||||||
modelCode: "",
|
modelCode: "",
|
||||||
deviceType: "MINIATURE_BREAKER",
|
deviceType: "10002",
|
||||||
protocolType: "",
|
protocolType: "",
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
|
@ -634,7 +635,7 @@ export default {
|
||||||
labelWidth: "68px",
|
labelWidth: "68px",
|
||||||
params: {
|
params: {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
deviceType: "MINIATURE_BREAKER",
|
deviceType: "10002",
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -713,8 +714,12 @@ export default {
|
||||||
},
|
},
|
||||||
// 查询设备类型列表
|
// 查询设备类型列表
|
||||||
getDeviceTypeList() {
|
getDeviceTypeList() {
|
||||||
listDeviceTypeList().then((response) => {
|
listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => {
|
||||||
this.deviceTypeList = response.data;
|
if(response.rows){
|
||||||
|
this.deviceTypeList = response.rows || [];
|
||||||
|
}else{
|
||||||
|
this.deviceTypeList = [];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
|
@ -827,7 +832,7 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.form.paramList = this.$refs.paramWrap.getResult();
|
this.form.paramList = this.$refs.paramWrap.getResult();
|
||||||
this.form.lineType =
|
this.form.lineType =
|
||||||
this.form.deviceType === "MINIATURE_BREAKER"
|
this.form.deviceType === "10002"
|
||||||
? this.form.lineType
|
? this.form.lineType
|
||||||
: undefined;
|
: undefined;
|
||||||
if (this.form.deviceId != null) {
|
if (this.form.deviceId != null) {
|
||||||
|
@ -854,7 +859,7 @@ export default {
|
||||||
parentName: this.pDevcieInfo.deviceName,
|
parentName: this.pDevcieInfo.deviceName,
|
||||||
parentId: this.pDevcieInfo.deviceId,
|
parentId: this.pDevcieInfo.deviceId,
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
deviceType: "MINIATURE_BREAKER",
|
deviceType: "10002",
|
||||||
paramList: [],
|
paramList: [],
|
||||||
deviceKey: "",
|
deviceKey: "",
|
||||||
lineType: "",
|
lineType: "",
|
||||||
|
|
|
@ -458,7 +458,6 @@ export default {
|
||||||
},${str}`;
|
},${str}`;
|
||||||
},
|
},
|
||||||
wsMessage(e) {
|
wsMessage(e) {
|
||||||
// debugger
|
|
||||||
if (
|
if (
|
||||||
e["deviceState"] ||
|
e["deviceState"] ||
|
||||||
(e["switch"] !== null && e["switch"] !== undefined)
|
(e["switch"] !== null && e["switch"] !== undefined)
|
||||||
|
@ -750,10 +749,11 @@ export default {
|
||||||
},
|
},
|
||||||
deviceId: row.deviceId
|
deviceId: row.deviceId
|
||||||
};
|
};
|
||||||
setLivetimeControl(params).then(res => {
|
//先屏蔽设备主动拉取功能
|
||||||
console.log(res);
|
// setLivetimeControl(params).then(res => {
|
||||||
// this.msgSuccess("成功");
|
// console.log(res);
|
||||||
});
|
// // this.msgSuccess("成功");
|
||||||
|
// });
|
||||||
},
|
},
|
||||||
// 点击子设备 线路开关
|
// 点击子设备 线路开关
|
||||||
submitChildStatus(type, row) {
|
submitChildStatus(type, row) {
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:formatter="dateFormat"
|
:formatter="dateFormat"
|
||||||
align="center"
|
align="center"
|
||||||
label="时间"
|
label="告警时间"
|
||||||
prop="timestamp"
|
prop="timestamp"
|
||||||
sortable="custom"
|
sortable="custom"
|
||||||
width="160px"
|
width="160px"
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
@changeEvent="viewDeviceChange($event)"
|
@changeEvent="viewDeviceChange($event)"
|
||||||
@wsRealTImeMsg="wsRealTImeMsg($event)"
|
@wsRealTImeMsg="wsRealTImeMsg($event)"
|
||||||
></device-select>
|
></device-select>
|
||||||
<div :class="infoData.deviceType === 'GATEWAY_CONTROLLER' ? 'link-to-list is-widening': 'link-to-list'">
|
<div :class="infoData.deviceType === '10001' ? 'link-to-list is-widening': 'link-to-list'">
|
||||||
<el-button icon="el-icon-d-arrow-left" size="small" style="margin-left: 10px;" title="返回列表" type="primary" @click="toTableClick"
|
<el-button icon="el-icon-d-arrow-left" size="small" style="margin-left: 10px;" title="返回列表" type="primary" @click="toTableClick"
|
||||||
>返回列表</el-button
|
>返回列表</el-button
|
||||||
>
|
>
|
||||||
<el-button v-if="infoData.deviceType === 'GATEWAY_CONTROLLER'" size="small" title="批量升级" type="primary" @click="batchUpgradeOpen">批量升级</el-button>
|
<el-button v-if="infoData.deviceType === '10001'" size="small" title="批量升级" type="primary" @click="batchUpgradeOpen">批量升级</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-tabs-circuit main-device-card">
|
<div class="info-tabs-circuit main-device-card">
|
||||||
<div v-show="breadcrumbList.length > 1" class="breadcrumb-wrap">
|
<div v-show="breadcrumbList.length > 1" class="breadcrumb-wrap">
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-if="infoData.deviceType === 'GATEWAY_CONTROLLER' && !isTenant"
|
v-if="infoData.deviceType === '10001' && !isTenant"
|
||||||
label="子设备"
|
label="子设备"
|
||||||
name="child"
|
name="child"
|
||||||
>
|
>
|
||||||
|
|
|
@ -212,7 +212,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="infoData.deviceType === 'MINIATURE_BREAKER' || infoData.deviceType === 'MOLDED_BREAKER'"
|
v-if="infoData.deviceType === '10002' || infoData.deviceType === '10013'"
|
||||||
class="group-list-info"
|
class="group-list-info"
|
||||||
style="margin-top: 15px"
|
style="margin-top: 15px"
|
||||||
>
|
>
|
||||||
|
@ -227,12 +227,12 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="infoData.deviceType === 'MINIATURE_BREAKER' || infoData.deviceType === 'MOLDED_BREAKER'"
|
v-if="infoData.deviceType === '10002' || infoData.deviceType === '10013'"
|
||||||
class="group-list-table"
|
class="group-list-table"
|
||||||
style="border: 0"
|
style="border: 0"
|
||||||
>
|
>
|
||||||
<device-alarm-config
|
<device-alarm-config
|
||||||
v-if="infoData.deviceType === 'MINIATURE_BREAKER' || infoData.deviceType === 'MOLDED_BREAKER'"
|
v-if="infoData.deviceType === '10002' || infoData.deviceType === '10013'"
|
||||||
:deviceId="infoData.deviceId"
|
:deviceId="infoData.deviceId"
|
||||||
:deviceKey="infoData.deviceKey"
|
:deviceKey="infoData.deviceKey"
|
||||||
/>
|
/>
|
||||||
|
@ -241,7 +241,7 @@
|
||||||
<!-- <div-->
|
<!-- <div-->
|
||||||
<!-- class="group-list-info"-->
|
<!-- class="group-list-info"-->
|
||||||
<!-- style="margin-top: 15px"-->
|
<!-- style="margin-top: 15px"-->
|
||||||
<!-- v-if="infoData.deviceType === 'MINIATURE_BREAKER'"-->
|
<!-- v-if="infoData.deviceType === '10002'"-->
|
||||||
<!-- >-->
|
<!-- >-->
|
||||||
<!-- <div class="top">-->
|
<!-- <div class="top">-->
|
||||||
<!-- <div class="top-label">-->
|
<!-- <div class="top-label">-->
|
||||||
|
@ -256,10 +256,10 @@
|
||||||
<!-- <div-->
|
<!-- <div-->
|
||||||
<!-- class="group-list-table"-->
|
<!-- class="group-list-table"-->
|
||||||
<!-- style="border: 0"-->
|
<!-- style="border: 0"-->
|
||||||
<!-- v-if="infoData.deviceType === 'MINIATURE_BREAKER'"-->
|
<!-- v-if="infoData.deviceType === '10002'"-->
|
||||||
<!-- >-->
|
<!-- >-->
|
||||||
<!-- <device-timing-config-->
|
<!-- <device-timing-config-->
|
||||||
<!-- v-if="infoData.deviceType === 'MINIATURE_BREAKER'"-->
|
<!-- v-if="infoData.deviceType === '10002'"-->
|
||||||
<!-- :deviceId="infoData.deviceId"-->
|
<!-- :deviceId="infoData.deviceId"-->
|
||||||
<!-- :deviceKey="infoData.deviceKey"-->
|
<!-- :deviceKey="infoData.deviceKey"-->
|
||||||
<!-- />-->
|
<!-- />-->
|
||||||
|
|
|
@ -406,7 +406,7 @@ export default {
|
||||||
params: {
|
params: {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
modelId: "",
|
modelId: "",
|
||||||
deviceType: "GATEWAY_CONTROLLER"
|
deviceType: "10001"
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -567,7 +567,7 @@ export default {
|
||||||
this.selectTableShow = false;
|
this.selectTableShow = false;
|
||||||
},
|
},
|
||||||
deviceTypeChange(val) {
|
deviceTypeChange(val) {
|
||||||
if (val !== "MINIATURE_BREAKER") {
|
if (val !== "10002") {
|
||||||
this.form.parentId = 0;
|
this.form.parentId = 0;
|
||||||
this.form.parentName = "";
|
this.form.parentName = "";
|
||||||
} else if (!val) {
|
} else if (!val) {
|
||||||
|
@ -585,7 +585,7 @@ export default {
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listDevice(Object.assign(this.queryParams , {
|
listDevice(Object.assign(this.queryParams , {
|
||||||
deviceType: 'GATEWAY_CONTROLLER'
|
deviceType: '10001'
|
||||||
})).then(response => {
|
})).then(response => {
|
||||||
this.deviceList = response.rows;
|
this.deviceList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
|
@ -648,7 +648,7 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.form.paramList = this.$refs.paramWrap.getResult();
|
this.form.paramList = this.$refs.paramWrap.getResult();
|
||||||
this.form.lineType =
|
this.form.lineType =
|
||||||
this.form.deviceType === "MINIATURE_BREAKER"
|
this.form.deviceType === "10002"
|
||||||
? this.form.lineType
|
? this.form.lineType
|
||||||
: undefined;
|
: undefined;
|
||||||
if (this.form.deviceId != null) {
|
if (this.form.deviceId != null) {
|
||||||
|
|
|
@ -83,10 +83,10 @@
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:key="vals"
|
:key="item.id"
|
||||||
:label="keys"
|
:label="item.categoryName"
|
||||||
:value="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -363,6 +363,7 @@ import DetailsWrap from "./profile/details";
|
||||||
import GatewayDetail from "@/views/profile/DeviceDetailsView/index";
|
import GatewayDetail from "@/views/profile/DeviceDetailsView/index";
|
||||||
import JsBarcode from "jsbarcode";
|
import JsBarcode from "jsbarcode";
|
||||||
import { getProjectGroupList, listProject } from "@/api/tenant/project";
|
import { getProjectGroupList, listProject } from "@/api/tenant/project";
|
||||||
|
import { listDeviceType } from '../../../api/iot/deviceType'
|
||||||
const deviceStatusOpt = {
|
const deviceStatusOpt = {
|
||||||
ONLINE: "在线",
|
ONLINE: "在线",
|
||||||
OFFLINE: "离线",
|
OFFLINE: "离线",
|
||||||
|
@ -427,7 +428,7 @@ export default {
|
||||||
isAsc: "desc"
|
isAsc: "desc"
|
||||||
},
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
deviceTypeList: {},
|
deviceTypeList: [],
|
||||||
imgPath: "",
|
imgPath: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -490,7 +491,7 @@ export default {
|
||||||
this.sourceId = row.deviceId;
|
this.sourceId = row.deviceId;
|
||||||
// this.componectVal = "DetailsWrap";
|
// this.componectVal = "DetailsWrap";
|
||||||
this.componectVal =
|
this.componectVal =
|
||||||
row.deviceType === "GATEWAY_CONTROLLER"
|
row.deviceType === "10001"
|
||||||
? "GatewayDetail"
|
? "GatewayDetail"
|
||||||
: "DetailsWrap";
|
: "DetailsWrap";
|
||||||
},
|
},
|
||||||
|
@ -502,7 +503,7 @@ export default {
|
||||||
this.componectVal = "";
|
this.componectVal = "";
|
||||||
},
|
},
|
||||||
deviceTypeChange(val) {
|
deviceTypeChange(val) {
|
||||||
if (val !== "MINIATURE_BREAKER") {
|
if (val !== "10002") {
|
||||||
this.form.parentId = 0;
|
this.form.parentId = 0;
|
||||||
this.form.parentName = "";
|
this.form.parentName = "";
|
||||||
} else if (!val) {
|
} else if (!val) {
|
||||||
|
@ -527,8 +528,12 @@ export default {
|
||||||
},
|
},
|
||||||
// 查询设备类型列表
|
// 查询设备类型列表
|
||||||
getDeviceTypeList() {
|
getDeviceTypeList() {
|
||||||
listDeviceTypeList().then(response => {
|
listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => {
|
||||||
this.deviceTypeList = response.data;
|
if(response.rows){
|
||||||
|
this.deviceTypeList = response.rows || [];
|
||||||
|
}else{
|
||||||
|
this.deviceTypeList = [];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 查询设备列表 */
|
/** 查询设备列表 */
|
||||||
|
|
|
@ -98,10 +98,10 @@
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
:label="keys"
|
v-for="(item, index) in deviceTypeList"
|
||||||
:value="vals"
|
:key="item.id"
|
||||||
v-for="(keys, vals) in deviceTypeList"
|
:label="item.categoryName"
|
||||||
:key="vals"
|
:value="item.categoryKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -177,6 +177,7 @@ import {
|
||||||
import { listModel, getModel } from "@/api/iot/model";
|
import { listModel, getModel } from "@/api/iot/model";
|
||||||
import SelectTableWrap from "@/components/SelectTable/index";
|
import SelectTableWrap from "@/components/SelectTable/index";
|
||||||
import ParamWrap from "@/components/ParamWrap/deviceParam";
|
import ParamWrap from "@/components/ParamWrap/deviceParam";
|
||||||
|
import { listDeviceType } from '../../../../api/iot/deviceType'
|
||||||
const lineTypeOpt = {
|
const lineTypeOpt = {
|
||||||
MAIN: "总路",
|
MAIN: "总路",
|
||||||
BRANCH: "支路"
|
BRANCH: "支路"
|
||||||
|
@ -306,7 +307,7 @@ export default {
|
||||||
params: {
|
params: {
|
||||||
modelName: "",
|
modelName: "",
|
||||||
modelCode: "",
|
modelCode: "",
|
||||||
deviceType: "MINIATURE_BREAKER"
|
deviceType: "10002"
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -394,8 +395,12 @@ export default {
|
||||||
},
|
},
|
||||||
// 查询设备类型列表
|
// 查询设备类型列表
|
||||||
getDeviceTypeList() {
|
getDeviceTypeList() {
|
||||||
listDeviceTypeList().then(response => {
|
listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => {
|
||||||
this.deviceTypeList = response.data;
|
if(response.rows){
|
||||||
|
this.deviceTypeList = response.rows || [];
|
||||||
|
}else{
|
||||||
|
this.deviceTypeList = [];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
|
@ -491,7 +496,7 @@ export default {
|
||||||
parentName: this.pDevcieInfo.deviceName,
|
parentName: this.pDevcieInfo.deviceName,
|
||||||
parentId: this.pDevcieInfo.deviceId,
|
parentId: this.pDevcieInfo.deviceId,
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
deviceType: "MINIATURE_BREAKER",
|
deviceType: "10002",
|
||||||
paramList: [],
|
paramList: [],
|
||||||
deviceKey: "",
|
deviceKey: "",
|
||||||
lineType: ""
|
lineType: ""
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<info-wrap :infoData="infoData" @updateInfo="updateInfo($event)" />
|
<info-wrap :infoData="infoData" @updateInfo="updateInfo($event)" />
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane v-if="infoData.deviceType === 'GATEWAY_CONTROLLER'" label="子设备" name="child">
|
<el-tab-pane v-if="infoData.deviceType === '10001'" label="子设备" name="child">
|
||||||
<div class="tabs-body">
|
<div class="tabs-body">
|
||||||
<child-device
|
<child-device
|
||||||
v-if="activeName === 'child'"
|
v-if="activeName === 'child'"
|
||||||
|
|
|
@ -135,7 +135,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="infoData.deviceType === 'MINIATURE_BREAKER' || infoData.deviceType === 'MOLDED_BREAKER'" class="group-list-info" style="margin-top: 15px;">
|
<div v-if="infoData.deviceType === '10002' || infoData.deviceType === '10013'" class="group-list-info" style="margin-top: 15px;">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div class="top-label">
|
<div class="top-label">
|
||||||
<svg-icon icon-class="system" style="margin-right: 2px; height: 20px; width: 20px;" />告警配置
|
<svg-icon icon-class="system" style="margin-right: 2px; height: 20px; width: 20px;" />告警配置
|
||||||
|
@ -143,8 +143,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="infoData.deviceType === 'MINIATURE_BREAKER' || infoData.deviceType === 'MOLDED_BREAKER'" class="group-list-table" style="border: 0;">
|
<div v-if="infoData.deviceType === '10002' || infoData.deviceType === '10013'" class="group-list-table" style="border: 0;">
|
||||||
<device-alarm-config v-if="infoData.deviceType === 'MINIATURE_BREAKER' || infoData.deviceType === 'MOLDED_BREAKER'" :deviceId="infoData.deviceId" :deviceKey="infoData.deviceKey" />
|
<device-alarm-config v-if="infoData.deviceType === '10002' || infoData.deviceType === '10013'" :deviceId="infoData.deviceId" :deviceKey="infoData.deviceKey" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue