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

master
许宏杰 6 months ago
parent a2a1a4ccd8
commit cbbc44f968

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

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

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

Loading…
Cancel
Save