Please enter the commit message for your changes. Lines starting
with '#' will be ignored, and an empty message aborts the commit. On branch develop Your branch is up to date with 'goflyapp/develop'. Changes to be committed: modified: zlt-business/order-center/src/main/resources/application.yml modified: zlt-gateway/sc-gateway/src/main/resources/application.yml modified: zlt-web/react-web/src/main/frontend/src/pages/device/Device/index.tsx modified: zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx modified: zlt-web/react-web/src/main/frontend/src/services/device/api.ts Changes not staged for commit: modified: zlt-web/react-web/src/main/frontend/config/config.ts modified: zlt-web/react-web/src/main/frontend/package.json modified: zlt-web/react-web/src/main/frontend/src/app.tsx
This commit is contained in:
@@ -272,7 +272,20 @@ const TableList: React.FC = () => {
|
||||
rowKey="deviceSn"
|
||||
headerTitle="设备管理"
|
||||
actionRef={actionRef}
|
||||
request={device}
|
||||
request={async (params, sorter, filter) => {
|
||||
const res = await device({
|
||||
page: params.current,
|
||||
limit: params.pageSize,
|
||||
searchKey: params.searchKey,
|
||||
searchValue: params.searchValue,
|
||||
});
|
||||
|
||||
return {
|
||||
data: res.data || [],
|
||||
success: res.resp_code === 0,
|
||||
total: res.count || 0,
|
||||
};
|
||||
}}
|
||||
columns={columns}
|
||||
search={false}
|
||||
params={searchParams}
|
||||
|
||||
@@ -191,8 +191,8 @@ const TableList: React.FC = () => {
|
||||
const fetchDeviceList = useCallback(async () => {
|
||||
try {
|
||||
const result = await device({
|
||||
current: 1,
|
||||
pageSize: 100,
|
||||
page: 1,
|
||||
limit: 100,
|
||||
});
|
||||
|
||||
if (result?.data) {
|
||||
|
||||
@@ -29,32 +29,16 @@ export async function deleteWayline(id: number) {
|
||||
}
|
||||
|
||||
// 获取设备列表
|
||||
export async function device(params?: { [key: string]: any }) {
|
||||
const { current, pageSize, ...rest } = params ?? {};
|
||||
try {
|
||||
const result = await request<API.Result<DEVICE.Device[]>>('/api-device/device', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
page: current,
|
||||
limit: pageSize,
|
||||
...rest,
|
||||
},
|
||||
});
|
||||
|
||||
// 根据实际返回的数据结构进行处理
|
||||
return {
|
||||
data: result.data || [], // 直接使用返回的数组
|
||||
success: result.resp_code === 0,
|
||||
total: result.count || 0, // 使用返回的count作为总数
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('获取设备列表失败:', error);
|
||||
return {
|
||||
data: [],
|
||||
success: false,
|
||||
total: 0,
|
||||
};
|
||||
}
|
||||
export async function device(params: {
|
||||
page?: number;
|
||||
limit?: number;
|
||||
searchKey?: string;
|
||||
searchValue?: string;
|
||||
}) {
|
||||
return request('/api-device/device', {
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 新增或更新设备
|
||||
|
||||
Reference in New Issue
Block a user