1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/.cache/babel-loader/4c2fa9c629f404a1216d6185033...

1 line
22 KiB
JSON

{"remainingRequest":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!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\\pm25-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\\pm25-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":["import \"core-js/modules/es7.object.get-own-property-descriptors\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/es6.regexp.split\";\nimport _defineProperty from \"C:\\\\Users\\\\27446\\\\Desktop\\\\up\\\\front\\\\dkha-web-sz-main\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/defineProperty\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.string.iterator\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\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 position from \"./pm25-position\";\nimport { treeDataTranslate } from '@/utils';\nexport default {\n name: \"pir-add-or-update\",\n components: {\n position: position\n },\n data: function data() {\n return {\n loading: false,\n visible: false,\n positionVisible: false,\n tfSetupaddrList: [],\n // 楼栋、楼层级联\n dataForm: {\n id: \"\",\n mbdId: \"\",\n mbdDevicetype: 2,\n // 设备类型\n mbdNetwork: 0,\n // 是否组网\n mbdDevicename: \"\",\n mbdDevicesn: \"\",\n mbdExpirydate: \"\",\n mbdUwbaddr: [],\n remark: \"\",\n mbdCoordinate: [0, 0]\n },\n pictureId: \"1f\"\n };\n },\n computed: {\n dataRule: function dataRule() {\n return {\n mbdDevicename: [{\n required: true,\n message: this.$t('validate.required'),\n trigger: 'blur'\n }],\n mbdDevicesn: [{\n required: true,\n message: this.$t('validate.required'),\n trigger: 'blur'\n }],\n mbdExpirydate: [{\n required: true,\n message: this.$t('validate.required'),\n trigger: 'change'\n }],\n mbdUwbaddr: [{\n required: true,\n message: this.$t('validate.required'),\n trigger: 'change'\n }],\n mbdCoordinate: [{\n required: true,\n message: '请选择',\n trigger: 'blur'\n }]\n };\n }\n },\n methods: {\n init: function init() {\n var _this = this;\n\n this.visible = true;\n this.positionVisible = false;\n this.dataForm.mbdNetwork = 0;\n this.$nextTick(function () {\n _this.dataForm.mbdCoordinate = [0, 0];\n\n _this.$refs['dataForm'].resetFields();\n\n Promise.all([_this.getTfSetupaddrList()]).then(function () {\n if (_this.dataForm.id) {\n _this.getInfo();\n }\n });\n });\n },\n // 获取楼栋和楼层的cascader\n getTfSetupaddrList: function getTfSetupaddrList() {\n var _this2 = this;\n\n // -1所有 0 学生宿舍 1 教师宿舍 2 教学楼\n return new Promise(function (resolve, reject) {\n _this2.$http.get(\"/system/scdormitoryfloor/roomTree/-1\").then(function (_ref) {\n var res = _ref.data;\n\n if (res.code !== 0) {\n return _this2.$message.error(res.msg);\n }\n\n _this2.tfSetupaddrList = treeDataTranslate(res.data, 'df_floorid', 'df_parentid');\n resolve();\n }).catch(function () {\n reject();\n });\n });\n },\n // 获取信息\n getInfo: function getInfo() {\n var _this3 = this;\n\n this.$http.get(\"/system/scmodbusdevicedc/\".concat(this.dataForm.id)).then(function (_ref2) {\n var res = _ref2.data;\n\n if (res.code !== 0) {\n return _this3.$message.error(res.msg);\n }\n\n _this3.dataForm = _objectSpread({}, _this3.dataForm, {}, res.data, {\n mbdCoordinate: res.data.mbdCoordinate ? res.data.mbdCoordinate.split(\",\") : \"\" // 查询当前设备安装位置楼层性质以及楼层\n\n });\n var buildId = res.data.mbdUwbaddr[0];\n\n var building = _this3.tfSetupaddrList.filter(function (item) {\n return item.df_floorid == buildId;\n });\n\n var type = building && building[0].df_purpose;\n var floor; // 判断是否有楼层\n\n var floorId = res.data.mbdUwbaddr[1];\n\n if (floorId) {\n floor = building[0].children.filter(function (item) {\n return item.df_floorid == floorId;\n });\n } // 判断是否需要显示 地图位置\n\n\n if (type == 2 && floor) {\n _this3.positionVisible = true;\n _this3.pictureId = floor[0].df_floorname;\n }\n }).catch(function () {});\n },\n // 表单提交\n dataFormSubmitHandle: throttle(function () {\n var _this4 = this;\n\n this.$refs['dataForm'].validate(function (valid) {\n if (!valid) {\n return false;\n }\n\n _this4.loading = true; // 位置数组转为string\n\n var submitData = JSON.parse(JSON.stringify(_this4.dataForm));\n submitData.mbdCoordinate = submitData.mbdCoordinate ? submitData.mbdCoordinate.join(\",\") : \"\"; // 提交\n\n _this4.$http[!_this4.dataForm.id ? 'post' : 'put'](!_this4.dataForm.id ? '/system/scmodbusdevicedc' : '/system/scmodbusdevicedc', submitData).then(function (_ref3) {\n var res = _ref3.data;\n\n if (res.code !== 0) {\n return _this4.$message.error(res.msg);\n }\n\n _this4.$message({\n message: _this4.$t('prompt.success'),\n type: 'success',\n duration: 500,\n onClose: function onClose() {\n _this4.visible = false;\n\n _this4.$emit('refreshDataList');\n }\n });\n }).catch(function () {}).finally(function () {\n _this4.loading = false;\n });\n });\n }, 1000, {\n 'leading': true,\n 'trailing': false\n }),\n findNodeLevelFirst: function findNodeLevelFirst(node) {\n if (node.level == 1) {\n return node;\n }\n\n return this.findNodeLevelFirst(node.parent);\n },\n findNodeFloorLayer: function findNodeFloorLayer(node) {\n if (node.level == 1) {\n this.pictureId = 0;\n return null;\n } else if (node.level == 2) {\n return node.label;\n }\n\n return this.findNodeFloorLayer(node.parent);\n },\n positonChangeHandler: function positonChangeHandler(data) {\n // 获取当前选中节点信息\n var node = this.$refs['cascader'].getCheckedNodes()[0]; // 查找楼层信息\n\n var floor = this.findNodeFloorLayer(node); // 查找到第一级\n\n var first = this.findNodeLevelFirst(node); // df_purpose=2 楼栋属性为教学楼\n\n if (first.data.df_purpose == 2 && floor) {\n this.positionVisible = true;\n this.pictureId = floor;\n } else {\n this.positionVisible = false;\n }\n }\n }\n};",{"version":3,"sources":["pm25-add-or-update.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,OAAA,QAAA,MAAA,iBAAA;AACA,OAAA,QAAA;AACA,SACA,iBADA,QAEA,SAFA;AAGA,eAAA;AACA,EAAA,IAAA,EAAA,mBADA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('add') : $t('update')\" :close-on-click-modal=\"false\"\n\t :close-on-press-escape=\"false\">\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=\"mbdId\" label=\"id\" style=\"display: none;\">\n\t\t\t\t<el-input v-model=\"dataForm.mbdId\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item prop=\"mbdDevicename\" label=\"设备名称\">\n\t\t\t\t<el-input v-model=\"dataForm.mbdDevicename\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item prop=\"mbdDevicesn\" label=\"设备序列号\">\n\t\t\t\t<el-input v-model=\"dataForm.mbdDevicesn\" placeholder=\"请输入\" clearable></el-input>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item prop=\"mbdExpirydate\" label=\"有效期\">\n\t\t\t\t<el-date-picker v-model=\"dataForm.mbdExpirydate\" 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=\"mbdUwbaddr\" label=\"安装位置\">\n\t\t\t\t<el-cascader ref=\"cascader\" v-model=\"dataForm.mbdUwbaddr\" :props=\"{ value: 'df_floorid', label: 'df_floorname',checkStrictly: true}\"\n\t\t\t\t clearable placeholder=\"请选择\" :options=\"tfSetupaddrList\" style=\"width: 100%;\" @change=\"positonChangeHandler\"></el-cascader>\n\t\t\t</el-form-item>\n\t\t\t<el-form-item v-if=\"positionVisible\" prop=\"mbdCoordinate\" label=\"地图位置\">\n\t\t\t\t<position v-model=\"dataForm.mbdCoordinate\" :pictureid=\"pictureId\"></position>\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 position from './pm25-position'\n\timport {\n\t\ttreeDataTranslate\n\t} from '@/utils'\n\texport default {\n\t\tname: \"pir-add-or-update\",\n\t\tcomponents:{\n\t\t\tposition\n\t\t},\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tloading: false,\n\t\t\t\tvisible: false,\n\t\t\t\tpositionVisible:false,\n\t\t\t\ttfSetupaddrList: [], // 楼栋、楼层级联\n\t\t\t\tdataForm: {\n\t\t\t\t\tid: \"\",\n\t\t\t\t\tmbdId: \"\",\n\t\t\t\t\tmbdDevicetype: 2, // 设备类型\n\t\t\t\t\tmbdNetwork: 0, // 是否组网\n\t\t\t\t\tmbdDevicename: \"\",\n\t\t\t\t\tmbdDevicesn: \"\",\n\t\t\t\t\tmbdExpirydate: \"\",\n\t\t\t\t\tmbdUwbaddr: [],\n\t\t\t\t\tremark: \"\",\n\t\t\t\t\tmbdCoordinate:[0,0]\n\t\t\t\t},\n\t\t\t\tpictureId:\"1f\",\n\t\t\t}\n\t\t},\n\t\tcomputed: {\n\t\t\tdataRule() {\n\t\t\t\treturn {\n\t\t\t\t\tmbdDevicename: [{\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\tmbdDevicesn: [{\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\tmbdExpirydate: [{\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\tmbdUwbaddr: [{\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\tmbdCoordinate:[\n\t\t\t\t\t\t{required: true, message:'请选择', trigger: 'blur'}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tmethods: {\n\t\t\tinit() {\n\t\t\t\tthis.visible = true;\n\t\t\t\tthis.positionVisible=false;\n\t\t\t\tthis.dataForm.mbdNetwork = 0\n\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\tthis.dataForm.mbdCoordinate=[0,0];\n\t\t\t\t\tthis.$refs['dataForm'].resetFields()\n\t\t\t\t\tPromise.all([this.getTfSetupaddrList()]).then(() => {\n\t\t\t\t\t\tif (this.dataForm.id) {\n\t\t\t\t\t\t\tthis.getInfo()\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\treturn new Promise((resolve,reject)=>{\n\t\t\t\t\tthis.$http.get(`/system/scdormitoryfloor/roomTree/-1`).then(({\n\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.tfSetupaddrList = treeDataTranslate(res.data, 'df_floorid', 'df_parentid')\n\t\t\t\t\t\tresolve()\n\t\t\t\t\t}).catch(() => {\n\t\t\t\t\t\treject()\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\t\n\t\t\t},\n\t\t\t// 获取信息\n\t\t\tgetInfo() {\n\t\t\t\tthis.$http.get(`/system/scmodbusdevicedc/${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\tthis.dataForm = { ...this.dataForm,\n\t\t\t\t\t\t...res.data,\n\t\t\t\t\t\tmbdCoordinate:res.data.mbdCoordinate?res.data.mbdCoordinate.split(\",\"):\"\"\n\t\t\t\t\t}\n\t\t\t\t\t// 查询当前设备安装位置楼层性质以及楼层\n\t\t\t\t\tlet buildId=res.data.mbdUwbaddr[0];\n\t\t\t\t\tlet building=this.tfSetupaddrList.filter(item=>item.df_floorid==buildId);\n\t\t\t\t\tlet type=building&&building[0].df_purpose;\n\t\t\t\t\tlet floor;\n\t\t\t\t\t// 判断是否有楼层\n\t\t\t\t\tlet floorId=res.data.mbdUwbaddr[1];\n\t\t\t\t\tif(floorId){\n\t\t\t\t\t\tfloor=building[0].children.filter(item=>item.df_floorid==floorId);\n\t\t\t\t\t}\n\t\t\t\t\t// 判断是否需要显示 地图位置\n\t\t\t\t\tif(type==2&&floor){\n\t\t\t\t\t\tthis.positionVisible=true;\n\t\t\t\t\t\tthis.pictureId=floor[0].df_floorname;\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// 位置数组转为string\n\t\t\t\t\tlet submitData=JSON.parse(JSON.stringify(this.dataForm));\n\t\t\t\t\tsubmitData.mbdCoordinate=submitData.mbdCoordinate?submitData.mbdCoordinate.join(\",\"):\"\";\n\t\t\t\t\t// 提交\n\t\t\t\t\tthis.$http[!this.dataForm.id ? 'post' : 'put'](!this.dataForm.id ? '/system/scmodbusdevicedc' :\n\t\t\t\t\t\t'/system/scmodbusdevicedc', submitData).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\tfindNodeLevelFirst(node){\n\t\t\t\tif(node.level==1){\n\t\t\t\t\treturn node\n\t\t\t\t}\n\t\t\t\treturn this.findNodeLevelFirst(node.parent)\n\t\t\t},\n\t\t\tfindNodeFloorLayer(node){\n\t\t\t\tif(node.level==1){\n\t\t\t\t\tthis.pictureId=0;\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\telse if(node.level==2){\n\t\t\t\t\treturn node.label\n\t\t\t\t}\n\t\t\t\treturn this.findNodeFloorLayer(node.parent)\n\t\t\t},\n\t\t\tpositonChangeHandler(data){\n\t\t\t\t// 获取当前选中节点信息\n\t\t\t\tlet node=this.$refs['cascader'].getCheckedNodes()[0];\n\t\t\t\t// 查找楼层信息\n\t\t\t\tlet floor=this.findNodeFloorLayer(node);\n\t\t\t\t// 查找到第一级\n\t\t\t\tlet first=this.findNodeLevelFirst(node);\n\t\t\t\t// df_purpose=2 楼栋属性为教学楼\n\t\t\t\tif(first.data.df_purpose==2&&floor){\n\t\t\t\t\tthis.positionVisible=true;\n\t\t\t\t\tthis.pictureId=floor;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tthis.positionVisible=false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n</script>\n"],"sourceRoot":"src/views/modules/equipmentManage"}]}