搜索中心筛选全部加上

master
许宏杰 9 months ago
parent f8bd27349a
commit 090ac9c87f

@ -1,52 +1,59 @@
import request from '@/utils/request' import request from "@/utils/request";
// 查询部门列表 // 查询部门列表
export function listDept(query) { export function listDept(query) {
return request({ return request({
url: '/system/dept/list', url: "/system/dept/list",
method: 'get', method: "get",
params: query params: query,
}) });
} }
// 查询部门列表(排除节点) // 查询部门列表(排除节点)
export function listDeptExcludeChild(deptId) { export function listDeptExcludeChild(deptId) {
return request({ return request({
url: '/system/dept/list/exclude/' + deptId, url: "/system/dept/list/exclude/" + deptId,
method: 'get' method: "get",
}) });
} }
// 查询部门详细 // 查询部门详细
export function getDept(deptId) { export function getDept(deptId) {
return request({ return request({
url: '/system/dept/' + deptId, url: "/system/dept/" + deptId,
method: 'get' method: "get",
}) });
}
// 查询部门下拉树结构
export function treeselect() {
return request({
url: "/system/dept/treeselect",
method: "get",
});
} }
// 新增部门 // 新增部门
export function addDept(data) { export function addDept(data) {
return request({ return request({
url: '/system/dept', url: "/system/dept",
method: 'post', method: "post",
data: data data: data,
}) });
} }
// 修改部门 // 修改部门
export function updateDept(data) { export function updateDept(data) {
return request({ return request({
url: '/system/dept', url: "/system/dept",
method: 'put', method: "put",
data: data data: data,
}) });
} }
// 删除部门 // 删除部门
export function delDept(deptId) { export function delDept(deptId) {
return request({ return request({
url: '/system/dept/' + deptId, url: "/system/dept/" + deptId,
method: 'delete' method: "delete",
}) });
} }

