|
@@ -40,7 +40,7 @@ function doQuery(params = {}) {
|
|
|
function doSearch() {
|
|
|
return doQuery()
|
|
|
}
|
|
|
-
|
|
|
+let filterParams = reactive({})
|
|
|
// 列表状态
|
|
|
const listState = reactive({
|
|
|
finished,
|
|
@@ -50,6 +50,7 @@ const listState = reactive({
|
|
|
total
|
|
|
})
|
|
|
|
|
|
+
|
|
|
// search-list 组件所需参数
|
|
|
const searchListProps = computed(() => {
|
|
|
return {
|
|
@@ -74,14 +75,72 @@ function doChangePageSize(size) {
|
|
|
}
|
|
|
|
|
|
function doChangeFilter() {
|
|
|
+ // doQuery()
|
|
|
+}
|
|
|
+
|
|
|
+function doChangeInput(data) {
|
|
|
+ console.log(data)
|
|
|
+ let { area, build, civil, electromechanical, project_stage, ownerclass } = data
|
|
|
+ const areaJudge = checkIfArrayHasOnlyValue(area, '全部');
|
|
|
+ const buildJudge = checkIfArrayHasOnlyValue(build, '全部');
|
|
|
+ const civilJudge = checkIfArrayHasOnlyValue(civil, '全部');
|
|
|
+ const electromechanicalJudge = checkIfArrayHasOnlyValue(
|
|
|
+ electromechanical,
|
|
|
+ '全部'
|
|
|
+ )
|
|
|
+ const project_stageJudge = checkIfArrayHasOnlyValue(project_stage, '全部');
|
|
|
+ const ownerclassJudge = checkIfArrayHasOnlyValue(ownerclass, '全部');
|
|
|
+ // 地区
|
|
|
+ area = areaJudge ? '' : area.join(',')
|
|
|
+ // 工程(建筑、土木、机电)
|
|
|
+ // 如果三个都选全部,则category为空,有一个不选全部,剩下两个选全部,则category为两个不选全部的字符串拼接
|
|
|
+ // 如果三个都不选全部,则category为三个不选全部的字符串拼接
|
|
|
+ let category = ''
|
|
|
+ if (buildJudge && civilJudge && electromechanicalJudge) {
|
|
|
+ category = ''
|
|
|
+ } else {
|
|
|
+ const buildValue = getCategoryValue(data, build, 'build', buildJudge)
|
|
|
+ const civilValue = getCategoryValue(data, civil, 'civil', civilJudge)
|
|
|
+ const electromechanicalValue = getCategoryValue(data, electromechanical, 'electromechanical', electromechanicalJudge)
|
|
|
+ category = `${buildValue}${buildValue ? ',' : ''}${civilValue}${civilValue ? ',' : ''}${electromechanicalValue}`
|
|
|
+ }
|
|
|
+ const pattern = /(全部,){2}全部/;
|
|
|
+ if (pattern.test(category)) {
|
|
|
+ category = ''
|
|
|
+ }
|
|
|
+ // 项目阶段
|
|
|
+ project_stage = project_stageJudge ? '' : project_stage.join(',')
|
|
|
+ // 业主类别
|
|
|
+ ownerclass = ownerclassJudge ? '' : ownerclass.join(',')
|
|
|
+ filterParams = {
|
|
|
+ keyWord: inputKeywordsState.value.input,
|
|
|
+ area: area, // 地区
|
|
|
+ category: category,
|
|
|
+ project_stage: project_stage, // 项目阶段
|
|
|
+ ownerclass: ownerclass, // 业主类型
|
|
|
+ searchSort: 0
|
|
|
+ }
|
|
|
+ console.log(filterParams, 'filterParams')
|
|
|
doQuery()
|
|
|
}
|
|
|
|
|
|
+function getCategoryValue(filterData, field, filterDataString, judgeVariable) {
|
|
|
+ const judgeData = !judgeVariable
|
|
|
+ ? filterData[filterDataString].join(',')
|
|
|
+ : field.join(',')
|
|
|
+ debugger
|
|
|
+ console.log(judgeData, 'judgeData')
|
|
|
+ return judgeData
|
|
|
+}
|
|
|
+function checkIfArrayHasOnlyValue(arr, value) {
|
|
|
+ return arr.length === 1 && arr[0] === value;
|
|
|
+}
|
|
|
function getParams() {
|
|
|
return {
|
|
|
keyWord: inputKeywordsState.value.input,
|
|
|
pageNum: listState.pageNum,
|
|
|
- pageSize: listState.pageSize
|
|
|
+ pageSize: listState.pageSize,
|
|
|
+ ...filterParams
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -93,6 +152,7 @@ export {
|
|
|
// 搜索UI
|
|
|
filterState,
|
|
|
doChangeFilter,
|
|
|
+ doChangeInput,
|
|
|
searchTabs,
|
|
|
inputKeywordsState,
|
|
|
doSearch,
|