|
@@ -4,83 +4,141 @@
|
|
|
:type="data.type"
|
|
|
:data-list="data.dataList"
|
|
|
:show-more="showSeeMore"
|
|
|
- v-if="data.dataList.length > 0 && data.type !== '0'"
|
|
|
+ v-if="data.dataList.length > 0 && data.type !== '0' && data.type !== '5'"
|
|
|
@handle-see-more="handleSeeMore"
|
|
|
>
|
|
|
<template #head="{ data }">
|
|
|
- <context-head :type="data.type" />
|
|
|
+ <context-head :type="data.type"/>
|
|
|
</template>
|
|
|
<template #share="{ data }">
|
|
|
<context-share :type="data.type!" :id="data.id" :content="data.content" />
|
|
|
</template>
|
|
|
</context-contain>
|
|
|
- <div v-if="isEmpty && i === 0" class="empty">
|
|
|
- 暂无任何文件~
|
|
|
- </div>
|
|
|
+ <context-contain
|
|
|
+ :type="data.type"
|
|
|
+ :data-list="data.dataList"
|
|
|
+ :show-more="showSeeMore"
|
|
|
+ v-if="isShowType && data.type === '5'"
|
|
|
+ @handle-see-more="handleSeeMore"
|
|
|
+ >
|
|
|
+ <template #head="{ data }">
|
|
|
+ <context-head :type="data.type" @handle-all-status="handleAllStatus" />
|
|
|
+ </template>
|
|
|
+ <template #share="{ data }">
|
|
|
+ <context-share :type="data.type!" :id="data.id" :content="data.content" :all-status="data.allStatus" />
|
|
|
+ </template>
|
|
|
+ </context-contain>
|
|
|
+ </div>
|
|
|
+ <div v-if="isEmpty && route.query.t !== '5'" class="empty">暂无任何文件~</div>
|
|
|
+ <div class="bottom-btn" v-if="reqParams.type === '5' && isAddStatus">
|
|
|
+ <data-button
|
|
|
+ @handle-emit="router.push('/database/add')"
|
|
|
+ backgroundColor="#FF5B00"
|
|
|
+ color="#FFFFFF"
|
|
|
+ label="添加话术"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, computed, watchEffect, onMounted } from "vue";
|
|
|
+import { computed, ref, watch } from 'vue';
|
|
|
import contextContain from "../components/context-contain.vue";
|
|
|
import { DDataBaseListAll, DetailParams, tabList } from "@/types/views/database.type";
|
|
|
import contextHead from "../components/context-head.vue";
|
|
|
import contextShare from "../components/context-share.vue";
|
|
|
-import { useRoute } from "vue-router";
|
|
|
+import { useRouter, useRoute, LocationQueryValue } from "vue-router";
|
|
|
import { getArchiveList } from "@/api/context/context";
|
|
|
-import { IArchiveRequest } from "@/types/api/context.type"
|
|
|
-
|
|
|
+import { IArchiveRequest } from "@/types/api/context.type";
|
|
|
+import { useUserInfoState } from "@/store/user/user";
|
|
|
+import { myDecrypt } from '@/util/authStorage';
|
|
|
+const { userId } = useUserInfoState();
|
|
|
+const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
const dataList = ref<DDataBaseListAll[] | null>(null);
|
|
|
-const setNull = (t: any) => (t === "0" ? "" : t);
|
|
|
-const reqParams = computed<IArchiveRequest>(
|
|
|
- () =>
|
|
|
- ({
|
|
|
- type: setNull(route.query.t),
|
|
|
- title: route.query.sv,
|
|
|
- productId: setNull(route.query.pId),
|
|
|
- labelIds: route.query.lId,
|
|
|
- stageStatus: setNull(route.query.ss),
|
|
|
- allStatus: route.query.as,
|
|
|
- pageNum: 1,
|
|
|
- } as IArchiveRequest)
|
|
|
-);
|
|
|
-
|
|
|
-const isEmpty = ref<boolean>(false)
|
|
|
-const showSeeMore = ref<boolean>(true)
|
|
|
+const routeQuery = (str: LocationQueryValue | LocationQueryValue[]) => str === '0' ? '' : str
|
|
|
+const reqParams = computed<IArchiveRequest>(() => ({
|
|
|
+ type: routeQuery(route.query.t),
|
|
|
+ title: route.query.sv,
|
|
|
+ productId: routeQuery(route.query.pId),
|
|
|
+ labelIds: route.query.lId,
|
|
|
+ stageStatus: routeQuery(route.query.ss),
|
|
|
+ spId: '',
|
|
|
+ userId: userId,
|
|
|
+}) as IArchiveRequest);
|
|
|
+const isAddStatus = ref<boolean>(false);
|
|
|
+const isEmpty = ref<boolean>(false);
|
|
|
+const isShowType = ref<boolean>(false);
|
|
|
+const showSeeMore = ref<boolean>(true);
|
|
|
+const formParams = ref({ allStatus: '1' })
|
|
|
const reqArchiveList = async (res?: DetailParams) => {
|
|
|
if (!res) {
|
|
|
- const { data } = await getArchiveList({ ...reqParams.value });
|
|
|
+ const { data } = await getArchiveList({ ...reqParams.value, ...formParams.value });
|
|
|
+ const DcreptoList = data?.map(e => ({
|
|
|
+ ...e,
|
|
|
+ waters: myDecrypt(e.waters! as string[])
|
|
|
+ }))
|
|
|
dataList.value = tabList.map((e) => ({
|
|
|
type: e.type,
|
|
|
- dataList: data!.filter((i) => i.type === e.type),
|
|
|
+ dataList: DcreptoList!.filter((i) => i.type === e.type),
|
|
|
}));
|
|
|
+ isEmpty.value = data?.length === 0;
|
|
|
} else {
|
|
|
const { data } = await getArchiveList({ ...reqParams.value, ...res! });
|
|
|
- dataList.value![res.type]!.dataList = [...dataList.value![res.type]!.dataList, ...data!]
|
|
|
- isEmpty.value = dataList.value![res.type]!.dataList.length === 0
|
|
|
- showSeeMore.value = data?.length! < 5
|
|
|
+ const DcreptoList = data?.map(e => ({
|
|
|
+ ...e,
|
|
|
+ waters: myDecrypt(e.waters! as string[])
|
|
|
+ }))
|
|
|
+ if (res.allStatus || res.pageNum === 1) {
|
|
|
+ dataList.value![res.type]!.dataList = [];
|
|
|
+ }
|
|
|
+ dataList.value![res.type]!.dataList = [
|
|
|
+ ...dataList.value![res.type]!.dataList,
|
|
|
+ ...DcreptoList!,
|
|
|
+ ];
|
|
|
+ isEmpty.value = dataList.value![res.type]!.dataList.length === 0 && reqParams.value.type !== '';
|
|
|
+ showSeeMore.value = data?.length! < 5;
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
-const handleSeeMore = ($event: DetailParams) => {
|
|
|
- reqArchiveList($event)
|
|
|
-}
|
|
|
-watchEffect(() => {
|
|
|
- reqArchiveList();
|
|
|
- console.log(reqParams.value);
|
|
|
+watch(() => route.query, (val) => {
|
|
|
+ console.log('路由变化', val)
|
|
|
+ isShowType.value = route.query.t === '0' || route.query.t === '5'
|
|
|
+ formParams.value.allStatus = '1'
|
|
|
+ reqArchiveList()
|
|
|
+},
|
|
|
+{
|
|
|
+ immediate: true,
|
|
|
});
|
|
|
|
|
|
-onMounted(() => {});
|
|
|
+const handleSeeMore = ($event: DetailParams) => {
|
|
|
+ console.log('查看更多')
|
|
|
+ reqArchiveList($event);
|
|
|
+};
|
|
|
+const handleAllStatus = ($event: DetailParams) => {
|
|
|
+ console.log('改变成企业', $event)
|
|
|
+ formParams.value.allStatus = $event.allStatus!
|
|
|
+ reqArchiveList($event);
|
|
|
+ isAddStatus.value = $event.allStatus === "2";
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+.bottom-btn {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ padding: 24px 28px;
|
|
|
+ background: #fff;
|
|
|
+ z-index: 99;
|
|
|
+ box-sizing: border-box;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
.empty {
|
|
|
width: 100%;
|
|
|
height: 135px;
|
|
|
background: #fff;
|
|
|
- @include display-column-end;
|
|
|
+ @include display-flex-center;
|
|
|
font-size: $basicFS-foot;
|
|
|
color: #909090;
|
|
|
+ padding-top: 67px;
|
|
|
}
|
|
|
</style>
|