diff --git a/src/api/iot/device.js b/src/api/iot/device.js index e9a89ad8..83fe46e4 100644 --- a/src/api/iot/device.js +++ b/src/api/iot/device.js @@ -151,3 +151,12 @@ export function disassociateChild(data) { data: data }); } + +// 查询 子设备列表 +export function listChildrenDevice(query) { + return request({ + url: "iot/device/listWithoutScope", + method: "get", + params: query + }); +} diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue index 029f6be8..8b941932 100644 --- a/src/views/iot/device/index.vue +++ b/src/views/iot/device/index.vue @@ -1,6 +1,11 @@ @@ -201,7 +255,7 @@ @@ -214,7 +268,11 @@ - + - - - + + + @@ -233,18 +305,26 @@ - + - *注意:锁定即参数不可修改;未锁则可以修改。 + *注意:锁定即参数不可修改;未锁则可以修改。
@@ -268,13 +348,33 @@ /> -
- 返回列表 +
+ 返回列表
@@ -287,23 +387,23 @@ import { addDevice, updateDevice, exportDevice, - listDeviceTypeList + listDeviceTypeList, + disassociateChild, } from "@/api/iot/device"; import { listModel, getModel } from "@/api/iot/model"; import SelectTableWrap from "@/components/SelectTable/index"; import DetailsWrap from "./profile/details"; import ParamWrap from "@/components/ParamWrap/deviceParam"; -import GatewayDetail from '@/views/profile/DeviceDetailsView/index' -import axios from "axios"; +import GatewayDetail from "@/views/profile/DeviceDetailsView/index"; const deviceStatusOpt = { ONLINE: "在线", OFFLINE: "离线", OUTLINE: "脱线", - UNACTIVE: "未激活" + UNACTIVE: "未激活", }; const lineTypeOpt = { MAIN: "总路", - BRANCH: "支路" + BRANCH: "支路", }; export default { @@ -312,7 +412,7 @@ export default { SelectTableWrap, DetailsWrap, ParamWrap, - GatewayDetail + GatewayDetail, }, data() { return { @@ -353,47 +453,46 @@ export default { deviceType: null, modelName: null, orderByColumn: "createTime", - isAsc: "desc" + isAsc: "desc", }, // 表单参数 form: {}, // 表单校验 rules: { modelId: [ - { required: true, message: "所属型号不能为空", trigger: "change" } + { required: true, message: "所属型号不能为空", trigger: "change" }, ], deviceType: [ - { required: true, message: "设备类型不能为空", trigger: "blur" } + { required: true, message: "设备类型不能为空", trigger: "blur" }, ], parentId: [ - { required: false, message: "父设备不能为空", trigger: "change" } + { required: false, message: "父设备不能为空", trigger: "change" }, ], deviceName: [ - { required: true, message: "设备名称不能为空", trigger: "blur" } + { required: true, message: "设备名称不能为空", trigger: "blur" }, ], lineType: [ - { required: false, message: "线路类型不能为空", trigger: "blur" } + { required: false, message: "线路类型不能为空", trigger: "blur" }, ], deviceKey: [ { required: true, validator: this.chenking_deviceKey, - trigger: "blur" - } - ] + trigger: "blur", + }, + ], }, - deviceTypeList: {} + deviceTypeList: {}, }; }, created() { - console.log(this.$route) - this.init() - + console.log(this.$route); + this.init(); }, methods: { init() { - if (this.$route.query['deviceId']) { - this.handleDetails(this.$route.query) + if (this.$route.query["deviceId"]) { + this.handleDetails(this.$route.query); } this.getDeviceTypeList(); this.initGetModelList(); @@ -402,7 +501,7 @@ export default { sortChange(column) { const sort = { isAsc: column.order === "descending" ? "desc" : "asc", - orderByColumn: column.prop + orderByColumn: column.prop, }; this.queryParams = Object.assign(this.queryParams, sort); this.handleQuery(); @@ -414,12 +513,15 @@ export default { }, handleDetails(row) { this.sourceId = row.deviceId; - this.componectVal = row.deviceType === 'GATEWAY_CONTROLLER'? 'GatewayDetail' : "DetailsWrap"; + this.componectVal = + row.deviceType === "GATEWAY_CONTROLLER" + ? "GatewayDetail" + : "DetailsWrap"; }, // 跳转详情页 toTableClick() { - if (this.$route.query['deviceId']) { - this.$router.push('/device/device') + if (this.$route.query["deviceId"]) { + this.$router.push("/device/device"); } this.componectVal = ""; }, @@ -428,19 +530,19 @@ export default { this.selectResult = {}; this.tableSelectOption = { otherOption: { - tableType: "model" + tableType: "model", }, queryOpt: { disable: false, labelWidth: "68px", params: { protocolType: "", - modelName: "" + modelName: "", }, page: { pageSize: 10, pageNum: 1, - total: 0 + total: 0, }, inline: true, queryChilds: [ @@ -452,7 +554,7 @@ export default { type: "input", key: "modelName", size: "small", - value: "" + value: "", }, { style: "", @@ -477,16 +579,16 @@ export default { { key: "OFFICIAL", label: "官方平台", - value: "OFFICIAL" - } + value: "OFFICIAL", + }, ], optionKey: { key: "key", label: "label", - value: "value" - } - } - ] + value: "value", + }, + }, + ], }, tableOpt: { loading: false, @@ -502,7 +604,7 @@ export default { align: "left", width: "200", "show-overflow-tooltip": false, - tempType: "span" + tempType: "span", }, { style: "", @@ -512,7 +614,7 @@ export default { align: "left", width: "200", "show-overflow-tooltip": false, - tempType: "span" + tempType: "span", }, { style: "", @@ -522,7 +624,7 @@ export default { align: "left", width: "120", "show-overflow-tooltip": false, - tempType: "span" + tempType: "span", }, { style: "", @@ -532,7 +634,7 @@ export default { align: "left", width: "", "show-overflow-tooltip": false, - tempType: "span" + tempType: "span", }, { style: "", @@ -542,14 +644,14 @@ export default { align: "left", width: "", "show-overflow-tooltip": false, - tempType: "span" - } + tempType: "span", + }, ], tableList: { - type: Array - } + type: Array, + }, }, - tableList: [] + tableList: [], }; this.selectTableShow = true; }, @@ -558,7 +660,7 @@ export default { this.selectResult = {}; this.tableSelectOption = { otherOption: { - tableType: "device" + tableType: "device", }, queryOpt: { disable: false, @@ -571,7 +673,7 @@ export default { page: { pageSize: 10, pageNum: 1, - total: 0 + total: 0, }, inline: true, queryChilds: [ @@ -583,9 +685,9 @@ export default { type: "input", key: "deviceName", size: "small", - value: "" - } - ] + value: "", + }, + ], }, tableOpt: { loading: false, @@ -601,7 +703,7 @@ export default { align: "left", width: "", "show-overflow-tooltip": false, - tempType: "span" + tempType: "span", }, { style: "", @@ -611,7 +713,7 @@ export default { align: "left", width: "", "show-overflow-tooltip": false, - tempType: "span" + tempType: "span", }, { style: "", @@ -621,7 +723,7 @@ export default { align: "left", width: "", "show-overflow-tooltip": false, - tempType: "span" + tempType: "span", }, { style: "", @@ -631,14 +733,14 @@ export default { align: "center", width: "160", "show-overflow-tooltip": false, - tempType: "span" - } + tempType: "span", + }, ], tableList: { - type: Array - } + type: Array, + }, }, - tableList: [] + tableList: [], }; this.selectTableShow = true; }, @@ -653,14 +755,14 @@ export default { initGetModelList() { listModel({ pageNum: 1, - pageSize: 99999 - }).then(response => { + pageSize: 99999, + }).then((response) => { this.queryModelOpt = response.rows; }); }, modelChildList(data) { listModel(Object.assign(data.page, data.param, { selected: 1 })).then( - response => { + (response) => { this.tableSelectOption.tableList = response.rows; this.tableSelectOption.queryOpt.page.total = Number(response.total); } @@ -668,7 +770,7 @@ export default { }, deviceChildList(data) { listDevice(Object.assign(data.page, data.param, { selected: 1 })).then( - response => { + (response) => { this.tableSelectOption.tableList = response.rows; this.tableSelectOption.queryOpt.page.total = Number(response.total); } @@ -676,7 +778,7 @@ export default { }, // 根据 型号id 获取 型号详情 getModelInfoById(modelId) { - getModel(modelId).then(res => { + getModel(modelId).then((res) => { this.$refs.paramWrap.setList(res.data.paramList || []); }); }, @@ -737,14 +839,14 @@ export default { }, // 查询设备类型列表 getDeviceTypeList() { - listDeviceTypeList().then(response => { + listDeviceTypeList().then((response) => { this.deviceTypeList = response.data; }); }, /** 查询设备列表 */ getList() { this.loading = true; - listDevice(this.queryParams).then(response => { + listDevice(this.queryParams).then((response) => { this.deviceList = response.rows; this.total = response.total; this.loading = false; @@ -766,7 +868,7 @@ export default { deviceType: null, paramList: [], deviceKey: "", - lineType: undefined + lineType: undefined, }; this.resetForm("form"); }, @@ -791,7 +893,7 @@ export default { this.reset(); const deviceId = row.deviceId || this.ids; const _this = this; - getDevice(deviceId).then(response => { + getDevice(deviceId).then((response) => { _this.form = response.data; _this.open = true; _this.title = "修改设备"; @@ -802,7 +904,7 @@ export default { }, /** 提交按钮 */ submitForm() { - this.$refs["form"].validate(valid => { + this.$refs["form"].validate((valid) => { if (valid) { this.form.paramList = this.$refs.paramWrap.getResult(); this.form.lineType = @@ -810,13 +912,13 @@ export default { ? this.form.lineType : undefined; if (this.form.deviceId != null) { - updateDevice(this.form).then(response => { + updateDevice(this.form).then((response) => { this.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { - addDevice(this.form).then(response => { + addDevice(this.form).then((response) => { this.msgSuccess("新增成功"); this.open = false; this.getList(); @@ -825,15 +927,35 @@ export default { } }); }, + + /** 取消关联 */ + handleDisassociate(row) { + this.$confirm("是否确认取消父子设备关联?", "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(function () { + return disassociateChild({ childIds: [row.deviceId] }); + }) + .then(() => { + this.getList(); + this.msgSuccess("取消成功"); + }); + }, /** 删除按钮操作 */ handleDelete(row) { const deviceIds = row.deviceId || this.ids; - this.$confirm("删除设备将会删除设备相关数据,请谨慎操作,是否继续?", "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }) - .then(function() { + this.$confirm( + "删除设备将会删除设备相关数据,请谨慎操作,是否继续?", + "警告", + { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + } + ) + .then(function () { return delDevice(deviceIds); }) .then(() => { @@ -847,12 +969,12 @@ export default { this.$confirm("是否确认导出所有设备数据项?", "警告", { confirmButtonText: "确定", cancelButtonText: "取消", - type: "warning" + type: "warning", }) - .then(function() { + .then(function () { return exportDevice(queryParams); }) - .then(response => { + .then((response) => { this.download(response.msg); }); }, @@ -863,8 +985,8 @@ export default { } else { callback(); } - } - } + }, + }, }; @@ -940,6 +1062,7 @@ export default { } .gateway-wrap { top: 220px; + display: none; } } .form-params-wrap::-webkit-scrollbar { diff --git a/src/views/iot/device/profile/info.vue b/src/views/iot/device/profile/info.vue index 827a0ab8..6e664b90 100644 --- a/src/views/iot/device/profile/info.vue +++ b/src/views/iot/device/profile/info.vue @@ -115,6 +115,10 @@
+
+
父设备
+
{{infoData.parentName || '--'}}
+
设备类型
{{infoData.deviceTypeName}}
@@ -126,15 +130,15 @@
脱线
未激活
+
+
创建时间
{{infoData.createTime || '--'}}
-
-
-
+
设备图片
--
diff --git a/src/views/iot/ota/index.vue b/src/views/iot/ota/index.vue index eb8d6f21..158f9469 100644 --- a/src/views/iot/ota/index.vue +++ b/src/views/iot/ota/index.vue @@ -235,12 +235,40 @@ - - + + - + + +
+ 将文件拖到此处,或 + 点击上传 +
+
+ + -
+ -->
- + @@ -400,7 +429,7 @@ export default { { required: true, message: "版本不能为空", trigger: "blur" }, ], otaUrl: [ - { required: true, message: " 升级地址不能为空", trigger: "blur" }, + { required: false, message: " 升级地址不能为空", trigger: "blur" }, ], txtUrl: [ { required: true, message: " 文件地址不能为空", trigger: "blur" }, diff --git a/src/views/profile/DeviceDetailsView/deviceLog.vue b/src/views/profile/DeviceDetailsView/deviceLog.vue index a83b3cdd..e1d3ce9f 100644 --- a/src/views/profile/DeviceDetailsView/deviceLog.vue +++ b/src/views/profile/DeviceDetailsView/deviceLog.vue @@ -48,8 +48,8 @@ :default-sort="{ prop: 'timestamp', order: 'descending' }" @sort-change="sortChange"> - - + +