refactor(mes): 移除工单模块中的BOM相关功能
- 删除bom-form.vue组件文件
- 删除bom-list.vue组件文件
- 从data.ts中移除BOM相关的表格列定义和表单schema函数
- 从form.vue中移除BOM相关导入和组件引用
- 将默认子标签页从bom切换为process
- 移除BOM物料生成子订单的功能逻辑
- 更新工单表单的数据结构定义
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesMdProductBomApi } from '#/api/mes/md/item/productBom'; |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | | import type { MesProWorkOrderBomApi } from '#/api/mes/pro/workorder/bom'; |
| | | import type { MesProWorkOrderProcessApi } from '#/api/mes/pro/workorder/process'; |
| | |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { |
| | | MdItemSelect, |
| | | MdProductBomSelect, |
| | | } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | |
| | |
| | | width: 240, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** 订å BOM å表çåæ®µ */ |
| | | export function useBomGridColumns( |
| | | editable: boolean, |
| | | generatable: boolean, |
| | | ): VxeTableGridOptions<MesProWorkOrderBomApi.WorkOrderBom>['columns'] { |
| | | return [ |
| | | { |
| | | field: 'itemCode', |
| | | title: 'BOM ç©æç¼ç ', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'BOM ç©æåç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'itemSpecification', |
| | | title: 'è§æ ¼åå·', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | | title: 'åä½', |
| | | width: 80, |
| | | }, |
| | | { |
| | | field: 'itemOrProduct', |
| | | title: 'ç©æ/产å', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: DICT_TYPE.MES_MD_ITEM_OR_PRODUCT }, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | | title: 'é¢è®¡ä½¿ç¨é', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'remark', |
| | | title: '夿³¨', |
| | | minWidth: 120, |
| | | }, |
| | | ...(editable || generatable |
| | | ? [ |
| | | { |
| | | title: 'æä½', |
| | | width: 160, |
| | | fixed: 'right', |
| | | slots: { default: 'actions' }, |
| | | } as const, |
| | | ] |
| | | : []), |
| | | ]; |
| | | } |
| | | |
| | | /** 订å BOM æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useBomFormSchema( |
| | | isCreate: boolean, |
| | | productId?: number, |
| | | formApi?: VbenFormApi, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'ç©æ', |
| | | component: markRaw(MdProductBomSelect), |
| | | componentProps: { |
| | | itemId: productId, |
| | | placeholder: 'è¯·éæ©ç©æ', |
| | | // BOM ç©æéä¸åèªå¨åå¡«é¢è®¡ä½¿ç¨é |
| | | onChange: async (bom?: MesMdProductBomApi.ProductBom) => { |
| | | await formApi?.setFieldValue('quantity', bom?.quantity ?? undefined); |
| | | }, |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => isCreate, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemName', |
| | | label: 'ç©æ', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => !isCreate, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'unitMeasureName', |
| | | label: 'åä½', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => !isCreate, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'quantity', |
| | | label: 'é¢è®¡ä½¿ç¨é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | min: 0, |
| | | placeholder: '请è¾å
¥é¢è®¡ä½¿ç¨é', |
| | | precision: 2, |
| | | }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | rows: 3, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | |
| | | import type { FormType } from "../data"; |
| | | |
| | | import type { MesProWorkOrderApi } from "#/api/mes/pro/workorder"; |
| | | import type { MesProWorkOrderBomApi } from "#/api/mes/pro/workorder/bom"; |
| | | import type { MesProWorkOrderProcessApi } from "#/api/mes/pro/workorder/process"; |
| | | |
| | | import { computed, ref } from "vue"; |
| | |
| | | import { BarcodeDetail } from "#/views/wls/barcode/components"; |
| | | |
| | | import { useFormSchema } from "../data"; |
| | | import BomList from "./bom-list.vue"; |
| | | import ItemList from "./item-list.vue"; |
| | | import ProcessList from "./process-list.vue"; |
| | | |
| | |
| | | const formType = ref<FormType>("create"); |
| | | const formData = ref<MesProWorkOrderApi.WorkOrder>(); |
| | | const originalSnapshot = ref(""); |
| | | const subTabsName = ref("bom"); |
| | | const subTabsName = ref("process"); |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); |
| | | const processListRef = ref<InstanceType<typeof ProcessList>>(); |
| | | const currentProductId = ref<number>(); // å½åéä¸ç产å IDï¼ç¨äºå·¥åºå è½½ï¼ |
| | |
| | | formData.value.code, |
| | | formData.value.name |
| | | ); |
| | | } |
| | | |
| | | /** ä» BOM ç©æè¡é¢å¡«å订å */ |
| | | async function handleGenerateWorkOrder( |
| | | bomRow: MesProWorkOrderBomApi.WorkOrderBom |
| | | ) { |
| | | const current = formData.value; |
| | | if (!current) { |
| | | return; |
| | | } |
| | | formData.value = undefined; |
| | | formType.value = "create"; |
| | | subTabsName.value = "bom"; |
| | | applySchema(); |
| | | await formApi.resetForm(); |
| | | await formApi.setValues({ |
| | | clientId: current.clientId, |
| | | name: `${bomRow.itemName}ã${bomRow.quantity}ã${ |
| | | bomRow.unitMeasureName || "" |
| | | }`, |
| | | orderSourceCode: current.orderSourceCode, |
| | | orderSourceType: current.orderSourceType, |
| | | parentId: current.id, |
| | | productId: bomRow.itemId, |
| | | quantity: bomRow.quantity, |
| | | requestDate: current.requestDate, |
| | | type: current.type, |
| | | vendorId: current.vendorId, |
| | | }); |
| | | // 设置å½å产å IDï¼è§¦åå·¥åºå è½½ |
| | | currentProductId.value = bomRow.itemId; |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | message.info("å·²ä» BOM ç©æé¢å¡«å订åï¼è¯·è¡¥å
订åç¼ç çä¿¡æ¯åä¿å"); |
| | | } |
| | | |
| | | /** å·¥åºå表åååè° */ |
| | |
| | | parentRow?: MesProWorkOrderApi.WorkOrder; |
| | | }>(); |
| | | formType.value = data.formType; |
| | | subTabsName.value = "bom"; |
| | | subTabsName.value = "process"; |
| | | tempProcessList.value = []; |
| | | applySchema(); |
| | | if (data?.id) { |
| | |
| | | class="w-3/5" |
| | | content-class="!max-h-[80vh] overflow-y-auto"> |
| | | <Form class="mx-4" /> |
| | | <!-- BOM / å·¥åº / ç©æéæ± Tab --> |
| | | <!-- å·¥åº / ç©æéæ± Tab --> |
| | | <template v-if="showTabs"> |
| | | <Tabs v-model:active-key="subTabsName" |
| | | class="mx-4"> |
| | | <Tabs.TabPane key="bom" |
| | | tab="订å BOM"> |
| | | <BomList v-if="formData?.id" |
| | | :form-type="formType" |
| | | :work-order="formData" |
| | | :work-order-id="formData.id" |
| | | @generate-work-order="handleGenerateWorkOrder" /> |
| | | <div v-else class="text-gray-400 text-center py-8"> |
| | | 请å
ä¿åå·¥åååé
ç½® BOM |
| | | </div> |
| | | </Tabs.TabPane> |
| | | <Tabs.TabPane key="process" |
| | | tab="å·¥åº" |
| | | forceRender> |