forked from zhurui/management
1 line
18 KiB
JSON
1 line
18 KiB
JSON
{"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\\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":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\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",{"version":3,"sources":["add-or-update.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA;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;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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","file":"add-or-update.vue","sourceRoot":"src/views/modules/building","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"]}]} |