Commit b3fb305a authored by “yiyousong”'s avatar “yiyousong”

perf: 优化搜索

parent 62be24dd
......@@ -446,33 +446,35 @@ export default {
// 业务搜索
handleSearch(type, form) {
if (type == "business") {
let { businessName } = form;
if (businessName) {
this.businessSearch.page = 1;
this.businessSearch.businessList = [businessName];
} else {
this.businessSearch.businessList = [];
}
this.getBusinessEva();
} else if (type == "dept") {
let { deptName } = form;
if (deptName) {
this.deptSearch.page = 1;
this.deptSearch.sectionNameList = [deptName];
} else {
this.deptSearch.sectionNameList = [];
}
this.getDeptEva();
} else if (type == "window") {
let { windowNum } = form;
if (windowNum) {
this.windowSearch.page = 1;
this.windowSearch.windowFromnumList = [windowNum];
} else {
this.windowSearch.windowFromnumList = [];
}
this.getWindowEva();
const { businessName, deptName, windowNum } = form;
const setupSearch = (searchObj, listKey, value, searchMethod) => {
searchObj.page = 1;
searchObj[listKey] = value ? [value] : [];
searchMethod();
};
if (type === "business") {
setupSearch(
this.businessSearch,
"businessList",
businessName,
this.getBusinessEva
);
} else if (type === "dept") {
setupSearch(
this.deptSearch,
"sectionNameList",
deptName,
this.getDeptEva
);
} else if (type === "window") {
setupSearch(
this.windowSearch,
"windowFromnumList",
windowNum,
this.getWindowEva
);
}
},
},
......
......@@ -451,32 +451,21 @@ export default {
// 业务搜索
handleSearch(type, form) {
if (type == "business") {
let { businessName } = form;
if (businessName) {
this.businessSearch.page = 1;
this.businessSearch.businessList = [businessName];
} else {
this.businessSearch.businessList = [];
}
let { businessName, deptName, windowNum } = form;
const setupSearch = (searchObj, listKey, value) => {
searchObj.page = 1;
searchObj[listKey] = value ? [value] : [];
};
if (type === "business") {
setupSearch(this.businessSearch, "businessList", businessName);
this.getBusinessQueue();
} else if (type == "dept") {
let { deptName } = form;
if (deptName) {
this.deptSearch.page = 1;
this.deptSearch.sectionNameList = [deptName];
} else {
this.deptSearch.sectionNameList = [];
}
} else if (type === "dept") {
setupSearch(this.deptSearch, "sectionNameList", deptName);
this.getDeptQueue();
} else if (type == "window") {
let { windowNum } = form;
if (windowNum) {
this.windowSearch.page = 1;
this.windowSearch.windowFromnumList = [windowNum];
} else {
this.windowSearch.windowFromnumList = [];
}
} else if (type === "window") {
setupSearch(this.windowSearch, "windowFromnumList", windowNum);
this.getWindowQueue();
}
},
......
......@@ -183,44 +183,36 @@ export default {
this.selectionRows = rows;
},
handleSearch(form) {
let { type, pjOption, deptName, windowName, year, month, day } = form;
if (type == "year") {
let { type, pjOption, deptName, windowNum, year, month, day } = form;
this.searchForm.year = "";
this.searchForm.month = "";
this.searchForm.day = "";
if (type === "year") {
this.searchForm.groupList = ["year"];
this.searchForm.year = year;
} else if (type == "month") {
} else if (type === "month") {
this.searchForm.groupList = ["year", "month"];
if (month) {
let monthNum = month.split("-");
this.searchForm.year = monthNum[0];
this.searchForm.month = monthNum[1];
[this.searchForm.year, this.searchForm.month] = month.split("-");
}
} else {
this.searchForm.groupList = ["year", "month", "day"];
if (day) {
let dayNum = day.split("-");
this.searchForm.year = dayNum[0];
this.searchForm.month = dayNum[1];
this.searchForm.day = dayNum[2];
[this.searchForm.year, this.searchForm.month, this.searchForm.day] =
day.split("-");
}
}
if (pjOption) {
this.searchForm.pjOptionList = [pjOption];
} else {
this.searchForm.pjOptionList = [];
}
if (deptName) {
this.searchForm.sectionNameList = [deptName];
} else {
this.searchForm.sectionNameList = [];
}
if (windowName) {
this.searchForm.windowFromnumList = [windowName];
} else {
this.searchForm.windowFromnumList = [];
}
this.searchForm.pjOptionList = pjOption ? [pjOption] : [];
this.searchForm.sectionNameList = deptName ? [deptName] : [];
this.searchForm.windowFromnumList = windowNum ? [windowNum] : [];
this.current = 1;
this.getEvaStatList();
},
// 导出表格
exportExcel() {
this.exportLoading = true;
......
......@@ -187,41 +187,29 @@ export default {
this.selectionRows = rows;
},
handleSearch(form) {
let { type, businessName, deptName, windowName, year, month, day } = form;
let { type, businessName, deptName, windowNum, year, month, day } = form;
this.searchForm.year = "";
this.searchForm.month = "";
this.searchForm.day = "";
if (type == "year") {
this.searchForm.groupList = ["year"];
this.searchForm.year = year;
} else if (type == "month") {
this.searchForm.groupList = ["year", "month"];
if (month) {
let monthNum = month.split("-");
this.searchForm.year = monthNum[0];
this.searchForm.month = monthNum[1];
[this.searchForm.year, this.searchForm.month] = month.split("-");
}
} else {
this.searchForm.groupList = ["year", "month", "day"];
if (day) {
let dayNum = day.split("-");
this.searchForm.year = dayNum[0];
this.searchForm.month = dayNum[1];
this.searchForm.day = dayNum[2];
[this.searchForm.year, this.searchForm.month, this.searchForm.day] =
day.split("-");
}
}
if (businessName) {
this.searchForm.businessList = [businessName];
} else {
this.searchForm.businessList = [];
}
if (deptName) {
this.searchForm.sectionNameList = [deptName];
} else {
this.searchForm.sectionNameList = [];
}
if (windowName) {
this.searchForm.windowFromnumList = [windowName];
} else {
this.searchForm.windowFromnumList = [];
}
this.searchForm.businessList = businessName ? [businessName] : [];
this.searchForm.sectionNameList = deptName ? [deptName] : [];
this.searchForm.windowFromnumList = windowNum ? [windowNum] : [];
this.current = 1;
this.getQueueStatList();
},
......
......@@ -101,10 +101,10 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item prop="windowName">
<el-form-item prop="windowNum">
<el-select
style="width: 150px"
v-model="form.windowName"
v-model="form.windowNum"
placeholder="请选择窗口"
clearable
filterable
......@@ -142,7 +142,7 @@ export default {
type: "year",
businessName: "",
deptName: "",
windowName: "",
windowNum: "",
year: "",
month: "",
day: "",
......
......@@ -75,7 +75,10 @@
></el-input>
</el-popover>
</div>
<div class="item border">
<div
class="item border"
v-if="$route.path == '/enginesearch/queueupdata'"
>
<span class="pl-[15px] text-[14px]">选择业务</span>
<el-popover
trigger="click"
......@@ -100,7 +103,7 @@
</div>
<el-input
size="small"
placeholder="暂未选择"
placeholder="请输入"
slot="reference"
v-model="form.businessName"
clearable
......@@ -108,6 +111,23 @@
></el-input>
</el-popover>
</div>
<div class="item border" v-else>
<span class="pl-[15px] text-[14px]">选择评价选项</span>
<el-select
v-model="form.pjOption"
placeholder="请选择评价选项"
clearable
filterable
size="small"
>
<el-option
v-for="(v, i) in pjOption"
:key="i"
:label="v"
:value="v"
></el-option>
</el-select>
</div>
<div class="item border">
<span class="pl-[15px] text-[14px]">选择部门</span>
<el-popover
......@@ -115,10 +135,29 @@
placement="bottom-start"
popper-class="search-popover"
>
<div class="w-full">
<div class="mb-3">推荐部门</div>
<div class="flex w-full flex-col gap-3">
<div
class="flex cursor-pointer"
v-for="(v, i) in calcDept"
:key="v.id"
@click="form.deptName = v.name"
>
<div :class="['mr-4', ' w-[20px]', `index-${i + 1}`]">
{{ i + 1 }}
</div>
<div class="flex-1 truncate">{{ v.name }}</div>
</div>
</div>
</div>
<el-input
size="small"
placeholder="暂未选择"
placeholder="请输入"
slot="reference"
v-model="form.deptName"
clearable
@input="handleDeptNameInput"
></el-input>
</el-popover>
</div>
......@@ -129,15 +168,36 @@
placement="bottom-start"
popper-class="search-popover"
>
<div class="w-full">
<div class="mb-3">推荐窗口</div>
<div class="flex w-full flex-col gap-3">
<div
class="flex cursor-pointer"
v-for="(v, i) in calcWindow"
:key="v.id"
@click="form.windowNum = v.fromnum"
>
<div :class="['mr-4', ' w-[20px]', `index-${i + 1}`]">
{{ i + 1 }}
</div>
<div class="flex-1 truncate">
{{ v.fromnum }}-{{ v.name }}
</div>
</div>
</div>
</div>
<el-input
size="small"
placeholder="暂未选择"
placeholder="请输入"
slot="reference"
v-model="form.windowNum"
clearable
@input="handleWindowInput"
></el-input>
</el-popover>
</div>
</div>
<div class="btn">检索</div>
<div class="btn" @click="handleSearch">检索</div>
</div>
<div class="back-btn" @click="$router.push('/engine')">返回</div>
</div>
......@@ -147,17 +207,21 @@
<script>
import { findBottomSubarrays } from "@/utils";
import { mapState } from "vuex";
let pjOption = ["非常满意", "满意", "基本满意", "不满意", "非常不满意"];
export default {
components: {},
data() {
return {
pjOption,
calcBusiness: [],
calcDept: [],
calcWindow: [],
subMenus: [],
form: {
type: "year",
businessName: "",
deptName: "",
windowName: "",
windowNum: "",
year: "",
month: "",
day: "",
......@@ -184,12 +248,30 @@ export default {
return this.calcBusiness;
},
set(val) {
return (this.calcBusiness = val);
this.calcBusiness = val;
},
},
calcDeptList: {
get() {
return this.calcDept;
},
set(val) {
this.calcDept = val;
},
},
calcWindowList: {
get() {
return this.calcWindow;
},
set(val) {
this.calcWindow = val;
},
},
},
created() {
this.calcBusiness = this.businessList.slice(0, 10);
this.calcDept = this.deptList.slice(0, 10);
this.calcWindow = this.windowList.slice(0, 10);
this.getSubMenus();
},
mounted() {},
......@@ -209,18 +291,19 @@ export default {
);
},
changeTab(key) {
this.form.year = "";
this.form.month = "";
this.form.day = "";
this.form.type = key;
},
handlePick(val) {
console.log(val);
},
handleClearDate() {
this.form.year = "";
this.form.month = "";
this.form.day = "";
},
handleBusinessNameInput(name) {
if (name !== "") {
if (name != "") {
let list = this.businessList.filter((v) =>
v.businessName.includes(name)
);
......@@ -229,6 +312,27 @@ export default {
this.calcBusinessList = this.businessList.slice(0, 10);
}
},
handleDeptNameInput(name) {
if (name != "") {
let list = this.deptList.filter((v) => v.name.includes(name));
this.calcDeptList = list.slice(0, 10);
} else {
this.calcDeptList = this.deptList.slice(0, 10);
}
},
handleWindowInput(value) {
if (value != "") {
let list = this.windowList.filter(
(v) => v.name.includes(value) || v.fromnum.includes(value)
);
this.calcWindowList = list.slice(0, 10);
} else {
this.calcWindowList = this.windowList.slice(0, 10);
}
},
handleSearch() {
this.$emit("search", this.form);
},
},
};
</script>
......
......@@ -25,7 +25,7 @@
v-for="(v, key) in searchType"
:key="key"
:label="v"
:value="Number(key)"
:value="key"
></el-option>
</el-select>
</el-form-item>
......@@ -182,9 +182,9 @@ import { dataSection } from "@/utils";
import { export2Excel } from "@/utils/exportExcel";
import storage from "@/utils/storage";
let searchType = {
1: "按窗口编号",
2: "按群众姓名",
3: "按群众手机号",
windowFromnum: "按窗口编号",
peopleName: "按群众姓名",
peoplePhone: "按群众手机号",
};
export default {
components: {
......@@ -200,7 +200,7 @@ export default {
current: 1,
total: 0,
searchForm: {
type: 1,
type: "windowFromnum",
keyword: "",
time: [
this.$moment().format("YYYY-MM-DD"),
......@@ -411,17 +411,8 @@ export default {
siteId: this.searchForm.siteId,
};
let val = `%${this.searchForm.keyword}%`;
switch (this.searchForm.type) {
case 1:
obj.windowFromnum = val;
break;
case 2:
obj.peopleName = val;
break;
case 3:
obj.peoplePhone = val;
break;
}
obj[this.searchForm.type] = val;
let res = await getEvaluateList({
...obj,
...this.searchForm2,
......
......@@ -25,7 +25,7 @@
v-for="(v, key) in searchType"
:key="key"
:label="v"
:value="Number(key)"
:value="key"
></el-option>
</el-select>
</el-form-item>
......@@ -148,10 +148,10 @@
<script>
import QueueUpDetails from "./components/QueueUpDetails.vue";
let searchType = {
1: "按业务",
2: "按窗口编号",
3: "按群众姓名",
4: "按群众手机号",
business: "按业务",
windowFromnum: "按窗口编号",
peopleName: "按群众姓名",
peoplePhone: "按群众手机号",
};
import { getQueueList } from "@/api/market";
import { getDepartment, getHall } from "@/api/site";
......@@ -173,7 +173,7 @@ export default {
current: 1,
selectionRow: [],
searchForm: {
type: 1,
type: "business",
keyword: "",
time: [
this.$moment().format("YYYY-MM-DD"),
......@@ -394,20 +394,7 @@ export default {
siteId: this.searchForm.siteId,
};
let val = `%${this.searchForm.keyword}%`;
switch (this.searchForm.type) {
case 1:
obj.business = val;
break;
case 2:
obj.windowFromnum = val;
break;
case 3:
obj.peopleName = val;
break;
case 4:
obj.peoplePhone = val;
break;
}
obj[this.searchForm.type] = val;
let res = await getQueueList({ ...obj, ...this.searchForm2, ...form });
if (res.data.code == 1) {
return res.data.data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment