Browse Source

差个街道id列表菜单联动

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

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

@ -20,7 +20,7 @@
:filter-node-method="filterNode" :filter-node-method="filterNode"
@node-click="handleNodeClick" @node-click="handleNodeClick"
lazy lazy
auto-expand-parent :auto-expand-parent="true"
:default-expanded-keys="autoOpenArr" :default-expanded-keys="autoOpenArr"
:load="lazyLoadTree" :load="lazyLoadTree"
> >
@ -43,14 +43,18 @@
<span style="color: red">{{ data.showNum }}</span> <span style="color: red">{{ data.showNum }}</span>
<span>{{ ")" }}</span> <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> </span>
</el-tree> </el-tree>
</el-scrollbar> </el-scrollbar>
</div> </div>
<div class="div_left"> <div class="div_left">
<div class="m-search" style="flex-direction: column;"> <div class="m-search" style="flex-direction: column">
<section <section
:class="boxHeight ? 'm-form-box-height' : 'm-form-box-height-auto'" :class="boxHeight ? 'm-form-box-height' : 'm-form-box-height-auto'"
> >
@ -503,16 +507,16 @@ export default {
...mapGetters(["clientHeight", "iframeHeight"]), ...mapGetters(["clientHeight", "iframeHeight"]),
showIcons() { showIcons() {
return function (data) { return function (data) {
if(data.level=='building'){ if (data.level == "building") {
let arr = data.showNum.split('/') let arr = data.showNum.split("/");
console.log(arr); console.log(arr);
if (arr[0] !== arr[1]) { if (arr[0] !== arr[1]) {
return true return true;
} else { } else {
return false return false;
}
} }
} }
};
}, },
}, },
watch: { watch: {
@ -716,11 +720,11 @@ export default {
this.pageSize = 10; this.pageSize = 10;
this.pageNo = 1; this.pageNo = 1;
// this.handleNodeClick(this.selObj) // this.handleNodeClick(this.selTreeObj)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.ref_buildingTable.loadTable('search',this.selObj) this.$refs.ref_buildingTable.loadTable("search", this.selTreeObj);
}) });
}, },
async loadOpenNode() { async loadOpenNode() {
@ -738,10 +742,11 @@ export default {
async loadTree(isRefresh) { async loadTree(isRefresh) {
const url = "/actual/base/communityBuilding/tree/initTree"; const url = "/actual/base/communityBuilding/tree/initTree";
const { data, code, msg } = await requestGet(url); const { data, code, msg } = await requestGet(url);
this.handleNodeClick(data);
if (code === 0) { if (code === 0) {
this.treeData = []; this.treeData = [];
this.treeData.push(data); this.treeData.push(data);
//
this.autoOpenArr.push(data.id)
if (!isRefresh && data) { if (!isRefresh && data) {
this.selTreeObj = data; this.selTreeObj = data;
if (!this.selTreeObj.latitude) { if (!this.selTreeObj.latitude) {
@ -810,9 +815,7 @@ export default {
this.bDisabled = false; this.bDisabled = false;
if (obj.level === "building") { if (obj.level === "building") {
// //
setTimeout(() => {
this.$refs["ref_buildingTable"].loadTable("tree", this.selTreeObj); this.$refs["ref_buildingTable"].loadTable("tree", this.selTreeObj);
}, 100);
this.selAgencyId = ""; this.selAgencyId = "";
this.selGridId = ""; this.selGridId = "";
await this.getValiheList(); await this.getValiheList();
@ -858,25 +861,47 @@ export default {
// //
async toNextLevel(row, level) { async toNextLevel(row, level) {
console.log(row, "row"); console.log(row);
console.log(level, "level");
this.autoOpenArr = []; this.autoOpenArr = [];
// console.log(this.$refs.ref_tree); console.log(this.$refs.ref_tree);
const { agencyId, gridId, neighborHoodId, propertyId } = row; const {
let arr = [agencyId, gridId, neighborHoodId, propertyId]; agencyId,
gridId,
neighborHoodId,
gridName,
agencyName,
buildingId,
pid
} = row;
let arr = [agencyId, gridId, neighborHoodId,pid];
console.log(arr,'展开的数组');
this.autoOpenArr = 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.handleNodeClick(this.selTreeObj);
this.$nextTick(() => { this.$nextTick(() => {
// ref_tree ref value node-key // ref_tree ref value node-key
@ -900,35 +925,39 @@ export default {
// idtypeidid // idtypeidid
// idtypeid // idtypeid
if (obj.level === "building") { if (obj.level === "building") {
console.log(obj);
this.selTreeObj = obj;
// //
let neighborHoodNode = this.$refs.ref_tree.getNode(obj.pid); // // let neighborHoodNode = this.$refs.ref_tree.getNode(obj.pid); //
let gridNode = this.$refs.ref_tree.getNode(neighborHoodNode.data.pid); // // let gridNode = this.$refs.ref_tree.getNode(neighborHoodNode.data.pid); //
let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid); // // let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid); //
obj.agencyId = agencyNode.data.id; // obj.agencyId = agencyNode.data.id;
obj.agencyName = agencyNode.data.label; // obj.agencyName = agencyNode.data.label;
obj.gridId = gridNode.data.id; // obj.gridId = gridNode.data.id;
obj.gridName = gridNode.data.label; // obj.gridName = gridNode.data.label;
obj.neighborHoodId = neighborHoodNode.data.id; // obj.neighborHoodId = neighborHoodNode.data.id;
obj.neighborHoodName = neighborHoodNode.data.label; // obj.neighborHoodName = neighborHoodNode.data.label;
if (obj.agencyId === this.staffAgencyId) { // if (obj.agencyId === this.staffAgencyId) {
this.showImportBtn = true; // this.showImportBtn = true;
} else { // } else {
this.showImportBtn = false; // this.showImportBtn = false;
} // }
} else if (obj.level === "neighborHood") { } else if (obj.level === "neighborHood") {
// //
let gridNode = this.$refs.ref_tree.getNode(obj.pid); // let gridNode = this.$refs.ref_tree.getNode(obj.pid);
let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid); // let agencyNode = this.$refs.ref_tree.getNode(obj.agencyId);
obj.gridId = gridNode.data.id; // obj.gridId = gridNode.data.id;
obj.gridName = gridNode.data.label; // obj.gridName = gridNode.data.label;
obj.agencyId = agencyNode.data.id; // obj.agencyId = agencyNode.data.id;
obj.agencyName = agencyNode.data.label; // obj.agencyName = agencyNode.data.label;
if (obj.agencyId === this.staffAgencyId) {
this.showImportBtn = true; // if (obj.agencyId === this.staffAgencyId) {
} else { // this.showImportBtn = true;
this.showImportBtn = false; // } else {
} // this.showImportBtn = false;
// }
this.selTreeObj = obj;
} else { } else {
} }

Loading…
Cancel
Save