Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
liyeyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cfld-frontend
liyeyun
Commits
af845539
Commit
af845539
authored
Dec 13, 2023
by
王玉鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 搜索条件,招商方向修正
parent
d6333b27
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
37 deletions
+52
-37
useListView.ts
src/composable/useListView.ts
+32
-12
useQueryList.ts
src/composable/useQueryList.ts
+1
-1
CarrierList.vue
src/views/carrier/CarrierList.vue
+2
-3
DevelopZoneList.vue
src/views/develop/DevelopZoneList.vue
+2
-3
IndustrialParkList.vue
src/views/industrial-park/IndustrialParkList.vue
+2
-3
IndustryCategory.vue
src/views/industry/IndustryCategory.vue
+10
-6
LandList.vue
src/views/land/LandList.vue
+3
-9
No files found.
src/composable/useListView.ts
View file @
af845539
import
{
useQueryList
}
from
'@/composable/useQueryList.ts'
;
import
{
ref
,
type
Ref
,
watchEffect
,
nextTick
,
type
ShallowRef
}
from
'vue'
;
import
{
ref
,
type
Ref
,
watchEffect
,
nextTick
,
type
ShallowRef
,
computed
}
from
'vue'
;
import
{
RequestUrl
}
from
'@/types/api.ts'
;
import
type
{
CommonListResp
,
CommonListParams
}
from
'@/types/common'
;
import
type
{
RouteName
}
from
'@/router/router.ts'
;
import
{
useRoute
,
onBeforeRouteLeave
}
from
'vue-router'
;
import
{
useSearchParamsStore
}
from
'@/stores/searchParams.ts'
;
import
{
cloneDeep
}
from
'lodash-es'
;
import
{
cloneDeep
,
isEmpty
}
from
'lodash-es'
;
import
{
useRequest
}
from
'./useRequest.ts'
;
import
{
useJump
}
from
'./useJump.ts'
;
...
...
@@ -13,7 +13,7 @@ type CurrentUrl = RequestUrl | ShallowRef<{ target: RequestUrl }>;
export
function
useListView
<
T
extends
{
id
:
number
;
[
index
:
string
]:
any
},
C
extends
Record
<
any
,
any
>
&
{
name
?:
string
},
>
(
url
:
CurrentUrl
)
{
>
(
url
:
CurrentUrl
,
specialParams
:
Ref
<
Record
<
string
,
any
>>
=
{}
as
any
)
{
const
{
open
,
router
}
=
useJump
();
const
getCurrentUrl
=
()
=>
{
if
(
typeof
url
===
'string'
)
{
...
...
@@ -41,6 +41,26 @@ export function useListView<
const
searchParams
=
ref
<
C
>
(
cloneDeep
(
searchParamsStore
.
urlSearchParams
)
||
{});
const
isRequesting
=
ref
(
false
);
const
otherParams
=
computed
(()
=>
{
const
{
searchName
}
=
searchParamsStore
;
return
{
...
specialParams
.
value
,
...(
searchName
?
{
name
:
searchName
}
:
{}),
};
});
const
currentParams
=
computed
(()
=>
{
return
{
...
searchParams
.
value
,
...
otherParams
.
value
,
};
});
/** 是否存在搜索参数 */
const
haveSearchParams
=
computed
(()
=>
{
return
!
isEmpty
(
currentParams
.
value
);
});
/**
* 清除url传递的参数
*/
...
...
@@ -57,7 +77,13 @@ export function useListView<
watchEffect
(
async
()
=>
{
try
{
changeIsRequesting
(
true
);
const
{
data
}
=
await
queryList
(
searchParams
.
value
||
{},
getCurrentUrl
());
const
{
data
}
=
await
queryList
(
{
...
searchParams
.
value
,
...
otherParams
.
value
,
}
||
{},
getCurrentUrl
(),
);
handleUrlClear
();
datas
.
value
=
data
.
records
;
}
catch
(
error
)
{
...
...
@@ -87,14 +113,8 @@ export function useListView<
for
(
const
item
of
selectList
.
value
)
{
temp
[
item
.
key
]
=
item
.
value
;
}
const
{
searchName
}
=
searchParamsStore
;
if
(
searchName
)
{
temp
.
name
=
searchName
;
}
initPagination
();
const
{
investmentDirection
}
=
searchParams
.
value
;
temp
.
investmentDirection
=
investmentDirection
;
searchParams
.
value
=
temp
;
};
...
...
@@ -103,8 +123,7 @@ export function useListView<
*/
const
handleNameSearch
=
(
params
:
{
name
:
string
})
=>
{
nextTick
(()
=>
{
if
(
searchParams
.
value
.
name
!==
params
.
name
)
{
searchParams
.
value
.
name
=
params
.
name
;
if
(
searchParamsStore
.
searchName
!==
params
.
name
)
{
initPagination
();
}
});
...
...
@@ -121,6 +140,7 @@ export function useListView<
totalCount
,
datas
,
isRequesting
,
haveSearchParams
,
queryList
,
handleDetail
,
initPagination
,
...
...
src/composable/useQueryList.ts
View file @
af845539
...
...
@@ -47,7 +47,7 @@ export function useQueryList<T, C>(queryFn: QueryFn<T, CommonListParams<C>>) {
};
const
initPagination
=
()
=>
{
changePagination
({
page
:
1
,
size
:
10
,
total
:
0
});
changePagination
({
page
:
1
,
size
:
10
});
};
const
assignPageParams
=
(
params
:
C
):
CommonListParams
<
C
>
=>
{
...
...
src/views/carrier/CarrierList.vue
View file @
af845539
...
...
@@ -12,7 +12,7 @@
</div>
<div>
<!-- 载体列表 -->
<p
v-if=
"
!isEmpty(searchParams)
"
class=
"mb-7 text-sm font-medium text-[#4d4d4d]"
>
<p
v-if=
"
haveSearchParams
"
class=
"mb-7 text-sm font-medium text-[#4d4d4d]"
>
搜索到
<span
class=
"text-[#C0322B]"
>
{{
totalCount
}}
</span>
个相关载体
...
...
@@ -48,7 +48,6 @@ import CommonTitle from '@/components/common/CommonTitle.vue';
import
FilterView
from
'@/components/filter/filter-view.vue'
;
import
type
{
CarrierListCondition
,
CarrierListItem
}
from
'@/types/api/carrierList'
;
import
{
ref
}
from
'vue'
;
import
{
isEmpty
}
from
'lodash-es'
;
const
{
pageNum
,
...
...
@@ -58,7 +57,7 @@ const {
handleDetail
,
handleFilterChange
,
handleNameSearch
,
s
earchParams
,
haveS
earchParams
,
}
=
useListView
<
CarrierListItem
,
CarrierListCondition
>
(
RequestUrl
.
carrierList
);
// 筛选项
const
filterKeyList
=
ref
([
...
...
src/views/develop/DevelopZoneList.vue
View file @
af845539
...
...
@@ -11,7 +11,7 @@
<FormModal></FormModal>
</div>
<div>
<p
v-if=
"
!isEmpty(searchParams)
"
class=
"mb-7 text-sm font-medium text-[#4d4d4d]"
>
<p
v-if=
"
haveSearchParams
"
class=
"mb-7 text-sm font-medium text-[#4d4d4d]"
>
搜索到
<span
class=
"text-[#C0322B]"
>
{{
totalCount
}}
</span>
个相关开发区
...
...
@@ -48,7 +48,6 @@ import type { DevelopZoneItem, DevelopZoneListCondition } from '@/types/api/deve
import
{
ParkItemType
}
from
'@/types/enum.ts'
;
import
FilterView
from
'@/components/filter/filter-view.vue'
;
import
CommonTitle
from
'@/components/common/CommonTitle.vue'
;
import
{
isEmpty
}
from
'lodash-es'
;
// 筛选项列表
const
filterKeyList
=
[
...
...
@@ -67,6 +66,6 @@ const {
handleDetail
,
handleFilterChange
,
handleNameSearch
,
s
earchParams
,
haveS
earchParams
,
}
=
useListView
<
DevelopZoneItem
,
DevelopZoneListCondition
>
(
RequestUrl
.
developZoneList
);
</
script
>
src/views/industrial-park/IndustrialParkList.vue
View file @
af845539
...
...
@@ -11,7 +11,7 @@
<FormModal></FormModal>
</div>
<div>
<p
v-if=
"
!isEmpty(searchParams)
"
class=
"mb-7 text-sm font-medium text-[#4d4d4d]"
>
<p
v-if=
"
haveSearchParams
"
class=
"mb-7 text-sm font-medium text-[#4d4d4d]"
>
搜索到
<span
class=
"text-[#C0322B]"
>
{{
totalCount
}}
</span>
个相关产业园
...
...
@@ -50,7 +50,6 @@ import ListPagination from '@/components/list/ListPagination.vue';
import
FilterView
from
'@/components/filter/filter-view.vue'
;
import
CommonTitle
from
'@/components/common/CommonTitle.vue'
;
import
ParkItem
from
'@/components/list/ParkItem.vue'
;
import
{
isEmpty
}
from
'lodash-es'
;
// import FormModal from '@/components/form-modal/FormModal.vue';
import
type
{
IndustrialParkItem
,
...
...
@@ -66,7 +65,7 @@ const {
handleDetail
,
handleFilterChange
,
handleNameSearch
,
s
earchParams
,
haveS
earchParams
,
}
=
useListView
<
IndustrialParkItem
,
IndustrialParkListCondition
>
(
RequestUrl
.
industrialParkList
);
// 筛选项
const
filterKeyList
=
[
...
...
src/views/industry/IndustryCategory.vue
View file @
af845539
...
...
@@ -51,7 +51,7 @@
@
change=
"handleFilterChange"
></FilterView>
<template
v-if=
"datas.length"
>
<p
v-if=
"
!isEmpty(searchParams)
"
class=
"mb-7 text-sm font-medium text-[#4d4d4d]"
>
<p
v-if=
"
haveSearchParams
"
class=
"mb-7 text-sm font-medium text-[#4d4d4d]"
>
搜索到
<span
class=
"text-[#C0322B]"
>
{{
totalCount
}}
</span>
个相关
{{
tabList
[
activeTab
].
name
}}
...
...
@@ -101,7 +101,7 @@
</template>
<
script
lang=
"ts"
setup
>
import
{
ref
,
shallowRef
,
watch
,
onMounted
,
nextTick
}
from
'vue'
;
import
{
ref
,
shallowRef
,
watch
,
onMounted
,
nextTick
,
computed
}
from
'vue'
;
import
{
useRequest
}
from
'@/composable/useRequest.ts'
;
import
{
RequestUrl
}
from
'@/types/api.ts'
;
import
{
useListView
}
from
'@/composable/useListView.ts'
;
...
...
@@ -114,7 +114,6 @@ import CarrierListItemView from '@/components/list/list-carrier-item.vue';
import
LandListItemView
from
'@/components/list/list-land-item.vue'
;
import
ParkItem
from
'@/components/list/ParkItem.vue'
;
import
FilterView
from
'@/components/filter/filter-view.vue'
;
import
{
isEmpty
}
from
'lodash-es'
;
type
tabItem
=
{
name
:
string
;
...
...
@@ -181,6 +180,12 @@ onMounted(async () => {
}
});
const
otherParams
=
computed
(()
=>
{
return
{
investmentDirection
:
currentDirection
.
value
,
};
});
const
{
pageNum
,
pageSize
,
...
...
@@ -188,13 +193,12 @@ const {
datas
,
handleDetail
,
handleFilterChange
,
s
earchParams
,
haveS
earchParams
,
isRequesting
,
}
=
useListView
(
currentUrl
);
}
=
useListView
(
currentUrl
,
otherParams
);
const
handleDirectionClick
=
(
item
:
string
)
=>
{
currentDirection
.
value
=
item
;
searchParams
.
value
.
investmentDirection
=
item
;
};
watch
(
...
...
src/views/land/LandList.vue
View file @
af845539
...
...
@@ -12,7 +12,7 @@
<FormModal></FormModal>
</div>
<div>
<p
v-if=
"
!isEmpty(searchParams)
"
class=
"mb-7 text-sm font-medium text-[#4d4d4d]"
>
<p
v-if=
"
haveSearchParams
"
class=
"mb-7 text-sm font-medium text-[#4d4d4d]"
>
搜索到
<span
class=
"text-[#C0322B]"
>
{{
totalCount
}}
</span>
个相关土地
...
...
@@ -49,8 +49,7 @@ import LandListItemView from '@/components/list/list-land-item.vue';
import
CommonTitle
from
'@/components/common/CommonTitle.vue'
;
import
FilterView
from
'@/components/filter/filter-view.vue'
;
import
type
{
LandListCondition
,
LandListItem
}
from
'@/types/api/landList'
;
import
{
ref
,
watch
}
from
'vue'
;
import
{
isEmpty
}
from
'lodash-es'
;
import
{
ref
}
from
'vue'
;
const
Response
=
useListView
<
LandListItem
,
LandListCondition
>
(
RequestUrl
.
landList
);
const
{
...
...
@@ -61,13 +60,8 @@ const {
handleDetail
,
handleFilterChange
,
handleNameSearch
,
s
earchParams
,
haveS
earchParams
,
}
=
Response
;
console
.
log
(
searchParams
);
watch
(
searchParams
,
()
=>
{
console
.
log
(
isEmpty
(
searchParams
.
value
));
});
const
filterKeyList
=
ref
([
'land_price'
,
'land_type'
,
'land_area'
]);
</
script
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment