Browse Source

差个街道id列表菜单联动

V1.0
mk 3 years ago
parent
commit
2173facb53
  1. 167
      src/views/modules/base/community/community.vue

167
src/views/modules/base/community/community.vue

@ -20,7 +20,7 @@
:filter-node-method="filterNode"
@node-click="handleNodeClick"
lazy
auto-expand-parent
:auto-expand-parent="true"
:default-expanded-keys="autoOpenArr"
:load="lazyLoadTree"
>
@ -43,14 +43,18 @@
<span style="color: red">{{ data.showNum }}</span>
<span>{{ ")" }}</span>
</span> -->
<span :id="data.id" :style="{'color':showIcons(data)?'#ff4d4f':''}">{{ data.showName }}</span>
<span
:id="data.id"
:style="{ color: showIcons(data) ? '#ff4d4f' : '' }"
>{{ data.showName }}</span
>
</span>
</el-tree>
</el-scrollbar>
</div>
<div class="div_left">
<div class="m-search" style="flex-direction: column;">
<div class="m-search" style="flex-direction: column">
<section
:class="boxHeight ? 'm-form-box-height' : 'm-form-box-height-auto'"
>
@ -243,7 +247,7 @@
<el-button
style="margin-left: 10px"
size="small"
type="primary"
type="primary"
@click="handleSearch"
>查询</el-button
>
@ -254,7 +258,7 @@
>重置</el-button
>
<el-button
style="margin:0 6px 0 10px"
style="margin: 0 6px 0 10px"
size="small"
class="div-table-button--blue"
type="text"
@ -501,19 +505,19 @@ export default {
: this.clientHeight - 245 + "px";
},
...mapGetters(["clientHeight", "iframeHeight"]),
showIcons(){
return function(data){
if(data.level=='building'){
let arr = data.showNum.split('/')
console.log(arr);
if(arr[0] !== arr[1]){
return true
}else{
return false
}
}
}
},
showIcons() {
return function (data) {
if (data.level == "building") {
let arr = data.showNum.split("/");
console.log(arr);
if (arr[0] !== arr[1]) {
return true;
} else {
return false;
}
}
};
},
},
watch: {
// filterText (val) {
@ -716,12 +720,12 @@ export default {
this.pageSize = 10;
this.pageNo = 1;
// this.handleNodeClick(this.selObj)
this.$nextTick(()=>{
this.$refs.ref_buildingTable.loadTable('search',this.selObj)
})
},
// this.handleNodeClick(this.selTreeObj)
this.$nextTick(() => {
this.$refs.ref_buildingTable.loadTable("search", this.selTreeObj);
});
},
async loadOpenNode() {
const url = "/gov/org/building/tree-ids";
@ -738,10 +742,11 @@ export default {
async loadTree(isRefresh) {
const url = "/actual/base/communityBuilding/tree/initTree";
const { data, code, msg } = await requestGet(url);
this.handleNodeClick(data);
if (code === 0) {
this.treeData = [];
this.treeData.push(data);
//
this.autoOpenArr.push(data.id)
if (!isRefresh && data) {
this.selTreeObj = data;
if (!this.selTreeObj.latitude) {
@ -810,9 +815,7 @@ export default {
this.bDisabled = false;
if (obj.level === "building") {
//
setTimeout(() => {
this.$refs["ref_buildingTable"].loadTable("tree", this.selTreeObj);
}, 100);
this.selAgencyId = "";
this.selGridId = "";
await this.getValiheList();
@ -858,25 +861,47 @@ export default {
//
async toNextLevel(row, level) {
console.log(row, "row");
console.log(level, "level");
console.log(row);
this.autoOpenArr = [];
// console.log(this.$refs.ref_tree);
const { agencyId, gridId, neighborHoodId, propertyId } = row;
let arr = [agencyId, gridId, neighborHoodId, propertyId];
console.log(this.$refs.ref_tree);
const {
agencyId,
gridId,
neighborHoodId,
gridName,
agencyName,
buildingId,
pid
} = row;
let arr = [agencyId, gridId, neighborHoodId,pid];
console.log(arr,'展开的数组');
this.autoOpenArr = arr;
console.log(this.autoOpenArr, "默认展开数组");
// if (level === 'community') {
// setTimeout(()=>{
// nextTick(1000)
// this.selTreeObj = this.$refs.ref_tree.getNode(row.neighborHoodId).data || {}
// },50)
// this.autoOpenArr.push(this.selTreeObj.id)
// } else {
// this.selTreeObj = this.$refs.ref_tree.getNode(row.buildingId).data
// }
console.log(this.selTreeObj, "123123123");
// this.$nextTick(()=>{
// console.log( this.$refs.ref_tree.getNode("d167076e825e75edda6540c5b9717c79"));
// })
// this.selTreeObj = this.$refs.ref_tree.getNode(row.neighborHoodId) || {};
if (level == "community") {
this.selTreeObj = {
id: neighborHoodId,
level: "neighborHood",
pid: gridId,
agencyId: agencyId,
agencyName: agencyName,
gridName: gridName,
};
} else if (level == "building") {
// this.selTreeObj = this.$refs.ref_tree.getNode(row.buildingId).data
this.selTreeObj = {
id:buildingId,
neighborHoodId: neighborHoodId,
level: "building",
pid: neighborHoodId,
agencyId: agencyId,
agencyName: agencyName,
gridName: gridName,
};
}
this.handleNodeClick(this.selTreeObj);
this.$nextTick(() => {
// ref_tree ref value node-key
@ -900,35 +925,39 @@ export default {
// idtypeidid
// idtypeid
if (obj.level === "building") {
console.log(obj);
this.selTreeObj = obj;
//
let neighborHoodNode = this.$refs.ref_tree.getNode(obj.pid); //
let gridNode = this.$refs.ref_tree.getNode(neighborHoodNode.data.pid); //
let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid); //
obj.agencyId = agencyNode.data.id;
obj.agencyName = agencyNode.data.label;
obj.gridId = gridNode.data.id;
obj.gridName = gridNode.data.label;
obj.neighborHoodId = neighborHoodNode.data.id;
obj.neighborHoodName = neighborHoodNode.data.label;
if (obj.agencyId === this.staffAgencyId) {
this.showImportBtn = true;
} else {
this.showImportBtn = false;
}
// let neighborHoodNode = this.$refs.ref_tree.getNode(obj.pid); //
// let gridNode = this.$refs.ref_tree.getNode(neighborHoodNode.data.pid); //
// let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid); //
// obj.agencyId = agencyNode.data.id;
// obj.agencyName = agencyNode.data.label;
// obj.gridId = gridNode.data.id;
// obj.gridName = gridNode.data.label;
// obj.neighborHoodId = neighborHoodNode.data.id;
// obj.neighborHoodName = neighborHoodNode.data.label;
// if (obj.agencyId === this.staffAgencyId) {
// this.showImportBtn = true;
// } else {
// this.showImportBtn = false;
// }
} else if (obj.level === "neighborHood") {
//
let gridNode = this.$refs.ref_tree.getNode(obj.pid);
let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid);
obj.gridId = gridNode.data.id;
obj.gridName = gridNode.data.label;
obj.agencyId = agencyNode.data.id;
obj.agencyName = agencyNode.data.label;
if (obj.agencyId === this.staffAgencyId) {
this.showImportBtn = true;
} else {
this.showImportBtn = false;
}
// let gridNode = this.$refs.ref_tree.getNode(obj.pid);
// let agencyNode = this.$refs.ref_tree.getNode(obj.agencyId);
// obj.gridId = gridNode.data.id;
// obj.gridName = gridNode.data.label;
// obj.agencyId = agencyNode.data.id;
// obj.agencyName = agencyNode.data.label;
// if (obj.agencyId === this.staffAgencyId) {
// this.showImportBtn = true;
// } else {
// this.showImportBtn = false;
// }
this.selTreeObj = obj;
} else {
}

Loading…
Cancel
Save