@ -1,83 +1,108 @@
<template> <template>
<div class="search-container"> <div class="search-container">
<div class="option-rows"> <div class="option-rows">
<el-select v-model="value" placeholder="选择社区"> <el-select
@change="changeSelect($event, 'xiaoquList')"
v-model="queryParams.shequId"
placeholder="选择社区"
>
<el-option <el-option
v-for="item in community" v-for="item in deptList"
:key="item.value" :key="item.id"
:label="item.label" :label="item.label"
:value="item.value" :value="item.id"
> >
</el-option> </el-option>
</el-select> </el-select>
<el-select v-model="value" placeholder="选择小区"> <el-select
v-model="queryParams.xiaoquId"
placeholder="选择小区"
@change="changeSelect($event, 'netList')"
>
<el-option <el-option
v-for="item in xiaoqu" v-for="item in xiaoquList"
:key="item.value" :key="item.id"
:label="item.label" :label="item.label"
:value="item.value" :value="item.id"
> >
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
<div class="option-rows"> <div class="option-rows">
<el-select v-model="value" placeholder="选择网格"> <el-select
v-model="queryParams.parentid"
placeholder="选择网格"
@change="changeSelect($event, 'yuanList')"
>
<el-option <el-option
v-for="item in community" v-for="item in netList"
:key="item.value" :key="item.id"
:label="item.label" :label="item.label"
:value="item.value" :value="item.id"
> >
</el-option> </el-option>
</el-select> </el-select>
<el-select v-model="value" placeholder="选择苑"> <el-select
v-model="queryParams.yuanid"
placeholder="选择苑"
@change="changeSelect($event, 'buildingList')"
>
<el-option <el-option
v-for="item in xiaoqu" v-for="item in yuanList"
:key="item.value" :key="item.id"
:label="item.label" :label="item.label"
:value="item.value" :value="item.id"
> >
</el-option> </el-option>
</el-select> </el-select>
<el-select v-model="value" placeholder="选择楼栋"> <el-select
v-model="queryParams.buildingId"
placeholder="选择楼栋"
@change="changeSelect($event, 'houseList')"
>
<el-option <el-option
v-for="item in xiaoqu" v-for="item in buildingList"
:key="item.value" :key="item.id"
:label="item.label" :label="item.label"
:value="item.value" :value="item.id"
> >
</el-option> </el-option>
</el-select> </el-select>
<el-select v-model="value" placeholder="选择住户"> <el-select v-model="queryParams.houseid" placeholder="选择住户">
<el-option <el-option
v-for="item in xiaoqu" v-for="item in houseList"
:key="item.value" :key="item.id"
:label="item.label" :label="item.label"
:value="item.value" :value="item.id"
> >
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
<div class="option-rows"> <div class="option-rows">
<el-select v-model="value" placeholder="选择分色"> <el-select
v-model="colorList"
placeholder="选择分色"
multiple
collapse-tags
clearable
>
<el-option <el-option
v-for="item in xiaoqu" v-for="dict in dict.type.b_color_type"
:key="item.value" :key="dict.value"
:label="item.label" :label="dict.label"
:value="item.value" :value="dict.value"
> >
</el-option> </el-option>
</el-select> </el-select>
<el-radio-group v-model="radio">
<el-radio :label="1">户籍</el-radio>
<el-radio :label="2">流动</el-radio>
</el-radio-group>
<el-checkbox-group v-model="checkList"> <el-radio v-model="queryParams.type" :label="1"></el-radio>
<el-checkbox label="党员"></el-checkbox> <el-radio v-model="queryParams.type" :label="2"></el-radio>
<el-checkbox label="困难户"></el-checkbox>
<el-checkbox label="信访户"></el-checkbox> <el-checkbox-group v-model="isCheck">
<el-checkbox label="退役军人"></el-checkbox> <el-checkbox label="中共党员"> </el-checkbox>
<el-checkbox label="帮扶对象"> </el-checkbox>
<el-checkbox label="重点人群"> </el-checkbox>
<el-checkbox label="退役军人"> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
<div class="three-option"> <div class="three-option">
@ -95,7 +120,6 @@
<div class="option-input"> <div class="option-input">
<el-select <el-select
v-model="credentialnoType" v-model="credentialnoType"
placeholder="选择分色"
v-show="currentIndex == 0" v-show="currentIndex == 0"
class="input-general-width" class="input-general-width"
> >
@ -169,9 +193,12 @@
<script> <script>
import { getNetWorkId, inputSearch } from "@/api/home/index.js"; import { getNetWorkId, inputSearch } from "@/api/home/index.js";
import { handleTreeId } from "@/utils/findTreeId.js";
import { treeselect } from "@/api/system/dept"; //
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import ColorCell from "@/components/ColorCell"; import ColorCell from "@/components/ColorCell";
export default { export default {
dicts: ["b_color_type"],
components: { ColorCell }, components: { ColorCell },
computed: { computed: {
...mapGetters(["leftColor", "rightTopColor"]), ...mapGetters(["leftColor", "rightTopColor"]),
@ -192,34 +219,84 @@ export default {
{ name: "市级(前4位)", value: 2 }, { name: "市级(前4位)", value: 2 },
{ name: "县级(前6位)", value: 3 }, { name: "县级(前6位)", value: 3 },
], ],
checkList: [], isCheck: [],
isList: [
{ name: "中共党员", key: "isd" },
{ name: "帮扶对象", key: "isk" },
{ name: "退役军人", key: "isj" },
{ name: "重点人群", key: "isx" },
],
radio: "", radio: "",
value: "", value: "",
keyWord: "", keyWord: "",
colorList: [],
queryParams: { queryParams: {
shequId: undefined,
xiaoquId: undefined,
parentid: undefined,
yuanid: undefined,
buildingId: undefined,
houseid: undefined,
isd: undefined, //
isk: undefined, //
isj: undefined, //退
isx: undefined, //
credentialno: undefined, //() credentialno: undefined, //()
cre1: undefined, //(2) cre1: undefined, //(2)
cre2: undefined, //(4) cre2: undefined, //(4)
cre3: undefined, //(6) cre3: undefined, //(6)
phone: undefined, phone: undefined,
name: undefined, name: undefined,
color: undefined,
type: undefined,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}, },
community: [], deptList: [],
xiaoqu: [], xiaoquList: [],
netList: [],
yuanList: [],
buildingList: [],
houseList: [],
list: [], list: [],
houseTotal: 0, houseTotal: 0,
total: 0, total: 0,
}; };
}, },
mounted() {}, mounted() {
this.getDeptList();
},
methods: { methods: {
/**获取树部门 */
async getDeptList() {
let result = await treeselect();
this.deptList = result.data[0].children;
console.log(result);
},
/**
* 级联筛选
*/
changeSelect(e, key) {
this[key] = handleTreeId(e, this.deptList);
// console.log(e, key, this[key]);
},
/** /**
* 搜索 * 搜索
*/ */
handleSearch() { handleSearch() {
this.reset(); this.reset();
//
this.queryParams.color = this.colorList.toString();
console.log(this.queryParams.color);
//is
this.isCheck.forEach((item) => {
let index = this.isList.findIndex((it) => it.name == item);
if (index > -1) {
this.queryParams[this.isList[index].key] = 1;
}
});
//tab
if (this.currentIndex == 0) { if (this.currentIndex == 0) {
if (this.credentialnoType == 0) { if (this.credentialnoType == 0) {
this.queryParams.credentialno = this.keyWord; this.queryParams.credentialno = this.keyWord;
@ -239,6 +316,16 @@ export default {
handleReset() { handleReset() {
this.keyWord = ""; this.keyWord = "";
this.credentialnoType = 0; this.credentialnoType = 0;
this.queryParams.type = undefined;
this.queryParams.shequId = undefined;
this.queryParams.xiaoquId = undefined;
this.queryParams.parentid = undefined;
this.queryParams.yuanid = undefined;
this.queryParams.buildingId = undefined;
this.queryParams.houseid = undefined;
this.colorList = [];
this.isCheck = [];
this.reset(); this.reset();
this.load(); this.load();
}, },
@ -293,14 +380,21 @@ export default {
* 重置 * 重置
*/ */
reset() { reset() {
this.queryParams.isd = undefined; //
this.queryParams.isk = undefined; //
this.queryParams.isj = undefined; //退
this.queryParams.isx = undefined; //
this.queryParams.credentialno = undefined; //() this.queryParams.credentialno = undefined; //()
this.queryParams.cre1 = undefined; //(2) this.queryParams.cre1 = undefined; //(2)
this.queryParams.cre2 = undefined; //(4) this.queryParams.cre2 = undefined; //(4)
this.queryParams.cre3 = undefined; //(6) this.queryParams.cre3 = undefined; //(6)
this.queryParams.phone = undefined; this.queryParams.phone = undefined;
this.queryParams.name = undefined; this.queryParams.name = undefined;
this.queryParams.color = undefined; //
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10; this.queryParams.pageSize = 10;
this.list = []; this.list = [];
this.houseTotal = 0; this.houseTotal = 0;
this.total = 0; this.total = 0;
@ -320,7 +414,7 @@ export default {
padding: 15px 0; padding: 15px 0;
.el-select { .el-select {
margin-right: 10px; margin-right: 10px;
width: 140px; width: 150px;
} }
.el-radio-group { .el-radio-group {
margin: 0 30px 0 10px; margin: 0 30px 0 10px;

@ -0,0 +1,52 @@
// 定义递归函数来查找指定 id 的节点及其子节点
function findNodeById(tree, id) {
// 遍历树的每一个节点
for (let node of tree) {
// 如果当前节点的 id 匹配
if (node.id === id) {
return node; // 返回当前节点及其子节点
}
// 如果当前节点有子节点,则递归查找子节点
if (node.children) {
let result = findNodeById(node.children, id);
if (result) {
return result; // 如果找到了就直接返回结果
}
}
}
// 如果未找到匹配的节点则返回空null
return null;
}
// 定义一个函数来找到指定 id 节点及其所有子节点的完整信息
function findAllChildrenInfo(tree, id) {
let node = findNodeById(tree, id); // 首先找到指定 id 的节点
if (!node) {
return null; // 如果找不到,返回 null
}
// 定义一个递归函数来获取节点及其所有子节点的完整信息
function collectChildrenInfo(node) {
let result = { ...node }; // 复制当前节点的所有属性
if (result.children) {
// 如果当前节点有子节点,则递归处理每一个子节点
result.children = result.children.map((child) =>
collectChildrenInfo(child)
);
}
return result;
}
return collectChildrenInfo(node); // 返回节点及其所有子节点的完整信息
}
export function handleTreeId(id, tree) {
// 测试示例
const idToFind = id; // 要查找的 id
const foundIds = findAllChildrenInfo(tree, idToFind); // 找到所有与 idToFind 相关的节点 id
return foundIds.children;
}
Loading…
Cancel
Save