Commit 8f645e4c authored by tanghao's avatar tanghao

分页查询

parent 11ec22d9
...@@ -95,15 +95,26 @@ export const getInformationListTitlesApi = (params: any) => { ...@@ -95,15 +95,26 @@ export const getInformationListTitlesApi = (params: any) => {
}) })
} }
// /**
// * 获取资料库列表数据
// * @param params
// * @returns
// */
// export const getInformationListApi = (data: any) => {
// return axios.post('/api/information/listInformation', data)
// }
/** /**
* 获取资料库列表数据 * 获取资料库列表数据
* @param params * @param params
* @returns * @returns
*/ */
export const getInformationListApi = (data: any) => { export const getInformationListApi = (data: any) => {
return axios.post('/api/information/listInformation', data) return axios.post('/api/information/pageInformation', data)
} }
/** /**
* 导入客户资料 * 导入客户资料
* @param params * @param params
......
...@@ -45,8 +45,8 @@ ...@@ -45,8 +45,8 @@
</template> </template>
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
<vxe-pager v-if="total > 0" size="small" background v-model:current-page="form.currentPage" <vxe-pager size="small" background v-model:current-page="currentPage"
v-model:page-size="form.pageSize" :total="total" @page-change="onSearch" v-model:page-size="pageSize" :total="total" @page-change="onSearch"
:layouts="['PrevPage', 'JumpNumber', 'NextPage', 'Sizes', 'FullJump', 'Total']"> :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'Sizes', 'FullJump', 'Total']">
</vxe-pager> </vxe-pager>
</div> </div>
...@@ -72,6 +72,9 @@ const form = ref<any>({}) ...@@ -72,6 +72,9 @@ const form = ref<any>({})
const defualtForm = ref<any>({}) const defualtForm = ref<any>({})
const total = ref(0) const total = ref(0)
const currentPage = ref(1)
const pageSize = ref(10)
const xTable = ref<VxeTableInstance>() const xTable = ref<VxeTableInstance>()
const tableData = ref([]) const tableData = ref([])
const tableColumn = ref([]) const tableColumn = ref([])
...@@ -102,11 +105,11 @@ const initData = async () => { ...@@ -102,11 +105,11 @@ const initData = async () => {
form.value[ele] = "" form.value[ele] = ""
defualtForm.value[ele]="" defualtForm.value[ele]=""
}); });
getInformationListApi(params).then((res) => { // getInformationListApi(params).then((res) => {
if (res.data?.code == 200) { // if (res.data?.code == 200) {
tableData.value = res.data?.result // tableData.value = res.data?.result
} // }
}) // })
} }
} catch (error) { } catch (error) {
...@@ -120,7 +123,9 @@ const getInformationList = async (params: any) => { ...@@ -120,7 +123,9 @@ const getInformationList = async (params: any) => {
try { try {
const res = await getInformationListApi(params); const res = await getInformationListApi(params);
if (res.data?.code == 200) { if (res.data?.code == 200) {
tableData.value = res.data?.result console.log(res)
tableData.value = res.data?.result.records
total.value = res.data?.result.total
} }
} catch (error) { } catch (error) {
...@@ -129,20 +134,24 @@ const getInformationList = async (params: any) => { ...@@ -129,20 +134,24 @@ const getInformationList = async (params: any) => {
} }
} }
const onReset = () => { const onReset = () => {
if(formRef?.value) { if(formRef?.value) {
formRef?.value.resetFields() formRef?.value.resetFields()
} }
const params = { // const params = {
informationType: route.query.informationType // informationType: route.query.informationType
} // }
getInformationList(params) // getInformationList(params)
onSearch()
} }
const onSearch = () => { const onSearch = () => {
const params = { const params = {
informationType: route.query.informationType, informationType: route.query.informationType,
json: JSON.stringify(form.value) json: JSON.stringify(form.value),
currentPage:currentPage.value,
pageSize:pageSize.value
} }
getInformationList(params) getInformationList(params)
} }
...@@ -221,7 +230,7 @@ const handleImport = () => { ...@@ -221,7 +230,7 @@ const handleImport = () => {
const onImportChange = (type: any) => { const onImportChange = (type: any) => {
importVisible.value = false importVisible.value = false
if (type != 'close') { if (type != 'close') {
initData() onSearch()
} }
} }
...@@ -230,6 +239,7 @@ onMounted(() => { ...@@ -230,6 +239,7 @@ onMounted(() => {
return return
} }
initData() initData()
onSearch()
}) })
</script> </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