{"remainingRequest":"D:\\jenkins\\workspace\\damDance-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\damDance-fvue\\src\\views\\BasicData\\components\\IntelligentDeviceDialog.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\damDance-fvue\\src\\views\\BasicData\\components\\IntelligentDeviceDialog.vue","mtime":1703831130600},{"path":"D:\\jenkins\\workspace\\damDance-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\damDance-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\damDance-fvue\\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//\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\r\nimport utils from '@/utils.js'\r\nimport IntelligentDevice from '@/api/basicConfiguration/IntelligentDevice'\r\nimport Team from '@/api/basicConfiguration/Team'\r\n\r\nimport dictUtils from '@/components/dict/DictSelectUtils.js'\r\nimport placesDialog from '../../BasicData/components/placesDialog.vue'\r\n\r\nexport default {\r\n props: {},\r\n name: 'IntelligentDeviceDialog',\r\n components: {\r\n placesDialog,\r\n },\r\n data() {\r\n const validateDevice = (rule, value, callback) => {\r\n console.log(value)\r\n if (value.length) {\r\n callback()\r\n } else {\r\n callback(new Error('请选择关联设备'))\r\n }\r\n }\r\n return {\r\n visible: false,\r\n loading: false,\r\n rules: {\r\n code: [\r\n {\r\n required: true,\r\n message: '请输入设备编码',\r\n trigger: 'blur',\r\n },\r\n ],\r\n name: [\r\n {\r\n required: true,\r\n message: '请输入设备名称',\r\n trigger: 'blur',\r\n },\r\n ],\r\n type: [\r\n {\r\n required: true,\r\n message: '请选择设备类型',\r\n trigger: 'blur',\r\n },\r\n ],\r\n // squareLocationId: [\r\n // {\r\n // required: true,\r\n // message: '请选择所属广场舞',\r\n // trigger: 'blur',\r\n // },\r\n // ],\r\n areaCode: [\r\n {\r\n required: true,\r\n message: '请选择行政区划',\r\n trigger: 'blur',\r\n },\r\n ],\r\n detailAddress: [\r\n {\r\n required: true,\r\n message: '请输入详细地址',\r\n trigger: 'blur',\r\n },\r\n ],\r\n deviceRelateds: [\r\n {\r\n required: true,\r\n validator: validateDevice,\r\n tirgger: 'change',\r\n },\r\n ],\r\n },\r\n xboptions: [],\r\n type: '新增',\r\n formData: {\r\n code: '',\r\n name: '',\r\n type: null,\r\n squareLocationId: '',\r\n areaCode: '',\r\n detailAddress: '',\r\n lgtd: null,\r\n lttd: null,\r\n status: null,\r\n deviceRelateds: [],\r\n },\r\n areaCode: [],\r\n options: [],\r\n\r\n sblxList: [], //设备类型\r\n sbztList: [], //设备状态\r\n squareList: [], //广场舞地址\r\n btnLoading: false,\r\n deviceList: [],\r\n deviceInfo: [],\r\n }\r\n },\r\n created() {\r\n this.sblxList = dictUtils.getDictItemsFromCache('sblx')\r\n this.sbztList = dictUtils.getDictItemsFromCache('sbzt')\r\n\r\n this.getTownTree()\r\n this.getPlazaLocation()\r\n // this.getNoiseTree()\r\n // this.getTeam()\r\n },\r\n methods: {\r\n //行政区划\r\n getTownTree() {\r\n Team.townTree({}, (res) => {\r\n if (res.state) {\r\n this.options = res.value\r\n }\r\n })\r\n },\r\n handleChange(val) {\r\n let nodesObj = this.$refs['cascader'].getCheckedNodes()[0].data\r\n this.formData.areaFullCode = nodesObj.fullCode\r\n this.formData.areaFullName = nodesObj.fullName\r\n this.formData.areaCode = nodesObj.code\r\n },\r\n //获取广场舞地点\r\n getPlazaLocation() {\r\n IntelligentDevice.plazaQuery(\r\n {\r\n pageBean: {\r\n page: 1,\r\n pageSize: -1,\r\n },\r\n },\r\n (res) => {\r\n this.squareList = res.rows\r\n }\r\n )\r\n },\r\n handleSelect(val) {\r\n this.squareList.forEach((e) => {\r\n if (e.id === val) {\r\n this.areaCode = e.areaFullCode\r\n ? e.areaFullCode.split('/').splice(1)\r\n : []\r\n this.formData.areaCode = e.areaCode\r\n this.formData.detailAddress = e.detailAddress\r\n }\r\n })\r\n },\r\n open(data) {\r\n this.deviceInfo = []\r\n this.noise = []\r\n this.squareTeam = []\r\n this.areaCode = []\r\n this.visible = true\r\n this.formData = {\r\n code: '',\r\n name: '',\r\n type: '1',\r\n squareLocationId: '',\r\n areaCode: '',\r\n detailAddress: '',\r\n lgtd: null,\r\n lttd: null,\r\n status: null,\r\n deviceRelateds: [],\r\n }\r\n this.type = '新增'\r\n this.getDeviceList()\r\n },\r\n handleClose() {\r\n this.visible = false\r\n },\r\n getDeviceList(id) {\r\n this.deviceList = []\r\n IntelligentDevice.getDeviceList(id, (res) => {\r\n for (let key in res) {\r\n // 循环代码块\r\n this.deviceList.push({\r\n name: key,\r\n children: res[key],\r\n })\r\n }\r\n console.log(this.deviceList)\r\n })\r\n },\r\n submitForm(formName) {\r\n this.$refs.form.validate((valid) => {\r\n if (valid) {\r\n this.btnLoading = true\r\n alert('submit!')\r\n } else {\r\n console.log('error submit!!')\r\n return false\r\n }\r\n })\r\n },\r\n edit(val) {\r\n this.deviceInfo = []\r\n this.noise = []\r\n this.squareTeam = []\r\n this.areaCode = []\r\n this.formData = {\r\n code: '',\r\n name: '',\r\n type: null,\r\n squareLocationId: '',\r\n areaCode: '',\r\n detailAddress: '',\r\n lgtd: null,\r\n lttd: null,\r\n status: null,\r\n deviceRelateds: [],\r\n }\r\n this.type = '编辑'\r\n this.visible = true\r\n IntelligentDevice.detailId(val, (res) => {\r\n if (res) {\r\n this.formData = res\r\n this.getDeviceList(res.code)\r\n this.deviceInfo = res.deviceRelateds.map(it => {\r\n return it.relatedDeviceCode\r\n })\r\n this.areaCode = res.areaFullCode\r\n ? res.areaFullCode.split('/').splice(1)\r\n : []\r\n\r\n if (res.noiseLevelId && res.noiseTypeId) {\r\n this.noise = [res.noiseTypeId, res.noiseLevelId]\r\n } else if (res.noiseTypeId) {\r\n this.noise = [res.noiseTypeId]\r\n } else {\r\n this.noise = []\r\n }\r\n }\r\n })\r\n },\r\n handleSave() {\r\n this.$refs.form.validate((valid) => {\r\n if (valid) {\r\n let method\r\n if (this.type === '新增') {\r\n method = IntelligentDevice.addSave\r\n } else {\r\n method = IntelligentDevice.upData\r\n }\r\n method(this.formData, (response) => {\r\n if (response.state) {\r\n this.$notify({\r\n type: 'success',\r\n message: this.type + '成功',\r\n duration: 2000,\r\n })\r\n this.handleClose()\r\n this.$emit('getData')\r\n } else {\r\n this.$message.warning(response.message)\r\n }\r\n })\r\n } else {\r\n this.$notify({\r\n type: 'warning',\r\n message: '请完善表单信息!',\r\n duration: 2000,\r\n })\r\n }\r\n })\r\n },\r\n handleSearchPlaces() {\r\n this.$refs.placesDialog.open()\r\n },\r\n changePlaces(data) {\r\n this.formData.squareLocationName = data.squareLocationName\r\n this.formData.squareLocationId = data.id\r\n this.formData.areaCode = data.areaCode\r\n this.formData.areaFullCode = data.areaFullCode\r\n this.$forceUpdate()\r\n },\r\n changeDevice(val) {\r\n this.formData.deviceRelateds = val.map((it) => {\r\n return {\r\n deviceInfoCode: this.formData.code,\r\n relatedDeviceCode: it,\r\n }\r\n })\r\n },\r\n },\r\n}\r\n",null]}