| | |
| | | import { computed, ref, reactive, watch, nextTick, onBeforeMount } from "vue"; |
| | | import { useI18n } from 'vue-i18n'; |
| | | import useLoading from '@/hooks/loading'; |
| | | import { queryKbList, PolicyRecord, PolicyParams } from '@/api/kbList'; |
| | | 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[]>([]); |
| | |
| | | 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 = { page: 1, page_size: 20 } |
| | | ) => { |
| | | const fetchData = async (params) => { |
| | | setLoading(true); |
| | | try { |
| | | const { data } = await queryKbList(params); |
| | | const data = await queryKbDocumentList(params); |
| | | console.log(data, 'data'); |
| | | // renderData.value = data.list; |
| | | // console.log(renderData, 'renderData'); |
| | | // pagination.current = params.current; |
| | | // pagination.total = data.total; |
| | | 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 = ()=>{ |
| | |
| | | console.log(data, 'data'); |
| | | tabs.value = data; |
| | | console.log(tabs.value, 'tabs'); |
| | | // fetchData() |
| | | 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; |