搜索中心联动下拉,社区小区隔离

master
许宏杰 6 months ago
parent a2a1a4ccd8
commit cbbc44f968

@ -27,12 +27,20 @@ export function getDept(deptId) {
// 查询部门下拉树结构 // 查询部门下拉树结构
export function treeselect() { export function treeselect() {
return request({ return request({
url: "/system/dept/tree", // url: "/system/dept/tree",
// url: "/system/dept/treeselect", url: "/system/dept/treeselect",
method: "get", method: "get",
}); });
} }
export function getsszxBh(query) {
return request({
url: "/taicangpop/tc/sszxBh",
method: "get",
params: query,
});
}
// 新增部门 // 新增部门
export function addDept(data) { export function addDept(data) {
return request({ return request({

@ -1,6 +1,6 @@
<template> <template>
<div class="search-container"> <div class="search-container">
<div class="option-rows" v-show="show_shequ_xiaoqu"> <div class="option-rows" v-if="show_shequ_xiaoqu">
<el-select <el-select
@change="changeSelect($event, 'xiaoquList')" @change="changeSelect($event, 'xiaoquList')"
v-model="queryParams.shequId" v-model="queryParams.shequId"
@ -32,7 +32,6 @@
</div> </div>
<div class="option-rows"> <div class="option-rows">
<el-select <el-select
v-show="show_net || show_shequ_xiaoqu"
v-model="queryParams.parentid" v-model="queryParams.parentid"
placeholder="选择网格" placeholder="选择网格"
@change="changeSelect($event, 'yuanList')" @change="changeSelect($event, 'yuanList')"
@ -68,18 +67,18 @@
> >
<el-option <el-option
v-for="item in buildingList" v-for="item in buildingList"
:key="item.id" :key="item.buildingId"
:label="item.label" :label="item.buildingName"
:value="item.id" :value="item.buildingId"
> >
</el-option> </el-option>
</el-select> </el-select>
<el-select v-model="queryParams.houseid" placeholder="选择住户" clearable> <el-select v-model="queryParams.houseid" placeholder="选择住户" clearable>
<el-option <el-option
v-for="item in houseList" v-for="item in houseList"
:key="item.id" :key="item.houseId"
:label="item.label" :label="item.houseName"
:value="item.id" :value="item.houseId"
> >
</el-option> </el-option>
</el-select> </el-select>
@ -212,7 +211,7 @@
<script> <script>
import { inputSearch2 } from "@/api/home/index.js"; import { inputSearch2 } from "@/api/home/index.js";
import { handleTreeId } from "@/utils/findTreeId.js"; import { handleTreeId } from "@/utils/findTreeId.js";
import { treeselect } from "@/api/system/dept"; // import { treeselect, getsszxBh } from "@/api/system/dept"; //
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import ColorCell from "@/components/ColorCell"; import ColorCell from "@/components/ColorCell";
import { exportSearch } from "@/api/home/index.js"; // import { exportSearch } from "@/api/home/index.js"; //
@ -221,7 +220,7 @@ export default {
dicts: ["b_color_type"], dicts: ["b_color_type"],
components: { ColorCell }, components: { ColorCell },
computed: { computed: {
...mapGetters(["leftColor", "rightTopColor", "queryParamsIndex"]), ...mapGetters(["leftColor", "rightTopColor", "queryParamsXiaoqu"]),
}, },
data() { data() {
return { return {
@ -293,12 +292,12 @@ export default {
}; };
}, },
mounted() { mounted() {
this.show_shequ_xiaoqu = this.$auth.hasRoleOr(["admin", "leader"]); // - // this.show_shequ_xiaoqu = this.$auth.hasRoleOr(["admin", "leader"]); // -
// this.show_net = this.$auth.authRoleNet("network"); // // this.show_net = this.$auth.authRoleNet("network"); //
// console.log(this.show_shequ_xiaoqu, this.show_net); // console.log(this.show_shequ_xiaoqu, this.show_net);
this.queryParams.shequId = this.queryParamsIndex.shequId; // this.queryParams.shequId = this.queryParamsIndex.shequId;
this.getDeptList(); this.getDeptList();
}, },
methods: { methods: {
@ -306,12 +305,20 @@ export default {
async getDeptList() { async getDeptList() {
let result = await treeselect(); let result = await treeselect();
this.deptList = result.data[0].children; this.deptList = result.data[0].children;
console.log(result);
this.$nextTick(() => {
if (this.$route.path == "/xiaoqu") {
this.queryParams.xiaoquId = this.queryParamsXiaoqu.xiaoquId;
this.changeSelect(this.queryParams.xiaoquId, "netList");
this.show_shequ_xiaoqu = false;
}
});
}, },
/** /**
* 级联筛选 * 级联筛选
*/ */
changeSelect(e, key) { async changeSelect(e, key) {
console.log(key);
let list = []; let list = [];
let index = this.objList.findIndex((item) => item.key == key); let index = this.objList.findIndex((item) => item.key == key);
if (index > -1) { if (index > -1) {
@ -321,8 +328,12 @@ export default {
this.queryParams[item.value] = undefined; this.queryParams[item.value] = undefined;
}); });
if (key == "houseList") { if (key == "buildingList" || key == "houseList") {
// this.getHouse(e) let res = await getsszxBh({
deptId: this.queryParams.yuanid,
buildingId: this.queryParams.buildingId,
});
this[key] = res.data;
} else { } else {
this[key] = handleTreeId(e, this.deptList); this[key] = handleTreeId(e, this.deptList);
} }

@ -13,7 +13,6 @@
<el-select <el-select
v-model="community" v-model="community"
placeholder="选择社区" placeholder="选择社区"
clearable
@change="handleChange" @change="handleChange"
:popper-append-to-body="false" :popper-append-to-body="false"
> >

Loading…
Cancel
Save