Browse Source

居民列表左侧树筛选报错跟频繁调用接口问题

xiaowang-featrue
mk 9 months ago
parent
commit
f2a53e7a20
  1. 19
      src/views/components/resiSearch.vue
  2. 28
      src/views/modules/base/resi.vue

19
src/views/components/resiSearch.vue

@ -250,6 +250,8 @@
<script>
import inputRange from './rangeInput.vue'
import smartSearchRule from './smartSearchRule.vue'
import debounce from 'lodash/debounce'
export default {
name: 'ResiSearch',
components: {
@ -973,23 +975,23 @@ export default {
if (this.columnName) this.handleChangeForm(this.columnName)
},
mounted(){
this.$EventBus.$on('handleClickResiTree', async (val) => {
if(val.type === 'agency'){
this.$EventBus.$on('handleClickResiTree', debounce(async (val) => {
if (val.type === 'agency') {
this.form.agencyId = val.id;
this.cascaderAgencyId = val.id;
this.optionsV = [];
this.form.villageId = '';
this.form.buildId = '';
await this.getValiheList();
}else if(val.type === 'neighborHood'){
} else if (val.type === 'neighborHood') {
this.form.villageId = val.id;
await this.handleChangeV(val.id)
await this.handleChangeV(val.id);
this.form.buildId = '';
}else if(val.type === 'building'){
} else if (val.type === 'building') {
this.form.buildId = val.id;
await this.handleChangeB(val.id)
await this.handleChangeB(val.id);
}
})
}, 300)); // 300ms
},
methods: {
handleChange(val){
@ -1169,10 +1171,7 @@ export default {
},
// form
handleChangeForm(val) {
console.log(val,"skldjfklsjf");
for (let n in this.fixedForm) {
console.log("324234");
if (n === val) {
if (this.fixedList.length > 0) {
let _item = {}

28
src/views/modules/base/resi.vue

@ -330,12 +330,7 @@ export default {
selTreeObj: {},
treeLoading: false,
filterText: "",
searchAgencyObj: {
buildId: null,
villageId: null,
gridId: null,
// agencyId: null,
},
defaultProps: {
children: "children",
label: "showName",
@ -575,7 +570,6 @@ export default {
}
_obj.level = level || "";
_obj.orgType = level || "";
_obj = { ...this.searchAgencyObj , ..._obj};
if (type) {
this.currentPage = 1;
}
@ -818,7 +812,6 @@ export default {
}
_obj.level = level || "";
_obj.orgType = level || "";
_obj = { ..._obj, ...this.searchAgencyObj };
await this.$http({
method: "POST",
url,
@ -1069,7 +1062,7 @@ export default {
return this.$message.error(res.msg);
} else {
this.$message.success("信息确定成功");
this.handleSearchFrom();
this.handleSearchFrom();//
}
})
},
@ -1247,25 +1240,12 @@ export default {
if (buildingId) {
await this.$EventBus.$emit('handleClickResiTree', { type: 'building', id: buildingId });
}
}else{
this.$EventBus.$emit('handleClickResiTree',{type:'agency',id:obj.id})
}
await nextTick(500);
this.handleSearchFrom("type")
})
this.searchAgencyObj = {};
if (obj.level === "building") {
this.searchAgencyObj.buildId = obj.id;
this.handleSearchFrom("type");
} else if (obj.level === "neighborHood") {
this.searchAgencyObj.villageId = obj.id;
this.handleSearchFrom("type");
} else if (obj.level == "grid") {
this.searchAgencyObj.gridId = obj.id;
this.handleSearchFrom("type");
} else {
this.searchAgencyObj.agencyId = obj.id;
this.handleSearchFrom("type");
}
},
},
watch: {

Loading…
Cancel
Save