management/front/dkha-web-sz-main/node_modules/.cache/babel-loader/19419adc487d192550d598edeb7...

1 line
23 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\\building\\add-or-update.vue?vue&type=script&lang=js&","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\building\\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/web.dom.iterable\";\nimport \"core-js/modules/es6.object.keys\";\nimport _defineProperty from \"C:\\\\Users\\\\27446\\\\Desktop\\\\up\\\\front\\\\dkha-web-sz-main\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/defineProperty\";\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//\n//\n//\n//\n//\n//\nimport { getDictDataList } from '@/utils';\nimport debounce from 'lodash/debounce';\nimport buildingTree from '@/views/modules/building/building-tree';\nimport ajax from '@/utils/login';\nexport default {\n components: {\n buildingTree: buildingTree\n },\n inject: ['refresh'],\n data: function data() {\n var _this = this;\n\n var validateType = function validateType(rule, value, UWBallback) {\n if (value != '0' && !_this.dataForm.dfParentName) {\n UWBallback(new Error('请选择楼层或房间上级'));\n } else {\n UWBallback();\n }\n };\n\n return {\n showFloorCascader: false,\n // 是否显示楼层的cascader(当选择楼层\"1\"时展示)\n uwbFloorList: [],\n // 楼栋、楼层\n dialogVisible: false,\n loading: false,\n type: 'post',\n dfTypeList: getDictDataList('buildingType'),\n dfPurposeList: getDictDataList('purpose'),\n dataForm: {\n dfParentid: '0',\n dfParentName: '',\n dfType: '',\n uwbFloors: [],\n dfFloorname: '',\n dfPurpose: '',\n dfOrder: 0,\n drCapacity: 1\n },\n rules: {\n dfType: [{\n required: true,\n message: '请选择',\n trigger: ['blur', 'change']\n }, {\n validator: validateType,\n trigger: ['blur', 'change']\n }],\n uwbFloors: [{\n required: true,\n message: '请选择',\n trigger: ['blur', 'change']\n }],\n dfPurpose: [{\n required: true,\n message: '请选择',\n trigger: ['blur', 'change']\n }],\n dfFloorname: [{\n required: true,\n message: '请输入',\n trigger: ['blur', 'change']\n }, {\n max: 30,\n message: '最多 30 个字符',\n trigger: ['blur', 'change']\n }],\n dfOrder: [{\n required: true,\n message: '请输入',\n trigger: ['blur', 'change']\n }],\n drCapacity: [{\n required: true,\n message: '请输入',\n trigger: ['blur', 'change']\n }]\n }\n };\n },\n created: function created() {\n var _this2 = this;\n\n // 获取UWB楼栋和楼层的cascader\n ajax({\n url: \"/map/map\",\n // url:\"/system/scdormitoryfloor/uwbbuildingtree\",\n method: \"get\"\n }).then(function (_ref) {\n var res = _ref.data;\n\n // status 200\n if (res.status !== 200) {\n return _this2.$message.error(res.msg);\n } // this.uwbFloorList = res.data.map(item => {\n // \titem.children = item.children.map(item1 => {\n // \t\treturn {\n // \t\t\tlabel: item1.label,\n // \t\t\tvalue: item1.value\n // \t\t}\n // \t})\n // \treturn item\n // })\n\n\n _this2.uwbFloorList = res.result.filter(function (item) {\n return item.mapType == 1;\n }).map(function (item) {\n item.children = JSON.parse(item.floorList).map(function (label) {\n return {\n label: label,\n value: label\n };\n });\n item.label = item.buildingName;\n item.value = String(item.id);\n return item;\n });\n }).catch(function (err) {\n console.log('building error', err);\n });\n },\n methods: {\n init: function init(id, type) {\n var _this3 = this;\n\n this.dialogVisible = true; // 编辑\n\n if (id) {\n this.type = 'put';\n this.$http({\n url: \"/system/scdormitoryfloor/\".concat(id, \"/\").concat(type),\n method: \"get\"\n }).then(function (_ref2) {\n var data = _ref2.data;\n\n if (data.code == 0) {\n // 1 是楼层\n if (data.data.dfType == 1) {\n _this3.showFloorCascader = true;\n } else {\n _this3.showFloorCascader = false;\n data.data.uwbFloors = [];\n }\n\n _this3.dataForm = _objectSpread({}, data.data, {\n dfPurpose: String(data.data.dfPurpose),\n dfType: String(data.data.dfType),\n dfParentName: data.data.parentName\n });\n } else {\n _this3.$message.warning(data.msg);\n }\n });\n } // 新增\n else {\n this.type = 'post';\n this.dataForm = {\n dfParentid: '0',\n dfParentName: '',\n dfType: '',\n uwbFloors: [],\n dfFloorname: '',\n dfPurpose: '',\n dfOrder: 0,\n drCapacity: 1\n };\n this.showFloorCascader = false;\n this.dataForm.uwbFloors = [];\n this.$nextTick(function () {\n _this3.$refs['dataForm'].resetFields();\n });\n }\n },\n typeHandle: function typeHandle(e) {\n if (e == 1) {\n this.showFloorCascader = true;\n } else {\n this.showFloorCascader = false;\n this.dataForm.uwbFloors = [];\n }\n },\n submitForm: debounce(function () {\n var _this4 = this;\n\n this.$refs['dataForm'].validate(function (valid) {\n if (!valid) {\n return false;\n } // 当uwbFloors没数据时,后端返回的时\"\",但是提交数据时后端接收的是[]\n\n\n if (_this4.dataForm.uwbFloors === \"\") {\n _this4.dataForm.uwbFloors = [];\n }\n\n _this4.loading = true;\n\n _this4.$http({\n url: \"/system/scdormitoryfloor\",\n method: _this4.type,\n data: _objectSpread({}, _this4.dataForm)\n }).then(function (_ref3) {\n var data = _ref3.data;\n\n if (data.code == 0) {\n _this4.dialogVisible = false; // this.$parent.$parent.initTree();\n\n _this4.refresh();\n\n _this4.$message.success(data.msg);\n } else {\n _this4.$message.warning(data.msg);\n }\n }).finally(function () {\n _this4.loading = false;\n });\n });\n }, 1000, {\n 'leading': true,\n 'trailing': false\n })\n }\n};",{"version":3,"sources":["add-or-update.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SACA,eADA,QAEA,SAFA;AAGA,OAAA,QAAA,MAAA,iBAAA;AACA,OAAA,YAAA,MAAA,wCAAA;AACA,OAAA,IAAA,MAAA,eAAA;AACA,eAAA;AACA,EAAA,UAAA,EAAA;AACA,IAAA,YAAA,EAAA;AADA,GADA;AAIA,EAAA,MAAA,EAAA,CAAA,SAAA,CAJA;AAKA,EAAA,IALA,kBAKA;AAAA;;AACA,QAAA,YAAA,GAAA,SAAA,YAAA,CAAA,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA;AACA,UAAA,KAAA,IAAA,GAAA,IAAA,CAAA,KAAA,CAAA,QAAA,CAAA,YAA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A;AACA,UAAA,GAAA,EAAA,0BADA;AAEA,UAAA,MAAA,EAAA,MAAA,CAAA,IAFA;AAGA,UAAA,IAAA,oBACA,MAAA,CAAA,QADA;AAHA,SAAA,EAMA,IANA,CAMA,iBAEA;AAAA,cADA,IACA,SADA,IACA;;AACA,cAAA,IAAA,CAAA,IAAA,IAAA,CAAA,EAAA;AACA,YAAA,MAAA,CAAA,aAAA,GAAA,KAAA,CADA,CAEA;;AACA,YAAA,MAAA,CAAA,OAAA;;AACA,YAAA,MAAA,CAAA,QAAA,CAAA,OAAA,CAAA,IAAA,CAAA,GAAA;AACA,WALA,MAKA;AACA,YAAA,MAAA,CAAA,QAAA,CAAA,OAAA,CAAA,IAAA,CAAA,GAAA;AACA;AACA,SAjBA,EAiBA,OAjBA,CAiBA,YAAA;AACA,UAAA,MAAA,CAAA,OAAA,GAAA,KAAA;AACA,SAnBA;AAqBA,OA9BA;AA+BA,KAhCA,EAgCA,IAhCA,EAgCA;AACA,iBAAA,IADA;AAEA,kBAAA;AAFA,KAhCA;AA5DA;AAnHA,CAAA","sourcesContent":["<template>\n\t<el-dialog :title=\"type==='post'?'新增':'修改'\" :visible.sync=\"dialogVisible\" width=\"500px\" class=\"add-update-building\"\n\t :close-on-click-modal=\"false\">\n\t\t<div>\n\t\t\t<el-form ref=\"dataForm\" :rules=\"rules\" :model=\"dataForm\" label-width=\"80px\">\n\t\t\t\t<el-form-item label=\"上级\">\n\t\t\t\t\t<building-tree v-model=\"dataForm.dfParentid\" placeholder=\"选择上级\" :build-type.sync=\"dataForm.dfType\" :purpose.sync=\"dataForm.dfPurpose\" :parent-name.sync=\"dataForm.dfParentName\"></building-tree>\n\n\t\t\t\t</el-form-item>\n\t\t\t\t<el-form-item label=\"类型\" prop=\"dfType\">\n\t\t\t\t\t<el-select v-model=\"dataForm.dfType\" :disabled=\"dataForm.dfParentid!='0'\" placeholder=\"请选择\" @change=\"typeHandle\">\n\t\t\t\t\t\t<el-option v-for=\"item in dfTypeList\" :key=\"item.dictLabel\" :label=\"item.dictLabel\" :value=\"item.dictValue\"></el-option>\n\t\t\t\t\t</el-select>\n\t\t\t\t</el-form-item>\n\t\t\t\t<el-form-item label=\"位置\" prop=\"uwbFloors\" v-if=\"dataForm.dfType=='1'\">\n\t\t\t\t\t<el-cascader v-model=\"dataForm.uwbFloors\" clearable placeholder=\"请选择\" :options=\"uwbFloorList\" style=\"width: 100%;\"></el-cascader>\n\t\t\t\t</el-form-item>\n\t\t\t\t<el-form-item v-if=\"dataForm.dfType=='2'\" label=\"房间人数\" prop=\"drCapacity\">\n\t\t\t\t\t<el-input-number v-model=\"dataForm.drCapacity\" :min=\"0\" :controls=\"false\" placeholder=\"请输入\"></el-input-number>\n\t\t\t\t</el-form-item>\n\t\t\t\t<el-form-item label=\"用途\" prop=\"dfPurpose\">\n\t\t\t\t\t<el-select v-model=\"dataForm.dfPurpose\" :disabled=\"type==='put'||dataForm.dfParentid!='0'\" placeholder=\"请选择\">\n\t\t\t\t\t\t<el-option v-for=\"item in dfPurposeList\" :key=\"item.dictLabel\" :label=\"item.dictLabel\" :value=\"item.dictValue\"></el-option>\n\t\t\t\t\t</el-select>\n\t\t\t\t</el-form-item>\n\t\t\t\t<el-form-item label=\"名称\" prop=\"dfFloorname\">\n\t\t\t\t\t<el-input v-model=\"dataForm.dfFloorname\"></el-input>\n\t\t\t\t</el-form-item>\n\t\t\t\t<el-form-item label=\"排序\" prop=\"dfOrder\">\n\t\t\t\t\t<el-input-number v-model=\"dataForm.dfOrder\" :min=\"0\" :controls=\"false\" placeholder=\"请输入\"></el-input-number>\n\t\t\t\t</el-form-item>\n\t\t\t</el-form>\n\t\t</div>\n\t\t<div slot=\"footer\">\n\t\t\t<el-button @click=\"dialogVisible = false\">取 消</el-button>\n\t\t\t<el-button type=\"primary\" v-loading=\"loading\" @click=\"submitForm\">确 定</el-button>\n\t\t</div>\n\t</el-dialog>\n</template>\n<script>\n\timport {\n\t\tgetDictDataList\n\t} from '@/utils'\n\timport debounce from 'lodash/debounce'\n\timport buildingTree from '@/views/modules/building/building-tree'\n\timport ajax from '@/utils/login'\n\texport default {\n\t\tcomponents: {\n\t\t\tbuildingTree\n\t\t},\n \t\tinject: ['refresh'],\n\t\tdata() {\n\t\t\tconst validateType = (rule, value, UWBallback) => {\n\t\t\t\tif (value != '0' && !this.dataForm.dfParentName) {\n\t\t\t\t\tUWBallback(new Error('请选择楼层或房间上级'))\n\t\t\t\t} else {\n\t\t\t\t\tUWBallback()\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tshowFloorCascader: false, // 是否显示楼层的cascader(当选择楼层\"1\"时展示)\n\t\t\t\tuwbFloorList: [], // 楼栋、楼层\n\t\t\t\tdialogVisible: false,\n\t\t\t\tloading: false,\n\t\t\t\ttype: 'post',\n\t\t\t\tdfTypeList: getDictDataList('buildingType'),\n\t\t\t\tdfPurposeList: getDictDataList('purpose'),\n\t\t\t\tdataForm: {\n\t\t\t\t\tdfParentid: '0',\n\t\t\t\t\tdfParentName: '',\n\t\t\t\t\tdfType: '',\n\t\t\t\t\tuwbFloors: [],\n\t\t\t\t\tdfFloorname: '',\n\t\t\t\t\tdfPurpose: '',\n\t\t\t\t\tdfOrder: 0,\n\t\t\t\t\tdrCapacity: 1\n\t\t\t\t},\n\t\t\t\trules: {\n\t\t\t\t\tdfType: [{\n\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\tmessage: '请选择',\n\t\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalidator: validateType,\n\t\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tuwbFloors: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请选择',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}],\n\t\t\t\t\tdfPurpose: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请选择',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}, ],\n\t\t\t\t\tdfFloorname: [{\n\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmax: 30,\n\t\t\t\t\t\t\tmessage: '最多 30 个字符',\n\t\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tdfOrder: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}, ],\n\t\t\t\t\tdrCapacity: [{\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tmessage: '请输入',\n\t\t\t\t\t\ttrigger: ['blur', 'change']\n\t\t\t\t\t}, ]\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tcreated() {\n\t\t\t\t// 获取UWB楼栋和楼层的cascader\n\t\t\t\tajax({\n\t\t\t\t\turl:\"/map/map\",\n\t\t\t\t\t// url:\"/system/scdormitoryfloor/uwbbuildingtree\",\n\t\t\t\t\tmethod:\"get\"\n\t\t\t\t}).then(({\n\t\t\t\t\tdata: res\n\t\t\t\t}) => {\n\t\t\t\t\t// status 200\n\t\t\t\t\tif (res.status !==200) {\n\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t}\n\t\t\t\t\t// this.uwbFloorList = res.data.map(item => {\n\t\t\t\t\t// \titem.children = item.children.map(item1 => {\n\t\t\t\t\t// \t\treturn {\n\t\t\t\t\t// \t\t\tlabel: item1.label,\n\t\t\t\t\t// \t\t\tvalue: item1.value\n\t\t\t\t\t// \t\t}\n\t\t\t\t\t// \t})\n\t\t\t\t\t// \treturn item\n\t\t\t\t\t// })\n\t\t\t\t\tthis.uwbFloorList=res.result.filter(item=>{\n\t\t\t\t\t\treturn item.mapType==1\n\t\t\t\t\t}).map(item=>{\n\t\t\t\t\t\titem.children=JSON.parse(item.floorList).map(label=>{\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tlabel: label,\n\t\t\t\t\t\t\t\tvalue: label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\titem.label=item.buildingName;\n\t\t\t\t\t\titem.value=String(item.id);\n\t\t\t\t\t\treturn item\n\t\t\t\t\t})\n\t\t\t\t}).catch((err) => {\n\t\t\t\t\tconsole.log('building error',err)\n\t\t\t\t})\n\t\t},\n\t\tmethods: {\n\t\t\tinit(id, type) {\n\t\t\t\tthis.dialogVisible = true;\n\t\t\t\t\t// 编辑\n\t\t\t\t\tif (id) {\n\t\t\t\t\t\tthis.type = 'put';\n\t\t\t\t\t\tthis.$http({\n\t\t\t\t\t\t\turl: `/system/scdormitoryfloor/${id}/${type}`,\n\t\t\t\t\t\t\tmethod: \"get\"\n\t\t\t\t\t\t}).then(({\n\t\t\t\t\t\t\tdata\n\t\t\t\t\t\t}) => {\n\t\t\t\t\t\t\tif (data.code == 0) {\n\t\t\t\t\t\t\t\t// 1 是楼层\n\t\t\t\t\t\t\t\tif (data.data.dfType == 1) {\n\t\t\t\t\t\t\t\t\tthis.showFloorCascader = true\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\tthis.showFloorCascader = false\n\t\t\t\t\t\t\t\t\tdata.data.uwbFloors = []\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis.dataForm = {\n\t\t\t\t\t\t\t\t\t...data.data,\n\t\t\t\t\t\t\t\t\tdfPurpose: String(data.data.dfPurpose),\n\t\t\t\t\t\t\t\t\tdfType: String(data.data.dfType),\n\t\t\t\t\t\t\t\t\tdfParentName: data.data.parentName\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.$message.warning(data.msg)\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\t// 新增\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis.type = 'post';\n\t\t\t\t\t\tthis.dataForm = {\n\t\t\t\t\t\t\tdfParentid: '0',\n\t\t\t\t\t\t\tdfParentName: '',\n\t\t\t\t\t\t\tdfType: '',\n\t\t\t\t\t\t\tuwbFloors: [],\n\t\t\t\t\t\t\tdfFloorname: '',\n\t\t\t\t\t\t\tdfPurpose: '',\n\t\t\t\t\t\t\tdfOrder: 0,\n\t\t\t\t\t\t\tdrCapacity: 1\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.showFloorCascader = false\n\t\t\t\t\t\tthis.dataForm.uwbFloors = []\n\t\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\t\tthis.$refs['dataForm'].resetFields();\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t},\n\t\t\ttypeHandle(e) {\n\t\t\t\tif (e == 1) {\n\t\t\t\t\tthis.showFloorCascader = true\n\t\t\t\t} else {\n\t\t\t\t\tthis.showFloorCascader = false\n\t\t\t\t\tthis.dataForm.uwbFloors = []\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmitForm: debounce(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\t// 当uwbFloors没数据时,后端返回的时\"\",但是提交数据时后端接收的是[]\n\t\t\t\t\tif(this.dataForm.uwbFloors === \"\"){\n\t\t\t\t\t\tthis.dataForm.uwbFloors = []\n\t\t\t\t\t}\n\t\t\t\t\tthis.loading = true;\n\t\t\t\t\tthis.$http({\n\t\t\t\t\t\turl: \"/system/scdormitoryfloor\",\n\t\t\t\t\t\tmethod: this.type,\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t...this.dataForm\n\t\t\t\t\t\t}\n\t\t\t\t\t}).then(({\n\t\t\t\t\t\tdata\n\t\t\t\t\t}) => {\n\t\t\t\t\t\tif (data.code == 0) {\n\t\t\t\t\t\t\tthis.dialogVisible = false;\n\t\t\t\t\t\t\t// this.$parent.$parent.initTree();\n\t\t\t\t\t\t\tthis.refresh();\n\t\t\t\t\t\t\tthis.$message.success(data.msg)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.$message.warning(data.msg)\n\t\t\t\t\t\t}\n\t\t\t\t\t}).finally(() => {\n\t\t\t\t\t\tthis.loading = false;\n\t\t\t\t\t})\n\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}\n</script>\n<style lang=\"scss\" scoped>\n\t.add-update-building {\n\t\t.el-form {\n\t\t\t.el-form-item {\n\t\t\t\t.el-select {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t}\n\n\t\t\t\t.el-input-number {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n</style>\n"],"sourceRoot":"src/views/modules/building"}]}