Commit f3bf8cd1 authored by shilei's avatar shilei

Merge branch 'dev' of http://101.201.78.203/cfld-front/liyeyun into dev

parents 2597f49e c0295f90
<!-- 联系人信息 -->
<template>
<div class="flex h-[95px] flex-col">
<div
v-if="personName"
class="flex h-[100px] flex-none items-center justify-between bg-[#FAFAFC] px-10"
>
<div class="flex h-[100px] flex-none items-center justify-between bg-[#FAFAFC] px-10">
<div class="flex items-center space-x-4">
<div class="flex items-center justify-center">
<div
class="flex h-[60px] w-[60px] items-center justify-center rounded bg-[#cccccc] font-yahei text-lg leading-5 text-white"
>
{{ personName?.[0] }}
{{ noPerson ? '空' : personName?.[0] }}
</div>
</div>
<div>
<div class="text-center font-yahei text-sm font-bold text-[#1A1A1A]">
{{ personName }}
{{ personName || '暂无对接人' }}
</div>
<div class="mt-[5px] rounded-sm text-sm text-[#4F4F4F]">园区对接人</div>
</div>
......@@ -23,9 +20,10 @@
<div>
<div
class="flex h-[44px] w-[128px] cursor-pointer items-center justify-center rounded-[4px] bg-[#C0322B] px-[23px] text-base leading-[22px] text-white"
:class="{ 'cursor-not-allowed opacity-[.45]': noPerson }"
@click="handleContact"
>
{{ isShowPhone && phone ? phone : '立即沟通' }}
{{ btnContent }}
</div>
</div>
</div>
......@@ -85,6 +83,20 @@ const isLogin = computed(() => {
return appStore.isLogin;
});
const noPerson = computed(() => {
return !props.personName;
});
const btnContent = computed(() => {
if (isShowPhone.value && phone.value) {
return phone.value;
} else if (noPerson.value) {
return '暂无对接人';
} else {
return '立即沟通';
}
});
const changeShowPhone = (b: boolean) => {
isShowPhone.value = b;
};
......@@ -109,7 +121,7 @@ const handlePhone = async () => {
};
const handleContact = () => {
if (!phone.value) {
if (!phone.value && !noPerson.value) {
if (isLogin.value) {
handlePhone();
} else {
......
......@@ -38,6 +38,7 @@
视频
</div>
<div
v-if="imageUrls.length > 0"
class="flex flex-1 items-center justify-center rounded-[50px]"
:class="{ 'bg-white text-[#C0322B]': isPictureType }"
@click="changeListType(ListType.picture)"
......
......@@ -59,7 +59,12 @@
</ElTableColumn>
<ElTableColumn prop="name" :label="typeName + '名称'">
<template #default="{ row }">
<div class="link cursor-pointer" @click="toDetail(row)">{{ row.name }}</div>
<div
class="cursor-pointer text-sm leading-6 text-[#2C68FF] hover:underline"
@click="toDetail(row)"
>
{{ row.name }}
</div>
</template>
</ElTableColumn>
<ElTableColumn prop="isSystemName" label="来源方式"></ElTableColumn>
......@@ -68,7 +73,10 @@
<ElTableColumn prop="statusName" label="审批状态"></ElTableColumn>
<ElTableColumn label="操作">
<template #default="{ row }">
<div class="cursor-pointer text-sm leading-6 text-[#2C68FF]" @click="toDetail(row)">
<div
class="cursor-pointer text-sm leading-6 text-[#2C68FF] hover:underline"
@click="toDetail(row)"
>
查看
</div>
</template>
......@@ -195,8 +203,3 @@ const handleReset = () => {
searchParams.value = '' as any;
};
</script>
<style scoped>
.link:hover {
text-decoration: underline;
}
</style>
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,10 +123,9 @@ 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();
}
initPagination();
});
};
......@@ -121,6 +140,7 @@ export function useListView<
totalCount,
datas,
isRequesting,
haveSearchParams,
queryList,
handleDetail,
initPagination,
......
......@@ -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> => {
......
......@@ -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,
searchParams,
haveSearchParams,
} = useListView<CarrierListItem, CarrierListCondition>(RequestUrl.carrierList);
// 筛选项
const filterKeyList = ref([
......
......@@ -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,
searchParams,
haveSearchParams,
} = useListView<DevelopZoneItem, DevelopZoneListCondition>(RequestUrl.developZoneList);
</script>
......@@ -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,
searchParams,
haveSearchParams,
} = useListView<IndustrialParkItem, IndustrialParkListCondition>(RequestUrl.industrialParkList);
// 筛选项
const filterKeyList = [
......
......@@ -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,
searchParams,
haveSearchParams,
isRequesting,
} = useListView(currentUrl);
} = useListView(currentUrl, otherParams);
const handleDirectionClick = (item: string) => {
currentDirection.value = item;
searchParams.value.investmentDirection = item;
};
watch(
......
......@@ -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,
searchParams,
haveSearchParams,
} = Response;
console.log(searchParams);
watch(searchParams, () => {
console.log(isEmpty(searchParams.value));
});
const filterKeyList = ref(['land_price', 'land_type', 'land_area']);
</script>
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