management/front/dkha-web-sz-main/node_modules/.cache/vue-loader/e566b09ad54e12985e3474b8c9a...

1 line
38 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{"remainingRequest":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\equipmentManage\\gateway-add-or-update.vue?vue&type=script&lang=js&","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\equipmentManage\\gateway-add-or-update.vue","mtime":1614735254000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport throttle from 'lodash/throttle'\nimport {\n\tvalidateIP,\n} from '@/utils/validate.js'\nimport {\n\ttreeDataTranslate,\n\tgetDictDataList\n} from '@/utils'\nexport default {\n\tname: \"electric-add-or-update\",\n\tdata() {\n\t\treturn {\n\t\t\tloading: false,\n\t\t\tvisible: false,\n\t\t\ttfSetupaddrList: [], // 安装地址\n\t\t\teqTypeList: [], // 设备类型\n\t\t\tbusList: [], // 总线\n\t\t\teqNumberList: [], // 设备路数\n\t\t\teqList: [], // 设备(新增使用)\n\t\t\tpirList: [], // 修改使用\n\t\t\tlightList: [], // 修改使用\n\t\t\tpm25List: [], // 修改使用\n\t\t\tuwbRegionList: [], // \"区域围栏列表\"\n\t\t\tdataForm: {\n\t\t\t\t\"id\": \"\",\n\t\t\t\tgwId: \"\",\n\t\t\t\tgwIpgateway: \"\",\n\t\t\t\tgwName: \"\",\n\t\t\t\tmbdDevicetype: \"\",\n\t\t\t\tgwSn: \"\",\n\t\t\t\t// gwUwbnum: \"\",\n\t\t\t\tgwExpirydate: \"\",\n\t\t\t\tgwSetupaddr: [],\n\t\t\t\tscGatebusdeviceDTOList: [],\n\t\t\t\tremark: \"\",\n\t\t\t},\n\t\t\toptions: [{\n\t\t\t\tvalue: '-1',\n\t\t\t\tlabel: '-1'\n\t\t\t}]\n\t\t}\n\t},\n\tmethods: {\n\t\t// 新增总线\n\t\thandleAddClick() {\n\t\t\tlet obj = {\n\t\t\t\tgbdLineNum: \"\",\n\t\t\t\tgbdDevicetype: \"\",\n\t\t\t\tmbdId: \"\",\n\t\t\t\tlightroadnum: \"\", // 灯口编号\n\t\t\t\tgbdAddr: \"\",\n\t\t\t\tgbdGroup: \"\",\n\t\t\t\tgbdFenceId: \"\",\n\t\t\t\tfourEightTwelve: \"\", // 灯口编号类型\n\t\t\t}\n\n\t\t\tlet isZero = this.dataForm.scGatebusdeviceDTOList.length === 0 // 空数组\n\t\t\tif (isZero) {\n\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.unshift(obj)\n\t\t\t} else {\n\t\t\t\tlet isEmpty = false // 默认每个字段都有值\n\t\t\t\tlet i = 0\n\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\t\tif (item.gbdLineNum === \"\" || item.gbdDevicetype === \"\" || item.mbdId === \"\" || item.gbdAddr === \"\") {\n\t\t\t\t\t\ti = index\n\t\t\t\t\t\tisEmpty = true\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tif (isEmpty) {\n\t\t\t\t\tthis.$message.info(`请先完善第${i+1}条数据信息再新增`)\n\t\t\t\t} else {\n\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.unshift(obj)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// 删除\n\t\thandleDeleteClick(obj, index) {\n\t\t\tthis.dataForm.scGatebusdeviceDTOList.splice(index, 1)\n\t\t},\n\t\t// 选择总线\n\t\thandleLineChange(e, obj, i) {\n\t\t\tif (e === \"\") {\n\t\t\t\treturn this.dataForm.scGatebusdeviceDTOList[i].gbdLineNum = \"\"\n\t\t\t}\n\t\t\t// 当表单\"设备类型\"和总线\"设备类型\"都选择智能控灯设备时,不做设备是否被使用的校验\n\t\t\tif (obj.gbdDevicetype === \"1\") {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet j = 0\n\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\tif (obj.gbdAddr == item.gbdAddr && item.gbdLineNum == e) {\n\t\t\t\t\tj++\n\t\t\t\t\tif (j > 1) {\n\t\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList[i].gbdLineNum = \"\"\n\t\t\t\t\t\treturn this.$message.info(`第${i+1}条数据的编号已使用`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t// 选择设备类型\n\t\thandleEqTypeChange(i) {\n\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\tif (index == i) {\n\t\t\t\t\treturn item.mbdId = \"\"\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t// 选择设备\n\t\thandleEqChange(e, i, obj) {\n\t\t\tif (e === \"\") {\n\t\t\t\treturn this.dataForm.scGatebusdeviceDTOList[i].mbdId = \"\"\n\t\t\t}\n\n\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\tif (i === index && item.gbdDevicetype === \"1\") {\n\t\t\t\t\tthis.lightList.forEach(item1 => {\n\t\t\t\t\t\tif (e === item1.mbdId) {\n\t\t\t\t\t\t\titem.fourEightTwelve = item1.mbdLightroads\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t} else if (i === index && item.gbdDevicetype != \"1\") {\n\t\t\t\t\titem.fourEightTwelve = -1\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t// 当表单\"设备类型\"和总线\"设备类型\"都选择智能控灯设备时,不做设备是否被使用的校验\n\t\t\tif (obj.gbdDevicetype === \"1\") {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet j = 0\n\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\tif (item.mbdId == e) {\n\t\t\t\t\tj++\n\t\t\t\t\tif (j > 1) {\n\t\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList[i].mbdId = \"\"\n\t\t\t\t\t\treturn this.$message.info(`第${i+1}条数据的设备已使用`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t// 选择编号\n\t\thandleNumChange(e, obj, i) {\n\t\t\tif (e === \"\") {\n\t\t\t\treturn this.dataForm.scGatebusdeviceDTOList[i].gbdAddr = \"\"\n\t\t\t}\n\t\t\t// 当表单\"设备类型\"和总线\"设备类型\"都选择智能控灯设备时,不做设备是否被使用的校验\n\t\t\tif (obj.gbdDevicetype === \"1\") {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet j = 0\n\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\tif (obj.gbdLineNum == item.gbdLineNum && item.gbdAddr == e) {\n\t\t\t\t\tj++\n\t\t\t\t\tif (j > 1) {\n\t\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList[i].gbdAddr = \"\"\n\t\t\t\t\t\treturn this.$message.info(`第${i+1}条数据的编号已使用`)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\tinit() {\n\t\t\tthis.visible = true\n\t\t\tthis.busList = getDictDataList(\"bus\")\n\t\t\tthis.eqTypeList = getDictDataList(\"eq_type\")\n\t\t\tthis.eqNumberList = getDictDataList(\"eq_number\")\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tthis.$refs['dataForm'].resetFields()\n\t\t\t\tPromise.all([this.getTfSetupaddrList(), this.getEqList(), this.getUwbRegionList()]).then(result => {\n\t\t\t\t\tif (this.dataForm.id) {\n\t\t\t\t\t\t// 传递下拉框数据\n\t\t\t\t\t\tthis.getInfo(result[1])\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t\t},\n\t\t// 获取楼栋和楼层的cascader\n\t\tgetTfSetupaddrList() {\n\t\t\t// -1所有 0 学生宿舍 1 教师宿舍 2 教学楼\n\t\t\tthis.$http.get(`/system/scdormitoryfloor/roomTree/-1`).then(({\n\t\t\t\tdata: res\n\t\t\t}) => {\n\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t}\n\t\t\t\tthis.tfSetupaddrList = treeDataTranslate(res.data, 'df_floorid', 'df_parentid')\n\t\t\t}).catch(() => {})\n\t\t},\n\t\t// 获取三种类型的设备列表\n\t\tgetEqList() {\n\t\t\t// return new Promise((resolve, reject) => {\n\t\t\t// \tthis.$http.get(`/system/scmodbusdevicedc/type/-1`).then(({\n\t\t\t// \t\tdata: res\n\t\t\t// \t}) => {\n\t\t\t// \t\tif (res.code !== 0) {\n\t\t\t// \t\t\treturn this.$message.error(res.msg)\n\t\t\t// \t\t}\n\t\t\t// \t\t// res.data.mbdDevicetype 0 pirList 1 lightList 2pm25List\n\t\t\t// \t\tlet pirList = res.data.filter(item => item.mbdDevicetype == 0);\n\t\t\t// \t\tlet lightList = res.data.filter(item => item.mbdDevicetype == 1);\n\t\t\t// \t\tlet pm25List = res.data.filter(item => item.mbdDevicetype == 2);\n\n\t\t\t// \t\tthis.pirList = pirList\n\t\t\t// \t\tthis.lightList = lightList\n\t\t\t// \t\tthis.pm25List = pm25List\n\n\t\t\t// \t\t// 返回列表数据 供后续操作使用\n\t\t\t// \t\tresolve({\n\t\t\t// \t\t\tpirList: pirList,\n\t\t\t// \t\t\tlightList: lightList,\n\t\t\t// \t\t\tpm25List: pm25List,\n\t\t\t// \t\t})\n\t\t\t// \t}).catch(err => {\n\t\t\t// \t\treject(err)\n\t\t\t// \t})\n\t\t\t// })\n\t\t\tthis.$http.get(`/system/scmodbusdevicedc/type/0`).then(({\n\t\t\t\tdata: res\n\t\t\t}) => {\n\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t}\n\t\t\t\tthis.pirList = res.data\n\t\t\t}).catch(() => {})\n\t\t\tthis.$http.get(`/system/scmodbusdevicedc/type/1`).then(({\n\t\t\t\tdata: res\n\t\t\t}) => {\n\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t}\n\t\t\t\tthis.lightList = res.data\n\t\t\t}).catch(() => {})\n\t\t\tthis.$http.get(`/system/scmodbusdevicedc/type/2`).then(({\n\t\t\t\tdata: res\n\t\t\t}) => {\n\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t}\n\t\t\t\tthis.pm25List = res.data\n\t\t\t}).catch(() => {})\n\t\t},\n\t\t// 获取区域编号\n\t\tgetUwbRegionList() {\n\t\t\tthis.$http.get(`/system/scregionconfig/getUwbRegionList`).then(({\n\t\t\t\tdata: res\n\t\t\t}) => {\n\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t}\n\t\t\t\tthis.uwbRegionList = res.data\n\t\t\t}).catch(() => {})\n\t\t},\n\t\t// 获取信息\n\t\tgetInfo(eqList) {\n\t\t\tthis.$http.get(`/system/scgatewaydc/${this.dataForm.id}`).then(({\n\t\t\t\tdata: res\n\t\t\t}) => {\n\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t}\n\t\t\t\t// 组装灯口类型 fourEightTwelve-10123\n\t\t\t\tres.data.scGatebusdeviceDTOList.forEach(item => {\n\t\t\t\t\tif (item.gbdDevicetype != 1) {\n\t\t\t\t\t\titem.fourEightTwelve = -1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.lightList.forEach(item1 => {\n\t\t\t\t\t\t\tif (item1.mbdId === item.mbdId) {\n\t\t\t\t\t\t\t\titem.fourEightTwelve = item1.mbdLightroads\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\tthis.dataForm = { ...this.dataForm,\n\t\t\t\t\t...res.data\n\t\t\t\t}\n\t\t\t\tthis.dataForm.mbdDevicetype = String(this.dataForm.mbdDevicetype)\n\n\t\t\t\tconsole.log(this.dataForm)\n\n\t\t\t\t// 是否组网mbdNetwork 0否 1是\n\t\t\t\tlet ids = res.data.scGatebusdeviceDTOList.map(item => item.mbdId);\n\t\t\t\t// 筛选未组网和当前项组网列表集合\n\t\t\t\tthis.pirList = eqList.pirList.filter(item => {\n\t\t\t\t\treturn item.mbdNetwork == 0 || ids.includes(item.mbdId)\n\t\t\t\t});\n\t\t\t\tthis.lightList = eqList.lightList.filter(item => {\n\t\t\t\t\treturn item.mbdNetwork == 0 || ids.includes(item.mbdId)\n\t\t\t\t});\n\t\t\t\tthis.pm25List = eqList.pm25List.filter(item => {\n\t\t\t\t\treturn item.mbdNetwork == 0 || ids.includes(item.mbdId)\n\t\t\t\t});\n\t\t\t}).catch(() => {})\n\t\t},\n\t\t// 表单提交\n\t\tdataFormSubmitHandle: throttle(function() {\n\t\t\tthis.$refs['dataForm'].validate((valid) => {\n\t\t\t\tif (!valid) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tthis.loading = true;\n\t\t\t\t// 总线 根据围栏编号还原 围栏名称返回给后端 纯数字key 有问题 加key字段拼接\n\t\t\t\tlet uwbListObj = {};\n\t\t\t\tthis.uwbRegionList.forEach(item => {\n\t\t\t\t\tuwbListObj['key' + item.id] = item.fenceName;\n\t\t\t\t})\n\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach(item => {\n\t\t\t\t\titem.fenceName = uwbListObj['key' + item.gbdFenceId]\n\t\t\t\t})\n\t\t\t\tthis.$http[!this.dataForm.id ? 'post' : 'put'](!this.dataForm.id ? '/system/scgatewaydc' :\n\t\t\t\t\t'/system/scgatewaydc', this.dataForm).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t}\n\t\t\t\t\tthis.$message({\n\t\t\t\t\t\tmessage: this.$t('prompt.success'),\n\t\t\t\t\t\ttype: 'success',\n\t\t\t\t\t\tduration: 500,\n\t\t\t\t\t\tonClose: () => {\n\t\t\t\t\t\t\tthis.visible = false\n\t\t\t\t\t\t\tthis.$emit('refreshDataList')\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t}).catch(() => {}).finally(() => {\n\t\t\t\t\tthis.loading = false\n\t\t\t\t})\n\t\t\t})\n\t\t}, 1000, {\n\t\t\t'leading': true,\n\t\t\t'trailing': false\n\t\t})\n\t},\n\tcomputed: {\n\t\tdataRule() {\n\t\t\tvar validateLine = (rule, value, callback) => {\n\t\t\t\tif (value.length === 0) {\n\t\t\t\t\tcallback(new Error(this.$t('validate.required')));\n\t\t\t\t} else {\n\t\t\t\t\tvalue.forEach((item, index) => {\n\t\t\t\t\t\tif (item.gbdLineNum === \"\" || item.gbdDevicetype === \"\" || item.mbdId === \"\" || item.gbdAddr === \"\") {\n\t\t\t\t\t\t\tcallback(new Error(this.$t('validate.required')));\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tgwIpgateway: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalidator: validateIP,\n\t\t\t\t\ttrigger: 'blur'\n\t\t\t\t}],\n\t\t\t\tgwName: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: this.$t('validate.required'),\n\t\t\t\t\ttrigger: 'blur'\n\t\t\t\t}],\n\t\t\t\tmbdDevicetype: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: this.$t('validate.required'),\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t\tgwSn: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: this.$t('validate.required'),\n\t\t\t\t\ttrigger: 'blur'\n\t\t\t\t}],\n\t\t\t\t// gwUwbnum: [{\n\t\t\t\t// \trequired: true,\n\t\t\t\t// \tmessage: this.$t('validate.required'),\n\t\t\t\t// \ttrigger: 'blur'\n\t\t\t\t// }],\n\t\t\t\tgwExpirydate: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: this.$t('validate.required'),\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t\tgwSetupaddr: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: this.$t('validate.required'),\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t\tscGatebusdeviceDTOList: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalidator: validateLine,\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t}\n\t\t}\n\t},\n}\n",{"version":3,"sources":["gateway-add-or-update.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"gateway-add-or-update.vue","sourceRoot":"src/views/modules/equipmentManage","sourcesContent":["<template>\n\t<el-dialog :visible.sync=\"visible\" :title=\"!dataForm.id ? $t('add') : $t('update')\" :close-on-click-modal=\"false\"\n\t :close-on-press-escape=\"false\" width=\"85%\">\n\t\t<el-form :model=\"dataForm\" :rules=\"dataRule\" ref=\"dataForm\" @keyup.enter.native=\"dataFormSubmitHandle()\" label-width=\"120px\">\n\t\t\t<el-form-item prop=\"gwId\" label=\"id\" style=\"display: none;\">\n\t\t\t\t<el-input v-model=\"dataForm.gwId\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item prop=\"gwIpgateway\" label=\"IP地址\">\n\t\t\t\t<el-input v-model=\"dataForm.gwIpgateway\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item prop=\"gwName\" label=\"设备名称\">\n\t\t\t\t<el-input v-model=\"dataForm.gwName\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item prop=\"mbdDevicetype\" label=\"设备类型\">\n\t\t\t\t<el-select filterable v-model=\"dataForm.mbdDevicetype\" placeholder=\"请选择\" clearable style=\"width: 100%;\">\n\t\t\t\t\t<el-option v-for=\"item in eqTypeList\" :key=\"item.dictValue\" :label=\"item.dictLabel\" :value=\"item.dictValue\">\n\t\t\t\t\t</el-option>\n\t\t\t\t</el-select>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item prop=\"gwSn\" label=\"设备序列号\">\n\t\t\t\t<el-input v-model=\"dataForm.gwSn\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t</el-form-item>\n\t\t\t<!-- <el-form-item prop=\"gwUwbnum\" label=\"UWB区域编号\">\n\t\t\t\t<el-input v-model=\"dataForm.gwUwbnum\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t</el-form-item> -->\n\t\t\t<el-form-item prop=\"gwExpirydate\" label=\"有效期\">\n\t\t\t\t<el-date-picker v-model=\"dataForm.gwExpirydate\" type=\"date\" value-format=\"yyyy-MM-dd\" placeholder=\"请选择\" style=\"width: 100%\"></el-date-picker>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item prop=\"gwSetupaddr\" label=\"安装位置\">\n\t\t\t\t<el-cascader v-model=\"dataForm.gwSetupaddr\" :props=\"{ value: 'df_floorid', label: 'df_floorname',checkStrictly: true}\"\n\t\t\t\t clearable placeholder=\"请选择\" :options=\"tfSetupaddrList\" style=\"width: 100%;\"></el-cascader>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item prop=\"scGatebusdeviceDTOList\" label=\"总线\">\n\t\t\t\t<el-row>\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"2\">序号</el-col>\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"3\">总线编号</el-col>\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"3\">设备类型</el-col>\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"3\">设备</el-col>\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"2\">灯口编号</el-col>\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"3\">接口编号</el-col>\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"3\">分组编号</el-col>\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"3\">围栏编号</el-col>\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"2\">\n\t\t\t\t\t\t<el-button size=\"small\" type=\"primary\" icon=\"el-icon-plus\" circle @click=\"handleAddClick\"></el-button>\n\t\t\t\t\t</el-col>\n\t\t\t\t</el-row>\n\t\t\t\t<el-row v-for=\"(item,index) in dataForm.scGatebusdeviceDTOList\" :key=\"index\">\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"2\">{{index+1}}</el-col>\n\t\t\t\t\t<!-- 总线编号 -->\n\t\t\t\t\t<el-col :span=\"3\">\n\t\t\t\t\t\t<el-select filterable v-model=\"item.gbdLineNum\" placeholder=\"请选择\" clearable style=\"width: 100%;\" @change=\"handleLineChange($event,item,index)\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in busList\" :key=\"item.dictValue\" :label=\"item.dictLabel\" :value=\"item.dictValue\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<!-- 设备类型 -->\n\t\t\t\t\t<el-col :span=\"3\">\n\t\t\t\t\t\t<el-select filterable v-model=\"item.gbdDevicetype\" placeholder=\"请选择\" clearable style=\"width: 100%;\" @change=\"handleEqTypeChange(index)\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in eqTypeList\" :key=\"item.dictValue\" :label=\"item.dictLabel\" :value=\"item.dictValue\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<!-- 设备 -->\n\t\t\t\t\t<el-col :span=\"3\">\n\t\t\t\t\t\t<el-select filterable v-if=\"item.gbdDevicetype==='0'\" v-model=\"item.mbdId\" placeholder=\"请选择\" clearable style=\"width: 100%;\"\n\t\t\t\t\t\t @change=\"handleEqChange($event,index,item)\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in pirList\" :key=\"item.mbdId\" :label=\"item.mbdDevicename\" :value=\"item.mbdId\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t\t<el-select filterable v-else-if=\"item.gbdDevicetype=='1'\" v-model=\"item.mbdId\" placeholder=\"请选择\" clearable style=\"width: 100%;\"\n\t\t\t\t\t\t @change=\"handleEqChange($event,index,item)\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in lightList\" :key=\"item.mbdId\" :label=\"item.mbdDevicename\" :value=\"item.mbdId\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t\t<el-select filterable v-else-if=\"item.gbdDevicetype==='2'\" v-model=\"item.mbdId\" placeholder=\"请选择\" clearable style=\"width: 100%;\"\n\t\t\t\t\t\t @change=\"handleEqChange($event,index,item)\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in pm25List\" :key=\"item.mbdId\" :label=\"item.mbdDevicename\" :value=\"item.mbdId\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t\t<el-select v-else placeholder=\"请先选择设备类型\" style=\"width: 100%;\" disabled>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<el-col :span=\"2\">\n\t\t\t\t\t\t<!-- XX{{item.fourEightTwelve}}XX -->\n\t\t\t\t\t\t<el-select v-if=\"item.fourEightTwelve==-1\" filterable v-model=\"item.lightroadnum\" placeholder=\"请选择\" clearable\n\t\t\t\t\t\t style=\"width: 100%;\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in options\" :key=\"item.value\" :label=\"item.label\" :value=\"item.value\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t\t<el-select v-else-if=\"item.fourEightTwelve==0\" filterable v-model=\"item.lightroadnum\" placeholder=\"请选择\" clearable\n\t\t\t\t\t\t style=\"width: 100%;\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in 4\" :key=\"item\" :label=\"item\" :value=\"item\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t\t<el-select v-else-if=\"item.fourEightTwelve==1\" filterable v-model=\"item.lightroadnum\" placeholder=\"请选择\" clearable\n\t\t\t\t\t\t style=\"width: 100%;\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in 8\" :key=\"item\" :label=\"item\" :value=\"item\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t\t<el-select v-else filterable v-model=\"item.lightroadnum\" placeholder=\"请选择\" clearable style=\"width: 100%;\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in 12\" :key=\"item\" :label=\"item\" :value=\"item\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<el-col :span=\"3\">\n\t\t\t\t\t\t<el-select filterable v-model=\"item.gbdAddr\" placeholder=\"请选择\" clearable style=\"width: 100%;\" @change=\"handleNumChange($event,item,index)\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in 31\" :key=\"item\" :label=\"item\" :value=\"item\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<el-col :span=\"3\">\n\t\t\t\t\t\t<el-select filterable v-model=\"item.gbdGroup\" placeholder=\"请选择\" clearable style=\"width: 100%;\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in 31\" :key=\"item\" :label=\"item\" :value=\"item\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<el-col :span=\"3\">\n\t\t\t\t\t\t<el-select filterable v-model=\"item.gbdFenceId\" placeholder=\"请选择\" clearable style=\"width: 100%;\">\n\t\t\t\t\t\t\t<el-option v-for=\"item in uwbRegionList\" :key=\"item.id\" :label=\"item.fenceName\" :value=\"item.id\">\n\t\t\t\t\t\t\t</el-option>\n\t\t\t\t\t\t</el-select>\n\t\t\t\t\t</el-col>\n\t\t\t\t\t<el-col class=\"col-title\" :span=\"2\">\n\t\t\t\t\t\t<el-button size=\"small\" type=\"danger\" icon=\"el-icon-delete\" circle @click=\"handleDeleteClick(item,index)\"></el-button>\n\t\t\t\t\t</el-col>\n\t\t\t\t</el-row>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item label=\"备注\" prop=\"remark\">\n\t\t\t\t<el-input type=\"textarea\" v-model=\"dataForm.remark\" clearable></el-input>\n\t\t\t</el-form-item>\n\t\t</el-form>\n\t\t<template slot=\"footer\">\n\t\t\t<el-button @click=\"visible = false\">{{ $t('cancel') }}</el-button>\n\t\t\t<el-button type=\"primary\" @click=\"dataFormSubmitHandle()\" v-loading=\"loading\">{{ $t('confirm') }}</el-button>\n\t\t</template>\n\t</el-dialog>\n</template>\n\n<script>\n\timport throttle from 'lodash/throttle'\n\timport {\n\t\tvalidateIP,\n\t} from '@/utils/validate.js'\n\timport {\n\t\ttreeDataTranslate,\n\t\tgetDictDataList\n\t} from '@/utils'\n\texport default {\n\t\tname: \"electric-add-or-update\",\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tloading: false,\n\t\t\t\tvisible: false,\n\t\t\t\ttfSetupaddrList: [], // 安装地址\n\t\t\t\teqTypeList: [], // 设备类型\n\t\t\t\tbusList: [], // 总线\n\t\t\t\teqNumberList: [], // 设备路数\n\t\t\t\teqList: [], // 设备(新增使用)\n\t\t\t\tpirList: [], // 修改使用\n\t\t\t\tlightList: [], // 修改使用\n\t\t\t\tpm25List: [], // 修改使用\n\t\t\t\tuwbRegionList: [], // \"区域围栏列表\"\n\t\t\t\tdataForm: {\n\t\t\t\t\t\"id\": \"\",\n\t\t\t\t\tgwId: \"\",\n\t\t\t\t\tgwIpgateway: \"\",\n\t\t\t\t\tgwName: \"\",\n\t\t\t\t\tmbdDevicetype: \"\",\n\t\t\t\t\tgwSn: \"\",\n\t\t\t\t\t// gwUwbnum: \"\",\n\t\t\t\t\tgwExpirydate: \"\",\n\t\t\t\t\tgwSetupaddr: [],\n\t\t\t\t\tscGatebusdeviceDTOList: [],\n\t\t\t\t\tremark: \"\",\n\t\t\t\t},\n\t\t\t\toptions: [{\n\t\t\t\t\tvalue: '-1',\n\t\t\t\t\tlabel: '-1'\n\t\t\t\t}]\n\t\t\t}\n\t\t},\n\t\tmethods: {\n\t\t\t// 新增总线\n\t\t\thandleAddClick() {\n\t\t\t\tlet obj = {\n\t\t\t\t\tgbdLineNum: \"\",\n\t\t\t\t\tgbdDevicetype: \"\",\n\t\t\t\t\tmbdId: \"\",\n\t\t\t\t\tlightroadnum: \"\", // 灯口编号\n\t\t\t\t\tgbdAddr: \"\",\n\t\t\t\t\tgbdGroup: \"\",\n\t\t\t\t\tgbdFenceId: \"\",\n\t\t\t\t\tfourEightTwelve: \"\", // 灯口编号类型\n\t\t\t\t}\n\n\t\t\t\tlet isZero = this.dataForm.scGatebusdeviceDTOList.length === 0 // 空数组\n\t\t\t\tif (isZero) {\n\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.unshift(obj)\n\t\t\t\t} else {\n\t\t\t\t\tlet isEmpty = false // 默认每个字段都有值\n\t\t\t\t\tlet i = 0\n\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\t\t\tif (item.gbdLineNum === \"\" || item.gbdDevicetype === \"\" || item.mbdId === \"\" || item.gbdAddr === \"\") {\n\t\t\t\t\t\t\ti = index\n\t\t\t\t\t\t\tisEmpty = true\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\tif (isEmpty) {\n\t\t\t\t\t\tthis.$message.info(`请先完善第${i+1}条数据信息再新增`)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.unshift(obj)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t// 删除\n\t\t\thandleDeleteClick(obj, index) {\n\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.splice(index, 1)\n\t\t\t},\n\t\t\t// 选择总线\n\t\t\thandleLineChange(e, obj, i) {\n\t\t\t\tif (e === \"\") {\n\t\t\t\t\treturn this.dataForm.scGatebusdeviceDTOList[i].gbdLineNum = \"\"\n\t\t\t\t}\n\t\t\t\t// 当表单\"设备类型\"和总线\"设备类型\"都选择智能控灯设备时,不做设备是否被使用的校验\n\t\t\t\tif (obj.gbdDevicetype === \"1\") {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlet j = 0\n\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\t\tif (obj.gbdAddr == item.gbdAddr && item.gbdLineNum == e) {\n\t\t\t\t\t\tj++\n\t\t\t\t\t\tif (j > 1) {\n\t\t\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList[i].gbdLineNum = \"\"\n\t\t\t\t\t\t\treturn this.$message.info(`第${i+1}条数据的编号已使用`)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t// 选择设备类型\n\t\t\thandleEqTypeChange(i) {\n\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\t\tif (index == i) {\n\t\t\t\t\t\treturn item.mbdId = \"\"\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t// 选择设备\n\t\t\thandleEqChange(e, i, obj) {\n\t\t\t\tif (e === \"\") {\n\t\t\t\t\treturn this.dataForm.scGatebusdeviceDTOList[i].mbdId = \"\"\n\t\t\t\t}\n\n\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\t\tif (i === index && item.gbdDevicetype === \"1\") {\n\t\t\t\t\t\tthis.lightList.forEach(item1 => {\n\t\t\t\t\t\t\tif (e === item1.mbdId) {\n\t\t\t\t\t\t\t\titem.fourEightTwelve = item1.mbdLightroads\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t} else if (i === index && item.gbdDevicetype != \"1\") {\n\t\t\t\t\t\titem.fourEightTwelve = -1\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\t// 当表单\"设备类型\"和总线\"设备类型\"都选择智能控灯设备时,不做设备是否被使用的校验\n\t\t\t\tif (obj.gbdDevicetype === \"1\") {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlet j = 0\n\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\t\tif (item.mbdId == e) {\n\t\t\t\t\t\tj++\n\t\t\t\t\t\tif (j > 1) {\n\t\t\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList[i].mbdId = \"\"\n\t\t\t\t\t\t\treturn this.$message.info(`第${i+1}条数据的设备已使用`)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t// 选择编号\n\t\t\thandleNumChange(e, obj, i) {\n\t\t\t\tif (e === \"\") {\n\t\t\t\t\treturn this.dataForm.scGatebusdeviceDTOList[i].gbdAddr = \"\"\n\t\t\t\t}\n\t\t\t\t// 当表单\"设备类型\"和总线\"设备类型\"都选择智能控灯设备时,不做设备是否被使用的校验\n\t\t\t\tif (obj.gbdDevicetype === \"1\") {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlet j = 0\n\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach((item, index) => {\n\t\t\t\t\tif (obj.gbdLineNum == item.gbdLineNum && item.gbdAddr == e) {\n\t\t\t\t\t\tj++\n\t\t\t\t\t\tif (j > 1) {\n\t\t\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList[i].gbdAddr = \"\"\n\t\t\t\t\t\t\treturn this.$message.info(`第${i+1}条数据的编号已使用`)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\tinit() {\n\t\t\t\tthis.visible = true\n\t\t\t\tthis.busList = getDictDataList(\"bus\")\n\t\t\t\tthis.eqTypeList = getDictDataList(\"eq_type\")\n\t\t\t\tthis.eqNumberList = getDictDataList(\"eq_number\")\n\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\tthis.$refs['dataForm'].resetFields()\n\t\t\t\t\tPromise.all([this.getTfSetupaddrList(), this.getEqList(), this.getUwbRegionList()]).then(result => {\n\t\t\t\t\t\tif (this.dataForm.id) {\n\t\t\t\t\t\t\t// 传递下拉框数据\n\t\t\t\t\t\t\tthis.getInfo(result[1])\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t},\n\t\t\t// 获取楼栋和楼层的cascader\n\t\t\tgetTfSetupaddrList() {\n\t\t\t\t// -1所有 0 学生宿舍 1 教师宿舍 2 教学楼\n\t\t\t\tthis.$http.get(`/system/scdormitoryfloor/roomTree/-1`).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t}\n\t\t\t\t\tthis.tfSetupaddrList = treeDataTranslate(res.data, 'df_floorid', 'df_parentid')\n\t\t\t\t}).catch(() => {})\n\t\t\t},\n\t\t\t// 获取三种类型的设备列表\n\t\t\tgetEqList() {\n\t\t\t\t// return new Promise((resolve, reject) => {\n\t\t\t\t// \tthis.$http.get(`/system/scmodbusdevicedc/type/-1`).then(({\n\t\t\t\t// \t\tdata: res\n\t\t\t\t// \t}) => {\n\t\t\t\t// \t\tif (res.code !== 0) {\n\t\t\t\t// \t\t\treturn this.$message.error(res.msg)\n\t\t\t\t// \t\t}\n\t\t\t\t// \t\t// res.data.mbdDevicetype 0 pirList 1 lightList 2pm25List\n\t\t\t\t// \t\tlet pirList = res.data.filter(item => item.mbdDevicetype == 0);\n\t\t\t\t// \t\tlet lightList = res.data.filter(item => item.mbdDevicetype == 1);\n\t\t\t\t// \t\tlet pm25List = res.data.filter(item => item.mbdDevicetype == 2);\n\n\t\t\t\t// \t\tthis.pirList = pirList\n\t\t\t\t// \t\tthis.lightList = lightList\n\t\t\t\t// \t\tthis.pm25List = pm25List\n\n\t\t\t\t// \t\t// 返回列表数据 供后续操作使用\n\t\t\t\t// \t\tresolve({\n\t\t\t\t// \t\t\tpirList: pirList,\n\t\t\t\t// \t\t\tlightList: lightList,\n\t\t\t\t// \t\t\tpm25List: pm25List,\n\t\t\t\t// \t\t})\n\t\t\t\t// \t}).catch(err => {\n\t\t\t\t// \t\treject(err)\n\t\t\t\t// \t})\n\t\t\t\t// })\n\t\t\t\tthis.$http.get(`/system/scmodbusdevicedc/type/0`).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t}\n\t\t\t\t\tthis.pirList = res.data\n\t\t\t\t}).catch(() => {})\n\t\t\t\tthis.$http.get(`/system/scmodbusdevicedc/type/1`).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t}\n\t\t\t\t\tthis.lightList = res.data\n\t\t\t\t}).catch(() => {})\n\t\t\t\tthis.$http.get(`/system/scmodbusdevicedc/type/2`).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t}\n\t\t\t\t\tthis.pm25List = res.data\n\t\t\t\t}).catch(() => {})\n\t\t\t},\n\t\t\t// 获取区域编号\n\t\t\tgetUwbRegionList() {\n\t\t\t\tthis.$http.get(`/system/scregionconfig/getUwbRegionList`).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t}\n\t\t\t\t\tthis.uwbRegionList = res.data\n\t\t\t\t}).catch(() => {})\n\t\t\t},\n\t\t\t// 获取信息\n\t\t\tgetInfo(eqList) {\n\t\t\t\tthis.$http.get(`/system/scgatewaydc/${this.dataForm.id}`).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t}\n\t\t\t\t\t// 组装灯口类型 fourEightTwelve-10123\n\t\t\t\t\tres.data.scGatebusdeviceDTOList.forEach(item => {\n\t\t\t\t\t\tif (item.gbdDevicetype != 1) {\n\t\t\t\t\t\t\titem.fourEightTwelve = -1\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.lightList.forEach(item1 => {\n\t\t\t\t\t\t\t\tif (item1.mbdId === item.mbdId) {\n\t\t\t\t\t\t\t\t\titem.fourEightTwelve = item1.mbdLightroads\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tthis.dataForm = { ...this.dataForm,\n\t\t\t\t\t\t...res.data\n\t\t\t\t\t}\n\t\t\t\t\tthis.dataForm.mbdDevicetype = String(this.dataForm.mbdDevicetype)\n\n\t\t\t\t\tconsole.log(this.dataForm)\n\n\t\t\t\t\t// 是否组网mbdNetwork 0否 1是\n\t\t\t\t\tlet ids = res.data.scGatebusdeviceDTOList.map(item => item.mbdId);\n\t\t\t\t\t// 筛选未组网和当前项组网列表集合\n\t\t\t\t\tthis.pirList = eqList.pirList.filter(item => {\n\t\t\t\t\t\treturn item.mbdNetwork == 0 || ids.includes(item.mbdId)\n\t\t\t\t\t});\n\t\t\t\t\tthis.lightList = eqList.lightList.filter(item => {\n\t\t\t\t\t\treturn item.mbdNetwork == 0 || ids.includes(item.mbdId)\n\t\t\t\t\t});\n\t\t\t\t\tthis.pm25List = eqList.pm25List.filter(item => {\n\t\t\t\t\t\treturn item.mbdNetwork == 0 || ids.includes(item.mbdId)\n\t\t\t\t\t});\n\t\t\t\t}).catch(() => {})\n\t\t\t},\n\t\t\t// 表单提交\n\t\t\tdataFormSubmitHandle: throttle(function() {\n\t\t\t\tthis.$refs['dataForm'].validate((valid) => {\n\t\t\t\t\tif (!valid) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t\tthis.loading = true;\n\t\t\t\t\t// 总线 根据围栏编号还原 围栏名称返回给后端 纯数字key 有问题 加key字段拼接\n\t\t\t\t\tlet uwbListObj = {};\n\t\t\t\t\tthis.uwbRegionList.forEach(item => {\n\t\t\t\t\t\tuwbListObj['key' + item.id] = item.fenceName;\n\t\t\t\t\t})\n\t\t\t\t\tthis.dataForm.scGatebusdeviceDTOList.forEach(item => {\n\t\t\t\t\t\titem.fenceName = uwbListObj['key' + item.gbdFenceId]\n\t\t\t\t\t})\n\t\t\t\t\tthis.$http[!this.dataForm.id ? 'post' : 'put'](!this.dataForm.id ? '/system/scgatewaydc' :\n\t\t\t\t\t\t'/system/scgatewaydc', this.dataForm).then(({\n\t\t\t\t\t\tdata: res\n\t\t\t\t\t}) => {\n\t\t\t\t\t\tif (res.code !== 0) {\n\t\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.$message({\n\t\t\t\t\t\t\tmessage: this.$t('prompt.success'),\n\t\t\t\t\t\t\ttype: 'success',\n\t\t\t\t\t\t\tduration: 500,\n\t\t\t\t\t\t\tonClose: () => {\n\t\t\t\t\t\t\t\tthis.visible = false\n\t\t\t\t\t\t\t\tthis.$emit('refreshDataList')\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t}).catch(() => {}).finally(() => {\n\t\t\t\t\t\tthis.loading = false\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}, 1000, {\n\t\t\t\t'leading': true,\n\t\t\t\t'trailing': false\n\t\t\t})\n\t\t},\n\t\tcomputed: {\n\t\t\tdataRule() {\n\t\t\t\tvar validateLine = (rule, value, callback) => {\n\t\t\t\t\tif (value.length === 0) {\n\t\t\t\t\t\tcallback(new Error(this.$t('validate.required')));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalue.forEach((item, index) => {\n\t\t\t\t\t\t\tif (item.gbdLineNum === \"\" || item.gbdDevicetype === \"\" || item.mbdId === \"\" || item.gbdAddr === \"\") {\n\t\t\t\t\t\t\t\tcallback(new Error(this.$t('validate.required')));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\tcallback();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tgwIpgateway: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tvalidator: validateIP,\n\t\t\t\t\t\ttrigger: 'blur'\n\t\t\t\t\t}],\n\t\t\t\t\tgwName: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: this.$t('validate.required'),\n\t\t\t\t\t\ttrigger: 'blur'\n\t\t\t\t\t}],\n\t\t\t\t\tmbdDevicetype: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: this.$t('validate.required'),\n\t\t\t\t\t\ttrigger: 'change'\n\t\t\t\t\t}],\n\t\t\t\t\tgwSn: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: this.$t('validate.required'),\n\t\t\t\t\t\ttrigger: 'blur'\n\t\t\t\t\t}],\n\t\t\t\t\t// gwUwbnum: [{\n\t\t\t\t\t// \trequired: true,\n\t\t\t\t\t// \tmessage: this.$t('validate.required'),\n\t\t\t\t\t// \ttrigger: 'blur'\n\t\t\t\t\t// }],\n\t\t\t\t\tgwExpirydate: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: this.$t('validate.required'),\n\t\t\t\t\t\ttrigger: 'change'\n\t\t\t\t\t}],\n\t\t\t\t\tgwSetupaddr: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: this.$t('validate.required'),\n\t\t\t\t\t\ttrigger: 'change'\n\t\t\t\t\t}],\n\t\t\t\t\tscGatebusdeviceDTOList: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tvalidator: validateLine,\n\t\t\t\t\t\ttrigger: 'change'\n\t\t\t\t\t}],\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}\n</script>\n\n<style scoped lang=\"scss\">\n\t/deep/ .col-title {\n\t\ttext-align: center;\n\t\tbackground: rgba(0, 191, 255, 0.2);\n\t\tborder: 1px solid rgba(0, 191, 255, 0.5)\n\t}\n</style>\n"]}]}