| | |
| | | |
| | | export function buildDeliverySearchParams(params = {}) { |
| | | const result = {} |
| | | ;['condition', 'code', 'platId', 'type', 'wkType', 'source', 'timeStart', 'timeEnd', 'memo'].forEach((key) => { |
| | | ;[ |
| | | 'condition', |
| | | 'code', |
| | | 'platId', |
| | | 'type', |
| | | 'wkType', |
| | | 'source', |
| | | 'platCode', |
| | | 'timeStart', |
| | | 'timeEnd', |
| | | 'startTime', |
| | | 'endTime', |
| | | 'memo' |
| | | ].forEach((key) => { |
| | | const value = normalizeText(params[key]) |
| | | if (value) result[key] = value |
| | | }) |
| | | ;['anfme', 'qty', 'workQty'].forEach((key) => { |
| | | if (params[key] !== '' && params[key] !== undefined && params[key] !== null) { |
| | | result[key] = Number(params[key]) |
| | | } |
| | | }) |
| | | if (params.status !== '' && params.status !== undefined && params.status !== null) { |
| | | result.status = Number(params.status) |
| | |
| | | return { |
| | | current: params.current || 1, |
| | | pageSize: params.pageSize || params.size || 20, |
| | | orderBy: normalizeText(params.orderBy) || 'create_time desc', |
| | | ...buildDeliverySearchParams(params) |
| | | } |
| | | } |
| | |
| | | 'splrBatch', |
| | | 'timeStart', |
| | | 'timeEnd', |
| | | 'memo' |
| | | 'memo', |
| | | 'fieldsIndex' |
| | | ].forEach((key) => { |
| | | const value = normalizeText(params[key]) |
| | | if (value) result[key] = value |
| | |
| | | return { |
| | | current: params.current || 1, |
| | | pageSize: params.pageSize || params.size || 20, |
| | | orderBy: normalizeText(params.orderBy) || 'create_time desc', |
| | | ...buildDeliveryItemSearchParams(params) |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function fetchDeleteDeliveryMany(ids) { |
| | | return request.post({ |
| | | url: `/delivery/remove/${normalizeIds(ids)}` |
| | | }) |
| | | } |
| | | |
| | | export function fetchSaveDelivery(payload = {}) { |
| | | return request.post({ |
| | | url: '/delivery/save', |
| | |
| | | return request.post({ |
| | | url: '/delivery/update', |
| | | params: payload |
| | | }) |
| | | } |
| | | |
| | | export function fetchImportDelivery(file) { |
| | | const formData = new FormData() |
| | | formData.append('file', file) |
| | | return request.post({ |
| | | url: '/delivery/import', |
| | | data: formData, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | export function fetchDeleteDeliveryItemMany(ids) { |
| | | return request.post({ |
| | | url: `/deliveryItem/remove/${normalizeIds(ids)}` |
| | | }) |
| | | } |
| | | |
| | | export function fetchSaveDeliveryItem(payload = {}) { |
| | | return request.post({ |
| | | url: '/deliveryItem/save', |
| | |
| | | body: JSON.stringify(buildDeliveryExportParams(payload)) |
| | | }) |
| | | } |
| | | |
| | | export async function fetchDownloadDeliveryTemplate(payload = {}, options = {}) { |
| | | return fetch(`${import.meta.env.VITE_API_URL}/delivery/template/download`, { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | ...(options.headers || {}) |
| | | }, |
| | | body: JSON.stringify(payload) |
| | | }) |
| | | } |