已复制25个文件
已添加204个文件
已重命名161个文件
已修改1个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace ErpWarehouseMappingApi { |
| | | /** ä»åºæ å° */ |
| | | export interface WarehouseMapping { |
| | | id?: number; // æ å°ç¼å· |
| | | erpWarehouseId: number; // ERPä»åºID |
| | | erpWarehouseName?: string; // ERPä»åºåç§° |
| | | mesWarehouseId: number; // MESä»åºID |
| | | mesWarehouseName?: string; // MESä»åºåç§° |
| | | status: number; // ç¶æ(0:ç¦ç¨ 1:å¯ç¨) |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** å页æ¥è¯¢æ å°å表 */ |
| | | export function getMappingPage(params: PageParam) { |
| | | return requestClient.get<PageResult<ErpWarehouseMappingApi.WarehouseMapping>>( |
| | | '/erp/warehouse-mapping/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** è·åå个æ å° */ |
| | | export function getMapping(id: number) { |
| | | return requestClient.get<ErpWarehouseMappingApi.WarehouseMapping>( |
| | | '/erp/warehouse-mapping/get', |
| | | { |
| | | params: { id }, |
| | | }, |
| | | ); |
| | | } |
| | | |
| | | /** è·åæ å°ç®åå表 */ |
| | | export function getMappingSimpleList() { |
| | | return requestClient.get<ErpWarehouseMappingApi.WarehouseMapping[]>( |
| | | '/erp/warehouse-mapping/simple-list', |
| | | ); |
| | | } |
| | | |
| | | /** æ ¹æ®ERPä»åºIDè·åMESä»åºæ å° */ |
| | | export function getMappingByErpWarehouseId(erpWarehouseId: number) { |
| | | return requestClient.get<ErpWarehouseMappingApi.WarehouseMapping>( |
| | | '/erp/warehouse-mapping/get-by-erp', |
| | | { |
| | | params: { erpWarehouseId }, |
| | | }, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢æ å° */ |
| | | export function createMapping(data: ErpWarehouseMappingApi.WarehouseMapping) { |
| | | return requestClient.post('/erp/warehouse-mapping/create', data); |
| | | } |
| | | |
| | | /** æ´æ°æ å° */ |
| | | export function updateMapping(data: ErpWarehouseMappingApi.WarehouseMapping) { |
| | | return requestClient.put('/erp/warehouse-mapping/update', data); |
| | | } |
| | | |
| | | /** å 餿 å° */ |
| | | export function deleteMapping(id: number) { |
| | | return requestClient.delete('/erp/warehouse-mapping/delete', { |
| | | params: { id }, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WmsApprovalApi { |
| | | /** 审æ¹é
ç½® */ |
| | | export interface ApprovalConfig { |
| | | id?: number; |
| | | warehouseId: number; |
| | | warehouseName?: string; |
| | | bizType: string; |
| | | approvalEnabled: boolean; |
| | | processDefinitionKey?: string; |
| | | processDefinitionName?: string; |
| | | categoryCode?: string; |
| | | createTime?: Date; |
| | | } |
| | | |
| | | /** æµç¨å®ä¹ç®åä¿¡æ¯ */ |
| | | export interface ProcessSimpleInfo { |
| | | key: string; |
| | | name: string; |
| | | } |
| | | |
| | | /** ä¸å¡ç±»å */ |
| | | export type BizType = 'INBOUND' | 'OUTBOUND' | 'TRANSFER' | 'CHECK'; |
| | | } |
| | | |
| | | /** è·åå个审æ¹é
ç½® */ |
| | | export function getApprovalConfig(warehouseId: number, bizType: string) { |
| | | return requestClient.get<WmsApprovalApi.ApprovalConfig>( |
| | | '/mes/wms/approval/config/get', |
| | | { |
| | | params: { warehouseId, bizType }, |
| | | }, |
| | | ); |
| | | } |
| | | |
| | | /** è·åä»åºææå®¡æ¹é
ç½® */ |
| | | export function getApprovalConfigList(warehouseId: number) { |
| | | return requestClient.get<WmsApprovalApi.ApprovalConfig[]>( |
| | | '/mes/wms/approval/config/list', |
| | | { |
| | | params: { warehouseId }, |
| | | }, |
| | | ); |
| | | } |
| | | |
| | | /** è·åææä»åºç审æ¹é
ç½®å表 */ |
| | | export function getApprovalConfigAllList() { |
| | | return requestClient.get<WmsApprovalApi.ApprovalConfig[]>( |
| | | '/mes/wms/approval/config/all-list', |
| | | ); |
| | | } |
| | | |
| | | /** ä¿å审æ¹é
ç½® */ |
| | | export function saveApprovalConfig(data: WmsApprovalApi.ApprovalConfig) { |
| | | return requestClient.post('/mes/wms/approval/config/save', data); |
| | | } |
| | | |
| | | /** è·åå¯ç¨å®¡æ¹æµç¨å表 */ |
| | | export function getAvailableProcessList(warehouseId: number, bizType: string) { |
| | | return requestClient.get<WmsApprovalApi.ProcessSimpleInfo[]>( |
| | | '/mes/wms/approval/process-list', |
| | | { |
| | | params: { warehouseId, bizType }, |
| | | }, |
| | | ); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsApprovalApi { |
| | | /** 审æ¹é
ç½® */ |
| | | export interface ApprovalConfig { |
| | | id?: number; |
| | | warehouseId: number; |
| | | warehouseName?: string; |
| | | bizType: string; |
| | | approvalEnabled: boolean; |
| | | processDefinitionKey?: string; |
| | | processDefinitionName?: string; |
| | | categoryCode?: string; |
| | | createTime?: Date; |
| | | } |
| | | |
| | | /** æµç¨å®ä¹ç®åä¿¡æ¯ */ |
| | | export interface ProcessSimpleInfo { |
| | | key: string; |
| | | name: string; |
| | | } |
| | | |
| | | /** ä¸å¡ç±»å */ |
| | | export type BizType = 'INBOUND' | 'OUTBOUND' | 'TRANSFER' | 'CHECK'; |
| | | } |
| | | |
| | | /** è·åå个审æ¹é
ç½® */ |
| | | export function getApprovalConfig(warehouseId: number, bizType: string) { |
| | | return requestClient.get<WlsApprovalApi.ApprovalConfig>( |
| | | '/mes/wm/approval/config/get', |
| | | { |
| | | params: { warehouseId, bizType }, |
| | | }, |
| | | ); |
| | | } |
| | | |
| | | /** è·åä»åºææå®¡æ¹é
ç½® */ |
| | | export function getApprovalConfigList(warehouseId: number) { |
| | | return requestClient.get<WlsApprovalApi.ApprovalConfig[]>( |
| | | '/mes/wm/approval/config/list', |
| | | { |
| | | params: { warehouseId }, |
| | | }, |
| | | ); |
| | | } |
| | | |
| | | /** è·åææä»åºç审æ¹é
ç½®å表 */ |
| | | export function getApprovalConfigAllList() { |
| | | return requestClient.get<WlsApprovalApi.ApprovalConfig[]>( |
| | | '/mes/wm/approval/config/all-list', |
| | | ); |
| | | } |
| | | |
| | | /** ä¿å审æ¹é
ç½® */ |
| | | export function saveApprovalConfig(data: WlsApprovalApi.ApprovalConfig) { |
| | | return requestClient.post('/mes/wm/approval/config/save', data); |
| | | } |
| | | |
| | | /** è·åå¯ç¨å®¡æ¹æµç¨å表 */ |
| | | export function getAvailableProcessList(warehouseId: number, bizType: string) { |
| | | return requestClient.get<WlsApprovalApi.ProcessSimpleInfo[]>( |
| | | '/mes/wm/approval/process-list', |
| | | { |
| | | params: { warehouseId, bizType }, |
| | | }, |
| | | ); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsArrivalNoticeApi { |
| | | /** MES å°è´§éç¥å */ |
| | | export interface ArrivalNotice { |
| | | id?: number; // éç¥åç¼å· |
| | | code?: string; // éç¥åç¼å· |
| | | name?: string; // éç¥ååç§° |
| | | purchaseOrderCode?: string; // éè´è®¢åç¼å· |
| | | vendorId?: number; // ä¾åºåç¼å· |
| | | vendorCode?: string; // ä¾åºåç¼ç |
| | | vendorName?: string; // ä¾åºååç§° |
| | | arrivalDate?: number; // å°è´§æ¥æ |
| | | contactName?: string; // è系人 |
| | | contactTelephone?: string; // èç³»æ¹å¼ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢å°è´§éç¥åå页 */ |
| | | export function getArrivalNoticePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsArrivalNoticeApi.ArrivalNotice>>( |
| | | '/mes/wm/arrival-notice/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢å°è´§éç¥å详æ
*/ |
| | | export function getArrivalNotice(id: number) { |
| | | return requestClient.get<WlsArrivalNoticeApi.ArrivalNotice>( |
| | | `/mes/wm/arrival-notice/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢å°è´§éç¥å */ |
| | | export function createArrivalNotice(data: WlsArrivalNoticeApi.ArrivalNotice) { |
| | | return requestClient.post<number>('/mes/wm/arrival-notice/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹å°è´§éç¥å */ |
| | | export function updateArrivalNotice(data: WlsArrivalNoticeApi.ArrivalNotice) { |
| | | return requestClient.put('/mes/wm/arrival-notice/update', data); |
| | | } |
| | | |
| | | /** å é¤å°è´§éç¥å */ |
| | | export function deleteArrivalNotice(id: number) { |
| | | return requestClient.delete(`/mes/wm/arrival-notice/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤å°è´§éç¥å */ |
| | | export function submitArrivalNotice(id: number) { |
| | | return requestClient.put(`/mes/wm/arrival-notice/submit?id=${id}`); |
| | | } |
| | | |
| | | /** 导åºå°è´§éç¥å */ |
| | | export function exportArrivalNotice(params: any) { |
| | | return requestClient.download('/mes/wm/arrival-notice/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsArrivalNoticeLineApi { |
| | | /** MES å°è´§éç¥åè¡ */ |
| | | export interface ArrivalNoticeLine { |
| | | id?: number; // è¡ç¼å· |
| | | noticeId?: number; // å°è´§éç¥åç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | arrivalQuantity?: number; // å°è´§æ°é |
| | | qualifiedQuantity?: number; // åæ ¼æ°é |
| | | iqcCheckFlag?: boolean; // æ¯å¦æ£éª |
| | | iqcId?: number; // æ¥ææ£éªåç¼å· |
| | | iqcCode?: string; // æ¥ææ£éªåç¼ç |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢å°è´§éç¥åè¡å页 */ |
| | | export function getArrivalNoticeLinePage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsArrivalNoticeLineApi.ArrivalNoticeLine> |
| | | >('/mes/wm/arrival-notice-line/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢å°è´§éç¥åè¡è¯¦æ
*/ |
| | | export function getArrivalNoticeLine(id: number) { |
| | | return requestClient.get<WlsArrivalNoticeLineApi.ArrivalNoticeLine>( |
| | | `/mes/wm/arrival-notice-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢å°è´§éç¥åè¡ */ |
| | | export function createArrivalNoticeLine( |
| | | data: WlsArrivalNoticeLineApi.ArrivalNoticeLine, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/arrival-notice-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹å°è´§éç¥åè¡ */ |
| | | export function updateArrivalNoticeLine( |
| | | data: WlsArrivalNoticeLineApi.ArrivalNoticeLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/arrival-notice-line/update', data); |
| | | } |
| | | |
| | | /** å é¤å°è´§éç¥åè¡ */ |
| | | export function deleteArrivalNoticeLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/arrival-notice-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsBarcodeConfigApi { |
| | | /** MES æ¡ç é
ç½® */ |
| | | export interface BarcodeConfig { |
| | | id?: number; // ç¼å· |
| | | format?: number; // æ¡ç æ ¼å¼ |
| | | bizType?: number; // ä¸å¡ç±»å |
| | | contentFormat?: string; // å
å®¹æ ¼å¼æ¨¡æ¿ |
| | | contentExample?: string; // å
å®¹æ ·ä¾ |
| | | autoGenerateFlag?: boolean; // æ¯å¦èªå¨çæ |
| | | defaultTemplate?: string; // é»è®¤æå°æ¨¡æ¿ |
| | | status?: number; // ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢æ¡ç é
ç½®å页 */ |
| | | export function getBarcodeConfigPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsBarcodeConfigApi.BarcodeConfig>>( |
| | | '/mes/wm/barcode-config/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢æ¡ç é
置详æ
*/ |
| | | export function getBarcodeConfig(id: number) { |
| | | return requestClient.get<WlsBarcodeConfigApi.BarcodeConfig>( |
| | | `/mes/wm/barcode-config/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢æ¡ç é
ç½® */ |
| | | export function createBarcodeConfig(data: WlsBarcodeConfigApi.BarcodeConfig) { |
| | | return requestClient.post('/mes/wm/barcode-config/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹æ¡ç é
ç½® */ |
| | | export function updateBarcodeConfig(data: WlsBarcodeConfigApi.BarcodeConfig) { |
| | | return requestClient.put('/mes/wm/barcode-config/update', data); |
| | | } |
| | | |
| | | /** å 餿¡ç é
ç½® */ |
| | | export function deleteBarcodeConfig(id: number) { |
| | | return requestClient.delete(`/mes/wm/barcode-config/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsBarcodeApi { |
| | | /** MES æ¡ç æ¸
å */ |
| | | export interface Barcode { |
| | | id?: number; // æ¡ç ç¼å· |
| | | configId?: number; // æ¡ç é
ç½®ç¼å· |
| | | format?: number; // æ¡ç æ ¼å¼ |
| | | bizType?: number; // ä¸å¡ç±»å |
| | | content?: string; // æ¡ç å
容 |
| | | bizId?: number; // ä¸å¡å¯¹è±¡ç¼å· |
| | | bizCode?: string; // ä¸å¡å¯¹è±¡ç¼ç |
| | | bizName?: string; // ä¸å¡å¯¹è±¡åç§° |
| | | status?: number; // ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢æ¡ç å页 */ |
| | | export function getBarcodePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsBarcodeApi.Barcode>>( |
| | | '/mes/wm/barcode/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢æ¡ç 详æ
*/ |
| | | export function getBarcode(id: number) { |
| | | return requestClient.get<WlsBarcodeApi.Barcode>( |
| | | `/mes/wm/barcode/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ ¹æ®ä¸å¡å¯¹è±¡è·åæ¡ç */ |
| | | export function getBarcodeByBusiness(bizType: number, bizId: number) { |
| | | return requestClient.get<WlsBarcodeApi.Barcode>( |
| | | '/mes/wm/barcode/get-by-business', |
| | | { params: { bizId, bizType } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢æ¡ç */ |
| | | export function createBarcode(data: WlsBarcodeApi.Barcode) { |
| | | return requestClient.post('/mes/wm/barcode/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹æ¡ç */ |
| | | export function updateBarcode(data: WlsBarcodeApi.Barcode) { |
| | | return requestClient.put('/mes/wm/barcode/update', data); |
| | | } |
| | | |
| | | /** å 餿¡ç */ |
| | | export function deleteBarcode(id: number) { |
| | | return requestClient.delete(`/mes/wm/barcode/delete?id=${id}`); |
| | | } |
| | | |
| | | /** å¯¼åºæ¡ç */ |
| | | export function exportBarcode(params: any) { |
| | | return requestClient.download('/mes/wm/barcode/export-excel', { params }); |
| | | } |
| | | |
| | | /** çææ¡ç å
容 */ |
| | | export function generateBarcodeContent(bizType: number, bizCode: string) { |
| | | return requestClient.get<string>('/mes/wm/barcode/generate-content', { |
| | | params: { bizCode, bizType }, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsBatchApi { |
| | | /** MES æ¹æ¬¡ */ |
| | | export interface Batch { |
| | | id?: number; // æ¹æ¬¡ ID |
| | | code?: string; // æ¹æ¬¡ç¼ç |
| | | itemId?: number; // ç©æ ID |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | itemSpecification?: string; // è§æ ¼åå· |
| | | unitName?: string; // åä½åç§° |
| | | produceDate?: Date; // çäº§æ¥æ |
| | | expireDate?: Date; // æææ |
| | | receiptDate?: Date; // å
¥åºæ¥æ |
| | | vendorId?: number; // ä¾åºå ID |
| | | vendorCode?: string; // ä¾åºåç¼ç |
| | | vendorName?: string; // ä¾åºååç§° |
| | | clientId?: number; // å®¢æ· ID |
| | | clientCode?: string; // 客æ·ç¼ç |
| | | clientName?: string; // 客æ·åç§° |
| | | purchaseOrderCode?: string; // éè´è®¢åç¼å· |
| | | salesOrderCode?: string; // éå®è®¢åç¼å· |
| | | workOrderId?: number; // ç产订å ID |
| | | workOrderCode?: string; // ç产订åç¼å· |
| | | taskId?: number; // çäº§ä»»å¡ ID |
| | | taskCode?: string; // ç产任å¡ç¼å· |
| | | workstationId?: number; // å·¥ä½ç« ID |
| | | workstationCode?: string; // å·¥ä½ç«ç¼ç |
| | | toolId?: number; // å·¥å
· ID |
| | | toolCode?: string; // å·¥å
·ç¼å· |
| | | moldId?: number; // 模å
· ID |
| | | lotNumber?: string; // ç产æ¹å· |
| | | qualityStatus?: number; // è´¨éç¶æ |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | |
| | | /** MES æ¹æ¬¡å页æ¥è¯¢åæ° */ |
| | | export interface PageParams extends PageParam { |
| | | code?: string; // æ¹æ¬¡å· |
| | | itemId?: number; // ç©æç¼å· |
| | | vendorId?: number; // ä¾åºåç¼å· |
| | | clientId?: number; // 客æ·ç¼å· |
| | | workOrderId?: number; // 订åç¼å· |
| | | taskId?: number; // ç产任å¡ç¼å· |
| | | workstationId?: number; // å·¥ä½ç«ç¼å· |
| | | toolId?: number; // å·¥å
·ç¼å· |
| | | moldId?: number; // 模å
·ç¼å· |
| | | salesOrderCode?: string; // éå®è®¢åå· |
| | | purchaseOrderCode?: string; // éè´è®¢åå· |
| | | lotNumber?: string; // æ¹å· |
| | | qualityStatus?: number; // è´¨éç¶æ |
| | | produceDate?: string[]; // çäº§æ¥æ |
| | | expireDate?: string[]; // è¿ææ¥æ |
| | | receiptDate?: string[]; // å
¥åºæ¥æ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢æ¹æ¬¡è¯¦æ
*/ |
| | | export function getBatch(id: number) { |
| | | return requestClient.get<WlsBatchApi.Batch>(`/mes/wm/batch/get?id=${id}`); |
| | | } |
| | | |
| | | /** æ¥è¯¢æ¹æ¬¡å页 */ |
| | | export function getBatchPage(params: WlsBatchApi.PageParams) { |
| | | return requestClient.get<PageResult<WlsBatchApi.Batch>>( |
| | | '/mes/wm/batch/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¹æ¬¡åå追溯 */ |
| | | export function getForwardBatchList(code: string) { |
| | | return requestClient.get<WlsBatchApi.Batch[]>( |
| | | '/mes/wm/batch/forward-list', |
| | | { |
| | | params: { code }, |
| | | }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¹æ¬¡åå追溯 */ |
| | | export function getBackwardBatchList(code: string) { |
| | | return requestClient.get<WlsBatchApi.Batch[]>( |
| | | '/mes/wm/batch/backward-list', |
| | | { params: { code } }, |
| | | ); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsItemConsumeLineApi { |
| | | /** MES ç©ææ¶èè¡ */ |
| | | export interface ItemConsumeLine { |
| | | id?: number; |
| | | feedbackId?: number; // æ¥å·¥ç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©èµç¼ç |
| | | itemName?: string; // ç©èµåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitId?: number; // åä½ç¼å· |
| | | unitName?: string; // åä½ |
| | | quantity?: number; // æ¶èæ°é |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | locationId?: number; // åºä½ç¼å· |
| | | locationName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | |
| | | /** MES ç©ææ¶èè¡å页æ¥è¯¢åæ° */ |
| | | export interface PageParams extends PageParam { |
| | | feedbackId?: number; |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢ç©ææ¶èè¡å页 */ |
| | | export function getItemConsumeLinePage( |
| | | params: WlsItemConsumeLineApi.PageParams, |
| | | ) { |
| | | return requestClient.get<PageResult<WlsItemConsumeLineApi.ItemConsumeLine>>( |
| | | '/mes/wm/item-consume-line/page', |
| | | { params }, |
| | | ); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsItemReceiptDetailApi { |
| | | /** MES éè´å
¥åºæç» */ |
| | | export interface ItemReceiptDetail { |
| | | id?: number; // æç»ç¼å· |
| | | lineId?: number; // å
¥åºåè¡ç¼å· |
| | | receiptId?: number; // å
¥åºåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | quantity?: number; // æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢éè´å
¥åºæç»åè¡¨ï¼æè¡ç¼å·ï¼ */ |
| | | export function getItemReceiptDetailListByLineId(lineId: number) { |
| | | return requestClient.get<WlsItemReceiptDetailApi.ItemReceiptDetail[]>( |
| | | '/mes/wm/item-receipt-detail/list-by-line', |
| | | { params: { lineId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢éè´å
¥åºæç»è¯¦æ
*/ |
| | | export function getItemReceiptDetail(id: number) { |
| | | return requestClient.get<WlsItemReceiptDetailApi.ItemReceiptDetail>( |
| | | `/mes/wm/item-receipt-detail/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢éè´å
¥åºæç» */ |
| | | export function createItemReceiptDetail( |
| | | data: WlsItemReceiptDetailApi.ItemReceiptDetail, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/item-receipt-detail/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹éè´å
¥åºæç» */ |
| | | export function updateItemReceiptDetail( |
| | | data: WlsItemReceiptDetailApi.ItemReceiptDetail, |
| | | ) { |
| | | return requestClient.put('/mes/wm/item-receipt-detail/update', data); |
| | | } |
| | | |
| | | /** å é¤éè´å
¥åºæç» */ |
| | | export function deleteItemReceiptDetail(id: number) { |
| | | return requestClient.delete(`/mes/wm/item-receipt-detail/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsItemReceiptApi { |
| | | /** MES éè´å
¥åºå */ |
| | | export interface ItemReceipt { |
| | | id?: number; // å
¥åºåç¼å· |
| | | code?: string; // å
¥åºåç¼ç |
| | | name?: string; // å
¥åºååç§° |
| | | iqcId?: number; // æ¥ææ£éªåç¼å· |
| | | iqcCode?: string; // æ¥ææ£éªåç¼ç |
| | | noticeId?: number; // å°è´§éç¥åç¼å· |
| | | noticeCode?: string; // å°è´§éç¥åç¼ç |
| | | purchaseOrderCode?: string; // éè´è®¢åå· |
| | | vendorId?: number; // ä¾åºåç¼å· |
| | | vendorName?: string; // ä¾åºååç§° |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | receiptDate?: number; // å
¥åºæ¥æ |
| | | status?: number; // ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢éè´å
¥åºåå页 */ |
| | | export function getItemReceiptPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsItemReceiptApi.ItemReceipt>>( |
| | | '/mes/wm/item-receipt/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢éè´å
¥åºå详æ
*/ |
| | | export function getItemReceipt(id: number) { |
| | | return requestClient.get<WlsItemReceiptApi.ItemReceipt>( |
| | | `/mes/wm/item-receipt/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢éè´å
¥åºå */ |
| | | export function createItemReceipt(data: WlsItemReceiptApi.ItemReceipt) { |
| | | return requestClient.post<number>('/mes/wm/item-receipt/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹éè´å
¥åºå */ |
| | | export function updateItemReceipt(data: WlsItemReceiptApi.ItemReceipt) { |
| | | return requestClient.put('/mes/wm/item-receipt/update', data); |
| | | } |
| | | |
| | | /** å é¤éè´å
¥åºå */ |
| | | export function deleteItemReceipt(id: number) { |
| | | return requestClient.delete(`/mes/wm/item-receipt/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤éè´å
¥åºå */ |
| | | export function submitItemReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/item-receipt/submit?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ */ |
| | | export function stockItemReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/item-receipt/stock?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡å
¥åº */ |
| | | export function finishItemReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/item-receipt/finish?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶éè´å
¥åºå */ |
| | | export function cancelItemReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/item-receipt/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** 导åºéè´å
¥åºå */ |
| | | export function exportItemReceipt(params: any) { |
| | | return requestClient.download('/mes/wm/item-receipt/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsItemReceiptLineApi { |
| | | /** MES éè´å
¥åºåè¡ */ |
| | | export interface ItemReceiptLine { |
| | | id?: number; // è¡ç¼å· |
| | | receiptId?: number; // å
¥åºåç¼å· |
| | | receiptCode?: string; // å
¥åºåç¼ç |
| | | arrivalNoticeLineId?: number; // å°è´§éç¥åè¡ç¼å· |
| | | purchaseOrderCode?: string; // éè´è®¢åå· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | receivedQuantity?: number; // å
¥åºæ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | productionDate?: number; // çäº§æ¥æ |
| | | expireDate?: number; // æææ |
| | | lotNumber?: string; // ç产æ¹å· |
| | | iqcCheckFlag?: boolean; // æ¯å¦æ£éª |
| | | iqcId?: number; // æ¥ææ£éªåç¼å· |
| | | iqcCode?: string; // æ¥ææ£éªåç¼ç |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢éè´å
¥åºåè¡å页 */ |
| | | export function getItemReceiptLinePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsItemReceiptLineApi.ItemReceiptLine>>( |
| | | '/mes/wm/item-receipt-line/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢éè´å
¥åºåè¡è¯¦æ
*/ |
| | | export function getItemReceiptLine(id: number) { |
| | | return requestClient.get<WlsItemReceiptLineApi.ItemReceiptLine>( |
| | | `/mes/wm/item-receipt-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢éè´å
¥åºåè¡ */ |
| | | export function createItemReceiptLine( |
| | | data: WlsItemReceiptLineApi.ItemReceiptLine, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/item-receipt-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹éè´å
¥åºåè¡ */ |
| | | export function updateItemReceiptLine( |
| | | data: WlsItemReceiptLineApi.ItemReceiptLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/item-receipt-line/update', data); |
| | | } |
| | | |
| | | /** å é¤éè´å
¥åºåè¡ */ |
| | | export function deleteItemReceiptLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/item-receipt-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsMaterialStockApi { |
| | | /** MES åºåå°è´¦ */ |
| | | export interface MaterialStock { |
| | | id?: number; // ç¼å· |
| | | itemTypeId?: number; // ç©æåç±»ç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // 计éåä½åç§° |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseCode?: string; // ä»åºç¼ç |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | vendorId?: number; // ä¾åºåç¼å· |
| | | vendorName?: string; // ä¾åºååç§° |
| | | quantity?: number; // å¨åºæ°é |
| | | receiptTime?: string; // å
¥åºæ¥æ |
| | | frozen?: boolean; // æ¯å¦å»ç» |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢åºåå°è´¦å页 */ |
| | | export function getMaterialStockPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsMaterialStockApi.MaterialStock>>( |
| | | '/mes/wm/material-stock/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢åºåå°è´¦è¯¦æ
*/ |
| | | export function getMaterialStock(id: number) { |
| | | return requestClient.get<WlsMaterialStockApi.MaterialStock>( |
| | | `/mes/wm/material-stock/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ´æ°åºåå»ç»ç¶æ */ |
| | | export function updateMaterialStockFrozen(data: { |
| | | frozen: boolean; |
| | | id: number; |
| | | }) { |
| | | return requestClient.put('/mes/wm/material-stock/update-frozen', data); |
| | | } |
| | | |
| | | /** 导åºåºåå°è´¦ */ |
| | | export function exportMaterialStock(params: any) { |
| | | return requestClient.download('/mes/wm/material-stock/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsMiscIssueApi { |
| | | /** MES æé¡¹åºåºå */ |
| | | export interface MiscIssue { |
| | | id?: number; // ç¼å· |
| | | code?: string; // åºåºåç¼å· |
| | | name?: string; // åºåºååç§° |
| | | type?: number; // ä¸å¡ç±»å |
| | | sourceDocType?: string; // æ¥æºåæ®ç±»å |
| | | sourceDocId?: number; // æ¥æºåæ®ç¼å· |
| | | sourceDocCode?: string; // æ¥æºåæ®ç¼ç |
| | | issueDate?: number; // åºåºæ¥æ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢æé¡¹åºåºåå页 */ |
| | | export function getMiscIssuePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsMiscIssueApi.MiscIssue>>( |
| | | '/mes/wm/misc-issue/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢æé¡¹åºåºå详æ
*/ |
| | | export function getMiscIssue(id: number) { |
| | | return requestClient.get<WlsMiscIssueApi.MiscIssue>( |
| | | `/mes/wm/misc-issue/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢æé¡¹åºåºå */ |
| | | export function createMiscIssue(data: WlsMiscIssueApi.MiscIssue) { |
| | | return requestClient.post<number>('/mes/wm/misc-issue/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹æé¡¹åºåºå */ |
| | | export function updateMiscIssue(data: WlsMiscIssueApi.MiscIssue) { |
| | | return requestClient.put('/mes/wm/misc-issue/update', data); |
| | | } |
| | | |
| | | /** å 餿项åºåºå */ |
| | | export function deleteMiscIssue(id: number) { |
| | | return requestClient.delete(`/mes/wm/misc-issue/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤æé¡¹åºåºå */ |
| | | export function submitMiscIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/misc-issue/submit?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡åºåº */ |
| | | export function finishMiscIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/misc-issue/finish?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶æé¡¹åºåºå */ |
| | | export function cancelMiscIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/misc-issue/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** å¯¼åºæé¡¹åºåºå */ |
| | | export function exportMiscIssue(params: any) { |
| | | return requestClient.download('/mes/wm/misc-issue/export-excel', { params }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsMiscIssueLineApi { |
| | | /** MES æé¡¹åºåºåè¡ */ |
| | | export interface MiscIssueLine { |
| | | id?: number; // ç¼å· |
| | | issueId?: number; // åºåºåç¼å· |
| | | sourceDocLineId?: number; // æ¥æºåæ®è¡ç¼å· |
| | | materialStockId?: number; // åºåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasure?: string; // 计éåä½ |
| | | unitMeasureName?: string; // 计éåä½åç§° |
| | | quantity?: number; // åºåºæ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseCode?: string; // ä»åºç¼ç |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationCode?: string; // åºåºç¼ç |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaCode?: string; // åºä½ç¼ç |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | quantityMax?: number; // å¯åºåºæå¤§æ°éï¼å端ç¨äºéå¶åºåºæ°éï¼åèªåºåå¨åºæ°éï¼ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢æé¡¹åºåºåè¡å页 */ |
| | | export function getMiscIssueLinePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsMiscIssueLineApi.MiscIssueLine>>( |
| | | '/mes/wm/misc-issue-line/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢æé¡¹åºåºåè¡å表 */ |
| | | export function getMiscIssueLineListByIssueId(issueId: number) { |
| | | return requestClient.get<WlsMiscIssueLineApi.MiscIssueLine[]>( |
| | | `/mes/wm/misc-issue-line/list-by-issue-id?issueId=${issueId}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢æé¡¹åºåºåè¡è¯¦æ
*/ |
| | | export function getMiscIssueLine(id: number) { |
| | | return requestClient.get<WlsMiscIssueLineApi.MiscIssueLine>( |
| | | `/mes/wm/misc-issue-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢æé¡¹åºåºåè¡ */ |
| | | export function createMiscIssueLine(data: WlsMiscIssueLineApi.MiscIssueLine) { |
| | | return requestClient.post('/mes/wm/misc-issue-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹æé¡¹åºåºåè¡ */ |
| | | export function updateMiscIssueLine(data: WlsMiscIssueLineApi.MiscIssueLine) { |
| | | return requestClient.put('/mes/wm/misc-issue-line/update', data); |
| | | } |
| | | |
| | | /** å 餿项åºåºåè¡ */ |
| | | export function deleteMiscIssueLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/misc-issue-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsMiscReceiptApi { |
| | | /** MES æé¡¹å
¥åºå */ |
| | | export interface MiscReceipt { |
| | | id?: number; // ç¼å· |
| | | code?: string; // å
¥åºåç¼å· |
| | | name?: string; // å
¥åºååç§° |
| | | type?: number; // æé¡¹ç±»å |
| | | sourceDocType?: string; // æ¥æºåæ®ç±»å |
| | | sourceDocId?: number; // æ¥æºåæ®ç¼å· |
| | | sourceDocCode?: string; // æ¥æºåæ®ç¼ç |
| | | receiptDate?: number; // å
¥åºæ¥æ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢æé¡¹å
¥åºåå页 */ |
| | | export function getMiscReceiptPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsMiscReceiptApi.MiscReceipt>>( |
| | | '/mes/wm/misc-receipt/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢æé¡¹å
¥åºå详æ
*/ |
| | | export function getMiscReceipt(id: number) { |
| | | return requestClient.get<WlsMiscReceiptApi.MiscReceipt>( |
| | | `/mes/wm/misc-receipt/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢æé¡¹å
¥åºå */ |
| | | export function createMiscReceipt(data: WlsMiscReceiptApi.MiscReceipt) { |
| | | return requestClient.post<number>('/mes/wm/misc-receipt/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹æé¡¹å
¥åºå */ |
| | | export function updateMiscReceipt(data: WlsMiscReceiptApi.MiscReceipt) { |
| | | return requestClient.put('/mes/wm/misc-receipt/update', data); |
| | | } |
| | | |
| | | /** å 餿项å
¥åºå */ |
| | | export function deleteMiscReceipt(id: number) { |
| | | return requestClient.delete(`/mes/wm/misc-receipt/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤æé¡¹å
¥åºå */ |
| | | export function submitMiscReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/misc-receipt/submit?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡å
¥åº */ |
| | | export function finishMiscReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/misc-receipt/finish?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶æé¡¹å
¥åºå */ |
| | | export function cancelMiscReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/misc-receipt/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** å¯¼åºæé¡¹å
¥åºå */ |
| | | export function exportMiscReceipt(params: any) { |
| | | return requestClient.download('/mes/wm/misc-receipt/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsMiscReceiptLineApi { |
| | | /** MES æé¡¹å
¥åºåè¡ */ |
| | | export interface MiscReceiptLine { |
| | | id?: number; // ç¼å· |
| | | receiptId?: number; // å
¥åºåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // 计éåä½åç§° |
| | | quantity?: number; // å
¥åºæ°é |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢æé¡¹å
¥åºåè¡å表 */ |
| | | export function getMiscReceiptLineListByReceiptId(receiptId: number) { |
| | | return requestClient.get<WlsMiscReceiptLineApi.MiscReceiptLine[]>( |
| | | `/mes/wm/misc-receipt-line/list-by-receipt-id?receiptId=${receiptId}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢æé¡¹å
¥åºåè¡è¯¦æ
*/ |
| | | export function getMiscReceiptLine(id: number) { |
| | | return requestClient.get<WlsMiscReceiptLineApi.MiscReceiptLine>( |
| | | `/mes/wm/misc-receipt-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢æé¡¹å
¥åºåè¡ */ |
| | | export function createMiscReceiptLine( |
| | | data: WlsMiscReceiptLineApi.MiscReceiptLine, |
| | | ) { |
| | | return requestClient.post('/mes/wm/misc-receipt-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹æé¡¹å
¥åºåè¡ */ |
| | | export function updateMiscReceiptLine( |
| | | data: WlsMiscReceiptLineApi.MiscReceiptLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/misc-receipt-line/update', data); |
| | | } |
| | | |
| | | /** å 餿项å
¥åºåè¡ */ |
| | | export function deleteMiscReceiptLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/misc-receipt-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsOutsourceIssueDetailApi { |
| | | /** MES å¤ååæåæç» */ |
| | | export interface OutsourceIssueDetail { |
| | | id?: number; // æç»ç¼å· |
| | | lineId?: number; // è¡ç¼å· |
| | | issueId?: number; // åæåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // 计éåä½åç§° |
| | | quantity?: number; // æ°é |
| | | materialStockId?: number; // åºåç¼å· |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡ç¼ç |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤ååæåæç»å表 */ |
| | | export function getOutsourceIssueDetailListByLineId(lineId: number) { |
| | | return requestClient.get<WlsOutsourceIssueDetailApi.OutsourceIssueDetail[]>( |
| | | '/mes/wm/outsource-issue-detail/list-by-line', |
| | | { params: { lineId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤ååæåæç»è¯¦æ
*/ |
| | | export function getOutsourceIssueDetail(id: number) { |
| | | return requestClient.get<WlsOutsourceIssueDetailApi.OutsourceIssueDetail>( |
| | | `/mes/wm/outsource-issue-detail/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢å¤ååæåæç» */ |
| | | export function createOutsourceIssueDetail( |
| | | data: WlsOutsourceIssueDetailApi.OutsourceIssueDetail, |
| | | ) { |
| | | return requestClient.post('/mes/wm/outsource-issue-detail/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹å¤ååæåæç» */ |
| | | export function updateOutsourceIssueDetail( |
| | | data: WlsOutsourceIssueDetailApi.OutsourceIssueDetail, |
| | | ) { |
| | | return requestClient.put('/mes/wm/outsource-issue-detail/update', data); |
| | | } |
| | | |
| | | /** å é¤å¤ååæåæç» */ |
| | | export function deleteOutsourceIssueDetail(id: number) { |
| | | return requestClient.delete(`/mes/wm/outsource-issue-detail/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsOutsourceIssueApi { |
| | | /** MES å¤ååæå */ |
| | | export interface OutsourceIssue { |
| | | id?: number; // åæåç¼å· |
| | | code?: string; // åæåç¼å· |
| | | name?: string; // åæååç§° |
| | | vendorId?: number; // ä¾åºåç¼å· |
| | | vendorCode?: string; // ä¾åºåç¼ç |
| | | vendorName?: string; // ä¾åºååç§° |
| | | workOrderId?: number; // ç产订åç¼å· |
| | | workOrderCode?: string; // ç产订åç¼ç |
| | | workOrderName?: string; // ç产订ååç§° |
| | | issueDate?: number; // åææ¥æ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤ååæåå页 */ |
| | | export function getOutsourceIssuePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsOutsourceIssueApi.OutsourceIssue>>( |
| | | '/mes/wm/outsource-issue/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤ååæå详æ
*/ |
| | | export function getOutsourceIssue(id: number) { |
| | | return requestClient.get<WlsOutsourceIssueApi.OutsourceIssue>( |
| | | `/mes/wm/outsource-issue/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢å¤ååæå */ |
| | | export function createOutsourceIssue( |
| | | data: WlsOutsourceIssueApi.OutsourceIssue, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/outsource-issue/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹å¤ååæå */ |
| | | export function updateOutsourceIssue( |
| | | data: WlsOutsourceIssueApi.OutsourceIssue, |
| | | ) { |
| | | return requestClient.put('/mes/wm/outsource-issue/update', data); |
| | | } |
| | | |
| | | /** å é¤å¤ååæå */ |
| | | export function deleteOutsourceIssue(id: number) { |
| | | return requestClient.delete(`/mes/wm/outsource-issue/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤å¤ååæå */ |
| | | export function submitOutsourceIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/outsource-issue/submit?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡æ£è´§ */ |
| | | export function stockOutsourceIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/outsource-issue/stock?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡é¢åº */ |
| | | export function finishOutsourceIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/outsource-issue/finish?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶å¤ååæå */ |
| | | export function cancelOutsourceIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/outsource-issue/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** æ ¡éªå¤ååæåæ£è´§æ°éæ¯å¦ä¸åææ°éä¸è´ */ |
| | | export function checkOutsourceIssueQuantity(id: number) { |
| | | return requestClient.get<boolean>( |
| | | `/mes/wm/outsource-issue/check-quantity?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** 导åºå¤ååæå */ |
| | | export function exportOutsourceIssue(params: any) { |
| | | return requestClient.download('/mes/wm/outsource-issue/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsOutsourceIssueLineApi { |
| | | /** MES å¤ååæåè¡ */ |
| | | export interface OutsourceIssueLine { |
| | | id?: number; // è¡ç¼å· |
| | | issueId?: number; // åæåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // 计éåä½åç§° |
| | | quantity?: number; // åææ°é |
| | | materialStockId?: number; // åºåç¼å· |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡ç¼ç |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤ååæåè¡å页 */ |
| | | export function getOutsourceIssueLinePage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsOutsourceIssueLineApi.OutsourceIssueLine> |
| | | >('/mes/wm/outsource-issue-line/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤ååæåè¡è¯¦æ
*/ |
| | | export function getOutsourceIssueLine(id: number) { |
| | | return requestClient.get<WlsOutsourceIssueLineApi.OutsourceIssueLine>( |
| | | `/mes/wm/outsource-issue-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢å¤ååæåè¡ */ |
| | | export function createOutsourceIssueLine( |
| | | data: WlsOutsourceIssueLineApi.OutsourceIssueLine, |
| | | ) { |
| | | return requestClient.post('/mes/wm/outsource-issue-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹å¤ååæåè¡ */ |
| | | export function updateOutsourceIssueLine( |
| | | data: WlsOutsourceIssueLineApi.OutsourceIssueLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/outsource-issue-line/update', data); |
| | | } |
| | | |
| | | /** å é¤å¤ååæåè¡ */ |
| | | export function deleteOutsourceIssueLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/outsource-issue-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsOutsourceReceiptDetailApi { |
| | | /** MES å¤åå
¥åºåæç» */ |
| | | export interface OutsourceReceiptDetail { |
| | | id?: number; // æç»ç¼å· |
| | | lineId?: number; // è¡ç¼å· |
| | | receiptId?: number; // å
¥åºåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // 计éåä½åç§° |
| | | quantity?: number; // 䏿¶æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡ç¼ç |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤åå
¥åºåæç»å表 */ |
| | | export function getOutsourceReceiptDetailListByLineId(lineId: number) { |
| | | return requestClient.get< |
| | | WlsOutsourceReceiptDetailApi.OutsourceReceiptDetail[] |
| | | >('/mes/wm/outsource-receipt-detail/list-by-line', { params: { lineId } }); |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤åå
¥åºåæç»è¯¦æ
*/ |
| | | export function getOutsourceReceiptDetail(id: number) { |
| | | return requestClient.get<WlsOutsourceReceiptDetailApi.OutsourceReceiptDetail>( |
| | | `/mes/wm/outsource-receipt-detail/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢å¤åå
¥åºåæç» */ |
| | | export function createOutsourceReceiptDetail( |
| | | data: WlsOutsourceReceiptDetailApi.OutsourceReceiptDetail, |
| | | ) { |
| | | return requestClient.post('/mes/wm/outsource-receipt-detail/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹å¤åå
¥åºåæç» */ |
| | | export function updateOutsourceReceiptDetail( |
| | | data: WlsOutsourceReceiptDetailApi.OutsourceReceiptDetail, |
| | | ) { |
| | | return requestClient.put('/mes/wm/outsource-receipt-detail/update', data); |
| | | } |
| | | |
| | | /** å é¤å¤åå
¥åºåæç» */ |
| | | export function deleteOutsourceReceiptDetail(id: number) { |
| | | return requestClient.delete( |
| | | `/mes/wm/outsource-receipt-detail/delete?id=${id}`, |
| | | ); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsOutsourceReceiptApi { |
| | | /** MES å¤åå
¥åºå */ |
| | | export interface OutsourceReceipt { |
| | | id?: number; // å
¥åºåç¼å· |
| | | code?: string; // å
¥åºåç¼ç |
| | | name?: string; // å
¥åºååç§° |
| | | workOrderId?: number; // å¤å订åç¼å· |
| | | workOrderCode?: string; // å¤å订åç¼ç |
| | | vendorId?: number; // ä¾åºåç¼å· |
| | | vendorName?: string; // ä¾åºååç§° |
| | | receiptDate?: number; // å
¥åºæ¥æ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤åå
¥åºåå页 */ |
| | | export function getOutsourceReceiptPage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsOutsourceReceiptApi.OutsourceReceipt> |
| | | >('/mes/wm/outsource-receipt/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤åå
¥åºå详æ
*/ |
| | | export function getOutsourceReceipt(id: number) { |
| | | return requestClient.get<WlsOutsourceReceiptApi.OutsourceReceipt>( |
| | | `/mes/wm/outsource-receipt/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢å¤åå
¥åºå */ |
| | | export function createOutsourceReceipt( |
| | | data: WlsOutsourceReceiptApi.OutsourceReceipt, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/outsource-receipt/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹å¤åå
¥åºå */ |
| | | export function updateOutsourceReceipt( |
| | | data: WlsOutsourceReceiptApi.OutsourceReceipt, |
| | | ) { |
| | | return requestClient.put('/mes/wm/outsource-receipt/update', data); |
| | | } |
| | | |
| | | /** å é¤å¤åå
¥åºå */ |
| | | export function deleteOutsourceReceipt(id: number) { |
| | | return requestClient.delete(`/mes/wm/outsource-receipt/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤å¤åå
¥åºå */ |
| | | export function submitOutsourceReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/outsource-receipt/submit?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ */ |
| | | export function stockOutsourceReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/outsource-receipt/stock?id=${id}`); |
| | | } |
| | | |
| | | /** 宿å
¥åº */ |
| | | export function finishOutsourceReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/outsource-receipt/finish?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶å¤åå
¥åºå */ |
| | | export function cancelOutsourceReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/outsource-receipt/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** 导åºå¤åå
¥åºå */ |
| | | export function exportOutsourceReceipt(params: any) { |
| | | return requestClient.download('/mes/wm/outsource-receipt/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsOutsourceReceiptLineApi { |
| | | /** MES å¤åå
¥åºåè¡ */ |
| | | export interface OutsourceReceiptLine { |
| | | id?: number; // è¡ç¼å· |
| | | receiptId?: number; // å
¥åºåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // 计éåä½åç§° |
| | | quantity?: number; // å
¥åºæ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡ç¼ç |
| | | productionDate?: number; // çäº§æ¥æ |
| | | expireDate?: number; // æææ |
| | | lotNumber?: string; // ç产æ¹å· |
| | | iqcCheckFlag?: boolean; // æ¯å¦éè¦è´¨æ£ |
| | | qualityStatus?: number; // è´¨éç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤åå
¥åºåè¡å页 */ |
| | | export function getOutsourceReceiptLinePage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsOutsourceReceiptLineApi.OutsourceReceiptLine> |
| | | >('/mes/wm/outsource-receipt-line/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢å¤åå
¥åºåè¡è¯¦æ
*/ |
| | | export function getOutsourceReceiptLine(id: number) { |
| | | return requestClient.get<WlsOutsourceReceiptLineApi.OutsourceReceiptLine>( |
| | | `/mes/wm/outsource-receipt-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢å¤åå
¥åºåè¡ */ |
| | | export function createOutsourceReceiptLine( |
| | | data: WlsOutsourceReceiptLineApi.OutsourceReceiptLine, |
| | | ) { |
| | | return requestClient.post('/mes/wm/outsource-receipt-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹å¤åå
¥åºåè¡ */ |
| | | export function updateOutsourceReceiptLine( |
| | | data: WlsOutsourceReceiptLineApi.OutsourceReceiptLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/outsource-receipt-line/update', data); |
| | | } |
| | | |
| | | /** å é¤å¤åå
¥åºåè¡ */ |
| | | export function deleteOutsourceReceiptLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/outsource-receipt-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsPackageApi { |
| | | /** è£
ç®±å */ |
| | | export interface Package { |
| | | id?: number; // è£
ç®±åç¼å· |
| | | code?: string; // è£
ç®±åç¼ç |
| | | parentId?: number; // ç¶ç®±ç¼å· |
| | | packageDate?: number; // è£
ç®±æ¥æ |
| | | salesOrderCode?: string; // éå®è®¢åç¼å· |
| | | invoiceCode?: string; // å票ç¼å· |
| | | clientId?: number; // 客æ·ç¼å· |
| | | clientCode?: string; // 客æ·ç¼ç |
| | | clientName?: string; // 客æ·åç§° |
| | | clientNickname?: string; // 客æ·ç®ç§° |
| | | length?: number; // ç®±é¿åº¦ |
| | | width?: number; // 箱宽度 |
| | | height?: number; // ç®±é«åº¦ |
| | | sizeUnitId?: number; // 尺寸åä½ç¼å· |
| | | sizeUnitName?: string; // 尺寸åä½åç§° |
| | | netWeight?: number; // åé |
| | | grossWeight?: number; // æ¯é |
| | | weightUnitId?: number; // ééåä½ç¼å· |
| | | weightUnitName?: string; // ééåä½åç§° |
| | | inspectorUserId?: number; // æ£æ¥åç¨æ·ç¼å· |
| | | inspectorName?: string; // æ£æ¥ååç§° |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: string; // å建æ¶é´ |
| | | children?: Package[]; // åç®±å表 |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢è£
ç®±åå页 */ |
| | | export function getPackagePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsPackageApi.Package>>( |
| | | '/mes/wm/package/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢è£
ç®±å详æ
*/ |
| | | export function getPackage(id: number) { |
| | | return requestClient.get<WlsPackageApi.Package>( |
| | | `/mes/wm/package/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢è£
ç®±å */ |
| | | export function createPackage(data: WlsPackageApi.Package) { |
| | | return requestClient.post<number>('/mes/wm/package/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹è£
ç®±å */ |
| | | export function updatePackage(data: WlsPackageApi.Package) { |
| | | return requestClient.put('/mes/wm/package/update', data); |
| | | } |
| | | |
| | | /** å é¤è£
ç®±å */ |
| | | export function deletePackage(id: number) { |
| | | return requestClient.delete(`/mes/wm/package/delete?id=${id}`); |
| | | } |
| | | |
| | | /** 宿è£
ç®±å */ |
| | | export function finishPackage(id: number) { |
| | | return requestClient.put(`/mes/wm/package/finish?id=${id}`); |
| | | } |
| | | |
| | | /** æ·»å åç®± */ |
| | | export function addChildPackage(parentId: number, childId: number) { |
| | | return requestClient.put('/mes/wm/package/add-child-package', null, { |
| | | params: { childId, parentId }, |
| | | }); |
| | | } |
| | | |
| | | /** ç§»é¤åç®± */ |
| | | export function removeChildPackage(childId: number) { |
| | | return requestClient.put( |
| | | `/mes/wm/package/remove-child-package?childId=${childId}`, |
| | | ); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsPackageLineApi { |
| | | /** è£
ç®±æç» */ |
| | | export interface PackageLine { |
| | | id?: number; // è£
ç®±æç»ç¼å· |
| | | packageId?: number; // è£
ç®±åç¼å· |
| | | materialStockId?: number; // åºåç¼å· |
| | | itemId?: number; // 产åç©æç¼å· |
| | | itemCode?: string; // 产åç©æç¼ç |
| | | itemName?: string; // 产åç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // 计éåä½åç§° |
| | | quantity?: number; // è£
ç®±æ°é |
| | | workOrderId?: number; // ç产订åç¼å· |
| | | workOrderCode?: string; // ç产订åç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | expireDate?: number; // æææ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: string; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢è£
ç®±æç»å页 */ |
| | | export function getPackageLinePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsPackageLineApi.PackageLine>>( |
| | | '/mes/wm/package-line/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢è£
ç®±æç»è¯¦æ
*/ |
| | | export function getPackageLine(id: number) { |
| | | return requestClient.get<WlsPackageLineApi.PackageLine>( |
| | | `/mes/wm/package-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢è£
ç®±æç» */ |
| | | export function createPackageLine(data: WlsPackageLineApi.PackageLine) { |
| | | return requestClient.post('/mes/wm/package-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹è£
ç®±æç» */ |
| | | export function updatePackageLine(data: WlsPackageLineApi.PackageLine) { |
| | | return requestClient.put('/mes/wm/package-line/update', data); |
| | | } |
| | | |
| | | /** å é¤è£
ç®±æç» */ |
| | | export function deletePackageLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/package-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsProductIssueDetailApi { |
| | | /** MES 颿åºåºæç» */ |
| | | export interface ProductIssueDetail { |
| | | id?: number; // æç»ç¼å· |
| | | issueId?: number; // 颿åç¼å· |
| | | lineId?: number; // 颿åè¡ç¼å· |
| | | materialStockId?: number; // åºåè®°å½ç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | quantity?: number; // æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢é¢æåºåºæç»åè¡¨ï¼æè¡ç¼å·ï¼ */ |
| | | export function getProductIssueDetailListByLineId(lineId: number) { |
| | | return requestClient.get<WlsProductIssueDetailApi.ProductIssueDetail[]>( |
| | | '/mes/wm/product-issue-detail/list-by-line', |
| | | { params: { lineId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢é¢æåºåºæç»è¯¦æ
*/ |
| | | export function getProductIssueDetail(id: number) { |
| | | return requestClient.get<WlsProductIssueDetailApi.ProductIssueDetail>( |
| | | `/mes/wm/product-issue-detail/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢é¢æåºåºæç» */ |
| | | export function createProductIssueDetail( |
| | | data: WlsProductIssueDetailApi.ProductIssueDetail, |
| | | ) { |
| | | return requestClient.post<number>( |
| | | '/mes/wm/product-issue-detail/create', |
| | | data, |
| | | ); |
| | | } |
| | | |
| | | /** ä¿®æ¹é¢æåºåºæç» */ |
| | | export function updateProductIssueDetail( |
| | | data: WlsProductIssueDetailApi.ProductIssueDetail, |
| | | ) { |
| | | return requestClient.put('/mes/wm/product-issue-detail/update', data); |
| | | } |
| | | |
| | | /** å é¤é¢æåºåºæç» */ |
| | | export function deleteProductIssueDetail(id: number) { |
| | | return requestClient.delete(`/mes/wm/product-issue-detail/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsProductIssueApi { |
| | | /** MES 颿åºåºå */ |
| | | export interface ProductIssue { |
| | | id?: number; // 颿åç¼å· |
| | | code?: string; // 颿åç¼å· |
| | | name?: string; // 颿ååç§° |
| | | workstationId?: number; // å·¥ä½ç«ç¼å· |
| | | workstationCode?: string; // å·¥ä½ç«ç¼ç |
| | | workstationName?: string; // å·¥ä½ç«åç§° |
| | | workOrderId?: number; // ç产订åç¼å· |
| | | workOrderCode?: string; // ç产订åç¼ç |
| | | clientCode?: string; // 客æ·ç¼ç |
| | | clientName?: string; // 客æ·åç§° |
| | | requiredTime?: number; // éæ±æ¶é´ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢é¢æåºåºåå页 */ |
| | | export function getProductIssuePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsProductIssueApi.ProductIssue>>( |
| | | '/mes/wm/product-issue/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢é¢æåºåºå详æ
*/ |
| | | export function getProductIssue(id: number) { |
| | | return requestClient.get<WlsProductIssueApi.ProductIssue>( |
| | | `/mes/wm/product-issue/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢é¢æåºåºå */ |
| | | export function createProductIssue(data: WlsProductIssueApi.ProductIssue) { |
| | | return requestClient.post<number>('/mes/wm/product-issue/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹é¢æåºåºå */ |
| | | export function updateProductIssue(data: WlsProductIssueApi.ProductIssue) { |
| | | return requestClient.put('/mes/wm/product-issue/update', data); |
| | | } |
| | | |
| | | /** å é¤é¢æåºåºå */ |
| | | export function deleteProductIssue(id: number) { |
| | | return requestClient.delete(`/mes/wm/product-issue/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤é¢æåºåºå */ |
| | | export function submitProductIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/product-issue/submit?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡æ£è´§ */ |
| | | export function stockProductIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/product-issue/stock?id=${id}`); |
| | | } |
| | | |
| | | /** 宿颿åºåºå */ |
| | | export function finishProductIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/product-issue/finish?id=${id}`); |
| | | } |
| | | |
| | | /** 忶颿åºåºå */ |
| | | export function cancelProductIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/product-issue/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** æ ¡éªé¢æåºåºåæ£è´§æ°éæ¯å¦ä¸é¢ææ°éä¸è´ */ |
| | | export function checkProductIssueQuantity(id: number) { |
| | | return requestClient.get<boolean>( |
| | | `/mes/wm/product-issue/check-quantity?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** 导åºé¢æåºåºå */ |
| | | export function exportProductIssue(params: any) { |
| | | return requestClient.download('/mes/wm/product-issue/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsProductIssueLineApi { |
| | | /** MES 颿åºåºåè¡ */ |
| | | export interface ProductIssueLine { |
| | | id?: number; // è¡ç¼å· |
| | | issueId?: number; // 颿åç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | quantity?: number; // 颿æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢é¢æåºåºåè¡å页 */ |
| | | export function getProductIssueLinePage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsProductIssueLineApi.ProductIssueLine> |
| | | >('/mes/wm/product-issue-line/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢é¢æåºåºåè¡è¯¦æ
*/ |
| | | export function getProductIssueLine(id: number) { |
| | | return requestClient.get<WlsProductIssueLineApi.ProductIssueLine>( |
| | | `/mes/wm/product-issue-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢é¢æåºåºåè¡ */ |
| | | export function createProductIssueLine( |
| | | data: WlsProductIssueLineApi.ProductIssueLine, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/product-issue-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹é¢æåºåºåè¡ */ |
| | | export function updateProductIssueLine( |
| | | data: WlsProductIssueLineApi.ProductIssueLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/product-issue-line/update', data); |
| | | } |
| | | |
| | | /** å é¤é¢æåºåºåè¡ */ |
| | | export function deleteProductIssueLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/product-issue-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsProductProduceLineApi { |
| | | /** MES 产å产åºè¡ */ |
| | | export interface ProductProduceLine { |
| | | id?: number; |
| | | feedbackId?: number; // æ¥å·¥ç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©èµç¼ç |
| | | itemName?: string; // ç©èµåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureId?: number; // åä½ç¼å· |
| | | unitMeasureName?: string; // åä½ |
| | | quantity?: number; // äº§åºæ°é |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | qualityStatus?: number; // è´¨éç¶æ |
| | | locationId?: number; // åºä½ç¼å· |
| | | locationName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | |
| | | /** MES 产å产åºè¡å页æ¥è¯¢åæ° */ |
| | | export interface PageParams extends PageParam { |
| | | feedbackId?: number; |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢äº§å产åºè¡å页 */ |
| | | export function getProductProduceLinePage( |
| | | params: WlsProductProduceLineApi.PageParams, |
| | | ) { |
| | | return requestClient.get< |
| | | PageResult<WlsProductProduceLineApi.ProductProduceLine> |
| | | >('/mes/wm/product-produce-line/page', { params }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsProductReceiptDetailApi { |
| | | /** MES 产åå
¥åºæç» */ |
| | | export interface ProductReceiptDetail { |
| | | id?: number; // æç»ç¼å· |
| | | lineId?: number; // å
¥åºåè¡ç¼å· |
| | | receiptId?: number; // å
¥åºåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | quantity?: number; // æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢äº§åå
¥åºæç»åè¡¨ï¼æè¡ç¼å·ï¼ */ |
| | | export function getProductReceiptDetailListByLineId(lineId: number) { |
| | | return requestClient.get<WlsProductReceiptDetailApi.ProductReceiptDetail[]>( |
| | | '/mes/wm/product-receipt-detail/list-by-line', |
| | | { params: { lineId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢äº§åå
¥åºæç»è¯¦æ
*/ |
| | | export function getProductReceiptDetail(id: number) { |
| | | return requestClient.get<WlsProductReceiptDetailApi.ProductReceiptDetail>( |
| | | `/mes/wm/product-receipt-detail/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢äº§åå
¥åºæç» */ |
| | | export function createProductReceiptDetail( |
| | | data: WlsProductReceiptDetailApi.ProductReceiptDetail, |
| | | ) { |
| | | return requestClient.post<number>( |
| | | '/mes/wm/product-receipt-detail/create', |
| | | data, |
| | | ); |
| | | } |
| | | |
| | | /** ä¿®æ¹äº§åå
¥åºæç» */ |
| | | export function updateProductReceiptDetail( |
| | | data: WlsProductReceiptDetailApi.ProductReceiptDetail, |
| | | ) { |
| | | return requestClient.put('/mes/wm/product-receipt-detail/update', data); |
| | | } |
| | | |
| | | /** å é¤äº§åå
¥åºæç» */ |
| | | export function deleteProductReceiptDetail(id: number) { |
| | | return requestClient.delete(`/mes/wm/product-receipt-detail/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsProductReceiptApi { |
| | | /** MES 产åå
¥åºå */ |
| | | export interface ProductReceipt { |
| | | id?: number; // å
¥åºåç¼å· |
| | | code?: string; // å
¥åºåç¼ç |
| | | name?: string; // å
¥åºååç§° |
| | | workOrderId?: number; // ç产订åç¼å· |
| | | workOrderCode?: string; // ç产订åç¼ç |
| | | itemId?: number; // 产åç©æç¼å· |
| | | itemCode?: string; // 产åç©æç¼ç |
| | | itemName?: string; // 产åç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | receiptDate?: number; // å
¥åºæ¥æ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢äº§åå
¥åºåå页 */ |
| | | export function getProductReceiptPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsProductReceiptApi.ProductReceipt>>( |
| | | '/mes/wm/product-receipt/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢äº§åå
¥åºå详æ
*/ |
| | | export function getProductReceipt(id: number) { |
| | | return requestClient.get<WlsProductReceiptApi.ProductReceipt>( |
| | | `/mes/wm/product-receipt/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢äº§åå
¥åºå */ |
| | | export function createProductReceipt( |
| | | data: WlsProductReceiptApi.ProductReceipt, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/product-receipt/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹äº§åå
¥åºå */ |
| | | export function updateProductReceipt( |
| | | data: WlsProductReceiptApi.ProductReceipt, |
| | | ) { |
| | | return requestClient.put('/mes/wm/product-receipt/update', data); |
| | | } |
| | | |
| | | /** å é¤äº§åå
¥åºå */ |
| | | export function deleteProductReceipt(id: number) { |
| | | return requestClient.delete(`/mes/wm/product-receipt/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤äº§åå
¥åºå */ |
| | | export function submitProductReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/product-receipt/submit?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ */ |
| | | export function stockProductReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/product-receipt/stock?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡å
¥åº */ |
| | | export function finishProductReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/product-receipt/finish?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶äº§åå
¥åºå */ |
| | | export function cancelProductReceipt(id: number) { |
| | | return requestClient.put(`/mes/wm/product-receipt/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** æ ¡éªäº§åå
¥åºåæç»æ°éæ¯å¦ä¸è¡æ¶è´§æ°éä¸è´ */ |
| | | export function checkProductReceiptQuantity(id: number) { |
| | | return requestClient.get<boolean>( |
| | | `/mes/wm/product-receipt/check-quantity?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** 导åºäº§åå
¥åºå */ |
| | | export function exportProductReceipt(params: any) { |
| | | return requestClient.download('/mes/wm/product-receipt/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsProductReceiptLineApi { |
| | | /** MES 产åå
¥åºåè¡ */ |
| | | export interface ProductReceiptLine { |
| | | id?: number; // è¡ç¼å· |
| | | receiptId?: number; // å
¥åºåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | materialStockId?: number; // åºåè®°å½ç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | quantity?: number; // å
¥åºæ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢äº§åå
¥åºåè¡å页 */ |
| | | export function getProductReceiptLinePage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsProductReceiptLineApi.ProductReceiptLine> |
| | | >('/mes/wm/product-receipt-line/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢äº§åå
¥åºåè¡è¯¦æ
*/ |
| | | export function getProductReceiptLine(id: number) { |
| | | return requestClient.get<WlsProductReceiptLineApi.ProductReceiptLine>( |
| | | `/mes/wm/product-receipt-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢äº§åå
¥åºåè¡ */ |
| | | export function createProductReceiptLine( |
| | | data: WlsProductReceiptLineApi.ProductReceiptLine, |
| | | ) { |
| | | return requestClient.post<number>( |
| | | '/mes/wm/product-receipt-line/create', |
| | | data, |
| | | ); |
| | | } |
| | | |
| | | /** ä¿®æ¹äº§åå
¥åºåè¡ */ |
| | | export function updateProductReceiptLine( |
| | | data: WlsProductReceiptLineApi.ProductReceiptLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/product-receipt-line/update', data); |
| | | } |
| | | |
| | | /** å é¤äº§åå
¥åºåè¡ */ |
| | | export function deleteProductReceiptLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/product-receipt-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsProductSalesDetailApi { |
| | | /** MES éå®åºåºæç» */ |
| | | export interface ProductSalesDetail { |
| | | id?: number; // æç»ç¼å· |
| | | lineId?: number; // åºåºåè¡ç¼å· |
| | | salesId?: number; // åºåºåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | quantity?: number; // æ°é |
| | | materialStockId?: number; // åºåè®°å½ç¼å· |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®åºåºæç»åè¡¨ï¼æè¡ç¼å·ï¼ */ |
| | | export function getProductSalesDetailListByLineId(lineId: number) { |
| | | return requestClient.get<WlsProductSalesDetailApi.ProductSalesDetail[]>( |
| | | '/mes/wm/product-sales-detail/list-by-line', |
| | | { params: { lineId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®åºåºæç»è¯¦æ
*/ |
| | | export function getProductSalesDetail(id: number) { |
| | | return requestClient.get<WlsProductSalesDetailApi.ProductSalesDetail>( |
| | | `/mes/wm/product-sales-detail/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢éå®åºåºæç» */ |
| | | export function createProductSalesDetail( |
| | | data: WlsProductSalesDetailApi.ProductSalesDetail, |
| | | ) { |
| | | return requestClient.post<number>( |
| | | '/mes/wm/product-sales-detail/create', |
| | | data, |
| | | ); |
| | | } |
| | | |
| | | /** ä¿®æ¹éå®åºåºæç» */ |
| | | export function updateProductSalesDetail( |
| | | data: WlsProductSalesDetailApi.ProductSalesDetail, |
| | | ) { |
| | | return requestClient.put('/mes/wm/product-sales-detail/update', data); |
| | | } |
| | | |
| | | /** å é¤éå®åºåºæç» */ |
| | | export function deleteProductSalesDetail(id: number) { |
| | | return requestClient.delete(`/mes/wm/product-sales-detail/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsProductSalesApi { |
| | | /** MES éå®åºåºå */ |
| | | export interface ProductSales { |
| | | id?: number; // åºåºåç¼å· |
| | | code?: string; // åºåºåç¼å· |
| | | name?: string; // åºåºååç§° |
| | | noticeId?: number; // åè´§éç¥åç¼å· |
| | | noticeCode?: string; // åè´§éç¥åç¼ç |
| | | clientId?: number; // 客æ·ç¼å· |
| | | clientCode?: string; // 客æ·ç¼ç |
| | | clientName?: string; // 客æ·åç§° |
| | | salesOrderCode?: string; // éå®è®¢åç¼å· |
| | | salesDate?: number; // åºåºæ¥æ |
| | | contactName?: string; // æ¶è´§äºº |
| | | contactTelephone?: string; // èç³»æ¹å¼ |
| | | contactAddress?: string; // æ¶è´§å°å |
| | | carrier?: string; // æ¿è¿å |
| | | shippingNumber?: string; // è¿è¾åå· |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®åºåºåå页 */ |
| | | export function getProductSalesPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsProductSalesApi.ProductSales>>( |
| | | '/mes/wm/product-sales/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®åºåºå详æ
*/ |
| | | export function getProductSales(id: number) { |
| | | return requestClient.get<WlsProductSalesApi.ProductSales>( |
| | | `/mes/wm/product-sales/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢éå®åºåºå */ |
| | | export function createProductSales(data: WlsProductSalesApi.ProductSales) { |
| | | return requestClient.post<number>('/mes/wm/product-sales/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹éå®åºåºå */ |
| | | export function updateProductSales(data: WlsProductSalesApi.ProductSales) { |
| | | return requestClient.put('/mes/wm/product-sales/update', data); |
| | | } |
| | | |
| | | /** å é¤éå®åºåºå */ |
| | | export function deleteProductSales(id: number) { |
| | | return requestClient.delete(`/mes/wm/product-sales/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤éå®åºåºå */ |
| | | export function submitProductSales(id: number) { |
| | | return requestClient.put(`/mes/wm/product-sales/submit?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡æ£è´§ */ |
| | | export function stockProductSales(id: number) { |
| | | return requestClient.put(`/mes/wm/product-sales/stock?id=${id}`); |
| | | } |
| | | |
| | | /** å¡«åè¿å */ |
| | | export function shippingProductSales(data: WlsProductSalesApi.ProductSales) { |
| | | return requestClient.put('/mes/wm/product-sales/shipping', data); |
| | | } |
| | | |
| | | /** æ§è¡åºåº */ |
| | | export function finishProductSales(id: number) { |
| | | return requestClient.put(`/mes/wm/product-sales/finish?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶éå®åºåºå */ |
| | | export function cancelProductSales(id: number) { |
| | | return requestClient.put(`/mes/wm/product-sales/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** æ ¡éªéå®åºåºåæ£è´§æ°éæ¯å¦ä¸åºåºæ°éä¸è´ */ |
| | | export function checkProductSalesQuantity(id: number) { |
| | | return requestClient.get<boolean>( |
| | | `/mes/wm/product-sales/check-quantity?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** 导åºéå®åºåºå */ |
| | | export function exportProductSales(params: any) { |
| | | return requestClient.download('/mes/wm/product-sales/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsProductSalesLineApi { |
| | | /** MES éå®åºåºåè¡ */ |
| | | export interface ProductSalesLine { |
| | | id?: number; // è¡ç¼å· |
| | | salesId?: number; // åºåºåç¼å· |
| | | noticeLineId?: number; // åè´§éç¥åè¡ç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | quantity?: number; // åºåºæ°é |
| | | pickedQuantity?: number; // å·²æ£è´§æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | oqcCheckFlag?: boolean; // æ¯å¦æ£éª |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®åºåºåè¡å页 */ |
| | | export function getProductSalesLinePage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsProductSalesLineApi.ProductSalesLine> |
| | | >('/mes/wm/product-sales-line/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®åºåºåè¡è¯¦æ
*/ |
| | | export function getProductSalesLine(id: number) { |
| | | return requestClient.get<WlsProductSalesLineApi.ProductSalesLine>( |
| | | `/mes/wm/product-sales-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢éå®åºåºåè¡ */ |
| | | export function createProductSalesLine( |
| | | data: WlsProductSalesLineApi.ProductSalesLine, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/product-sales-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹éå®åºåºåè¡ */ |
| | | export function updateProductSalesLine( |
| | | data: WlsProductSalesLineApi.ProductSalesLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/product-sales-line/update', data); |
| | | } |
| | | |
| | | /** å é¤éå®åºåºåè¡ */ |
| | | export function deleteProductSalesLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/product-sales-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsReturnIssueDetailApi { |
| | | /** MES çäº§éææç» */ |
| | | export interface ReturnIssueDetail { |
| | | id?: number; // æç»ç¼å· |
| | | issueId?: number; // éæåç¼å· |
| | | lineId?: number; // éæåè¡ç¼å· |
| | | materialStockId?: number; // åºåè®°å½ç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | quantity?: number; // æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢çäº§éææç»åè¡¨ï¼æè¡ç¼å·ï¼ */ |
| | | export function getReturnIssueDetailListByLineId(lineId: number) { |
| | | return requestClient.get<WlsReturnIssueDetailApi.ReturnIssueDetail[]>( |
| | | '/mes/wm/return-issue-detail/list-by-line', |
| | | { params: { lineId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢çäº§éææç»è¯¦æ
*/ |
| | | export function getReturnIssueDetail(id: number) { |
| | | return requestClient.get<WlsReturnIssueDetailApi.ReturnIssueDetail>( |
| | | `/mes/wm/return-issue-detail/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢çäº§éææç» */ |
| | | export function createReturnIssueDetail( |
| | | data: WlsReturnIssueDetailApi.ReturnIssueDetail, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/return-issue-detail/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹çäº§éææç» */ |
| | | export function updateReturnIssueDetail( |
| | | data: WlsReturnIssueDetailApi.ReturnIssueDetail, |
| | | ) { |
| | | return requestClient.put('/mes/wm/return-issue-detail/update', data); |
| | | } |
| | | |
| | | /** å é¤çäº§éææç» */ |
| | | export function deleteReturnIssueDetail(id: number) { |
| | | return requestClient.delete(`/mes/wm/return-issue-detail/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsReturnIssueApi { |
| | | /** MES ç产éæå */ |
| | | export interface ReturnIssue { |
| | | id?: number; // éæåç¼å· |
| | | code?: string; // éæåç¼å· |
| | | name?: string; // éæååç§° |
| | | workstationId?: number; // å·¥ä½ç«ç¼å· |
| | | workstationName?: string; // å·¥ä½ç«åç§° |
| | | workOrderId?: number; // ç产订åç¼å· |
| | | workOrderCode?: string; // ç产订åç¼ç |
| | | type?: number; // éæç±»å |
| | | returnDate?: number; // éææ¥æ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢ç产éæåå页 */ |
| | | export function getReturnIssuePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsReturnIssueApi.ReturnIssue>>( |
| | | '/mes/wm/return-issue/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢ç产éæå详æ
*/ |
| | | export function getReturnIssue(id: number) { |
| | | return requestClient.get<WlsReturnIssueApi.ReturnIssue>( |
| | | `/mes/wm/return-issue/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢ç产éæå */ |
| | | export function createReturnIssue(data: WlsReturnIssueApi.ReturnIssue) { |
| | | return requestClient.post<number>('/mes/wm/return-issue/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹ç产éæå */ |
| | | export function updateReturnIssue(data: WlsReturnIssueApi.ReturnIssue) { |
| | | return requestClient.put('/mes/wm/return-issue/update', data); |
| | | } |
| | | |
| | | /** å é¤ç产éæå */ |
| | | export function deleteReturnIssue(id: number) { |
| | | return requestClient.delete(`/mes/wm/return-issue/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤ç产éæå */ |
| | | export function submitReturnIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/return-issue/submit?id=${id}`); |
| | | } |
| | | |
| | | /** å
¥åºä¸æ¶ */ |
| | | export function stockReturnIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/return-issue/stock?id=${id}`); |
| | | } |
| | | |
| | | /** 宿ç产éæå */ |
| | | export function finishReturnIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/return-issue/finish?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶ç产éæå */ |
| | | export function cancelReturnIssue(id: number) { |
| | | return requestClient.put(`/mes/wm/return-issue/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** 导åºç产éæå */ |
| | | export function exportReturnIssue(params: any) { |
| | | return requestClient.download('/mes/wm/return-issue/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsReturnIssueLineApi { |
| | | /** MES ç产éæåè¡ */ |
| | | export interface ReturnIssueLine { |
| | | id?: number; // è¡ç¼å· |
| | | issueId?: number; // éæåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | materialStockId?: number; // åºåè®°å½ç¼å· |
| | | quantity?: number; // éææ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | rqcCheckFlag?: boolean; // æ¯å¦æ£æµ |
| | | qualityStatus?: number; // è´¨éç¶æ |
| | | rqcId?: number; // éè´§æ£éªåç¼å· |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢ç产éæåè¡å页 */ |
| | | export function getReturnIssueLinePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsReturnIssueLineApi.ReturnIssueLine>>( |
| | | '/mes/wm/return-issue-line/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢ç产éæåè¡è¯¦æ
*/ |
| | | export function getReturnIssueLine(id: number) { |
| | | return requestClient.get<WlsReturnIssueLineApi.ReturnIssueLine>( |
| | | `/mes/wm/return-issue-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢ç产éæåè¡ */ |
| | | export function createReturnIssueLine( |
| | | data: WlsReturnIssueLineApi.ReturnIssueLine, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/return-issue-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹ç产éæåè¡ */ |
| | | export function updateReturnIssueLine( |
| | | data: WlsReturnIssueLineApi.ReturnIssueLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/return-issue-line/update', data); |
| | | } |
| | | |
| | | /** å é¤ç产éæåè¡ */ |
| | | export function deleteReturnIssueLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/return-issue-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsReturnSalesDetailApi { |
| | | /** MES éå®éè´§æç» */ |
| | | export interface ReturnSalesDetail { |
| | | id?: number; // æç»ç¼å· |
| | | returnId?: number; // éè´§åç¼å· |
| | | lineId?: number; // éè´§åè¡ç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | quantity?: number; // æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®éè´§æç»åè¡¨ï¼æè¡ç¼å·ï¼ */ |
| | | export function getReturnSalesDetailListByLineId(lineId: number) { |
| | | return requestClient.get<WlsReturnSalesDetailApi.ReturnSalesDetail[]>( |
| | | '/mes/wm/return-sales-detail/list-by-line', |
| | | { params: { lineId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®éè´§æç»è¯¦æ
*/ |
| | | export function getReturnSalesDetail(id: number) { |
| | | return requestClient.get<WlsReturnSalesDetailApi.ReturnSalesDetail>( |
| | | `/mes/wm/return-sales-detail/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢éå®éè´§æç» */ |
| | | export function createReturnSalesDetail( |
| | | data: WlsReturnSalesDetailApi.ReturnSalesDetail, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/return-sales-detail/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹éå®éè´§æç» */ |
| | | export function updateReturnSalesDetail( |
| | | data: WlsReturnSalesDetailApi.ReturnSalesDetail, |
| | | ) { |
| | | return requestClient.put('/mes/wm/return-sales-detail/update', data); |
| | | } |
| | | |
| | | /** å é¤éå®éè´§æç» */ |
| | | export function deleteReturnSalesDetail(id: number) { |
| | | return requestClient.delete(`/mes/wm/return-sales-detail/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsReturnSalesApi { |
| | | /** MES éå®éè´§å */ |
| | | export interface ReturnSales { |
| | | id?: number; // éè´§åç¼å· |
| | | code?: string; // éè´§åç¼å· |
| | | name?: string; // éè´§ååç§° |
| | | salesOrderCode?: string; // éå®è®¢åå· |
| | | clientId?: number; // 客æ·ç¼å· |
| | | clientCode?: string; // 客æ·ç¼ç |
| | | clientName?: string; // 客æ·åç§° |
| | | returnDate?: number; // éè´§æ¥æ |
| | | returnReason?: string; // éè´§åå |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®éè´§åå页 */ |
| | | export function getReturnSalesPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsReturnSalesApi.ReturnSales>>( |
| | | '/mes/wm/return-sales/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®éè´§å详æ
*/ |
| | | export function getReturnSales(id: number) { |
| | | return requestClient.get<WlsReturnSalesApi.ReturnSales>( |
| | | `/mes/wm/return-sales/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢éå®éè´§å */ |
| | | export function createReturnSales(data: WlsReturnSalesApi.ReturnSales) { |
| | | return requestClient.post<number>('/mes/wm/return-sales/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹éå®éè´§å */ |
| | | export function updateReturnSales(data: WlsReturnSalesApi.ReturnSales) { |
| | | return requestClient.put('/mes/wm/return-sales/update', data); |
| | | } |
| | | |
| | | /** å é¤éå®éè´§å */ |
| | | export function deleteReturnSales(id: number) { |
| | | return requestClient.delete(`/mes/wm/return-sales/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤éå®éè´§å */ |
| | | export function submitReturnSales(id: number) { |
| | | return requestClient.put(`/mes/wm/return-sales/submit?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡éè´§ */ |
| | | export function finishReturnSales(id: number) { |
| | | return requestClient.put(`/mes/wm/return-sales/finish?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ */ |
| | | export function stockReturnSales(id: number) { |
| | | return requestClient.put(`/mes/wm/return-sales/stock?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶éå®éè´§å */ |
| | | export function cancelReturnSales(id: number) { |
| | | return requestClient.put(`/mes/wm/return-sales/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** 导åºéå®éè´§å */ |
| | | export function exportReturnSales(params: any) { |
| | | return requestClient.download('/mes/wm/return-sales/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsReturnSalesLineApi { |
| | | /** MES éå®éè´§åè¡ */ |
| | | export interface ReturnSalesLine { |
| | | id?: number; // è¡ç¼å· |
| | | returnId?: number; // éè´§åç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | quantity?: number; // éè´§æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | rqcCheckFlag?: boolean; // æ¯å¦éè¦è´¨æ£ |
| | | rqcId?: number; // éè´§æ£éªåç¼å· |
| | | qualityStatus?: number; // è´¨éç¶æ |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®éè´§åè¡å页 */ |
| | | export function getReturnSalesLinePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsReturnSalesLineApi.ReturnSalesLine>>( |
| | | '/mes/wm/return-sales-line/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢éå®éè´§åè¡è¯¦æ
*/ |
| | | export function getReturnSalesLine(id: number) { |
| | | return requestClient.get<WlsReturnSalesLineApi.ReturnSalesLine>( |
| | | `/mes/wm/return-sales-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢éå®éè´§åè¡ */ |
| | | export function createReturnSalesLine( |
| | | data: WlsReturnSalesLineApi.ReturnSalesLine, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/return-sales-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹éå®éè´§åè¡ */ |
| | | export function updateReturnSalesLine( |
| | | data: WlsReturnSalesLineApi.ReturnSalesLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/return-sales-line/update', data); |
| | | } |
| | | |
| | | /** å é¤éå®éè´§åè¡ */ |
| | | export function deleteReturnSalesLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/return-sales-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsReturnVendorDetailApi { |
| | | /** MES ä¾åºåéè´§æç» */ |
| | | export interface ReturnVendorDetail { |
| | | id?: number; // æç»ç¼å· |
| | | returnId?: number; // éè´§åç¼å· |
| | | lineId?: number; // éè´§åè¡ç¼å· |
| | | materialStockId?: number; // åºåè®°å½ç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | quantity?: number; // æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢ä¾åºåéè´§æç»åè¡¨ï¼æè¡ç¼å·ï¼ */ |
| | | export function getReturnVendorDetailListByLineId(lineId: number) { |
| | | return requestClient.get<WlsReturnVendorDetailApi.ReturnVendorDetail[]>( |
| | | '/mes/wm/return-vendor-detail/list-by-line', |
| | | { params: { lineId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢ä¾åºåéè´§æç»è¯¦æ
*/ |
| | | export function getReturnVendorDetail(id: number) { |
| | | return requestClient.get<WlsReturnVendorDetailApi.ReturnVendorDetail>( |
| | | `/mes/wm/return-vendor-detail/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢ä¾åºåéè´§æç» */ |
| | | export function createReturnVendorDetail( |
| | | data: WlsReturnVendorDetailApi.ReturnVendorDetail, |
| | | ) { |
| | | return requestClient.post<number>( |
| | | '/mes/wm/return-vendor-detail/create', |
| | | data, |
| | | ); |
| | | } |
| | | |
| | | /** ä¿®æ¹ä¾åºåéè´§æç» */ |
| | | export function updateReturnVendorDetail( |
| | | data: WlsReturnVendorDetailApi.ReturnVendorDetail, |
| | | ) { |
| | | return requestClient.put('/mes/wm/return-vendor-detail/update', data); |
| | | } |
| | | |
| | | /** å é¤ä¾åºåéè´§æç» */ |
| | | export function deleteReturnVendorDetail(id: number) { |
| | | return requestClient.delete(`/mes/wm/return-vendor-detail/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsReturnVendorApi { |
| | | /** MES ä¾åºåéè´§å */ |
| | | export interface ReturnVendor { |
| | | id?: number; // éè´§åç¼å· |
| | | code?: string; // éè´§åç¼å· |
| | | name?: string; // éè´§ååç§° |
| | | purchaseOrderCode?: string; // éè´è®¢åå· |
| | | vendorId?: number; // ä¾åºåç¼å· |
| | | vendorCode?: string; // ä¾åºåç¼ç |
| | | vendorName?: string; // ä¾åºååç§° |
| | | vendorNickname?: string; // ä¾åºåç®ç§° |
| | | returnDate?: number; // éè´§æ¥æ |
| | | returnReason?: string; // éè´§åå |
| | | transportCode?: string; // è¿åå· |
| | | transportTelephone?: string; // èç³»çµè¯ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢ä¾åºåéè´§åå页 */ |
| | | export function getReturnVendorPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsReturnVendorApi.ReturnVendor>>( |
| | | '/mes/wm/return-vendor/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢ä¾åºåéè´§å详æ
*/ |
| | | export function getReturnVendor(id: number) { |
| | | return requestClient.get<WlsReturnVendorApi.ReturnVendor>( |
| | | `/mes/wm/return-vendor/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢ä¾åºåéè´§å */ |
| | | export function createReturnVendor(data: WlsReturnVendorApi.ReturnVendor) { |
| | | return requestClient.post<number>('/mes/wm/return-vendor/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹ä¾åºåéè´§å */ |
| | | export function updateReturnVendor(data: WlsReturnVendorApi.ReturnVendor) { |
| | | return requestClient.put('/mes/wm/return-vendor/update', data); |
| | | } |
| | | |
| | | /** å é¤ä¾åºåéè´§å */ |
| | | export function deleteReturnVendor(id: number) { |
| | | return requestClient.delete(`/mes/wm/return-vendor/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤ä¾åºåéè´§å */ |
| | | export function submitReturnVendor(id: number) { |
| | | return requestClient.put(`/mes/wm/return-vendor/submit?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡æ£è´§ */ |
| | | export function stockReturnVendor(id: number) { |
| | | return requestClient.put(`/mes/wm/return-vendor/stock?id=${id}`); |
| | | } |
| | | |
| | | /** 宿ä¾åºåéè´§å */ |
| | | export function finishReturnVendor(id: number) { |
| | | return requestClient.put(`/mes/wm/return-vendor/finish?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶ä¾åºåéè´§å */ |
| | | export function cancelReturnVendor(id: number) { |
| | | return requestClient.put(`/mes/wm/return-vendor/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** æ ¡éªä¾åºåéè´§åæ£è´§æ°éæ¯å¦ä¸éè´§æ°éä¸è´ */ |
| | | export function checkReturnVendorQuantity(id: number) { |
| | | return requestClient.get<boolean>( |
| | | `/mes/wm/return-vendor/check-quantity?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** 导åºä¾åºåéè´§å */ |
| | | export function exportReturnVendor(params: any) { |
| | | return requestClient.download('/mes/wm/return-vendor/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsReturnVendorLineApi { |
| | | /** MES ä¾åºåéè´§åè¡ */ |
| | | export interface ReturnVendorLine { |
| | | id?: number; // è¡ç¼å· |
| | | returnId?: number; // éè´§åç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | quantity?: number; // éè´§æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢ä¾åºåéè´§åè¡å页 */ |
| | | export function getReturnVendorLinePage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsReturnVendorLineApi.ReturnVendorLine> |
| | | >('/mes/wm/return-vendor-line/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢ä¾åºåéè´§åè¡è¯¦æ
*/ |
| | | export function getReturnVendorLine(id: number) { |
| | | return requestClient.get<WlsReturnVendorLineApi.ReturnVendorLine>( |
| | | `/mes/wm/return-vendor-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢ä¾åºåéè´§åè¡ */ |
| | | export function createReturnVendorLine( |
| | | data: WlsReturnVendorLineApi.ReturnVendorLine, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/return-vendor-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹ä¾åºåéè´§åè¡ */ |
| | | export function updateReturnVendorLine( |
| | | data: WlsReturnVendorLineApi.ReturnVendorLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/return-vendor-line/update', data); |
| | | } |
| | | |
| | | /** å é¤ä¾åºåéè´§åè¡ */ |
| | | export function deleteReturnVendorLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/return-vendor-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsSalesNoticeApi { |
| | | /** MES åè´§éç¥å */ |
| | | export interface SalesNotice { |
| | | id?: number; // éç¥åç¼å· |
| | | code?: string; // éç¥åç¼å· |
| | | name?: string; // éç¥ååç§° |
| | | salesOrderCode?: string; // éå®è®¢åç¼å· |
| | | clientId?: number; // 客æ·ç¼å· |
| | | clientCode?: string; // 客æ·ç¼ç |
| | | clientName?: string; // 客æ·åç§° |
| | | salesDate?: number; // åè´§æ¥æ |
| | | recipientName?: string; // æ¶è´§äºº |
| | | recipientTelephone?: string; // èç³»æ¹å¼ |
| | | recipientAddress?: string; // æ¶è´§å°å |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢åè´§éç¥åå页 */ |
| | | export function getSalesNoticePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsSalesNoticeApi.SalesNotice>>( |
| | | '/mes/wm/sales-notice/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢åè´§éç¥å详æ
*/ |
| | | export function getSalesNotice(id: number) { |
| | | return requestClient.get<WlsSalesNoticeApi.SalesNotice>( |
| | | `/mes/wm/sales-notice/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢åè´§éç¥å */ |
| | | export function createSalesNotice(data: WlsSalesNoticeApi.SalesNotice) { |
| | | return requestClient.post<number>('/mes/wm/sales-notice/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹åè´§éç¥å */ |
| | | export function updateSalesNotice(data: WlsSalesNoticeApi.SalesNotice) { |
| | | return requestClient.put('/mes/wm/sales-notice/update', data); |
| | | } |
| | | |
| | | /** å é¤åè´§éç¥å */ |
| | | export function deleteSalesNotice(id: number) { |
| | | return requestClient.delete(`/mes/wm/sales-notice/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤åè´§éç¥å */ |
| | | export function submitSalesNotice(id: number) { |
| | | return requestClient.put(`/mes/wm/sales-notice/submit?id=${id}`); |
| | | } |
| | | |
| | | /** 导åºåè´§éç¥å */ |
| | | export function exportSalesNotice(params: any) { |
| | | return requestClient.download('/mes/wm/sales-notice/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsSalesNoticeLineApi { |
| | | /** MES åè´§éç¥åè¡ */ |
| | | export interface SalesNoticeLine { |
| | | id?: number; // è¡ç¼å· |
| | | noticeId?: number; // åè´§éç¥åç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½ |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | quantity?: number; // åè´§æ°é |
| | | oqcCheckFlag?: boolean; // æ¯å¦æ£éª |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢åè´§éç¥åè¡å页 */ |
| | | export function getSalesNoticeLinePage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsSalesNoticeLineApi.SalesNoticeLine>>( |
| | | '/mes/wm/sales-notice-line/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢åè´§éç¥åè¡è¯¦æ
*/ |
| | | export function getSalesNoticeLine(id: number) { |
| | | return requestClient.get<WlsSalesNoticeLineApi.SalesNoticeLine>( |
| | | `/mes/wm/sales-notice-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢åè´§éç¥åè¡ */ |
| | | export function createSalesNoticeLine( |
| | | data: WlsSalesNoticeLineApi.SalesNoticeLine, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/sales-notice-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹åè´§éç¥åè¡ */ |
| | | export function updateSalesNoticeLine( |
| | | data: WlsSalesNoticeLineApi.SalesNoticeLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/sales-notice-line/update', data); |
| | | } |
| | | |
| | | /** å é¤åè´§éç¥åè¡ */ |
| | | export function deleteSalesNoticeLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/sales-notice-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsSnApi { |
| | | /** MES SN ç åç» */ |
| | | export interface SnGroup { |
| | | uuid?: string; // æ¹æ¬¡ UUID |
| | | count?: number; // SN ç æ°é |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitName?: string; // åä½åç§° |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | workOrderId?: number; // ç产订åç¼å· |
| | | createTime?: Date; // çææ¶é´ |
| | | } |
| | | |
| | | /** MES SN ç æç» */ |
| | | export interface Sn { |
| | | id?: number; // ç¼å· |
| | | uuid?: string; // æ¹æ¬¡ UUID |
| | | code?: string; // SN ç |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitName?: string; // åä½åç§° |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | workOrderId?: number; // ç产订åç¼å· |
| | | createTime?: Date; // çææ¶é´ |
| | | } |
| | | |
| | | /** MES SN ç çæåæ° */ |
| | | export interface SnGenerate { |
| | | itemId?: number; // ç©æç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | workOrderId?: number; // ç产订åç¼å· |
| | | count?: number; // çææ°é |
| | | } |
| | | |
| | | /** MES SN ç åç»å页æ¥è¯¢åæ° */ |
| | | export interface PageParams extends PageParam { |
| | | uuid?: string; // åç» UUID |
| | | code?: string; // SN ç |
| | | itemId?: number; // ç©æç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | createTime?: string[]; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** çæ SN ç */ |
| | | export function generateSnCodes(data: WlsSnApi.SnGenerate) { |
| | | return requestClient.post('/mes/wm/sn/generate', data); |
| | | } |
| | | |
| | | /** æ¥è¯¢ SN ç åç»å页 */ |
| | | export function getSnGroupPage(params: WlsSnApi.PageParams) { |
| | | return requestClient.get<PageResult<WlsSnApi.SnGroup>>( |
| | | '/mes/wm/sn/group-page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢æ¹æ¬¡ SN ç æç»å表 */ |
| | | export function getSnListByUuid(uuid: string) { |
| | | return requestClient.get<WlsSnApi.Sn[]>('/mes/wm/sn/list-by-uuid', { |
| | | params: { uuid }, |
| | | }); |
| | | } |
| | | |
| | | /** æ¹éå é¤ SN ç ï¼ææ¹æ¬¡ UUIDï¼ */ |
| | | export function deleteSnBatch(uuid: string) { |
| | | return requestClient.delete('/mes/wm/sn/delete-batch', { |
| | | params: { uuid }, |
| | | }); |
| | | } |
| | | |
| | | /** å¯¼åº SN ç åç» Excel */ |
| | | export function exportSnGroupExcel(params: WlsSnApi.PageParams) { |
| | | return requestClient.download('/mes/wm/sn/group-export-excel', { params }); |
| | | } |
| | | |
| | | /** å¯¼åºæ¹æ¬¡ SN ç æç» Excel */ |
| | | export function exportSnDetailExcel(uuid: string) { |
| | | return requestClient.download('/mes/wm/sn/export-excel', { |
| | | params: { uuid }, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsStockTakingPlanApi { |
| | | /** çç¹æ¹æ¡ */ |
| | | export interface StockTakingPlan { |
| | | id?: number; // æ¹æ¡ç¼å· |
| | | code?: string; // æ¹æ¡ç¼ç |
| | | name?: string; // æ¹æ¡åç§° |
| | | type?: number; // çç¹ç±»å |
| | | startTime?: number; // å¼å§æ¶é´ |
| | | endTime?: number; // ç»ææ¶é´ |
| | | blindFlag?: boolean; // æ¯å¦ç²ç |
| | | frozen?: boolean; // æ¯å¦å»ç»åºå |
| | | status?: number; // ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: string; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹æ¹æ¡å页 */ |
| | | export function getStockTakingPlanPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsStockTakingPlanApi.StockTakingPlan>>( |
| | | '/mes/wm/stocktaking-plan/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹æ¹æ¡è¯¦æ
*/ |
| | | export function getStockTakingPlan(id: number) { |
| | | return requestClient.get<WlsStockTakingPlanApi.StockTakingPlan>( |
| | | `/mes/wm/stocktaking-plan/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢çç¹æ¹æ¡ */ |
| | | export function createStockTakingPlan( |
| | | data: WlsStockTakingPlanApi.StockTakingPlan, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/stocktaking-plan/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹çç¹æ¹æ¡ */ |
| | | export function updateStockTakingPlan( |
| | | data: WlsStockTakingPlanApi.StockTakingPlan, |
| | | ) { |
| | | return requestClient.put('/mes/wm/stocktaking-plan/update', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹çç¹æ¹æ¡ç¶æ */ |
| | | export function updateStockTakingPlanStatus(id: number, status: number) { |
| | | return requestClient.put('/mes/wm/stocktaking-plan/update-status', null, { |
| | | params: { id, status }, |
| | | }); |
| | | } |
| | | |
| | | /** å é¤çç¹æ¹æ¡ */ |
| | | export function deleteStockTakingPlan(id: number) { |
| | | return requestClient.delete(`/mes/wm/stocktaking-plan/delete?id=${id}`); |
| | | } |
| | | |
| | | /** 导åºçç¹æ¹æ¡ */ |
| | | export function exportStockTakingPlan(params: any) { |
| | | return requestClient.download('/mes/wm/stocktaking-plan/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsStockTakingPlanParamApi { |
| | | /** çç¹æ¹æ¡æ¡ä»¶ */ |
| | | export interface StockTakingPlanParam { |
| | | id?: number; // æ¡ä»¶ç¼å· |
| | | planId?: number; // æ¹æ¡ç¼å· |
| | | type?: number; // æ¡ä»¶ç±»å |
| | | valueId?: number; // æ¡ä»¶å¼ç¼å· |
| | | valueCode?: string; // æ¡ä»¶å¼ç¼ç |
| | | valueName?: string; // æ¡ä»¶å¼åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹æ¹æ¡æ¡ä»¶å页 */ |
| | | export function getStockTakingPlanParamPage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsStockTakingPlanParamApi.StockTakingPlanParam> |
| | | >('/mes/wm/stocktaking-plan-param/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹æ¹æ¡æ¡ä»¶è¯¦æ
*/ |
| | | export function getStockTakingPlanParam(id: number) { |
| | | return requestClient.get<WlsStockTakingPlanParamApi.StockTakingPlanParam>( |
| | | `/mes/wm/stocktaking-plan-param/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢çç¹æ¹æ¡æ¡ä»¶ */ |
| | | export function createStockTakingPlanParam( |
| | | data: WlsStockTakingPlanParamApi.StockTakingPlanParam, |
| | | ) { |
| | | return requestClient.post('/mes/wm/stocktaking-plan-param/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹çç¹æ¹æ¡æ¡ä»¶ */ |
| | | export function updateStockTakingPlanParam( |
| | | data: WlsStockTakingPlanParamApi.StockTakingPlanParam, |
| | | ) { |
| | | return requestClient.put('/mes/wm/stocktaking-plan-param/update', data); |
| | | } |
| | | |
| | | /** å é¤çç¹æ¹æ¡æ¡ä»¶ */ |
| | | export function deleteStockTakingPlanParam(id: number) { |
| | | return requestClient.delete(`/mes/wm/stocktaking-plan-param/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsStockTakingTaskApi { |
| | | /** çç¹ä»»å¡ */ |
| | | export interface StockTakingTask { |
| | | id?: number; // ä»»å¡ç¼å· |
| | | code?: string; // ä»»å¡ç¼ç |
| | | name?: string; // ä»»å¡åç§° |
| | | takingDate?: string; // çç¹æ¥æ |
| | | type?: number; // çç¹ç±»å |
| | | userId?: number; // çç¹äººç¨æ·ç¼å· |
| | | userNickname?: string; // çç¹äººåç§° |
| | | planId?: number; // çç¹æ¹æ¡ç¼å· |
| | | planCode?: string; // çç¹æ¹æ¡ç¼ç |
| | | planName?: string; // çç¹æ¹æ¡åç§° |
| | | blindFlag?: boolean; // æ¯å¦ç²ç |
| | | frozen?: boolean; // æ¯å¦å»ç»åºå |
| | | startTime?: number; // å¼å§æ¶é´ |
| | | endTime?: number; // ç»ææ¶é´ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: string; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹ä»»å¡å页 */ |
| | | export function getStockTakingPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsStockTakingTaskApi.StockTakingTask>>( |
| | | '/mes/wm/stocktaking-task/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹ä»»å¡è¯¦æ
*/ |
| | | export function getStockTaking(id: number) { |
| | | return requestClient.get<WlsStockTakingTaskApi.StockTakingTask>( |
| | | `/mes/wm/stocktaking-task/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢çç¹ä»»å¡ */ |
| | | export function createStockTaking( |
| | | data: WlsStockTakingTaskApi.StockTakingTask, |
| | | ) { |
| | | return requestClient.post<number>('/mes/wm/stocktaking-task/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹çç¹ä»»å¡ */ |
| | | export function updateStockTaking( |
| | | data: WlsStockTakingTaskApi.StockTakingTask, |
| | | ) { |
| | | return requestClient.put('/mes/wm/stocktaking-task/update', data); |
| | | } |
| | | |
| | | /** å é¤çç¹ä»»å¡ */ |
| | | export function deleteStockTaking(id: number) { |
| | | return requestClient.delete(`/mes/wm/stocktaking-task/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤çç¹ä»»å¡ */ |
| | | export function submitStockTaking(id: number) { |
| | | return requestClient.put('/mes/wm/stocktaking-task/submit', null, { |
| | | params: { id }, |
| | | }); |
| | | } |
| | | |
| | | /** åæ¶çç¹ä»»å¡ */ |
| | | export function cancelStockTaking(id: number) { |
| | | return requestClient.put('/mes/wm/stocktaking-task/cancel', null, { |
| | | params: { id }, |
| | | }); |
| | | } |
| | | |
| | | /** æ§è¡çç¹ä»»å¡ */ |
| | | export function finishStockTaking(id: number) { |
| | | return requestClient.put('/mes/wm/stocktaking-task/finish', { id }); |
| | | } |
| | | |
| | | /** 导åºçç¹ä»»å¡ */ |
| | | export function exportStockTaking(params: any) { |
| | | return requestClient.download('/mes/wm/stocktaking-task/export-excel', { |
| | | params, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsStockTakingTaskLineApi { |
| | | /** çç¹ä»»å¡è¡ */ |
| | | export interface StockTakingTaskLine { |
| | | id?: number; // çç¹è¡ç¼å· |
| | | taskId?: number; // ä»»å¡ç¼å· |
| | | materialStockId?: number; // åºåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // 计éåä½åç§° |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | quantity?: number; // å¨åºæ°é |
| | | takingQuantity?: number; // çç¹æ°é |
| | | differenceQuantity?: number; // 差弿°é |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | status?: number; // ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹ä»»å¡è¡å页 */ |
| | | export function getStockTakingTaskLinePage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsStockTakingTaskLineApi.StockTakingTaskLine> |
| | | >('/mes/wm/stocktaking-task-line/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹ä»»å¡è¡ç²¾ç®å表 */ |
| | | export function getStockTakingTaskLineSimpleList(taskId: number) { |
| | | return requestClient.get<WlsStockTakingTaskLineApi.StockTakingTaskLine[]>( |
| | | '/mes/wm/stocktaking-task-line/simple-list', |
| | | { params: { taskId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹ä»»å¡è¡è¯¦æ
*/ |
| | | export function getStockTakingTaskLine(id: number) { |
| | | return requestClient.get<WlsStockTakingTaskLineApi.StockTakingTaskLine>( |
| | | '/mes/wm/stocktaking-task-line/get', |
| | | { params: { id } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢çç¹ä»»å¡è¡ */ |
| | | export function createStockTakingTaskLine( |
| | | data: WlsStockTakingTaskLineApi.StockTakingTaskLine, |
| | | ) { |
| | | return requestClient.post('/mes/wm/stocktaking-task-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹çç¹ä»»å¡è¡ */ |
| | | export function updateStockTakingTaskLine( |
| | | data: WlsStockTakingTaskLineApi.StockTakingTaskLine, |
| | | ) { |
| | | return requestClient.put('/mes/wm/stocktaking-task-line/update', data); |
| | | } |
| | | |
| | | /** å é¤çç¹ä»»å¡è¡ */ |
| | | export function deleteStockTakingTaskLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/stocktaking-task-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsStockTakingResultApi { |
| | | /** çç¹ç»æ */ |
| | | export interface StockTakingResult { |
| | | id?: number; // ç»æç¼å· |
| | | taskId?: number; // ä»»å¡ç¼å· |
| | | lineId?: number; // çç¹è¡ç¼å· |
| | | materialStockId?: number; // åºåç¼å· |
| | | itemId?: number; // ç©æç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // 计éåä½åç§° |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | areaId?: number; // åºä½ç¼å· |
| | | areaName?: string; // åºä½åç§° |
| | | quantity?: number; // å¨åºæ°é |
| | | takingQuantity?: number; // çç¹æ°é |
| | | remark?: string; // 夿³¨ |
| | | createTime?: string; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹ç»æå页 */ |
| | | export function getStockTakingResultPage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsStockTakingResultApi.StockTakingResult> |
| | | >('/mes/wm/stocktaking-task-result/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢çç¹ç»æè¯¦æ
*/ |
| | | export function getStockTakingResult(id: number) { |
| | | return requestClient.get<WlsStockTakingResultApi.StockTakingResult>( |
| | | '/mes/wm/stocktaking-task-result/get', |
| | | { params: { id } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢çç¹ç»æ */ |
| | | export function createStockTakingResult( |
| | | data: WlsStockTakingResultApi.StockTakingResult, |
| | | ) { |
| | | return requestClient.post('/mes/wm/stocktaking-task-result/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹çç¹ç»æ */ |
| | | export function updateStockTakingResult( |
| | | data: WlsStockTakingResultApi.StockTakingResult, |
| | | ) { |
| | | return requestClient.put('/mes/wm/stocktaking-task-result/update', data); |
| | | } |
| | | |
| | | /** å é¤çç¹ç»æ */ |
| | | export function deleteStockTakingResult(id: number) { |
| | | return requestClient.delete( |
| | | `/mes/wm/stocktaking-task-result/delete?id=${id}`, |
| | | ); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsTransferDetailApi { |
| | | /** MES è°æ¨æç» */ |
| | | export interface TransferDetail { |
| | | id?: number; // ç¼å· |
| | | lineId?: number; // 转移åè¡ç¼å· |
| | | transferId?: number; // 转移åç¼å· |
| | | itemId?: number; // ç©æäº§åç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½åç§° |
| | | quantity?: number; // æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | toWarehouseId?: number; // ç§»å
¥ä»åºç¼å· |
| | | toWarehouseName?: string; // ç§»å
¥ä»åºåç§° |
| | | toLocationId?: number; // ç§»å
¥åºåºç¼å· |
| | | toLocationName?: string; // ç§»å
¥åºåºåç§° |
| | | toAreaId?: number; // ç§»å
¥åºä½ç¼å· |
| | | toAreaName?: string; // ç§»å
¥åºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢è°æ¨æç»åè¡¨ï¼æè¡ç¼å·ï¼ */ |
| | | export function getTransferDetailListByLineId(lineId: number) { |
| | | return requestClient.get<WlsTransferDetailApi.TransferDetail[]>( |
| | | '/mes/wm/transfer-detail/list-by-line', |
| | | { params: { lineId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢è°æ¨æç»è¯¦æ
*/ |
| | | export function getTransferDetail(id: number) { |
| | | return requestClient.get<WlsTransferDetailApi.TransferDetail>( |
| | | `/mes/wm/transfer-detail/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢è°æ¨æç» */ |
| | | export function createTransferDetail( |
| | | data: WlsTransferDetailApi.TransferDetail, |
| | | ) { |
| | | return requestClient.post('/mes/wm/transfer-detail/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹è°æ¨æç» */ |
| | | export function updateTransferDetail( |
| | | data: WlsTransferDetailApi.TransferDetail, |
| | | ) { |
| | | return requestClient.put('/mes/wm/transfer-detail/update', data); |
| | | } |
| | | |
| | | /** å é¤è°æ¨æç» */ |
| | | export function deleteTransferDetail(id: number) { |
| | | return requestClient.delete(`/mes/wm/transfer-detail/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsTransferApi { |
| | | /** MES 转移å */ |
| | | export interface Transfer { |
| | | id?: number; // ç¼å· |
| | | code?: string; // 转移åç¼å· |
| | | name?: string; // 转移ååç§° |
| | | type?: number; // 转移åç±»å |
| | | deliveryFlag?: boolean; // æ¯å¦é
é |
| | | recipientName?: string; // æ¶è´§äºº |
| | | recipientTelephone?: string; // èç³»çµè¯ |
| | | destinationAddress?: string; // ç®çå° |
| | | carrier?: string; // æ¿è¿å |
| | | shippingNumber?: string; // è¿è¾åå· |
| | | confirmFlag?: boolean; // æ¯å¦ç¡®è®¤ |
| | | transferDate?: string; // è½¬ç§»æ¥æ |
| | | status?: number; // åæ®ç¶æ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: number; // å建æ¶é´ |
| | | } |
| | | |
| | | /** MES 转移åå页æ¥è¯¢åæ° */ |
| | | export interface PageParams extends PageParam { |
| | | code?: string; |
| | | name?: string; |
| | | type?: number; |
| | | status?: number; |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢è½¬ç§»åå页 */ |
| | | export function getTransferPage(params: WlsTransferApi.PageParams) { |
| | | return requestClient.get<PageResult<WlsTransferApi.Transfer>>( |
| | | '/mes/wm/transfer/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢è½¬ç§»å详æ
*/ |
| | | export function getTransfer(id: number) { |
| | | return requestClient.get<WlsTransferApi.Transfer>( |
| | | `/mes/wm/transfer/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢è½¬ç§»å */ |
| | | export function createTransfer(data: WlsTransferApi.Transfer) { |
| | | return requestClient.post<number>('/mes/wm/transfer/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹è½¬ç§»å */ |
| | | export function updateTransfer(data: WlsTransferApi.Transfer) { |
| | | return requestClient.put('/mes/wm/transfer/update', data); |
| | | } |
| | | |
| | | /** å é¤è½¬ç§»å */ |
| | | export function deleteTransfer(id: number) { |
| | | return requestClient.delete(`/mes/wm/transfer/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æäº¤è½¬ç§»å */ |
| | | export function submitTransfer(id: number) { |
| | | return requestClient.put(`/mes/wm/transfer/submit?id=${id}`); |
| | | } |
| | | |
| | | /** å°è´§ç¡®è®¤ */ |
| | | export function confirmTransfer(id: number) { |
| | | return requestClient.put(`/mes/wm/transfer/confirm?id=${id}`); |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ */ |
| | | export function stockTransfer(id: number) { |
| | | return requestClient.put(`/mes/wm/transfer/stock?id=${id}`); |
| | | } |
| | | |
| | | /** å®æè½¬ç§» */ |
| | | export function finishTransfer(id: number) { |
| | | return requestClient.put(`/mes/wm/transfer/finish?id=${id}`); |
| | | } |
| | | |
| | | /** åæ¶è½¬ç§»å */ |
| | | export function cancelTransfer(id: number) { |
| | | return requestClient.put(`/mes/wm/transfer/cancel?id=${id}`); |
| | | } |
| | | |
| | | /** 导åºè½¬ç§»å */ |
| | | export function exportTransfer(params: any) { |
| | | return requestClient.download('/mes/wm/transfer/export-excel', { params }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsTransferLineApi { |
| | | /** MES 转移åè¡ */ |
| | | export interface TransferLine { |
| | | id?: number; // ç¼å· |
| | | transferId?: number; // 转移åç¼å· |
| | | materialStockId?: number; // åºåå°è´¦ç¼å· |
| | | itemId?: number; // ç©æäº§åç¼å· |
| | | itemCode?: string; // ç©æç¼ç |
| | | itemName?: string; // ç©æåç§° |
| | | specification?: string; // è§æ ¼åå· |
| | | unitMeasureName?: string; // åä½åç§° |
| | | quantity?: number; // 转移æ°é |
| | | batchId?: number; // æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | fromWarehouseId?: number; // ç§»åºä»åºç¼å· |
| | | fromWarehouseName?: string; // ç§»åºä»åºåç§° |
| | | fromLocationId?: number; // ç§»åºåºåºç¼å· |
| | | fromLocationName?: string; // ç§»åºåºåºåç§° |
| | | fromAreaId?: number; // ç§»åºåºä½ç¼å· |
| | | fromAreaName?: string; // ç§»åºåºä½åç§° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢è½¬ç§»åè¡å表 */ |
| | | export function getTransferLineList(transferId: number) { |
| | | return requestClient.get<WlsTransferLineApi.TransferLine[]>( |
| | | '/mes/wm/transfer-line/list', |
| | | { params: { transferId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢è½¬ç§»åè¡è¯¦æ
*/ |
| | | export function getTransferLine(id: number) { |
| | | return requestClient.get<WlsTransferLineApi.TransferLine>( |
| | | `/mes/wm/transfer-line/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢è½¬ç§»åè¡ */ |
| | | export function createTransferLine(data: WlsTransferLineApi.TransferLine) { |
| | | return requestClient.post('/mes/wm/transfer-line/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹è½¬ç§»åè¡ */ |
| | | export function updateTransferLine(data: WlsTransferLineApi.TransferLine) { |
| | | return requestClient.put('/mes/wm/transfer-line/update', data); |
| | | } |
| | | |
| | | /** å é¤è½¬ç§»åè¡ */ |
| | | export function deleteTransferLine(id: number) { |
| | | return requestClient.delete(`/mes/wm/transfer-line/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsWarehouseAreaApi { |
| | | /** MES åºä½ */ |
| | | export interface WarehouseArea { |
| | | id?: number; // åºä½ç¼å· |
| | | code?: string; // åºä½ç¼ç |
| | | name?: string; // åºä½åç§° |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | locationId?: number; // åºåºç¼å· |
| | | locationName?: string; // åºåºåç§° |
| | | area?: number; // é¢ç§¯ |
| | | maxLoad?: number; // æå¤§è½½è· |
| | | positionX?: number; // X åæ |
| | | positionY?: number; // Y åæ |
| | | positionZ?: number; // Z åæ |
| | | status?: number; // ç¶æ |
| | | frozen?: boolean; // æ¯å¦å»ç» |
| | | allowItemMixing?: boolean; // æ¯å¦å
è®¸ç©ææ··æ¾ |
| | | allowBatchMixing?: boolean; // æ¯å¦å
è®¸æ¹æ¬¡æ··æ¾ |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢åºä½å页 */ |
| | | export function getWarehouseAreaPage(params: PageParam) { |
| | | return requestClient.get<PageResult<WlsWarehouseAreaApi.WarehouseArea>>( |
| | | '/mes/wm/warehouse-area/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢åºä½ç²¾ç®å表 */ |
| | | export function getWarehouseAreaSimpleList(locationId?: number) { |
| | | return requestClient.get<WlsWarehouseAreaApi.WarehouseArea[]>( |
| | | '/mes/wm/warehouse-area/simple-list', |
| | | { params: { locationId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢åºä½è¯¦æ
*/ |
| | | export function getWarehouseArea(id: number) { |
| | | return requestClient.get<WlsWarehouseAreaApi.WarehouseArea>( |
| | | `/mes/wm/warehouse-area/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢åºä½ */ |
| | | export function createWarehouseArea(data: WlsWarehouseAreaApi.WarehouseArea) { |
| | | return requestClient.post('/mes/wm/warehouse-area/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹åºä½ */ |
| | | export function updateWarehouseArea(data: WlsWarehouseAreaApi.WarehouseArea) { |
| | | return requestClient.put('/mes/wm/warehouse-area/update', data); |
| | | } |
| | | |
| | | /** å é¤åºä½ */ |
| | | export function deleteWarehouseArea(id: number) { |
| | | return requestClient.delete(`/mes/wm/warehouse-area/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace MesWmWarehouseApi { |
| | | /** MES ä»åº */ |
| | | export interface Warehouse { |
| | | id?: number; // ä»åºç¼å· |
| | | code?: string; // ä»åºç¼ç |
| | | name?: string; // ä»åºåç§° |
| | | address?: string; // å°å |
| | | area?: number; // é¢ç§¯ |
| | | chargeUserId?: number; // è´è´£äºº |
| | | frozen?: boolean; // æ¯å¦å»ç» |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢ä»åºå页 */ |
| | | export function getWarehousePage(params: PageParam) { |
| | | return requestClient.get<PageResult<MesWmWarehouseApi.Warehouse>>( |
| | | '/mes/wm/warehouse/page', |
| | | { params }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢ä»åºç²¾ç®å表 */ |
| | | export function getWarehouseSimpleList() { |
| | | return requestClient.get<MesWmWarehouseApi.Warehouse[]>( |
| | | '/mes/wm/warehouse/simple-list', |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢ä»åºè¯¦æ
*/ |
| | | export function getWarehouse(id: number) { |
| | | return requestClient.get<MesWmWarehouseApi.Warehouse>( |
| | | `/mes/wm/warehouse/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢ä»åº */ |
| | | export function createWarehouse(data: MesWmWarehouseApi.Warehouse) { |
| | | return requestClient.post('/mes/wm/warehouse/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹ä»åº */ |
| | | export function updateWarehouse(data: MesWmWarehouseApi.Warehouse) { |
| | | return requestClient.put('/mes/wm/warehouse/update', data); |
| | | } |
| | | |
| | | /** å é¤ä»åº */ |
| | | export function deleteWarehouse(id: number) { |
| | | return requestClient.delete(`/mes/wm/warehouse/delete?id=${id}`); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WlsWarehouseLocationApi { |
| | | /** MES åºåº */ |
| | | export interface WarehouseLocation { |
| | | id?: number; // åºåºç¼å· |
| | | code?: string; // åºåºç¼ç |
| | | name?: string; // åºåºåç§° |
| | | warehouseId?: number; // ä»åºç¼å· |
| | | warehouseName?: string; // ä»åºåç§° |
| | | area?: number; // é¢ç§¯ |
| | | frozen?: boolean; // æ¯å¦å»ç» |
| | | remark?: string; // 夿³¨ |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢åºåºå页 */ |
| | | export function getWarehouseLocationPage(params: PageParam) { |
| | | return requestClient.get< |
| | | PageResult<WlsWarehouseLocationApi.WarehouseLocation> |
| | | >('/mes/wm/warehouse-location/page', { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢åºåºç²¾ç®å表 */ |
| | | export function getWarehouseLocationSimpleList(warehouseId?: number) { |
| | | return requestClient.get<WlsWarehouseLocationApi.WarehouseLocation[]>( |
| | | '/mes/wm/warehouse-location/simple-list', |
| | | { params: { warehouseId } }, |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢åºåºè¯¦æ
*/ |
| | | export function getWarehouseLocation(id: number) { |
| | | return requestClient.get<WlsWarehouseLocationApi.WarehouseLocation>( |
| | | `/mes/wm/warehouse-location/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢åºåº */ |
| | | export function createWarehouseLocation( |
| | | data: WlsWarehouseLocationApi.WarehouseLocation, |
| | | ) { |
| | | return requestClient.post('/mes/wm/warehouse-location/create', data); |
| | | } |
| | | |
| | | /** ä¿®æ¹åºåº */ |
| | | export function updateWarehouseLocation( |
| | | data: WlsWarehouseLocationApi.WarehouseLocation, |
| | | ) { |
| | | return requestClient.put('/mes/wm/warehouse-location/update', data); |
| | | } |
| | | |
| | | /** å é¤åºåº */ |
| | | export function deleteWarehouseLocation(id: number) { |
| | | return requestClient.delete(`/mes/wm/warehouse-location/delete?id=${id}`); |
| | | } |
| | | |
| | | /** æ¹é设置åºåºä¸ææåºä½çæ··æ¾è§å */ |
| | | export function updateAreaByLocationId( |
| | | locationId: number, |
| | | allowItemMixing?: boolean, |
| | | allowBatchMixing?: boolean, |
| | | ) { |
| | | return requestClient.put( |
| | | '/mes/wm/warehouse-location/update-by-location-id', |
| | | null, |
| | | { params: { allowBatchMixing, allowItemMixing, locationId } }, |
| | | ); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { PageParam, PageResult } from '../../../packages/effects/request/src'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace WmsApprovalApi { |
| | | /** 审æ¹é
ç½® */ |
| | | export interface ApprovalConfig { |
| | | id?: number; // é
ç½®ç¼å· |
| | | warehouseId: number; // ä»åºID |
| | | warehouseName?: string; // ä»åºåç§° |
| | | bizType: string; // ä¸å¡ç±»å(INBOUND/OUTBOUND/TRANSFER/CHECK) |
| | | approvalEnabled: boolean; // æ¯å¦å¯ç¨å®¡æ¹ |
| | | processDefinitionKey?: string; // æµç¨å®ä¹Key |
| | | processDefinitionName?: string; // æµç¨å®ä¹åç§° |
| | | categoryCode?: string; // æµç¨åç±»ç¼ç |
| | | createTime?: Date; // å建æ¶é´ |
| | | } |
| | | |
| | | /** æµç¨å®ä¹ç®åä¿¡æ¯ */ |
| | | export interface ProcessSimpleInfo { |
| | | key: string; // æµç¨å®ä¹Key |
| | | name: string; // æµç¨å®ä¹åç§° |
| | | } |
| | | |
| | | /** ä¸å¡ç±»åæä¸¾ */ |
| | | export type BizType = 'INBOUND' | 'OUTBOUND' | 'TRANSFER' | 'CHECK'; |
| | | } |
| | | |
| | | /** è·åå个审æ¹é
ç½® */ |
| | | export function getApprovalConfig(warehouseId: number, bizType: string) { |
| | | return requestClient.get<WmsApprovalApi.ApprovalConfig>( |
| | | '/mes/wms/approval/config/get', |
| | | { |
| | | params: { warehouseId, bizType }, |
| | | }, |
| | | ); |
| | | } |
| | | |
| | | /** è·åä»åºææå®¡æ¹é
ç½® */ |
| | | export function getApprovalConfigList(warehouseId: number) { |
| | | return requestClient.get<WmsApprovalApi.ApprovalConfig[]>( |
| | | '/mes/wms/approval/config/list', |
| | | { |
| | | params: { warehouseId }, |
| | | }, |
| | | ); |
| | | } |
| | | |
| | | /** è·åææä»åºç审æ¹é
ç½®å表 */ |
| | | export function getApprovalConfigAllList() { |
| | | return requestClient.get<WmsApprovalApi.ApprovalConfig[]>( |
| | | '/mes/wms/approval/config/all-list', |
| | | ); |
| | | } |
| | | |
| | | /** ä¿å审æ¹é
ç½® */ |
| | | export function saveApprovalConfig(data: WmsApprovalApi.ApprovalConfig) { |
| | | return requestClient.post('/mes/wms/approval/config/save', data); |
| | | } |
| | | |
| | | /** è·åå¯ç¨å®¡æ¹æµç¨å表 */ |
| | | export function getAvailableProcessList(warehouseId: number, bizType: string) { |
| | | return requestClient.get<WmsApprovalApi.ProcessSimpleInfo[]>( |
| | | '/mes/wms/approval/process-list', |
| | | { |
| | | params: { warehouseId, bizType }, |
| | | }, |
| | | ); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import ErpPurchaseOrderSelect from './select.vue'; |
| | | import ErpPurchaseOrderSelectDialog from './select-dialog.vue'; |
| | | |
| | | export { ErpPurchaseOrderSelect, ErpPurchaseOrderSelectDialog }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order'; |
| | | |
| | | import { nextTick, ref } from 'vue'; |
| | | |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getPurchaseOrderPage } from '#/api/erp/purchase/order'; |
| | | |
| | | defineOptions({ name: 'ErpPurchaseOrderSelectDialog' }); |
| | | |
| | | const emit = defineEmits<{ |
| | | selected: [rows: ErpPurchaseOrderApi.PurchaseOrder[]]; |
| | | }>(); |
| | | |
| | | const open = ref(false); |
| | | const multiple = ref(true); |
| | | const selectedRows = ref<ErpPurchaseOrderApi.PurchaseOrder[]>([]); |
| | | const preSelectedIds = ref<number[]>([]); |
| | | |
| | | /** è·åå½åè¡¨æ ¼æ°æ® */ |
| | | function getTableRows() { |
| | | return gridApi.grid.getTableData().fullData as ErpPurchaseOrderApi.PurchaseOrder[]; |
| | | } |
| | | |
| | | /** è·åå¤éè®°å½ */ |
| | | function getMultipleSelectedRows() { |
| | | const selectedMap = new Map<number, ErpPurchaseOrderApi.PurchaseOrder>(); |
| | | const records = [ |
| | | ...(gridApi.grid.getCheckboxReserveRecords?.() ?? []), |
| | | ...(gridApi.grid.getCheckboxRecords?.() ?? []), |
| | | ] as ErpPurchaseOrderApi.PurchaseOrder[]; |
| | | records.forEach((row) => { |
| | | if (row.id) { |
| | | selectedMap.set(row.id, row); |
| | | } |
| | | }); |
| | | return [...selectedMap.values()]; |
| | | } |
| | | |
| | | /** å¤çå¾éåå */ |
| | | function handleCheckboxSelectChange() { |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | |
| | | /** å¤çåéåå */ |
| | | function handleRadioChange(row: ErpPurchaseOrderApi.PurchaseOrder) { |
| | | selectedRows.value = [row]; |
| | | } |
| | | |
| | | /** å¤çè¡åå» */ |
| | | async function handleCellDblclick({ row }: { row: ErpPurchaseOrderApi.PurchaseOrder }) { |
| | | if (multiple.value) { |
| | | const selected = gridApi.grid.isCheckedByCheckboxRow(row); |
| | | await gridApi.grid.setCheckboxRow(row, !selected); |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | return; |
| | | } |
| | | selectedRows.value = [row]; |
| | | await gridApi.grid.setRadioRow(row); |
| | | handleConfirm(); |
| | | } |
| | | |
| | | /** åæ¾é¢ééè´è®¢å */ |
| | | async function applyPreSelection() { |
| | | if (preSelectedIds.value.length === 0) { |
| | | return; |
| | | } |
| | | const rows = getTableRows(); |
| | | for (const row of rows) { |
| | | if (row.id && preSelectedIds.value.includes(row.id)) { |
| | | if (multiple.value) { |
| | | await gridApi.grid.setCheckboxRow(row, true); |
| | | } else { |
| | | await gridApi.grid.setRadioRow(row); |
| | | selectedRows.value = [row]; |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | if (multiple.value) { |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | } |
| | | |
| | | /** åè¡¨åæ®µ */ |
| | | function useGridColumns(isMultiple: boolean): VxeTableGridOptions<ErpPurchaseOrderApi.PurchaseOrder>['columns'] { |
| | | return [ |
| | | { type: isMultiple ? 'checkbox' : 'radio', width: 50 }, |
| | | { field: 'no', title: '订åå·', minWidth: 140 }, |
| | | { field: 'supplierName', title: 'ä¾åºå', minWidth: 120 }, |
| | | { field: 'orderTime', title: 'è®¢åæ¶é´', width: 120, formatter: 'formatDate' }, |
| | | { field: 'totalCount', title: 'å计æ°é', width: 100 }, |
| | | { field: 'totalPrice', title: 'å计éé¢', width: 100 }, |
| | | ]; |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | gridOptions: { |
| | | columns: useGridColumns(true), |
| | | height: 400, |
| | | keepSource: true, |
| | | checkboxConfig: { |
| | | highlight: true, |
| | | reserve: true, |
| | | }, |
| | | radioConfig: { |
| | | highlight: true, |
| | | trigger: 'row', |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getPurchaseOrderPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | } as VxeTableGridOptions<ErpPurchaseOrderApi.PurchaseOrder>, |
| | | gridEvents: { |
| | | cellDblclick: handleCellDblclick, |
| | | checkboxAll: handleCheckboxSelectChange, |
| | | checkboxChange: handleCheckboxSelectChange, |
| | | radioChange: ({ row }: { row: ErpPurchaseOrderApi.PurchaseOrder }) => { |
| | | handleRadioChange(row); |
| | | }, |
| | | }, |
| | | }); |
| | | |
| | | /** éç½®æ¥è¯¢åéæ©ç¶æ */ |
| | | async function resetQueryState() { |
| | | selectedRows.value = []; |
| | | await gridApi.grid.clearCheckboxRow(); |
| | | await gridApi.grid.clearCheckboxReserve(); |
| | | await gridApi.grid.clearRadioRow(); |
| | | } |
| | | |
| | | /** æå¼éè´è®¢åéæ©å¼¹çª */ |
| | | async function openModal( |
| | | selectedIds?: number[], |
| | | options?: { multiple?: boolean }, |
| | | ) { |
| | | open.value = true; |
| | | multiple.value = options?.multiple ?? true; |
| | | preSelectedIds.value = selectedIds || []; |
| | | await nextTick(); |
| | | gridApi.setGridOptions({ |
| | | columns: useGridColumns(multiple.value), |
| | | }); |
| | | await resetQueryState(); |
| | | await gridApi.query(); |
| | | await nextTick(); |
| | | await applyPreSelection(); |
| | | } |
| | | |
| | | /** å
³ééè´è®¢åéæ©å¼¹çª */ |
| | | async function closeModal() { |
| | | open.value = false; |
| | | await resetQueryState(); |
| | | } |
| | | |
| | | /** ç¡®è®¤éæ©éè´è®¢å */ |
| | | function handleConfirm() { |
| | | const rows = multiple.value ? getMultipleSelectedRows() : selectedRows.value; |
| | | if (rows.length === 0) { |
| | | message.warning(multiple.value ? '请è³å°éæ©ä¸æ¡æ°æ®' : 'è¯·éæ©ä¸æ¡æ°æ®'); |
| | | return; |
| | | } |
| | | emit('selected', multiple.value ? rows : [rows[0]!]); |
| | | open.value = false; |
| | | } |
| | | |
| | | defineExpose({ open: openModal }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal |
| | | v-model:open="open" |
| | | title="éè´è®¢åéæ©" |
| | | width="70%" |
| | | :destroy-on-close="true" |
| | | @ok="handleConfirm" |
| | | @cancel="closeModal" |
| | | > |
| | | <Grid table-title="éè´è®¢åå表" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order'; |
| | | |
| | | import { computed, ref, useAttrs, watch } from 'vue'; |
| | | |
| | | import { IconifyIcon } from '../../../../../packages/icons/src'; |
| | | |
| | | import { Input, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getPurchaseOrder } from '#/api/erp/purchase/order'; |
| | | |
| | | import ErpPurchaseOrderSelectDialog from './select-dialog.vue'; |
| | | |
| | | defineOptions({ name: 'ErpPurchaseOrderSelect', inheritAttrs: false }); |
| | | |
| | | const props = withDefaults( |
| | | defineProps<{ |
| | | allowClear?: boolean; |
| | | disabled?: boolean; |
| | | modelValue?: number; |
| | | placeholder?: string; |
| | | }>(), |
| | | { |
| | | allowClear: true, |
| | | disabled: false, |
| | | modelValue: undefined, |
| | | placeholder: 'è¯·éæ©éè´è®¢å', |
| | | }, |
| | | ); |
| | | const emit = defineEmits<{ |
| | | change: [item: ErpPurchaseOrderApi.PurchaseOrder | undefined]; |
| | | 'update:modelValue': [value: number | undefined]; |
| | | }>(); |
| | | const attrs = useAttrs(); |
| | | const dialogRef = ref<InstanceType<typeof ErpPurchaseOrderSelectDialog>>(); |
| | | const hovering = ref(false); |
| | | const selectedItem = ref<ErpPurchaseOrderApi.PurchaseOrder>(); |
| | | |
| | | const displayLabel = computed(() => selectedItem.value?.no ?? ''); |
| | | const showClear = computed( |
| | | () => |
| | | props.allowClear && |
| | | !props.disabled && |
| | | hovering.value && |
| | | props.modelValue !== null, |
| | | ); |
| | | |
| | | /** æ ¹æ®éè´è®¢åç¼å·åæ¾éæ©å¨ */ |
| | | async function resolveItemById(id: number | undefined) { |
| | | if (!id) { |
| | | selectedItem.value = undefined; |
| | | return; |
| | | } |
| | | if (selectedItem.value?.id === id) { |
| | | return; |
| | | } |
| | | selectedItem.value = await getPurchaseOrder(id); |
| | | } |
| | | |
| | | watch( |
| | | () => props.modelValue, |
| | | (value) => { |
| | | resolveItemById(value); |
| | | }, |
| | | { immediate: true }, |
| | | ); |
| | | |
| | | /** æ¸
空已ééè´è®¢å */ |
| | | function clearSelected() { |
| | | selectedItem.value = undefined; |
| | | emit('update:modelValue', undefined); |
| | | emit('change', undefined); |
| | | } |
| | | |
| | | /** æå¼éè´è®¢åéæ©å¼¹çª */ |
| | | function handleClick(event: MouseEvent) { |
| | | if (props.disabled) { |
| | | return; |
| | | } |
| | | const target = event.target as HTMLElement; |
| | | if (showClear.value && target.closest('.ant-input-suffix')) { |
| | | event.stopPropagation(); |
| | | clearSelected(); |
| | | return; |
| | | } |
| | | const selectedIds = ( |
| | | props.modelValue === null ? [] : [props.modelValue] |
| | | ) as number[]; |
| | | dialogRef.value?.open(selectedIds, { multiple: false }); |
| | | } |
| | | |
| | | /** åå¡«éä¸çéè´è®¢å */ |
| | | function handleSelected(rows: ErpPurchaseOrderApi.PurchaseOrder[]) { |
| | | const item = rows[0]; |
| | | if (!item) { |
| | | return; |
| | | } |
| | | selectedItem.value = item; |
| | | emit('update:modelValue', item.id); |
| | | emit('change', item); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div |
| | | v-bind="attrs" |
| | | class="w-full" |
| | | :class="disabled ? 'cursor-not-allowed' : 'cursor-pointer'" |
| | | @click="handleClick" |
| | | @mouseenter="hovering = true" |
| | | @mouseleave="hovering = false" |
| | | > |
| | | <Tooltip :mouse-enter-delay="0.5" :open="selectedItem ? undefined : false"> |
| | | <template #title> |
| | | <div v-if="selectedItem" class="leading-6"> |
| | | <div>订åå·ï¼{{ selectedItem.no || '-' }}</div> |
| | | <div>ä¾åºåï¼{{ selectedItem.supplierName || '-' }}</div> |
| | | <div>è®¢åæ¶é´ï¼{{ selectedItem.orderTime || '-' }}</div> |
| | | <div>å计éé¢ï¼{{ selectedItem.totalPrice || '-' }} å
</div> |
| | | </div> |
| | | </template> |
| | | <Input |
| | | :disabled="disabled" |
| | | :placeholder="placeholder" |
| | | :value="displayLabel" |
| | | readonly |
| | | > |
| | | <template #suffix> |
| | | <IconifyIcon |
| | | class="size-4" |
| | | :icon="showClear ? 'lucide:circle-x' : 'lucide:search'" |
| | | /> |
| | | </template> |
| | | </Input> |
| | | </Tooltip> |
| | | </div> |
| | | <ErpPurchaseOrderSelectDialog ref="dialogRef" @selected="handleSelected" /> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { ErpWarehouseMappingApi } from '#/api/erp/warehouseMapping'; |
| | | |
| | | import { getWarehouseSimpleList as getErpWarehouseSimpleList } from '#/api/erp/stock/warehouse'; |
| | | import { getWarehouseSimpleList as getMesWarehouseSimpleList } from '#/api/mes/wm/warehouse'; |
| | | |
| | | /** ç¶æé项 */ |
| | | export const STATUS_OPTIONS = [ |
| | | { label: 'å¯ç¨', value: 1 }, |
| | | { label: 'ç¦ç¨', value: 0 }, |
| | | ]; |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'erpWarehouseId', |
| | | label: 'ERPä»åº', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | allowClear: true, |
| | | api: getErpWarehouseSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | placeholder: 'è¯·éæ©ERPä»åº', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'mesWarehouseId', |
| | | label: 'MESä»åº', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | allowClear: true, |
| | | api: getMesWarehouseSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | placeholder: 'è¯·éæ©MESä»åº', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'ç¶æ', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: STATUS_OPTIONS, |
| | | placeholder: 'è¯·éæ©ç¶æ', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<ErpWarehouseMappingApi.WarehouseMapping>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'erpWarehouseName', |
| | | title: 'ERPä»åº', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'mesWarehouseName', |
| | | title: 'MESä»åº', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'ç¶æ', |
| | | width: 100, |
| | | align: 'center', |
| | | cellRender: { |
| | | name: 'CellTag', |
| | | props: { |
| | | options: STATUS_OPTIONS, |
| | | colorKeyMap: { |
| | | 0: 'error', |
| | | 1: 'success', |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'createTime', |
| | | title: 'å建æ¶é´', |
| | | width: 180, |
| | | formatter: 'formatDateTime', |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 160, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'erpWarehouseId', |
| | | label: 'ERPä»åº', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | api: getErpWarehouseSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | placeholder: 'è¯·éæ©ERPä»åº', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'mesWarehouseId', |
| | | label: 'MESä»åº', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | api: getMesWarehouseSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | placeholder: 'è¯·éæ©MESä»åº', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'ç¶æ', |
| | | component: 'RadioGroup', |
| | | defaultValue: 1, |
| | | componentProps: { |
| | | options: STATUS_OPTIONS, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { ErpWarehouseMappingApi } from '#/api/erp/warehouseMapping'; |
| | | |
| | | import { Page, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteMapping, |
| | | getMappingPage, |
| | | } from '#/api/erp/warehouseMapping'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import MappingForm from './modules/form.vue'; |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | |
| | | defineOptions({ name: 'ErpWarehouseMapping' }); |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: MappingForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建æ å° */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾æ å° */ |
| | | function handleEdit(row: ErpWarehouseMappingApi.WarehouseMapping) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å 餿 å° */ |
| | | async function handleDelete(row: ErpWarehouseMappingApi.WarehouseMapping) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.erpWarehouseName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteMapping(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.erpWarehouseName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getMappingPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<ErpWarehouseMappingApi.WarehouseMapping>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="ä»åºæ å°å表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['ä»åºæ å°']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['erp:warehouse:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['erp:warehouse:update'], |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['erp:warehouse:delete'], |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.erpWarehouseName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { createMapping, getMapping, updateMapping } from '#/api/erp/warehouseMapping'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | |
| | | defineOptions({ name: 'ErpWarehouseMappingForm' }); |
| | | |
| | | const emit = defineEmits<{ success: [] }>(); |
| | | |
| | | const formType = ref<'create' | 'update'>('create'); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useFormSchema(), |
| | | showDefaultActions: false, |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const values = await formApi.getValues(); |
| | | try { |
| | | if (formType.value === 'create') { |
| | | await createMapping(values); |
| | | message.success('å建æå'); |
| | | } else { |
| | | await updateMapping(values); |
| | | message.success('æ´æ°æå'); |
| | | } |
| | | emit('success'); |
| | | modalApi.close(); |
| | | } catch (error) { |
| | | console.error('ä¿å失败:', error); |
| | | } |
| | | }, |
| | | onOpenChange(isOpen) { |
| | | if (isOpen) { |
| | | const data = modalApi.getData() as { |
| | | formType: 'create' | 'update'; |
| | | id?: number; |
| | | }; |
| | | if (data) { |
| | | formType.value = data.formType; |
| | | if (data.formType === 'update' && data.id) { |
| | | // å 载详æ
|
| | | getMapping(data.id).then((detail) => { |
| | | formApi.setValues(detail); |
| | | }); |
| | | } else { |
| | | formApi.resetForm(); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | const modalTitle = computed(() => { |
| | | return formType.value === 'create' ? 'æ°å¢ä»åºæ å°' : 'ç¼è¾ä»åºæ å°'; |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="modalTitle" class="w-[500px]"> |
| | | <Form /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { WmsApprovalApi } from '#/api/mes/wm/approval'; |
| | | |
| | | import { h } from 'vue'; |
| | | |
| | | import { Switch, Tag } from 'ant-design-vue'; |
| | | |
| | | import { getWarehouseSimpleList } from '#/api/mes/wm/warehouse'; |
| | | |
| | | /** ä¸å¡ç±»åé项 */ |
| | | export const BIZ_TYPE_OPTIONS = [ |
| | | { label: 'å
¥åºå®¡æ¹', value: 'INBOUND' }, |
| | | { label: 'åºåºå®¡æ¹', value: 'OUTBOUND' }, |
| | | { label: 'è°æ¨å®¡æ¹', value: 'TRANSFER' }, |
| | | { label: 'çç¹å®¡æ¹', value: 'CHECK' }, |
| | | ]; |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'ä»åº', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | allowClear: true, |
| | | api: getWarehouseSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | placeholder: 'è¯·éæ©ä»åº', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns( |
| | | handleChange: (row: any, bizType: string, enabled: boolean) => void, |
| | | ): VxeTableGridOptions['columns'] { |
| | | return [ |
| | | { |
| | | field: 'warehouseName', |
| | | title: 'ä»åºåç§°', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'warehouseCode', |
| | | title: 'ä»åºç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | title: 'å
¥åºå®¡æ¹', |
| | | width: 100, |
| | | align: 'center', |
| | | slots: { |
| | | default: ({ row }) => { |
| | | const config = row.configs?.find( |
| | | (c: WmsApprovalApi.ApprovalConfig) => c.bizType === 'INBOUND', |
| | | ); |
| | | return h(Switch, { |
| | | checked: config?.approvalEnabled ?? false, |
| | | checkedChildren: 'å¼', |
| | | unCheckedChildren: 'å
³', |
| | | onChange: (checked: boolean) => { |
| | | handleChange(row, 'INBOUND', checked); |
| | | }, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'åºåºå®¡æ¹', |
| | | width: 100, |
| | | align: 'center', |
| | | slots: { |
| | | default: ({ row }) => { |
| | | const config = row.configs?.find( |
| | | (c: WmsApprovalApi.ApprovalConfig) => c.bizType === 'OUTBOUND', |
| | | ); |
| | | return h(Switch, { |
| | | checked: config?.approvalEnabled ?? false, |
| | | checkedChildren: 'å¼', |
| | | unCheckedChildren: 'å
³', |
| | | onChange: (checked: boolean) => { |
| | | handleChange(row, 'OUTBOUND', checked); |
| | | }, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'è°æ¨å®¡æ¹', |
| | | width: 100, |
| | | align: 'center', |
| | | slots: { |
| | | default: ({ row }) => { |
| | | const config = row.configs?.find( |
| | | (c: WmsApprovalApi.ApprovalConfig) => c.bizType === 'TRANSFER', |
| | | ); |
| | | return h(Switch, { |
| | | checked: config?.approvalEnabled ?? false, |
| | | checkedChildren: 'å¼', |
| | | unCheckedChildren: 'å
³', |
| | | onChange: (checked: boolean) => { |
| | | handleChange(row, 'TRANSFER', checked); |
| | | }, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'çç¹å®¡æ¹', |
| | | width: 100, |
| | | align: 'center', |
| | | slots: { |
| | | default: ({ row }) => { |
| | | const config = row.configs?.find( |
| | | (c: WmsApprovalApi.ApprovalConfig) => c.bizType === 'CHECK', |
| | | ); |
| | | return h(Switch, { |
| | | checked: config?.approvalEnabled ?? false, |
| | | checkedChildren: 'å¼', |
| | | unCheckedChildren: 'å
³', |
| | | onChange: (checked: boolean) => { |
| | | handleChange(row, 'CHECK', checked); |
| | | }, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æµç¨é
ç½®', |
| | | minWidth: 200, |
| | | slots: { |
| | | default: ({ row }) => { |
| | | const configs = row.configs || []; |
| | | if (configs.length === 0) { |
| | | return h(Tag, { color: 'default' }, () => 'æªé
ç½®'); |
| | | } |
| | | const enabledConfigs = configs.filter( |
| | | (c: WmsApprovalApi.ApprovalConfig) => c.approvalEnabled, |
| | | ); |
| | | if (enabledConfigs.length === 0) { |
| | | return h(Tag, { color: 'default' }, () => 'æªé
ç½®'); |
| | | } |
| | | return h( |
| | | 'div', |
| | | { class: 'flex flex-wrap gap-1' }, |
| | | enabledConfigs.map((config: WmsApprovalApi.ApprovalConfig) => { |
| | | const option = BIZ_TYPE_OPTIONS.find( |
| | | (o) => o.value === config.bizType, |
| | | ); |
| | | return h( |
| | | Tag, |
| | | { |
| | | color: config.processDefinitionKey ? 'green' : 'orange', |
| | | }, |
| | | () => option?.label || config.bizType, |
| | | ); |
| | | }), |
| | | ); |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 100, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** æµç¨é
置表å */ |
| | | export function useProcessFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'ä»åº', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'bizType', |
| | | label: 'ä¸å¡ç±»å', |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: BIZ_TYPE_OPTIONS, |
| | | placeholder: 'è¯·éæ©ä¸å¡ç±»å', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'processDefinitionKey', |
| | | label: 'å®¡æ¹æµç¨', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | allowClear: true, |
| | | labelField: 'name', |
| | | valueField: 'key', |
| | | placeholder: 'è¯·éæ©å®¡æ¹æµç¨', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { WmsApprovalApi } from '#/api/mes/wm/approval'; |
| | | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { Page, useVbenModal } from '../../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { saveApprovalConfig } from '#/api/mes/wm/approval'; |
| | | |
| | | import ProcessConfigForm from './modules/process-config-form.vue'; |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | |
| | | defineOptions({ name: 'WlsApprovalConfig' }); |
| | | |
| | | const [ProcessConfigModal, processConfigModalApi] = useVbenModal({ |
| | | connectedComponent: ProcessConfigForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** ä»åºé
ç½®å表 */ |
| | | const warehouseConfigList = ref<any[]>([]); |
| | | |
| | | /** 审æ¹å¼å
³åæ´ */ |
| | | async function handleApprovalChange( |
| | | row: any, |
| | | bizType: string, |
| | | enabled: boolean, |
| | | ) { |
| | | try { |
| | | await saveApprovalConfig({ |
| | | warehouseId: row.warehouseId, |
| | | bizType: bizType as WmsApprovalApi.BizType, |
| | | approvalEnabled: enabled, |
| | | }); |
| | | // æ´æ°æ¬å°æ°æ® |
| | | const config = row.configs?.find( |
| | | (c: WmsApprovalApi.ApprovalConfig) => c.bizType === bizType, |
| | | ); |
| | | if (config) { |
| | | config.approvalEnabled = enabled; |
| | | } else { |
| | | row.configs = row.configs || []; |
| | | row.configs.push({ |
| | | warehouseId: row.warehouseId, |
| | | bizType, |
| | | approvalEnabled: enabled, |
| | | }); |
| | | } |
| | | message.success('é
ç½®ä¿åæå'); |
| | | } catch { |
| | | gridApi.query(); |
| | | } |
| | | } |
| | | |
| | | /** é
ç½®æµç¨ */ |
| | | function handleConfigProcess(row: any) { |
| | | processConfigModalApi.setData({ warehouseId: row.warehouseId, warehouseName: row.warehouseName }).open(); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(handleApprovalChange), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | data: warehouseConfigList, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | // TODO: è°ç¨å端æ¥å£è·åææä»åºåå
¶å®¡æ¹é
ç½® |
| | | return { list: [], total: 0 }; |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'warehouseId', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height> |
| | | <ProcessConfigModal @success="gridApi.query()" /> |
| | | |
| | | <Grid table-title="审æ¹é
ç½®"> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: 'é
ç½®æµç¨', |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-approval:save'], |
| | | onClick: handleConfigProcess.bind(null, row), |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { WmsApprovalApi } from '#/api/mes/wm/approval'; |
| | | |
| | | import { computed, ref, watch } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | getAvailableProcessList, |
| | | getApprovalConfig, |
| | | saveApprovalConfig, |
| | | } from '#/api/mes/wm/approval'; |
| | | |
| | | import { BIZ_TYPE_OPTIONS, useProcessFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits<{ success: [] }>(); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useProcessFormSchema(), |
| | | showDefaultActions: false, |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const values = await formApi.getValues(); |
| | | if (!values.bizType) { |
| | | message.error('è¯·éæ©ä¸å¡ç±»å'); |
| | | return; |
| | | } |
| | | if (!values.processDefinitionKey) { |
| | | message.error('è¯·éæ©å®¡æ¹æµç¨'); |
| | | return; |
| | | } |
| | | |
| | | await saveApprovalConfig({ |
| | | warehouseId: values.warehouseId, |
| | | bizType: values.bizType, |
| | | approvalEnabled: true, |
| | | processDefinitionKey: values.processDefinitionKey, |
| | | }); |
| | | message.success('é
ç½®ä¿åæå'); |
| | | emit('success'); |
| | | modalApi.close(); |
| | | }, |
| | | onOpenChange(isOpen) { |
| | | if (isOpen) { |
| | | const data = modalApi.getData() as { |
| | | warehouseId: number; |
| | | warehouseName: string; |
| | | }; |
| | | if (data) { |
| | | formApi.setValues({ |
| | | warehouseId: data.warehouseId, |
| | | warehouseName: data.warehouseName, |
| | | bizType: undefined, |
| | | processDefinitionKey: undefined, |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | /** å½åéä¸çä¸å¡ç±»å */ |
| | | const currentBizType = computed(() => { |
| | | const values = formApi.getValues(); |
| | | return values.bizType; |
| | | }); |
| | | |
| | | /** çå¬ä¸å¡ç±»åååï¼å 载对åºçæµç¨å表 */ |
| | | watch(currentBizType, async (bizType) => { |
| | | if (bizType) { |
| | | const data = modalApi.getData() as { warehouseId: number }; |
| | | if (data?.warehouseId) { |
| | | try { |
| | | const config = await getApprovalConfig(data.warehouseId, bizType); |
| | | if (config) { |
| | | formApi.setValues({ |
| | | processDefinitionKey: config.processDefinitionKey, |
| | | }); |
| | | } |
| | | } catch { |
| | | // 忽ç¥é误 |
| | | } |
| | | |
| | | formApi.updateSchema([ |
| | | { |
| | | fieldName: 'processDefinitionKey', |
| | | componentProps: { |
| | | api: async () => { |
| | | return await getAvailableProcessList(data.warehouseId, bizType); |
| | | }, |
| | | }, |
| | | }, |
| | | ]); |
| | | } |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal title="é
ç½®å®¡æ¹æµç¨" class="w-[500px]"> |
| | | <Form /> |
| | | </Modal> |
| | | </template> |
copy from src/views/mes/wm/arrivalnotice/components/index.ts
copy to src/views/wls/arrivalnotice/components/index.ts
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmArrivalNoticeLineApi } from '#/api/mes/wm/arrivalnotice/line'; |
| | | |
| | | import { nextTick, ref } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '../../../../packages/constants/src'; |
| | | |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getArrivalNoticeLinePage } from '#/api/mes/wm/arrivalnotice/line'; |
| | | |
| | | const emit = defineEmits<{ |
| | | selected: [rows: MesWmArrivalNoticeLineApi.ArrivalNoticeLine[]]; |
| | | }>(); |
| | | |
| | | const open = ref(false); // å¼¹çªæ¯å¦æå¼ |
| | | const noticeId = ref<number>(); // æå±éç¥åç¼å· |
| | | const syncingSingleSelection = ref(false); // æ¯å¦åæ¥åéå¾éç¶æ |
| | | const selectedRows = ref<MesWmArrivalNoticeLineApi.ArrivalNoticeLine[]>([]); // å·²éè¡å表 |
| | | const preSelectedIds = ref<number[]>([]); // é¢éè¡ç¼å·å表 |
| | | |
| | | /** è¡¨æ ¼åæ®µ */ |
| | | function useGridColumns(): VxeTableGridOptions<MesWmArrivalNoticeLineApi.ArrivalNoticeLine>['columns'] { |
| | | return [ |
| | | { |
| | | type: 'checkbox', |
| | | width: 50, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: 'ç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'ç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'arrivalQuantity', |
| | | title: 'å°è´§æ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'iqcCheckFlag', |
| | | title: 'æ¯å¦æ£éª', |
| | | width: 90, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'qualifiedQuantity', |
| | | title: 'åæ ¼æ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'remark', |
| | | title: '夿³¨', |
| | | minWidth: 120, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å鿍¡å¼ä¸åæ¥ VXE å¾éç¶æ */ |
| | | async function syncSingleSelection( |
| | | row?: MesWmArrivalNoticeLineApi.ArrivalNoticeLine, |
| | | ) { |
| | | syncingSingleSelection.value = true; |
| | | await nextTick(); |
| | | await gridApi.grid.clearCheckboxRow(); |
| | | if (row) { |
| | | await gridApi.grid.setCheckboxRow(row, true); |
| | | } |
| | | await nextTick(); |
| | | syncingSingleSelection.value = false; |
| | | } |
| | | |
| | | /** å¤çå¾éååï¼åªä¿çæå䏿¡ */ |
| | | async function handleCheckboxChange({ |
| | | checked, |
| | | row, |
| | | }: { |
| | | checked: boolean; |
| | | row?: MesWmArrivalNoticeLineApi.ArrivalNoticeLine; |
| | | }) { |
| | | if (syncingSingleSelection.value) { |
| | | return; |
| | | } |
| | | const selected = checked && row ? [row] : []; |
| | | selectedRows.value = selected; |
| | | await syncSingleSelection(selected[0]); |
| | | } |
| | | |
| | | /** åæ¾é¢éè¡ */ |
| | | function applyPreSelection() { |
| | | if (preSelectedIds.value.length === 0) { |
| | | return; |
| | | } |
| | | const rows = |
| | | gridApi.grid.getData() as MesWmArrivalNoticeLineApi.ArrivalNoticeLine[]; |
| | | for (const row of rows) { |
| | | if (row.id && preSelectedIds.value.includes(row.id)) { |
| | | gridApi.grid.setCheckboxRow(row, true); |
| | | selectedRows.value = [row]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 460, |
| | | keepSource: true, |
| | | checkboxConfig: { |
| | | highlight: true, |
| | | reserve: true, |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }) => { |
| | | if (!noticeId.value) { |
| | | return { list: [], total: 0 }; |
| | | } |
| | | return await getArrivalNoticeLinePage({ |
| | | noticeId: noticeId.value, |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmArrivalNoticeLineApi.ArrivalNoticeLine>, |
| | | gridEvents: { |
| | | checkboxChange: handleCheckboxChange, |
| | | }, |
| | | }); |
| | | |
| | | /** æå¼è¡éæ©å¼¹çª */ |
| | | async function openModal(id: number | undefined, selectedIds?: number[]) { |
| | | open.value = true; |
| | | noticeId.value = id; |
| | | preSelectedIds.value = selectedIds || []; |
| | | selectedRows.value = []; |
| | | await nextTick(); |
| | | await gridApi.grid.clearCheckboxRow(); |
| | | await gridApi.query(); |
| | | await nextTick(); |
| | | applyPreSelection(); |
| | | } |
| | | |
| | | /** å
³éå¼¹çª */ |
| | | async function closeModal() { |
| | | open.value = false; |
| | | selectedRows.value = []; |
| | | await gridApi.grid.clearCheckboxRow(); |
| | | } |
| | | |
| | | /** ç¡®è®¤éæ©è¡ */ |
| | | function handleConfirm() { |
| | | if (selectedRows.value.length === 0) { |
| | | message.warning('è¯·éæ©ä¸æ¡æ°æ®'); |
| | | return; |
| | | } |
| | | emit('selected', [selectedRows.value[0]!]); |
| | | open.value = false; |
| | | } |
| | | |
| | | defineExpose({ open: openModal }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal |
| | | v-model:open="open" |
| | | title="å°è´§éç¥åè¡éæ©" |
| | | width="70%" |
| | | :destroy-on-close="true" |
| | | @cancel="closeModal" |
| | | @ok="handleConfirm" |
| | | > |
| | | <Grid table-title="å°è´§éç¥åè¡å表" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmArrivalNoticeLineApi } from '#/api/mes/wm/arrivalnotice/line'; |
| | | |
| | | import { computed, ref, useAttrs, watch } from 'vue'; |
| | | |
| | | import { IconifyIcon } from '../../../../packages/icons/src'; |
| | | |
| | | import { Input, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getArrivalNoticeLine } from '#/api/mes/wm/arrivalnotice/line'; |
| | | |
| | | import WmArrivalNoticeLineSelectDialog from './line-select-dialog.vue'; |
| | | |
| | | defineOptions({ name: 'WmArrivalNoticeLineSelect', inheritAttrs: false }); |
| | | |
| | | const props = withDefaults( |
| | | defineProps<{ |
| | | allowClear?: boolean; |
| | | disabled?: boolean; |
| | | modelValue?: number; |
| | | noticeId?: number; // æå±å°è´§éç¥åç¼å· |
| | | placeholder?: string; |
| | | }>(), |
| | | { |
| | | allowClear: true, |
| | | disabled: false, |
| | | modelValue: undefined, |
| | | noticeId: undefined, |
| | | placeholder: 'è¯·éæ©å°è´§éç¥åè¡', |
| | | }, |
| | | ); |
| | | |
| | | const emit = defineEmits<{ |
| | | change: [item: MesWmArrivalNoticeLineApi.ArrivalNoticeLine | undefined]; |
| | | 'update:modelValue': [value: number | undefined]; |
| | | }>(); |
| | | |
| | | const attrs = useAttrs(); |
| | | const dialogRef = ref<InstanceType<typeof WmArrivalNoticeLineSelectDialog>>(); |
| | | const hovering = ref(false); |
| | | const selectedItem = ref<MesWmArrivalNoticeLineApi.ArrivalNoticeLine>(); |
| | | |
| | | const displayLabel = computed(() => { |
| | | const item = selectedItem.value; |
| | | if (!item) { |
| | | return ''; |
| | | } |
| | | return `${item.itemCode ?? ''} - ${item.itemName ?? ''}`; |
| | | }); |
| | | |
| | | const showClear = computed( |
| | | () => |
| | | props.allowClear && |
| | | !props.disabled && |
| | | hovering.value && |
| | | props.modelValue !== null, |
| | | ); |
| | | |
| | | /** æ ¹æ®ç¼å·åæ¡æ¥è¯¢è¡ä¿¡æ¯ï¼ç¨äºç¼è¾åæ¾ï¼ */ |
| | | async function resolveItemById(id: number | undefined) { |
| | | if (!id) { |
| | | selectedItem.value = undefined; |
| | | return; |
| | | } |
| | | if (selectedItem.value?.id === id) { |
| | | return; |
| | | } |
| | | selectedItem.value = await getArrivalNoticeLine(id); |
| | | } |
| | | |
| | | watch(() => props.modelValue, resolveItemById, { immediate: true }); |
| | | |
| | | /** noticeId ååæ¶æ¸
空éä¸ï¼å
³èçè¡å·²å¤±æï¼ */ |
| | | watch( |
| | | () => props.noticeId, |
| | | () => { |
| | | selectedItem.value = undefined; |
| | | emit('update:modelValue', undefined); |
| | | emit('change', undefined); |
| | | }, |
| | | ); |
| | | |
| | | /** æ¸
空已éè¡ */ |
| | | function clearSelected() { |
| | | selectedItem.value = undefined; |
| | | emit('update:modelValue', undefined); |
| | | emit('change', undefined); |
| | | } |
| | | |
| | | /** æå¼è¡éæ©å¼¹çª */ |
| | | function handleClick(event: MouseEvent) { |
| | | if (props.disabled || !props.noticeId) { |
| | | return; |
| | | } |
| | | const target = event.target as HTMLElement; |
| | | if (showClear.value && target.closest('.ant-input-suffix')) { |
| | | event.stopPropagation(); |
| | | clearSelected(); |
| | | return; |
| | | } |
| | | const selectedIds = ( |
| | | props.modelValue === null ? [] : [props.modelValue] |
| | | ) as number[]; |
| | | dialogRef.value?.open(props.noticeId, selectedIds); |
| | | } |
| | | |
| | | /** å¼¹çªéä¸åè° */ |
| | | function handleSelected(rows: MesWmArrivalNoticeLineApi.ArrivalNoticeLine[]) { |
| | | const item = rows[0]; |
| | | if (!item) { |
| | | return; |
| | | } |
| | | selectedItem.value = item; |
| | | emit('update:modelValue', item.id); |
| | | emit('change', item); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div |
| | | v-bind="attrs" |
| | | class="w-full" |
| | | :class="disabled ? 'cursor-not-allowed' : 'cursor-pointer'" |
| | | @click="handleClick" |
| | | @mouseenter="hovering = true" |
| | | @mouseleave="hovering = false" |
| | | > |
| | | <Tooltip :mouse-enter-delay="0.5" :open="selectedItem ? undefined : false"> |
| | | <template #title> |
| | | <div v-if="selectedItem" class="leading-6"> |
| | | <div>ç©æç¼ç ï¼{{ selectedItem.itemCode || '-' }}</div> |
| | | <div>ç©æåç§°ï¼{{ selectedItem.itemName || '-' }}</div> |
| | | <div>è§æ ¼åå·ï¼{{ selectedItem.specification || '-' }}</div> |
| | | <div>å°è´§æ°éï¼{{ selectedItem.arrivalQuantity ?? '-' }}</div> |
| | | </div> |
| | | </template> |
| | | <Input |
| | | :disabled="disabled" |
| | | :placeholder="placeholder" |
| | | :value="displayLabel" |
| | | readonly |
| | | > |
| | | <template #suffix> |
| | | <IconifyIcon |
| | | class="size-4" |
| | | :icon="showClear ? 'lucide:circle-x' : 'lucide:search'" |
| | | /> |
| | | </template> |
| | | </Input> |
| | | </Tooltip> |
| | | </div> |
| | | <WmArrivalNoticeLineSelectDialog ref="dialogRef" @selected="handleSelected" /> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmArrivalNoticeApi } from '#/api/mes/wm/arrivalnotice'; |
| | | |
| | | import { nextTick, ref } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '../../../../packages/constants/src'; |
| | | |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getArrivalNoticePage } from '#/api/mes/wm/arrivalnotice'; |
| | | |
| | | const emit = defineEmits<{ |
| | | selected: [rows: MesWmArrivalNoticeApi.ArrivalNotice[]]; |
| | | }>(); |
| | | |
| | | const open = ref(false); // å¼¹çªæ¯å¦æå¼ |
| | | const multiple = ref(false); // æ¯å¦å¤é |
| | | const fixedStatus = ref<number>(); // åºå®ç¶æçé |
| | | const selectedRows = ref<MesWmArrivalNoticeApi.ArrivalNotice[]>([]); // å·²ééç¥åå表 |
| | | const preSelectedIds = ref<number[]>([]); // é¢ééç¥åç¼å·å表 |
| | | |
| | | /** æç´¢è¡¨å */ |
| | | function useSearchSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'éç¥åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éç¥åç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'éç¥ååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éç¥ååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderCode', |
| | | label: 'éè´è®¢åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éè´è®¢åç¼å·', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** è¡¨æ ¼åæ®µ */ |
| | | function useGridColumns( |
| | | multipleSelect = false, |
| | | ): VxeTableGridOptions<MesWmArrivalNoticeApi.ArrivalNotice>['columns'] { |
| | | return [ |
| | | { |
| | | type: multipleSelect ? 'checkbox' : 'radio', |
| | | width: 50, |
| | | }, |
| | | { |
| | | field: 'code', |
| | | title: 'éç¥åç¼å·', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: 'éç¥ååç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'purchaseOrderCode', |
| | | title: 'éè´è®¢åç¼å·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'vendorName', |
| | | title: 'ä¾åºååç§°', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'arrivalDate', |
| | | title: 'å°è´§æ¥æ', |
| | | width: 120, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_ARRIVAL_NOTICE_STATUS }, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** è·åå¤éè®°å½ï¼å
å« VXE reserve è·¨é¡µè®°å½ */ |
| | | function getMultipleSelectedRows() { |
| | | const selectedMap = new Map<number, MesWmArrivalNoticeApi.ArrivalNotice>(); |
| | | const records = [ |
| | | ...(gridApi.grid.getCheckboxReserveRecords?.() ?? []), |
| | | ...(gridApi.grid.getCheckboxRecords?.() ?? []), |
| | | ] as MesWmArrivalNoticeApi.ArrivalNotice[]; |
| | | records.forEach((row) => { |
| | | const rowId = row.id; |
| | | if (rowId !== undefined) { |
| | | selectedMap.set(rowId, row); |
| | | } |
| | | }); |
| | | return [...selectedMap.values()]; |
| | | } |
| | | |
| | | /** å¤çå¤éå¾éåå */ |
| | | function handleCheckboxSelectChange() { |
| | | if (!multiple.value) { |
| | | return; |
| | | } |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | |
| | | /** å¤çåé忢 */ |
| | | function handleRadioChange(row: MesWmArrivalNoticeApi.ArrivalNotice) { |
| | | selectedRows.value = [row]; |
| | | } |
| | | |
| | | /** å¤é模å¼ä¸åæ¢è¡å¾é */ |
| | | async function toggleMultipleRow(row: MesWmArrivalNoticeApi.ArrivalNotice) { |
| | | const selected = gridApi.grid.isCheckedByCheckboxRow(row); |
| | | await gridApi.grid.setCheckboxRow(row, !selected); |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | |
| | | /** å¤çè¡åå»ï¼åéç´æ¥ç¡®è®¤ï¼å¤é忢å¾é */ |
| | | async function handleCellDblclick({ |
| | | row, |
| | | }: { |
| | | row: MesWmArrivalNoticeApi.ArrivalNotice; |
| | | }) { |
| | | if (multiple.value) { |
| | | await toggleMultipleRow(row); |
| | | return; |
| | | } |
| | | selectedRows.value = [row]; |
| | | await gridApi.grid.setRadioRow(row); |
| | | handleConfirm(); |
| | | } |
| | | |
| | | /** åæ¾é¢ééç¥å */ |
| | | async function applyPreSelection() { |
| | | if (preSelectedIds.value.length === 0) { |
| | | return; |
| | | } |
| | | const rows = gridApi.grid.getData() as MesWmArrivalNoticeApi.ArrivalNotice[]; |
| | | for (const row of rows) { |
| | | if (row.id === undefined || !preSelectedIds.value.includes(row.id)) { |
| | | continue; |
| | | } |
| | | if (multiple.value) { |
| | | await gridApi.grid.setCheckboxRow(row, true); |
| | | } else { |
| | | await gridApi.grid.setRadioRow(row); |
| | | selectedRows.value = [row]; |
| | | return; |
| | | } |
| | | } |
| | | if (multiple.value) { |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useSearchSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(false), |
| | | height: 520, |
| | | keepSource: true, |
| | | checkboxConfig: { |
| | | highlight: true, |
| | | range: true, |
| | | reserve: true, |
| | | }, |
| | | radioConfig: { |
| | | highlight: true, |
| | | trigger: 'row', |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getArrivalNoticePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | status: fixedStatus.value, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmArrivalNoticeApi.ArrivalNotice>, |
| | | gridEvents: { |
| | | cellDblclick: handleCellDblclick, |
| | | checkboxAll: handleCheckboxSelectChange, |
| | | checkboxChange: handleCheckboxSelectChange, |
| | | radioChange: ({ row }: { row: MesWmArrivalNoticeApi.ArrivalNotice }) => { |
| | | handleRadioChange(row); |
| | | }, |
| | | }, |
| | | }); |
| | | |
| | | /** éç½®æ¥è¯¢åéæ©ç¶æ */ |
| | | async function resetQueryState() { |
| | | selectedRows.value = []; |
| | | await gridApi.grid.clearCheckboxRow(); |
| | | await gridApi.grid.clearCheckboxReserve(); |
| | | await gridApi.grid.clearRadioRow(); |
| | | await gridApi.formApi.resetForm(); |
| | | } |
| | | |
| | | /** æå¼éç¥åéæ©å¼¹çª */ |
| | | async function openModal( |
| | | selectedIds?: number[], |
| | | options?: { multiple?: boolean; status?: number }, |
| | | ) { |
| | | open.value = true; |
| | | multiple.value = options?.multiple ?? false; |
| | | fixedStatus.value = options?.status; |
| | | preSelectedIds.value = selectedIds || []; |
| | | await nextTick(); |
| | | gridApi.setGridOptions({ |
| | | columns: useGridColumns(multiple.value), |
| | | }); |
| | | await resetQueryState(); |
| | | await gridApi.query(); |
| | | await nextTick(); |
| | | await applyPreSelection(); |
| | | } |
| | | |
| | | /** å
³ééç¥åéæ©å¼¹çª */ |
| | | async function closeModal() { |
| | | open.value = false; |
| | | await resetQueryState(); |
| | | } |
| | | |
| | | /** ç¡®è®¤éæ©éç¥å */ |
| | | function handleConfirm() { |
| | | if (selectedRows.value.length === 0) { |
| | | message.warning(multiple.value ? '请è³å°éæ©ä¸æ¡æ°æ®' : 'è¯·éæ©ä¸æ¡æ°æ®'); |
| | | return; |
| | | } |
| | | emit( |
| | | 'selected', |
| | | multiple.value ? selectedRows.value : [selectedRows.value[0]!], |
| | | ); |
| | | open.value = false; |
| | | } |
| | | |
| | | defineExpose({ open: openModal }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal |
| | | v-model:open="open" |
| | | title="å°è´§éç¥åéæ©" |
| | | width="70%" |
| | | :destroy-on-close="true" |
| | | @cancel="closeModal" |
| | | @ok="handleConfirm" |
| | | > |
| | | <Grid table-title="å°è´§éç¥åå表" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmArrivalNoticeApi } from '#/api/mes/wm/arrivalnotice'; |
| | | |
| | | import { computed, ref, useAttrs, watch } from 'vue'; |
| | | |
| | | import { IconifyIcon } from '../../../../packages/icons/src'; |
| | | |
| | | import { Input, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getArrivalNotice } from '#/api/mes/wm/arrivalnotice'; |
| | | |
| | | import WmArrivalNoticeSelectDialog from './select-dialog.vue'; |
| | | |
| | | defineOptions({ name: 'WmArrivalNoticeSelect', inheritAttrs: false }); |
| | | |
| | | const props = withDefaults( |
| | | defineProps<{ |
| | | allowClear?: boolean; |
| | | disabled?: boolean; |
| | | modelValue?: number; |
| | | placeholder?: string; |
| | | status?: number; // åºå®ç¶æçé |
| | | }>(), |
| | | { |
| | | allowClear: true, |
| | | disabled: false, |
| | | modelValue: undefined, |
| | | placeholder: 'è¯·éæ©å°è´§éç¥å', |
| | | status: undefined, |
| | | }, |
| | | ); |
| | | |
| | | const emit = defineEmits<{ |
| | | change: [item: MesWmArrivalNoticeApi.ArrivalNotice | undefined]; |
| | | 'update:modelValue': [value: number | undefined]; |
| | | }>(); |
| | | |
| | | const attrs = useAttrs(); |
| | | const dialogRef = ref<InstanceType<typeof WmArrivalNoticeSelectDialog>>(); |
| | | const hovering = ref(false); |
| | | const selectedItem = ref<MesWmArrivalNoticeApi.ArrivalNotice>(); |
| | | |
| | | const displayLabel = computed(() => selectedItem.value?.code ?? ''); |
| | | |
| | | const showClear = computed( |
| | | () => |
| | | props.allowClear && |
| | | !props.disabled && |
| | | hovering.value && |
| | | props.modelValue !== undefined && |
| | | props.modelValue !== null, |
| | | ); |
| | | |
| | | /** æ ¹æ®ç¼å·åæ¡æ¥è¯¢éç¥åä¿¡æ¯ï¼ç¨äºç¼è¾åæ¾ï¼ */ |
| | | async function resolveItemById(id: number | undefined) { |
| | | if (!id) { |
| | | selectedItem.value = undefined; |
| | | return; |
| | | } |
| | | if (selectedItem.value?.id === id) { |
| | | return; |
| | | } |
| | | selectedItem.value = await getArrivalNotice(id); |
| | | } |
| | | |
| | | watch(() => props.modelValue, resolveItemById, { immediate: true }); |
| | | |
| | | /** æ¸
空已ééç¥å */ |
| | | function clearSelected() { |
| | | selectedItem.value = undefined; |
| | | emit('update:modelValue', undefined); |
| | | emit('change', undefined); |
| | | } |
| | | |
| | | /** æå¼éç¥åéæ©å¼¹çª */ |
| | | function handleClick(event: MouseEvent) { |
| | | if (props.disabled) { |
| | | return; |
| | | } |
| | | const target = event.target as HTMLElement; |
| | | if (showClear.value && target.closest('.ant-input-suffix')) { |
| | | event.stopPropagation(); |
| | | clearSelected(); |
| | | return; |
| | | } |
| | | const selectedIds = ( |
| | | props.modelValue === null ? [] : [props.modelValue] |
| | | ) as number[]; |
| | | dialogRef.value?.open(selectedIds, { |
| | | multiple: false, |
| | | status: props.status, |
| | | }); |
| | | } |
| | | |
| | | /** å¼¹çªéä¸åè° */ |
| | | function handleSelected(rows: MesWmArrivalNoticeApi.ArrivalNotice[]) { |
| | | const item = rows[0]; |
| | | if (!item) { |
| | | return; |
| | | } |
| | | selectedItem.value = item; |
| | | emit('update:modelValue', item.id); |
| | | emit('change', item); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div |
| | | v-bind="attrs" |
| | | class="w-full" |
| | | :class="disabled ? 'cursor-not-allowed' : 'cursor-pointer'" |
| | | @click="handleClick" |
| | | @mouseenter="hovering = true" |
| | | @mouseleave="hovering = false" |
| | | > |
| | | <Tooltip :mouse-enter-delay="0.5" :open="selectedItem ? undefined : false"> |
| | | <template #title> |
| | | <div v-if="selectedItem" class="leading-6"> |
| | | <div>ç¼å·ï¼{{ selectedItem.code || '-' }}</div> |
| | | <div>åç§°ï¼{{ selectedItem.name || '-' }}</div> |
| | | <div>ä¾åºåï¼{{ selectedItem.vendorName || '-' }}</div> |
| | | <div>éè´è®¢åï¼{{ selectedItem.purchaseOrderCode || '-' }}</div> |
| | | </div> |
| | | </template> |
| | | <Input |
| | | :disabled="disabled" |
| | | :placeholder="placeholder" |
| | | :value="displayLabel" |
| | | readonly |
| | | > |
| | | <template #suffix> |
| | | <IconifyIcon |
| | | class="size-4" |
| | | :icon="showClear ? 'lucide:circle-x' : 'lucide:search'" |
| | | /> |
| | | </template> |
| | | </Input> |
| | | </Tooltip> |
| | | </div> |
| | | <WmArrivalNoticeSelectDialog ref="dialogRef" @selected="handleSelected" /> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmArrivalNoticeApi } from '#/api/mes/wm/arrivalnotice'; |
| | | import type { MesWmArrivalNoticeLineApi } from '#/api/mes/wm/arrivalnotice/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE, MesAutoCodeRuleCode } from '../../../packages/constants/src'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { ErpPurchaseOrderSelect } from '#/views/erp/purchase/order/components'; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'update'; |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: 'éç¥åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥éç¥åç¼å·', |
| | | }, |
| | | rules: 'required', |
| | | suffix: |
| | | formType === 'detail' |
| | | ? undefined |
| | | : () => |
| | | h( |
| | | Button, |
| | | { |
| | | type: 'default', |
| | | onClick: async () => { |
| | | const code = await generateAutoCode( |
| | | MesAutoCodeRuleCode.WM_ARRIVAL_NOTICE_CODE, |
| | | ); |
| | | await formApi?.setFieldValue('code', code); |
| | | }, |
| | | }, |
| | | { default: () => 'çæ' }, |
| | | ), |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'éç¥ååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥éç¥ååç§°', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderId', |
| | | label: 'éè´è®¢å', |
| | | component: markRaw(ErpPurchaseOrderSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©éè´è®¢å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | label: 'ä¾åºå', |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'arrivalDate', |
| | | label: 'å°è´§æ¥æ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©å°è´§æ¥æ', |
| | | valueFormat: 'x', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'contactName', |
| | | label: 'è系人', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥è系人', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'contactTelephone', |
| | | label: 'èç³»æ¹å¼', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥èç³»æ¹å¼', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'éç¥åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éç¥åç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'éç¥ååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éç¥ååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderNo', |
| | | label: 'éè´è®¢åå·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éè´è®¢åå·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorName', |
| | | label: 'ä¾åºå', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥ä¾åºååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'arrivalDate', |
| | | label: 'å°è´§æ¥æ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesWmArrivalNoticeApi.ArrivalNotice>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: 'éç¥åç¼å·', |
| | | minWidth: 160, |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: 'éç¥ååç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'purchaseOrderNo', |
| | | title: 'éè´è®¢åå·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'vendorName', |
| | | title: 'ä¾åºååç§°', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'contactName', |
| | | title: 'è系人', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'contactTelephone', |
| | | title: 'èç³»æ¹å¼', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'arrivalDate', |
| | | title: 'å°è´§æ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_ARRIVAL_NOTICE_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 180, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** éç¥åè¡å表çåæ®µ */ |
| | | export function useLineGridColumns( |
| | | editable: boolean, |
| | | ): VxeTableGridOptions<MesWmArrivalNoticeLineApi.ArrivalNoticeLine>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'itemCode', |
| | | title: 'ç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'ç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'arrivalQuantity', |
| | | title: 'å°è´§æ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'iqcCheckFlag', |
| | | title: 'æ¯å¦æ£éª', |
| | | width: 90, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'qualifiedQuantity', |
| | | title: 'åæ ¼æ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'iqcCode', |
| | | title: 'æ£éªåå·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'remark', |
| | | title: '夿³¨', |
| | | minWidth: 120, |
| | | }, |
| | | ...(editable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 120, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** éç¥åè¡æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useLineFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç©æ', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'arrivalQuantity', |
| | | label: 'å°è´§æ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0.01, |
| | | placeholder: '请è¾å
¥å°è´§æ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'iqcCheckFlag', |
| | | label: 'æ¯å¦æ£éª', |
| | | component: 'Switch', |
| | | rules: z.boolean().default(false), |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmArrivalNoticeApi } from '#/api/mes/wm/arrivalnotice'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { MesWmArrivalNoticeStatusEnum } from '../../../packages/constants/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteArrivalNotice, |
| | | exportArrivalNotice, |
| | | getArrivalNoticePage, |
| | | } from '#/api/mes/wm/arrivalnotice'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建å°è´§éç¥å */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ¥çå°è´§éç¥å */ |
| | | function handleDetail(row: MesWmArrivalNoticeApi.ArrivalNotice) { |
| | | formModalApi.setData({ formType: 'detail', id: row.id }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾å°è´§éç¥å */ |
| | | function handleEdit(row: MesWmArrivalNoticeApi.ArrivalNotice) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å é¤å°è´§éç¥å */ |
| | | async function handleDelete(row: MesWmArrivalNoticeApi.ArrivalNotice) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.code]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteArrivalNotice(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** æç¤ºåå¾è´¨æ£æ¨¡å */ |
| | | function handleQc() { |
| | | message.info('请åå¾ãè´¨é管ç - å¾
æ£ä»»å¡ãä¸è¿è¡æ¥ææ£éªæä½'); |
| | | } |
| | | |
| | | /** æç¤ºåå¾éè´å
¥åºæ¨¡å */ |
| | | function handleReceipt() { |
| | | message.info('请åå¾ãä»åºç®¡ç - éè´å
¥åºãä¸è¿è¡å
¥åºæä½'); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportArrivalNotice(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: 'å°è´§éç¥å.xls', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getArrivalNoticePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmArrivalNoticeApi.ArrivalNotice>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="å°è´§éç¥åå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['å°è´§éç¥å']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-arrival-notice:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:wm-arrival-notice:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-arrival-notice:update'], |
| | | ifShow: row.status === MesWmArrivalNoticeStatusEnum.PREPARE, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-arrival-notice:delete'], |
| | | ifShow: row.status === MesWmArrivalNoticeStatusEnum.PREPARE, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.code]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ§è¡è´¨æ£', |
| | | type: 'link', |
| | | ifShow: row.status === MesWmArrivalNoticeStatusEnum.PENDING_QC, |
| | | onClick: handleQc, |
| | | }, |
| | | { |
| | | label: 'æ§è¡å
¥åº', |
| | | type: 'link', |
| | | ifShow: |
| | | row.status === MesWmArrivalNoticeStatusEnum.PENDING_RECEIPT, |
| | | onClick: handleReceipt, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { MesWmArrivalNoticeApi } from '#/api/mes/wm/arrivalnotice'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { MesWmArrivalNoticeStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createArrivalNotice, |
| | | getArrivalNotice, |
| | | submitArrivalNotice, |
| | | updateArrivalNotice, |
| | | } from '#/api/mes/wm/arrivalnotice'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import LineList from './line-list.vue'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesWmArrivalNoticeApi.ArrivalNotice>(); |
| | | const originalSnapshot = ref(''); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äºæäº¤æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | const isEditable = computed(() => |
| | | // æ¯å¦ä¸ºç¼è¾æ¨¡å¼ï¼å¯ä¿åï¼ |
| | | ['create', 'update'].includes(formType.value), |
| | | ); |
| | | const canSubmit = computed( |
| | | () => |
| | | // æ¯å¦å¯æäº¤ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmArrivalNoticeStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.view', ['å°è´§éç¥å']); |
| | | } |
| | | return formType.value === 'update' |
| | | ? $t('ui.actionTitle.edit', ['å°è´§éç¥å']) |
| | | : $t('ui.actionTitle.create', ['å°è´§éç¥å']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | /** æäº¤éç¥åï¼è¡¨åæä¿®æ¹æ¶å
ä¿åï¼åè°ç¨æäº¤æ¥å£ */ |
| | | async function handleSubmit() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = |
| | | (await formApi.getValues()) as MesWmArrivalNoticeApi.ArrivalNotice; |
| | | await updateArrivalNotice({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | await submitArrivalNotice(formData.value.id); |
| | | message.success('æäº¤æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (!isEditable.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmArrivalNoticeApi.ArrivalNotice; |
| | | try { |
| | | if (formData.value?.id) { |
| | | await updateArrivalNotice({ ...formData.value, ...data }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createArrivalNotice(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesWmArrivalNoticeStatusEnum.PREPARE, |
| | | }; |
| | | await formApi.setFieldValue('id', id); |
| | | await formApi.setFieldValue('status', formData.value.status); |
| | | formType.value = 'update'; |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ''; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | formApi.setDisabled(!isEditable.value); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | | if (data?.id) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getArrivalNotice(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | <!-- éæ°å»ºæ¨¡å¼å±ç¤ºç©æä¿¡æ¯ --> |
| | | <template v-if="formData?.id"> |
| | | <Divider>ç©æä¿¡æ¯</Divider> |
| | | <div class="mx-4"> |
| | | <LineList :form-type="formType" :notice-id="formData.id" /> |
| | | </div> |
| | | </template> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Popconfirm |
| | | v-if="canSubmit" |
| | | title="确认æäº¤è¯¥å°è´§éç¥åï¼ãæäº¤åå°ä¸è½ä¿®æ¹ã" |
| | | @confirm="handleSubmit" |
| | | > |
| | | <Button type="primary">æäº¤</Button> |
| | | </Popconfirm> |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmArrivalNoticeLineApi } from '#/api/mes/wm/arrivalnotice/line'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createArrivalNoticeLine, |
| | | getArrivalNoticeLine, |
| | | updateArrivalNoticeLine, |
| | | } from '#/api/mes/wm/arrivalnotice/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formData = ref<MesWmArrivalNoticeLineApi.ArrivalNoticeLine>(); |
| | | const noticeId = ref<number>(); // æå±éç¥åç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['å°è´§éç¥åè¡']) |
| | | : $t('ui.actionTitle.create', ['å°è´§éç¥åè¡']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useLineFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmArrivalNoticeLineApi.ArrivalNoticeLine; |
| | | data.noticeId = noticeId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateArrivalNoticeLine({ ...data, id: formData.value.id }) |
| | | : createArrivalNoticeLine(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ id?: number; noticeId: number }>(); |
| | | noticeId.value = data.noticeId; |
| | | if (!data.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getArrivalNoticeLine(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmArrivalNoticeLineApi } from '#/api/mes/wm/arrivalnotice/line'; |
| | | |
| | | import { computed } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteArrivalNoticeLine, |
| | | getArrivalNoticeLinePage, |
| | | } from '#/api/mes/wm/arrivalnotice/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import LineForm from './line-form.vue'; |
| | | |
| | | const props = defineProps<{ |
| | | formType: FormType; |
| | | noticeId: number; |
| | | }>(); |
| | | |
| | | const isEditable = computed(() => |
| | | // æ¯å¦å¯ç¼è¾æç»è¡ |
| | | ['create', 'update'].includes(props.formType), |
| | | ); |
| | | |
| | | const [LineFormModal, lineFormModalApi] = useVbenModal({ |
| | | connectedComponent: LineForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** æ·»å ç©æ */ |
| | | function handleCreate() { |
| | | lineFormModalApi.setData({ noticeId: props.noticeId }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾ç©æ */ |
| | | function handleEdit(row: MesWmArrivalNoticeLineApi.ArrivalNoticeLine) { |
| | | lineFormModalApi.setData({ id: row.id, noticeId: props.noticeId }).open(); |
| | | } |
| | | |
| | | /** å é¤ç©æ */ |
| | | async function handleDelete(row: MesWmArrivalNoticeLineApi.ArrivalNoticeLine) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.itemName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteArrivalNoticeLine(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.itemName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | gridOptions: { |
| | | columns: useLineGridColumns(isEditable.value), |
| | | height: 400, |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }) => { |
| | | if (!props.noticeId) { |
| | | return { list: [], total: 0 }; |
| | | } |
| | | return await getArrivalNoticeLinePage({ |
| | | noticeId: props.noticeId, |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmArrivalNoticeLineApi.ArrivalNoticeLine>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <LineFormModal @success="handleRefresh" /> |
| | | <Grid table-title="ç©æä¿¡æ¯"> |
| | | <template v-if="isEditable" #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: 'æ·»å ç©æ', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | ifShow: isEditable, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | ifShow: isEditable, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.itemName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </div> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { BarcodeFormat } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { BarcodeFormatEnum, Barcode as CommonBarcode } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | defineOptions({ name: 'WlsBarcode' }); |
| | | |
| | | const props = withDefaults( |
| | | defineProps<{ |
| | | content?: string; |
| | | displayValue?: boolean; |
| | | format?: number; |
| | | height?: number; |
| | | width?: number; |
| | | }>(), |
| | | { |
| | | content: '', |
| | | displayValue: true, |
| | | format: BarcodeFormatEnum.QR_CODE, |
| | | height: 100, |
| | | width: 200, |
| | | }, |
| | | ); |
| | | |
| | | const emit = defineEmits<{ done: [value: string] }>(); |
| | | |
| | | const barcodeRef = ref<InstanceType<typeof CommonBarcode>>(); |
| | | const commonFormat = computed<BarcodeFormat>( |
| | | () => (props.format || BarcodeFormatEnum.QR_CODE) as BarcodeFormat, |
| | | ); |
| | | |
| | | function getImageBase64() { |
| | | return barcodeRef.value?.getImageBase64() || ''; |
| | | } |
| | | |
| | | defineExpose({ getImageBase64 }); |
| | | </script> |
| | | |
| | | <template> |
| | | <CommonBarcode |
| | | ref="barcodeRef" |
| | | :content="content" |
| | | :display-value="displayValue" |
| | | :format="commonFormat" |
| | | :height="height" |
| | | :width="width" |
| | | @done="emit('done', $event)" |
| | | /> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type Barcode from './barcode.vue'; |
| | | |
| | | import type { MesWmBarcodeApi } from '#/api/mes/wm/barcode'; |
| | | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { Button, Empty, message, Modal, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { createBarcode, getBarcodeByBusiness } from '#/api/mes/wm/barcode'; |
| | | import { useDescription } from '#/components/description'; |
| | | |
| | | import { useBarcodeDetailSchema } from '../data'; |
| | | import WlsBarcode from './barcode.vue'; |
| | | |
| | | defineOptions({ name: 'WlsBarcodeDetail' }); |
| | | |
| | | const open = ref(false); |
| | | const barcodeRef = ref<InstanceType<typeof Barcode>>(); |
| | | const barcodeData = ref<Partial<MesWmBarcodeApi.Barcode>>({}); |
| | | |
| | | const [Descriptions] = useDescription({ |
| | | bordered: true, |
| | | column: 1, |
| | | schema: useBarcodeDetailSchema(), |
| | | useCard: false, |
| | | }); |
| | | |
| | | function openModal(row: Partial<MesWmBarcodeApi.Barcode>) { |
| | | open.value = true; |
| | | barcodeData.value = { ...row }; |
| | | } |
| | | |
| | | async function openByBusiness( |
| | | bizId: number, |
| | | bizType: number, |
| | | bizCode?: string, |
| | | bizName?: string, |
| | | ) { |
| | | open.value = true; |
| | | try { |
| | | const data = await getBarcodeByBusiness(bizType, bizId); |
| | | barcodeData.value = data || { |
| | | bizCode, |
| | | bizId, |
| | | bizName, |
| | | bizType, |
| | | content: '', |
| | | }; |
| | | if (!data) { |
| | | message.warning('æªæ¾å°å¯¹åºæ¡ç æ°æ®'); |
| | | } |
| | | } catch { |
| | | barcodeData.value = { bizCode, bizId, bizName, bizType, content: '' }; |
| | | message.error('å è½½æ¡ç æ°æ®å¤±è´¥'); |
| | | } |
| | | } |
| | | |
| | | defineExpose({ open: openModal, openByBusiness }); |
| | | |
| | | function escapeHtml(value: string) { |
| | | return value |
| | | .replaceAll('&', '&') |
| | | .replaceAll('<', '<') |
| | | .replaceAll('>', '>'); |
| | | } |
| | | |
| | | function handlePrint() { |
| | | const base64 = barcodeRef.value?.getImageBase64(); |
| | | if (!base64) { |
| | | message.warning('æ¡ç çæå¤±è´¥ï¼æ æ³æå°'); |
| | | return; |
| | | } |
| | | const printWindow = window.open('', '_blank'); |
| | | if (!printWindow) { |
| | | message.error('æ æ³æå¼æå°çªå£ï¼è¯·æ£æ¥æµè§å¨è®¾ç½®'); |
| | | return; |
| | | } |
| | | printWindow.document.write(`<!DOCTYPE html> |
| | | <html><head><meta charset="UTF-8"><title>æå°æ¡ç </title> |
| | | <style>*{margin:0;padding:0}body{font-family:Arial,sans-serif;padding:20px}.print-container{text-align:center}.barcode-img{max-width:100%;margin:20px 0}.info{margin-top:20px;text-align:left;font-size:12px}.info p{margin:5px 0}@media print{body{padding:0}.print-container{padding:20px}}</style> |
| | | </head><body><div class="print-container"> |
| | | <img src="${base64}" class="barcode-img" alt="æ¡ç " /> |
| | | <div class="info"> |
| | | <p><strong>ä¸å¡ç¼ç :</strong> ${escapeHtml(barcodeData.value.bizCode || '')}</p> |
| | | <p><strong>ä¸å¡åç§°:</strong> ${escapeHtml(barcodeData.value.bizName || '')}</p> |
| | | <p><strong>æ¡ç å
容:</strong> ${escapeHtml(barcodeData.value.content || '')}</p> |
| | | </div></div></body></html>`); |
| | | printWindow.document.close(); |
| | | printWindow.addEventListener('load', () => { |
| | | setTimeout(() => printWindow.print(), 500); |
| | | }); |
| | | } |
| | | |
| | | function handleDownload() { |
| | | const base64 = barcodeRef.value?.getImageBase64(); |
| | | if (!base64) { |
| | | message.warning('æ¡ç çæå¤±è´¥ï¼æ æ³ä¸è½½'); |
| | | return; |
| | | } |
| | | const link = document.createElement('a'); |
| | | link.href = base64; |
| | | link.download = `barcode_${barcodeData.value.bizCode || 'unknown'}_${Date.now()}.png`; |
| | | link.click(); |
| | | message.success('ä¸è½½æå'); |
| | | } |
| | | |
| | | async function handleGenerate() { |
| | | const { bizCode, bizId, bizName, bizType } = barcodeData.value; |
| | | if (!bizType || !bizId) { |
| | | message.warning('缺å°ä¸å¡ç±»åæä¸å¡ç¼å·ï¼æ æ³çææ¡ç '); |
| | | return; |
| | | } |
| | | await createBarcode({ |
| | | bizCode: bizCode || '', |
| | | bizId, |
| | | bizName: bizName || '', |
| | | bizType, |
| | | }); |
| | | message.success('æ¡ç çææå'); |
| | | const data = await getBarcodeByBusiness(bizType, bizId); |
| | | if (data) { |
| | | barcodeData.value = { ...data }; |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal v-model:open="open" title="æ¥çæ¡ç " width="500px"> |
| | | <div> |
| | | <div |
| | | class="mb-5 flex min-h-50 items-center justify-center rounded bg-gray-100 p-5" |
| | | > |
| | | <div |
| | | v-if="barcodeData.content" |
| | | class="flex items-center justify-center" |
| | | > |
| | | <WlsBarcode |
| | | ref="barcodeRef" |
| | | :content="barcodeData.content" |
| | | :format="barcodeData.format" |
| | | :height="150" |
| | | :width="400" |
| | | /> |
| | | </div> |
| | | <Empty v-else description="ææ æ¡ç æ°æ®" /> |
| | | </div> |
| | | <Descriptions :data="barcodeData"> |
| | | <template #content> |
| | | <Tooltip :title="barcodeData.content"> |
| | | <span |
| | | class="inline-block max-w-75 overflow-hidden text-ellipsis whitespace-nowrap" |
| | | > |
| | | {{ barcodeData.content }} |
| | | </span> |
| | | </Tooltip> |
| | | </template> |
| | | </Descriptions> |
| | | </div> |
| | | <template #footer> |
| | | <Button v-if="!barcodeData.content" @click="handleGenerate"> |
| | | çæ |
| | | </Button> |
| | | <Button type="primary" @click="handlePrint">æå°</Button> |
| | | <Button @click="handleDownload">ä¸è½½</Button> |
| | | <Button @click="open = false">å
³é</Button> |
| | | </template> |
| | | </Modal> |
| | | </template> |
copy from src/views/mes/wm/barcode/components/index.ts
copy to src/views/wls/barcode/components/index.ts
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | defineOptions({ name: 'WlsPrinterLabel' }); |
| | | |
| | | withDefaults( |
| | | defineProps<{ |
| | | bizCode?: string; |
| | | bizId?: number; |
| | | bizType?: string; |
| | | labelText?: string; |
| | | }>(), |
| | | { |
| | | bizCode: undefined, |
| | | bizId: undefined, |
| | | bizType: undefined, |
| | | labelText: 'æ ç¾æå°', |
| | | }, |
| | | ); |
| | | |
| | | function handlePrint() { |
| | | message.warning('æ ç¾æå°åè½ææªå®ç°ï¼æ¬è¯·æå¾
'); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <Button type="link" @click="handlePrint"> |
| | | {{ labelText }} |
| | | </Button> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | |
| | | import { h } from 'vue'; |
| | | |
| | | import { CommonStatusEnum, DICT_TYPE } from '../../../../packages/constants/src'; |
| | | import { getDictOptions } from '../../../../packages/effects/hooks/src'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | |
| | | /** 表å */ |
| | | export function useFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'format', |
| | | label: 'æ¡ç æ ¼å¼', |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: getDictOptions(DICT_TYPE.MES_WM_BARCODE_FORMAT, 'number'), |
| | | placeholder: 'è¯·éæ©æ¡ç æ ¼å¼', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizType', |
| | | label: 'ä¸å¡ç±»å', |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: getDictOptions(DICT_TYPE.MES_WM_BARCODE_BIZ_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©ä¸å¡ç±»å', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['id'], |
| | | componentProps: (values) => ({ |
| | | disabled: !!values.id, // ç¼è¾æ¶ä¸å¡ç±»åä¸å
è®¸åæ´ |
| | | }), |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'contentFormat', |
| | | label: 'å
å®¹æ ¼å¼æ¨¡æ¿', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: 'æ¯æ{BUSINESSCODE}å ä½ç¬¦ï¼å¦ï¼WH-{BUSINESSCODE}', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'contentExample', |
| | | label: 'å
å®¹æ ·ä¾', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: 'å¦ï¼WH-WH001', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'autoGenerateFlag', |
| | | label: 'èªå¨çæ', |
| | | component: 'Switch', |
| | | componentProps: { |
| | | checkedChildren: 'æ¯', |
| | | unCheckedChildren: 'å¦', |
| | | }, |
| | | rules: z.boolean().default(true), |
| | | }, |
| | | { |
| | | fieldName: 'defaultTemplate', |
| | | label: 'é»è®¤æå°æ¨¡æ¿', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©æå°æ¨¡æ¿', |
| | | readonly: true, |
| | | }, |
| | | // TODO @èè¿ï¼åç»å¯¹æ¥ UReport æ¥è¡¨éæ©å¨ï¼å®ç°æå°æ¨¡æ¿éæ©åè½ |
| | | suffix: () => |
| | | h( |
| | | Button, |
| | | { |
| | | onClick: () => |
| | | message.warning('æå°æ¨¡æ¿éæ©åè½ææªå®ç°ï¼æ¬è¯·æå¾
'), |
| | | }, |
| | | { default: () => '设置' }, |
| | | ), |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'ç¶æ', |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), |
| | | }, |
| | | rules: z.number().default(CommonStatusEnum.ENABLE), |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 2, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmBarcodeConfigApi } from '#/api/mes/wm/barcode/config'; |
| | | |
| | | import { confirm, Page, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteBarcodeConfig, |
| | | getBarcodeConfigPage, |
| | | updateBarcodeConfig, |
| | | } from '#/api/mes/wm/barcode/config'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useConfigGridColumns, useConfigGridFormSchema } from '../data'; |
| | | import ConfigForm from './modules/form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: ConfigForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** èªå¨çæå¼å
³åæ´ */ |
| | | async function handleAutoGenerateChange( |
| | | row: MesWmBarcodeConfigApi.BarcodeConfig, |
| | | ): Promise<boolean> { |
| | | const text = row.autoGenerateFlag ? 'å¯ç¨' : 'åç¨'; |
| | | try { |
| | | await confirm(`确认è¦${text}èªå¨çæåï¼`); |
| | | } catch { |
| | | return false; |
| | | } |
| | | await updateBarcodeConfig(row); |
| | | message.success(`${text}æå`); |
| | | return true; |
| | | } |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建æ¡ç é
ç½® */ |
| | | function handleCreate() { |
| | | formModalApi.setData(null).open(); |
| | | } |
| | | |
| | | /** ç¼è¾æ¡ç é
ç½® */ |
| | | function handleEdit(row: MesWmBarcodeConfigApi.BarcodeConfig) { |
| | | formModalApi.setData(row).open(); |
| | | } |
| | | |
| | | /** å 餿¡ç é
ç½® */ |
| | | async function handleDelete(row: MesWmBarcodeConfigApi.BarcodeConfig) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [ |
| | | row.contentFormat || `#${row.id}`, |
| | | ]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteBarcodeConfig(row.id!); |
| | | message.success( |
| | | $t('ui.actionMessage.deleteSuccess', [row.contentFormat || `#${row.id}`]), |
| | | ); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useConfigGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useConfigGridColumns(handleAutoGenerateChange), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getBarcodeConfigPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmBarcodeConfigApi.BarcodeConfig>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="æ¡ç é
ç½®å表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['æ¡ç é
ç½®']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-barcode-config:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-barcode-config:update'], |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-barcode-config:delete'], |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [ |
| | | row.contentFormat || `#${row.id}`, |
| | | ]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmBarcodeConfigApi } from '#/api/mes/wm/barcode/config'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createBarcodeConfig, |
| | | getBarcodeConfig, |
| | | updateBarcodeConfig, |
| | | } from '#/api/mes/wm/barcode/config'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formData = ref<MesWmBarcodeConfigApi.BarcodeConfig>(); |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['æ¡ç é
ç½®']) |
| | | : $t('ui.actionTitle.create', ['æ¡ç é
ç½®']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-2', |
| | | labelWidth: 130, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useFormSchema(), |
| | | showDefaultActions: false, |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmBarcodeConfigApi.BarcodeConfig; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateBarcodeConfig(data) |
| | | : createBarcodeConfig(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<MesWmBarcodeConfigApi.BarcodeConfig>(); |
| | | if (!data || !data.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getBarcodeConfig(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-2/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmBarcodeApi } from '#/api/mes/wm/barcode'; |
| | | import type { MesWmBarcodeConfigApi } from '#/api/mes/wm/barcode/config'; |
| | | import type { DescriptionItemSchema } from '#/components/description'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | BarcodeBizTypeEnum, |
| | | CommonStatusEnum, |
| | | DICT_TYPE, |
| | | MesProWorkOrderStatusEnum, |
| | | } from '../../../packages/constants/src'; |
| | | import { getDictOptions } from '../../../packages/effects/hooks/src'; |
| | | import { formatDateTime } from '../../../packages/utils/src'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateBarcodeContent } from '#/api/mes/wm/barcode'; |
| | | import { DictTag } from '#/components/dict-tag'; |
| | | import { DvMachinerySelect } from '#/views/mes/dv/machinery/components'; |
| | | import { MdClientSelect } from '#/views/mes/md/client/components'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { |
| | | MdWorkshopSelect, |
| | | MdWorkstationSelect, |
| | | } from '#/views/mes/md/workstation/components'; |
| | | import { ProCardSelect } from '#/views/mes/pro/card/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { TmToolSelect } from '#/views/mes/tm/tool/components'; |
| | | import { WmBatchSelect } from '#/views/wls/batch/components'; |
| | | import { UserSelect } from '#/views/system/user/components'; |
| | | |
| | | import { WmMaterialStockSelect } from '../materialstock/components'; |
| | | import { WmPackageSelect } from '../packages/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | | WmWarehouseSelect, |
| | | } from '../warehouse/components'; |
| | | |
| | | /** ä¸å¡å¯¹è±¡éä¸ååå¡«ä¸å¡ç¼ç ãä¸å¡åç§°ãæ¡ç å
容 */ |
| | | async function syncBizDetail(formApi: undefined | VbenFormApi, item: any) { |
| | | if (!formApi) { |
| | | return; |
| | | } |
| | | const values = await formApi.getValues(); |
| | | const bizType = values.bizType as number | undefined; |
| | | if (!item) { |
| | | await formApi.setValues({ |
| | | bizCode: undefined, |
| | | bizName: undefined, |
| | | content: undefined, |
| | | }); |
| | | return; |
| | | } |
| | | let bizCode: string | undefined; |
| | | let bizName: string | undefined; |
| | | switch (bizType) { |
| | | case BarcodeBizTypeEnum.BATCH: { |
| | | bizCode = item.code; |
| | | bizName = item.itemName || item.code; |
| | | break; |
| | | } |
| | | case BarcodeBizTypeEnum.PACKAGE: { |
| | | bizCode = item.code; |
| | | bizName = item.clientName || item.code; |
| | | break; |
| | | } |
| | | case BarcodeBizTypeEnum.PROCARD: { |
| | | bizCode = item.code; |
| | | bizName = item.workOrderName || item.code; |
| | | break; |
| | | } |
| | | case BarcodeBizTypeEnum.STOCK: { |
| | | bizCode = item.itemCode; |
| | | bizName = item.itemName; |
| | | break; |
| | | } |
| | | default: { |
| | | bizCode = item.code || item.username; |
| | | bizName = item.name || item.nickname; |
| | | } |
| | | } |
| | | // å
åå¡«ä¸å¡ç¼ç ãåç§°å¹¶æ¸
ç©ºæ§æ¡ç å
容 |
| | | await formApi.setValues({ bizCode, bizName, content: undefined }); |
| | | // åæ ¹æ®ä¸å¡ç±»å + ä¸å¡ç¼ç çææ¡ç å
容 |
| | | if (bizType && bizCode) { |
| | | const content = await generateBarcodeContent(bizType, bizCode); |
| | | await formApi.setFieldValue('content', content); |
| | | } |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹æ¡ç ç表å */ |
| | | export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'bizType', |
| | | label: 'ä¸å¡ç±»å', |
| | | component: 'Select', |
| | | componentProps: { |
| | | // ä¸å¡ç±»ååæ´æ¶æ¸
空ä¸å¡å段 |
| | | onChange: () => |
| | | formApi?.setValues({ |
| | | bizId: undefined, |
| | | bizCode: undefined, |
| | | bizName: undefined, |
| | | content: undefined, |
| | | locationWarehouseId: undefined, |
| | | areaWarehouseId: undefined, |
| | | areaLocationId: undefined, |
| | | }), |
| | | options: getDictOptions(DICT_TYPE.MES_WM_BARCODE_BIZ_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©ä¸å¡ç±»å', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | // ==================== ä¸å¡å¯¹è±¡éæ©å¨ï¼æ bizType åæ¢ï¼ ==================== |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'ä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.WAREHOUSE, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'locationWarehouseId', |
| | | label: 'åºåºÂ·ä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | onChange: () => |
| | | formApi?.setValues({ |
| | | bizId: undefined, |
| | | bizCode: undefined, |
| | | bizName: undefined, |
| | | content: undefined, |
| | | }), |
| | | placeholder: 'è¯·éæ©ä»åº', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.LOCATION, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | dependencies: { |
| | | triggerFields: ['bizType', 'locationWarehouseId'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.LOCATION, |
| | | componentProps: (values) => ({ |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | warehouseId: values.locationWarehouseId, |
| | | }), |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'areaWarehouseId', |
| | | label: 'åºä½Â·ä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | onChange: () => |
| | | formApi?.setValues({ |
| | | areaLocationId: undefined, |
| | | bizId: undefined, |
| | | bizCode: undefined, |
| | | bizName: undefined, |
| | | content: undefined, |
| | | }), |
| | | placeholder: 'è¯·éæ©ä»åº', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.AREA, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaLocationId', |
| | | label: 'åºä½Â·åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | dependencies: { |
| | | triggerFields: ['bizType', 'areaWarehouseId'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.AREA, |
| | | componentProps: (values) => ({ |
| | | onChange: () => |
| | | formApi?.setValues({ |
| | | bizId: undefined, |
| | | bizCode: undefined, |
| | | bizName: undefined, |
| | | content: undefined, |
| | | }), |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | warehouseId: values.areaWarehouseId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'åºä½', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | dependencies: { |
| | | triggerFields: ['bizType', 'areaLocationId'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.AREA, |
| | | componentProps: (values) => ({ |
| | | locationId: values.areaLocationId, |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | placeholder: 'è¯·éæ©åºä½', |
| | | }), |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: '订å', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | componentProps: { |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.WORKORDER, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: '设å¤', |
| | | component: markRaw(DvMachinerySelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.MACHINERY, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: '产åç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.ITEM, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'ä¾åºå', |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.VENDOR, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'å·¥ä½ç«', |
| | | component: markRaw(MdWorkstationSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.WORKSTATION, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: '车é´', |
| | | component: markRaw(MdWorkshopSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.WORKSHOP, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: '客æ·', |
| | | component: markRaw(MdClientSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.CLIENT, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'å·¥å
·', |
| | | component: markRaw(TmToolSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.TOOL, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'åºå', |
| | | component: markRaw(WmMaterialStockSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.STOCK, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'è£
ç®±å', |
| | | component: markRaw(WmPackageSelect), |
| | | componentProps: { |
| | | childableOnly: true, |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.PACKAGE, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'æ¹æ¬¡', |
| | | component: markRaw(WmBatchSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.BATCH, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'æµè½¬å¡', |
| | | component: markRaw(ProCardSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.PROCARD, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: '人å', |
| | | component: markRaw(UserSelect), |
| | | componentProps: { |
| | | onChange: (item: any) => syncBizDetail(formApi, item), |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => values.bizType === BarcodeBizTypeEnum.USER, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizId', |
| | | label: 'ä¸å¡ç¼å·', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 1, |
| | | placeholder: '请è¾å
¥ä¸å¡ç¼å·', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['bizType'], |
| | | show: (values) => |
| | | values.bizType !== undefined && |
| | | ![ |
| | | BarcodeBizTypeEnum.AREA, |
| | | BarcodeBizTypeEnum.BATCH, |
| | | BarcodeBizTypeEnum.CLIENT, |
| | | BarcodeBizTypeEnum.ITEM, |
| | | BarcodeBizTypeEnum.LOCATION, |
| | | BarcodeBizTypeEnum.MACHINERY, |
| | | BarcodeBizTypeEnum.PACKAGE, |
| | | BarcodeBizTypeEnum.PROCARD, |
| | | BarcodeBizTypeEnum.STOCK, |
| | | BarcodeBizTypeEnum.TOOL, |
| | | BarcodeBizTypeEnum.USER, |
| | | BarcodeBizTypeEnum.VENDOR, |
| | | BarcodeBizTypeEnum.WAREHOUSE, |
| | | BarcodeBizTypeEnum.WORKORDER, |
| | | BarcodeBizTypeEnum.WORKSHOP, |
| | | BarcodeBizTypeEnum.WORKSTATION, |
| | | ].includes(values.bizType), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'bizCode', |
| | | label: 'ä¸å¡ç¼ç ', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: 'èªå¨å¡«å
', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'bizName', |
| | | label: 'ä¸å¡åç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: 'èªå¨å¡«å
', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'content', |
| | | label: 'æ¡ç å
容', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥æ¡ç å
容æèªå¨çæ', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'ç¶æ', |
| | | component: 'RadioGroup', |
| | | componentProps: { |
| | | options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), |
| | | }, |
| | | rules: z.number().default(CommonStatusEnum.ENABLE), |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 2, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'bizType', |
| | | label: 'ä¸å¡ç±»å', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_WM_BARCODE_BIZ_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©ä¸å¡ç±»å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'bizCode', |
| | | label: 'ä¸å¡ç¼ç ', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥ä¸å¡ç¼ç ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'bizName', |
| | | label: 'ä¸å¡åç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥ä¸å¡åç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'content', |
| | | label: 'æ¡ç å
容', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥æ¡ç å
容', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesWmBarcodeApi.Barcode>['columns'] { |
| | | return [ |
| | | { |
| | | type: 'checkbox', |
| | | width: 50, |
| | | }, |
| | | { |
| | | field: 'content', |
| | | title: 'æ¡ç ', |
| | | width: 180, |
| | | slots: { default: 'barcode' }, |
| | | }, |
| | | { |
| | | field: 'format', |
| | | title: 'æ¡ç æ ¼å¼', |
| | | width: 110, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_BARCODE_FORMAT }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'bizType', |
| | | title: 'ä¸å¡ç±»å', |
| | | width: 110, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_BARCODE_BIZ_TYPE }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'content', |
| | | title: 'æ¡ç å
容', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'bizCode', |
| | | title: 'ä¸å¡ç¼ç ', |
| | | width: 130, |
| | | }, |
| | | { |
| | | field: 'bizName', |
| | | title: 'ä¸å¡åç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'ç¶æ', |
| | | width: 90, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.COMMON_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 200, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** é
ç½®å表çæç´¢è¡¨å */ |
| | | export function useConfigGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'format', |
| | | label: 'æ¡ç æ ¼å¼', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_WM_BARCODE_FORMAT, 'number'), |
| | | placeholder: 'è¯·éæ©æ¡ç æ ¼å¼', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'bizType', |
| | | label: 'ä¸å¡ç±»å', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_WM_BARCODE_BIZ_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©ä¸å¡ç±»å', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** é
ç½®å表çåæ®µ */ |
| | | export function useConfigGridColumns( |
| | | onAutoGenerateChange: ( |
| | | row: MesWmBarcodeConfigApi.BarcodeConfig, |
| | | ) => Promise<boolean>, |
| | | ): VxeTableGridOptions<MesWmBarcodeConfigApi.BarcodeConfig>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'id', |
| | | title: 'ç¼å·', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'format', |
| | | title: 'æ¡ç æ ¼å¼', |
| | | width: 110, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_BARCODE_FORMAT }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'bizType', |
| | | title: 'ä¸å¡ç±»å', |
| | | width: 110, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_BARCODE_BIZ_TYPE }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'contentFormat', |
| | | title: 'å
å®¹æ ¼å¼', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'contentExample', |
| | | title: 'å
å®¹æ ·ä¾', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'defaultTemplate', |
| | | title: 'é»è®¤æå°æ¨¡æ¿', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'autoGenerateFlag', |
| | | title: 'èªå¨çæ', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellSwitch', |
| | | attrs: { beforeChange: onAutoGenerateChange }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'ç¶æ', |
| | | width: 90, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.COMMON_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'createTime', |
| | | title: 'å建æ¶é´', |
| | | width: 180, |
| | | formatter: 'formatDateTime', |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 160, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** æ¡ç 详æ
çæè¿°å段 */ |
| | | export function useBarcodeDetailSchema(): DescriptionItemSchema[] { |
| | | return [ |
| | | { |
| | | field: 'format', |
| | | label: 'æ¡ç æ ¼å¼', |
| | | render: (value) => |
| | | value === null |
| | | ? '-' |
| | | : h(DictTag, { type: DICT_TYPE.MES_WM_BARCODE_FORMAT, value }), |
| | | }, |
| | | { |
| | | field: 'bizType', |
| | | label: 'ä¸å¡ç±»å', |
| | | render: (value) => |
| | | value === null |
| | | ? '-' |
| | | : h(DictTag, { type: DICT_TYPE.MES_WM_BARCODE_BIZ_TYPE, value }), |
| | | }, |
| | | { |
| | | field: 'content', |
| | | label: 'æ¡ç å
容', |
| | | slot: 'content', |
| | | }, |
| | | { |
| | | field: 'bizCode', |
| | | label: 'ä¸å¡ç¼ç ', |
| | | render: (value) => value || '-', |
| | | }, |
| | | { |
| | | field: 'bizName', |
| | | label: 'ä¸å¡åç§°', |
| | | render: (value) => value || '-', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | label: 'ç¶æ', |
| | | render: (value) => |
| | | value === null |
| | | ? '-' |
| | | : h(DictTag, { type: DICT_TYPE.COMMON_STATUS, value }), |
| | | }, |
| | | { |
| | | field: 'createTime', |
| | | label: 'å建æ¶é´', |
| | | render: (value) => formatDateTime(value) || '-', |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmBarcodeApi } from '#/api/mes/wm/barcode'; |
| | | |
| | | import { ref } from 'vue'; |
| | | import { useRouter } from 'vue-router'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteBarcode, |
| | | exportBarcode, |
| | | getBarcodePage, |
| | | } from '#/api/mes/wm/barcode'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { Barcode, BarcodeDetail } from './components'; |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); |
| | | |
| | | const checkedIds = ref<number[]>([]); |
| | | function handleRowCheckboxChange({ |
| | | records, |
| | | }: { |
| | | records: MesWmBarcodeApi.Barcode[]; |
| | | }) { |
| | | checkedIds.value = records.map((item) => item.id!); |
| | | } |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建æ¡ç */ |
| | | function handleCreate() { |
| | | formModalApi.setData(null).open(); |
| | | } |
| | | |
| | | /** ç¼è¾æ¡ç */ |
| | | function handleEdit(row: MesWmBarcodeApi.Barcode) { |
| | | formModalApi.setData(row).open(); |
| | | } |
| | | |
| | | /** å 餿¡ç */ |
| | | async function handleDelete(row: MesWmBarcodeApi.Barcode) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [ |
| | | row.bizName || row.bizCode || '', |
| | | ]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteBarcode(row.id!); |
| | | message.success( |
| | | $t('ui.actionMessage.deleteSuccess', [row.bizName || row.bizCode || '']), |
| | | ); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** æ¹éå 餿¡ç */ |
| | | async function handleDeleteBatch() { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [`${checkedIds.value.length} æ¡`]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await Promise.all(checkedIds.value.map((id) => deleteBarcode(id))); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [''])); |
| | | checkedIds.value = []; |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** æ¥çæ¡ç */ |
| | | function handleView(row: MesWmBarcodeApi.Barcode) { |
| | | barcodeDetailRef.value?.open(row); |
| | | } |
| | | |
| | | /** 跳转æ¡ç é
ç½® */ |
| | | function handleConfig() { |
| | | router.push({ name: 'WlsBarcodeConfig' }); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportBarcode(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: 'æ¡ç æ¸
å.xls', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getBarcodePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | height: 80, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmBarcodeApi.Barcode>, |
| | | gridEvents: { |
| | | checkboxAll: handleRowCheckboxChange, |
| | | checkboxChange: handleRowCheckboxChange, |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | <BarcodeDetail ref="barcodeDetailRef" /> |
| | | |
| | | <Grid table-title="æ¡ç å表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['æ¡ç ']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-barcode:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.deleteBatch'), |
| | | type: 'primary', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-barcode:delete'], |
| | | disabled: checkedIds.length === 0, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [ |
| | | `${checkedIds.length} æ¡`, |
| | | ]), |
| | | confirm: handleDeleteBatch, |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ¡ç 设置', |
| | | type: 'primary', |
| | | auth: ['mes:wm-barcode-config:query'], |
| | | onClick: handleConfig, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:wm-barcode:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #barcode="{ row }"> |
| | | <div v-if="row.content" class="flex justify-center"> |
| | | <Barcode |
| | | :content="row.content" |
| | | :format="row.format" |
| | | :height="60" |
| | | :width="140" |
| | | /> |
| | | </div> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.detail'), |
| | | type: 'link', |
| | | auth: ['mes:wm-barcode:query'], |
| | | onClick: handleView.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-barcode:update'], |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-barcode:delete'], |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [ |
| | | row.bizName || row.bizCode || '', |
| | | ]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmBarcodeApi } from '#/api/mes/wm/barcode'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { BarcodeBizTypeEnum, CommonStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { createBarcode, getBarcode, updateBarcode } from '#/api/mes/wm/barcode'; |
| | | import { getWarehouseArea } from '#/api/mes/wm/warehouse/area'; |
| | | import { getWarehouseLocation } from '#/api/mes/wm/warehouse/location'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | |
| | | const formData = ref<MesWmBarcodeApi.Barcode>(); |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['æ¡ç ']) |
| | | : $t('ui.actionTitle.create', ['æ¡ç ']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-2', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | }); |
| | | |
| | | /** å 载级èéæ©å¨çæ°æ®ï¼ç¼è¾æ¶åå¡«ä¸çº§ä»åº/åºåºï¼ */ |
| | | async function loadCascadeData(data: MesWmBarcodeApi.Barcode) { |
| | | if (!data.bizType || !data.bizId) { |
| | | return; |
| | | } |
| | | if (data.bizType === BarcodeBizTypeEnum.LOCATION) { |
| | | const location = await getWarehouseLocation(data.bizId); |
| | | if (location?.warehouseId) { |
| | | await formApi.setFieldValue('locationWarehouseId', location.warehouseId); |
| | | } |
| | | } else if (data.bizType === BarcodeBizTypeEnum.AREA) { |
| | | const area = await getWarehouseArea(data.bizId); |
| | | await formApi.setValues({ |
| | | areaWarehouseId: area?.warehouseId, |
| | | areaLocationId: area?.locationId, |
| | | }); |
| | | } |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesWmBarcodeApi.Barcode; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateBarcode({ ...data, id: formData.value.id }) |
| | | : createBarcode(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | formApi.setState({ schema: useFormSchema(formApi) }); |
| | | await formApi.setValues({ status: CommonStatusEnum.ENABLE }); |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<MesWmBarcodeApi.Barcode>(); |
| | | if (!data || !data.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getBarcode(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | await loadCascadeData(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-1/2"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmBatchApi } from '#/api/mes/wm/batch'; |
| | | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { getBatch } from '#/api/mes/wm/batch'; |
| | | import { useDescription } from '#/components/description'; |
| | | |
| | | import { useDetailSchema } from '../data'; |
| | | |
| | | const detailData = ref<MesWmBatchApi.Batch>(); // å½åæ¹æ¬¡è¯¦æ
|
| | | |
| | | const [Descriptions] = useDescription({ |
| | | bordered: true, |
| | | column: 3, |
| | | schema: useDetailSchema(), |
| | | useCard: false, |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | showCancelButton: false, |
| | | showConfirmButton: false, |
| | | async onOpenChange(isOpen) { |
| | | if (!isOpen) { |
| | | detailData.value = undefined; |
| | | return; |
| | | } |
| | | const data = modalApi.getData<{ id?: number }>(); |
| | | if (!data?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | detailData.value = await getBatch(data.id); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | defineExpose({ |
| | | open: (id: number) => modalApi.setData({ id }).open(), |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal title="æ¹æ¬¡è¯¦æ
" class="w-3/5"> |
| | | <Descriptions class="mx-4" :data="detailData" /> |
| | | </Modal> |
| | | </template> |
copy from src/views/mes/wm/batch/components/index.ts
copy to src/views/wls/batch/components/index.ts
copy from src/views/mes/wm/batch/components/select-dialog.vue
copy to src/views/wls/batch/components/select-dialog.vue
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmBatchApi } from '#/api/mes/wm/batch'; |
| | | |
| | | import { computed, ref, useAttrs, watch } from 'vue'; |
| | | |
| | | import { IconifyIcon } from '../../../../packages/icons/src'; |
| | | |
| | | import { Input, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getBatch } from '#/api/mes/wm/batch'; |
| | | |
| | | import WmBatchSelectDialog from './select-dialog.vue'; |
| | | |
| | | defineOptions({ name: 'WmBatchSelect', inheritAttrs: false }); |
| | | |
| | | const props = withDefaults( |
| | | defineProps<{ |
| | | allowClear?: boolean; |
| | | clientId?: number; // é»è®¤è¿æ»¤çå®¢æ· ID |
| | | disabled?: boolean; |
| | | itemId?: number; // é»è®¤è¿æ»¤çç©æ ID |
| | | modelValue?: number; |
| | | placeholder?: string; |
| | | salesOrderCode?: string; // é»è®¤è¿æ»¤çéå®è®¢åç¼å· |
| | | vendorId?: number; // é»è®¤è¿æ»¤çä¾åºå ID |
| | | }>(), |
| | | { |
| | | allowClear: true, |
| | | clientId: undefined, |
| | | disabled: false, |
| | | itemId: undefined, |
| | | modelValue: undefined, |
| | | placeholder: 'è¯·éæ©æ¹æ¬¡', |
| | | salesOrderCode: undefined, |
| | | vendorId: undefined, |
| | | }, |
| | | ); |
| | | |
| | | const emit = defineEmits<{ |
| | | change: [item: MesWmBatchApi.Batch | undefined]; |
| | | 'update:modelValue': [value: number | undefined]; |
| | | }>(); |
| | | |
| | | const attrs = useAttrs(); |
| | | const dialogRef = ref<InstanceType<typeof WmBatchSelectDialog>>(); |
| | | const hovering = ref(false); |
| | | const selectedItem = ref<MesWmBatchApi.Batch>(); |
| | | |
| | | const displayLabel = computed(() => selectedItem.value?.code ?? ''); |
| | | |
| | | const showClear = computed( |
| | | () => |
| | | props.allowClear && |
| | | !props.disabled && |
| | | hovering.value && |
| | | props.modelValue !== null, |
| | | ); |
| | | |
| | | /** æ ¹æ®ç¼å·åæ¡æ¥è¯¢æ¹æ¬¡ä¿¡æ¯ï¼ç¨äºç¼è¾åæ¾ï¼ */ |
| | | async function resolveItemById(id: number | undefined) { |
| | | if (!id) { |
| | | selectedItem.value = undefined; |
| | | return; |
| | | } |
| | | if (selectedItem.value?.id === id) { |
| | | return; |
| | | } |
| | | selectedItem.value = await getBatch(id); |
| | | } |
| | | |
| | | watch(() => props.modelValue, resolveItemById, { immediate: true }); |
| | | |
| | | /** æ¸
ç©ºå·²éæ¹æ¬¡ */ |
| | | function clearSelected() { |
| | | selectedItem.value = undefined; |
| | | emit('update:modelValue', undefined); |
| | | emit('change', undefined); |
| | | } |
| | | |
| | | /** æå¼æ¹æ¬¡éæ©å¼¹çª */ |
| | | function handleClick(event: MouseEvent) { |
| | | if (props.disabled) { |
| | | return; |
| | | } |
| | | const target = event.target as HTMLElement; |
| | | if (showClear.value && target.closest('.ant-input-suffix')) { |
| | | event.stopPropagation(); |
| | | clearSelected(); |
| | | return; |
| | | } |
| | | const selectedIds = ( |
| | | props.modelValue === null ? [] : [props.modelValue] |
| | | ) as number[]; |
| | | dialogRef.value?.open(selectedIds, { |
| | | clientId: props.clientId, |
| | | itemId: props.itemId, |
| | | multiple: false, |
| | | salesOrderCode: props.salesOrderCode, |
| | | vendorId: props.vendorId, |
| | | }); |
| | | } |
| | | |
| | | /** å¼¹çªéä¸åè° */ |
| | | function handleSelected(rows: MesWmBatchApi.Batch[]) { |
| | | const item = rows[0]; |
| | | if (!item) { |
| | | return; |
| | | } |
| | | selectedItem.value = item; |
| | | emit('update:modelValue', item.id); |
| | | emit('change', item); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div |
| | | v-bind="attrs" |
| | | class="w-full" |
| | | :class="disabled ? 'cursor-not-allowed' : 'cursor-pointer'" |
| | | @click="handleClick" |
| | | @mouseenter="hovering = true" |
| | | @mouseleave="hovering = false" |
| | | > |
| | | <Tooltip :mouse-enter-delay="0.5" :open="selectedItem ? undefined : false"> |
| | | <template #title> |
| | | <div v-if="selectedItem" class="leading-6"> |
| | | <div>æ¹æ¬¡ç¼å·ï¼{{ selectedItem.code || '-' }}</div> |
| | | <div>ç©æç¼ç ï¼{{ selectedItem.itemCode || '-' }}</div> |
| | | <div>ç©æåç§°ï¼{{ selectedItem.itemName || '-' }}</div> |
| | | <div>ç产æ¹å·ï¼{{ selectedItem.lotNumber || '-' }}</div> |
| | | </div> |
| | | </template> |
| | | <Input |
| | | :disabled="disabled" |
| | | :placeholder="placeholder" |
| | | :value="displayLabel" |
| | | readonly |
| | | > |
| | | <template #suffix> |
| | | <IconifyIcon |
| | | class="size-4" |
| | | :icon="showClear ? 'lucide:circle-x' : 'lucide:search'" |
| | | /> |
| | | </template> |
| | | </Input> |
| | | </Tooltip> |
| | | </div> |
| | | <WmBatchSelectDialog ref="dialogRef" @selected="handleSelected" /> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmBatchApi } from '#/api/mes/wm/batch'; |
| | | import type { DescriptionItemSchema } from '#/components/description'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '../../../packages/constants/src'; |
| | | import { getDictOptions } from '../../../packages/effects/hooks/src'; |
| | | import { formatDate } from '../../../packages/utils/src'; |
| | | |
| | | import { DictTag } from '#/components/dict-tag'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdClientSelect } from '#/views/mes/md/client/components'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; |
| | | import { ProTaskSelect } from '#/views/mes/pro/task/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { TmToolSelect } from '#/views/mes/tm/tool/components'; |
| | | |
| | | /** æ¹æ¬¡éæ©å¼¹çªçæç´¢è¡¨å */ |
| | | export function useBatchSelectGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'æ¹æ¬¡ç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥æ¹æ¬¡ç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '产åç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©äº§åç©æ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | label: 'ä¾åºå', |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客æ·', |
| | | component: markRaw(MdClientSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©å®¢æ·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: 'ç产订å', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç产订å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workstationId', |
| | | label: 'å·¥ä½ç«', |
| | | component: markRaw(MdWorkstationSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©å·¥ä½ç«', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'taskId', |
| | | label: 'ç产任å¡', |
| | | component: markRaw(ProTaskSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç产任å¡', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'toolId', |
| | | label: 'å·¥å
·', |
| | | component: markRaw(TmToolSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©å·¥å
·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'moldId', |
| | | label: '模å
·ç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥æ¨¡å
·ç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | label: 'éå®è®¢åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éå®è®¢åç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderCode', |
| | | label: 'éè´è®¢åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éè´è®¢åç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'lotNumber', |
| | | label: 'ç产æ¹å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥ç产æ¹å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'qualityStatus', |
| | | label: 'è´¨éç¶æ', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_WM_QUALITY_STATUS, 'number'), |
| | | placeholder: 'è¯·éæ©è´¨éç¶æ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'produceDate', |
| | | label: 'çäº§æ¥æ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'expireDate', |
| | | label: 'æææ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'receiptDate', |
| | | label: 'å
¥åºæ¥æ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** æ¹æ¬¡éæ©å¼¹çªçåæ®µ */ |
| | | export function useBatchSelectGridColumns( |
| | | multiple = false, |
| | | ): VxeTableGridOptions<MesWmBatchApi.Batch>['columns'] { |
| | | return [ |
| | | { |
| | | type: multiple ? 'checkbox' : 'radio', |
| | | width: 50, |
| | | }, |
| | | { |
| | | field: 'code', |
| | | title: 'æ¹æ¬¡ç¼å·', |
| | | width: 150, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: 'ç©æç¼ç ', |
| | | width: 150, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'ç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'itemSpecification', |
| | | title: 'è§æ ¼åå·', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'unitName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'vendorCode', |
| | | title: 'ä¾åºåç¼ç ', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'vendorName', |
| | | title: 'ä¾åºååç§°', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'clientCode', |
| | | title: '客æ·ç¼ç ', |
| | | width: 110, |
| | | }, |
| | | { |
| | | field: 'clientName', |
| | | title: '客æ·åç§°', |
| | | width: 110, |
| | | }, |
| | | { |
| | | field: 'salesOrderCode', |
| | | title: 'éå®è®¢åç¼å·', |
| | | width: 140, |
| | | }, |
| | | { |
| | | field: 'purchaseOrderCode', |
| | | title: 'éè´è®¢åç¼å·', |
| | | width: 140, |
| | | }, |
| | | { |
| | | field: 'workOrderCode', |
| | | title: '订åç¼ç ', |
| | | width: 140, |
| | | }, |
| | | { |
| | | field: 'workstationCode', |
| | | title: 'å·¥ä½ç«ç¼ç ', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'taskCode', |
| | | title: 'ç产任å¡ç¼å·', |
| | | width: 140, |
| | | }, |
| | | { |
| | | field: 'toolCode', |
| | | title: 'å·¥å
·ç¼å·', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'lotNumber', |
| | | title: 'ç产æ¹å·', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'qualityStatus', |
| | | title: 'è´¨éç¶æ', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_QUALITY_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'produceDate', |
| | | title: 'çäº§æ¥æ', |
| | | width: 120, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'expireDate', |
| | | title: 'æææ', |
| | | width: 120, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'receiptDate', |
| | | title: 'å
¥åºæ¥æ', |
| | | width: 120, |
| | | formatter: 'formatDate', |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** æ¹æ¬¡è¯¦æ
çæè¿°å段 */ |
| | | export function useDetailSchema(): DescriptionItemSchema[] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | label: 'æ¹æ¬¡ç¼å·', |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | label: 'ç©æç¼ç ', |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | label: 'ç©æåç§°', |
| | | }, |
| | | { |
| | | field: 'itemSpecification', |
| | | label: 'è§æ ¼åå·', |
| | | }, |
| | | { |
| | | field: 'unitName', |
| | | label: 'åä½', |
| | | }, |
| | | { |
| | | field: 'lotNumber', |
| | | label: 'ç产æ¹å·', |
| | | }, |
| | | { |
| | | field: 'produceDate', |
| | | label: 'çäº§æ¥æ', |
| | | render: (value) => (value ? formatDate(value, 'YYYY-MM-DD') : '-'), |
| | | }, |
| | | { |
| | | field: 'expireDate', |
| | | label: 'æææ', |
| | | render: (value) => (value ? formatDate(value, 'YYYY-MM-DD') : '-'), |
| | | }, |
| | | { |
| | | field: 'receiptDate', |
| | | label: 'å
¥åºæ¥æ', |
| | | render: (value) => (value ? formatDate(value, 'YYYY-MM-DD') : '-'), |
| | | }, |
| | | { |
| | | field: 'vendorName', |
| | | label: 'ä¾åºå', |
| | | render: (value) => value || '-', |
| | | }, |
| | | { |
| | | field: 'clientName', |
| | | label: '客æ·', |
| | | render: (value) => value || '-', |
| | | }, |
| | | { |
| | | field: 'workstationCode', |
| | | label: 'å·¥ä½ç«', |
| | | render: (value) => value || '-', |
| | | }, |
| | | { |
| | | field: 'purchaseOrderCode', |
| | | label: 'éè´è®¢åç¼å·', |
| | | render: (value) => value || '-', |
| | | }, |
| | | { |
| | | field: 'salesOrderCode', |
| | | label: 'éå®è®¢åç¼å·', |
| | | render: (value) => value || '-', |
| | | }, |
| | | { |
| | | field: 'workOrderCode', |
| | | label: 'ç产订å', |
| | | render: (value) => value || '-', |
| | | }, |
| | | { |
| | | field: 'qualityStatus', |
| | | label: 'è´¨éç¶æ', |
| | | render: (value) => |
| | | value === null |
| | | ? '-' |
| | | : h(DictTag, { type: DICT_TYPE.MES_WM_QUALITY_STATUS, value }), |
| | | }, |
| | | { |
| | | field: 'remark', |
| | | label: '夿³¨', |
| | | span: 3, |
| | | render: (value) => value || '-', |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmArrivalNoticeApi } from '#/api/mes/wm/arrivalnotice'; |
| | | import type { MesWmArrivalNoticeLineApi } from '#/api/mes/wm/arrivalnotice/line'; |
| | | import type { MesWmItemReceiptApi } from '#/api/mes/wm/itemreceipt'; |
| | | import type { MesWmItemReceiptDetailApi } from '#/api/mes/wm/itemreceipt/detail'; |
| | | import type { MesWmItemReceiptLineApi } from '#/api/mes/wm/itemreceipt/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesWmArrivalNoticeStatusEnum, |
| | | } from '../../../packages/constants/src'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { |
| | | WmArrivalNoticeLineSelect, |
| | | WmArrivalNoticeSelect, |
| | | } from '#/views/wls/arrivalnotice/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | | WmWarehouseSelect, |
| | | } from '#/views/wls/warehouse/components'; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'finish' | 'stock' | 'update'; |
| | | |
| | | /** 表å头鍿¯å¦åªè¯»ï¼ä¸æ¶ã详æ
ãå
¥åºæï¼ */ |
| | | function isHeaderReadonly(formType: FormType): boolean { |
| | | return formType === 'detail' || formType === 'finish' || formType === 'stock'; |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: 'å
¥åºåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å
¥åºåç¼å·', |
| | | }, |
| | | rules: 'required', |
| | | suffix: isHeaderReadonly(formType) |
| | | ? undefined |
| | | : () => |
| | | h( |
| | | Button, |
| | | { |
| | | type: 'default', |
| | | onClick: async () => { |
| | | const code = await generateAutoCode( |
| | | MesAutoCodeRuleCode.WM_ITEM_RECEIPT_CODE, |
| | | ); |
| | | await formApi?.setFieldValue('code', code); |
| | | }, |
| | | }, |
| | | { default: () => 'çæ' }, |
| | | ), |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'å
¥åºååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å
¥åºååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'receiptDate', |
| | | label: 'å
¥åºæ¥æ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©å
¥åºæ¥æ', |
| | | valueFormat: 'x', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'noticeId', |
| | | label: 'å°è´§éç¥å', |
| | | component: markRaw(WmArrivalNoticeSelect), |
| | | componentProps: { |
| | | // éæ©å°è´§éç¥ååï¼èªå¨åå¡«ä¾åºååéè´è®¢åå· |
| | | onChange: async (notice?: MesWmArrivalNoticeApi.ArrivalNotice) => { |
| | | await formApi?.setValues({ |
| | | purchaseOrderCode: notice?.purchaseOrderCode, |
| | | vendorId: notice?.vendorId, |
| | | }); |
| | | }, |
| | | status: MesWmArrivalNoticeStatusEnum.PENDING_RECEIPT, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | label: 'ä¾åºå', |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderCode', |
| | | label: 'éè´è®¢åå·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥éè´è®¢åå·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'å
¥åºåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥å
¥åºåç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'å
¥åºååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥å
¥åºååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | label: 'ä¾åºå', |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'receiptDate', |
| | | label: 'å
¥åºæ¥æ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesWmItemReceiptApi.ItemReceipt>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: 'å
¥åºåç¼å·', |
| | | minWidth: 160, |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: 'å
¥åºååç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'purchaseOrderCode', |
| | | title: 'éè´è®¢åå·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'vendorName', |
| | | title: 'ä¾åºååç§°', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'receiptDate', |
| | | title: 'å
¥åºæ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_ITEM_RECEIPT_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å
¥åºåè¡å表çåæ®µ */ |
| | | export function useLineGridColumns( |
| | | editable: boolean, |
| | | stockable: boolean, |
| | | ): VxeTableGridOptions<MesWmItemReceiptLineApi.ItemReceiptLine>['columns'] { |
| | | return [ |
| | | { |
| | | type: 'expand', |
| | | width: 48, |
| | | slots: { content: 'detail' }, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: 'ç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'ç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'receivedQuantity', |
| | | title: 'å
¥åºæ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'batchCode', |
| | | title: 'æ¹æ¬¡å·', |
| | | minWidth: 120, |
| | | }, |
| | | ...(editable || stockable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 200, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** å
¥åºåè¡æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useLineFormSchema( |
| | | hasNotice: boolean, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'noticeId', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'arrivalNoticeLineId', |
| | | label: 'å°è´§éç¥åè¡', |
| | | component: markRaw(WmArrivalNoticeLineSelect), |
| | | componentProps: { |
| | | // éæ©å°è´§éç¥åè¡åï¼èªå¨åå¡«ç©æåå
¥åºæ°é |
| | | onChange: async ( |
| | | line?: MesWmArrivalNoticeLineApi.ArrivalNoticeLine, |
| | | ) => { |
| | | await formApi?.setValues({ |
| | | itemId: line?.itemId, |
| | | receivedQuantity: line?.arrivalQuantity, |
| | | }); |
| | | }, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['noticeId'], |
| | | if: () => hasNotice, |
| | | componentProps: (values) => ({ |
| | | noticeId: values.noticeId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç©æ', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['arrivalNoticeLineId'], |
| | | componentProps: (values) => ({ |
| | | disabled: !!values.arrivalNoticeLineId, |
| | | placeholder: 'è¯·éæ©ç©æ', |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'receivedQuantity', |
| | | label: 'å
¥åºæ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥å
¥åºæ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'productionDate', |
| | | label: 'çäº§æ¥æ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©çäº§æ¥æ', |
| | | valueFormat: 'x', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'expireDate', |
| | | label: 'æææ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©æææ', |
| | | valueFormat: 'x', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'lotNumber', |
| | | label: 'ç产æ¹å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥ç产æ¹å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: 'ç±å¡«åä¿¡æ¯èªå¨çæ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 䏿¶æç»å表çåæ®µ */ |
| | | export function useDetailGridColumns( |
| | | stockable: boolean, |
| | | ): VxeTableGridOptions<MesWmItemReceiptDetailApi.ItemReceiptDetail>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'warehouseName', |
| | | title: 'ä»åºåç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'locationName', |
| | | title: 'åºåºåç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'areaName', |
| | | title: 'åºä½åç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'æ°é', |
| | | width: 100, |
| | | }, |
| | | ...(stockable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 120, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** 䏿¶æç»æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useDetailFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'å
¥åºä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | // 忢ä»åºåæ¸
空åºåºååºä½ |
| | | onChange: async () => { |
| | | await formApi?.setValues({ |
| | | areaId: undefined, |
| | | locationId: undefined, |
| | | }); |
| | | }, |
| | | placeholder: 'è¯·éæ©ä»åº', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: 'åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | // 忢åºåºåæ¸
空åºä½ |
| | | onChange: async () => { |
| | | await formApi?.setFieldValue('areaId', undefined); |
| | | }, |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | warehouseId: values.warehouseId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaId', |
| | | label: 'åºä½', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åºä½', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['locationId'], |
| | | componentProps: (values) => ({ |
| | | locationId: values.locationId, |
| | | placeholder: 'è¯·éæ©åºä½', |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'æ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥æ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmItemReceiptApi } from '#/api/mes/wm/itemreceipt'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { MesWmItemReceiptStatusEnum } from '../../../packages/constants/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | cancelItemReceipt, |
| | | deleteItemReceipt, |
| | | exportItemReceipt, |
| | | getItemReceiptPage, |
| | | } from '#/api/mes/wm/itemreceipt'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建éè´å
¥åºå */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ¥çéè´å
¥åºå */ |
| | | function handleDetail(row: MesWmItemReceiptApi.ItemReceipt) { |
| | | formModalApi.setData({ formType: 'detail', id: row.id }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾éè´å
¥åºå */ |
| | | function handleEdit(row: MesWmItemReceiptApi.ItemReceipt) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ */ |
| | | function handleStock(row: MesWmItemReceiptApi.ItemReceipt) { |
| | | formModalApi.setData({ formType: 'stock', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æ§è¡å
¥åº */ |
| | | function handleFinish(row: MesWmItemReceiptApi.ItemReceipt) { |
| | | formModalApi.setData({ formType: 'finish', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å é¤éè´å
¥åºå */ |
| | | async function handleDelete(row: MesWmItemReceiptApi.ItemReceipt) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.code]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteItemReceipt(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** åæ¶éè´å
¥åºå */ |
| | | async function handleCancel(row: MesWmItemReceiptApi.ItemReceipt) { |
| | | await cancelItemReceipt(row.id!); |
| | | message.success('åæ¶æå'); |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportItemReceipt(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: 'éè´å
¥åºå.xls', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getItemReceiptPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmItemReceiptApi.ItemReceipt>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="éè´å
¥åºåå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['éè´å
¥åºå']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-item-receipt:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:wm-item-receipt:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-item-receipt:update'], |
| | | ifShow: row.status === MesWmItemReceiptStatusEnum.PREPARE, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-item-receipt:delete'], |
| | | ifShow: row.status === MesWmItemReceiptStatusEnum.PREPARE, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.code]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ§è¡ä¸æ¶', |
| | | type: 'link', |
| | | auth: ['mes:wm-item-receipt:update'], |
| | | ifShow: row.status === MesWmItemReceiptStatusEnum.APPROVING, |
| | | onClick: handleStock.bind(null, row), |
| | | }, |
| | | { |
| | | label: 'æ§è¡å
¥åº', |
| | | type: 'link', |
| | | auth: ['mes:wm-item-receipt:finish'], |
| | | ifShow: row.status === MesWmItemReceiptStatusEnum.APPROVED, |
| | | onClick: handleFinish.bind(null, row), |
| | | }, |
| | | { |
| | | label: 'åæ¶', |
| | | type: 'link', |
| | | danger: true, |
| | | auth: ['mes:wm-item-receipt:update'], |
| | | ifShow: |
| | | row.status === MesWmItemReceiptStatusEnum.APPROVING || |
| | | row.status === MesWmItemReceiptStatusEnum.APPROVED, |
| | | popConfirm: { |
| | | title: 'ç¡®è®¤åæ¶è¯¥éè´å
¥åºåï¼åæ¶åä¸å¯æ¢å¤ã', |
| | | confirm: handleCancel.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmItemReceiptDetailApi } from '#/api/mes/wm/itemreceipt/detail'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createItemReceiptDetail, |
| | | getItemReceiptDetail, |
| | | updateItemReceiptDetail, |
| | | } from '#/api/mes/wm/itemreceipt/detail'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useDetailFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits<{ success: [lineId: number] }>(); |
| | | const formData = ref<MesWmItemReceiptDetailApi.ItemReceiptDetail>(); |
| | | const receiptId = ref<number>(); // æå±å
¥åºåç¼å· |
| | | const lineId = ref<number>(); // æå±å
¥åºåè¡ç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['䏿¶æç»']) |
| | | : $t('ui.actionTitle.create', ['䏿¶æç»']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useDetailFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmItemReceiptDetailApi.ItemReceiptDetail; |
| | | data.receiptId = receiptId.value; |
| | | data.lineId = lineId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateItemReceiptDetail({ ...data, id: formData.value.id }) |
| | | : createItemReceiptDetail(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success', lineId.value!); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | formApi.setState({ schema: useDetailFormSchema(formApi) }); |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | detailId?: number; |
| | | itemId?: number; |
| | | lineId: number; |
| | | receiptId: number; |
| | | }>(); |
| | | receiptId.value = data.receiptId; |
| | | lineId.value = data.lineId; |
| | | if (data.detailId) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getItemReceiptDetail(data.detailId); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } else if (data.itemId) { |
| | | await formApi.setFieldValue('itemId', data.itemId); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
copy from src/views/mes/wm/itemreceipt/modules/detail-list.vue
copy to src/views/wls/itemreceipt/modules/detail-list.vue
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { MesWmItemReceiptApi } from '#/api/mes/wm/itemreceipt'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { confirm, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { MesWmItemReceiptStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createItemReceipt, |
| | | finishItemReceipt, |
| | | getItemReceipt, |
| | | stockItemReceipt, |
| | | submitItemReceipt, |
| | | updateItemReceipt, |
| | | } from '#/api/mes/wm/itemreceipt'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import LineList from './line-list.vue'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesWmItemReceiptApi.ItemReceipt>(); |
| | | const originalSnapshot = ref(''); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äºæäº¤æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | const isEditable = computed(() => |
| | | // æ¯å¦ä¸ºç¼è¾æ¨¡å¼ï¼å¯ä¿åï¼ |
| | | ['create', 'update'].includes(formType.value), |
| | | ); |
| | | const isStock = computed(() => formType.value === 'stock'); // æ¯å¦ä¸ºä¸æ¶æ¨¡å¼ |
| | | const isFinish = computed(() => formType.value === 'finish'); // æ¯å¦ä¸ºæ§è¡å
¥åºæ¨¡å¼ |
| | | const canSubmit = computed( |
| | | () => |
| | | // æ¯å¦å¯æäº¤ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmItemReceiptStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.view', ['éè´å
¥åºå']); |
| | | } |
| | | if (formType.value === 'stock') { |
| | | return 'æ§è¡ä¸æ¶'; |
| | | } |
| | | if (formType.value === 'finish') { |
| | | return 'æ§è¡å
¥åº'; |
| | | } |
| | | return formType.value === 'update' |
| | | ? $t('ui.actionTitle.edit', ['éè´å
¥åºå']) |
| | | : $t('ui.actionTitle.create', ['éè´å
¥åºå']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | /** æäº¤å
¥åºåï¼è¡¨åæä¿®æ¹æ¶å
ä¿åï¼åè°ç¨æäº¤æ¥å£ */ |
| | | async function handleSubmit() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = |
| | | (await formApi.getValues()) as MesWmItemReceiptApi.ItemReceipt; |
| | | await updateItemReceipt({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | await submitItemReceipt(formData.value.id); |
| | | message.success('æäº¤æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ */ |
| | | async function handleStock() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await stockItemReceipt(formData.value.id); |
| | | message.success('䏿¶æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æ§è¡å
¥åº */ |
| | | async function handleFinish() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await finishItemReceipt(formData.value.id); |
| | | message.success('å
¥åºæå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (!isEditable.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesWmItemReceiptApi.ItemReceipt; |
| | | try { |
| | | if (formData.value?.id) { |
| | | await updateItemReceipt({ ...formData.value, ...data }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createItemReceipt(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesWmItemReceiptStatusEnum.PREPARE, |
| | | }; |
| | | await formApi.setFieldValue('id', id); |
| | | await formApi.setFieldValue('status', formData.value.status); |
| | | formType.value = 'update'; |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ''; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | formApi.setDisabled(!isEditable.value); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | | if (data?.id) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getItemReceipt(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | |
| | | /** 䏿¶å确认 */ |
| | | async function confirmStock() { |
| | | try { |
| | | await confirm('确认æ§è¡ä¸æ¶ï¼'); |
| | | } catch { |
| | | return; |
| | | } |
| | | await handleStock(); |
| | | } |
| | | |
| | | /** å
¥åºå确认 */ |
| | | async function confirmFinish() { |
| | | try { |
| | | await confirm('确认æ§è¡å
¥åºï¼æ§è¡åå°æ´æ°åºåå°è´¦ã'); |
| | | } catch { |
| | | return; |
| | | } |
| | | await handleFinish(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | <!-- éæ°å»ºæ¨¡å¼å±ç¤ºç©æä¿¡æ¯ --> |
| | | <template v-if="formData?.id"> |
| | | <Divider>ç©æä¿¡æ¯</Divider> |
| | | <div class="mx-4"> |
| | | <LineList |
| | | :form-type="formType" |
| | | :notice-id="formData.noticeId" |
| | | :receipt-id="formData.id" |
| | | /> |
| | | </div> |
| | | </template> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Popconfirm |
| | | v-if="canSubmit" |
| | | title="确认æäº¤è¯¥éè´å
¥åºåï¼ãæäº¤åå°ä¸è½ä¿®æ¹ã" |
| | | @confirm="handleSubmit" |
| | | > |
| | | <Button type="primary">æäº¤</Button> |
| | | </Popconfirm> |
| | | <Button v-if="isStock" type="primary" @click="confirmStock"> |
| | | æ§è¡ä¸æ¶ |
| | | </Button> |
| | | <Button v-if="isFinish" type="primary" @click="confirmFinish"> |
| | | æ§è¡å
¥åº |
| | | </Button> |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmItemReceiptLineApi } from '#/api/mes/wm/itemreceipt/line'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createItemReceiptLine, |
| | | getItemReceiptLine, |
| | | updateItemReceiptLine, |
| | | } from '#/api/mes/wm/itemreceipt/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formData = ref<MesWmItemReceiptLineApi.ItemReceiptLine>(); |
| | | const receiptId = ref<number>(); // æå±å
¥åºåç¼å· |
| | | const noticeId = ref<number>(); // æå±å°è´§éç¥åç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['ç©æå
¥åºåè¡']) |
| | | : $t('ui.actionTitle.create', ['ç©æå
¥åºåè¡']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmItemReceiptLineApi.ItemReceiptLine; |
| | | data.receiptId = receiptId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateItemReceiptLine({ ...data, id: formData.value.id }) |
| | | : createItemReceiptLine(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | id?: number; |
| | | noticeId?: number; |
| | | receiptId: number; |
| | | }>(); |
| | | receiptId.value = data.receiptId; |
| | | noticeId.value = data.noticeId; |
| | | formApi.setState({ schema: useLineFormSchema(!!data.noticeId, formApi) }); |
| | | if (data.noticeId) { |
| | | await formApi.setFieldValue('noticeId', data.noticeId); |
| | | } |
| | | if (!data.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getItemReceiptLine(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues({ ...formData.value, noticeId: noticeId.value }); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmItemReceiptDetailApi } from '#/api/mes/wm/itemreceipt/detail'; |
| | | import type { MesWmItemReceiptLineApi } from '#/api/mes/wm/itemreceipt/line'; |
| | | |
| | | import { computed, reactive } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getItemReceiptDetailListByLineId } from '#/api/mes/wm/itemreceipt/detail'; |
| | | import { |
| | | deleteItemReceiptLine, |
| | | getItemReceiptLinePage, |
| | | } from '#/api/mes/wm/itemreceipt/line'; |
| | | import { $t } from '#/locales'; |
| | | import { PrinterLabel } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | | import DetailList from './detail-list.vue'; |
| | | import LineForm from './line-form.vue'; |
| | | |
| | | const props = defineProps<{ |
| | | formType: FormType; |
| | | noticeId?: number; |
| | | receiptId: number; |
| | | }>(); |
| | | |
| | | const isEditable = computed(() => |
| | | // æ¯å¦å¯ç¼è¾æç»è¡ |
| | | ['create', 'update'].includes(props.formType), |
| | | ); |
| | | const isStock = computed(() => props.formType === 'stock'); // æ¯å¦ä¸ºä¸æ¶æ¨¡å¼ |
| | | const detailMap = reactive< |
| | | Record<number, MesWmItemReceiptDetailApi.ItemReceiptDetail[]> |
| | | >({}); // å·²å±å¼è¡ç䏿¶æç»ç¼å |
| | | |
| | | const [LineFormModal, lineFormModalApi] = useVbenModal({ |
| | | connectedComponent: LineForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [DetailFormModal, detailFormModalApi] = useVbenModal({ |
| | | connectedComponent: DetailForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | for (const id of Object.keys(detailMap)) { |
| | | delete detailMap[Number(id)]; |
| | | } |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** æ·»å ç©æ */ |
| | | function handleCreate() { |
| | | lineFormModalApi |
| | | .setData({ noticeId: props.noticeId, receiptId: props.receiptId }) |
| | | .open(); |
| | | } |
| | | |
| | | /** ç¼è¾ç©æ */ |
| | | function handleEdit(row: MesWmItemReceiptLineApi.ItemReceiptLine) { |
| | | lineFormModalApi |
| | | .setData({ |
| | | id: row.id, |
| | | noticeId: props.noticeId, |
| | | receiptId: props.receiptId, |
| | | }) |
| | | .open(); |
| | | } |
| | | |
| | | /** å é¤ç©æ */ |
| | | async function handleDelete(row: MesWmItemReceiptLineApi.ItemReceiptLine) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.itemName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteItemReceiptLine(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.itemName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 䏿¶ï¼ç´æ¥æå¼æç»å建表å */ |
| | | function handleStock(row: MesWmItemReceiptLineApi.ItemReceiptLine) { |
| | | openDetailForm(row.id!, row.itemId); |
| | | } |
| | | |
| | | /** æå¼ä¸æ¶æç»è¡¨å */ |
| | | function openDetailForm(lineId: number, itemId?: number, detailId?: number) { |
| | | detailFormModalApi |
| | | .setData({ detailId, itemId, lineId, receiptId: props.receiptId }) |
| | | .open(); |
| | | } |
| | | |
| | | /** è·åå·²å±å¼è¡ç䏿¶æç» */ |
| | | function getExpandedDetails(row: MesWmItemReceiptLineApi.ItemReceiptLine) { |
| | | return detailMap[row.id!] || []; |
| | | } |
| | | |
| | | /** å è½½æå®è¡ç䏿¶æç» */ |
| | | async function loadLineDetails(lineId: number) { |
| | | detailMap[lineId] = await getItemReceiptDetailListByLineId(lineId); |
| | | } |
| | | |
| | | /** å±å¼è¡æ¶æå è½½ä¸æ¶æç» */ |
| | | async function handleExpandChange( |
| | | row: MesWmItemReceiptLineApi.ItemReceiptLine, |
| | | expanded: boolean, |
| | | ) { |
| | | if (!expanded) { |
| | | return; |
| | | } |
| | | await loadLineDetails(row.id!); |
| | | } |
| | | |
| | | /** æç»è¡¨åæäº¤æååï¼å·æ°å¯¹åºè¡å·²å±å¼çæç» */ |
| | | async function handleDetailSuccess(lineId: number) { |
| | | await loadLineDetails(lineId); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | gridOptions: { |
| | | columns: useLineGridColumns(isEditable.value, isStock.value), |
| | | expandConfig: { |
| | | padding: true, |
| | | }, |
| | | height: 400, |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }) => { |
| | | if (!props.receiptId) { |
| | | return { list: [], total: 0 }; |
| | | } |
| | | return await getItemReceiptLinePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | receiptId: props.receiptId, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmItemReceiptLineApi.ItemReceiptLine>, |
| | | gridEvents: { |
| | | toggleRowExpand: ({ |
| | | expanded, |
| | | row, |
| | | }: { |
| | | expanded: boolean; |
| | | row: MesWmItemReceiptLineApi.ItemReceiptLine; |
| | | }) => { |
| | | handleExpandChange(row, expanded); |
| | | }, |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <LineFormModal @success="handleRefresh" /> |
| | | <DetailFormModal @success="handleDetailSuccess" /> |
| | | <Grid table-title="ç©æä¿¡æ¯"> |
| | | <template v-if="isEditable" #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: 'æ·»å ç©æ', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #detail="{ row }"> |
| | | <DetailList |
| | | :details="getExpandedDetails(row)" |
| | | :form-type="formType" |
| | | @edit="(detailId) => openDetailForm(row.id!, row.itemId, detailId)" |
| | | @refresh="loadLineDetails(row.id!)" |
| | | /> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <div class="flex items-center justify-center"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | ifShow: isEditable, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | ifShow: isEditable, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.itemName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: '䏿¶', |
| | | type: 'link', |
| | | ifShow: isStock, |
| | | onClick: handleStock.bind(null, row), |
| | | }, |
| | | ]" |
| | | /> |
| | | <PrinterLabel |
| | | v-if="isStock" |
| | | :biz-code="row.batchCode" |
| | | :biz-id="row.batchId" |
| | | biz-type="ITEM_BATCH" |
| | | /> |
| | | </div> |
| | | </template> |
| | | </Grid> |
| | | </div> |
| | | </template> |
copy from src/views/mes/wm/materialstock/components/index.ts
copy to src/views/wls/materialstock/components/index.ts
copy from src/views/mes/wm/materialstock/components/select-dialog.vue
copy to src/views/wls/materialstock/components/select-dialog.vue
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | |
| | | import { computed, ref, useAttrs, watch } from 'vue'; |
| | | |
| | | import { IconifyIcon } from '../../../../packages/icons/src'; |
| | | |
| | | import { Input, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getMaterialStock } from '#/api/mes/wm/materialstock'; |
| | | |
| | | import WmMaterialStockSelectDialog from './select-dialog.vue'; |
| | | |
| | | defineOptions({ name: 'WmMaterialStockSelect', inheritAttrs: false }); |
| | | |
| | | const props = withDefaults( |
| | | defineProps<{ |
| | | allowClear?: boolean; |
| | | batchId?: number; |
| | | disabled?: boolean; |
| | | itemId?: number; |
| | | modelValue?: number; |
| | | placeholder?: string; |
| | | virtualFilter?: 'all' | 'exclude' | 'only'; |
| | | warehouseId?: number; |
| | | }>(), |
| | | { |
| | | allowClear: true, |
| | | batchId: undefined, |
| | | disabled: false, |
| | | itemId: undefined, |
| | | modelValue: undefined, |
| | | placeholder: 'è¯·éæ©åºå', |
| | | virtualFilter: 'exclude', |
| | | warehouseId: undefined, |
| | | }, |
| | | ); |
| | | |
| | | const emit = defineEmits<{ |
| | | change: [item: MesWmMaterialStockApi.MaterialStock | undefined]; |
| | | 'update:modelValue': [value: number | undefined]; |
| | | }>(); |
| | | |
| | | const attrs = useAttrs(); |
| | | const dialogRef = ref<InstanceType<typeof WmMaterialStockSelectDialog>>(); |
| | | const hovering = ref(false); |
| | | const selectedItem = ref<MesWmMaterialStockApi.MaterialStock>(); |
| | | |
| | | const displayLabel = computed(() => { |
| | | const item = selectedItem.value; |
| | | if (!item) { |
| | | return ''; |
| | | } |
| | | return `${item.warehouseName || '-'} / ${item.batchCode || '-'} / æ°é:${item.quantity}`; |
| | | }); |
| | | |
| | | const showClear = computed( |
| | | () => |
| | | props.allowClear && |
| | | !props.disabled && |
| | | hovering.value && |
| | | props.modelValue !== null, |
| | | ); |
| | | |
| | | /** æ ¹æ® ID åæ¡æ¥è¯¢åºåä¿¡æ¯ï¼ç¨äºç¼è¾åæ¾ï¼ */ |
| | | async function resolveItemById(id: number | undefined) { |
| | | if (!id) { |
| | | selectedItem.value = undefined; |
| | | return; |
| | | } |
| | | if (selectedItem.value?.id === id) { |
| | | return; |
| | | } |
| | | selectedItem.value = await getMaterialStock(id); |
| | | } |
| | | |
| | | watch(() => props.modelValue, resolveItemById, { immediate: true }); |
| | | |
| | | /** æ¸
空已éåºå */ |
| | | function clearSelected() { |
| | | selectedItem.value = undefined; |
| | | emit('update:modelValue', undefined); |
| | | emit('change', undefined); |
| | | } |
| | | |
| | | /** æå¼åºåéæ©å¼¹çª */ |
| | | function handleClick(event: MouseEvent) { |
| | | if (props.disabled) { |
| | | return; |
| | | } |
| | | const target = event.target as HTMLElement; |
| | | if (showClear.value && target.closest('.ant-input-suffix')) { |
| | | event.stopPropagation(); |
| | | clearSelected(); |
| | | return; |
| | | } |
| | | const selectedIds = ( |
| | | props.modelValue === null ? [] : [props.modelValue] |
| | | ) as number[]; |
| | | dialogRef.value?.open(selectedIds, { multiple: false }); |
| | | } |
| | | |
| | | /** å¼¹çªéä¸åè° */ |
| | | function handleSelected(rows: MesWmMaterialStockApi.MaterialStock[]) { |
| | | const item = rows[0]; |
| | | if (!item) { |
| | | return; |
| | | } |
| | | selectedItem.value = item; |
| | | emit('update:modelValue', item.id); |
| | | emit('change', item); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div |
| | | v-bind="attrs" |
| | | class="w-full" |
| | | :class="disabled ? 'cursor-not-allowed' : 'cursor-pointer'" |
| | | @click="handleClick" |
| | | @mouseenter="hovering = true" |
| | | @mouseleave="hovering = false" |
| | | > |
| | | <Tooltip :mouse-enter-delay="0.5" :open="selectedItem ? undefined : false"> |
| | | <template #title> |
| | | <div v-if="selectedItem" class="leading-6"> |
| | | <div>ç©æï¼{{ selectedItem.itemName || '-' }}</div> |
| | | <div>æ¹æ¬¡ï¼{{ selectedItem.batchCode || '-' }}</div> |
| | | <div>æ°éï¼{{ selectedItem.quantity ?? '-' }}</div> |
| | | <div>ä»åºï¼{{ selectedItem.warehouseName || '-' }}</div> |
| | | <div>åºåºï¼{{ selectedItem.locationName || '-' }}</div> |
| | | <div>åºä½ï¼{{ selectedItem.areaName || '-' }}</div> |
| | | </div> |
| | | </template> |
| | | <Input |
| | | :disabled="disabled" |
| | | :placeholder="placeholder" |
| | | :value="displayLabel" |
| | | readonly |
| | | > |
| | | <template #suffix> |
| | | <IconifyIcon |
| | | class="size-4" |
| | | :icon="showClear ? 'lucide:circle-x' : 'lucide:search'" |
| | | /> |
| | | </template> |
| | | </Input> |
| | | </Tooltip> |
| | | </div> |
| | | <WmMaterialStockSelectDialog |
| | | ref="dialogRef" |
| | | :batch-id="batchId" |
| | | :item-id="itemId" |
| | | :virtual-filter="virtualFilter" |
| | | :warehouse-id="warehouseId" |
| | | @selected="handleSelected" |
| | | /> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { useAccess } from '../../../packages/effects/access/src'; |
| | | import { DICT_TYPE } from '../../../packages/constants/src'; |
| | | |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | | WmWarehouseSelect, |
| | | } from '../warehouse/components'; |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç©æ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥æ¹æ¬¡å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'ä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä»åº', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: 'åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | warehouseId: values.warehouseId, |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | }), |
| | | // ä»åºåæ¢æ¶æ¸
空åºåºï¼é¿å
æ§åºåºæ¡ä»¶æ®ç |
| | | trigger: (values, formApi) => { |
| | | if (values.locationId !== undefined) { |
| | | void formApi.setFieldValue('locationId', undefined); |
| | | } |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'frozen', |
| | | label: 'æ¯å¦å»ç»', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: [ |
| | | { label: 'æ¯', value: true }, |
| | | { label: 'å¦', value: false }, |
| | | ], |
| | | placeholder: 'è¯·éæ©', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns( |
| | | onFrozenChange: ( |
| | | newFrozen: boolean, |
| | | row: MesWmMaterialStockApi.MaterialStock, |
| | | ) => Promise<boolean | undefined>, |
| | | ): VxeTableGridOptions<MesWmMaterialStockApi.MaterialStock>['columns'] { |
| | | const { hasAccessByCodes } = useAccess(); |
| | | return [ |
| | | { |
| | | field: 'itemCode', |
| | | title: '产åç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: '产åç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'å¨åºæ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'batchCode', |
| | | title: 'æ¹æ¬¡å·', |
| | | minWidth: 140, |
| | | slots: { default: 'batchCode' }, |
| | | }, |
| | | { |
| | | field: 'warehouseName', |
| | | title: 'ä»åº', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'locationName', |
| | | title: 'åºåº', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'areaName', |
| | | title: 'åºä½', |
| | | minWidth: 100, |
| | | slots: { default: 'areaName' }, |
| | | }, |
| | | { |
| | | field: 'receiptTime', |
| | | title: 'å
¥åºæ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDateTime', |
| | | }, |
| | | { |
| | | field: 'frozen', |
| | | title: 'å»ç»', |
| | | width: 90, |
| | | cellRender: { |
| | | name: 'CellSwitch', |
| | | attrs: { beforeChange: onFrozenChange }, |
| | | props: { |
| | | checkedValue: true, |
| | | // å»ç»å¼å
³åæ´æ°æéæ§å¶ï¼æ æéæ¶ç¦ç¨ï¼ä¿æä¸æºé¡¹ç® v-hasPermi ä¸è´ |
| | | disabled: !hasAccessByCodes(['mes:wm-material-stock:update']), |
| | | unCheckedValue: false, |
| | | }, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 鿩弹çªçæç´¢è¡¨å */ |
| | | export function useSelectGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç©æ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | label: 'ä¾åºå', |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥æ¹æ¬¡å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'ä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä»åº', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: 'åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | warehouseId: values.warehouseId, |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | }), |
| | | // ä»åºåæ¢æ¶æ¸
空åºåº |
| | | trigger: (values, formApi) => { |
| | | if (values.locationId !== undefined) { |
| | | void formApi.setFieldValue('locationId', undefined); |
| | | } |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaId', |
| | | label: 'åºä½', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | dependencies: { |
| | | triggerFields: ['warehouseId', 'locationId'], |
| | | componentProps: (values) => ({ |
| | | locationId: values.locationId, |
| | | placeholder: 'è¯·éæ©åºä½', |
| | | }), |
| | | // ä»åºæåºåºåæ¢æ¶æ¸
空åºä½ |
| | | trigger: (values, formApi) => { |
| | | if (values.areaId !== undefined) { |
| | | void formApi.setFieldValue('areaId', undefined); |
| | | } |
| | | }, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 鿩弹çªçåæ®µ */ |
| | | export function useSelectGridColumns( |
| | | multiple = false, |
| | | ): VxeTableGridOptions<MesWmMaterialStockApi.MaterialStock>['columns'] { |
| | | return [ |
| | | { |
| | | type: multiple ? 'checkbox' : 'radio', |
| | | width: 50, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: '产åç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: '产åç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'batchCode', |
| | | title: 'å
¥åºæ¹æ¬¡å·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'warehouseName', |
| | | title: 'ä»åº', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'locationName', |
| | | title: 'åºåº', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'areaName', |
| | | title: 'åºä½', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'å¨åºæ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'receiptTime', |
| | | title: 'å
¥åºæ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDateTime', |
| | | }, |
| | | { |
| | | field: 'frozen', |
| | | title: 'å»ç»', |
| | | width: 80, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { confirm, Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | |
| | | import { Button, Card, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | exportMaterialStock, |
| | | getMaterialStockPage, |
| | | updateMaterialStockFrozen, |
| | | } from '#/api/mes/wm/materialstock'; |
| | | import { $t } from '#/locales'; |
| | | import { MdItemTypeTree } from '#/views/mes/md/item/type/components'; |
| | | import { WmBatchDetail } from '#/views/wls/batch/components'; |
| | | import AreaForm from '#/views/wls/warehouse/area/modules/form.vue'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | |
| | | const [AreaModal, areaModalApi] = useVbenModal({ |
| | | connectedComponent: AreaForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const batchDetailRef = ref<InstanceType<typeof WmBatchDetail>>(); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportMaterialStock({ |
| | | ...(await gridApi.formApi.getValues()), |
| | | itemTypeId: searchItemTypeId.value, |
| | | }); |
| | | downloadFileFromBlobPart({ fileName: 'åºåå°è´¦.xls', source: data }); |
| | | } |
| | | |
| | | /** éæ©ç©æåç±» */ |
| | | const searchItemTypeId = ref<number | undefined>(undefined); |
| | | function handleTypeNodeClick(row: undefined | { id?: number }) { |
| | | searchItemTypeId.value = row?.id; |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** æå¼åºä½è¯¦æ
å¼¹çª */ |
| | | function handleOpenAreaDetail(row: MesWmMaterialStockApi.MaterialStock) { |
| | | if (!row.areaId) { |
| | | return; |
| | | } |
| | | areaModalApi.setData({ formType: 'detail', id: row.areaId }).open(); |
| | | } |
| | | |
| | | /** æå¼æ¹æ¬¡è¯¦æ
å¼¹çª */ |
| | | function handleOpenBatchDetail(row: MesWmMaterialStockApi.MaterialStock) { |
| | | if (!row.batchId) { |
| | | return; |
| | | } |
| | | batchDetailRef.value?.open(row.batchId); |
| | | } |
| | | |
| | | /** å¤çå»ç»ç¶æåæ¢ */ |
| | | async function handleFrozenChange( |
| | | newFrozen: boolean, |
| | | row: MesWmMaterialStockApi.MaterialStock, |
| | | ): Promise<boolean | undefined> { |
| | | const text = newFrozen ? 'å»ç»' : 'è§£å»'; |
| | | try { |
| | | await confirm(`确认è¦"${text}"该åºåè®°å½åï¼`); |
| | | } catch { |
| | | return false; |
| | | } |
| | | // æ´æ°å»ç»ç¶æ |
| | | await updateMaterialStockFrozen({ |
| | | id: row.id!, |
| | | frozen: newFrozen, |
| | | }); |
| | | // æç¤ºå¹¶è¿åæå |
| | | message.success(`${text}æå`); |
| | | return true; |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(handleFrozenChange), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getMaterialStockPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | itemTypeId: searchItemTypeId.value, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmMaterialStockApi.MaterialStock>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><AreaModal /> |
| | | <WmBatchDetail ref="batchDetailRef" /> |
| | | |
| | | <div class="flex h-full w-full"> |
| | | <!-- å·¦ä¾§ç©æåç±»æ --> |
| | | <Card class="mr-4 h-full w-1/6"> |
| | | <MdItemTypeTree @node-click="handleTypeNodeClick" /> |
| | | </Card> |
| | | <!-- å³ä¾§åºåå°è´¦å表 --> |
| | | <div class="w-5/6"> |
| | | <Grid table-title="åºåå°è´¦å表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:wm-material-stock:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #batchCode="{ row }"> |
| | | <Button |
| | | v-if="row.batchId" |
| | | :title="row.batchCode" |
| | | size="small" |
| | | type="link" |
| | | @click="handleOpenBatchDetail(row)" |
| | | > |
| | | {{ row.batchCode }} |
| | | </Button> |
| | | <span v-else>-</span> |
| | | </template> |
| | | <template #areaName="{ row }"> |
| | | <Button |
| | | v-if="row.areaId" |
| | | :title="row.areaName" |
| | | size="small" |
| | | type="link" |
| | | @click="handleOpenAreaDetail(row)" |
| | | > |
| | | {{ row.areaName }} |
| | | </Button> |
| | | <span v-else>-</span> |
| | | </template> |
| | | </Grid> |
| | | </div> |
| | | </div> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | import type { MesWmMiscIssueApi } from '#/api/mes/wm/miscissue'; |
| | | import type { MesWmMiscIssueLineApi } from '#/api/mes/wm/miscissue/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE, MesAutoCodeRuleCode } from '../../../packages/constants/src'; |
| | | import { getDictOptions } from '../../../packages/effects/hooks/src'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | | WmWarehouseSelect, |
| | | } from '#/views/wls/warehouse/components'; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'finish' | 'update'; |
| | | |
| | | /** 表å头鍿¯å¦åªè¯»ï¼è¯¦æ
ãæ§è¡åºåºæï¼ */ |
| | | function isHeaderReadonly(formType: FormType): boolean { |
| | | return formType === 'detail' || formType === 'finish'; |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: 'åºåºåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥åºåºåç¼å·', |
| | | }, |
| | | rules: 'required', |
| | | suffix: isHeaderReadonly(formType) |
| | | ? undefined |
| | | : () => |
| | | h( |
| | | Button, |
| | | { |
| | | type: 'default', |
| | | onClick: async () => { |
| | | const code = await generateAutoCode( |
| | | MesAutoCodeRuleCode.WM_MISC_ISSUE_CODE, |
| | | ); |
| | | await formApi?.setFieldValue('code', code); |
| | | }, |
| | | }, |
| | | { default: () => 'çæ' }, |
| | | ), |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'åºåºååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥åºåºååç§°', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: 'ä¸å¡ç±»å', |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: getDictOptions(DICT_TYPE.MES_WM_MISC_ISSUE_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©ä¸å¡ç±»å', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'issueDate', |
| | | label: 'åºåºæ¥æ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©åºåºæ¥æ', |
| | | valueFormat: 'x', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'sourceDocType', |
| | | label: 'æ¥æºåæ®ç±»å', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥æ¥æºåæ®ç±»å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'sourceDocCode', |
| | | label: 'æ¥æºåæ®ç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥æ¥æºåæ®ç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'åºåºåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥åºåºåç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'åºåºååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥åºåºååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: 'ä¸å¡ç±»å', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_WM_MISC_ISSUE_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©ä¸å¡ç±»å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'sourceDocType', |
| | | label: 'æ¥æºåæ®ç±»å', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥æ¥æºåæ®ç±»å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'sourceDocCode', |
| | | label: 'æ¥æºåæ®ç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥æ¥æºåæ®ç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'issueDate', |
| | | label: 'åºåºæ¥æ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'åæ®ç¶æ', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_WM_MISC_ISSUE_STATUS, 'number'), |
| | | placeholder: 'è¯·éæ©åæ®ç¶æ', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesWmMiscIssueApi.MiscIssue>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: 'åºåºåç¼å·', |
| | | minWidth: 160, |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: 'åºåºååç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'type', |
| | | title: 'ä¸å¡ç±»å', |
| | | minWidth: 120, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_MISC_ISSUE_TYPE }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'sourceDocType', |
| | | title: 'æ¥æºåæ®ç±»å', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'sourceDocCode', |
| | | title: 'æ¥æºåæ®ç¼å·', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'issueDate', |
| | | title: 'åºåºæ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_MISC_ISSUE_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** åºåºåè¡å表çåæ®µ */ |
| | | export function useLineGridColumns( |
| | | editable = true, |
| | | ): VxeTableGridOptions<MesWmMiscIssueLineApi.MiscIssueLine>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'itemCode', |
| | | title: 'ç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'ç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'åºåºæ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'batchCode', |
| | | title: 'æ¹æ¬¡ç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'warehouseName', |
| | | title: 'ä»åº', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'locationName', |
| | | title: 'åºåº', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'areaName', |
| | | title: 'åºä½', |
| | | minWidth: 120, |
| | | }, |
| | | ...(editable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 120, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** åºåºåè¡æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useLineFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'quantityMax', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'materialStockId', |
| | | label: 'åºåç©èµ', |
| | | component: markRaw(WmMaterialStockSelect), |
| | | componentProps: { |
| | | // éæ©åºåç©èµåï¼èªå¨åå¡«ç©æãæ¹æ¬¡å·ãä»åºä½ç½®åæå¤§å¯åºåºæ°é |
| | | onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => { |
| | | await formApi?.setValues({ |
| | | areaId: stock?.areaId, |
| | | batchCode: stock?.batchCode, |
| | | itemId: stock?.itemId, |
| | | locationId: stock?.locationId, |
| | | quantityMax: stock?.quantity, |
| | | warehouseId: stock?.warehouseId, |
| | | }); |
| | | }, |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['itemId'], |
| | | componentProps: (values) => ({ |
| | | itemId: values.itemId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'åºåºæ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0.01, |
| | | placeholder: '请è¾å
¥åºåºæ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | dependencies: { |
| | | triggerFields: ['quantityMax'], |
| | | componentProps: (values) => ({ |
| | | class: '!w-full', |
| | | max: values.quantityMax, |
| | | min: 0.01, |
| | | placeholder: '请è¾å
¥åºåºæ°é', |
| | | precision: 2, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: 'æ¹æ¬¡å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'ä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: 'åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | disabled: true, |
| | | warehouseId: values.warehouseId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaId', |
| | | label: 'åºä½', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['locationId'], |
| | | componentProps: (values) => ({ |
| | | disabled: true, |
| | | locationId: values.locationId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMiscIssueApi } from '#/api/mes/wm/miscissue'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { MesWmMiscIssueStatusEnum } from '../../../packages/constants/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | cancelMiscIssue, |
| | | deleteMiscIssue, |
| | | exportMiscIssue, |
| | | getMiscIssuePage, |
| | | } from '#/api/mes/wm/miscissue'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建æé¡¹åºåºå */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ¥çæé¡¹åºåºå */ |
| | | function handleDetail(row: MesWmMiscIssueApi.MiscIssue) { |
| | | formModalApi.setData({ formType: 'detail', id: row.id }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾æé¡¹åºåºå */ |
| | | function handleEdit(row: MesWmMiscIssueApi.MiscIssue) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æ§è¡åºåº */ |
| | | function handleFinish(row: MesWmMiscIssueApi.MiscIssue) { |
| | | formModalApi.setData({ formType: 'finish', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å 餿项åºåºå */ |
| | | async function handleDelete(row: MesWmMiscIssueApi.MiscIssue) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.code]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteMiscIssue(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** åæ¶æé¡¹åºåºå */ |
| | | async function handleCancel(row: MesWmMiscIssueApi.MiscIssue) { |
| | | await cancelMiscIssue(row.id!); |
| | | message.success('åæ¶æå'); |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportMiscIssue(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: 'æé¡¹åºåºå.xls', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getMiscIssuePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmMiscIssueApi.MiscIssue>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="æé¡¹åºåºåå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['æé¡¹åºåºå']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-misc-issue:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:wm-misc-issue:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-misc-issue:update'], |
| | | ifShow: row.status === MesWmMiscIssueStatusEnum.PREPARE, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-misc-issue:delete'], |
| | | ifShow: row.status === MesWmMiscIssueStatusEnum.PREPARE, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.code]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ§è¡åºåº', |
| | | type: 'link', |
| | | auth: ['mes:wm-misc-issue:finish'], |
| | | ifShow: row.status === MesWmMiscIssueStatusEnum.APPROVED, |
| | | onClick: handleFinish.bind(null, row), |
| | | }, |
| | | { |
| | | label: 'åæ¶', |
| | | type: 'link', |
| | | danger: true, |
| | | auth: ['mes:wm-misc-issue:update'], |
| | | ifShow: row.status === MesWmMiscIssueStatusEnum.APPROVED, |
| | | popConfirm: { |
| | | title: 'ç¡®è®¤åæ¶è¯¥æé¡¹åºåºåï¼åæ¶åä¸å¯æ¢å¤ã', |
| | | confirm: handleCancel.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { MesWmMiscIssueApi } from '#/api/mes/wm/miscissue'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { MesWmMiscIssueStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createMiscIssue, |
| | | finishMiscIssue, |
| | | getMiscIssue, |
| | | submitMiscIssue, |
| | | updateMiscIssue, |
| | | } from '#/api/mes/wm/miscissue'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import LineList from './line-list.vue'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesWmMiscIssueApi.MiscIssue>(); |
| | | const originalSnapshot = ref(''); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äºæäº¤æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | const isEditable = computed(() => |
| | | // æ¯å¦ä¸ºç¼è¾æ¨¡å¼ï¼å¯ä¿åï¼ |
| | | ['create', 'update'].includes(formType.value), |
| | | ); |
| | | const isFinish = computed(() => formType.value === 'finish'); // æ¯å¦ä¸ºæ§è¡åºåºæ¨¡å¼ |
| | | const canSubmit = computed( |
| | | () => |
| | | // æ¯å¦å¯æäº¤ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmMiscIssueStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.view', ['æé¡¹åºåºå']); |
| | | } |
| | | if (formType.value === 'finish') { |
| | | return 'æ§è¡åºåº'; |
| | | } |
| | | return formType.value === 'update' |
| | | ? $t('ui.actionTitle.edit', ['æé¡¹åºåºå']) |
| | | : $t('ui.actionTitle.create', ['æé¡¹åºåºå']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | /** æäº¤åºåºåï¼è¡¨åæä¿®æ¹æ¶å
ä¿åï¼åè°ç¨æäº¤æ¥å£ */ |
| | | async function handleSubmit() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = (await formApi.getValues()) as MesWmMiscIssueApi.MiscIssue; |
| | | await updateMiscIssue({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | await submitMiscIssue(formData.value.id); |
| | | message.success('æäº¤æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æ§è¡åºåº */ |
| | | async function handleFinish() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await finishMiscIssue(formData.value.id); |
| | | message.success('åºåºæå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (!isEditable.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesWmMiscIssueApi.MiscIssue; |
| | | try { |
| | | if (formData.value?.id) { |
| | | await updateMiscIssue({ ...formData.value, ...data }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createMiscIssue(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesWmMiscIssueStatusEnum.PREPARE, |
| | | }; |
| | | await formApi.setFieldValue('id', id); |
| | | await formApi.setFieldValue('status', formData.value.status); |
| | | formType.value = 'update'; |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ''; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | formApi.setDisabled( |
| | | formType.value === 'detail' || formType.value === 'finish', |
| | | ); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | | if (data?.id) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getMiscIssue(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | <!-- éæ°å»ºæ¨¡å¼å±ç¤ºç©æä¿¡æ¯ --> |
| | | <template v-if="formData?.id"> |
| | | <Divider>ç©æä¿¡æ¯</Divider> |
| | | <div class="mx-4"> |
| | | <LineList :form-type="formType" :issue-id="formData.id" /> |
| | | </div> |
| | | </template> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Popconfirm |
| | | v-if="canSubmit" |
| | | title="确认æäº¤è¯¥æé¡¹åºåºåï¼ãæäº¤åå°ä¸è½ä¿®æ¹ã" |
| | | @confirm="handleSubmit" |
| | | > |
| | | <Button type="primary">æäº¤</Button> |
| | | </Popconfirm> |
| | | <Popconfirm |
| | | v-if="isFinish" |
| | | title="确认æ§è¡åºåºï¼æ§è¡åå°æ´æ°åºåå°è´¦ã" |
| | | @confirm="handleFinish" |
| | | > |
| | | <Button type="primary">æ§è¡åºåº</Button> |
| | | </Popconfirm> |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmMiscIssueLineApi } from '#/api/mes/wm/miscissue/line'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createMiscIssueLine, |
| | | getMiscIssueLine, |
| | | updateMiscIssueLine, |
| | | } from '#/api/mes/wm/miscissue/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formData = ref<MesWmMiscIssueLineApi.MiscIssueLine>(); |
| | | const issueId = ref<number>(); // æå±åºåºåç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['ç©æåºåºåè¡']) |
| | | : $t('ui.actionTitle.create', ['ç©æåºåºåè¡']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useLineFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmMiscIssueLineApi.MiscIssueLine; |
| | | data.issueId = issueId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateMiscIssueLine({ ...data, id: formData.value.id }) |
| | | : createMiscIssueLine(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | formApi.setState({ schema: useLineFormSchema(formApi) }); |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | id?: number; |
| | | issueId: number; |
| | | }>(); |
| | | issueId.value = data.issueId; |
| | | if (!data.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getMiscIssueLine(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMiscIssueLineApi } from '#/api/mes/wm/miscissue/line'; |
| | | |
| | | import { computed } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteMiscIssueLine, |
| | | getMiscIssueLinePage, |
| | | } from '#/api/mes/wm/miscissue/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import LineForm from './line-form.vue'; |
| | | |
| | | const props = defineProps<{ |
| | | formType: FormType; |
| | | issueId: number; |
| | | }>(); |
| | | |
| | | const isEditable = computed(() => |
| | | // æ¯å¦å¯ç¼è¾æç»è¡ |
| | | ['create', 'update'].includes(props.formType), |
| | | ); |
| | | |
| | | const [LineFormModal, lineFormModalApi] = useVbenModal({ |
| | | connectedComponent: LineForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** æ·»å ç©æ */ |
| | | function handleCreate() { |
| | | lineFormModalApi.setData({ issueId: props.issueId }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾ç©æ */ |
| | | function handleEdit(row: MesWmMiscIssueLineApi.MiscIssueLine) { |
| | | lineFormModalApi.setData({ id: row.id, issueId: props.issueId }).open(); |
| | | } |
| | | |
| | | /** å é¤ç©æ */ |
| | | async function handleDelete(row: MesWmMiscIssueLineApi.MiscIssueLine) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.itemName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteMiscIssueLine(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.itemName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | gridOptions: { |
| | | columns: useLineGridColumns(isEditable.value), |
| | | height: 360, |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }) => { |
| | | if (!props.issueId) { |
| | | return { list: [], total: 0 }; |
| | | } |
| | | return await getMiscIssueLinePage({ |
| | | issueId: props.issueId, |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmMiscIssueLineApi.MiscIssueLine>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <LineFormModal @success="handleRefresh" /> |
| | | <Grid table-title="ç©æä¿¡æ¯"> |
| | | <template v-if="isEditable" #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: 'æ·»å ç©æ', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | ifShow: isEditable, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | ifShow: isEditable, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.itemName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </div> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMiscReceiptApi } from '#/api/mes/wm/miscreceipt'; |
| | | import type { MesWmMiscReceiptLineApi } from '#/api/mes/wm/miscreceipt/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE, MesAutoCodeRuleCode } from '../../../packages/constants/src'; |
| | | import { getDictOptions } from '../../../packages/effects/hooks/src'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | | WmWarehouseSelect, |
| | | } from '#/views/wls/warehouse/components'; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'finish' | 'update'; |
| | | |
| | | /** 表å头鍿¯å¦åªè¯»ï¼è¯¦æ
ãæ§è¡å
¥åºæï¼ */ |
| | | function isHeaderReadonly(formType: FormType): boolean { |
| | | return formType === 'detail' || formType === 'finish'; |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: 'å
¥åºåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å
¥åºåç¼å·', |
| | | }, |
| | | rules: 'required', |
| | | suffix: isHeaderReadonly(formType) |
| | | ? undefined |
| | | : () => |
| | | h( |
| | | Button, |
| | | { |
| | | type: 'default', |
| | | onClick: async () => { |
| | | const code = await generateAutoCode( |
| | | MesAutoCodeRuleCode.WM_MISC_RECEIPT_CODE, |
| | | ); |
| | | await formApi?.setFieldValue('code', code); |
| | | }, |
| | | }, |
| | | { default: () => 'çæ' }, |
| | | ), |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'å
¥åºååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å
¥åºååç§°', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: 'æé¡¹ç±»å', |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: getDictOptions(DICT_TYPE.MES_WM_MISC_RECEIPT_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©æé¡¹ç±»å', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'sourceDocType', |
| | | label: 'æ¥æºåæ®ç±»å', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥æ¥æºåæ®ç±»å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'sourceDocCode', |
| | | label: 'æ¥æºåæ®ç¼ç ', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥æ¥æºåæ®ç¼ç ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'receiptDate', |
| | | label: 'å
¥åºæ¥æ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©å
¥åºæ¥æ', |
| | | valueFormat: 'x', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'å
¥åºåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥å
¥åºåç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'å
¥åºååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥å
¥åºååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: 'æé¡¹ç±»å', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_WM_MISC_RECEIPT_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©æé¡¹ç±»å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'sourceDocType', |
| | | label: 'æ¥æºåæ®ç±»å', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥æ¥æºåæ®ç±»å', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'sourceDocCode', |
| | | label: 'æ¥æºåæ®ç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥æ¥æºåæ®ç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'receiptDate', |
| | | label: 'å
¥åºæ¥æ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'åæ®ç¶æ', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_WM_MISC_RECEIPT_STATUS, 'number'), |
| | | placeholder: 'è¯·éæ©åæ®ç¶æ', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesWmMiscReceiptApi.MiscReceipt>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: 'å
¥åºåç¼å·', |
| | | minWidth: 160, |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: 'å
¥åºååç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'type', |
| | | title: 'æé¡¹ç±»å', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_MISC_RECEIPT_TYPE }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'sourceDocType', |
| | | title: 'æ¥æºåæ®ç±»å', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'sourceDocCode', |
| | | title: 'æ¥æºåæ®ç¼å·', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'receiptDate', |
| | | title: 'å
¥åºæ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_MISC_RECEIPT_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å
¥åºåè¡å表çåæ®µ */ |
| | | export function useLineGridColumns( |
| | | editable = true, |
| | | ): VxeTableGridOptions<MesWmMiscReceiptLineApi.MiscReceiptLine>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'itemCode', |
| | | title: 'ç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'ç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'å
¥åºæ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'batchCode', |
| | | title: 'æ¹æ¬¡å·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'warehouseName', |
| | | title: 'ä»åº', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'locationName', |
| | | title: 'åºåº', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'areaName', |
| | | title: 'åºä½', |
| | | minWidth: 100, |
| | | }, |
| | | ...(editable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 160, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** å
¥åºåè¡æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useLineFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç©æ', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'å
¥åºæ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0.01, |
| | | placeholder: '请è¾å
¥å
¥åºæ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥æ¹æ¬¡å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'ä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | // 忢ä»åºåæ¸
空åºåºååºä½ |
| | | onChange: async () => { |
| | | await formApi?.setValues({ |
| | | areaId: undefined, |
| | | locationId: undefined, |
| | | }); |
| | | }, |
| | | placeholder: 'è¯·éæ©ä»åº', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: 'åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | // 忢åºåºåæ¸
空åºä½ |
| | | onChange: async () => { |
| | | await formApi?.setFieldValue('areaId', undefined); |
| | | }, |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | warehouseId: values.warehouseId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaId', |
| | | label: 'åºä½', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åºä½', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['locationId'], |
| | | componentProps: (values) => ({ |
| | | locationId: values.locationId, |
| | | placeholder: 'è¯·éæ©åºä½', |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMiscReceiptApi } from '#/api/mes/wm/miscreceipt'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { MesWmMiscReceiptStatusEnum } from '../../../packages/constants/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | cancelMiscReceipt, |
| | | deleteMiscReceipt, |
| | | exportMiscReceipt, |
| | | getMiscReceiptPage, |
| | | } from '#/api/mes/wm/miscreceipt'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建æé¡¹å
¥åºå */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ¥çæé¡¹å
¥åºå */ |
| | | function handleDetail(row: MesWmMiscReceiptApi.MiscReceipt) { |
| | | formModalApi.setData({ formType: 'detail', id: row.id }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾æé¡¹å
¥åºå */ |
| | | function handleEdit(row: MesWmMiscReceiptApi.MiscReceipt) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æ§è¡å
¥åº */ |
| | | function handleFinish(row: MesWmMiscReceiptApi.MiscReceipt) { |
| | | formModalApi.setData({ formType: 'finish', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å 餿项å
¥åºå */ |
| | | async function handleDelete(row: MesWmMiscReceiptApi.MiscReceipt) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.code]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteMiscReceipt(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** åæ¶æé¡¹å
¥åºå */ |
| | | async function handleCancel(row: MesWmMiscReceiptApi.MiscReceipt) { |
| | | await cancelMiscReceipt(row.id!); |
| | | message.success('åæ¶æå'); |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportMiscReceipt(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: 'æé¡¹å
¥åºå.xls', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getMiscReceiptPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmMiscReceiptApi.MiscReceipt>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="æé¡¹å
¥åºåå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['æé¡¹å
¥åºå']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-misc-receipt:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:wm-misc-receipt:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-misc-receipt:update'], |
| | | ifShow: row.status === MesWmMiscReceiptStatusEnum.PREPARE, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-misc-receipt:delete'], |
| | | ifShow: row.status === MesWmMiscReceiptStatusEnum.PREPARE, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.code]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ§è¡å
¥åº', |
| | | type: 'link', |
| | | auth: ['mes:wm-misc-receipt:finish'], |
| | | ifShow: row.status === MesWmMiscReceiptStatusEnum.APPROVED, |
| | | onClick: handleFinish.bind(null, row), |
| | | }, |
| | | { |
| | | label: 'åæ¶', |
| | | type: 'link', |
| | | danger: true, |
| | | auth: ['mes:wm-misc-receipt:cancel'], |
| | | ifShow: row.status === MesWmMiscReceiptStatusEnum.APPROVED, |
| | | popConfirm: { |
| | | title: 'ç¡®è®¤åæ¶è¯¥æé¡¹å
¥åºååï¼', |
| | | confirm: handleCancel.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { MesWmMiscReceiptApi } from '#/api/mes/wm/miscreceipt'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { MesWmMiscReceiptStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createMiscReceipt, |
| | | finishMiscReceipt, |
| | | getMiscReceipt, |
| | | submitMiscReceipt, |
| | | updateMiscReceipt, |
| | | } from '#/api/mes/wm/miscreceipt'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import LineList from './line-list.vue'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesWmMiscReceiptApi.MiscReceipt>(); |
| | | const originalSnapshot = ref(''); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äºæäº¤æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | const isEditable = computed(() => |
| | | // æ¯å¦ä¸ºç¼è¾æ¨¡å¼ï¼å¯ä¿åï¼ |
| | | ['create', 'update'].includes(formType.value), |
| | | ); |
| | | const isFinish = computed(() => formType.value === 'finish'); // æ¯å¦ä¸ºæ§è¡å
¥åºæ¨¡å¼ |
| | | const canSubmit = computed( |
| | | () => |
| | | // æ¯å¦å¯æäº¤ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmMiscReceiptStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.view', ['æé¡¹å
¥åºå']); |
| | | } |
| | | if (formType.value === 'finish') { |
| | | return 'æ§è¡å
¥åº'; |
| | | } |
| | | return formType.value === 'update' |
| | | ? $t('ui.actionTitle.edit', ['æé¡¹å
¥åºå']) |
| | | : $t('ui.actionTitle.create', ['æé¡¹å
¥åºå']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | /** æäº¤å
¥åºåï¼è¡¨åæä¿®æ¹æ¶å
ä¿åï¼åè°ç¨æäº¤æ¥å£ */ |
| | | async function handleSubmit() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = |
| | | (await formApi.getValues()) as MesWmMiscReceiptApi.MiscReceipt; |
| | | await updateMiscReceipt({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | await submitMiscReceipt(formData.value.id); |
| | | message.success('æäº¤æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æ§è¡å
¥åº */ |
| | | async function handleFinish() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await finishMiscReceipt(formData.value.id); |
| | | message.success('å
¥åºæå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (!isEditable.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesWmMiscReceiptApi.MiscReceipt; |
| | | try { |
| | | if (formData.value?.id) { |
| | | await updateMiscReceipt({ ...formData.value, ...data }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createMiscReceipt(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesWmMiscReceiptStatusEnum.PREPARE, |
| | | }; |
| | | await formApi.setFieldValue('id', id); |
| | | await formApi.setFieldValue('status', formData.value.status); |
| | | formType.value = 'update'; |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ''; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | formApi.setDisabled( |
| | | formType.value === 'detail' || formType.value === 'finish', |
| | | ); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | | if (data?.id) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getMiscReceipt(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | <!-- éæ°å»ºæ¨¡å¼å±ç¤ºç©æä¿¡æ¯ --> |
| | | <template v-if="formData?.id"> |
| | | <Divider>ç©æä¿¡æ¯</Divider> |
| | | <div class="mx-4"> |
| | | <LineList :form-type="formType" :receipt-id="formData.id" /> |
| | | </div> |
| | | </template> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Popconfirm |
| | | v-if="canSubmit" |
| | | title="确认æäº¤è¯¥æé¡¹å
¥åºåï¼ãæäº¤åå°ä¸è½ä¿®æ¹ã" |
| | | @confirm="handleSubmit" |
| | | > |
| | | <Button type="primary">æäº¤</Button> |
| | | </Popconfirm> |
| | | <Popconfirm |
| | | v-if="isFinish" |
| | | title="确认æ§è¡å
¥åºï¼æ§è¡åå°æ´æ°åºåå°è´¦ã" |
| | | @confirm="handleFinish" |
| | | > |
| | | <Button type="primary">æ§è¡å
¥åº</Button> |
| | | </Popconfirm> |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmMiscReceiptLineApi } from '#/api/mes/wm/miscreceipt/line'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createMiscReceiptLine, |
| | | getMiscReceiptLine, |
| | | updateMiscReceiptLine, |
| | | } from '#/api/mes/wm/miscreceipt/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formData = ref<MesWmMiscReceiptLineApi.MiscReceiptLine>(); |
| | | const receiptId = ref<number>(); // æå±å
¥åºåç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['ç©æ']) |
| | | : $t('ui.actionTitle.create', ['ç©æ']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useLineFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmMiscReceiptLineApi.MiscReceiptLine; |
| | | data.receiptId = receiptId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateMiscReceiptLine({ ...data, id: formData.value.id }) |
| | | : createMiscReceiptLine(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | formApi.setState({ schema: useLineFormSchema(formApi) }); |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | id?: number; |
| | | receiptId: number; |
| | | }>(); |
| | | receiptId.value = data.receiptId; |
| | | if (!data.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getMiscReceiptLine(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMiscReceiptLineApi } from '#/api/mes/wm/miscreceipt/line'; |
| | | |
| | | import { computed } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteMiscReceiptLine, |
| | | getMiscReceiptLineListByReceiptId, |
| | | } from '#/api/mes/wm/miscreceipt/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import LineForm from './line-form.vue'; |
| | | |
| | | const props = defineProps<{ |
| | | formType: FormType; |
| | | receiptId: number; |
| | | }>(); |
| | | |
| | | const isEditable = computed(() => |
| | | // æ¯å¦å¯ç¼è¾æç»è¡ |
| | | ['create', 'update'].includes(props.formType), |
| | | ); |
| | | |
| | | const [LineFormModal, lineFormModalApi] = useVbenModal({ |
| | | connectedComponent: LineForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** æ·»å ç©æ */ |
| | | function handleCreate() { |
| | | lineFormModalApi.setData({ receiptId: props.receiptId }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾ç©æ */ |
| | | function handleEdit(row: MesWmMiscReceiptLineApi.MiscReceiptLine) { |
| | | lineFormModalApi.setData({ id: row.id, receiptId: props.receiptId }).open(); |
| | | } |
| | | |
| | | /** å é¤ç©æ */ |
| | | async function handleDelete(row: MesWmMiscReceiptLineApi.MiscReceiptLine) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.itemName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteMiscReceiptLine(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.itemName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | gridOptions: { |
| | | columns: useLineGridColumns(isEditable.value), |
| | | height: 360, |
| | | keepSource: true, |
| | | pagerConfig: { |
| | | enabled: false, |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async () => { |
| | | if (!props.receiptId) { |
| | | return { list: [], total: 0 }; |
| | | } |
| | | const list = await getMiscReceiptLineListByReceiptId(props.receiptId); |
| | | return { list, total: list.length }; |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmMiscReceiptLineApi.MiscReceiptLine>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <LineFormModal @success="handleRefresh" /> |
| | | <Grid table-title="ç©æä¿¡æ¯"> |
| | | <template v-if="isEditable" #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: 'æ·»å ç©æ', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | ifShow: isEditable, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | ifShow: isEditable, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.itemName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </div> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | import type { MesWmOutsourceIssueApi } from '#/api/mes/wm/outsourceissue'; |
| | | import type { MesWmOutsourceIssueDetailApi } from '#/api/mes/wm/outsourceissue/detail'; |
| | | import type { MesWmOutsourceIssueLineApi } from '#/api/mes/wm/outsourceissue/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProWorkOrderStatusEnum, |
| | | MesProWorkOrderTypeEnum, |
| | | } from '../../../packages/constants/src'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | | WmWarehouseSelect, |
| | | } from '#/views/wls/warehouse/components'; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'finish' | 'stock' | 'update'; |
| | | |
| | | /** 表å头鍿¯å¦åªè¯»ï¼æ£è´§ã详æ
ãé¢åºæï¼ */ |
| | | function isHeaderReadonly(formType: FormType): boolean { |
| | | return formType === 'detail' || formType === 'finish' || formType === 'stock'; |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: 'åæåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥åæåç¼å·', |
| | | }, |
| | | rules: 'required', |
| | | suffix: isHeaderReadonly(formType) |
| | | ? undefined |
| | | : () => |
| | | h( |
| | | Button, |
| | | { |
| | | type: 'default', |
| | | onClick: async () => { |
| | | const code = await generateAutoCode( |
| | | MesAutoCodeRuleCode.WM_OUTSOURCE_ISSUE_CODE, |
| | | ); |
| | | await formApi?.setFieldValue('code', code); |
| | | }, |
| | | }, |
| | | { default: () => 'çæ' }, |
| | | ), |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'åæååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥åæååç§°', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'issueDate', |
| | | label: 'åææ¥æ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©åææ¥æ', |
| | | valueFormat: 'x', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: 'å¤å订å', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | componentProps: { |
| | | // éæ©å¤å订ååï¼èªå¨åå¡«ä¾åºå |
| | | onChange: async (workOrder?: MesProWorkOrderApi.WorkOrder) => { |
| | | await formApi?.setFieldValue('vendorId', workOrder?.vendorId); |
| | | }, |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | type: MesProWorkOrderTypeEnum.OUTSOURCE, |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | label: 'ä¾åºå', |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'åæåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥åæåç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'åæååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥åæååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | label: 'ä¾åºå', |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'issueDate', |
| | | label: 'åææ¥æ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesWmOutsourceIssueApi.OutsourceIssue>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: 'åæåç¼å·', |
| | | minWidth: 160, |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: 'åæååç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'workOrderCode', |
| | | title: 'ç产订åå·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'vendorName', |
| | | title: 'ä¾åºååç§°', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'issueDate', |
| | | title: 'åææ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_OUTSOURCE_ISSUE_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** åæåè¡å表çåæ®µ */ |
| | | export function useLineGridColumns( |
| | | editable: boolean, |
| | | stockable: boolean, |
| | | ): VxeTableGridOptions<MesWmOutsourceIssueLineApi.OutsourceIssueLine>['columns'] { |
| | | return [ |
| | | { |
| | | type: 'expand', |
| | | width: 48, |
| | | slots: { content: 'detail' }, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: 'ç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'ç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: '颿æ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'batchCode', |
| | | title: 'æ¹æ¬¡å·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'remark', |
| | | title: '夿³¨', |
| | | minWidth: 150, |
| | | }, |
| | | ...(editable || stockable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 160, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** åæåè¡æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useLineFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç©æ', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'åææ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥åææ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥æ¹æ¬¡å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** åææç»å表çåæ®µ */ |
| | | export function useDetailGridColumns( |
| | | stockable: boolean, |
| | | ): VxeTableGridOptions<MesWmOutsourceIssueDetailApi.OutsourceIssueDetail>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'warehouseName', |
| | | title: 'ä»åºåç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'locationName', |
| | | title: 'åºåºåç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'areaName', |
| | | title: 'åºä½åç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'æ°é', |
| | | width: 100, |
| | | }, |
| | | ...(stockable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 120, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** åææç»æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useDetailFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'quantityMax', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'materialStockId', |
| | | label: 'åºåè®°å½', |
| | | component: markRaw(WmMaterialStockSelect), |
| | | componentProps: { |
| | | // éæ©åºåè®°å½åï¼èªå¨åå¡«ä»åº/åºåº/åºä½/æ¹æ¬¡/æ°é |
| | | onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => { |
| | | await formApi?.setValues({ |
| | | areaId: stock?.areaId, |
| | | batchCode: stock?.batchCode, |
| | | batchId: stock?.batchId, |
| | | locationId: stock?.locationId, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | | warehouseId: stock?.warehouseId, |
| | | }); |
| | | }, |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['itemId'], |
| | | componentProps: (values) => ({ |
| | | itemId: values.itemId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'æ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥æ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | dependencies: { |
| | | triggerFields: ['quantityMax'], |
| | | componentProps: (values) => ({ |
| | | class: '!w-full', |
| | | max: values.quantityMax, |
| | | min: 0, |
| | | placeholder: '请è¾å
¥æ°é', |
| | | precision: 2, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'åæä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: 'åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | disabled: true, |
| | | warehouseId: values.warehouseId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaId', |
| | | label: 'åºä½', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['locationId'], |
| | | componentProps: (values) => ({ |
| | | disabled: true, |
| | | locationId: values.locationId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmOutsourceIssueApi } from '#/api/mes/wm/outsourceissue'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { MesWmOutsourceIssueStatusEnum } from '../../../packages/constants/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | cancelOutsourceIssue, |
| | | deleteOutsourceIssue, |
| | | exportOutsourceIssue, |
| | | getOutsourceIssuePage, |
| | | } from '#/api/mes/wm/outsourceissue'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建å¤ååæå */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ¥çå¤ååæå */ |
| | | function handleDetail(row: MesWmOutsourceIssueApi.OutsourceIssue) { |
| | | formModalApi.setData({ formType: 'detail', id: row.id }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾å¤ååæå */ |
| | | function handleEdit(row: MesWmOutsourceIssueApi.OutsourceIssue) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æ§è¡æ£è´§ */ |
| | | function handleStock(row: MesWmOutsourceIssueApi.OutsourceIssue) { |
| | | formModalApi.setData({ formType: 'stock', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æ§è¡é¢åº */ |
| | | function handleFinish(row: MesWmOutsourceIssueApi.OutsourceIssue) { |
| | | formModalApi.setData({ formType: 'finish', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å é¤å¤ååæå */ |
| | | async function handleDelete(row: MesWmOutsourceIssueApi.OutsourceIssue) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.code]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteOutsourceIssue(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** åæ¶å¤ååæå */ |
| | | async function handleCancel(row: MesWmOutsourceIssueApi.OutsourceIssue) { |
| | | await cancelOutsourceIssue(row.id!); |
| | | message.success('åæ¶æå'); |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportOutsourceIssue(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: 'å¤ååæå.xls', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getOutsourceIssuePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmOutsourceIssueApi.OutsourceIssue>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="å¤ååæåå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['å¤ååæå']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-outsource-issue:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:wm-outsource-issue:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-outsource-issue:update'], |
| | | ifShow: row.status === MesWmOutsourceIssueStatusEnum.PREPARE, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-outsource-issue:delete'], |
| | | ifShow: row.status === MesWmOutsourceIssueStatusEnum.PREPARE, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.code]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ§è¡æ£è´§', |
| | | type: 'link', |
| | | auth: ['mes:wm-outsource-issue:update'], |
| | | ifShow: row.status === MesWmOutsourceIssueStatusEnum.APPROVING, |
| | | onClick: handleStock.bind(null, row), |
| | | }, |
| | | { |
| | | label: 'æ§è¡é¢åº', |
| | | type: 'link', |
| | | auth: ['mes:wm-outsource-issue:finish'], |
| | | ifShow: row.status === MesWmOutsourceIssueStatusEnum.APPROVED, |
| | | onClick: handleFinish.bind(null, row), |
| | | }, |
| | | { |
| | | label: 'åæ¶', |
| | | type: 'link', |
| | | danger: true, |
| | | auth: ['mes:wm-outsource-issue:update'], |
| | | ifShow: |
| | | row.status === MesWmOutsourceIssueStatusEnum.APPROVING || |
| | | row.status === MesWmOutsourceIssueStatusEnum.APPROVED, |
| | | popConfirm: { |
| | | title: 'ç¡®è®¤åæ¶è¯¥å¤ååæåï¼åæ¶åä¸å¯æ¢å¤ã', |
| | | confirm: handleCancel.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmOutsourceIssueDetailApi } from '#/api/mes/wm/outsourceissue/detail'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createOutsourceIssueDetail, |
| | | getOutsourceIssueDetail, |
| | | updateOutsourceIssueDetail, |
| | | } from '#/api/mes/wm/outsourceissue/detail'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useDetailFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits<{ success: [lineId: number] }>(); |
| | | const formData = ref<MesWmOutsourceIssueDetailApi.OutsourceIssueDetail>(); |
| | | const issueId = ref<number>(); // æå±åæåç¼å· |
| | | const lineId = ref<number>(); // æå±åæåè¡ç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['åææç»']) |
| | | : $t('ui.actionTitle.create', ['åææç»']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useDetailFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmOutsourceIssueDetailApi.OutsourceIssueDetail; |
| | | data.issueId = issueId.value; |
| | | data.lineId = lineId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateOutsourceIssueDetail({ ...data, id: formData.value.id }) |
| | | : createOutsourceIssueDetail(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success', lineId.value!); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | formApi.setState({ schema: useDetailFormSchema(formApi) }); |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | detailId?: number; |
| | | issueId: number; |
| | | itemId?: number; |
| | | lineId: number; |
| | | }>(); |
| | | issueId.value = data.issueId; |
| | | lineId.value = data.lineId; |
| | | if (data.detailId) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getOutsourceIssueDetail(data.detailId); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } else if (data.itemId) { |
| | | await formApi.setFieldValue('itemId', data.itemId); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
copy from src/views/mes/wm/outsourceissue/modules/detail-list.vue
copy to src/views/wls/outsourceissue/modules/detail-list.vue
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { MesWmOutsourceIssueApi } from '#/api/mes/wm/outsourceissue'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { confirm, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { MesWmOutsourceIssueStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | checkOutsourceIssueQuantity, |
| | | createOutsourceIssue, |
| | | finishOutsourceIssue, |
| | | getOutsourceIssue, |
| | | stockOutsourceIssue, |
| | | submitOutsourceIssue, |
| | | updateOutsourceIssue, |
| | | } from '#/api/mes/wm/outsourceissue'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import LineList from './line-list.vue'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesWmOutsourceIssueApi.OutsourceIssue>(); |
| | | const originalSnapshot = ref(''); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äºæäº¤æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | const isEditable = computed(() => |
| | | // æ¯å¦ä¸ºç¼è¾æ¨¡å¼ï¼å¯ä¿åï¼ |
| | | ['create', 'update'].includes(formType.value), |
| | | ); |
| | | const isStock = computed(() => formType.value === 'stock'); // æ¯å¦ä¸ºæ£è´§æ¨¡å¼ |
| | | const isFinish = computed(() => formType.value === 'finish'); // æ¯å¦ä¸ºæ§è¡é¢åºæ¨¡å¼ |
| | | const canSubmit = computed( |
| | | () => |
| | | // æ¯å¦å¯æäº¤ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmOutsourceIssueStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.view', ['å¤ååæå']); |
| | | } |
| | | if (formType.value === 'stock') { |
| | | return 'æ§è¡æ£è´§'; |
| | | } |
| | | if (formType.value === 'finish') { |
| | | return 'æ§è¡é¢åº'; |
| | | } |
| | | return formType.value === 'update' |
| | | ? $t('ui.actionTitle.edit', ['å¤ååæå']) |
| | | : $t('ui.actionTitle.create', ['å¤ååæå']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | /** æäº¤åæåï¼è¡¨åæä¿®æ¹æ¶å
ä¿åï¼åè°ç¨æäº¤æ¥å£ */ |
| | | async function handleSubmit() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = |
| | | (await formApi.getValues()) as MesWmOutsourceIssueApi.OutsourceIssue; |
| | | await updateOutsourceIssue({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | await submitOutsourceIssue(formData.value.id); |
| | | message.success('æäº¤æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æ§è¡æ£è´§ï¼æ£è´§æ°éä¸åææ°éä¸ä¸è´æ¶äºæ¬¡ç¡®è®¤ */ |
| | | async function handleStock() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | const quantityMatch = await checkOutsourceIssueQuantity(formData.value.id); |
| | | if (!quantityMatch) { |
| | | try { |
| | | await confirm('åææ°é䏿£è´§æ°éä¸ä¸è´ï¼ç¡®è®¤æ§è¡æ£è´§ï¼'); |
| | | } catch { |
| | | return; |
| | | } |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await stockOutsourceIssue(formData.value.id); |
| | | message.success('æ£è´§æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æ§è¡é¢åº */ |
| | | async function handleFinish() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await finishOutsourceIssue(formData.value.id); |
| | | message.success('é¢åºæå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (!isEditable.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmOutsourceIssueApi.OutsourceIssue; |
| | | try { |
| | | if (formData.value?.id) { |
| | | await updateOutsourceIssue({ ...formData.value, ...data }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createOutsourceIssue(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesWmOutsourceIssueStatusEnum.PREPARE, |
| | | }; |
| | | await formApi.setFieldValue('id', id); |
| | | await formApi.setFieldValue('status', formData.value.status); |
| | | formType.value = 'update'; |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ''; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | formApi.setDisabled(!isEditable.value); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | | if (data?.id) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getOutsourceIssue(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | <!-- éæ°å»ºæ¨¡å¼å±ç¤ºç©æä¿¡æ¯ --> |
| | | <template v-if="formData?.id"> |
| | | <Divider>ç©æä¿¡æ¯</Divider> |
| | | <div class="mx-4"> |
| | | <LineList :form-type="formType" :issue-id="formData.id" /> |
| | | </div> |
| | | </template> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Popconfirm |
| | | v-if="canSubmit" |
| | | title="确认æäº¤è¯¥å¤ååæåï¼ãæäº¤åå°ä¸è½ä¿®æ¹ã" |
| | | @confirm="handleSubmit" |
| | | > |
| | | <Button type="primary">æäº¤</Button> |
| | | </Popconfirm> |
| | | <Popconfirm |
| | | v-if="isStock" |
| | | title="确认æ§è¡æ£è´§ï¼" |
| | | @confirm="handleStock" |
| | | > |
| | | <Button type="primary">æ§è¡æ£è´§</Button> |
| | | </Popconfirm> |
| | | <Popconfirm |
| | | v-if="isFinish" |
| | | title="确认æ§è¡é¢åºï¼æ§è¡åå°æ£ååºåï¼ä¸æ æ³æ¤éã" |
| | | @confirm="handleFinish" |
| | | > |
| | | <Button type="primary">æ§è¡é¢åº</Button> |
| | | </Popconfirm> |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmOutsourceIssueLineApi } from '#/api/mes/wm/outsourceissue/line'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createOutsourceIssueLine, |
| | | getOutsourceIssueLine, |
| | | updateOutsourceIssueLine, |
| | | } from '#/api/mes/wm/outsourceissue/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formData = ref<MesWmOutsourceIssueLineApi.OutsourceIssueLine>(); |
| | | const issueId = ref<number>(); // æå±åæåç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['ç©æåæåè¡']) |
| | | : $t('ui.actionTitle.create', ['ç©æåæåè¡']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useLineFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmOutsourceIssueLineApi.OutsourceIssueLine; |
| | | data.issueId = issueId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateOutsourceIssueLine({ ...data, id: formData.value.id }) |
| | | : createOutsourceIssueLine(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | id?: number; |
| | | issueId: number; |
| | | }>(); |
| | | issueId.value = data.issueId; |
| | | if (!data.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getOutsourceIssueLine(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmOutsourceIssueDetailApi } from '#/api/mes/wm/outsourceissue/detail'; |
| | | import type { MesWmOutsourceIssueLineApi } from '#/api/mes/wm/outsourceissue/line'; |
| | | |
| | | import { computed, reactive } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getOutsourceIssueDetailListByLineId } from '#/api/mes/wm/outsourceissue/detail'; |
| | | import { |
| | | deleteOutsourceIssueLine, |
| | | getOutsourceIssueLinePage, |
| | | } from '#/api/mes/wm/outsourceissue/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | | import DetailList from './detail-list.vue'; |
| | | import LineForm from './line-form.vue'; |
| | | |
| | | const props = defineProps<{ |
| | | formType: FormType; |
| | | issueId: number; |
| | | }>(); |
| | | |
| | | const isEditable = computed(() => |
| | | // æ¯å¦å¯ç¼è¾æç»è¡ |
| | | ['create', 'update'].includes(props.formType), |
| | | ); |
| | | const isStock = computed(() => props.formType === 'stock'); // æ¯å¦ä¸ºæ£è´§æ¨¡å¼ |
| | | const detailMap = reactive< |
| | | Record<number, MesWmOutsourceIssueDetailApi.OutsourceIssueDetail[]> |
| | | >({}); // å·²å±å¼è¡çåææç»ç¼å |
| | | |
| | | const [LineFormModal, lineFormModalApi] = useVbenModal({ |
| | | connectedComponent: LineForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [DetailFormModal, detailFormModalApi] = useVbenModal({ |
| | | connectedComponent: DetailForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | for (const id of Object.keys(detailMap)) { |
| | | delete detailMap[Number(id)]; |
| | | } |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** æ·»å ç©æ */ |
| | | function handleCreate() { |
| | | lineFormModalApi.setData({ issueId: props.issueId }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾ç©æ */ |
| | | function handleEdit(row: MesWmOutsourceIssueLineApi.OutsourceIssueLine) { |
| | | lineFormModalApi.setData({ id: row.id, issueId: props.issueId }).open(); |
| | | } |
| | | |
| | | /** å é¤ç©æ */ |
| | | async function handleDelete( |
| | | row: MesWmOutsourceIssueLineApi.OutsourceIssueLine, |
| | | ) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.itemName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteOutsourceIssueLine(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.itemName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** æ£è´§ï¼ç´æ¥æå¼æç»å建表å */ |
| | | function handlePicking(row: MesWmOutsourceIssueLineApi.OutsourceIssueLine) { |
| | | openDetailForm(row.id!, row.itemId); |
| | | } |
| | | |
| | | /** æå¼åææç»è¡¨å */ |
| | | function openDetailForm(lineId: number, itemId?: number, detailId?: number) { |
| | | detailFormModalApi |
| | | .setData({ detailId, issueId: props.issueId, itemId, lineId }) |
| | | .open(); |
| | | } |
| | | |
| | | /** è·åå·²å±å¼è¡çåææç» */ |
| | | function getExpandedDetails( |
| | | row: MesWmOutsourceIssueLineApi.OutsourceIssueLine, |
| | | ) { |
| | | return detailMap[row.id!] || []; |
| | | } |
| | | |
| | | /** å è½½æå®è¡çåææç» */ |
| | | async function loadLineDetails(lineId: number) { |
| | | detailMap[lineId] = await getOutsourceIssueDetailListByLineId(lineId); |
| | | } |
| | | |
| | | /** å±å¼è¡æ¶æå è½½åææç» */ |
| | | async function handleExpandChange( |
| | | row: MesWmOutsourceIssueLineApi.OutsourceIssueLine, |
| | | expanded: boolean, |
| | | ) { |
| | | if (!expanded) { |
| | | return; |
| | | } |
| | | await loadLineDetails(row.id!); |
| | | } |
| | | |
| | | /** æç»è¡¨åæäº¤æååï¼å·æ°å¯¹åºè¡å·²å±å¼çæç» */ |
| | | async function handleDetailSuccess(lineId: number) { |
| | | await loadLineDetails(lineId); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | gridOptions: { |
| | | columns: useLineGridColumns(isEditable.value, isStock.value), |
| | | expandConfig: { |
| | | padding: true, |
| | | }, |
| | | height: 400, |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }) => { |
| | | if (!props.issueId) { |
| | | return { list: [], total: 0 }; |
| | | } |
| | | return await getOutsourceIssueLinePage({ |
| | | issueId: props.issueId, |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmOutsourceIssueLineApi.OutsourceIssueLine>, |
| | | gridEvents: { |
| | | toggleRowExpand: ({ |
| | | expanded, |
| | | row, |
| | | }: { |
| | | expanded: boolean; |
| | | row: MesWmOutsourceIssueLineApi.OutsourceIssueLine; |
| | | }) => { |
| | | handleExpandChange(row, expanded); |
| | | }, |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <LineFormModal @success="handleRefresh" /> |
| | | <DetailFormModal @success="handleDetailSuccess" /> |
| | | <Grid table-title="ç©æä¿¡æ¯"> |
| | | <template v-if="isEditable" #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: 'æ·»å ç©æ', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #detail="{ row }"> |
| | | <DetailList |
| | | :details="getExpandedDetails(row)" |
| | | :form-type="formType" |
| | | @edit="(detailId) => openDetailForm(row.id!, row.itemId, detailId)" |
| | | @refresh="loadLineDetails(row.id!)" |
| | | /> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | ifShow: isEditable, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | ifShow: isEditable, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.itemName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ£è´§', |
| | | type: 'link', |
| | | ifShow: isStock, |
| | | onClick: handlePicking.bind(null, row), |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </div> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | | import type { MesWmOutsourceReceiptApi } from '#/api/mes/wm/outsourcereceipt'; |
| | | import type { MesWmOutsourceReceiptDetailApi } from '#/api/mes/wm/outsourcereceipt/detail'; |
| | | import type { MesWmOutsourceReceiptLineApi } from '#/api/mes/wm/outsourcereceipt/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProWorkOrderStatusEnum, |
| | | MesProWorkOrderTypeEnum, |
| | | } from '../../../packages/constants/src'; |
| | | import { getDictOptions } from '../../../packages/effects/hooks/src'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | | WmWarehouseSelect, |
| | | } from '#/views/wls/warehouse/components'; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'finish' | 'stock' | 'update'; |
| | | |
| | | /** 表å头鍿¯å¦åªè¯»ï¼ä¸æ¶ã详æ
ã宿æï¼ */ |
| | | function isHeaderReadonly(formType: FormType): boolean { |
| | | return formType === 'detail' || formType === 'finish' || formType === 'stock'; |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: 'å
¥åºåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å
¥åºåç¼å·', |
| | | }, |
| | | rules: 'required', |
| | | suffix: isHeaderReadonly(formType) |
| | | ? undefined |
| | | : () => |
| | | h( |
| | | Button, |
| | | { |
| | | type: 'default', |
| | | onClick: async () => { |
| | | const code = await generateAutoCode( |
| | | MesAutoCodeRuleCode.WM_OUTSOURCE_RECEIPT_CODE, |
| | | ); |
| | | await formApi?.setFieldValue('code', code); |
| | | }, |
| | | }, |
| | | { default: () => 'çæ' }, |
| | | ), |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'å
¥åºååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å
¥åºååç§°', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: 'å¤å订å', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | componentProps: { |
| | | // éæ©å¤å订ååï¼èªå¨åå¡«ä¾åºå |
| | | onChange: async (workOrder?: MesProWorkOrderApi.WorkOrder) => { |
| | | await formApi?.setFieldValue('vendorId', workOrder?.vendorId); |
| | | }, |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | type: MesProWorkOrderTypeEnum.OUTSOURCE, |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | label: 'ä¾åºå', |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'receiptDate', |
| | | label: 'å
¥åºæ¥æ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©å
¥åºæ¥æ', |
| | | valueFormat: 'x', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'å
¥åºåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥å
¥åºåç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'å
¥åºååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥å
¥åºååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workOrderCode', |
| | | label: 'å¤å订åå·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥å¤å订åå·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | label: 'ä¾åºå', |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'ç¶æ', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions( |
| | | DICT_TYPE.MES_WM_OUTSOURCE_RECEIPT_STATUS, |
| | | 'number', |
| | | ), |
| | | placeholder: 'è¯·éæ©åæ®ç¶æ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'receiptDate', |
| | | label: 'å
¥åºæ¥æ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesWmOutsourceReceiptApi.OutsourceReceipt>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: 'å
¥åºåç¼å·', |
| | | minWidth: 160, |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: 'å
¥åºååç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'workOrderCode', |
| | | title: 'å¤å订åå·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'vendorName', |
| | | title: 'ä¾åºååç§°', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'receiptDate', |
| | | title: 'å
¥åºæ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_OUTSOURCE_RECEIPT_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å
¥åºåè¡å表çåæ®µ */ |
| | | export function useLineGridColumns( |
| | | editable: boolean, |
| | | stockable: boolean, |
| | | ): VxeTableGridOptions<MesWmOutsourceReceiptLineApi.OutsourceReceiptLine>['columns'] { |
| | | return [ |
| | | { |
| | | type: 'expand', |
| | | width: 48, |
| | | slots: { content: 'detail' }, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: 'ç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'ç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'å
¥åºæ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'batchCode', |
| | | title: 'æ¹æ¬¡å·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'iqcCheckFlag', |
| | | title: 'æ¯å¦æ£éª', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'qualityStatus', |
| | | title: 'è´¨éç¶æ', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_QUALITY_STATUS }, |
| | | }, |
| | | }, |
| | | ...(editable || stockable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 180, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** å
¥åºåè¡æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useLineFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç©æ', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'å
¥åºæ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥å
¥åºæ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: 'ç³»ç»èªå¨çæ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'productionDate', |
| | | label: 'çäº§æ¥æ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©çäº§æ¥æ', |
| | | valueFormat: 'x', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'expireDate', |
| | | label: 'æææ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©æææ', |
| | | valueFormat: 'x', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'lotNumber', |
| | | label: 'æ¹å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥æ¹å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'iqcCheckFlag', |
| | | label: 'æ¯å¦è´¨æ£', |
| | | component: 'Switch', |
| | | rules: z.boolean().default(false), |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å
¥åºæç»å表çåæ®µ */ |
| | | export function useDetailGridColumns( |
| | | editable: boolean, |
| | | ): VxeTableGridOptions<MesWmOutsourceReceiptDetailApi.OutsourceReceiptDetail>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'warehouseName', |
| | | title: 'ä»åºåç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'locationName', |
| | | title: 'åºåºåç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'areaName', |
| | | title: 'åºä½åç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'æ°é', |
| | | width: 100, |
| | | }, |
| | | ...(editable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 120, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** å
¥åºæç»æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useDetailFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥æ¹æ¬¡å·', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'å
¥åºä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | // 忢ä»åºåæ¸
空åºåºååºä½ |
| | | onChange: async () => { |
| | | await formApi?.setValues({ |
| | | areaId: undefined, |
| | | locationId: undefined, |
| | | }); |
| | | }, |
| | | placeholder: 'è¯·éæ©ä»åº', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: 'åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | // 忢åºåºåæ¸
空åºä½ |
| | | onChange: async () => { |
| | | await formApi?.setFieldValue('areaId', undefined); |
| | | }, |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | warehouseId: values.warehouseId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaId', |
| | | label: 'åºä½', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åºä½', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['locationId'], |
| | | componentProps: (values) => ({ |
| | | locationId: values.locationId, |
| | | placeholder: 'è¯·éæ©åºä½', |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'æ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥æ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-2', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmOutsourceReceiptApi } from '#/api/mes/wm/outsourcereceipt'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { MesWmOutsourceReceiptStatusEnum } from '../../../packages/constants/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | cancelOutsourceReceipt, |
| | | deleteOutsourceReceipt, |
| | | exportOutsourceReceipt, |
| | | getOutsourceReceiptPage, |
| | | } from '#/api/mes/wm/outsourcereceipt'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建å¤åå
¥åºå */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ¥çå¤åå
¥åºå */ |
| | | function handleDetail(row: MesWmOutsourceReceiptApi.OutsourceReceipt) { |
| | | formModalApi.setData({ formType: 'detail', id: row.id }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾å¤åå
¥åºå */ |
| | | function handleEdit(row: MesWmOutsourceReceiptApi.OutsourceReceipt) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ */ |
| | | function handleStock(row: MesWmOutsourceReceiptApi.OutsourceReceipt) { |
| | | formModalApi.setData({ formType: 'stock', id: row.id }).open(); |
| | | } |
| | | |
| | | /** 宿å
¥åº */ |
| | | function handleFinish(row: MesWmOutsourceReceiptApi.OutsourceReceipt) { |
| | | formModalApi.setData({ formType: 'finish', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å é¤å¤åå
¥åºå */ |
| | | async function handleDelete(row: MesWmOutsourceReceiptApi.OutsourceReceipt) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.code]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteOutsourceReceipt(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** åæ¶å¤åå
¥åºå */ |
| | | async function handleCancel(row: MesWmOutsourceReceiptApi.OutsourceReceipt) { |
| | | await cancelOutsourceReceipt(row.id!); |
| | | message.success('åæ¶æå'); |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportOutsourceReceipt(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: 'å¤åå
¥åºå.xls', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getOutsourceReceiptPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmOutsourceReceiptApi.OutsourceReceipt>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="å¤åå
¥åºåå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['å¤åå
¥åºå']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-outsource-receipt:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:wm-outsource-receipt:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-outsource-receipt:update'], |
| | | ifShow: row.status === MesWmOutsourceReceiptStatusEnum.PREPARE, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-outsource-receipt:delete'], |
| | | ifShow: row.status === MesWmOutsourceReceiptStatusEnum.PREPARE, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.code]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ§è¡ä¸æ¶', |
| | | type: 'link', |
| | | auth: ['mes:wm-outsource-receipt:update'], |
| | | ifShow: row.status === MesWmOutsourceReceiptStatusEnum.APPROVING, |
| | | onClick: handleStock.bind(null, row), |
| | | }, |
| | | { |
| | | label: '宿å
¥åº', |
| | | type: 'link', |
| | | auth: ['mes:wm-outsource-receipt:finish'], |
| | | ifShow: row.status === MesWmOutsourceReceiptStatusEnum.APPROVED, |
| | | onClick: handleFinish.bind(null, row), |
| | | }, |
| | | { |
| | | label: 'åæ¶', |
| | | type: 'link', |
| | | danger: true, |
| | | auth: ['mes:wm-outsource-receipt:update'], |
| | | ifShow: |
| | | row.status === MesWmOutsourceReceiptStatusEnum.APPROVING || |
| | | row.status === MesWmOutsourceReceiptStatusEnum.APPROVED, |
| | | popConfirm: { |
| | | title: 'ç¡®è®¤åæ¶è¯¥å¤åå
¥åºåï¼åæ¶åä¸å¯æ¢å¤ã', |
| | | confirm: handleCancel.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmOutsourceReceiptDetailApi } from '#/api/mes/wm/outsourcereceipt/detail'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createOutsourceReceiptDetail, |
| | | getOutsourceReceiptDetail, |
| | | updateOutsourceReceiptDetail, |
| | | } from '#/api/mes/wm/outsourcereceipt/detail'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useDetailFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits<{ success: [lineId: number] }>(); |
| | | const formData = ref<MesWmOutsourceReceiptDetailApi.OutsourceReceiptDetail>(); |
| | | const receiptId = ref<number>(); // æå±å
¥åºåç¼å· |
| | | const lineId = ref<number>(); // æå±å
¥åºåè¡ç¼å· |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['æ¶è´§æç»']) |
| | | : $t('ui.actionTitle.create', ['æ¶è´§æç»']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useDetailFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-2', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmOutsourceReceiptDetailApi.OutsourceReceiptDetail; |
| | | data.receiptId = receiptId.value; |
| | | data.lineId = lineId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateOutsourceReceiptDetail({ ...data, id: formData.value.id }) |
| | | : createOutsourceReceiptDetail(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success', lineId.value!); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | formApi.setState({ schema: useDetailFormSchema(formApi) }); |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | detailId?: number; |
| | | itemId?: number; |
| | | lineId: number; |
| | | receiptId: number; |
| | | }>(); |
| | | receiptId.value = data.receiptId; |
| | | lineId.value = data.lineId; |
| | | if (data.detailId) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getOutsourceReceiptDetail(data.detailId); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } else if (data.itemId) { |
| | | await formApi.setFieldValue('itemId', data.itemId); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-1/2"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
copy from src/views/mes/wm/outsourcereceipt/modules/detail-list.vue
copy to src/views/wls/outsourcereceipt/modules/detail-list.vue
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { MesWmOutsourceReceiptApi } from '#/api/mes/wm/outsourcereceipt'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { MesWmOutsourceReceiptStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createOutsourceReceipt, |
| | | finishOutsourceReceipt, |
| | | getOutsourceReceipt, |
| | | stockOutsourceReceipt, |
| | | submitOutsourceReceipt, |
| | | updateOutsourceReceipt, |
| | | } from '#/api/mes/wm/outsourcereceipt'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import LineList from './line-list.vue'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesWmOutsourceReceiptApi.OutsourceReceipt>(); |
| | | const originalSnapshot = ref(''); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äºæäº¤æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | const isEditable = computed(() => |
| | | // æ¯å¦ä¸ºç¼è¾æ¨¡å¼ï¼å¯ä¿åï¼ |
| | | ['create', 'update'].includes(formType.value), |
| | | ); |
| | | const isStock = computed(() => formType.value === 'stock'); // æ¯å¦ä¸ºä¸æ¶æ¨¡å¼ |
| | | const isFinish = computed(() => formType.value === 'finish'); // æ¯å¦ä¸ºå®æå
¥åºæ¨¡å¼ |
| | | const canSubmit = computed( |
| | | () => |
| | | // æ¯å¦å¯æäº¤ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmOutsourceReceiptStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.view', ['å¤åå
¥åºå']); |
| | | } |
| | | if (formType.value === 'stock') { |
| | | return 'æ§è¡ä¸æ¶'; |
| | | } |
| | | if (formType.value === 'finish') { |
| | | return '宿å
¥åº'; |
| | | } |
| | | return formType.value === 'update' |
| | | ? $t('ui.actionTitle.edit', ['å¤åå
¥åºå']) |
| | | : $t('ui.actionTitle.create', ['å¤åå
¥åºå']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | /** æäº¤å
¥åºåï¼è¡¨åæä¿®æ¹æ¶å
ä¿åï¼åè°ç¨æäº¤æ¥å£ */ |
| | | async function handleSubmit() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = |
| | | (await formApi.getValues()) as MesWmOutsourceReceiptApi.OutsourceReceipt; |
| | | await updateOutsourceReceipt({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | await submitOutsourceReceipt(formData.value.id); |
| | | message.success('æäº¤æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ */ |
| | | async function handleStock() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await stockOutsourceReceipt(formData.value.id); |
| | | message.success('䏿¶æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** 宿å
¥åº */ |
| | | async function handleFinish() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await finishOutsourceReceipt(formData.value.id); |
| | | message.success('å
¥åºæå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (!isEditable.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmOutsourceReceiptApi.OutsourceReceipt; |
| | | try { |
| | | if (formData.value?.id) { |
| | | await updateOutsourceReceipt({ ...formData.value, ...data }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createOutsourceReceipt(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesWmOutsourceReceiptStatusEnum.PREPARE, |
| | | }; |
| | | await formApi.setFieldValue('id', id); |
| | | await formApi.setFieldValue('status', formData.value.status); |
| | | formType.value = 'update'; |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ''; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | formApi.setDisabled(!isEditable.value); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | | if (data?.id) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getOutsourceReceipt(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | <!-- éæ°å»ºæ¨¡å¼å±ç¤ºç©æä¿¡æ¯ --> |
| | | <template v-if="formData?.id"> |
| | | <Divider>ç©æä¿¡æ¯</Divider> |
| | | <div class="mx-4"> |
| | | <LineList :form-type="formType" :receipt-id="formData.id" /> |
| | | </div> |
| | | </template> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Popconfirm |
| | | v-if="canSubmit" |
| | | title="确认æäº¤è¯¥å¤åå
¥åºåï¼ãæäº¤åå°ä¸è½ä¿®æ¹ã" |
| | | @confirm="handleSubmit" |
| | | > |
| | | <Button type="primary">æäº¤</Button> |
| | | </Popconfirm> |
| | | <Popconfirm |
| | | v-if="isStock" |
| | | title="确认æ§è¡ä¸æ¶ï¼" |
| | | @confirm="handleStock" |
| | | > |
| | | <Button type="primary">æ§è¡ä¸æ¶</Button> |
| | | </Popconfirm> |
| | | <Popconfirm |
| | | v-if="isFinish" |
| | | title="ç¡®è®¤å®æå
¥åºï¼å®æåå°æ´æ°åºåå°è´¦ã" |
| | | @confirm="handleFinish" |
| | | > |
| | | <Button type="primary">宿å
¥åº</Button> |
| | | </Popconfirm> |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmOutsourceReceiptLineApi } from '#/api/mes/wm/outsourcereceipt/line'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createOutsourceReceiptLine, |
| | | getOutsourceReceiptLine, |
| | | updateOutsourceReceiptLine, |
| | | } from '#/api/mes/wm/outsourcereceipt/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formData = ref<MesWmOutsourceReceiptLineApi.OutsourceReceiptLine>(); |
| | | const receiptId = ref<number>(); // æå±å
¥åºåç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['å¤åå
¥åºåè¡']) |
| | | : $t('ui.actionTitle.create', ['å¤åå
¥åºåè¡']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useLineFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨åï¼æ¹æ¬¡å·ç±å端èªå¨çæï¼ä¸æäº¤ï¼ |
| | | const data = |
| | | (await formApi.getValues()) as MesWmOutsourceReceiptLineApi.OutsourceReceiptLine; |
| | | data.receiptId = receiptId.value; |
| | | delete data.batchCode; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateOutsourceReceiptLine({ ...data, id: formData.value.id }) |
| | | : createOutsourceReceiptLine(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | id?: number; |
| | | receiptId: number; |
| | | }>(); |
| | | receiptId.value = data.receiptId; |
| | | if (!data.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getOutsourceReceiptLine(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmOutsourceReceiptDetailApi } from '#/api/mes/wm/outsourcereceipt/detail'; |
| | | import type { MesWmOutsourceReceiptLineApi } from '#/api/mes/wm/outsourcereceipt/line'; |
| | | |
| | | import { computed, reactive } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getOutsourceReceiptDetailListByLineId } from '#/api/mes/wm/outsourcereceipt/detail'; |
| | | import { |
| | | deleteOutsourceReceiptLine, |
| | | getOutsourceReceiptLinePage, |
| | | } from '#/api/mes/wm/outsourcereceipt/line'; |
| | | import { $t } from '#/locales'; |
| | | import { PrinterLabel } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | | import DetailList from './detail-list.vue'; |
| | | import LineForm from './line-form.vue'; |
| | | |
| | | const props = defineProps<{ |
| | | formType: FormType; |
| | | receiptId: number; |
| | | }>(); |
| | | |
| | | const isEditable = computed(() => |
| | | // æ¯å¦å¯ç¼è¾æç»è¡ |
| | | ['create', 'update'].includes(props.formType), |
| | | ); |
| | | const isStock = computed(() => props.formType === 'stock'); // æ¯å¦ä¸ºä¸æ¶æ¨¡å¼ |
| | | const detailMap = reactive< |
| | | Record<number, MesWmOutsourceReceiptDetailApi.OutsourceReceiptDetail[]> |
| | | >({}); // å·²å±å¼è¡çæ¶è´§æç»ç¼å |
| | | |
| | | const [LineFormModal, lineFormModalApi] = useVbenModal({ |
| | | connectedComponent: LineForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [DetailFormModal, detailFormModalApi] = useVbenModal({ |
| | | connectedComponent: DetailForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | for (const id of Object.keys(detailMap)) { |
| | | delete detailMap[Number(id)]; |
| | | } |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** æ·»å ç©æ */ |
| | | function handleCreate() { |
| | | lineFormModalApi.setData({ receiptId: props.receiptId }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾ç©æ */ |
| | | function handleEdit(row: MesWmOutsourceReceiptLineApi.OutsourceReceiptLine) { |
| | | lineFormModalApi.setData({ id: row.id, receiptId: props.receiptId }).open(); |
| | | } |
| | | |
| | | /** å é¤ç©æ */ |
| | | async function handleDelete( |
| | | row: MesWmOutsourceReceiptLineApi.OutsourceReceiptLine, |
| | | ) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.itemName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteOutsourceReceiptLine(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.itemName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 䏿¶ï¼ç´æ¥æå¼æç»å建表å */ |
| | | function handlePicking(row: MesWmOutsourceReceiptLineApi.OutsourceReceiptLine) { |
| | | openDetailForm(row.id!, row.itemId); |
| | | } |
| | | |
| | | /** æå¼æ¶è´§æç»è¡¨å */ |
| | | function openDetailForm(lineId: number, itemId?: number, detailId?: number) { |
| | | detailFormModalApi |
| | | .setData({ detailId, itemId, lineId, receiptId: props.receiptId }) |
| | | .open(); |
| | | } |
| | | |
| | | /** è·åå·²å±å¼è¡çæ¶è´§æç» */ |
| | | function getExpandedDetails( |
| | | row: MesWmOutsourceReceiptLineApi.OutsourceReceiptLine, |
| | | ) { |
| | | return detailMap[row.id!] || []; |
| | | } |
| | | |
| | | /** å è½½æå®è¡çæ¶è´§æç» */ |
| | | async function loadLineDetails(lineId: number) { |
| | | detailMap[lineId] = await getOutsourceReceiptDetailListByLineId(lineId); |
| | | } |
| | | |
| | | /** å±å¼è¡æ¶æå è½½æ¶è´§æç» */ |
| | | async function handleExpandChange( |
| | | row: MesWmOutsourceReceiptLineApi.OutsourceReceiptLine, |
| | | expanded: boolean, |
| | | ) { |
| | | if (!expanded) { |
| | | return; |
| | | } |
| | | await loadLineDetails(row.id!); |
| | | } |
| | | |
| | | /** æç»è¡¨åæäº¤æååï¼å·æ°å¯¹åºè¡å·²å±å¼çæç» */ |
| | | async function handleDetailSuccess(lineId: number) { |
| | | await loadLineDetails(lineId); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | gridOptions: { |
| | | columns: useLineGridColumns(isEditable.value, isStock.value), |
| | | expandConfig: { |
| | | padding: true, |
| | | }, |
| | | height: 400, |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }) => { |
| | | if (!props.receiptId) { |
| | | return { list: [], total: 0 }; |
| | | } |
| | | return await getOutsourceReceiptLinePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | receiptId: props.receiptId, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmOutsourceReceiptLineApi.OutsourceReceiptLine>, |
| | | gridEvents: { |
| | | toggleRowExpand: ({ |
| | | expanded, |
| | | row, |
| | | }: { |
| | | expanded: boolean; |
| | | row: MesWmOutsourceReceiptLineApi.OutsourceReceiptLine; |
| | | }) => { |
| | | handleExpandChange(row, expanded); |
| | | }, |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <LineFormModal @success="handleRefresh" /> |
| | | <DetailFormModal @success="handleDetailSuccess" /> |
| | | <Grid table-title="ç©æä¿¡æ¯"> |
| | | <template v-if="isEditable" #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: 'æ·»å ç©æ', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #detail="{ row }"> |
| | | <DetailList |
| | | :details="getExpandedDetails(row)" |
| | | :form-type="formType" |
| | | @edit="(detailId) => openDetailForm(row.id!, row.itemId, detailId)" |
| | | @refresh="loadLineDetails(row.id!)" |
| | | /> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <div class="flex items-center justify-center"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | ifShow: isEditable, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | ifShow: isEditable, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.itemName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: '䏿¶', |
| | | type: 'link', |
| | | ifShow: isStock, |
| | | onClick: handlePicking.bind(null, row), |
| | | }, |
| | | ]" |
| | | /> |
| | | <PrinterLabel |
| | | v-if="isStock" |
| | | :biz-code="row.batchCode" |
| | | :biz-id="row.batchId" |
| | | biz-type="BATCH" |
| | | /> |
| | | </div> |
| | | </template> |
| | | </Grid> |
| | | </div> |
| | | </template> |
copy from src/views/mes/wm/packages/components/index.ts
copy to src/views/wls/packages/components/index.ts
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmPackageApi } from '#/api/mes/wm/packages'; |
| | | |
| | | import { nextTick, ref } from 'vue'; |
| | | |
| | | import { MesWmPackageStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { Alert, Button, message, Modal } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getPackagePage } from '#/api/mes/wm/packages'; |
| | | |
| | | import { useSelectGridColumns, useSelectGridFormSchema } from '../data'; |
| | | |
| | | const props = withDefaults( |
| | | defineProps<{ |
| | | childableOnly?: boolean; // åªå±ç¤ºå¯ä½ä¸ºåç®±çè£
ç®±åï¼æ ç¶ç®± + å·²å®æç¶æï¼ |
| | | excludeId?: number; // æé¤çç¼å·ï¼é¿å
éæ©èªå·±ä½ä¸ºç¶ç®±ï¼ |
| | | }>(), |
| | | { |
| | | childableOnly: false, |
| | | excludeId: undefined, |
| | | }, |
| | | ); |
| | | |
| | | const emit = defineEmits<{ |
| | | selected: [rows: MesWmPackageApi.Package[]]; |
| | | }>(); |
| | | |
| | | const open = ref(false); // å¼¹çªæ¯å¦æå¼ |
| | | const multiple = ref(true); // æ¯å¦å¤é |
| | | const selectedRows = ref<MesWmPackageApi.Package[]>([]); // å·²éè£
ç®±å |
| | | const preSelectedIds = ref<number[]>([]); // é¢éè£
ç®±åç¼å· |
| | | |
| | | /** è·åå¤éè®°å½ï¼å
å« VXE reserve è·¨é¡µè®°å½ */ |
| | | function getMultipleSelectedRows() { |
| | | const selectedMap = new Map<number, MesWmPackageApi.Package>(); |
| | | const records = [ |
| | | ...(gridApi.grid.getCheckboxReserveRecords?.() ?? []), |
| | | ...(gridApi.grid.getCheckboxRecords?.() ?? []), |
| | | ] as MesWmPackageApi.Package[]; |
| | | records.forEach((row) => { |
| | | if (row.id !== undefined && row.id !== null) { |
| | | selectedMap.set(row.id, row); |
| | | } |
| | | }); |
| | | return [...selectedMap.values()]; |
| | | } |
| | | |
| | | /** å¤çå¾éåå */ |
| | | function handleCheckboxSelectChange() { |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | |
| | | /** å¤çåéåå */ |
| | | function handleRadioChange(row: MesWmPackageApi.Package) { |
| | | selectedRows.value = [row]; |
| | | } |
| | | |
| | | /** å¤é模å¼ä¸åæ¢è¡å¾é */ |
| | | async function toggleMultipleRow(row: MesWmPackageApi.Package) { |
| | | const selected = gridApi.grid.isCheckedByCheckboxRow(row); |
| | | await gridApi.grid.setCheckboxRow(row, !selected); |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | |
| | | /** å¤çè¡åå»ï¼åéç´æ¥ç¡®è®¤ï¼å¤é忢å¾é */ |
| | | async function handleCellDblclick({ row }: { row: MesWmPackageApi.Package }) { |
| | | if (multiple.value) { |
| | | await toggleMultipleRow(row); |
| | | return; |
| | | } |
| | | selectedRows.value = [row]; |
| | | await gridApi.grid.setRadioRow(row); |
| | | handleConfirm(); |
| | | } |
| | | |
| | | /** åæ¾é¢éè£
ç®±å */ |
| | | async function applyPreSelection() { |
| | | if (preSelectedIds.value.length === 0) { |
| | | return; |
| | | } |
| | | const rows = gridApi.grid.getData() as MesWmPackageApi.Package[]; |
| | | for (const row of rows) { |
| | | if ( |
| | | row.id === undefined || |
| | | row.id === null || |
| | | !preSelectedIds.value.includes(row.id) |
| | | ) { |
| | | continue; |
| | | } |
| | | if (multiple.value) { |
| | | await gridApi.grid.setCheckboxRow(row, true); |
| | | } else { |
| | | await gridApi.grid.setRadioRow(row); |
| | | selectedRows.value = [row]; |
| | | return; |
| | | } |
| | | } |
| | | if (multiple.value) { |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useSelectGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useSelectGridColumns(true), |
| | | height: 480, |
| | | keepSource: true, |
| | | checkboxConfig: { |
| | | highlight: true, |
| | | range: true, |
| | | reserve: true, |
| | | }, |
| | | radioConfig: { |
| | | highlight: true, |
| | | trigger: 'row', |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | const data = await getPackagePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | // childableOnly 模å¼ï¼åºå®è¿æ»¤æ ç¶ç®± + å·²å®æç¶æ |
| | | parentId: props.childableOnly ? 0 : undefined, |
| | | status: props.childableOnly |
| | | ? MesWmPackageStatusEnum.FINISHED |
| | | : undefined, |
| | | }); |
| | | // æé¤æå®ç¼å·ï¼é¿å
éæ©èªå·±ä½ä¸ºç¶ç®± |
| | | const list = props.excludeId |
| | | ? (data.list || []).filter((item) => item.id !== props.excludeId) |
| | | : data.list || []; |
| | | return { list, total: data.total }; |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmPackageApi.Package>, |
| | | gridEvents: { |
| | | cellDblclick: handleCellDblclick, |
| | | checkboxAll: handleCheckboxSelectChange, |
| | | checkboxChange: handleCheckboxSelectChange, |
| | | radioChange: ({ row }: { row: MesWmPackageApi.Package }) => { |
| | | handleRadioChange(row); |
| | | }, |
| | | }, |
| | | }); |
| | | |
| | | /** éç½®æ¥è¯¢åéæ©ç¶æ */ |
| | | async function resetQueryState() { |
| | | selectedRows.value = []; |
| | | await gridApi.grid.clearCheckboxRow(); |
| | | await gridApi.grid.clearCheckboxReserve(); |
| | | await gridApi.grid.clearRadioRow(); |
| | | await gridApi.formApi.resetForm(); |
| | | } |
| | | |
| | | /** æå¼è£
ç®±åéæ©å¼¹çª */ |
| | | async function openModal( |
| | | selectedIds?: number[], |
| | | options?: { multiple?: boolean }, |
| | | ) { |
| | | open.value = true; |
| | | multiple.value = options?.multiple ?? true; |
| | | preSelectedIds.value = selectedIds || []; |
| | | await nextTick(); |
| | | gridApi.setGridOptions({ |
| | | columns: useSelectGridColumns(multiple.value), |
| | | }); |
| | | await resetQueryState(); |
| | | await gridApi.query(); |
| | | await nextTick(); |
| | | await applyPreSelection(); |
| | | } |
| | | |
| | | /** å
³éå¼¹çª */ |
| | | function closeModal() { |
| | | open.value = false; |
| | | } |
| | | |
| | | /** ç¡®è®¤éæ© */ |
| | | function handleConfirm() { |
| | | const rows = multiple.value ? getMultipleSelectedRows() : selectedRows.value; |
| | | if (rows.length === 0) { |
| | | message.warning(multiple.value ? '请è³å°éæ©ä¸æ¡æ°æ®' : 'è¯·éæ©ä¸æ¡æ°æ®'); |
| | | return; |
| | | } |
| | | emit('selected', multiple.value ? rows : [rows[0]!]); |
| | | open.value = false; |
| | | } |
| | | |
| | | defineExpose({ open: openModal }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal |
| | | v-model:open="open" |
| | | :destroy-on-close="true" |
| | | title="è£
ç®±åéæ©" |
| | | width="80%" |
| | | @cancel="closeModal" |
| | | @ok="handleConfirm" |
| | | > |
| | | <Alert |
| | | v-if="childableOnly" |
| | | class="mb-3" |
| | | message="ä»
å±ç¤ºå¯ä½ä¸ºåç®±çè£
ç®±åï¼æ ç¶ç®± + 已宿ï¼" |
| | | show-icon |
| | | type="info" |
| | | /> |
| | | <Grid table-title="è£
ç®±åå表" /> |
| | | <template #footer> |
| | | <Button @click="closeModal">åæ¶</Button> |
| | | <Button type="primary" @click="handleConfirm">ç¡®å®</Button> |
| | | </template> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmPackageApi } from '#/api/mes/wm/packages'; |
| | | |
| | | import { computed, ref, useAttrs, watch } from 'vue'; |
| | | |
| | | import { IconifyIcon } from '../../../../packages/icons/src'; |
| | | |
| | | import { Input, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getPackage } from '#/api/mes/wm/packages'; |
| | | |
| | | import WmPackageSelectDialog from './select-dialog.vue'; |
| | | |
| | | defineOptions({ name: 'WmPackageSelect', inheritAttrs: false }); |
| | | |
| | | const props = withDefaults( |
| | | defineProps<{ |
| | | allowClear?: boolean; |
| | | childableOnly?: boolean; // åªå±ç¤ºå¯ä½ä¸ºåç®±çè£
ç®±åï¼æ ç¶ç®± + å·²å®æç¶æï¼ |
| | | disabled?: boolean; |
| | | excludeId?: number; // æé¤çç¼å·ï¼é¿å
éæ©èªå·±ä½ä¸ºç¶ç®±ï¼ |
| | | modelValue?: number; |
| | | placeholder?: string; |
| | | }>(), |
| | | { |
| | | allowClear: true, |
| | | childableOnly: false, |
| | | disabled: false, |
| | | excludeId: undefined, |
| | | modelValue: undefined, |
| | | placeholder: 'è¯·éæ©è£
ç®±å', |
| | | }, |
| | | ); |
| | | |
| | | const emit = defineEmits<{ |
| | | change: [item: MesWmPackageApi.Package | undefined]; |
| | | 'update:modelValue': [value: number | undefined]; |
| | | }>(); |
| | | |
| | | const attrs = useAttrs(); |
| | | const dialogRef = ref<InstanceType<typeof WmPackageSelectDialog>>(); |
| | | const hovering = ref(false); |
| | | const selectedItem = ref<MesWmPackageApi.Package>(); |
| | | |
| | | const displayLabel = computed(() => selectedItem.value?.code ?? ''); |
| | | |
| | | const showClear = computed( |
| | | () => |
| | | props.allowClear && |
| | | !props.disabled && |
| | | hovering.value && |
| | | props.modelValue !== null, |
| | | ); |
| | | |
| | | /** æ ¹æ®ç¼å·åæ¡æ¥è¯¢è£
ç®±åä¿¡æ¯ï¼ç¨äºç¼è¾åæ¾ï¼ */ |
| | | async function resolveItemById(id: number | undefined) { |
| | | if (!id) { |
| | | selectedItem.value = undefined; |
| | | return; |
| | | } |
| | | if (selectedItem.value?.id === id) { |
| | | return; |
| | | } |
| | | selectedItem.value = await getPackage(id); |
| | | } |
| | | |
| | | watch(() => props.modelValue, resolveItemById, { immediate: true }); |
| | | |
| | | /** æ¸
空已éè£
ç®±å */ |
| | | function clearSelected() { |
| | | selectedItem.value = undefined; |
| | | emit('update:modelValue', undefined); |
| | | emit('change', undefined); |
| | | } |
| | | |
| | | /** æå¼è£
ç®±åéæ©å¼¹çª */ |
| | | function handleClick(event: MouseEvent) { |
| | | if (props.disabled) { |
| | | return; |
| | | } |
| | | const target = event.target as HTMLElement; |
| | | if (showClear.value && target.closest('.ant-input-suffix')) { |
| | | event.stopPropagation(); |
| | | clearSelected(); |
| | | return; |
| | | } |
| | | const selectedIds = ( |
| | | props.modelValue === null ? [] : [props.modelValue] |
| | | ) as number[]; |
| | | dialogRef.value?.open(selectedIds, { multiple: false }); |
| | | } |
| | | |
| | | /** å¼¹çªéä¸åè° */ |
| | | function handleSelected(rows: MesWmPackageApi.Package[]) { |
| | | const item = rows[0]; |
| | | if (!item) { |
| | | return; |
| | | } |
| | | selectedItem.value = item; |
| | | emit('update:modelValue', item.id); |
| | | emit('change', item); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div |
| | | v-bind="attrs" |
| | | class="w-full" |
| | | :class="disabled ? 'cursor-not-allowed' : 'cursor-pointer'" |
| | | @click="handleClick" |
| | | @mouseenter="hovering = true" |
| | | @mouseleave="hovering = false" |
| | | > |
| | | <Tooltip :mouse-enter-delay="0.5" :open="selectedItem ? undefined : false"> |
| | | <template #title> |
| | | <div v-if="selectedItem" class="leading-6"> |
| | | <div>ç¼å·ï¼{{ selectedItem.code || '-' }}</div> |
| | | <div>客æ·ï¼{{ selectedItem.clientName || '-' }}</div> |
| | | <div>éå®è®¢åï¼{{ selectedItem.salesOrderCode || '-' }}</div> |
| | | </div> |
| | | </template> |
| | | <Input |
| | | :disabled="disabled" |
| | | :placeholder="placeholder" |
| | | :value="displayLabel" |
| | | readonly |
| | | > |
| | | <template #suffix> |
| | | <IconifyIcon |
| | | class="size-4" |
| | | :icon="showClear ? 'lucide:circle-x' : 'lucide:search'" |
| | | /> |
| | | </template> |
| | | </Input> |
| | | </Tooltip> |
| | | </div> |
| | | <WmPackageSelectDialog |
| | | ref="dialogRef" |
| | | :childable-only="childableOnly" |
| | | :exclude-id="excludeId" |
| | | @selected="handleSelected" |
| | | /> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmPackageApi } from '#/api/mes/wm/packages'; |
| | | import type { MesWmPackageLineApi } from '#/api/mes/wm/packages/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProWorkOrderStatusEnum, |
| | | } from '../../../packages/constants/src'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { MdClientSelect } from '#/views/mes/md/client/components'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdUnitMeasureSelect } from '#/views/mes/md/unitmeasure/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'update'; |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: 'è£
ç®±åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥è£
ç®±åç¼å·', |
| | | }, |
| | | rules: 'required', |
| | | suffix: |
| | | formType === 'detail' |
| | | ? undefined |
| | | : () => |
| | | h( |
| | | Button, |
| | | { |
| | | type: 'default', |
| | | onClick: async () => { |
| | | const code = await generateAutoCode( |
| | | MesAutoCodeRuleCode.WM_PACKAGE_CODE, |
| | | ); |
| | | await formApi?.setFieldValue('code', code); |
| | | }, |
| | | }, |
| | | { default: () => 'çæ' }, |
| | | ), |
| | | }, |
| | | { |
| | | fieldName: 'packageDate', |
| | | label: 'è£
ç®±æ¥æ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©è£
ç®±æ¥æ', |
| | | valueFormat: 'x', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'inspectorUserId', |
| | | label: 'æ£æ¥å', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | allowClear: true, |
| | | api: getSimpleUserList, |
| | | labelField: 'nickname', |
| | | placeholder: 'è¯·éæ©æ£æ¥å', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | label: 'éå®è®¢åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥éå®è®¢åç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'invoiceCode', |
| | | label: 'å票ç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å票ç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客æ·', |
| | | component: markRaw(MdClientSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©å®¢æ·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'sizeUnitId', |
| | | label: '尺寸åä½', |
| | | component: markRaw(MdUnitMeasureSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©å°ºå¯¸åä½', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'length', |
| | | label: 'ç®±é¿åº¦', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥ç®±é¿åº¦', |
| | | precision: 2, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'width', |
| | | label: '箱宽度', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥ç®±å®½åº¦', |
| | | precision: 2, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'height', |
| | | label: 'ç®±é«åº¦', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥ç®±é«åº¦', |
| | | precision: 2, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'weightUnitId', |
| | | label: 'ééåä½', |
| | | component: markRaw(MdUnitMeasureSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ééåä½', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'netWeight', |
| | | label: 'åé', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥åé', |
| | | precision: 2, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'grossWeight', |
| | | label: 'æ¯é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥æ¯é', |
| | | precision: 2, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'è£
ç®±åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥è£
ç®±åç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | label: 'éå®è®¢åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éå®è®¢åç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客æ·', |
| | | component: markRaw(MdClientSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©å®¢æ·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'inspectorUserId', |
| | | label: 'æ£æ¥å', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | allowClear: true, |
| | | api: getSimpleUserList, |
| | | labelField: 'nickname', |
| | | placeholder: 'è¯·éæ©æ£æ¥å', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesWmPackageApi.Package>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: 'è£
ç®±åç¼å·', |
| | | minWidth: 250, |
| | | fixed: 'left', |
| | | treeNode: true, |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'packageDate', |
| | | title: 'è£
ç®±æ¥æ', |
| | | width: 120, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'salesOrderCode', |
| | | title: 'éå®è®¢åç¼å·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'invoiceCode', |
| | | title: 'å票ç¼å·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'clientCode', |
| | | title: '客æ·ç¼ç ', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'clientName', |
| | | title: '客æ·åç§°', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'length', |
| | | title: 'ç®±é¿åº¦', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'width', |
| | | title: '箱宽度', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'height', |
| | | title: 'ç®±é«åº¦', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'sizeUnitName', |
| | | title: '尺寸åä½', |
| | | width: 90, |
| | | }, |
| | | { |
| | | field: 'netWeight', |
| | | title: 'åé', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'grossWeight', |
| | | title: 'æ¯é', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'weightUnitName', |
| | | title: 'ééåä½', |
| | | width: 90, |
| | | }, |
| | | { |
| | | field: 'inspectorName', |
| | | title: 'æ£æ¥å', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_PACKAGE_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 160, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** åç®±å表çåæ®µ */ |
| | | export function useSubPackageGridColumns(): VxeTableGridOptions<MesWmPackageApi.Package>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: 'è£
ç®±åç¼å·', |
| | | minWidth: 160, |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | field: 'packageDate', |
| | | title: 'è£
ç®±æ¥æ', |
| | | width: 120, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'salesOrderCode', |
| | | title: 'éå®è®¢åç¼å·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'invoiceCode', |
| | | title: 'å票ç¼å·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'clientCode', |
| | | title: '客æ·ç¼ç ', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'clientName', |
| | | title: '客æ·åç§°', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'netWeight', |
| | | title: 'åé', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'grossWeight', |
| | | title: 'æ¯é', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'weightUnitName', |
| | | title: 'ééåä½', |
| | | width: 90, |
| | | }, |
| | | { |
| | | field: 'inspectorName', |
| | | title: 'æ£æ¥å', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_PACKAGE_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 100, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** è£
ç®±æç»ç表å */ |
| | | export function useLineFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: 'ç产订å', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç产订å', |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '产åç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©äº§åç©æ', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'è£
ç®±æ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0.01, |
| | | placeholder: '请è¾å
¥è£
ç®±æ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'expireDate', |
| | | label: 'æææ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©æææ', |
| | | valueFormat: 'x', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-2', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** è£
ç®±æç»å表çåæ®µ */ |
| | | export function useLineGridColumns(): VxeTableGridOptions<MesWmPackageLineApi.PackageLine>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'itemCode', |
| | | title: '产åç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: '产åç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'è£
ç®±æ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'workOrderCode', |
| | | title: 'ç产订åç¼å·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'batchCode', |
| | | title: 'æ¹æ¬¡å·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'expireDate', |
| | | title: 'æææ', |
| | | width: 120, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 120, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 鿩弹çªçæç´¢è¡¨å */ |
| | | export function useSelectGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'è£
ç®±åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥è£
ç®±åç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | label: 'éå®è®¢åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éå®è®¢åç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客æ·', |
| | | component: markRaw(MdClientSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©å®¢æ·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'inspectorUserId', |
| | | label: 'æ£æ¥å', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | allowClear: true, |
| | | api: getSimpleUserList, |
| | | labelField: 'nickname', |
| | | placeholder: 'è¯·éæ©æ£æ¥å', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 鿩弹çªçåæ®µ */ |
| | | export function useSelectGridColumns( |
| | | multiple = true, |
| | | ): VxeTableGridOptions<MesWmPackageApi.Package>['columns'] { |
| | | return [ |
| | | { |
| | | type: multiple ? 'checkbox' : 'radio', |
| | | width: 50, |
| | | }, |
| | | { |
| | | field: 'code', |
| | | title: 'è£
ç®±åç¼å·', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'packageDate', |
| | | title: 'è£
ç®±æ¥æ', |
| | | width: 120, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'salesOrderCode', |
| | | title: 'éå®è®¢åç¼å·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'invoiceCode', |
| | | title: 'å票ç¼å·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'clientCode', |
| | | title: '客æ·ç¼ç ', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'clientName', |
| | | title: '客æ·åç§°', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'netWeight', |
| | | title: 'åé', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'grossWeight', |
| | | title: 'æ¯é', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'weightUnitName', |
| | | title: 'ééåä½', |
| | | width: 90, |
| | | }, |
| | | { |
| | | field: 'inspectorName', |
| | | title: 'æ£æ¥å', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_PACKAGE_STATUS }, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmPackageApi } from '#/api/mes/wm/packages'; |
| | | |
| | | import { ref } from 'vue'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { MesWmPackageStatusEnum } from '../../../packages/constants/src'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { deletePackage, getPackagePage } from '#/api/mes/wm/packages'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const isExpanded = ref(true); // æ å½¢è¡¨æ ¼æ¯å¦å±å¼ |
| | | |
| | | /** 忢æ å½¢å±å¼/æ¶ç¼©ç¶æ */ |
| | | function handleExpand() { |
| | | isExpanded.value = !isExpanded.value; |
| | | gridApi.grid.setAllTreeExpand(isExpanded.value); |
| | | } |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建è£
ç®±å */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ¥çè£
ç®±å */ |
| | | function handleDetail(row: MesWmPackageApi.Package) { |
| | | formModalApi.setData({ formType: 'detail', id: row.id }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾è£
ç®±å */ |
| | | function handleEdit(row: MesWmPackageApi.Package) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å é¤è£
ç®±å */ |
| | | async function handleDelete(row: MesWmPackageApi.Package) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.code]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deletePackage(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getPackagePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | treeConfig: { |
| | | parentField: 'parentId', |
| | | rowField: 'id', |
| | | transform: true, |
| | | expandAll: true, |
| | | reserve: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmPackageApi.Package>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="è£
ç®±åå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['è£
ç®±å']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-package:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: isExpanded ? 'æ¶ç¼©' : 'å±å¼', |
| | | type: 'primary', |
| | | onClick: handleExpand, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-package:update'], |
| | | ifShow: row.status === MesWmPackageStatusEnum.PREPARE, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-package:delete'], |
| | | ifShow: row.status === MesWmPackageStatusEnum.PREPARE, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.code]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { MesWmPackageApi } from '#/api/mes/wm/packages'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { confirm, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { MesWmPackageStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { Button, message, Tabs } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createPackage, |
| | | finishPackage, |
| | | getPackage, |
| | | updatePackage, |
| | | } from '#/api/mes/wm/packages'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import PackageLineList from './package-line-list.vue'; |
| | | import SubPackageList from './sub-package-list.vue'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesWmPackageApi.Package>(); |
| | | const subTabsName = ref('subPackage'); // å表å½å tab |
| | | const originalSnapshot = ref(''); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äº finish æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | |
| | | const isEditable = computed(() => |
| | | ['create', 'update'].includes(formType.value), |
| | | ); |
| | | const canFinish = computed( |
| | | () => |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmPackageStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.view', ['è£
ç®±å']); |
| | | } |
| | | return formType.value === 'update' |
| | | ? $t('ui.actionTitle.edit', ['è£
ç®±å']) |
| | | : $t('ui.actionTitle.create', ['è£
ç®±å']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | /** æäº¤è¡¨åï¼create/updateï¼ï¼æ°å¢æåååæ¢ä¸ºç¼è¾æä»¥ç»§ç»ç»´æ¤å表 */ |
| | | async function handleSubmit(): Promise<boolean> { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return false; |
| | | } |
| | | const data = (await formApi.getValues()) as MesWmPackageApi.Package; |
| | | if (formData.value?.id) { |
| | | await updatePackage({ ...data, id: formData.value.id }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createPackage(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesWmPackageStatusEnum.PREPARE, |
| | | }; |
| | | await formApi.setFieldValue('id', id); |
| | | await formApi.setFieldValue('status', MesWmPackageStatusEnum.PREPARE); |
| | | formType.value = 'update'; |
| | | } |
| | | // å·æ°å¿«ç
§ï¼ä¸æ¬¡ finish ç¨äºå¤ææ¯å¦éè¦åä¿å |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | return true; |
| | | } |
| | | |
| | | /** 宿è£
ç®±åï¼ç¼è¾ææä¿®æ¹æ¶å
ä¿åï¼åè°ç¨å®ææ¥å£ */ |
| | | async function handleFinish() { |
| | | const id = formData.value?.id; |
| | | if (!id) { |
| | | return; |
| | | } |
| | | try { |
| | | await confirm('ç¡®è®¤å®æè¯¥è£
ç®±åï¼å®æåå°ä¸å¯ç¼è¾ã'); |
| | | } catch { |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = (await formApi.getValues()) as MesWmPackageApi.Package; |
| | | await updatePackage({ ...data, id }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | await finishPackage(id); |
| | | message.success('宿æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (formType.value === 'detail') { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | // æäº¤è¡¨å |
| | | const ok = await handleSubmit(); |
| | | if (!ok) { |
| | | return; |
| | | } |
| | | // å
³éå¹¶æç¤º |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ''; |
| | | return; |
| | | } |
| | | subTabsName.value = 'subPackage'; |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | formApi.setDisabled(formType.value === 'detail'); |
| | | modalApi.setState({ showConfirmButton: formType.value !== 'detail' }); |
| | | if (data?.id) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getPackage(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | // è®°å½åå§å¿«ç
§ï¼åç» finish ç¨äºå¤ææ¯å¦éè¦åä¿å |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-4/5"> |
| | | <Form class="mx-4" /> |
| | | <Tabs |
| | | v-if="formData?.id" |
| | | v-model:active-key="subTabsName" |
| | | class="mx-4 mt-4" |
| | | > |
| | | <Tabs.TabPane key="subPackage" tab="åç®±"> |
| | | <SubPackageList :editable="isEditable" :package-id="formData.id" /> |
| | | </Tabs.TabPane> |
| | | <Tabs.TabPane key="packageLine" tab="è£
ç®±æ¸
å"> |
| | | <PackageLineList :editable="isEditable" :package-id="formData.id" /> |
| | | </Tabs.TabPane> |
| | | </Tabs> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Button v-if="canFinish" type="primary" @click="handleFinish"> |
| | | 宿 |
| | | </Button> |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmPackageLineApi } from '#/api/mes/wm/packages/line'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createPackageLine, |
| | | getPackageLine, |
| | | updatePackageLine, |
| | | } from '#/api/mes/wm/packages/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formData = ref<MesWmPackageLineApi.PackageLine>(); |
| | | const packageId = ref<number>(); // æå±è£
ç®±åç¼å· |
| | | const getTitle = computed(() => |
| | | formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['è£
ç®±æç»']) |
| | | : $t('ui.actionTitle.create', ['è£
ç®±æç»']), |
| | | ); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 100, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useLineFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-2', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesWmPackageLineApi.PackageLine; |
| | | data.packageId = packageId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updatePackageLine({ ...data, id: formData.value.id }) |
| | | : createPackageLine(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ id?: number; packageId: number }>(); |
| | | packageId.value = data.packageId; |
| | | if (!data.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getPackageLine(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-2/5"> |
| | | <Form /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmPackageLineApi } from '#/api/mes/wm/packages/line'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deletePackageLine, |
| | | getPackageLinePage, |
| | | } from '#/api/mes/wm/packages/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import LineForm from './line-form.vue'; |
| | | |
| | | const props = defineProps<{ |
| | | editable: boolean; // æ¯å¦å¯ç¼è¾ï¼è稿æï¼ |
| | | packageId: number; // æå±è£
ç®±åç¼å· |
| | | }>(); |
| | | |
| | | const [LineFormModal, lineFormModalApi] = useVbenModal({ |
| | | connectedComponent: LineForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** æ·»å è£
ç®±æç» */ |
| | | function handleCreate() { |
| | | lineFormModalApi.setData({ packageId: props.packageId }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾è£
ç®±æç» */ |
| | | function handleEdit(row: MesWmPackageLineApi.PackageLine) { |
| | | lineFormModalApi.setData({ id: row.id, packageId: props.packageId }).open(); |
| | | } |
| | | |
| | | /** å é¤è£
ç®±æç» */ |
| | | async function handleDelete(row: MesWmPackageLineApi.PackageLine) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.itemName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deletePackageLine(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.itemName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | gridOptions: { |
| | | columns: useLineGridColumns(), |
| | | height: 360, |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }) => { |
| | | if (!props.packageId) { |
| | | return { list: [], total: 0 }; |
| | | } |
| | | return await getPackageLinePage({ |
| | | packageId: props.packageId, |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmPackageLineApi.PackageLine>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <LineFormModal @success="handleRefresh" /> |
| | | <Grid table-title="è£
ç®±æ¸
å"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | v-if="editable" |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['è£
ç®±æç»']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | ifShow: editable, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | ifShow: editable, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.itemName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </div> |
| | | </template> |
copy from src/views/mes/wm/packages/modules/sub-package-list.vue
copy to src/views/wls/packages/modules/sub-package-list.vue
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | import type { MesWmProductIssueApi } from '#/api/mes/wm/productissue'; |
| | | import type { MesWmProductIssueDetailApi } from '#/api/mes/wm/productissue/detail'; |
| | | import type { MesWmProductIssueLineApi } from '#/api/mes/wm/productissue/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProWorkOrderStatusEnum, |
| | | } from '../../../packages/constants/src'; |
| | | import { getDictOptions } from '../../../packages/effects/hooks/src'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | | WmWarehouseSelect, |
| | | } from '#/views/wls/warehouse/components'; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'finish' | 'stock' | 'update'; |
| | | |
| | | /** 表å头鍿¯å¦åªè¯»ï¼æ£è´§ã详æ
ã宿æï¼ */ |
| | | function isHeaderReadonly(formType: FormType): boolean { |
| | | return formType === 'detail' || formType === 'finish' || formType === 'stock'; |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: '颿åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥é¢æåç¼å·', |
| | | }, |
| | | rules: 'required', |
| | | suffix: isHeaderReadonly(formType) |
| | | ? undefined |
| | | : () => |
| | | h( |
| | | Button, |
| | | { |
| | | type: 'default', |
| | | onClick: async () => { |
| | | const code = await generateAutoCode( |
| | | MesAutoCodeRuleCode.WM_PRODUCT_ISSUE_CODE, |
| | | ); |
| | | await formApi?.setFieldValue('code', code); |
| | | }, |
| | | }, |
| | | { default: () => 'çæ' }, |
| | | ), |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: '颿ååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥é¢æååç§°', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'requiredTime', |
| | | label: 'éæ±æ¶é´', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | format: 'YYYY-MM-DD HH:mm:ss', |
| | | placeholder: 'è¯·éæ©éæ±æ¶é´', |
| | | showTime: true, |
| | | valueFormat: 'x', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: 'ç产订å', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | componentProps: { |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'workstationId', |
| | | label: 'å·¥ä½ç«', |
| | | component: markRaw(MdWorkstationSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©å·¥ä½ç«', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: '颿åç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥é¢æåç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: '颿ååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥é¢æååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'issueDate', |
| | | label: 'é¢ææ¥æ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | label: 'åæ®ç¶æ', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions( |
| | | DICT_TYPE.MES_WM_PRODUCT_ISSUE_STATUS, |
| | | 'number', |
| | | ), |
| | | placeholder: 'è¯·éæ©åæ®ç¶æ', |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesWmProductIssueApi.ProductIssue>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: '颿åç¼å·', |
| | | minWidth: 160, |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: '颿ååç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'workOrderCode', |
| | | title: 'ç产订å', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'workstationName', |
| | | title: 'å·¥ä½ç«', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'requiredTime', |
| | | title: 'éæ±æ¶é´', |
| | | width: 180, |
| | | formatter: 'formatDateTime', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 110, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_PRODUCT_ISSUE_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 颿åè¡å表çåæ®µ */ |
| | | export function useLineGridColumns( |
| | | editable: boolean, |
| | | stockable: boolean, |
| | | ): VxeTableGridOptions<MesWmProductIssueLineApi.ProductIssueLine>['columns'] { |
| | | return [ |
| | | { |
| | | type: 'expand', |
| | | width: 48, |
| | | slots: { content: 'detail' }, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: 'ç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'ç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: '颿æ°é', |
| | | width: 100, |
| | | }, |
| | | ...(editable || stockable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 160, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** 颿åè¡æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useLineFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: '产åç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©äº§åç©æ', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: '颿æ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥é¢ææ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** æ£è´§æç»å表çåæ®µ */ |
| | | export function useDetailGridColumns( |
| | | stockable: boolean, |
| | | ): VxeTableGridOptions<MesWmProductIssueDetailApi.ProductIssueDetail>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'batchCode', |
| | | title: 'æ¹æ¬¡å·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'warehouseName', |
| | | title: 'ä»åºåç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'locationName', |
| | | title: 'åºåºåç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'areaName', |
| | | title: 'åºä½åç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'æ°é', |
| | | width: 100, |
| | | }, |
| | | ...(stockable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 120, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** æ£è´§æç»æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useDetailFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'quantityMax', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'materialStockId', |
| | | label: 'åºåè®°å½', |
| | | component: markRaw(WmMaterialStockSelect), |
| | | componentProps: { |
| | | // éæ©åºåè®°å½åï¼èªå¨åå¡«ä»åº/åºåº/åºä½/æ¹æ¬¡/æ°é |
| | | onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => { |
| | | await formApi?.setValues({ |
| | | areaId: stock?.areaId, |
| | | batchCode: stock?.batchCode, |
| | | batchId: stock?.batchId, |
| | | locationId: stock?.locationId, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | | warehouseId: stock?.warehouseId, |
| | | }); |
| | | }, |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['itemId'], |
| | | componentProps: (values) => ({ |
| | | itemId: values.itemId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'æ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥æ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | dependencies: { |
| | | triggerFields: ['quantityMax'], |
| | | componentProps: (values) => ({ |
| | | class: '!w-full', |
| | | max: values.quantityMax, |
| | | min: 0, |
| | | placeholder: '请è¾å
¥æ°é', |
| | | precision: 2, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'åºåºä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: 'åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | disabled: true, |
| | | warehouseId: values.warehouseId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaId', |
| | | label: 'åºä½', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['locationId'], |
| | | componentProps: (values) => ({ |
| | | disabled: true, |
| | | locationId: values.locationId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmProductIssueApi } from '#/api/mes/wm/productissue'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { MesWmProductIssueStatusEnum } from '../../../packages/constants/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | cancelProductIssue, |
| | | deleteProductIssue, |
| | | exportProductIssue, |
| | | getProductIssuePage, |
| | | submitProductIssue, |
| | | } from '#/api/mes/wm/productissue'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** åå»ºé¢æåºåºå */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ¥ç颿åºåºå */ |
| | | function handleDetail(row: MesWmProductIssueApi.ProductIssue) { |
| | | formModalApi.setData({ formType: 'detail', id: row.id }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾é¢æåºåºå */ |
| | | function handleEdit(row: MesWmProductIssueApi.ProductIssue) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æ§è¡æ£è´§ */ |
| | | function handleStock(row: MesWmProductIssueApi.ProductIssue) { |
| | | formModalApi.setData({ formType: 'stock', id: row.id }).open(); |
| | | } |
| | | |
| | | /** 宿颿åºåº */ |
| | | function handleFinish(row: MesWmProductIssueApi.ProductIssue) { |
| | | formModalApi.setData({ formType: 'finish', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æäº¤é¢æåºåºå */ |
| | | async function handleSubmit(row: MesWmProductIssueApi.ProductIssue) { |
| | | await submitProductIssue(row.id!); |
| | | message.success('æäº¤æå'); |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** å é¤é¢æåºåºå */ |
| | | async function handleDelete(row: MesWmProductIssueApi.ProductIssue) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.code]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteProductIssue(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 忶颿åºåºå */ |
| | | async function handleCancel(row: MesWmProductIssueApi.ProductIssue) { |
| | | await cancelProductIssue(row.id!); |
| | | message.success('åæ¶æå'); |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportProductIssue(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: '颿åºåºå.xls', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getProductIssuePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmProductIssueApi.ProductIssue>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="颿åºåºåå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['颿åºåºå']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-product-issue:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:wm-product-issue:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-product-issue:update'], |
| | | ifShow: row.status === MesWmProductIssueStatusEnum.PREPARE, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.submit'), |
| | | type: 'link', |
| | | auth: ['mes:wm-product-issue:update'], |
| | | ifShow: row.status === MesWmProductIssueStatusEnum.PREPARE, |
| | | popConfirm: { |
| | | title: '确认æäº¤è¯¥é¢æåºåºåï¼æäº¤åå°ä¸è½ä¿®æ¹ã', |
| | | confirm: handleSubmit.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-product-issue:delete'], |
| | | ifShow: row.status === MesWmProductIssueStatusEnum.PREPARE, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.code]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ§è¡æ£è´§', |
| | | type: 'link', |
| | | auth: ['mes:wm-product-issue:update'], |
| | | ifShow: row.status === MesWmProductIssueStatusEnum.APPROVING, |
| | | onClick: handleStock.bind(null, row), |
| | | }, |
| | | { |
| | | label: '宿', |
| | | type: 'link', |
| | | auth: ['mes:wm-product-issue:finish'], |
| | | ifShow: row.status === MesWmProductIssueStatusEnum.APPROVED, |
| | | onClick: handleFinish.bind(null, row), |
| | | }, |
| | | { |
| | | label: 'åæ¶', |
| | | type: 'link', |
| | | danger: true, |
| | | auth: ['mes:wm-product-issue:update'], |
| | | ifShow: |
| | | row.status === MesWmProductIssueStatusEnum.APPROVING || |
| | | row.status === MesWmProductIssueStatusEnum.APPROVED, |
| | | popConfirm: { |
| | | title: 'ç¡®è®¤åæ¶è¯¥é¢æåºåºåï¼åæ¶åä¸å¯æ¢å¤ã', |
| | | confirm: handleCancel.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmProductIssueDetailApi } from '#/api/mes/wm/productissue/detail'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createProductIssueDetail, |
| | | getProductIssueDetail, |
| | | updateProductIssueDetail, |
| | | } from '#/api/mes/wm/productissue/detail'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useDetailFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits<{ success: [lineId: number] }>(); |
| | | const formData = ref<MesWmProductIssueDetailApi.ProductIssueDetail>(); |
| | | const issueId = ref<number>(); // æå±é¢æåç¼å· |
| | | const lineId = ref<number>(); // æå±é¢æåè¡ç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['æ£è´§æç»']) |
| | | : $t('ui.actionTitle.create', ['æ£è´§æç»']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useDetailFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmProductIssueDetailApi.ProductIssueDetail; |
| | | data.issueId = issueId.value; |
| | | data.lineId = lineId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateProductIssueDetail({ ...data, id: formData.value.id }) |
| | | : createProductIssueDetail(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success', lineId.value!); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | formApi.setState({ schema: useDetailFormSchema(formApi) }); |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | detailId?: number; |
| | | issueId: number; |
| | | itemId?: number; |
| | | lineId: number; |
| | | }>(); |
| | | issueId.value = data.issueId; |
| | | lineId.value = data.lineId; |
| | | if (data.detailId) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getProductIssueDetail(data.detailId); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } else if (data.itemId) { |
| | | await formApi.setFieldValue('itemId', data.itemId); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
copy from src/views/mes/wm/productissue/modules/detail-list.vue
copy to src/views/wls/productissue/modules/detail-list.vue
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { MesWmProductIssueApi } from '#/api/mes/wm/productissue'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { confirm, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { MesWmProductIssueStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | checkProductIssueQuantity, |
| | | createProductIssue, |
| | | finishProductIssue, |
| | | getProductIssue, |
| | | stockProductIssue, |
| | | submitProductIssue, |
| | | updateProductIssue, |
| | | } from '#/api/mes/wm/productissue'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import LineList from './line-list.vue'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesWmProductIssueApi.ProductIssue>(); |
| | | const originalSnapshot = ref(''); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äºæäº¤æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | const isEditable = computed(() => |
| | | // æ¯å¦ä¸ºç¼è¾æ¨¡å¼ï¼å¯ä¿åï¼ |
| | | ['create', 'update'].includes(formType.value), |
| | | ); |
| | | const isStock = computed(() => formType.value === 'stock'); // æ¯å¦ä¸ºæ£è´§æ¨¡å¼ |
| | | const isFinish = computed(() => formType.value === 'finish'); // æ¯å¦ä¸ºå®æåºåºæ¨¡å¼ |
| | | const canSubmit = computed( |
| | | () => |
| | | // æ¯å¦å¯æäº¤ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmProductIssueStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.view', ['颿åºåºå']); |
| | | } |
| | | if (formType.value === 'stock') { |
| | | return 'æ§è¡æ£è´§'; |
| | | } |
| | | if (formType.value === 'finish') { |
| | | return '宿颿åºåº'; |
| | | } |
| | | return formType.value === 'update' |
| | | ? $t('ui.actionTitle.edit', ['颿åºåºå']) |
| | | : $t('ui.actionTitle.create', ['颿åºåºå']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | /** æäº¤é¢æåï¼è¡¨åæä¿®æ¹æ¶å
ä¿åï¼åè°ç¨æäº¤æ¥å£ */ |
| | | async function handleSubmit() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = |
| | | (await formApi.getValues()) as MesWmProductIssueApi.ProductIssue; |
| | | await updateProductIssue({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | await submitProductIssue(formData.value.id); |
| | | message.success('æäº¤æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æ§è¡æ£è´§ï¼é¢ææ°é䏿£è´§æ°éä¸ä¸è´æ¶äºæ¬¡ç¡®è®¤ */ |
| | | async function handleStock() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | const quantityMatch = await checkProductIssueQuantity(formData.value.id); |
| | | if (!quantityMatch) { |
| | | try { |
| | | await confirm('颿æ°é䏿£è´§æ°éä¸ä¸è´ï¼ç¡®è®¤æ§è¡æ£è´§ï¼'); |
| | | } catch { |
| | | return; |
| | | } |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await stockProductIssue(formData.value.id); |
| | | message.success('æ£è´§æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** 宿颿åºåº */ |
| | | async function handleFinish() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await finishProductIssue(formData.value.id); |
| | | message.success('宿æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (!isEditable.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmProductIssueApi.ProductIssue; |
| | | try { |
| | | if (formData.value?.id) { |
| | | await updateProductIssue({ ...formData.value, ...data }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createProductIssue(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesWmProductIssueStatusEnum.PREPARE, |
| | | }; |
| | | await formApi.setFieldValue('id', id); |
| | | await formApi.setFieldValue('status', formData.value.status); |
| | | formType.value = 'update'; |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ''; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | formApi.setDisabled(!isEditable.value); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | | if (data?.id) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getProductIssue(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | <!-- éæ°å»ºæ¨¡å¼å±ç¤ºç©æä¿¡æ¯ --> |
| | | <template v-if="formData?.id"> |
| | | <Divider>ç©æä¿¡æ¯</Divider> |
| | | <div class="mx-4"> |
| | | <LineList :form-type="formType" :issue-id="formData.id" /> |
| | | </div> |
| | | </template> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Popconfirm |
| | | v-if="canSubmit" |
| | | title="确认æäº¤è¯¥é¢æåºåºåï¼ãæäº¤åå°ä¸è½ä¿®æ¹ã" |
| | | @confirm="handleSubmit" |
| | | > |
| | | <Button type="primary">æäº¤</Button> |
| | | </Popconfirm> |
| | | <Button v-if="isStock" type="primary" @click="handleStock"> |
| | | æ§è¡æ£è´§ |
| | | </Button> |
| | | <Popconfirm |
| | | v-if="isFinish" |
| | | title="ç¡®è®¤å®æè¯¥é¢æåå¹¶æ§è¡åºåºåï¼" |
| | | @confirm="handleFinish" |
| | | > |
| | | <Button type="primary">宿</Button> |
| | | </Popconfirm> |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmProductIssueLineApi } from '#/api/mes/wm/productissue/line'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createProductIssueLine, |
| | | getProductIssueLine, |
| | | updateProductIssueLine, |
| | | } from '#/api/mes/wm/productissue/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formData = ref<MesWmProductIssueLineApi.ProductIssueLine>(); |
| | | const issueId = ref<number>(); // æå±é¢æåç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['颿åºåºåè¡']) |
| | | : $t('ui.actionTitle.create', ['颿åºåºåè¡']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useLineFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmProductIssueLineApi.ProductIssueLine; |
| | | data.issueId = issueId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateProductIssueLine({ ...data, id: formData.value.id }) |
| | | : createProductIssueLine(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ id?: number; issueId: number }>(); |
| | | issueId.value = data.issueId; |
| | | if (!data.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getProductIssueLine(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmProductIssueDetailApi } from '#/api/mes/wm/productissue/detail'; |
| | | import type { MesWmProductIssueLineApi } from '#/api/mes/wm/productissue/line'; |
| | | |
| | | import { computed, reactive } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getProductIssueDetailListByLineId } from '#/api/mes/wm/productissue/detail'; |
| | | import { |
| | | deleteProductIssueLine, |
| | | getProductIssueLinePage, |
| | | } from '#/api/mes/wm/productissue/line'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | | import DetailList from './detail-list.vue'; |
| | | import LineForm from './line-form.vue'; |
| | | |
| | | const props = defineProps<{ |
| | | formType: FormType; |
| | | issueId: number; |
| | | }>(); |
| | | |
| | | const isEditable = computed(() => |
| | | // æ¯å¦å¯ç¼è¾æç»è¡ |
| | | ['create', 'update'].includes(props.formType), |
| | | ); |
| | | const isStock = computed(() => props.formType === 'stock'); // æ¯å¦ä¸ºæ£è´§æ¨¡å¼ |
| | | const detailMap = reactive< |
| | | Record<number, MesWmProductIssueDetailApi.ProductIssueDetail[]> |
| | | >({}); // å·²å±å¼è¡çæ£è´§æç»ç¼å |
| | | |
| | | const [LineFormModal, lineFormModalApi] = useVbenModal({ |
| | | connectedComponent: LineForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [DetailFormModal, detailFormModalApi] = useVbenModal({ |
| | | connectedComponent: DetailForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | for (const id of Object.keys(detailMap)) { |
| | | delete detailMap[Number(id)]; |
| | | } |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** æ·»å ç©æ */ |
| | | function handleCreate() { |
| | | lineFormModalApi.setData({ issueId: props.issueId }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾ç©æ */ |
| | | function handleEdit(row: MesWmProductIssueLineApi.ProductIssueLine) { |
| | | lineFormModalApi.setData({ id: row.id, issueId: props.issueId }).open(); |
| | | } |
| | | |
| | | /** å é¤ç©æ */ |
| | | async function handleDelete(row: MesWmProductIssueLineApi.ProductIssueLine) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.itemName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteProductIssueLine(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.itemName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** æ£è´§ï¼ç´æ¥æå¼æç»å建表å */ |
| | | function handlePicking(row: MesWmProductIssueLineApi.ProductIssueLine) { |
| | | openDetailForm(row.id!, row.itemId); |
| | | } |
| | | |
| | | /** æå¼æ£è´§æç»è¡¨å */ |
| | | function openDetailForm(lineId: number, itemId?: number, detailId?: number) { |
| | | detailFormModalApi |
| | | .setData({ detailId, issueId: props.issueId, itemId, lineId }) |
| | | .open(); |
| | | } |
| | | |
| | | /** è·åå·²å±å¼è¡çæ£è´§æç» */ |
| | | function getExpandedDetails(row: MesWmProductIssueLineApi.ProductIssueLine) { |
| | | return detailMap[row.id!] || []; |
| | | } |
| | | |
| | | /** å è½½æå®è¡çæ£è´§æç» */ |
| | | async function loadLineDetails(lineId: number) { |
| | | detailMap[lineId] = await getProductIssueDetailListByLineId(lineId); |
| | | } |
| | | |
| | | /** å±å¼è¡æ¶æå è½½æ£è´§æç» */ |
| | | async function handleExpandChange( |
| | | row: MesWmProductIssueLineApi.ProductIssueLine, |
| | | expanded: boolean, |
| | | ) { |
| | | if (!expanded) { |
| | | return; |
| | | } |
| | | await loadLineDetails(row.id!); |
| | | } |
| | | |
| | | /** æç»è¡¨åæäº¤æååï¼å·æ°å¯¹åºè¡å·²å±å¼çæç» */ |
| | | async function handleDetailSuccess(lineId: number) { |
| | | await loadLineDetails(lineId); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | gridOptions: { |
| | | columns: useLineGridColumns(isEditable.value, isStock.value), |
| | | expandConfig: { |
| | | padding: true, |
| | | }, |
| | | height: 400, |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }) => { |
| | | if (!props.issueId) { |
| | | return { list: [], total: 0 }; |
| | | } |
| | | return await getProductIssueLinePage({ |
| | | issueId: props.issueId, |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmProductIssueLineApi.ProductIssueLine>, |
| | | gridEvents: { |
| | | toggleRowExpand: ({ |
| | | expanded, |
| | | row, |
| | | }: { |
| | | expanded: boolean; |
| | | row: MesWmProductIssueLineApi.ProductIssueLine; |
| | | }) => { |
| | | handleExpandChange(row, expanded); |
| | | }, |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <LineFormModal @success="handleRefresh" /> |
| | | <DetailFormModal @success="handleDetailSuccess" /> |
| | | <Grid table-title="ç©æä¿¡æ¯"> |
| | | <template v-if="isEditable" #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: 'æ·»å ç©æ', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #detail="{ row }"> |
| | | <DetailList |
| | | :details="getExpandedDetails(row)" |
| | | :form-type="formType" |
| | | @edit="(detailId) => openDetailForm(row.id!, row.itemId, detailId)" |
| | | @refresh="loadLineDetails(row.id!)" |
| | | /> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | ifShow: isEditable, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | ifShow: isEditable, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.itemName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ£è´§', |
| | | type: 'link', |
| | | ifShow: isStock, |
| | | onClick: handlePicking.bind(null, row), |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </div> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | import type { MesWmProductReceiptApi } from '#/api/mes/wm/productreceipt'; |
| | | import type { MesWmProductReceiptDetailApi } from '#/api/mes/wm/productreceipt/detail'; |
| | | import type { MesWmProductReceiptLineApi } from '#/api/mes/wm/productreceipt/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProWorkOrderStatusEnum, |
| | | } from '../../../packages/constants/src'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | | WmWarehouseSelect, |
| | | } from '#/views/wls/warehouse/components'; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'finish' | 'stock' | 'update'; |
| | | |
| | | /** 表å头鍿¯å¦åªè¯»ï¼ä¸æ¶ã详æ
ãå
¥åºæï¼ */ |
| | | function isHeaderReadonly(formType: FormType): boolean { |
| | | return formType === 'detail' || formType === 'finish' || formType === 'stock'; |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'status', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: 'å
¥åºåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å
¥åºåç¼å·', |
| | | }, |
| | | rules: 'required', |
| | | suffix: isHeaderReadonly(formType) |
| | | ? undefined |
| | | : () => |
| | | h( |
| | | Button, |
| | | { |
| | | type: 'default', |
| | | onClick: async () => { |
| | | const code = await generateAutoCode( |
| | | MesAutoCodeRuleCode.PRODUCTRECPT_CODE, |
| | | ); |
| | | await formApi?.setFieldValue('code', code); |
| | | }, |
| | | }, |
| | | { default: () => 'çæ' }, |
| | | ), |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'å
¥åºååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å
¥åºååç§°', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'receiptDate', |
| | | label: 'å
¥åºæ¥æ', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | format: 'YYYY-MM-DD', |
| | | placeholder: 'è¯·éæ©å
¥åºæ¥æ', |
| | | valueFormat: 'x', |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: 'ç产订å', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | componentProps: { |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çæç´¢è¡¨å */ |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'å
¥åºåç¼å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥å
¥åºåç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'å
¥åºååç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥å
¥åºååç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'receiptDate', |
| | | label: 'å
¥åºæ¥æ', |
| | | component: 'RangePicker', |
| | | componentProps: { |
| | | ...getRangePickerDefaultProps(), |
| | | allowClear: true, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesWmProductReceiptApi.ProductReceipt>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'code', |
| | | title: 'å
¥åºåç¼å·', |
| | | minWidth: 160, |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: 'å
¥åºååç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'workOrderCode', |
| | | title: 'ç产订å', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'receiptDate', |
| | | title: 'å
¥åºæ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ®ç¶æ', |
| | | minWidth: 110, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_WM_PRODUCT_RECEIPT_STATUS }, |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å
¥åºåè¡å表çåæ®µ */ |
| | | export function useLineGridColumns( |
| | | editable: boolean, |
| | | stockable: boolean, |
| | | ): VxeTableGridOptions<MesWmProductReceiptLineApi.ProductReceiptLine>['columns'] { |
| | | return [ |
| | | { |
| | | type: 'expand', |
| | | width: 48, |
| | | slots: { content: 'detail' }, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: '产åç©æç¼ç ', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: '产åç©æåç§°', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'specification', |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'å
¥åºæ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'batchCode', |
| | | title: 'æ¹æ¬¡å·', |
| | | minWidth: 120, |
| | | }, |
| | | ...(editable || stockable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 200, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** å
¥åºåè¡æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useLineFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'materialStockId', |
| | | label: 'åºåè®°å½', |
| | | component: markRaw(WmMaterialStockSelect), |
| | | componentProps: { |
| | | // éæ©åºåè®°å½åï¼èªå¨åå¡«ç©æ/æ¹æ¬¡/æ°é |
| | | onChange: async (stock?: MesWmMaterialStockApi.MaterialStock) => { |
| | | await formApi?.setValues({ |
| | | batchCode: stock?.batchCode, |
| | | batchId: stock?.batchId, |
| | | itemId: stock?.itemId, |
| | | quantity: stock?.quantity, |
| | | quantityMax: stock?.quantity, |
| | | }); |
| | | }, |
| | | virtualFilter: 'only', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'quantityMax', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'å
¥åºæ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥å
¥åºæ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | dependencies: { |
| | | triggerFields: ['quantityMax'], |
| | | componentProps: (values) => ({ |
| | | class: '!w-full', |
| | | max: values.quantityMax, |
| | | min: 0, |
| | | placeholder: '请è¾å
¥å
¥åºæ°é', |
| | | precision: 2, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'batchCode', |
| | | label: 'æ¹æ¬¡å·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: 'éæ©åºååèªå¨å¸¦åº', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-3', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 䏿¶æç»å表çåæ®µ */ |
| | | export function useDetailGridColumns( |
| | | stockable: boolean, |
| | | ): VxeTableGridOptions<MesWmProductReceiptDetailApi.ProductReceiptDetail>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'warehouseName', |
| | | title: 'ä»åºåç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'locationName', |
| | | title: 'åºåºåç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'areaName', |
| | | title: 'åºä½åç§°', |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'æ°é', |
| | | width: 100, |
| | | }, |
| | | ...(stockable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 120, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** 䏿¶æç»æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useDetailFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdItemSelect), |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'warehouseId', |
| | | label: 'å
¥åºä»åº', |
| | | component: markRaw(WmWarehouseSelect), |
| | | componentProps: { |
| | | // 忢ä»åºåæ¸
空åºåºååºä½ |
| | | onChange: async () => { |
| | | await formApi?.setValues({ |
| | | areaId: undefined, |
| | | locationId: undefined, |
| | | }); |
| | | }, |
| | | placeholder: 'è¯·éæ©ä»åº', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'locationId', |
| | | label: 'åºåº', |
| | | component: markRaw(WmWarehouseLocationSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['warehouseId'], |
| | | componentProps: (values) => ({ |
| | | // 忢åºåºåæ¸
空åºä½ |
| | | onChange: async () => { |
| | | await formApi?.setFieldValue('areaId', undefined); |
| | | }, |
| | | placeholder: 'è¯·éæ©åºåº', |
| | | warehouseId: values.warehouseId, |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'areaId', |
| | | label: 'åºä½', |
| | | component: markRaw(WmWarehouseAreaSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åºä½', |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['locationId'], |
| | | componentProps: (values) => ({ |
| | | locationId: values.locationId, |
| | | placeholder: 'è¯·éæ©åºä½', |
| | | }), |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'æ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥æ°é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | ]; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesWmProductReceiptApi } from '#/api/mes/wm/productreceipt'; |
| | | |
| | | import { Page, useVbenModal } from '../../../packages/effects/common-ui/src'; |
| | | import { MesWmProductReceiptStatusEnum } from '../../../packages/constants/src'; |
| | | import { downloadFileFromBlobPart } from '../../../packages/utils/src'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | cancelProductReceipt, |
| | | deleteProductReceipt, |
| | | exportProductReceipt, |
| | | getProductReceiptPage, |
| | | } from '#/api/mes/wm/productreceipt'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建产åå
¥åºå */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ¥ç产åå
¥åºå */ |
| | | function handleDetail(row: MesWmProductReceiptApi.ProductReceipt) { |
| | | formModalApi.setData({ formType: 'detail', id: row.id }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾äº§åå
¥åºå */ |
| | | function handleEdit(row: MesWmProductReceiptApi.ProductReceipt) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ */ |
| | | function handleStock(row: MesWmProductReceiptApi.ProductReceipt) { |
| | | formModalApi.setData({ formType: 'stock', id: row.id }).open(); |
| | | } |
| | | |
| | | /** æ§è¡å
¥åº */ |
| | | function handleFinish(row: MesWmProductReceiptApi.ProductReceipt) { |
| | | formModalApi.setData({ formType: 'finish', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å é¤äº§åå
¥åºå */ |
| | | async function handleDelete(row: MesWmProductReceiptApi.ProductReceipt) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.code]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteProductReceipt(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** åæ¶äº§åå
¥åºå */ |
| | | async function handleCancel(row: MesWmProductReceiptApi.ProductReceipt) { |
| | | await cancelProductReceipt(row.id!); |
| | | message.success('åæ¶æå'); |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportProductReceipt(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: '产åå
¥åºå.xls', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getProductReceiptPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmProductReceiptApi.ProductReceipt>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Grid table-title="产åå
¥åºåå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['产åå
¥åºå']), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-product-receipt:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:wm-product-receipt:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |
| | | auth: ['mes:wm-product-receipt:update'], |
| | | ifShow: row.status === MesWmProductReceiptStatusEnum.PREPARE, |
| | | onClick: handleEdit.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.delete'), |
| | | type: 'link', |
| | | danger: true, |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:wm-product-receipt:delete'], |
| | | ifShow: row.status === MesWmProductReceiptStatusEnum.PREPARE, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.code]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ§è¡ä¸æ¶', |
| | | type: 'link', |
| | | auth: ['mes:wm-product-receipt:update'], |
| | | ifShow: row.status === MesWmProductReceiptStatusEnum.APPROVING, |
| | | onClick: handleStock.bind(null, row), |
| | | }, |
| | | { |
| | | label: 'æ§è¡å
¥åº', |
| | | type: 'link', |
| | | auth: ['mes:wm-product-receipt:finish'], |
| | | ifShow: row.status === MesWmProductReceiptStatusEnum.APPROVED, |
| | | onClick: handleFinish.bind(null, row), |
| | | }, |
| | | { |
| | | label: 'åæ¶', |
| | | type: 'link', |
| | | danger: true, |
| | | auth: ['mes:wm-product-receipt:update'], |
| | | ifShow: |
| | | row.status === MesWmProductReceiptStatusEnum.APPROVING || |
| | | row.status === MesWmProductReceiptStatusEnum.APPROVED, |
| | | popConfirm: { |
| | | title: 'ç¡®è®¤åæ¶è¯¥äº§åå
¥åºåï¼åæ¶åä¸å¯æ¢å¤ã', |
| | | confirm: handleCancel.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmProductReceiptDetailApi } from '#/api/mes/wm/productreceipt/detail'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createProductReceiptDetail, |
| | | getProductReceiptDetail, |
| | | updateProductReceiptDetail, |
| | | } from '#/api/mes/wm/productreceipt/detail'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useDetailFormSchema } from '../data'; |
| | | |
| | | const emit = defineEmits<{ success: [lineId: number] }>(); |
| | | const formData = ref<MesWmProductReceiptDetailApi.ProductReceiptDetail>(); |
| | | const receiptId = ref<number>(); // æå±å
¥åºåç¼å· |
| | | const lineId = ref<number>(); // æå±å
¥åºåè¡ç¼å· |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['䏿¶æç»']) |
| | | : $t('ui.actionTitle.create', ['䏿¶æç»']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 90, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: useDetailFormSchema(), |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmProductReceiptDetailApi.ProductReceiptDetail; |
| | | data.receiptId = receiptId.value; |
| | | data.lineId = lineId.value; |
| | | try { |
| | | await (formData.value?.id |
| | | ? updateProductReceiptDetail({ ...data, id: formData.value.id }) |
| | | : createProductReceiptDetail(data)); |
| | | // å
³éå¹¶æç¤º |
| | | await modalApi.close(); |
| | | emit('success', lineId.value!); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | formApi.setState({ schema: useDetailFormSchema(formApi) }); |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | detailId?: number; |
| | | itemId?: number; |
| | | lineId: number; |
| | | receiptId: number; |
| | | }>(); |
| | | receiptId.value = data.receiptId; |
| | | lineId.value = data.lineId; |
| | | if (data.detailId) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getProductReceiptDetail(data.detailId); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } else if (data.itemId) { |
| | | await formApi.setFieldValue('itemId', data.itemId); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |
copy from src/views/mes/wm/productreceipt/modules/detail-list.vue
copy to src/views/wls/productreceipt/modules/detail-list.vue
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | |
| | | import type { MesWmProductReceiptApi } from '#/api/mes/wm/productreceipt'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { confirm, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { MesWmProductReceiptStatusEnum } from '../../../../packages/constants/src'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | checkProductReceiptQuantity, |
| | | createProductReceipt, |
| | | finishProductReceipt, |
| | | getProductReceipt, |
| | | stockProductReceipt, |
| | | submitProductReceipt, |
| | | updateProductReceipt, |
| | | } from '#/api/mes/wm/productreceipt'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import LineList from './line-list.vue'; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesWmProductReceiptApi.ProductReceipt>(); |
| | | const originalSnapshot = ref(''); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äºæäº¤æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | const isEditable = computed(() => |
| | | // æ¯å¦ä¸ºç¼è¾æ¨¡å¼ï¼å¯ä¿åï¼ |
| | | ['create', 'update'].includes(formType.value), |
| | | ); |
| | | const isStock = computed(() => formType.value === 'stock'); // æ¯å¦ä¸ºä¸æ¶æ¨¡å¼ |
| | | const isFinish = computed(() => formType.value === 'finish'); // æ¯å¦ä¸ºæ§è¡å
¥åºæ¨¡å¼ |
| | | const canSubmit = computed( |
| | | () => |
| | | // æ¯å¦å¯æäº¤ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmProductReceiptStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.view', ['产åå
¥åºå']); |
| | | } |
| | | if (formType.value === 'stock') { |
| | | return 'æ§è¡ä¸æ¶'; |
| | | } |
| | | if (formType.value === 'finish') { |
| | | return 'æ§è¡å
¥åº'; |
| | | } |
| | | return formType.value === 'update' |
| | | ? $t('ui.actionTitle.edit', ['产åå
¥åºå']) |
| | | : $t('ui.actionTitle.create', ['产åå
¥åºå']); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | /** æäº¤å
¥åºåï¼è¡¨åæä¿®æ¹æ¶å
ä¿åï¼åè°ç¨æäº¤æ¥å£ */ |
| | | async function handleSubmit() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = |
| | | (await formApi.getValues()) as MesWmProductReceiptApi.ProductReceipt; |
| | | await updateProductReceipt({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | await submitProductReceipt(formData.value.id); |
| | | message.success('æäº¤æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æ§è¡ä¸æ¶ï¼å
确认ï¼åå¨æç»æ°éä¸è¡æ¶è´§æ°éä¸ä¸è´æ¶äºæ¬¡ç¡®è®¤ */ |
| | | async function handleStock() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | try { |
| | | await confirm('确认æ§è¡ä¸æ¶ï¼'); |
| | | } catch { |
| | | return; |
| | | } |
| | | const quantityMatch = await checkProductReceiptQuantity(formData.value.id); |
| | | if (!quantityMatch) { |
| | | try { |
| | | await confirm('æç»æ°éä¸è¡æ¶è´§æ°éä¸ä¸è´ï¼ç¡®è®¤æ§è¡ä¸æ¶ï¼'); |
| | | } catch { |
| | | return; |
| | | } |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await stockProductReceipt(formData.value.id); |
| | | message.success('䏿¶æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æ§è¡å
¥åº */ |
| | | async function handleFinish() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | await finishProductReceipt(formData.value.id); |
| | | message.success('å
¥åºæå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (!isEditable.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = |
| | | (await formApi.getValues()) as MesWmProductReceiptApi.ProductReceipt; |
| | | try { |
| | | if (formData.value?.id) { |
| | | await updateProductReceipt({ ...formData.value, ...data }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createProductReceipt(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesWmProductReceiptStatusEnum.PREPARE, |
| | | }; |
| | | await formApi.setFieldValue('id', id); |
| | | await formApi.setFieldValue('status', formData.value.status); |
| | | formType.value = 'update'; |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ''; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | formApi.setDisabled(!isEditable.value); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | | if (data?.id) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getProductReceipt(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | |
| | | /** å
¥åºå确认 */ |
| | | async function confirmFinish() { |
| | | try { |
| | | await confirm('确认æ§è¡å
¥åºï¼æ§è¡åå°æ´æ°åºåå°è´¦ã'); |
| | | } catch { |
| | | return; |
| | | } |
| | | await handleFinish(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | <!-- éæ°å»ºæ¨¡å¼å±ç¤ºç©æä¿¡æ¯ --> |
| | | <template v-if="formData?.id"> |
| | | <Divider>ç©æä¿¡æ¯</Divider> |
| | | <div class="mx-4"> |
| | | <LineList :form-type="formType" :receipt-id="formData.id" /> |
| | | </div> |
| | | </template> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Popconfirm |
| | | v-if="canSubmit" |
| | | title="确认æäº¤è¯¥äº§åå
¥åºåï¼ãæäº¤åå°ä¸è½ä¿®æ¹ã" |
| | | @confirm="handleSubmit" |
| | | > |
| | | <Button type="primary">æäº¤</Button> |
| | | </Popconfirm> |
| | | <Button v-if="isStock" type="primary" @click="handleStock"> |
| | | æ§è¡ä¸æ¶ |
| | | </Button> |
| | | <Button v-if="isFinish" type="primary" @click="confirmFinish"> |
| | | æ§è¡å
¥åº |
| | | </Button> |
| | | </div> |
| | | </template> |
| | | </Modal> |
| | | </template> |
| src/views/wls/productreceipt/modules/line-form.vue
src/views/wls/productreceipt/modules/line-list.vue
src/views/wls/productsales/data.ts
src/views/wls/productsales/index.vue
src/views/wls/productsales/modules/detail-form.vue
src/views/wls/productsales/modules/detail-list.vue
src/views/wls/productsales/modules/form.vue
src/views/wls/productsales/modules/line-form.vue
src/views/wls/productsales/modules/line-list.vue
src/views/wls/returnissue/data.ts
src/views/wls/returnissue/index.vue
src/views/wls/returnissue/modules/detail-form.vue
src/views/wls/returnissue/modules/detail-list.vue
src/views/wls/returnissue/modules/form.vue
src/views/wls/returnissue/modules/line-form.vue
src/views/wls/returnissue/modules/line-list.vue
src/views/wls/returnsales/data.ts
src/views/wls/returnsales/index.vue
src/views/wls/returnsales/modules/detail-form.vue
src/views/wls/returnsales/modules/detail-list.vue
src/views/wls/returnsales/modules/form.vue
src/views/wls/returnsales/modules/line-form.vue
src/views/wls/returnsales/modules/line-list.vue
src/views/wls/returnvendor/data.ts
src/views/wls/returnvendor/index.vue
src/views/wls/returnvendor/modules/detail-form.vue
src/views/wls/returnvendor/modules/detail-list.vue
src/views/wls/returnvendor/modules/form.vue
src/views/wls/returnvendor/modules/line-form.vue
src/views/wls/returnvendor/modules/line-list.vue
src/views/wls/salesnotice/components/index.ts
src/views/wls/salesnotice/components/line-select-dialog.vue
src/views/wls/salesnotice/components/line-select.vue
src/views/wls/salesnotice/components/select-dialog.vue
src/views/wls/salesnotice/components/select.vue
src/views/wls/salesnotice/data.ts
src/views/wls/salesnotice/index.vue
src/views/wls/salesnotice/modules/form.vue
src/views/wls/salesnotice/modules/line-form.vue
src/views/wls/salesnotice/modules/line-list.vue
src/views/wls/sn/data.ts
src/views/wls/sn/index.vue
src/views/wls/sn/modules/detail.vue
src/views/wls/sn/modules/form.vue
src/views/wls/stocktaking/plan/components/condition-value-input.vue
src/views/wls/stocktaking/plan/components/index.ts
src/views/wls/stocktaking/plan/components/select-dialog.vue
src/views/wls/stocktaking/plan/components/select.vue
src/views/wls/stocktaking/plan/data.ts
src/views/wls/stocktaking/plan/index.vue
src/views/wls/stocktaking/plan/modules/form.vue
src/views/wls/stocktaking/plan/modules/param-form.vue
src/views/wls/stocktaking/plan/modules/param-list.vue
src/views/wls/stocktaking/task/data.ts
src/views/wls/stocktaking/task/index.vue
src/views/wls/stocktaking/task/modules/form.vue
src/views/wls/stocktaking/task/modules/line-list.vue
src/views/wls/stocktaking/task/modules/result-form.vue
src/views/wls/stocktaking/task/modules/result-list.vue
src/views/wls/transfer/data.ts
src/views/wls/transfer/index.vue
src/views/wls/transfer/modules/detail-form.vue
src/views/wls/transfer/modules/detail-list.vue
src/views/wls/transfer/modules/form.vue
src/views/wls/transfer/modules/line-form.vue
src/views/wls/transfer/modules/line-list.vue
src/views/wls/warehouse/area/data.ts
src/views/wls/warehouse/area/index.vue
src/views/wls/warehouse/area/modules/form.vue
src/views/wls/warehouse/components/area-select.vue
src/views/wls/warehouse/components/index.ts
src/views/wls/warehouse/components/location-select.vue
src/views/wls/warehouse/components/select.vue
src/views/wls/warehouse/data.ts
src/views/wls/warehouse/index.vue
src/views/wls/warehouse/location/data.ts
src/views/wls/warehouse/location/index.vue
src/views/wls/warehouse/location/modules/form.vue
src/views/wls/warehouse/modules/form.vue
vite.config.ts |