Browse Source

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

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

33
src/views/components/resiSearch.vue

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

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

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

Loading…
Cancel
Save