diff --git a/src/api/iot/deviceType.js b/src/api/iot/deviceType.js new file mode 100644 index 00000000..919a1d2b --- /dev/null +++ b/src/api/iot/deviceType.js @@ -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" + }); +} diff --git a/src/components/ParamWrap/deviceParam.vue b/src/components/ParamWrap/deviceParam.vue index 19e48260..f3a30b66 100644 --- a/src/components/ParamWrap/deviceParam.vue +++ b/src/components/ParamWrap/deviceParam.vue @@ -47,7 +47,7 @@ import { getTypeParam } from "@/basedata/typeParams"; export default { name: "DeviceParam", - props: ["typeKeys"], + props: ["paramList"], data() { return { list: [], @@ -57,7 +57,7 @@ export default { methods: { getParams() { this.list = []; - const newArr = getTypeParam(this.typeKeys); + const newArr = getTypeParam(this.paramList); if (newArr) { newArr.forEach((v) => { this.list.push(Object.assign({}, v)); @@ -73,9 +73,12 @@ export default { }, }, watch: { - typeKeys(val) { + paramList(val) { if (val) { - this.getParams(); + // this.getParams(); + this.list = val; + }else{ + this.list = []; } }, }, diff --git a/src/views/iot/alarm/type/index.vue b/src/views/iot/alarm/type/index.vue index 2953a5ed..5b1c7746 100644 --- a/src/views/iot/alarm/type/index.vue +++ b/src/views/iot/alarm/type/index.vue @@ -27,10 +27,10 @@ @change="handleQuery" > @@ -214,10 +214,10 @@ style="width: 100%" > @@ -280,6 +280,7 @@ import { import { listDeviceTypeList } from "@/api/iot/device"; import { listUser } from "@/api/system/user"; import DialogTemplate from "@/components/DialogTemplate/index"; +import { listDeviceType } from '../../../../api/iot/deviceType' // import { selectedProdmodel } from "@/api/device/prodmodel"; const alarmDivideType = { ALARM: "报警", @@ -355,8 +356,12 @@ export default { }, // 查询设备类型列表 getDeviceTypeList() { - listDeviceTypeList().then((response) => { - this.deviceTypeList = response.data; + listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => { + if(response.rows){ + this.deviceTypeList = response.rows || []; + }else{ + this.deviceTypeList = []; + } }); }, sortChange(column) { diff --git a/src/views/iot/autocontrol/job/profile/deviceParam.vue b/src/views/iot/autocontrol/job/profile/deviceParam.vue index 0b6ab602..ef3f2671 100644 --- a/src/views/iot/autocontrol/job/profile/deviceParam.vue +++ b/src/views/iot/autocontrol/job/profile/deviceParam.vue @@ -261,7 +261,7 @@ export default { deviceName: "", modelId: "", parentId: 0, - deviceType: "GATEWAY_CONTROLLER" + deviceType: "10001" }, page: { pageSize: 10, diff --git a/src/views/iot/circuitBreaker/index.vue b/src/views/iot/circuitBreaker/index.vue index 6e5effcc..aea6f706 100644 --- a/src/views/iot/circuitBreaker/index.vue +++ b/src/views/iot/circuitBreaker/index.vue @@ -206,7 +206,7 @@ /> - + - + @@ -416,7 +416,7 @@ export default { params: { protocolType: "", modelName: "", - deviceType: 'GATEWAY_CONTROLLER' + deviceType: '10001' }, page: { pageSize: 10, @@ -543,7 +543,7 @@ export default { deviceName: "", modelId: "", parentId: 0, - deviceType: "GATEWAY_CONTROLLER" + deviceType: "10001" }, page: { pageSize: 10, @@ -704,7 +704,7 @@ export default { this.selectTableShow = false; }, deviceTypeChange(val) { - if (val !== "MINIATURE_BREAKER") { + if (val !== "10002") { this.form.parentId = 0; this.form.parentName = ""; } else if (!val) { @@ -722,7 +722,7 @@ export default { getList() { this.loading = true; listDevice(Object.assign(this.queryParams , { - deviceType: 'GATEWAY_CONTROLLER' + deviceType: '10001' })).then(response => { this.deviceList = response.rows; this.total = response.total; @@ -785,7 +785,7 @@ export default { if (valid) { this.form.paramList = this.$refs.paramWrap.getResult(); this.form.lineType = - this.form.deviceType === "MINIATURE_BREAKER" + this.form.deviceType === "10002" ? this.form.lineType : undefined; if (this.form.deviceId != null) { diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue index 532f0809..1c1bcb3c 100644 --- a/src/views/iot/device/index.vue +++ b/src/views/iot/device/index.vue @@ -106,10 +106,10 @@ @change="handleQuery" > @@ -263,7 +263,7 @@ size="mini" type="text" icon="el-icon-search" - v-if="scope.row.deviceType === 'GATEWAY_CONTROLLER'" + v-if="scope.row.deviceType === '10001'" @click="handleDetails(scope.row)" >子设备管理 --> - @@ -507,8 +506,8 @@ { - this.deviceTypeList = response.data; + // listDeviceTypeList().then(response => { + // 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) { this.form.paramList = this.$refs.paramWrap.getResult(); this.form.lineType = - this.form.deviceType === "MINIATURE_BREAKER" + this.form.deviceType === "10002" ? this.form.lineType : undefined; if (this.form.deviceId != null) { diff --git a/src/views/iot/device/profile/childDevice.vue b/src/views/iot/device/profile/childDevice.vue index 296235ea..9cd459e2 100644 --- a/src/views/iot/device/profile/childDevice.vue +++ b/src/views/iot/device/profile/childDevice.vue @@ -110,10 +110,10 @@ clearable > @@ -202,6 +202,7 @@ import { listModel, getModel } from "@/api/iot/model"; import SelectTableWrap from "@/components/SelectTable/index"; import ParamWrap from "@/components/ParamWrap/deviceParam"; import DialogTemplate from "@/components/DialogTemplate"; +import { listDeviceType } from '../../../../api/iot/deviceType' const lineTypeOpt = { MAIN:'总路', @@ -341,7 +342,7 @@ export default { params: { modelName: "", modelCode: "", - deviceType: 'MINIATURE_BREAKER', + deviceType: '10002', protocolType: '' }, page: { @@ -457,8 +458,12 @@ export default { }, // 查询设备类型列表 getDeviceTypeList() { - listDeviceTypeList().then(response => { - this.deviceTypeList = response.data; + listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => { + if(response.rows){ + this.deviceTypeList = response.rows || []; + }else{ + this.deviceTypeList = []; + } }); }, /** 新增按钮操作 */ @@ -528,7 +533,7 @@ export default { this.$refs["form"].validate(valid => { if (valid) { 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) { updateDevice(this.form).then(response => { this.msgSuccess("修改成功"); @@ -553,7 +558,7 @@ export default { parentName: this.pDevcieInfo.deviceName, parentId: this.pDevcieInfo.deviceId, deviceName: '', - deviceType: 'MINIATURE_BREAKER', + deviceType: '10002', paramList: [], deviceKey: "", lineType: '' diff --git a/src/views/iot/device/profile/details.vue b/src/views/iot/device/profile/details.vue index efd9fbec..a7878d48 100644 --- a/src/views/iot/device/profile/details.vue +++ b/src/views/iot/device/profile/details.vue @@ -53,7 +53,7 @@ - +
-
+
开锁
diff --git a/src/views/iot/device/profile/info.vue b/src/views/iot/device/profile/info.vue index 83bd8faa..214d2445 100644 --- a/src/views/iot/device/profile/info.vue +++ b/src/views/iot/device/profile/info.vue @@ -150,7 +150,7 @@
-
+
告警配置 @@ -158,12 +158,12 @@
-
- +
+
-
+
定时器 @@ -171,8 +171,8 @@
-
- +
+
diff --git a/src/views/iot/deviceType/ParamWrap.vue b/src/views/iot/deviceType/ParamWrap.vue new file mode 100644 index 00000000..48c86af4 --- /dev/null +++ b/src/views/iot/deviceType/ParamWrap.vue @@ -0,0 +1,214 @@ + + + + + diff --git a/src/views/iot/deviceType/index.vue b/src/views/iot/deviceType/index.vue new file mode 100644 index 00000000..a62155b6 --- /dev/null +++ b/src/views/iot/deviceType/index.vue @@ -0,0 +1,383 @@ + + + + + diff --git a/src/views/iot/model/index.vue b/src/views/iot/model/index.vue index 19eaec67..53103326 100644 --- a/src/views/iot/model/index.vue +++ b/src/views/iot/model/index.vue @@ -316,12 +316,13 @@ placeholder="请选择设备类型" size="small" style="width: 100%" + @change="handleDeviceTypeChange" > @@ -335,7 +336,7 @@
@@ -470,6 +471,7 @@ import groupForm from "@/views/profile/attribute/groupForm"; import paramsJson from "@/views/profile/attribute/paramsJson"; import { listModelSeries, getModelSeries } from "@/api/iot/modelSeries"; import ParamsJsonWrap from "@/views/profile/attribute/paramsJson"; +import { listDeviceType } from '../../../api/iot/deviceType' const deviceStartsOpt = { 0: "禁用", @@ -612,10 +614,26 @@ export default { }, // 查询设备类型列表 getDeviceTypeList() { - listDeviceTypeList().then(response => { - this.deviceTypeList = response.data; + listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => { + 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() { this.selectResult = {}; this.tableSelectOption = { diff --git a/src/views/iot/modelScries/index.vue b/src/views/iot/modelScries/index.vue index aa3873a7..43e2fd62 100644 --- a/src/views/iot/modelScries/index.vue +++ b/src/views/iot/modelScries/index.vue @@ -217,12 +217,13 @@ placeholder="请选择设备类型" size="small" style="width: 100%" + @change="handleDeviceTypeChange" > @@ -236,7 +237,7 @@
@@ -325,6 +326,7 @@ import paramsJson from "@/views/profile/attribute/paramsJson"; import ParamWrap from "@/components/ParamWrap/deviceParam"; import AttributeView from "@/views/profile/attribute/index"; import ParamsJsonWrap from "@/views/profile/attribute/paramsJson"; +import { listDeviceType } from '../../../api/iot/deviceType' export default { name: "ModelSeries", @@ -457,10 +459,26 @@ export default { }, // 查询设备类型列表 getDeviceTypeList() { - listDeviceTypeList().then((response) => { - this.deviceTypeList = response.data; + listDeviceType({pageNum: 1,pageSize: 999,status: 0}).then(response => { + 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) { const sort = { isAsc: column.order === "descending" ? "desc" : "asc", diff --git a/src/views/iot/project/index.vue b/src/views/iot/project/index.vue index 318568cf..9bc973d1 100644 --- a/src/views/iot/project/index.vue +++ b/src/views/iot/project/index.vue @@ -451,7 +451,7 @@ const selectDeviceTable = { params: { deviceName: "", parentId: 0, - deviceType: "MINIATURE_BREAKER", + deviceType: "10002", }, inline: true, queryChilds: [ diff --git a/src/views/iot/project/profile/spaceDevice.vue b/src/views/iot/project/profile/spaceDevice.vue index 3a1fc93e..56f9c5f0 100644 --- a/src/views/iot/project/profile/spaceDevice.vue +++ b/src/views/iot/project/profile/spaceDevice.vue @@ -25,7 +25,7 @@ size="mini" type="text" icon="el-icon-delete" - v-if="scope.row.deviceType !== 'MINIATURE_BREAKER'" + v-if="scope.row.deviceType !== '10002'" @click="handleDelete(scope.row)" >删除 @@ -163,7 +163,7 @@ export default { deviceName: "", modelId: "", parentId: 0, - deviceType: "GATEWAY_CONTROLLER" + deviceType: "10001" }, page: { pageSize: 10, diff --git a/src/views/iot/project/profileV2/DeviceGroupDevice.vue b/src/views/iot/project/profileV2/DeviceGroupDevice.vue index ddb7ad77..a89178b8 100644 --- a/src/views/iot/project/profileV2/DeviceGroupDevice.vue +++ b/src/views/iot/project/profileV2/DeviceGroupDevice.vue @@ -22,7 +22,7 @@