|
@@ -1,8 +1,9 @@
|
|
|
<template>
|
|
|
<div id="cascaderMap">
|
|
|
<span class="buildFloor" style="margin-right: 12px;">设备类别</span>
|
|
|
- <el-select v-model="value" placeholder="请选择" clearable :props="props" filterable :style="isWidth ? '' : 'width:160px;'" size="small" @change="changeVal">
|
|
|
- <el-option v-for="item in options" :key="item.code" :label="item.facility" :value="item.code"></el-option>
|
|
|
+ <el-select v-model="value" placeholder="请选择" clearable :props="props" filterable :style="isWidth ? '' : 'width:160px;'" size="small"
|
|
|
+ @change="changeVal">
|
|
|
+ <el-option v-for="item in options" :key="item.code" :label="item.facility" :value="item.code"></el-option>
|
|
|
</el-select>
|
|
|
<!-- <el-cascader placeholder="请选择" :options="options" v-model="value" :props="props" filterable :style="isWidth ? '' : 'width:160px;'" size="small"
|
|
|
@change="changeVal" change-on-select></el-cascader> -->
|
|
@@ -54,12 +55,18 @@ export default {
|
|
|
//修改val
|
|
|
changeVal(val) {
|
|
|
let value = {}
|
|
|
+ let flag = true;
|
|
|
this.options.map(item => {
|
|
|
if (item.code == val) {
|
|
|
+ flag = false;
|
|
|
value = item
|
|
|
}
|
|
|
})
|
|
|
this.value = val
|
|
|
+ if (flag) {
|
|
|
+ this.value = '';
|
|
|
+ }
|
|
|
+ console.log(value)
|
|
|
this.$emit("change", value)
|
|
|
},
|
|
|
//获取当前项目下的设备类型(只拿到编码-需要过滤)
|
|
@@ -93,20 +100,17 @@ export default {
|
|
|
resolve(res)
|
|
|
})
|
|
|
})
|
|
|
- Promise.all([promise1,promise2]).then((res) => {
|
|
|
+ Promise.all([promise1, promise2]).then((res) => {
|
|
|
let allData = res[0], data = res[1]
|
|
|
this.options = this.formatOptions(allData.Content)
|
|
|
- if (this.value) {
|
|
|
- this.changeVal(this.value)
|
|
|
- }
|
|
|
- if(!this.all) {
|
|
|
+ if (!this.all) {
|
|
|
this.content = data.Content.map(t => {
|
|
|
return t.Category
|
|
|
});
|
|
|
this.filterForOptions();
|
|
|
- if (this.value) {
|
|
|
- this.changeVal(this.value)
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (this.value) {
|
|
|
+ this.changeVal(this.value)
|
|
|
}
|
|
|
})
|
|
|
},
|