@@ -33,7 +33,7 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL | |||
...pageParams | |||
} | |||
const response = await request(params) | |||
const res = noPagination ? response : response.data | |||
const res = noPagination ? response.data : response.data | |||
const resultTotal = res[totalField] || 0 | |||
const currentPage = res[listPageField] | |||
// 如果数据异常,需获取正确的页码再次执行 | |||
@@ -47,7 +47,7 @@ export function useDataSource(propsRef, { getPaginationInfo, setPagination, setL | |||
} | |||
// 处理数据结构 | |||
const resultInfo = res[listField] ? res[listField] : res | |||
dataSourceRef.value = dataType === 'tree' ? dealTree(resultInfo.data) : resultInfo | |||
dataSourceRef.value = dataType === 'tree' ? dealTree(resultInfo) : resultInfo | |||
setPagination({ | |||
[pageField]: currentPage, | |||
[totalField]: Math.ceil(resultTotal / pageSize), |
@@ -7,6 +7,7 @@ | |||
:columns="columns" | |||
:row-key="(row) => row.id" | |||
:request="loadDataTable" | |||
:pagination="false" | |||
size="large" | |||
> | |||
<template #tableTitle> | |||
@@ -27,7 +28,7 @@ import { search } from '../tools/materialSearch.js' | |||
import HeadSearch from '@/components/Search/index.vue' | |||
import DataTable from '@/components/DataTable/index.vue' | |||
import MaterialModal from './MaterialModal.vue' | |||
import { defineComponent, reactive, unref, toRefs, computed, watch } from 'vue' | |||
import { defineComponent, reactive, unref, toRefs, computed } from 'vue' | |||
import { goodsList } from '@/api/basic/material.js' | |||
export default defineComponent({ |
@@ -1,8 +1,7 @@ | |||
import { h, ref, reactive } from 'vue' | |||
import TableImage from '@/components/DataTable/tools/Image.vue' | |||
import TableTags from '@/components/DataTable/tools/Tags.vue' | |||
import TableSwitch from '@/components/DataTable/tools/Switch.vue' | |||
import TableAction from '@/components/DataTable/tools/Action.vue' | |||
import { MATERIAL_TYPE } from '@/utils/dictionary.js' | |||
import { deleteGoods } from '@/api/basic/material.js' | |||
/* 注册table */ | |||
@@ -66,7 +65,13 @@ const data = reactive({ | |||
{ | |||
title: '物资类型', | |||
key: 'goodsType', | |||
align: 'center' | |||
align: 'center', | |||
render(row) { | |||
return h(TableTags, { | |||
data: row.goodsType, | |||
filters: MATERIAL_TYPE | |||
}) | |||
} | |||
}, | |||
{ | |||
title: '物资库存', |