|
@@ -143,13 +143,6 @@
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<div>
|
|
|
- <el-form-item label="归属设施" prop="refFacs">
|
|
|
- <el-select v-model="form.refFacs" placeholder="请选择归属设施" @change="handleFacilityChange">
|
|
|
- <el-option v-for="item in facsOptions" :key="item.facsCode" :label="item.facsName"
|
|
|
- :value="item.facsCode"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="归属区域" prop="areaCode">
|
|
|
<el-select v-model="form.areaCode" placeholder="请选择归属区域" @change="handleAreaChange">
|
|
|
<el-option v-for="item in areaOptions" :key="item.id" :label="item.label" :value="item.id"
|
|
@@ -162,6 +155,13 @@
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="归属设施" prop="refFacs">
|
|
|
+ <el-select v-model="form.refFacs" placeholder="请选择归属设施" >
|
|
|
+ <el-option v-for="item in facsOptions" :key="item.facsCode" :label="item.facsName"
|
|
|
+ :value="item.facsCode"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="安装位置" prop="location">
|
|
|
<el-input v-model="form.location" placeholder="请输入安装位置"></el-input>
|
|
|
</el-form-item>
|
|
@@ -593,7 +593,7 @@
|
|
|
<script>
|
|
|
import { listDevRecursionByArea, getDevice, delDevice, addDevice, updateDevice } from '@/api/device/device'
|
|
|
import { areaTreeSelect, getAreaTreeSelect } from '@/api/basecfg/area'
|
|
|
-import { getFacsCategorygetByCode, listAllFacs } from '@/api/basecfg/emsfacs'
|
|
|
+import { getFacsCategorygetByCode, listAllFacs,listFacs } from '@/api/basecfg/emsfacs'
|
|
|
import { listSubsystemAll } from '@/api/adapter/subsystem'
|
|
|
import { getModelByCode, listAllModel } from '@/api/basecfg/objModel'
|
|
|
import { getObjAttr } from '@/api/basecfg/objAttribute'
|
|
@@ -754,6 +754,12 @@ export default {
|
|
|
refFacs: [
|
|
|
{ required: true, message: '归属设施', trigger: 'blur' }
|
|
|
],
|
|
|
+ areaCode:[
|
|
|
+ { required: true, message: '归属区域', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ locationRef:[
|
|
|
+ { required: true, message: '归属子区', trigger: 'blur' }
|
|
|
+ ],
|
|
|
refArea: [
|
|
|
{ required: true, message: '安装位置', trigger: 'blur' }
|
|
|
],
|
|
@@ -818,24 +824,11 @@ export default {
|
|
|
const area = this.areaOptions.find(a => a.id === areaCode);
|
|
|
return area ? area.label : '未知区域';
|
|
|
},
|
|
|
- /** 归属设施*/
|
|
|
- handleFacilityChange(selectedFacilityCode) {
|
|
|
- const selectedFacility = this.facsOptions.find(f => f.facsCode === selectedFacilityCode)
|
|
|
- if (selectedFacility) {
|
|
|
- this.form.areaName = selectedFacility.refAreaName
|
|
|
- this.form.areaCode = selectedFacility.refArea
|
|
|
- this.loadSubAreaOptions(selectedFacility.refArea)
|
|
|
- }
|
|
|
- },
|
|
|
- /** 归属设施*/
|
|
|
- handleAreaChange(value) {
|
|
|
- this.form.locationRef = null
|
|
|
- this.loadSubAreaOptions(value)
|
|
|
- },
|
|
|
/**下拉归属区域*/
|
|
|
loadAreaOptions() {
|
|
|
getAreaTreeSelect('0', 1).then(response => {
|
|
|
this.areaOptions = response.data || []
|
|
|
+ console.log("归属区域",this.areaOptions)
|
|
|
})
|
|
|
},
|
|
|
/**下拉归属子区*/
|
|
@@ -844,14 +837,30 @@ export default {
|
|
|
this.subAreaOptions = response.data || []
|
|
|
})
|
|
|
},
|
|
|
- getFacsOptions() {
|
|
|
+
|
|
|
+ /** 归属区域变更时查询归属子区和归属设施 */
|
|
|
+ handleAreaChange(value) {
|
|
|
+ //清空
|
|
|
+ this.form.locationRef = null;
|
|
|
+ this.form.refFacs = null;
|
|
|
+ this.subAreaOptions = [];
|
|
|
+ this.facsOptions = [];
|
|
|
+ // 归属子区
|
|
|
+ this.loadSubAreaOptions(value);
|
|
|
+ // 归属设施
|
|
|
+ this.getFacsOptions(value);
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 查询归属设施 */
|
|
|
+ getFacsOptions(refArea) {
|
|
|
const getFacsParams = {
|
|
|
- facsCategory: this.queryParams.deviceCategory,
|
|
|
- subCategory: this.queryParams.deviceSubCategory
|
|
|
- }
|
|
|
- listAllFacs(getFacsParams).then(response => {
|
|
|
- this.facsOptions = response.data
|
|
|
- })
|
|
|
+ refArea: refArea,
|
|
|
+ facsCategory: this.queryParams.deviceCategory // 当前标签页的分类
|
|
|
+ };
|
|
|
+ listFacs(getFacsParams).then(response => {
|
|
|
+ this.facsOptions = response.rows || [];
|
|
|
+ console.log("归属设施",this.facsOptions);
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
formatDate(date) {
|