| | |
| | | class="tab" |
| | | v-for="(tab, index) in tabs" |
| | | :key="index" |
| | | @click="selectTab(index)" |
| | | @click="selectTab(index,tab)" |
| | | :class="{ 'active': selectedTab === index }" |
| | | > |
| | | {{ tab }} |
| | | {{ tab.name }} |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { computed, ref, reactive, watch, nextTick } from 'vue'; |
| | | import { computed, ref, reactive, watch, nextTick, onBeforeMount } from "vue"; |
| | | import { useI18n } from 'vue-i18n'; |
| | | import useLoading from '@/hooks/loading'; |
| | | import { queryPolicyList, PolicyRecord, PolicyParams } from '@/api/list'; |
| | | import { queryKbList, PolicyRecord, PolicyParams, queryKbDocumentList } from "@/api/kbList"; |
| | | import { Pagination } from '@/types/global'; |
| | | import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface'; |
| | | import type { TableColumnData } from '@arco-design/web-vue/es/table/interface'; |
| | |
| | | }; |
| | | const { loading, setLoading } = useLoading(true); |
| | | const { t } = useI18n(); |
| | | const renderData = ref<PolicyRecord[]>([]); |
| | | const renderData = ref([]); |
| | | const formModel = ref(generateFormModel()); |
| | | const cloneColumns = ref<Column[]>([]); |
| | | const showColumns = ref<Column[]>([]); |
| | |
| | | let visible = ref(false) |
| | | let detailsShow = ref(false) |
| | | let selectedTab = ref(0) |
| | | let tabs = reactive(['法律知识库', '政务知识库', '医学知识库', '其他知识库']) |
| | | let tabs = ref([]) |
| | | |
| | | const selectTab = (index) => { |
| | | const selectTab = (index,item) => { |
| | | selectedTab.value= index; |
| | | console.log(item.id); |
| | | fetchData({ |
| | | kb_id: item.id, |
| | | page: 1, |
| | | page_size: 20 |
| | | }) |
| | | } |
| | | |
| | | const basePagination: Pagination = { |
| | |
| | | value: 'offline', |
| | | }, |
| | | ]); |
| | | const fetchData = async ( |
| | | params: PolicyParams = { current: 1, pageSize: 20 } |
| | | ) => { |
| | | const fetchData = async (params) => { |
| | | setLoading(true); |
| | | try { |
| | | const { data } = await queryPolicyList(params); |
| | | renderData.value = data.list; |
| | | console.log(renderData, 'renderData'); |
| | | pagination.current = params.current; |
| | | pagination.total = data.total; |
| | | const data = await queryKbDocumentList(params); |
| | | console.log(data, 'data'); |
| | | if(data.code=='0'){ |
| | | renderData.value = data.data.docs||[]; |
| | | pagination.current = params.page; |
| | | pagination.total = data.data.total; |
| | | } |
| | | } catch (err) { |
| | | // you can report use errorHandler or other |
| | | } finally { |
| | |
| | | fetchData({ |
| | | ...basePagination, |
| | | ...formModel.value, |
| | | } as unknown as PolicyParams); |
| | | }); |
| | | }; |
| | | |
| | | const handleClick = ()=>{ |
| | |
| | | fetchData({ ...basePagination, current }); |
| | | }; |
| | | |
| | | fetchData(); |
| | | const knowledgeData = async ( |
| | | params = { page: 1, page_size: 20 } |
| | | ) => { |
| | | setLoading(true); |
| | | try { |
| | | const { data } = await queryKbList(params); |
| | | console.log(data, 'data'); |
| | | tabs.value = data; |
| | | console.log(tabs.value, 'tabs'); |
| | | if(tabs.value.length>0 && tabs.value[0]){ |
| | | fetchData({ |
| | | kb_id: tabs.value[0].id, |
| | | page: 1, |
| | | page_size: 20 |
| | | }) |
| | | } |
| | | // renderData.value = data.list; |
| | | // console.log(renderData, 'renderData'); |
| | | // pagination.current = params.current; |
| | | // pagination.total = data.total; |
| | | } catch (err) { |
| | | // you can report use errorHandler or other |
| | | } finally { |
| | | setLoading(false); |
| | | } |
| | | }; |
| | | |
| | | const reset = () => { |
| | | formModel.value = generateFormModel(); |
| | | }; |
| | |
| | | }, |
| | | { deep: true, immediate: true } |
| | | ); |
| | | |
| | | onBeforeMount(()=>{ |
| | | knowledgeData() |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <script lang="ts"> |