| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <module type="WEB_MODULE" version="4"> |
| | | <component name="NewModuleRootManager"> |
| | | <content url="file://$MODULE_DIR$" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <excludeFolder url="file://$MODULE_DIR$/node_modules" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/.pnpm" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/.vite" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/.cache" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/dist" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/build" /> |
| | | </content> |
| | | <orderEntry type="inheritedJdk" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | | </component> |
| | |
| | | import type { PageParam, PageResult } from '#/packages/effects/request/src'; |
| | | import type { PageParam, PageResult } from "#/packages/effects/request/src"; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | import { requestClient } from "#/api/request"; |
| | | |
| | | export namespace MdmUnitApi { |
| | | /** 计éåä½ä¿¡æ¯ */ |
| | |
| | | |
| | | /** æ¥è¯¢è®¡éåä½å页 */ |
| | | export function getUnitPage(params: PageParam) { |
| | | return requestClient.get<PageResult<MdmUnitApi.Unit>>('/mdm/unit/page', { |
| | | return requestClient.get<PageResult<MdmUnitApi.Unit>>("/mdm/unit/page", { |
| | | params, |
| | | }); |
| | | } |
| | |
| | | |
| | | /** æ°å¢è®¡éåä½ */ |
| | | export function createUnit(data: MdmUnitApi.Unit) { |
| | | return requestClient.post('/mdm/unit/create', data); |
| | | return requestClient.post("/mdm/unit/create", data); |
| | | } |
| | | |
| | | /** ä¿®æ¹è®¡éåä½ */ |
| | | export function updateUnit(data: MdmUnitApi.Unit) { |
| | | return requestClient.put('/mdm/unit/update', data); |
| | | return requestClient.put("/mdm/unit/update", data); |
| | | } |
| | | |
| | | /** å é¤è®¡éåä½ */ |
| | |
| | | /** å·¥èºåæ° */ |
| | | export interface Parameter { |
| | | id?: number; |
| | | code?: string; |
| | | name?: string; |
| | | type?: number; |
| | | unit?: string; |
| | | requiredFlag?: boolean; |
| | | dictType?: string; |
| | | apiUrl?: string; |
| | | paramCode?: string; |
| | | paramName?: string; |
| | | paramType?: number; |
| | | unitMeasureId?: number; |
| | | unitMeasureName?: string; |
| | | required?: boolean; |
| | | remark?: string; |
| | | createTime?: Date; |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢å·¥èºåæ°å页 */ |
| | | export function getParameterPage(params: PageParam) { |
| | | export function getParameterPage(params: PageParam & { |
| | | paramCode?: string; |
| | | paramName?: string; |
| | | paramType?: number; |
| | | }) { |
| | | return requestClient.get<PageResult<MesPdParameterApi.Parameter>>( |
| | | '/mes/pro/process-design/parameter/page', |
| | | '/mes/pd/process-param/page', |
| | | { params }, |
| | | ); |
| | | } |
| | |
| | | /** æ¥è¯¢å·¥èºåæ°ç²¾ç®å表 */ |
| | | export function getParameterSimpleList() { |
| | | return requestClient.get<MesPdParameterApi.Parameter[]>( |
| | | '/mes/pro/process-design/parameter/simple-list', |
| | | '/mes/pd/process-param/simple-list', |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢å·¥èºåæ°è¯¦æ
*/ |
| | | export function getParameter(id: number) { |
| | | return requestClient.get<MesPdParameterApi.Parameter>( |
| | | `/mes/pro/process-design/parameter/get?id=${id}`, |
| | | `/mes/pd/process-param/get?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** æ°å¢å·¥èºåæ° */ |
| | | export function createParameter(data: MesPdParameterApi.Parameter) { |
| | | return requestClient.post( |
| | | '/mes/pro/process-design/parameter/create', |
| | | '/mes/pd/process-param/create', |
| | | data, |
| | | ); |
| | | } |
| | |
| | | /** ä¿®æ¹å·¥èºåæ° */ |
| | | export function updateParameter(data: MesPdParameterApi.Parameter) { |
| | | return requestClient.put( |
| | | '/mes/pro/process-design/parameter/update', |
| | | '/mes/pd/process-param/update', |
| | | data, |
| | | ); |
| | | } |
| | |
| | | /** å é¤å·¥èºåæ° */ |
| | | export function deleteParameter(id: number) { |
| | | return requestClient.delete( |
| | | `/mes/pro/process-design/parameter/delete?id=${id}`, |
| | | `/mes/pd/process-param/delete?id=${id}`, |
| | | ); |
| | | } |
| | | |
| | | /** 导åºå·¥èºåæ° */ |
| | | export function exportParameterExcel(params: any) { |
| | | return requestClient.download( |
| | | '/mes/pd/process-param/export-excel', |
| | | { params }, |
| | | ); |
| | | } |
| | |
| | | import type { PageParam, PageResult } from '../../../../../packages/effects/request/src'; |
| | | import type { PageParam, PageResult } from "../../../../../packages/effects/request/src"; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | import { requestClient } from "#/api/request"; |
| | | |
| | | export namespace MesPdTemplateApi { |
| | | /** æ¨¡æ¿æç» */ |
| | | export interface TemplateDetail { |
| | | id?: number; |
| | | templateId?: number; |
| | | processParamId?: number; |
| | | paramCode?: string; |
| | | paramName?: string; |
| | | paramType?: number; |
| | | unitMeasureName?: string; |
| | | required?: boolean; |
| | | remark?: string; |
| | | } |
| | | |
| | | /** å·¥èºåæ°æ¨¡æ¿ */ |
| | | export interface Template { |
| | | id?: number; |
| | | name?: string; |
| | | type?: number; |
| | | parameterIds?: number[]; |
| | | createUser?: string; |
| | | templateCode?: string; |
| | | templateName?: string; |
| | | templateType?: number; |
| | | remark?: string; |
| | | details?: TemplateDetail[]; |
| | | createTime?: Date; |
| | | } |
| | | } |
| | | |
| | | /** æ¥è¯¢å·¥èºåæ°æ¨¡æ¿å页 */ |
| | | export function getTemplatePage(params: PageParam) { |
| | | return requestClient.get<PageResult<MesPdTemplateApi.Template>>( |
| | | '/mes/pro/process-design/template/page', |
| | | { params }, |
| | | ); |
| | | export function getTemplatePage( |
| | | params: PageParam & { |
| | | templateCode?: string; |
| | | templateName?: string; |
| | | templateType?: number; |
| | | }, |
| | | ) { |
| | | return requestClient.get<PageResult<MesPdTemplateApi.Template>>("/mes/pd/process-param-template/page", { params }); |
| | | } |
| | | |
| | | /** æ¥è¯¢å·¥èºåæ°æ¨¡æ¿è¯¦æ
*/ |
| | | export function getTemplate(id: number) { |
| | | return requestClient.get<MesPdTemplateApi.Template>( |
| | | `/mes/pro/process-design/template/get?id=${id}`, |
| | | ); |
| | | return requestClient.get<MesPdTemplateApi.Template>(`/mes/pd/process-param-template/get?id=${id}`); |
| | | } |
| | | |
| | | /** æ°å¢å·¥èºåæ°æ¨¡æ¿ */ |
| | | export function createTemplate(data: MesPdTemplateApi.Template) { |
| | | return requestClient.post( |
| | | '/mes/pro/process-design/template/create', |
| | | data, |
| | | ); |
| | | return requestClient.post("/mes/pd/process-param-template/create", data); |
| | | } |
| | | |
| | | /** ä¿®æ¹å·¥èºåæ°æ¨¡æ¿ */ |
| | | export function updateTemplate(data: MesPdTemplateApi.Template) { |
| | | return requestClient.put( |
| | | '/mes/pro/process-design/template/update', |
| | | data, |
| | | ); |
| | | return requestClient.put("/mes/pd/process-param-template/update", data); |
| | | } |
| | | |
| | | /** å é¤å·¥èºåæ°æ¨¡æ¿ */ |
| | | export function deleteTemplate(id: number) { |
| | | return requestClient.delete( |
| | | `/mes/pro/process-design/template/delete?id=${id}`, |
| | | ); |
| | | return requestClient.delete(`/mes/pd/process-param-template/delete?id=${id}`); |
| | | } |
| | | |
| | | /** 导åºå·¥èºåæ°æ¨¡æ¿ */ |
| | | export function exportTemplateExcel(params: any) { |
| | | return requestClient.download("/mes/pd/process-param-template/export-excel", { params }); |
| | | } |
| | |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | /** æ ¹æ®éè´è®¢åçæå°è´§éç¥å */ |
| | | export function generateArrivalNoticeFromPurchaseOrder(purchaseOrderId: number) { |
| | | return requestClient.post<number>( |
| | | `/mes/wm/arrival-notice/generate-from-purchase-order?purchaseOrderId=${purchaseOrderId}`, |
| | | ); |
| | | } |
| | |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | /** æ ¹æ®å°è´§éç¥åçæéè´å
¥åºå */ |
| | | export function generateItemReceiptFromArrivalNotice(arrivalNoticeId: number) { |
| | | return requestClient.post<number>( |
| | | `/mes/wm/item-receipt/generate-from-arrival-notice?arrivalNoticeId=${arrivalNoticeId}`, |
| | | ); |
| | | } |
| | | |
| | | /** æäº¤éè´å
¥åºåå®¡æ¹ */ |
| | | export function submitItemReceiptApproval( |
| | | id: number, |
| | | processDefinitionKey: string, |
| | | ) { |
| | | return requestClient.put( |
| | | `/mes/wm/item-receipt/submit-approval?id=${id}&processDefinitionKey=${processDefinitionKey}`, |
| | | ); |
| | | } |
| | |
| | | id?: number; // éè´§åç¼å· |
| | | code?: string; // éè´§åç¼å· |
| | | name?: string; // éè´§ååç§° |
| | | purchaseOrderId?: number; // éè´è®¢åç¼å· |
| | | purchaseOrderCode?: string; // éè´è®¢åå· |
| | | vendorId?: number; // ä¾åºåç¼å· |
| | | vendorCode?: string; // ä¾åºåç¼ç |
| | |
| | | } |
| | | return prefix + result; |
| | | } |
| | | |
| | | /** çç¹æ¡ä»¶ç±»åæä¸¾ */ |
| | | export const WlsStockTakingParamTypeEnum = { |
| | | WAREHOUSE: 1, // ä»åº |
| | | LOCATION: 2, // åºåº |
| | | AREA: 3, // åºä½ |
| | | ITEM: 4, // ç©æ |
| | | BATCH: 5, // æ¹æ¬¡ |
| | | QUALITY_STATUS: 6, // è´¨éç¶æ |
| | | } as const; |
| | | |
| | | /** çç¹ç±»åæä¸¾ */ |
| | | export const WlsStockTakingTypeEnum = { |
| | | STATIC: 1, // éæçç¹ |
| | | DYNAMIC: 2, // 卿çç¹ |
| | | } as const; |
| | | |
| | | /** è°æ¨ç±»åæä¸¾ */ |
| | | export const WlsTransferTypeEnum = { |
| | | INNER: 1, // å
é¨è°æ¨ |
| | | OUTER: 2, // å¤é¨è°æ¨ |
| | | } as const; |
| | |
| | | }, |
| | | children: [ |
| | | { |
| | | path: 'wm/warehouse/location', |
| | | name: 'MesWmLocation', |
| | | meta: { |
| | | title: 'åºåºè®¾ç½®', |
| | | activePath: '/mes/wm/warehouse', |
| | | }, |
| | | component: () => import('#/views/mes/wm/warehouse/location/index.vue'), |
| | | }, |
| | | { |
| | | path: 'wm/warehouse/area', |
| | | name: 'MesWmArea', |
| | | meta: { |
| | | title: 'åºä½è®¾ç½®', |
| | | activePath: '/mes/wm/warehouse', |
| | | }, |
| | | component: () => import('#/views/mes/wm/warehouse/area/index.vue'), |
| | | }, |
| | | { |
| | | path: 'wm/barcode/config', |
| | | name: 'MesWmBarcodeConfig', |
| | | meta: { |
| | | title: 'æ¡ç é
ç½®', |
| | | activePath: '/mes/wm/barcode', |
| | | }, |
| | | component: () => import('#/views/mes/wm/barcode/config/index.vue'), |
| | | }, |
| | | { |
| | | path: 'pro/task/gantt-edit', |
| | | name: 'MesProTaskGanttEdit', |
| | | meta: { |
| | |
| | | getItemReceiptLinePage, |
| | | } from '#/api/mes/wm/itemreceipt/line'; |
| | | import { $t } from '#/locales'; |
| | | import { PrinterLabel } from '#/views/mes/wm/barcode/components'; |
| | | import { PrinterLabel } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | import type { FormType } from "../data"; |
| | | |
| | | import type { MesDvMachineryApi } from '#/api/mes/dv/machinery'; |
| | | import type { MesDvMachineryApi } from "#/api/mes/dv/machinery"; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | import { computed, ref } from "vue"; |
| | | |
| | | import { useVbenModal } from '../../../../../packages/effects/common-ui/src'; |
| | | import { BarcodeBizTypeEnum } from '../../../../../packages/constants/src'; |
| | | import { useVbenModal } from "../../../../../packages/effects/common-ui/src"; |
| | | import { BarcodeBizTypeEnum } from "../../../../../packages/constants/src"; |
| | | |
| | | import { Button, message, Tabs } from 'ant-design-vue'; |
| | | import { Button, message, Tabs } from "ant-design-vue"; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createMachinery, |
| | | getMachinery, |
| | | updateMachinery, |
| | | } from '#/api/mes/dv/machinery'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { useVbenForm } from "#/adapter/form"; |
| | | import { |
| | | createMachinery, |
| | | getMachinery, |
| | | updateMachinery, |
| | | } from "#/api/mes/dv/machinery"; |
| | | import { $t } from "#/locales"; |
| | | import { BarcodeDetail } from "#/views/wls/barcode/components"; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import CheckRecordList from './check-record-list.vue'; |
| | | import MaintenRecordList from './mainten-record-list.vue'; |
| | | import RepairList from './repair-list.vue'; |
| | | import { useFormSchema } from "../data"; |
| | | import CheckRecordList from "./check-record-list.vue"; |
| | | import MaintenRecordList from "./mainten-record-list.vue"; |
| | | import RepairList from "./repair-list.vue"; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); // è¡¨åæ¨¡å¼ |
| | | const subTabsName = ref('check'); // å½åèµæºé¡µç¾ |
| | | const formData = ref<MesDvMachineryApi.Machinery>(); |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | const isDetail = computed(() => formType.value === 'detail'); // æ¯å¦æ¥çæ¨¡å¼ |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return 'æ¥ç设å¤'; |
| | | } |
| | | return formType.value === 'update' ? 'ä¿®æ¹è®¾å¤' : 'æ°å¢è®¾å¤'; |
| | | }); |
| | | const emit = defineEmits(["success"]); |
| | | const formType = ref<FormType>("create"); // è¡¨åæ¨¡å¼ |
| | | const subTabsName = ref("check"); // å½åèµæºé¡µç¾ |
| | | const formData = ref<MesDvMachineryApi.Machinery>(); |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | const isDetail = computed(() => formType.value === "detail"); // æ¯å¦æ¥çæ¨¡å¼ |
| | | const getTitle = computed(() => { |
| | | if (formType.value === "detail") { |
| | | return "æ¥ç设å¤"; |
| | | } |
| | | return formType.value === "update" ? "ä¿®æ¹è®¾å¤" : "æ°å¢è®¾å¤"; |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: "w-full", |
| | | }, |
| | | formItemClass: "col-span-1", |
| | | labelWidth: 110, |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | wrapperClass: 'grid-cols-3', |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | }); |
| | | wrapperClass: "grid-cols-3", |
| | | layout: "horizontal", |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | }); |
| | | |
| | | /** æ¥çè®¾å¤æ¡ç */ |
| | | function handleBarcode() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | /** æ¥çè®¾å¤æ¡ç */ |
| | | function handleBarcode() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | formData.value.id, |
| | | BarcodeBizTypeEnum.MACHINERY, |
| | | formData.value.code, |
| | | formData.value.name |
| | | ); |
| | | } |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | formData.value.id, |
| | | BarcodeBizTypeEnum.MACHINERY, |
| | | formData.value.code, |
| | | formData.value.name, |
| | | ); |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (isDetail.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesDvMachineryApi.Machinery; |
| | | try { |
| | | await (data.id ? updateMachinery(data) : createMachinery(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; |
| | | } |
| | | subTabsName.value = 'check'; |
| | | // å è½½æ°æ® |
| | | 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) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getMachinery(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (isDetail.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesDvMachineryApi.Machinery; |
| | | try { |
| | | await (data.id ? updateMachinery(data) : createMachinery(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; |
| | | } |
| | | subTabsName.value = "check"; |
| | | // å è½½æ°æ® |
| | | 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) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getMachinery(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-4/5"> |
| | | <Modal :title="getTitle" |
| | | class="w-4/5"> |
| | | <Form class="mx-4" /> |
| | | <Tabs |
| | | v-if="formType !== 'create' && formData?.id" |
| | | v-model:active-key="subTabsName" |
| | | class="mx-4 mt-4" |
| | | > |
| | | <Tabs.TabPane key="check" tab="ç¹æ£è®°å½"> |
| | | <Tabs v-if="formType !== 'create' && formData?.id" |
| | | v-model:active-key="subTabsName" |
| | | class="mx-4 mt-4"> |
| | | <Tabs.TabPane key="check" |
| | | tab="ç¹æ£è®°å½"> |
| | | <CheckRecordList :machinery-id="formData.id" /> |
| | | </Tabs.TabPane> |
| | | <Tabs.TabPane key="mainten" tab="ä¿å
»è®°å½"> |
| | | <Tabs.TabPane key="mainten" |
| | | tab="ä¿å
»è®°å½"> |
| | | <MaintenRecordList :machinery-id="formData.id" /> |
| | | </Tabs.TabPane> |
| | | <Tabs.TabPane key="repair" tab="维修记å½"> |
| | | <Tabs.TabPane key="repair" |
| | | tab="维修记å½"> |
| | | <RepairList :machinery-id="formData.id" /> |
| | | </Tabs.TabPane> |
| | | </Tabs> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center"> |
| | | <Button |
| | | v-if="isDetail && formData?.id" |
| | | type="primary" |
| | | @click="handleBarcode" |
| | | > |
| | | <Button v-if="isDetail && formData?.id" |
| | | type="primary" |
| | | @click="handleBarcode"> |
| | | æ¥çæ¡ç |
| | | </Button> |
| | | </div> |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesMdItemApi } from '#/api/mes/md/item'; |
| | | import type { MesMdItemTypeApi } from '#/api/mes/md/item/type'; |
| | | import type { VxeTableGridOptions } from "#/adapter/vxe-table"; |
| | | import type { MesMdItemApi } from "#/api/mes/md/item"; |
| | | import type { MesMdItemTypeApi } from "#/api/mes/md/item/type"; |
| | | |
| | | import { nextTick, ref } from 'vue'; |
| | | import { nextTick, ref } from "vue"; |
| | | |
| | | import { CommonStatusEnum } from '../../../../../packages/constants/src'; |
| | | import { CommonStatusEnum } from "../../../../../packages/constants/src"; |
| | | |
| | | import { Card, message, Modal } from 'ant-design-vue'; |
| | | import { Card, message, Modal } from "ant-design-vue"; |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getItemPage } from '#/api/mes/md/item'; |
| | | import { MdItemTypeTree } from '#/views/mes/md/item/type/components'; |
| | | import { useVbenVxeGrid } from "#/adapter/vxe-table"; |
| | | import { getItemPage } from "#/api/mes/md/item"; |
| | | import { MdItemTypeTree } from "#/views/mes/md/item/type/components"; |
| | | |
| | | import { useItemSelectGridColumns, useItemSelectGridFormSchema } from '../data'; |
| | | import { useItemSelectGridColumns, useItemSelectGridFormSchema } from "../data"; |
| | | |
| | | defineOptions({ name: 'MdItemSelectDialog' }); |
| | | defineOptions({ name: "MdItemSelectDialog" }); |
| | | |
| | | const emit = defineEmits<{ |
| | | selected: [rows: MesMdItemApi.Item[]]; |
| | | }>(); |
| | | const emit = defineEmits<{ |
| | | selected: [rows: MesMdItemApi.Item[]]; |
| | | }>(); |
| | | |
| | | const open = ref(false); // å¼¹çªæ¯å¦æå¼ |
| | | const multiple = ref(true); // æ¯å¦å¤é |
| | | const selectedRows = ref<MesMdItemApi.Item[]>([]); // å·²éç©æå表 |
| | | const selectedItemTypeId = ref<number>(); // å½åçéåç±»ç¼å· |
| | | const preSelectedIds = ref<number[]>([]); // é¢éç©æç¼å·å表 |
| | | const typeTreeRef = ref<InstanceType<typeof MdItemTypeTree>>(); // ç©æåç±»æ |
| | | const open = ref(false); // å¼¹çªæ¯å¦æå¼ |
| | | const multiple = ref(true); // æ¯å¦å¤é |
| | | const selectedRows = ref<MesMdItemApi.Item[]>([]); // å·²éç©æå表 |
| | | const selectedItemTypeId = ref<number>(); // å½åçéåç±»ç¼å· |
| | | const preSelectedIds = ref<number[]>([]); // é¢éç©æç¼å·å表 |
| | | const typeTreeRef = ref<InstanceType<typeof MdItemTypeTree>>(); // ç©æåç±»æ |
| | | |
| | | /** è·åå½åè¡¨æ ¼æ°æ® */ |
| | | function getTableRows() { |
| | | return gridApi.grid.getTableData().fullData as MesMdItemApi.Item[]; |
| | | } |
| | | |
| | | /** è·åå¤éè®°å½ï¼å
å« VXE reserve è·¨é¡µè®°å½ */ |
| | | function getMultipleSelectedRows() { |
| | | const selectedMap = new Map<number, MesMdItemApi.Item>(); |
| | | const records = [ |
| | | ...(gridApi.grid.getCheckboxReserveRecords?.() ?? []), |
| | | ...(gridApi.grid.getCheckboxRecords?.() ?? []), |
| | | ] as MesMdItemApi.Item[]; |
| | | records.forEach((row) => { |
| | | const rowId = row.id; |
| | | if (!rowId) { |
| | | selectedMap.set(rowId as number, row); |
| | | } |
| | | }); |
| | | return [...selectedMap.values()]; |
| | | } |
| | | |
| | | /** å¤çå¾éåå */ |
| | | function handleCheckboxSelectChange() { |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | |
| | | /** å¤çåéåå */ |
| | | function handleRadioChange(row: MesMdItemApi.Item) { |
| | | selectedRows.value = [row]; |
| | | } |
| | | |
| | | /** å¤é模å¼ä¸åæ¢è¡å¾é */ |
| | | async function toggleMultipleRow(row: MesMdItemApi.Item) { |
| | | const selected = gridApi.grid.isCheckedByCheckboxRow(row); |
| | | await gridApi.grid.setCheckboxRow(row, !selected); |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | |
| | | /** å¤çè¡åå» */ |
| | | async function handleCellDblclick({ row }: { row: MesMdItemApi.Item }) { |
| | | if (multiple.value) { |
| | | await toggleMultipleRow(row); |
| | | return; |
| | | /** è·åå½åè¡¨æ ¼æ°æ® */ |
| | | function getTableRows() { |
| | | return gridApi.grid.getTableData().fullData as MesMdItemApi.Item[]; |
| | | } |
| | | selectedRows.value = [row]; |
| | | await gridApi.grid.setRadioRow(row); |
| | | handleConfirm(); |
| | | } |
| | | |
| | | /** æåç±»çéç©æ */ |
| | | function handleItemTypeNodeClick(row: MesMdItemTypeApi.ItemType | undefined) { |
| | | selectedItemTypeId.value = row?.id; |
| | | gridApi.query(); |
| | | } |
| | | /** è·åå¤éè®°å½ï¼å
å« VXE reserve è·¨é¡µè®°å½ */ |
| | | function getMultipleSelectedRows() { |
| | | const selectedMap = new Map<number, MesMdItemApi.Item>(); |
| | | const records = [ |
| | | ...(gridApi.grid.getCheckboxReserveRecords?.() ?? []), |
| | | ...(gridApi.grid.getCheckboxRecords?.() ?? []), |
| | | ] as MesMdItemApi.Item[]; |
| | | records.forEach(row => { |
| | | const rowId = row.id; |
| | | if (rowId) { |
| | | selectedMap.set(rowId, row); |
| | | } |
| | | }); |
| | | return [...selectedMap.values()]; |
| | | } |
| | | |
| | | /** åæ¾é¢éç©æ */ |
| | | async function applyPreSelection() { |
| | | if (preSelectedIds.value.length === 0) { |
| | | return; |
| | | } |
| | | const rows = getTableRows(); |
| | | 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) { |
| | | /** å¤çå¾éåå */ |
| | | function handleCheckboxSelectChange() { |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useItemSelectGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useItemSelectGridColumns(true), |
| | | height: 560, |
| | | keepSource: true, |
| | | checkboxConfig: { |
| | | highlight: true, |
| | | range: true, |
| | | reserve: true, |
| | | /** å¤çåéåå */ |
| | | function handleRadioChange(row: MesMdItemApi.Item) { |
| | | selectedRows.value = [row]; |
| | | } |
| | | |
| | | /** å¤é模å¼ä¸åæ¢è¡å¾é */ |
| | | async function toggleMultipleRow(row: MesMdItemApi.Item) { |
| | | const selected = gridApi.grid.isCheckedByCheckboxRow(row); |
| | | await gridApi.grid.setCheckboxRow(row, !selected); |
| | | selectedRows.value = getMultipleSelectedRows(); |
| | | } |
| | | |
| | | /** å¤çè¡åå» */ |
| | | async function handleCellDblclick({ row }: { row: MesMdItemApi.Item }) { |
| | | if (multiple.value) { |
| | | await toggleMultipleRow(row); |
| | | return; |
| | | } |
| | | selectedRows.value = [row]; |
| | | await gridApi.grid.setRadioRow(row); |
| | | handleConfirm(); |
| | | } |
| | | |
| | | /** æåç±»çéç©æ */ |
| | | function handleItemTypeNodeClick(row: MesMdItemTypeApi.ItemType | undefined) { |
| | | selectedItemTypeId.value = row?.id; |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** åæ¾é¢éç©æ */ |
| | | async function applyPreSelection() { |
| | | if (preSelectedIds.value.length === 0) { |
| | | return; |
| | | } |
| | | const rows = getTableRows(); |
| | | 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: useItemSelectGridFormSchema(), |
| | | }, |
| | | radioConfig: { |
| | | highlight: true, |
| | | trigger: 'row', |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getItemPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | itemTypeId: selectedItemTypeId.value, |
| | | status: CommonStatusEnum.ENABLE, |
| | | }); |
| | | gridOptions: { |
| | | columns: useItemSelectGridColumns(true), |
| | | height: 560, |
| | | keepSource: true, |
| | | checkboxConfig: { |
| | | highlight: true, |
| | | range: true, |
| | | reserve: true, |
| | | }, |
| | | radioConfig: { |
| | | highlight: true, |
| | | trigger: "row", |
| | | }, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getItemPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | itemTypeId: selectedItemTypeId.value, |
| | | status: CommonStatusEnum.ENABLE, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: "id", |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesMdItemApi.Item>, |
| | | gridEvents: { |
| | | cellDblclick: handleCellDblclick, |
| | | checkboxAll: handleCheckboxSelectChange, |
| | | checkboxChange: handleCheckboxSelectChange, |
| | | radioChange: ({ row }: { row: MesMdItemApi.Item }) => { |
| | | handleRadioChange(row); |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesMdItemApi.Item>, |
| | | gridEvents: { |
| | | cellDblclick: handleCellDblclick, |
| | | checkboxAll: handleCheckboxSelectChange, |
| | | checkboxChange: handleCheckboxSelectChange, |
| | | radioChange: ({ row }: { row: MesMdItemApi.Item }) => { |
| | | handleRadioChange(row); |
| | | }, |
| | | }, |
| | | }); |
| | | |
| | | /** éç½®æ¥è¯¢åéæ©ç¶æ */ |
| | | async function resetQueryState() { |
| | | selectedItemTypeId.value = undefined; |
| | | selectedRows.value = []; |
| | | typeTreeRef.value?.reset(); |
| | | 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: useItemSelectGridColumns(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; |
| | | /** éç½®æ¥è¯¢åéæ©ç¶æ */ |
| | | async function resetQueryState() { |
| | | selectedItemTypeId.value = undefined; |
| | | selectedRows.value = []; |
| | | typeTreeRef.value?.reset(); |
| | | await gridApi.grid.clearCheckboxRow(); |
| | | await gridApi.grid.clearCheckboxReserve(); |
| | | await gridApi.grid.clearRadioRow(); |
| | | await gridApi.formApi.resetForm(); |
| | | } |
| | | emit('selected', multiple.value ? rows : [rows[0]!]); |
| | | open.value = false; |
| | | } |
| | | |
| | | defineExpose({ open: openModal }); |
| | | /** æå¼ç©æéæ©å¼¹çª */ |
| | | async function openModal( |
| | | selectedIds?: number[], |
| | | options?: { multiple?: boolean } |
| | | ) { |
| | | open.value = true; |
| | | multiple.value = options?.multiple ?? true; |
| | | preSelectedIds.value = selectedIds || []; |
| | | await nextTick(); |
| | | gridApi.setGridOptions({ |
| | | columns: useItemSelectGridColumns(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="80%" |
| | | :destroy-on-close="true" |
| | | @ok="handleConfirm" |
| | | @cancel="closeModal" |
| | | > |
| | | <Modal v-model:open="open" |
| | | title="ç©æäº§åéæ©" |
| | | width="80%" |
| | | :destroy-on-close="true" |
| | | @ok="handleConfirm" |
| | | @cancel="closeModal"> |
| | | <div class="flex h-full w-full"> |
| | | <Card class="mr-4 h-full w-1/5"> |
| | | <MdItemTypeTree |
| | | ref="typeTreeRef" |
| | | @node-click="handleItemTypeNodeClick" |
| | | /> |
| | | <MdItemTypeTree ref="typeTreeRef" |
| | | @node-click="handleItemTypeNodeClick" /> |
| | | </Card> |
| | | <div class="w-4/5"> |
| | | <Grid table-title="ç©æäº§åå表" /> |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesMdItemApi } from '#/api/mes/md/item'; |
| | | import type { MesMdItemTypeApi } from '#/api/mes/md/item/type'; |
| | | import type { VxeTableGridOptions } from "#/adapter/vxe-table"; |
| | | import type { MesMdItemApi } from "#/api/mes/md/item"; |
| | | import type { MesMdItemTypeApi } from "#/api/mes/md/item/type"; |
| | | |
| | | import { ref } from 'vue'; |
| | | import { ref } from "vue"; |
| | | |
| | | import { confirm, Page, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { DICT_TYPE } from '../../../../packages/constants/src'; |
| | | import { getDictLabel } from '../../../../packages/effects/hooks/src'; |
| | | import { downloadFileFromBlobPart } from '../../../../packages/utils/src'; |
| | | import { |
| | | confirm, |
| | | Page, |
| | | useVbenModal, |
| | | } from "../../../../packages/effects/common-ui/src"; |
| | | import { DICT_TYPE } from "../../../../packages/constants/src"; |
| | | import { getDictLabel } from "../../../../packages/effects/hooks/src"; |
| | | import { downloadFileFromBlobPart } from "../../../../packages/utils/src"; |
| | | |
| | | import { Button, Card, message } from 'ant-design-vue'; |
| | | import { Button, Card, message } from "ant-design-vue"; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteItem, |
| | | exportItem, |
| | | getItemPage, |
| | | updateItemStatus, |
| | | } from '#/api/mes/md/item'; |
| | | import { $t } from '#/locales'; |
| | | import { MdItemTypeTree } from '#/views/mes/md/item/type/components'; |
| | | import { PrinterLabel } from '#/views/mes/wm/barcode/components'; |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from "#/adapter/vxe-table"; |
| | | import { |
| | | deleteItem, |
| | | exportItem, |
| | | getItemPage, |
| | | updateItemStatus, |
| | | } from "#/api/mes/md/item"; |
| | | import { $t } from "#/locales"; |
| | | import { MdItemTypeTree } from "#/views/mes/md/item/type/components"; |
| | | import { PrinterLabel } from "#/views/wls/barcode/components"; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | import ImportForm from './modules/import-form.vue'; |
| | | import { useGridColumns, useGridFormSchema } from "./data"; |
| | | import Form from "./modules/form.vue"; |
| | | import ImportForm from "./modules/import-form.vue"; |
| | | |
| | | const selectedItemTypeId = ref<number>(); // å½åéä¸çç©æåç±»ç¼å· |
| | | const selectedItemTypeId = ref<number>(); // å½åéä¸çç©æåç±»ç¼å· |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [ImportModal, importModalApi] = useVbenModal({ |
| | | connectedComponent: ImportForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** åå»ºç©æ */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ¥çç©æ */ |
| | | function handleDetail(row: MesMdItemApi.Item) { |
| | | formModalApi.setData({ id: row.id, formType: 'detail' }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾ç©æ */ |
| | | function handleEdit(row: MesMdItemApi.Item) { |
| | | formModalApi.setData({ id: row.id, formType: 'update' }).open(); |
| | | } |
| | | |
| | | /** å é¤ç©æ */ |
| | | async function handleDelete(row: MesMdItemApi.Item) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.name]), |
| | | duration: 0, |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | try { |
| | | await deleteItem(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.name])); |
| | | |
| | | const [ImportModal, importModalApi] = useVbenModal({ |
| | | connectedComponent: ImportForm, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** åå»ºç©æ */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: "create" }).open(); |
| | | } |
| | | |
| | | /** æ¥çç©æ */ |
| | | function handleDetail(row: MesMdItemApi.Item) { |
| | | formModalApi.setData({ id: row.id, formType: "detail" }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾ç©æ */ |
| | | function handleEdit(row: MesMdItemApi.Item) { |
| | | formModalApi.setData({ id: row.id, formType: "update" }).open(); |
| | | } |
| | | |
| | | /** å é¤ç©æ */ |
| | | async function handleDelete(row: MesMdItemApi.Item) { |
| | | const hideLoading = message.loading({ |
| | | content: $t("ui.actionMessage.deleting", [row.name]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteItem(row.id!); |
| | | message.success($t("ui.actionMessage.deleteSuccess", [row.name])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 导åºç©æ */ |
| | | async function handleExport() { |
| | | const data = await exportItem(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: "ç©æäº§å.xls", source: data }); |
| | | } |
| | | |
| | | /** 导å
¥ç©æ */ |
| | | function handleImport() { |
| | | importModalApi.open(); |
| | | } |
| | | |
| | | /** åç±»æ ç¹å» */ |
| | | function handleTypeNodeClick(row: MesMdItemTypeApi.ItemType | undefined) { |
| | | selectedItemTypeId.value = row?.id; |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 导åºç©æ */ |
| | | async function handleExport() { |
| | | const data = await exportItem(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: 'ç©æäº§å.xls', source: data }); |
| | | } |
| | | |
| | | /** 导å
¥ç©æ */ |
| | | function handleImport() { |
| | | importModalApi.open(); |
| | | } |
| | | |
| | | /** åç±»æ ç¹å» */ |
| | | function handleTypeNodeClick(row: MesMdItemTypeApi.ItemType | undefined) { |
| | | selectedItemTypeId.value = row?.id; |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** æ´æ°ç©æç¶æ */ |
| | | async function handleStatusChange( |
| | | newStatus: number, |
| | | row: MesMdItemApi.Item, |
| | | ): Promise<boolean | undefined> { |
| | | try { |
| | | await confirm( |
| | | `确认è¦å°"${row.name}"ç©æåæ¢ä¸ºã${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}ãåï¼`, |
| | | ); |
| | | } catch { |
| | | return false; |
| | | /** æ´æ°ç©æç¶æ */ |
| | | async function handleStatusChange( |
| | | newStatus: number, |
| | | row: MesMdItemApi.Item |
| | | ): Promise<boolean | undefined> { |
| | | try { |
| | | await confirm( |
| | | `确认è¦å°"${row.name}"ç©æåæ¢ä¸ºã${getDictLabel( |
| | | DICT_TYPE.COMMON_STATUS, |
| | | newStatus |
| | | )}ãåï¼` |
| | | ); |
| | | } catch { |
| | | return false; |
| | | } |
| | | await updateItemStatus(row.id!, newStatus); |
| | | message.success($t("ui.actionMessage.operationSuccess")); |
| | | return true; |
| | | } |
| | | await updateItemStatus(row.id!, newStatus); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | return true; |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(handleStatusChange), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getItemPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | itemTypeId: selectedItemTypeId.value, |
| | | }); |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(handleStatusChange), |
| | | height: "auto", |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getItemPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | itemTypeId: selectedItemTypeId.value, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesMdItemApi.Item>, |
| | | }); |
| | | rowConfig: { |
| | | keyField: "id", |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesMdItemApi.Item>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <ImportModal @success="handleRefresh" /> |
| | | |
| | | <div class="flex h-full w-full"> |
| | | <Card class="mr-4 h-full w-1/6"> |
| | | <MdItemTypeTree @node-click="handleTypeNodeClick" /> |
| | |
| | | <div class="w-5/6"> |
| | | <Grid table-title="ç©æäº§åå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | <TableAction :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['ç©æ']), |
| | | type: 'primary', |
| | |
| | | auth: ['mes:md-item:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | ]" /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | <Button type="link" |
| | | @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <div class="flex items-center justify-center"> |
| | | <TableAction |
| | | :actions="[ |
| | | <TableAction :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | <PrinterLabel |
| | | :biz-id="row.id" |
| | | :biz-code="row.code" |
| | | biz-type="ITEM" |
| | | /> |
| | | ]" /> |
| | | <PrinterLabel :biz-id="row.id" |
| | | :biz-code="row.code" |
| | | biz-type="ITEM" /> |
| | | </div> |
| | | </template> |
| | | </Grid> |
| | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { createItem, getItem, updateItem } from '#/api/mes/md/item'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { BarcodeDetail } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import ItemBatchConfigForm from './item-batch-config-form.vue'; |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesMdVendorApi } from '#/api/mes/md/vendor'; |
| | | |
| | | import { computed, ref, useAttrs, watch } from 'vue'; |
| | | import { computed, ref, useAttrs } from 'vue'; |
| | | |
| | | import { IconifyIcon } from '../../../../../packages/icons/src'; |
| | | |
| | | import { Input, Tooltip } from 'ant-design-vue'; |
| | | |
| | | import { getVendor } from '#/api/mes/md/vendor'; |
| | | |
| | | import MdVendorSelectDialog from './select-dialog.vue'; |
| | | |
| | |
| | | disabled?: boolean; |
| | | modelValue?: number; |
| | | placeholder?: string; |
| | | vendorName?: string; |
| | | }>(), |
| | | { |
| | | allowClear: true, |
| | | disabled: false, |
| | | modelValue: undefined, |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | vendorName: undefined, |
| | | }, |
| | | ); |
| | | const emit = defineEmits<{ |
| | | change: [item: MesMdVendorApi.Vendor | undefined]; |
| | | 'update:modelValue': [value: number | undefined]; |
| | | }>(); |
| | | const attrs = useAttrs(); // éä¼ å±æ§ |
| | | const dialogRef = ref<InstanceType<typeof MdVendorSelectDialog>>(); // ä¾åºåéæ©å¼¹çª |
| | | const hovering = ref(false); // æ¯å¦æ¬å |
| | | const selectedItem = ref<MesMdVendorApi.Vendor>(); // å½åéä¸ä¾åºå |
| | | const attrs = useAttrs(); |
| | | const dialogRef = ref<InstanceType<typeof MdVendorSelectDialog>>(); |
| | | const hovering = ref(false); |
| | | const selectedItem = ref<MesMdVendorApi.Vendor>(); |
| | | |
| | | const displayLabel = computed(() => selectedItem.value?.name ?? ''); // éæ©å¨å±ç¤ºåç§° |
| | | const displayLabel = computed(() => props.vendorName || selectedItem.value?.name || ''); |
| | | const showClear = computed( |
| | | () => |
| | | props.allowClear && |
| | |
| | | props.modelValue !== null, |
| | | ); |
| | | |
| | | /** æ ¹æ®ä¾åºåç¼å·åæ¾éæ©å¨ */ |
| | | async function resolveItemById(id: number | undefined) { |
| | | if (!id) { |
| | | selectedItem.value = undefined; |
| | | return; |
| | | } |
| | | if (selectedItem.value?.id === id) { |
| | | return; |
| | | } |
| | | selectedItem.value = await getVendor(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; |
| | |
| | | dialogRef.value?.open(selectedIds, { multiple: false }); |
| | | } |
| | | |
| | | /** åå¡«éä¸çä¾åºå */ |
| | | function handleSelected(rows: MesMdVendorApi.Vendor[]) { |
| | | const item = rows[0]; |
| | | if (!item) { |
| | |
| | | getWorkstationPage, |
| | | } from '#/api/mes/md/workstation'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { BarcodeDetail } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | import type { FormType } from "../data"; |
| | | |
| | | import type { MesMdWorkstationApi } from '#/api/mes/md/workstation'; |
| | | import type { MesMdWorkstationApi } from "#/api/mes/md/workstation"; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | import { computed, ref } from "vue"; |
| | | |
| | | import { useVbenModal } from '../../../../../packages/effects/common-ui/src'; |
| | | import { BarcodeBizTypeEnum } from '../../../../../packages/constants/src'; |
| | | import { useVbenModal } from "../../../../../packages/effects/common-ui/src"; |
| | | import { BarcodeBizTypeEnum } from "../../../../../packages/constants/src"; |
| | | |
| | | import { Button, message, Tabs } from 'ant-design-vue'; |
| | | import { Button, message, Tabs } from "ant-design-vue"; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createWorkstation, |
| | | getWorkstation, |
| | | updateWorkstation, |
| | | } from '#/api/mes/md/workstation'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { useVbenForm } from "#/adapter/form"; |
| | | import { |
| | | createWorkstation, |
| | | getWorkstation, |
| | | updateWorkstation, |
| | | } from "#/api/mes/md/workstation"; |
| | | import { $t } from "#/locales"; |
| | | import { BarcodeDetail } from "#/views/wls/barcode/components"; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import MachineList from './machine-list.vue'; |
| | | import ToolList from './tool-list.vue'; |
| | | import WorkerList from './worker-list.vue'; |
| | | import { useFormSchema } from "../data"; |
| | | import MachineList from "./machine-list.vue"; |
| | | import ToolList from "./tool-list.vue"; |
| | | import WorkerList from "./worker-list.vue"; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); // è¡¨åæ¨¡å¼ |
| | | const subTabsName = ref('machine'); // å½åèµæºé¡µç¾ |
| | | const formData = ref<MesMdWorkstationApi.Workstation>(); |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | const emit = defineEmits(["success"]); |
| | | const formType = ref<FormType>("create"); // è¡¨åæ¨¡å¼ |
| | | const subTabsName = ref("machine"); // å½åèµæºé¡µç¾ |
| | | const formData = ref<MesMdWorkstationApi.Workstation>(); |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | |
| | | const isDetail = computed(() => formType.value === 'detail'); // æ¯å¦æ¥çæ¨¡å¼ |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return 'æ¥çå·¥ä½ç«'; |
| | | } |
| | | return formType.value === 'update' ? 'ä¿®æ¹å·¥ä½ç«' : 'æ°å¢å·¥ä½ç«'; |
| | | }); |
| | | const isDetail = computed(() => formType.value === "detail"); // æ¯å¦æ¥çæ¨¡å¼ |
| | | const getTitle = computed(() => { |
| | | if (formType.value === "detail") { |
| | | return "æ¥çå·¥ä½ç«"; |
| | | } |
| | | return formType.value === "update" ? "ä¿®æ¹å·¥ä½ç«" : "æ°å¢å·¥ä½ç«"; |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: "w-full", |
| | | }, |
| | | formItemClass: "col-span-1", |
| | | labelWidth: 110, |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | wrapperClass: 'grid-cols-3', |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | }); |
| | | wrapperClass: "grid-cols-3", |
| | | layout: "horizontal", |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | }); |
| | | |
| | | /** æ¥çå·¥ä½ç«æ¡ç */ |
| | | function handleBarcode() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | /** æ¥çå·¥ä½ç«æ¡ç */ |
| | | function handleBarcode() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | formData.value.id, |
| | | BarcodeBizTypeEnum.WORKSTATION, |
| | | formData.value.code, |
| | | formData.value.name |
| | | ); |
| | | } |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | formData.value.id, |
| | | BarcodeBizTypeEnum.WORKSTATION, |
| | | formData.value.code, |
| | | formData.value.name, |
| | | ); |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (isDetail.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesMdWorkstationApi.Workstation; |
| | | try { |
| | | if (formType.value === 'create') { |
| | | const id = await createWorkstation(data); |
| | | formData.value = { ...data, id }; |
| | | await formApi.setFieldValue('id', id); |
| | | formType.value = 'update'; |
| | | } else { |
| | | await updateWorkstation(data); |
| | | formData.value = { ...formData.value, ...data }; |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (isDetail.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | subTabsName.value = 'machine'; |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(data.formType, formApi) }); |
| | | formApi.setDisabled(formType.value === 'detail'); |
| | | modalApi.setState({ showConfirmButton: formType.value !== 'detail' }); |
| | | if (!data?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getWorkstation(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesMdWorkstationApi.Workstation; |
| | | try { |
| | | if (formType.value === "create") { |
| | | const id = await createWorkstation(data); |
| | | formData.value = { ...data, id }; |
| | | await formApi.setFieldValue("id", id); |
| | | formType.value = "update"; |
| | | } else { |
| | | await updateWorkstation(data); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } |
| | | emit("success"); |
| | | message.success($t("ui.actionMessage.operationSuccess")); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | subTabsName.value = "machine"; |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(data.formType, formApi) }); |
| | | formApi.setDisabled(formType.value === "detail"); |
| | | modalApi.setState({ showConfirmButton: formType.value !== "detail" }); |
| | | if (!data?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getWorkstation(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-4/5"> |
| | | <Modal :title="getTitle" |
| | | class="w-4/5"> |
| | | <Form class="mx-4" /> |
| | | <Tabs |
| | | v-if="formType !== 'create' && formData?.id" |
| | | v-model:active-key="subTabsName" |
| | | class="mx-4 mt-4" |
| | | > |
| | | <Tabs.TabPane key="machine" tab="设å¤èµæº"> |
| | | <MachineList :form-type="formType" :workstation-id="formData.id" /> |
| | | <Tabs v-if="formType !== 'create' && formData?.id" |
| | | v-model:active-key="subTabsName" |
| | | class="mx-4 mt-4"> |
| | | <Tabs.TabPane key="machine" |
| | | tab="设å¤èµæº"> |
| | | <MachineList :form-type="formType" |
| | | :workstation-id="formData.id" /> |
| | | </Tabs.TabPane> |
| | | <Tabs.TabPane key="tool" tab="å·¥è£
夹å
·"> |
| | | <ToolList :form-type="formType" :workstation-id="formData.id" /> |
| | | <Tabs.TabPane key="tool" |
| | | tab="å·¥è£
夹å
·"> |
| | | <ToolList :form-type="formType" |
| | | :workstation-id="formData.id" /> |
| | | </Tabs.TabPane> |
| | | <Tabs.TabPane key="worker" tab="人åèµæº"> |
| | | <WorkerList :form-type="formType" :workstation-id="formData.id" /> |
| | | <Tabs.TabPane key="worker" |
| | | tab="人åèµæº"> |
| | | <WorkerList :form-type="formType" |
| | | :workstation-id="formData.id" /> |
| | | </Tabs.TabPane> |
| | | </Tabs> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center"> |
| | | <Button |
| | | v-if="isDetail && formData?.id" |
| | | type="primary" |
| | | @click="handleBarcode" |
| | | > |
| | | <Button v-if="isDetail && formData?.id" |
| | | type="primary" |
| | | @click="handleBarcode"> |
| | | æ¥çæ¡ç |
| | | </Button> |
| | | </div> |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | import type { FormType } from "../data"; |
| | | |
| | | import type { MesMdWorkshopApi } from '#/api/mes/md/workstation/workshop'; |
| | | import type { MesMdWorkshopApi } from "#/api/mes/md/workstation/workshop"; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | import { computed, ref } from "vue"; |
| | | |
| | | import { useVbenModal } from '../../../../../../packages/effects/common-ui/src'; |
| | | import { BarcodeBizTypeEnum } from '../../../../../../packages/constants/src'; |
| | | import { useVbenModal } from "../../../../../../packages/effects/common-ui/src"; |
| | | import { BarcodeBizTypeEnum } from "../../../../../../packages/constants/src"; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | import { Button, message } from "ant-design-vue"; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createWorkshop, |
| | | getWorkshop, |
| | | updateWorkshop, |
| | | } from '#/api/mes/md/workstation/workshop'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { useVbenForm } from "#/adapter/form"; |
| | | import { |
| | | createWorkshop, |
| | | getWorkshop, |
| | | updateWorkshop, |
| | | } from "#/api/mes/md/workstation/workshop"; |
| | | import { $t } from "#/locales"; |
| | | import { BarcodeDetail } from "#/views/wls/barcode/components"; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import { useFormSchema } from "../data"; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); // è¡¨åæ¨¡å¼ |
| | | const formData = ref<MesMdWorkshopApi.Workshop>(); |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | const emit = defineEmits(["success"]); |
| | | const formType = ref<FormType>("create"); // è¡¨åæ¨¡å¼ |
| | | const formData = ref<MesMdWorkshopApi.Workshop>(); |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | |
| | | const isDetail = computed(() => formType.value === 'detail'); // æ¯å¦æ¥çæ¨¡å¼ |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return 'æ¥ç车é´'; |
| | | } |
| | | return formType.value === 'update' ? 'ä¿®æ¹è½¦é´' : 'æ°å¢è½¦é´'; |
| | | }); |
| | | const isDetail = computed(() => formType.value === "detail"); // æ¯å¦æ¥çæ¨¡å¼ |
| | | const getTitle = computed(() => { |
| | | if (formType.value === "detail") { |
| | | return "æ¥ç车é´"; |
| | | } |
| | | return formType.value === "update" ? "ä¿®æ¹è½¦é´" : "æ°å¢è½¦é´"; |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: "w-full", |
| | | }, |
| | | formItemClass: "col-span-1", |
| | | labelWidth: 100, |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 100, |
| | | }, |
| | | wrapperClass: 'grid-cols-2', |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | }); |
| | | wrapperClass: "grid-cols-2", |
| | | layout: "horizontal", |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | }); |
| | | |
| | | /** æ¥çè½¦é´æ¡ç */ |
| | | function handleBarcode() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | /** æ¥çè½¦é´æ¡ç */ |
| | | function handleBarcode() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | formData.value.id, |
| | | BarcodeBizTypeEnum.WORKSHOP, |
| | | formData.value.code, |
| | | formData.value.name |
| | | ); |
| | | } |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | formData.value.id, |
| | | BarcodeBizTypeEnum.WORKSHOP, |
| | | formData.value.code, |
| | | formData.value.name, |
| | | ); |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (isDetail.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesMdWorkshopApi.Workshop; |
| | | try { |
| | | await (formData.value?.id ? updateWorkshop(data) : createWorkshop(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<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(data.formType, formApi) }); |
| | | formApi.setDisabled(formType.value === 'detail'); |
| | | modalApi.setState({ showConfirmButton: formType.value !== 'detail' }); |
| | | if (!data?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getWorkshop(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (isDetail.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesMdWorkshopApi.Workshop; |
| | | try { |
| | | await (formData.value?.id ? updateWorkshop(data) : createWorkshop(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<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(data.formType, formApi) }); |
| | | formApi.setDisabled(formType.value === "detail"); |
| | | modalApi.setState({ showConfirmButton: formType.value !== "detail" }); |
| | | if (!data?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getWorkshop(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-1/2"> |
| | | <Modal :title="getTitle" |
| | | class="w-1/2"> |
| | | <Form class="mx-4" /> |
| | | <template v-if="isDetail && formData?.id" #prepend-footer> |
| | | <template v-if="isDetail && formData?.id" |
| | | #prepend-footer> |
| | | <div class="flex flex-auto items-center"> |
| | | <Button @click="handleBarcode">æ¥çæ¡ç </Button> |
| | | </div> |
| | |
| | | getCardPage, |
| | | } from '#/api/mes/pro/card'; |
| | | import { $t } from '#/locales'; |
| | | import { PrinterLabel } from '#/views/mes/wm/barcode/components'; |
| | | import { PrinterLabel } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | |
| | | updateCard, |
| | | } from '#/api/mes/pro/card'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { BarcodeDetail } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import ProcessList from './process-list.vue'; |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from "#/adapter/vxe-table"; |
| | | import type { MesProWorkOrderApi } from "#/api/mes/pro/workorder"; |
| | | |
| | | import { ref } from 'vue'; |
| | | import { ref } from "vue"; |
| | | |
| | | import { Page, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { |
| | | BarcodeBizTypeEnum, |
| | | MesProWorkOrderStatusEnum, |
| | | MesProWorkOrderTypeEnum, |
| | | } from '../../../../packages/constants/src'; |
| | | import { downloadFileFromBlobPart } from '../../../../packages/utils/src'; |
| | | import { Page, useVbenModal } from "../../../../packages/effects/common-ui/src"; |
| | | import { |
| | | BarcodeBizTypeEnum, |
| | | MesProWorkOrderStatusEnum, |
| | | MesProWorkOrderTypeEnum, |
| | | } from "../../../../packages/constants/src"; |
| | | import { downloadFileFromBlobPart } from "../../../../packages/utils/src"; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | import { Button, message } from "ant-design-vue"; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | cancelWorkOrder, |
| | | deleteWorkOrder, |
| | | exportWorkOrder, |
| | | getWorkOrderPage, |
| | | } from '#/api/mes/pro/workorder'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from "#/adapter/vxe-table"; |
| | | import { |
| | | cancelWorkOrder, |
| | | deleteWorkOrder, |
| | | exportWorkOrder, |
| | | getWorkOrderPage, |
| | | } from "#/api/mes/pro/workorder"; |
| | | import { $t } from "#/locales"; |
| | | import { BarcodeDetail } from "#/views/wls/barcode/components"; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | import { useGridColumns, useGridFormSchema } from "./data"; |
| | | import Form from "./modules/form.vue"; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建订å */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: 'create' }).open(); |
| | | } |
| | | |
| | | /** æ°å¢å订å */ |
| | | function handleAddChild(row: MesProWorkOrderApi.WorkOrder) { |
| | | formModalApi.setData({ formType: 'create', parentRow: row }).open(); |
| | | } |
| | | |
| | | /** æ¥ç订å详æ
*/ |
| | | function handleDetail(row: MesProWorkOrderApi.WorkOrder) { |
| | | formModalApi.setData({ formType: 'detail', id: row.id }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾è®¢å */ |
| | | function handleEdit(row: MesProWorkOrderApi.WorkOrder) { |
| | | formModalApi.setData({ formType: 'update', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å®æè®¢å */ |
| | | function handleFinish(row: MesProWorkOrderApi.WorkOrder) { |
| | | formModalApi.setData({ formType: 'finish', id: row.id }).open(); |
| | | } |
| | | |
| | | /** å é¤è®¢å */ |
| | | async function handleDelete(row: MesProWorkOrderApi.WorkOrder) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.code]), |
| | | duration: 0, |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | try { |
| | | await deleteWorkOrder(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | } |
| | | |
| | | /** åæ¶è®¢å */ |
| | | async function handleCancel(row: MesProWorkOrderApi.WorkOrder) { |
| | | await cancelWorkOrder(row.id!); |
| | | message.success('订å已忶'); |
| | | handleRefresh(); |
| | | } |
| | | /** å建订å */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: "create" }).open(); |
| | | } |
| | | |
| | | /** æ¥çè®¢åæ¡ç */ |
| | | function handleBarcode(row: MesProWorkOrderApi.WorkOrder) { |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | row.id!, |
| | | BarcodeBizTypeEnum.WORKORDER, |
| | | row.code, |
| | | row.name, |
| | | ); |
| | | } |
| | | /** æ°å¢å订å */ |
| | | function handleAddChild(row: MesProWorkOrderApi.WorkOrder) { |
| | | formModalApi.setData({ formType: "create", parentRow: row }).open(); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportWorkOrder(await gridApi.formApi.getValues()); |
| | | downloadFileFromBlobPart({ fileName: 'ç产订å.xls', source: data }); |
| | | } |
| | | /** æ¥ç订å详æ
*/ |
| | | function handleDetail(row: MesProWorkOrderApi.WorkOrder) { |
| | | formModalApi.setData({ formType: "detail", id: row.id }).open(); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getWorkOrderPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | /** ç¼è¾è®¢å */ |
| | | function handleEdit(row: MesProWorkOrderApi.WorkOrder) { |
| | | formModalApi.setData({ formType: "update", id: row.id }).open(); |
| | | } |
| | | |
| | | /** å®æè®¢å */ |
| | | function handleFinish(row: MesProWorkOrderApi.WorkOrder) { |
| | | formModalApi.setData({ formType: "finish", id: row.id }).open(); |
| | | } |
| | | |
| | | /** å é¤è®¢å */ |
| | | async function handleDelete(row: MesProWorkOrderApi.WorkOrder) { |
| | | const hideLoading = message.loading({ |
| | | content: $t("ui.actionMessage.deleting", [row.code]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteWorkOrder(row.id!); |
| | | message.success($t("ui.actionMessage.deleteSuccess", [row.code])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** åæ¶è®¢å */ |
| | | async function handleCancel(row: MesProWorkOrderApi.WorkOrder) { |
| | | await cancelWorkOrder(row.id!); |
| | | message.success("订å已忶"); |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** æ¥çè®¢åæ¡ç */ |
| | | function handleBarcode(row: MesProWorkOrderApi.WorkOrder) { |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | row.id!, |
| | | BarcodeBizTypeEnum.WORKORDER, |
| | | row.code, |
| | | row.name |
| | | ); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportWorkOrder(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 getWorkOrderPage({ |
| | | 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<MesProWorkOrderApi.WorkOrder>, |
| | | }); |
| | | rowConfig: { |
| | | keyField: "id", |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | treeConfig: { |
| | | parentField: "parentId", |
| | | rowField: "id", |
| | | transform: true, |
| | | expandAll: true, |
| | | reserve: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesProWorkOrderApi.WorkOrder>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <Grid table-title="ç产订åå表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | <TableAction :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['订å']), |
| | | type: 'primary', |
| | |
| | | auth: ['mes:pro-work-order:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | ]" /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)"> |
| | | <Button type="link" |
| | | @click="handleDetail(row)"> |
| | | {{ row.code }} |
| | | </Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | <TableAction :actions="[ |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | |
| | | auth: ['mes:pro-work-order:query'], |
| | | onClick: handleBarcode.bind(null, row), |
| | | }, |
| | | ]" |
| | | /> |
| | | ]" /> |
| | | </template> |
| | | </Grid> |
| | | <BarcodeDetail ref="barcodeDetailRef" /> |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | <script lang="ts" setup> |
| | | import type { FormType } from "../data"; |
| | | |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | | import type { MesProWorkOrderBomApi } from '#/api/mes/pro/workorder/bom'; |
| | | import type { MesProWorkOrderApi } from "#/api/mes/pro/workorder"; |
| | | import type { MesProWorkOrderBomApi } from "#/api/mes/pro/workorder/bom"; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | import { computed, ref } from "vue"; |
| | | |
| | | import { useVbenModal } from '../../../../../packages/effects/common-ui/src'; |
| | | import { BarcodeBizTypeEnum, MesProWorkOrderStatusEnum } from '../../../../../packages/constants/src'; |
| | | import { useVbenModal } from "../../../../../packages/effects/common-ui/src"; |
| | | import { |
| | | BarcodeBizTypeEnum, |
| | | MesProWorkOrderStatusEnum, |
| | | } from "../../../../../packages/constants/src"; |
| | | |
| | | import { Button, message, Popconfirm, Tabs } from 'ant-design-vue'; |
| | | import { Button, message, Popconfirm, Tabs } from "ant-design-vue"; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | confirmWorkOrder, |
| | | createWorkOrder, |
| | | finishWorkOrder, |
| | | getWorkOrder, |
| | | updateWorkOrder, |
| | | } from '#/api/mes/pro/workorder'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { useVbenForm } from "#/adapter/form"; |
| | | import { |
| | | confirmWorkOrder, |
| | | createWorkOrder, |
| | | finishWorkOrder, |
| | | getWorkOrder, |
| | | updateWorkOrder, |
| | | } from "#/api/mes/pro/workorder"; |
| | | import { $t } from "#/locales"; |
| | | import { BarcodeDetail } from "#/views/wls/barcode/components"; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import BomList from './bom-list.vue'; |
| | | import ItemList from './item-list.vue'; |
| | | import { useFormSchema } from "../data"; |
| | | import BomList from "./bom-list.vue"; |
| | | import ItemList from "./item-list.vue"; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesProWorkOrderApi.WorkOrder>(); |
| | | const originalSnapshot = ref(''); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äºç¡®è®¤æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | const subTabsName = ref('bom'); // å½åéä¸çå表 Tab |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | const emit = defineEmits(["success"]); |
| | | const formType = ref<FormType>("create"); |
| | | const formData = ref<MesProWorkOrderApi.WorkOrder>(); |
| | | const originalSnapshot = ref(""); // 表ååå§æ°æ®å¿«ç
§ï¼ç¨äºç¡®è®¤æ¶è·³è¿æªåæ´çä¿åè¯·æ± |
| | | const subTabsName = ref("bom"); // å½åéä¸çå表 Tab |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | |
| | | const isEditable = computed(() => |
| | | // æ¯å¦ä¸ºç¼è¾æ¨¡å¼ï¼å¯ä¿åï¼ |
| | | ['create', 'update'].includes(formType.value), |
| | | ); |
| | | const isConfirm = computed(() => formType.value === 'confirm'); // æ¯å¦ä¸ºç¡®è®¤æ¨¡å¼ |
| | | const isFinish = computed(() => formType.value === 'finish'); // æ¯å¦ä¸ºå®ææ¨¡å¼ |
| | | const canConfirm = computed( |
| | | () => |
| | | // ç¼è¾æè稿å¯ç¡®è®¤ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesProWorkOrderStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | const isChild = !!formData.value?.parentId; |
| | | switch (formType.value) { |
| | | case 'confirm': { |
| | | return '确认订å'; |
| | | } |
| | | case 'detail': { |
| | | return $t('ui.actionTitle.view', ['订å']); |
| | | } |
| | | case 'finish': { |
| | | return 'å®æè®¢å'; |
| | | } |
| | | case 'update': { |
| | | return isChild ? 'ç¼è¾å订å' : $t('ui.actionTitle.edit', ['订å']); |
| | | } |
| | | default: { |
| | | return isChild ? 'æ°å¢å订å' : $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', |
| | | }); |
| | | |
| | | /** éæ°æè½½ schema å¹¶æè¡¨åææ§å¶åºé¨ç¡®è®¤æé® */ |
| | | function applySchema() { |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | | } |
| | | |
| | | /** æ¥çè®¢åæ¡ç */ |
| | | function handleBarcode() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | formData.value.id, |
| | | BarcodeBizTypeEnum.WORKORDER, |
| | | formData.value.code, |
| | | formData.value.name, |
| | | const isEditable = computed(() => |
| | | // æ¯å¦ä¸ºç¼è¾æ¨¡å¼ï¼å¯ä¿åï¼ |
| | | ["create", "update"].includes(formType.value) |
| | | ); |
| | | } |
| | | |
| | | /** 确认订åï¼ç¼è¾ææä¿®æ¹æ¶å
ä¿åï¼å确认 */ |
| | | async function handleConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | if (isEditable.value) { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = |
| | | (await formApi.getValues()) as MesProWorkOrderApi.WorkOrder; |
| | | await updateWorkOrder({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | const isConfirm = computed(() => formType.value === "confirm"); // æ¯å¦ä¸ºç¡®è®¤æ¨¡å¼ |
| | | const isFinish = computed(() => formType.value === "finish"); // æ¯å¦ä¸ºå®ææ¨¡å¼ |
| | | const canConfirm = computed( |
| | | () => |
| | | // ç¼è¾æè稿å¯ç¡®è®¤ |
| | | formType.value === "update" && |
| | | formData.value?.status === MesProWorkOrderStatusEnum.PREPARE |
| | | ); |
| | | const getTitle = computed(() => { |
| | | const isChild = !!formData.value?.parentId; |
| | | switch (formType.value) { |
| | | case "confirm": { |
| | | return "确认订å"; |
| | | } |
| | | case "detail": { |
| | | return $t("ui.actionTitle.view", ["订å"]); |
| | | } |
| | | case "finish": { |
| | | return "å®æè®¢å"; |
| | | } |
| | | case "update": { |
| | | return isChild ? "ç¼è¾å订å" : $t("ui.actionTitle.edit", ["订å"]); |
| | | } |
| | | default: { |
| | | return isChild ? "æ°å¢å订å" : $t("ui.actionTitle.create", ["订å"]); |
| | | } |
| | | } |
| | | await confirmWorkOrder(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 finishWorkOrder(formData.value.id); |
| | | message.success('订å已宿'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** ä» 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, |
| | | }); |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | message.info('å·²ä» BOM ç©æé¢å¡«å订åï¼è¯·è¡¥å
订åç¼ç çä¿¡æ¯åä¿å'); |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (!isEditable.value) { |
| | | await modalApi.close(); |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: "w-full", |
| | | }, |
| | | formItemClass: "col-span-1", |
| | | labelWidth: 110, |
| | | }, |
| | | layout: "horizontal", |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: "grid-cols-3", |
| | | }); |
| | | |
| | | /** éæ°æè½½ schema å¹¶æè¡¨åææ§å¶åºé¨ç¡®è®¤æé® */ |
| | | function applySchema() { |
| | | formApi.setState({ schema: useFormSchema(formType.value, formApi) }); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | | } |
| | | |
| | | /** æ¥çè®¢åæ¡ç */ |
| | | function handleBarcode() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | formData.value.id, |
| | | BarcodeBizTypeEnum.WORKORDER, |
| | | formData.value.code, |
| | | formData.value.name |
| | | ); |
| | | } |
| | | |
| | | /** 确认订åï¼ç¼è¾ææä¿®æ¹æ¶å
ä¿åï¼å确认 */ |
| | | async function handleConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesProWorkOrderApi.WorkOrder; |
| | | try { |
| | | if (formData.value?.id) { |
| | | await updateWorkOrder({ ...formData.value, ...data }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createWorkOrder(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesProWorkOrderStatusEnum.PREPARE, |
| | | }; |
| | | formType.value = 'update'; |
| | | // å建æåå忢ç¼è¾æï¼éæ schema 让ã订åç¶æãåæ®µæ¾ç° |
| | | applySchema(); |
| | | await formApi.setValues(formData.value); |
| | | if (isEditable.value) { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = |
| | | (await formApi.getValues()) as MesProWorkOrderApi.WorkOrder; |
| | | await updateWorkOrder({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | await confirmWorkOrder(formData.value.id); |
| | | message.success("订å已确认"); |
| | | await modalApi.close(); |
| | | emit("success"); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ''; |
| | | } |
| | | |
| | | /** å®æè®¢å */ |
| | | async function handleFinish() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | formType: FormType; |
| | | id?: number; |
| | | parentRow?: MesProWorkOrderApi.WorkOrder; |
| | | }>(); |
| | | formType.value = data.formType; |
| | | subTabsName.value = 'bom'; |
| | | modalApi.lock(); |
| | | try { |
| | | await finishWorkOrder(formData.value.id); |
| | | message.success("订å已宿"); |
| | | await modalApi.close(); |
| | | emit("success"); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** ä» BOM ç©æè¡é¢å¡«å订åï¼å¤ç¨å½å订åä¸ä¸æï¼è¿å
¥æ°å¢æ */ |
| | | async function handleGenerateWorkOrder( |
| | | bomRow: MesProWorkOrderBomApi.WorkOrderBom |
| | | ) { |
| | | const current = formData.value; |
| | | if (!current) { |
| | | return; |
| | | } |
| | | formData.value = undefined; |
| | | formType.value = "create"; |
| | | subTabsName.value = "bom"; |
| | | applySchema(); |
| | | if (data?.id) { |
| | | 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, |
| | | }); |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | message.info("å·²ä» BOM ç©æé¢å¡«å订åï¼è¯·è¡¥å
订åç¼ç çä¿¡æ¯åä¿å"); |
| | | } |
| | | |
| | | 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 MesProWorkOrderApi.WorkOrder; |
| | | try { |
| | | formData.value = await getWorkOrder(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | if (formData.value?.id) { |
| | | await updateWorkOrder({ ...formData.value, ...data }); |
| | | formData.value = { ...formData.value, ...data }; |
| | | } else { |
| | | const id = await createWorkOrder(data); |
| | | formData.value = { |
| | | ...data, |
| | | id, |
| | | status: MesProWorkOrderStatusEnum.PREPARE, |
| | | }; |
| | | formType.value = "update"; |
| | | // å建æåå忢ç¼è¾æï¼éæ schema 让ã订åç¶æãåæ®µæ¾ç° |
| | | applySchema(); |
| | | await formApi.setValues(formData.value); |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | emit("success"); |
| | | message.success($t("ui.actionMessage.operationSuccess")); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } else if (data?.parentRow) { |
| | | // æ°å¢åè®¢åæ¶ï¼é¢å¡«ç¶è®¢åä¿¡æ¯ |
| | | const parent = data.parentRow; |
| | | await formApi.setValues({ |
| | | clientId: parent.clientId, |
| | | orderSourceCode: parent.orderSourceCode, |
| | | orderSourceType: parent.orderSourceType, |
| | | parentId: parent.id, |
| | | requestDate: parent.requestDate, |
| | | type: parent.type, |
| | | vendorId: parent.vendorId, |
| | | }); |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | originalSnapshot.value = ""; |
| | | return; |
| | | } |
| | | // å è½½æ°æ® |
| | | const data = modalApi.getData<{ |
| | | formType: FormType; |
| | | id?: number; |
| | | parentRow?: MesProWorkOrderApi.WorkOrder; |
| | | }>(); |
| | | formType.value = data.formType; |
| | | subTabsName.value = "bom"; |
| | | applySchema(); |
| | | if (data?.id) { |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getWorkOrder(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } else if (data?.parentRow) { |
| | | // æ°å¢åè®¢åæ¶ï¼é¢å¡«ç¶è®¢åä¿¡æ¯ |
| | | const parent = data.parentRow; |
| | | await formApi.setValues({ |
| | | clientId: parent.clientId, |
| | | orderSourceCode: parent.orderSourceCode, |
| | | orderSourceType: parent.orderSourceType, |
| | | parentId: parent.id, |
| | | requestDate: parent.requestDate, |
| | | type: parent.type, |
| | | vendorId: parent.vendorId, |
| | | }); |
| | | } |
| | | originalSnapshot.value = JSON.stringify(await formApi.getValues()); |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Modal :title="getTitle" |
| | | class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | <!-- BOM / ç©æéæ± Tabï¼éæ°å»ºæå±ç¤º --> |
| | | <template v-if="formData?.id"> |
| | | <Tabs v-model:active-key="subTabsName" class="mx-4"> |
| | | <Tabs.TabPane key="bom" tab="订å BOM"> |
| | | <BomList |
| | | :form-type="formType" |
| | | :work-order="formData" |
| | | :work-order-id="formData.id" |
| | | @generate-work-order="handleGenerateWorkOrder" |
| | | /> |
| | | <Tabs v-model:active-key="subTabsName" |
| | | class="mx-4"> |
| | | <Tabs.TabPane key="bom" |
| | | tab="订å BOM"> |
| | | <BomList :form-type="formType" |
| | | :work-order="formData" |
| | | :work-order-id="formData.id" |
| | | @generate-work-order="handleGenerateWorkOrder" /> |
| | | </Tabs.TabPane> |
| | | <Tabs.TabPane key="item" tab="ç©æéæ±"> |
| | | <Tabs.TabPane key="item" |
| | | tab="ç©æéæ±"> |
| | | <ItemList :work-order-id="formData.id" /> |
| | | </Tabs.TabPane> |
| | | </Tabs> |
| | | </template> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Popconfirm |
| | | v-if="canConfirm || isConfirm" |
| | | title="确认è¦å®æè®¢åç¼å¶åï¼ç¡®è®¤åå°ä¸è½æ´æ¹ã" |
| | | @confirm="handleConfirm" |
| | | > |
| | | <Popconfirm v-if="canConfirm || isConfirm" |
| | | title="确认è¦å®æè®¢åç¼å¶åï¼ç¡®è®¤åå°ä¸è½æ´æ¹ã" |
| | | @confirm="handleConfirm"> |
| | | <Button type="primary">确认</Button> |
| | | </Popconfirm> |
| | | <Popconfirm |
| | | v-if="isFinish" |
| | | title="确认è¦å®æè¯¥è®¢ååï¼" |
| | | @confirm="handleFinish" |
| | | > |
| | | <Popconfirm v-if="isFinish" |
| | | title="确认è¦å®æè¯¥è®¢ååï¼" |
| | | @confirm="handleFinish"> |
| | | <Button type="primary">宿</Button> |
| | | </Popconfirm> |
| | | <Button |
| | | v-if="formType === 'detail' && formData?.id" |
| | | @click="handleBarcode" |
| | | > |
| | | <Button v-if="formType === 'detail' && formData?.id" |
| | | @click="handleBarcode"> |
| | | æ¥çæ¡ç |
| | | </Button> |
| | | </div> |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesPdParameterApi } from '#/api/mes/pro/processdesign/parameter'; |
| | | import type { VbenFormSchema } from "#/adapter/form"; |
| | | import type { VxeTableGridOptions } from "#/adapter/vxe-table"; |
| | | import type { MesPdParameterApi } from "#/api/mes/pro/processdesign/parameter"; |
| | | |
| | | import { DICT_TYPE } from '../../../../packages/constants/src'; |
| | | import { getDictOptions } from '../../../../packages/effects/hooks/src'; |
| | | import { DICT_TYPE } from "../../../../packages/constants/src"; |
| | | import { getDictOptions } from "../../../../packages/effects/hooks/src"; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | |
| | | /** åæ°ç±»å - 䏿é项çå¼ */ |
| | | const PARAM_TYPE_SELECT = 3; |
| | | import { z } from "#/adapter/form"; |
| | | import { getUnitPage } from "#/api/mdm/unit"; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'update'; |
| | | export type FormType = "create" | "detail" | "update"; |
| | | |
| | | /** æ°å¢/ä¿®æ¹å·¥èºåæ°ç表å */ |
| | | export function useFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | fieldName: "id", |
| | | component: "Input", |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | triggerFields: [""], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'code', |
| | | label: 'åæ°ç¼ç ', |
| | | component: 'Input', |
| | | fieldName: "paramCode", |
| | | label: "åæ°ç¼ç ", |
| | | component: "Input", |
| | | componentProps: { |
| | | maxLength: 64, |
| | | placeholder: '请è¾å
¥åæ°ç¼ç ', |
| | | placeholder: "åæ°ç¼ç èªå¨çæ", |
| | | disabled: true, |
| | | }, |
| | | rules: z.string().min(1, 'åæ°ç¼ç ä¸è½ä¸ºç©º').max(64), |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'åæ°åç§°', |
| | | component: 'Input', |
| | | fieldName: "paramName", |
| | | label: "åæ°åç§°", |
| | | component: "Input", |
| | | componentProps: { |
| | | maxLength: 100, |
| | | placeholder: '请è¾å
¥åæ°åç§°', |
| | | placeholder: "请è¾å
¥åæ°åç§°", |
| | | }, |
| | | rules: z.string().min(1, 'åæ°åç§°ä¸è½ä¸ºç©º').max(100), |
| | | rules: z.string().min(1, "åæ°åç§°ä¸è½ä¸ºç©º").max(100), |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: 'åæ°ç±»å', |
| | | component: 'Select', |
| | | fieldName: "paramType", |
| | | label: "åæ°ç±»å", |
| | | component: "Select", |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_PD_PARAM_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©åæ°ç±»å', |
| | | options: getDictOptions(DICT_TYPE.MES_PD_PARAM_TYPE, "number"), |
| | | placeholder: "è¯·éæ©åæ°ç±»å", |
| | | }, |
| | | rules: 'selectRequired', |
| | | rules: "selectRequired", |
| | | }, |
| | | { |
| | | fieldName: 'unit', |
| | | label: 'åä½', |
| | | component: 'Input', |
| | | fieldName: "unitMeasureId", |
| | | label: "计éåä½", |
| | | component: "ApiSelect", |
| | | componentProps: { |
| | | maxLength: 20, |
| | | placeholder: '请è¾å
¥åä½', |
| | | allowClear: true, |
| | | api: async () => { |
| | | const result = await getUnitPage({ pageNo: 1, pageSize: 100 }); |
| | | return result.list.map(item => ({ |
| | | label: item.name || "", |
| | | value: item.id || 0, |
| | | })); |
| | | }, |
| | | labelField: "label", |
| | | valueField: "value", |
| | | placeholder: "è¯·éæ©è®¡éåä½", |
| | | showSearch: true, |
| | | filterOption: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'requiredFlag', |
| | | label: 'æ¯å¦å¿
å¡«', |
| | | component: 'Switch', |
| | | fieldName: "required", |
| | | label: "æ¯å¦å¿
å¡«", |
| | | component: "Switch", |
| | | componentProps: { |
| | | checkedChildren: 'æ¯', |
| | | unCheckedChildren: 'å¦', |
| | | checkedChildren: "æ¯", |
| | | unCheckedChildren: "å¦", |
| | | }, |
| | | rules: z.boolean().default(false), |
| | | }, |
| | | { |
| | | fieldName: 'dictType', |
| | | label: 'åå
¸ç±»å', |
| | | component: 'Input', |
| | | componentProps: { |
| | | maxLength: 64, |
| | | placeholder: '请è¾å
¥åå
¸ç±»åï¼ä¸æé项æ¶é
ç½®ï¼', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['type'], |
| | | show: (values) => values?.type === PARAM_TYPE_SELECT, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'apiUrl', |
| | | label: 'æ¥å£å°å', |
| | | component: 'Input', |
| | | fieldName: "remark", |
| | | label: "夿³¨", |
| | | component: "Textarea", |
| | | formItemClass: "col-span-2", |
| | | componentProps: { |
| | | maxLength: 250, |
| | | placeholder: '请è¾å
¥æ¥å£å°åï¼ä¸æé项æ¶é
ç½®ï¼', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['type'], |
| | | show: (values) => values?.type === PARAM_TYPE_SELECT, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-2', |
| | | componentProps: { |
| | | maxLength: 250, |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | placeholder: "请è¾å
¥å¤æ³¨", |
| | | rows: 3, |
| | | }, |
| | | }, |
| | |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'åæ°ç¼ç ', |
| | | component: 'Input', |
| | | fieldName: "paramCode", |
| | | label: "åæ°ç¼ç ", |
| | | component: "Input", |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥åæ°ç¼ç ', |
| | | placeholder: "请è¾å
¥åæ°ç¼ç ", |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: 'åæ°åç§°', |
| | | component: 'Input', |
| | | fieldName: "paramName", |
| | | label: "åæ°åç§°", |
| | | component: "Input", |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥åæ°åç§°', |
| | | placeholder: "请è¾å
¥åæ°åç§°", |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: 'åæ°ç±»å', |
| | | component: 'Select', |
| | | fieldName: "paramType", |
| | | label: "åæ°ç±»å", |
| | | component: "Select", |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_PD_PARAM_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©åæ°ç±»å', |
| | | options: getDictOptions(DICT_TYPE.MES_PD_PARAM_TYPE, "number"), |
| | | placeholder: "è¯·éæ©åæ°ç±»å", |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesPdParameterApi.Parameter>['columns'] { |
| | | export function useGridColumns(): VxeTableGridOptions<MesPdParameterApi.Parameter>["columns"] { |
| | | return [ |
| | | { |
| | | type: 'seq', |
| | | title: 'åºå·', |
| | | type: "seq", |
| | | title: "åºå·", |
| | | width: 60, |
| | | align: 'center', |
| | | align: "center", |
| | | }, |
| | | { field: 'code', title: 'åæ°ç¼ç ', minWidth: 150 }, |
| | | { field: 'name', title: 'åæ°åç§°', minWidth: 180 }, |
| | | { field: "paramCode", title: "åæ°ç¼ç ", minWidth: 150 }, |
| | | { field: "paramName", title: "åæ°åç§°", minWidth: 180 }, |
| | | { |
| | | field: 'type', |
| | | title: 'åæ°ç±»å', |
| | | field: "paramType", |
| | | title: "åæ°ç±»å", |
| | | width: 120, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | name: "CellDict", |
| | | props: { type: DICT_TYPE.MES_PD_PARAM_TYPE }, |
| | | }, |
| | | }, |
| | | { field: 'unit', title: 'åä½', width: 80 }, |
| | | { field: "unitMeasureName", title: "åä½", width: 80 }, |
| | | { |
| | | field: 'requiredFlag', |
| | | title: 'æ¯å¦å¿
å¡«', |
| | | field: "required", |
| | | title: "æ¯å¦å¿
å¡«", |
| | | width: 90, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | name: "CellDict", |
| | | props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, |
| | | }, |
| | | }, |
| | | { field: 'remark', title: '夿³¨', minWidth: 180 }, |
| | | { field: "remark", title: "夿³¨", minWidth: 180 }, |
| | | { |
| | | field: 'createTime', |
| | | title: 'å建æ¶é´', |
| | | field: "createTime", |
| | | title: "å建æ¶é´", |
| | | width: 180, |
| | | formatter: 'formatDateTime', |
| | | formatter: "formatDateTime", |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | title: "æä½", |
| | | width: 150, |
| | | fixed: 'right', |
| | | fixed: "right", |
| | | slots: { |
| | | default: 'actions', |
| | | default: "actions", |
| | | }, |
| | | }, |
| | | ]; |
| | |
| | | import { |
| | | deleteParameter, |
| | | getParameterPage, |
| | | exportParameterExcel, |
| | | } from '#/api/mes/pro/processdesign/parameter'; |
| | | import { $t } from '#/locales'; |
| | | import { downloadFileFromBlobPart } from '../../../../packages/utils/src'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | |
| | | /** å é¤å·¥èºåæ° */ |
| | | async function handleDelete(row: MesPdParameterApi.Parameter) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.name]), |
| | | content: $t('ui.actionMessage.deleting', [row.paramName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteParameter(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.name])); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.paramName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 导åºå·¥èºåæ° */ |
| | | async function handleExport() { |
| | | const formValues = await gridApi.formApi.getValues(); |
| | | const data = await exportParameterExcel(formValues); |
| | | downloadFileFromBlobPart({ fileName: 'å·¥èºåæ°.xlsx', source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | |
| | | auth: ['mes:pd:parameter:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:pd:parameter:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #code="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)">{{ row.code }}</Button> |
| | | <template #paramCode="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)">{{ row.paramCode }}</Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:pd:parameter:delete'], |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.name]), |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.paramName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesPdTemplateApi } from '#/api/mes/pro/processdesign/template'; |
| | | import type { VbenFormSchema } from "#/adapter/form"; |
| | | import type { VxeTableGridOptions } from "#/adapter/vxe-table"; |
| | | import type { MesPdTemplateApi } from "#/api/mes/pro/processdesign/template"; |
| | | |
| | | import { DICT_TYPE } from '../../../../packages/constants/src'; |
| | | import { getDictOptions } from '../../../../packages/effects/hooks/src'; |
| | | import { DICT_TYPE } from "../../../../packages/constants/src"; |
| | | import { getDictOptions } from "../../../../packages/effects/hooks/src"; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { z } from "#/adapter/form"; |
| | | |
| | | /** 表åç±»å */ |
| | | export type FormType = 'create' | 'detail' | 'update'; |
| | | export type FormType = "create" | "detail" | "update"; |
| | | |
| | | /** æ°å¢/ä¿®æ¹å·¥èºåæ°æ¨¡æ¿ç表å */ |
| | | export function useFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'id', |
| | | component: 'Input', |
| | | fieldName: "id", |
| | | component: "Input", |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | triggerFields: [""], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: '模æ¿åç§°', |
| | | component: 'Input', |
| | | fieldName: "templateCode", |
| | | label: "模æ¿ç¼ç ", |
| | | component: "Input", |
| | | componentProps: { |
| | | maxLength: 64, |
| | | placeholder: "模æ¿ç¼ç èªå¨çæ", |
| | | disabled: true, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: "templateName", |
| | | label: "模æ¿åç§°", |
| | | component: "Input", |
| | | componentProps: { |
| | | maxLength: 100, |
| | | placeholder: '请è¾å
¥æ¨¡æ¿åç§°', |
| | | placeholder: "请è¾å
¥æ¨¡æ¿åç§°", |
| | | }, |
| | | rules: z.string().min(1, '模æ¿åç§°ä¸è½ä¸ºç©º').max(100), |
| | | rules: z.string().min(1, "模æ¿åç§°ä¸è½ä¸ºç©º").max(100), |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: '模æ¿ç±»å', |
| | | component: 'Select', |
| | | fieldName: "templateType", |
| | | label: "模æ¿ç±»å", |
| | | component: "Select", |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_PD_TEMPLATE_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©æ¨¡æ¿ç±»å', |
| | | options: getDictOptions(DICT_TYPE.MES_PD_TEMPLATE_TYPE, "number"), |
| | | placeholder: "è¯·éæ©æ¨¡æ¿ç±»å", |
| | | }, |
| | | rules: 'selectRequired', |
| | | rules: "selectRequired", |
| | | }, |
| | | { |
| | | fieldName: 'parameterIds', |
| | | label: 'å
³èåæ°', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | | label: '夿³¨', |
| | | component: 'Textarea', |
| | | formItemClass: 'col-span-2', |
| | | fieldName: "remark", |
| | | label: "夿³¨", |
| | | component: "Textarea", |
| | | formItemClass: "col-span-2", |
| | | componentProps: { |
| | | maxLength: 250, |
| | | placeholder: '请è¾å
¥å¤æ³¨', |
| | | placeholder: "请è¾å
¥å¤æ³¨", |
| | | rows: 3, |
| | | }, |
| | | }, |
| | |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'name', |
| | | label: '模æ¿åç§°', |
| | | component: 'Input', |
| | | fieldName: "templateCode", |
| | | label: "模æ¿ç¼ç ", |
| | | component: "Input", |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥æ¨¡æ¿åç§°', |
| | | placeholder: "请è¾å
¥æ¨¡æ¿ç¼ç ", |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: '模æ¿ç±»å', |
| | | component: 'Select', |
| | | fieldName: "templateName", |
| | | label: "模æ¿åç§°", |
| | | component: "Input", |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_PD_TEMPLATE_TYPE, 'number'), |
| | | placeholder: 'è¯·éæ©æ¨¡æ¿ç±»å', |
| | | placeholder: "请è¾å
¥æ¨¡æ¿åç§°", |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: "templateType", |
| | | label: "模æ¿ç±»å", |
| | | component: "Select", |
| | | componentProps: { |
| | | allowClear: true, |
| | | options: getDictOptions(DICT_TYPE.MES_PD_TEMPLATE_TYPE, "number"), |
| | | placeholder: "è¯·éæ©æ¨¡æ¿ç±»å", |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | | |
| | | /** å表çåæ®µ */ |
| | | export function useGridColumns(): VxeTableGridOptions<MesPdTemplateApi.Template>['columns'] { |
| | | export function useGridColumns(): VxeTableGridOptions<MesPdTemplateApi.Template>["columns"] { |
| | | return [ |
| | | { |
| | | type: 'seq', |
| | | title: 'åºå·', |
| | | type: "seq", |
| | | title: "åºå·", |
| | | width: 60, |
| | | align: 'center', |
| | | align: "center", |
| | | }, |
| | | { field: 'name', title: '模æ¿åç§°', minWidth: 180 }, |
| | | { field: "templateCode", title: "模æ¿ç¼ç ", minWidth: 150 }, |
| | | { field: "templateName", title: "模æ¿åç§°", minWidth: 180 }, |
| | | { |
| | | field: 'type', |
| | | title: '模æ¿ç±»å', |
| | | field: "templateType", |
| | | title: "模æ¿ç±»å", |
| | | width: 120, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | name: "CellDict", |
| | | props: { type: DICT_TYPE.MES_PD_TEMPLATE_TYPE }, |
| | | }, |
| | | }, |
| | | { field: 'createUser', title: 'å建人', width: 120 }, |
| | | { field: "remark", title: "夿³¨", minWidth: 180 }, |
| | | { |
| | | field: 'createTime', |
| | | title: 'å建æ¶é´', |
| | | field: "createTime", |
| | | title: "å建æ¶é´", |
| | | width: 180, |
| | | formatter: 'formatDateTime', |
| | | formatter: "formatDateTime", |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | width: 150, |
| | | fixed: 'right', |
| | | title: "æä½", |
| | | width: 240, |
| | | fixed: "right", |
| | | slots: { |
| | | default: 'actions', |
| | | default: "actions", |
| | | }, |
| | | }, |
| | | ]; |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesPdTemplateApi } from '#/api/mes/pro/processdesign/template'; |
| | | import type { VxeTableGridOptions } from "#/adapter/vxe-table"; |
| | | import type { MesPdTemplateApi } from "#/api/mes/pro/processdesign/template"; |
| | | |
| | | import { Page, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { Page, useVbenModal } from "../../../../packages/effects/common-ui/src"; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | import { Button, message } from "ant-design-vue"; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteTemplate, |
| | | getTemplatePage, |
| | | } from '#/api/mes/pro/processdesign/template'; |
| | | import { $t } from '#/locales'; |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from "#/adapter/vxe-table"; |
| | | import { |
| | | deleteTemplate, |
| | | getTemplatePage, |
| | | exportTemplateExcel, |
| | | } from "#/api/mes/pro/processdesign/template"; |
| | | import { $t } from "#/locales"; |
| | | import { downloadFileFromBlobPart } from "../../../../packages/utils/src"; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | 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 handleEdit(row: MesPdTemplateApi.Template) { |
| | | formModalApi.setData({ id: row.id, formType: 'update' }).open(); |
| | | } |
| | | |
| | | /** æ¥çå·¥èºåæ°æ¨¡æ¿è¯¦æ
*/ |
| | | function handleDetail(row: MesPdTemplateApi.Template) { |
| | | formModalApi.setData({ id: row.id, formType: 'detail' }).open(); |
| | | } |
| | | |
| | | /** å é¤å·¥èºåæ°æ¨¡æ¿ */ |
| | | async function handleDelete(row: MesPdTemplateApi.Template) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting', [row.name]), |
| | | duration: 0, |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | try { |
| | | await deleteTemplate(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess', [row.name])); |
| | | 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 getTemplatePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | | } |
| | | |
| | | /** å建工èºåæ°æ¨¡æ¿ */ |
| | | function handleCreate() { |
| | | formModalApi.setData({ formType: "create" }).open(); |
| | | } |
| | | |
| | | /** ç¼è¾å·¥èºåæ°æ¨¡æ¿ */ |
| | | function handleEdit(row: MesPdTemplateApi.Template) { |
| | | formModalApi.setData({ id: row.id, formType: "update" }).open(); |
| | | } |
| | | |
| | | /** æ¥çå·¥èºåæ°æ¨¡æ¿è¯¦æ
*/ |
| | | function handleDetail(row: MesPdTemplateApi.Template) { |
| | | formModalApi.setData({ id: row.id, formType: "detail" }).open(); |
| | | } |
| | | |
| | | /** å é¤å·¥èºåæ°æ¨¡æ¿ */ |
| | | async function handleDelete(row: MesPdTemplateApi.Template) { |
| | | const hideLoading = message.loading({ |
| | | content: $t("ui.actionMessage.deleting", [row.templateName]), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteTemplate(row.id!); |
| | | message.success($t("ui.actionMessage.deleteSuccess", [row.templateName])); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 导åºå·¥èºåæ°æ¨¡æ¿ */ |
| | | async function handleExport() { |
| | | const formValues = await gridApi.formApi.getValues(); |
| | | const data = await exportTemplateExcel(formValues); |
| | | downloadFileFromBlobPart({ fileName: "å·¥èºåæ°æ¨¡æ¿.xlsx", source: data }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: useGridFormSchema(), |
| | | }, |
| | | gridOptions: { |
| | | columns: useGridColumns(), |
| | | height: "auto", |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getTemplatePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: 'id', |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesPdTemplateApi.Template>, |
| | | }); |
| | | rowConfig: { |
| | | isHover: true, |
| | | keyField: "id", |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesPdTemplateApi.Template>, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <Grid table-title="å·¥èºåæ°æ¨¡æ¿å表"> |
| | | <template #toolbar-tools> |
| | | <TableAction |
| | | :actions="[ |
| | | <TableAction :actions="[ |
| | | { |
| | | label: $t('ui.actionTitle.create', ['模æ¿']), |
| | | type: 'primary', |
| | |
| | | auth: ['mes:pd:template:create'], |
| | | onClick: handleCreate, |
| | | }, |
| | | ]" |
| | | /> |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| | | auth: ['mes:pd:template:export'], |
| | | onClick: handleExport, |
| | | }, |
| | | ]" /> |
| | | </template> |
| | | <template #name="{ row }"> |
| | | <Button type="link" @click="handleDetail(row)">{{ row.name }}</Button> |
| | | <template #templateCode="{ row }"> |
| | | <Button type="link" |
| | | @click="handleDetail(row)">{{ row.templateCode }}</Button> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | | :actions="[ |
| | | <TableAction :actions="[ |
| | | { |
| | | label: $t('common.detail'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.VIEW, |
| | | onClick: handleDetail.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | |
| | | icon: ACTION_ICON.DELETE, |
| | | auth: ['mes:pd:template:delete'], |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.name]), |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.templateName]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | | /> |
| | | ]" /> |
| | | </template> |
| | | </Grid> |
| | | </Page> |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | import type { FormType } from "../data"; |
| | | |
| | | import type { MesPdParameterApi } from '#/api/mes/pro/processdesign/parameter'; |
| | | import type { MesPdTemplateApi } from '#/api/mes/pro/processdesign/template'; |
| | | import type { MesPdParameterApi } from "#/api/mes/pro/processdesign/parameter"; |
| | | import type { MesPdTemplateApi } from "#/api/mes/pro/processdesign/template"; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | import { computed, ref } from "vue"; |
| | | |
| | | import { useVbenModal } from '../../../../../packages/effects/common-ui/src'; |
| | | import { useVbenModal } from "../../../../../packages/effects/common-ui/src"; |
| | | |
| | | import { Button, message, Tag } from 'ant-design-vue'; |
| | | import { Button, message, Switch, Input } from "ant-design-vue"; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { |
| | | createTemplate, |
| | | getTemplate, |
| | | updateTemplate, |
| | | } from '#/api/mes/pro/processdesign/template'; |
| | | import { $t } from '#/locales'; |
| | | import { useVbenForm } from "#/adapter/form"; |
| | | import { |
| | | createTemplate, |
| | | getTemplate, |
| | | updateTemplate, |
| | | } from "#/api/mes/pro/processdesign/template"; |
| | | import { $t } from "#/locales"; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import ParameterSelectDialog from './parameter-select-dialog.vue'; |
| | | import { useFormSchema } from "../data"; |
| | | import ParameterSelectDialog from "./parameter-select-dialog.vue"; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesPdTemplateApi.Template>(); |
| | | const emit = defineEmits(["success"]); |
| | | const formType = ref<FormType>("create"); |
| | | const formData = ref<MesPdTemplateApi.Template>(); |
| | | |
| | | /** å·²éåæ°å表ï¼ç¨äºé¡µé¢å±ç¤ºï¼ */ |
| | | const selectedParameters = ref<MesPdParameterApi.Parameter[]>([]); |
| | | const parameterSelectDialogRef = ref<InstanceType<typeof ParameterSelectDialog>>(); |
| | | /** å·²éåæ°å表ï¼ç¨äºé¡µé¢å±ç¤ºï¼ */ |
| | | const selectedDetails = ref<MesPdTemplateApi.TemplateDetail[]>([]); |
| | | const parameterSelectDialogRef = |
| | | ref<InstanceType<typeof ParameterSelectDialog>>(); |
| | | |
| | | const isDetail = computed(() => formType.value === 'detail'); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.detail', ['å·¥èºåæ°æ¨¡æ¿']); |
| | | } |
| | | return formType.value === 'update' |
| | | ? $t('ui.actionTitle.edit', ['å·¥èºåæ°æ¨¡æ¿']) |
| | | : $t('ui.actionTitle.create', ['å·¥èºåæ°æ¨¡æ¿']); |
| | | }); |
| | | const isDetail = computed(() => formType.value === "detail"); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === "detail") { |
| | | return $t("ui.actionTitle.detail", ["å·¥èºåæ°æ¨¡æ¿"]); |
| | | } |
| | | return formType.value === "update" |
| | | ? $t("ui.actionTitle.edit", ["å·¥èºåæ°æ¨¡æ¿"]) |
| | | : $t("ui.actionTitle.create", ["å·¥èºåæ°æ¨¡æ¿"]); |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: 'w-full', |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: "w-full", |
| | | }, |
| | | formItemClass: "col-span-1", |
| | | labelWidth: 100, |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 100, |
| | | }, |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-2', |
| | | }); |
| | | layout: "horizontal", |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | wrapperClass: "grid-cols-2", |
| | | }); |
| | | |
| | | /** æå¼å·¥èºåæ°éæ©å¼¹çª */ |
| | | function handleSelectParameters() { |
| | | parameterSelectDialogRef.value?.open( |
| | | selectedParameters.value |
| | | .map((p) => p.id) |
| | | .filter((id): id is number => id !== undefined), |
| | | ); |
| | | } |
| | | /** æå¼å·¥èºåæ°éæ©å¼¹çª */ |
| | | function handleSelectParameters() { |
| | | parameterSelectDialogRef.value?.open( |
| | | selectedDetails.value |
| | | .map(d => d.processParamId) |
| | | .filter((id): id is number => id !== undefined) |
| | | ); |
| | | } |
| | | |
| | | /** æ¥æ¶éä¸çåæ° */ |
| | | function onParametersSelected(rows: MesPdParameterApi.Parameter[]) { |
| | | selectedParameters.value = rows; |
| | | } |
| | | /** æ¥æ¶éä¸çåæ° */ |
| | | function onParametersSelected(rows: MesPdParameterApi.Parameter[]) { |
| | | selectedDetails.value = rows.map(row => ({ |
| | | processParamId: row.id, |
| | | paramCode: row.paramCode, |
| | | paramName: row.paramName, |
| | | paramType: row.paramType, |
| | | unitMeasureName: row.unitMeasureName, |
| | | required: row.required, |
| | | remark: row.remark, |
| | | })); |
| | | } |
| | | |
| | | /** ç§»é¤å·²éåæ° */ |
| | | function removeParameter(param: MesPdParameterApi.Parameter) { |
| | | selectedParameters.value = selectedParameters.value.filter( |
| | | (p) => p.id !== param.id, |
| | | ); |
| | | } |
| | | /** ç§»é¤å·²éåæ° */ |
| | | function removeParameter(index: number) { |
| | | selectedDetails.value.splice(index, 1); |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (isDetail.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | if (selectedParameters.value.length === 0) { |
| | | message.warning('请è³å°éæ©ä¸ä¸ªå·¥èºåæ°'); |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | const data = (await formApi.getValues()) as MesPdTemplateApi.Template; |
| | | data.parameterIds = selectedParameters.value |
| | | .map((p) => p.id) |
| | | .filter((id): id is number => id !== undefined); |
| | | try { |
| | | await (formData.value?.id ? updateTemplate(data) : createTemplate(data)); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | selectedParameters.value = []; |
| | | return; |
| | | } |
| | | formApi.setState({ schema: useFormSchema() }); |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setDisabled(formType.value === 'detail'); |
| | | modalApi.setState({ showConfirmButton: formType.value !== 'detail' }); |
| | | if (!data?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getTemplate(data.id); |
| | | await formApi.setValues(formData.value); |
| | | // 忾已éåæ°ï¼ä»è¯¦æ
æ¥å£è¿åçåæ°å表ä¸è·åï¼ |
| | | if (formData.value.parameterIds) { |
| | | // parameterIds å·²ç±å端è¿åï¼selectedParameters å¨è¯¦æ
模å¼ä¸å±ç¤º |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (isDetail.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | if (selectedDetails.value.length === 0) { |
| | | message.warning("请è³å°éæ©ä¸ä¸ªå·¥èºåæ°"); |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | const data = (await formApi.getValues()) as MesPdTemplateApi.Template; |
| | | data.details = selectedDetails.value.map(d => ({ |
| | | ...d, |
| | | processParamId: d.processParamId, |
| | | required: d.required, |
| | | remark: d.remark, |
| | | })); |
| | | try { |
| | | await (formData.value?.id ? updateTemplate(data) : createTemplate(data)); |
| | | await modalApi.close(); |
| | | emit("success"); |
| | | message.success($t("ui.actionMessage.operationSuccess")); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) { |
| | | formData.value = undefined; |
| | | selectedDetails.value = []; |
| | | return; |
| | | } |
| | | formApi.setState({ schema: useFormSchema() }); |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setDisabled(formType.value === "detail"); |
| | | modalApi.setState({ showConfirmButton: formType.value !== "detail" }); |
| | | if (!data?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getTemplate(data.id); |
| | | await formApi.setValues(formData.value); |
| | | // 忾已éåæ°ï¼ä»è¯¦æ
æ¥å£è¿åçåæ°å表ä¸è·åï¼ |
| | | if (formData.value.details) { |
| | | selectedDetails.value = [...formData.value.details]; |
| | | } |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-4/5"> |
| | | <Modal :title="getTitle" |
| | | class="w-4/5"> |
| | | <Form class="mx-4" /> |
| | | <!-- å
³èåæ°éæ©åºå --> |
| | | <!-- æ¨¡æ¿æç»åºå --> |
| | | <div class="mx-4 mt-4"> |
| | | <div class="mb-2 flex items-center justify-between"> |
| | | <span class="text-sm font-medium">å
³èå·¥èºåæ°</span> |
| | | <Button |
| | | v-if="!isDetail" |
| | | type="primary" |
| | | size="small" |
| | | @click="handleSelectParameters" |
| | | > |
| | | 鿩忰 |
| | | <span class="text-sm font-medium">æ¨¡æ¿æç»</span> |
| | | <Button v-if="!isDetail" |
| | | type="primary" |
| | | size="small" |
| | | @click="handleSelectParameters"> |
| | | æ·»å åæ° |
| | | </Button> |
| | | </div> |
| | | <div |
| | | v-if="selectedParameters.length > 0" |
| | | class="min-h-10 rounded border border-gray-200 p-2" |
| | | > |
| | | <Tag |
| | | v-for="param in selectedParameters" |
| | | :key="param.id" |
| | | :closable="!isDetail" |
| | | class="mb-1 mr-1" |
| | | @close="removeParameter(param)" |
| | | > |
| | | {{ param.name }}({{ param.code }}) |
| | | </Tag> |
| | | <div v-if="selectedDetails.length > 0" |
| | | class="rounded border border-gray-200"> |
| | | <div class="grid grid-cols-12 gap-2 border-b border-gray-200 bg-gray-50 p-2 text-xs font-medium"> |
| | | <div class="col-span-3">åæ°åç§°</div> |
| | | <div class="col-span-2">åæ°ç¼ç </div> |
| | | <div class="col-span-2">åä½</div> |
| | | <div class="col-span-2 text-center">æ¯å¦å¿
å¡«</div> |
| | | <div class="col-span-2">夿³¨</div> |
| | | <div v-if="!isDetail" |
| | | class="col-span-1 text-center">æä½</div> |
| | | </div> |
| | | <div v-for="(detail, index) in selectedDetails" |
| | | :key="detail.processParamId || index" |
| | | class="grid grid-cols-12 gap-2 border-b border-gray-100 p-2"> |
| | | <div class="col-span-3 text-sm">{{ detail.paramName }}</div> |
| | | <div class="col-span-2 text-sm text-gray-500">{{ detail.paramCode }}</div> |
| | | <div class="col-span-2 text-sm">{{ detail.unitMeasureName }}</div> |
| | | <div class="col-span-2 flex items-center justify-center"> |
| | | <Switch v-model:checked="detail.required" |
| | | :disabled="isDetail" |
| | | size="small" /> |
| | | </div> |
| | | <div class="col-span-2"> |
| | | <Input v-model:value="detail.remark" |
| | | :disabled="isDetail" |
| | | placeholder="夿³¨" |
| | | size="small" /> |
| | | </div> |
| | | <div v-if="!isDetail" |
| | | class="col-span-1 flex items-center justify-center"> |
| | | <Button type="text" |
| | | danger |
| | | size="small" |
| | | @click="removeParameter(index)"> |
| | | å é¤ |
| | | </Button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div v-else class="rounded border border-dashed border-gray-300 p-4 text-center text-gray-400"> |
| | | <div v-else |
| | | class="rounded border border-dashed border-gray-300 p-4 text-center text-gray-400"> |
| | | ææªéæ©åæ° |
| | | </div> |
| | | </div> |
| | | <ParameterSelectDialog |
| | | ref="parameterSelectDialogRef" |
| | | @selected="onParametersSelected" |
| | | /> |
| | | <ParameterSelectDialog ref="parameterSelectDialogRef" |
| | | @selected="onParametersSelected" /> |
| | | </Modal> |
| | | </template> |
| | |
| | | formOptions: { |
| | | schema: [ |
| | | { |
| | | fieldName: 'code', |
| | | fieldName: 'paramCode', |
| | | label: 'åæ°ç¼ç ', |
| | | component: 'Input', |
| | | componentProps: { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | fieldName: 'paramName', |
| | | label: 'åæ°åç§°', |
| | | component: 'Input', |
| | | componentProps: { |
| | |
| | | gridOptions: { |
| | | columns: [ |
| | | { type: 'checkbox', width: 50 }, |
| | | { field: 'code', title: 'åæ°ç¼ç ', minWidth: 150 }, |
| | | { field: 'name', title: 'åæ°åç§°', minWidth: 180 }, |
| | | { field: 'paramCode', title: 'åæ°ç¼ç ', minWidth: 150 }, |
| | | { field: 'paramName', title: 'åæ°åç§°', minWidth: 180 }, |
| | | { |
| | | field: 'type', |
| | | field: 'paramType', |
| | | title: 'åæ°ç±»å', |
| | | width: 120, |
| | | cellRender: { |
| | |
| | | props: { type: DICT_TYPE.MES_PD_PARAM_TYPE }, |
| | | }, |
| | | }, |
| | | { field: 'unit', title: 'åä½', width: 80 }, |
| | | { field: 'unitMeasureName', title: 'åä½', width: 80 }, |
| | | { |
| | | field: 'requiredFlag', |
| | | field: 'required', |
| | | title: 'æ¯å¦å¿
å¡«', |
| | | width: 90, |
| | | cellRender: { |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from '../data'; |
| | | import type { FormType } from "../data"; |
| | | |
| | | import type { MesTmToolApi } from '#/api/mes/tm/tool'; |
| | | import type { MesTmToolApi } from "#/api/mes/tm/tool"; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | import { computed, ref } from "vue"; |
| | | |
| | | import { useVbenModal } from '../../../../../packages/effects/common-ui/src'; |
| | | import { BarcodeBizTypeEnum } from '../../../../../packages/constants/src'; |
| | | import { useVbenModal } from "../../../../../packages/effects/common-ui/src"; |
| | | import { BarcodeBizTypeEnum } from "../../../../../packages/constants/src"; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | import { Button, message } from "ant-design-vue"; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { createTool, getTool, updateTool } from '#/api/mes/tm/tool'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { useVbenForm } from "#/adapter/form"; |
| | | import { createTool, getTool, updateTool } from "#/api/mes/tm/tool"; |
| | | import { $t } from "#/locales"; |
| | | import { BarcodeDetail } from "#/views/wls/barcode/components"; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | import { useFormSchema } from "../data"; |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formType = ref<FormType>('create'); // è¡¨åæ¨¡å¼ |
| | | const formData = ref<MesTmToolApi.Tool>(); |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | const emit = defineEmits(["success"]); |
| | | const formType = ref<FormType>("create"); // è¡¨åæ¨¡å¼ |
| | | const formData = ref<MesTmToolApi.Tool>(); |
| | | const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // æ¡ç 详æ
å¼¹çª |
| | | |
| | | const isDetail = computed(() => formType.value === 'detail'); // æ¯å¦æ¥çæ¨¡å¼ |
| | | 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 isDetail = computed(() => formType.value === "detail"); // æ¯å¦æ¥çæ¨¡å¼ |
| | | 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', |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: "w-full", |
| | | }, |
| | | formItemClass: "col-span-1", |
| | | labelWidth: 110, |
| | | }, |
| | | formItemClass: 'col-span-1', |
| | | labelWidth: 110, |
| | | }, |
| | | wrapperClass: 'grid-cols-3', |
| | | layout: 'horizontal', |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | }); |
| | | wrapperClass: "grid-cols-3", |
| | | layout: "horizontal", |
| | | schema: [], |
| | | showDefaultActions: false, |
| | | }); |
| | | |
| | | /** æ¥çå·¥å
·æ¡ç */ |
| | | function handleBarcode() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | /** æ¥çå·¥å
·æ¡ç */ |
| | | function handleBarcode() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | formData.value.id, |
| | | BarcodeBizTypeEnum.TOOL, |
| | | formData.value.code, |
| | | formData.value.name |
| | | ); |
| | | } |
| | | barcodeDetailRef.value?.openByBusiness( |
| | | formData.value.id, |
| | | BarcodeBizTypeEnum.TOOL, |
| | | formData.value.code, |
| | | formData.value.name, |
| | | ); |
| | | } |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (isDetail.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesTmToolApi.Tool; |
| | | try { |
| | | await (data.id ? updateTool(data) : createTool(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<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(data.formType, formApi) }); |
| | | formApi.setDisabled(formType.value === 'detail'); |
| | | modalApi.setState({ showConfirmButton: formType.value !== 'detail' }); |
| | | if (!data?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getTool(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | if (isDetail.value) { |
| | | await modalApi.close(); |
| | | return; |
| | | } |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | // æäº¤è¡¨å |
| | | const data = (await formApi.getValues()) as MesTmToolApi.Tool; |
| | | try { |
| | | await (data.id ? updateTool(data) : createTool(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<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(data.formType, formApi) }); |
| | | formApi.setDisabled(formType.value === "detail"); |
| | | modalApi.setState({ showConfirmButton: formType.value !== "detail" }); |
| | | if (!data?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getTool(data.id); |
| | | // è®¾ç½®å° values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-4/5"> |
| | | <Modal :title="getTitle" |
| | | class="w-4/5"> |
| | | <Form class="mx-4" /> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center"> |
| | | <Button |
| | | v-if="isDetail && formData?.id" |
| | | type="primary" |
| | | @click="handleBarcode" |
| | | > |
| | | <Button v-if="isDetail && formData?.id" |
| | | type="primary" |
| | | @click="handleBarcode"> |
| | | æ¥çæ¡ç |
| | | </Button> |
| | | </div> |
| | |
| | | getOutsourceReceiptLinePage, |
| | | } from '#/api/mes/wm/outsourcereceipt/line'; |
| | | import { $t } from '#/locales'; |
| | | import { PrinterLabel } from '#/views/mes/wm/barcode/components'; |
| | | import { PrinterLabel } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | |
| | | getProductReceiptLinePage, |
| | | } from '#/api/mes/wm/productreceipt/line'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail, PrinterLabel } from '#/views/mes/wm/barcode/components'; |
| | | import { BarcodeDetail, PrinterLabel } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | |
| | | getReturnIssueLinePage, |
| | | } from '#/api/mes/wm/returnissue/line'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail, PrinterLabel } from '#/views/mes/wm/barcode/components'; |
| | | import { BarcodeDetail, PrinterLabel } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | |
| | | getReturnSalesLinePage, |
| | | } from '#/api/mes/wm/returnsales/line'; |
| | | import { $t } from '#/locales'; |
| | | import { PrinterLabel } from '#/views/mes/wm/barcode/components'; |
| | | import { PrinterLabel } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | |
| | | getReturnVendorLinePage, |
| | | } from '#/api/mes/wm/returnvendor/line'; |
| | | import { $t } from '#/locales'; |
| | | import { PrinterLabel } from '#/views/mes/wm/barcode/components'; |
| | | import { PrinterLabel } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getSnListByUuid } from '#/api/mes/wm/sn'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { BarcodeDetail } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useDetailGridColumns } from '../data'; |
| | | |
| | |
| | | getTransferLineList, |
| | | } from '#/api/mes/wm/transfer/line'; |
| | | import { $t } from '#/locales'; |
| | | import { PrinterLabel } from '#/views/mes/wm/barcode/components'; |
| | | import { PrinterLabel } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useLineGridColumns } from '../data'; |
| | | import DetailForm from './detail-form.vue'; |
| | |
| | | } from '#/api/mes/wm/warehouse/area'; |
| | | import { getWarehouseLocation } from '#/api/mes/wm/warehouse/location'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { BarcodeDetail } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | |
| | |
| | | updateWarehouseLocation, |
| | | } from '#/api/mes/wm/warehouse/location'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { BarcodeDetail } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | |
| | |
| | | updateWarehouse, |
| | | } from '#/api/mes/wm/warehouse'; |
| | | import { $t } from '#/locales'; |
| | | import { BarcodeDetail } from '#/views/mes/wm/barcode/components'; |
| | | import { BarcodeDetail } from '#/views/wls/barcode/components'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | | |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'vendorName', |
| | | label: '', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderId', |
| | | label: 'éè´è®¢å', |
| | | component: markRaw(ErpPurchaseOrderSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©éè´è®¢å', |
| | | onChange: (item: any) => { |
| | | if (item?.supplierId && formApi) { |
| | | formApi.setFieldValue('vendorId', item.supplierId); |
| | | formApi.setFieldValue('vendorName', item.supplierName); |
| | | } |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['vendorName'], |
| | | componentProps: (values) => ({ |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | disabled: true, |
| | | vendorName: values.vendorName as string, |
| | | }), |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | |
| | | 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 { Page, useVbenModal } from '@vben/common-ui'; |
| | | import { MesWmArrivalNoticeStatusEnum } from '@vben/constants'; |
| | | import { downloadFileFromBlobPart } from '@vben/utils'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | |
| | | import { |
| | | deleteArrivalNotice, |
| | | exportArrivalNotice, |
| | | generateArrivalNoticeFromPurchaseOrder, |
| | | getArrivalNoticePage, |
| | | } from '#/api/mes/wm/arrivalnotice'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | import PoSelectDialog from './modules/po-select-dialog.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [PoSelectModal, poSelectModalApi] = useVbenModal({ |
| | | connectedComponent: PoSelectDialog, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | |
| | | message.info('请åå¾ãä»åºç®¡ç - éè´å
¥åºãä¸è¿è¡å
¥åºæä½'); |
| | | } |
| | | |
| | | /** ä»éè´è®¢åçæå°è´§éç¥å */ |
| | | async function handleGenerateFromPO() { |
| | | poSelectModalApi.open(); |
| | | } |
| | | |
| | | /** éè´è®¢åéæ©åè° */ |
| | | async function handlePurchaseOrderSelected(purchaseOrderId: number) { |
| | | const hideLoading = message.loading({ |
| | | content: 'æ£å¨çæå°è´§éç¥å...', |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | const id = await generateArrivalNoticeFromPurchaseOrder(purchaseOrderId); |
| | | message.success('å°è´§éç¥åçææå'); |
| | | // 跳转å°ç¼è¾é¡µ |
| | | formModalApi.setData({ formType: 'update', id }).open(); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportArrivalNotice(await gridApi.formApi.getValues()); |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <PoSelectModal @selected="handlePurchaseOrderSelected" /> |
| | | |
| | | <Grid table-title="å°è´§éç¥åå表"> |
| | | <template #toolbar-tools> |
| | |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: 'ä»éè´è®¢åçæ', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-arrival-notice:create'], |
| | | onClick: handleGenerateFromPO, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { Page, useVbenModal } from '@vben/common-ui'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getPurchaseOrderPage } from '#/api/erp/purchase/order'; |
| | | |
| | | const emit = defineEmits<{ |
| | | selected: [purchaseOrderId: number]; |
| | | }>(); |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: [ |
| | | { |
| | | fieldName: 'no', |
| | | label: '订åå·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥è®¢åå·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'supplierName', |
| | | label: 'ä¾åºå', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥ä¾åºååç§°', |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | gridOptions: { |
| | | columns: [ |
| | | { |
| | | type: 'radio', |
| | | width: 60, |
| | | }, |
| | | { |
| | | field: 'no', |
| | | title: '订åå·', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'supplierName', |
| | | title: 'ä¾åºååç§°', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'orderTime', |
| | | title: 'è®¢åæ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'totalPrice', |
| | | title: 'æ»éé¢', |
| | | width: 120, |
| | | formatter: 'formatMoney', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'ç¶æ', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: 'erp_purchase_order_status' }, |
| | | }, |
| | | }, |
| | | ], |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getPurchaseOrderPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<ErpPurchaseOrderApi.PurchaseOrder>, |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const selectedRows = gridApi.grid.getRadioRecord(); |
| | | if (!selectedRows) { |
| | | message.warning('è¯·éæ©éè´è®¢å'); |
| | | return; |
| | | } |
| | | emit('selected', selectedRows.id); |
| | | await modalApi.close(); |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (isOpen) { |
| | | await gridApi.query(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal title="éæ©éè´è®¢å" class="w-2/3"> |
| | | <Grid table-title="éè´è®¢åå表" /> |
| | | </Modal> |
| | | </template> |
| | |
| | | column: 1, |
| | | schema: useBarcodeDetailSchema(), |
| | | useCard: false, |
| | | labelStyle: { width: '80px', whiteSpace: 'nowrap' }, |
| | | }); |
| | | |
| | | function openModal(row: Partial<MesWmBarcodeApi.Barcode>) { |
| | |
| | | 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('ä¸è½½æå'); |
| | | |
| | | const canvas = document.createElement('canvas'); |
| | | const ctx = canvas.getContext('2d'); |
| | | if (!ctx) { |
| | | message.error('Canvas åå§å失败'); |
| | | return; |
| | | } |
| | | |
| | | const img = new Image(); |
| | | img.onload = () => { |
| | | const padding = 20; |
| | | const infoX = img.width + padding * 2; |
| | | const infoWidth = 320; |
| | | canvas.width = infoX + infoWidth + padding; |
| | | canvas.height = Math.max(img.height + padding * 2, 360); |
| | | |
| | | ctx.fillStyle = '#ffffff'; |
| | | ctx.fillRect(0, 0, canvas.width, canvas.height); |
| | | |
| | | ctx.drawImage(img, padding, padding); |
| | | |
| | | ctx.fillStyle = '#000000'; |
| | | let y = padding + 10; |
| | | const lineHeight = 26; |
| | | |
| | | // è·ååå
¸ææ¬çè¾
å©å½æ° |
| | | const getFormatText = (val?: number) => { |
| | | const map: Record<number, string> = { 1: 'QR_CODE', 2: 'CODE_128', 3: 'CODE_39', 4: 'EAN_13', 5: 'UPC_A' }; |
| | | return map[val || 1] || 'QR_CODE'; |
| | | }; |
| | | const getBizTypeText = (val?: number) => { |
| | | const map: Record<number, string> = { 1: 'ä»åº', 2: 'åºåº', 3: 'åºä½', 4: 'ç©æ', 5: '客æ·', 6: 'ä¾åºå', 7: 'å·¥å', 8: '设å¤', 9: 'å·¥å
·', 10: '人å', 11: 'å·¥ä½ç«', 12: '车é´', 13: 'åºå', 14: 'æµè½¬å¡', 15: 'è£
ç®±å', 16: 'æ¹æ¬¡' }; |
| | | return map[val || 1] || '-'; |
| | | }; |
| | | const getStatusText = (val?: number) => val === 0 ? 'ç¦ç¨' : 'å¯ç¨'; |
| | | |
| | | const items = [ |
| | | { label: 'æ¡ç æ ¼å¼', value: getFormatText(barcodeData.value.format) }, |
| | | { label: 'ä¸å¡ç±»å', value: getBizTypeText(barcodeData.value.bizType) }, |
| | | { label: 'ä¸å¡ç¼ç ', value: barcodeData.value.bizCode }, |
| | | { label: 'ä¸å¡åç§°', value: barcodeData.value.bizName }, |
| | | { label: 'æ¡ç å
容', value: barcodeData.value.content }, |
| | | { label: 'ç¶æ', value: getStatusText(barcodeData.value.status) }, |
| | | ]; |
| | | |
| | | items.forEach((item) => { |
| | | ctx.font = 'bold 13px Arial, sans-serif'; |
| | | ctx.fillText(`${item.label}:`, infoX, y); |
| | | y += 18; |
| | | ctx.font = '13px Arial, sans-serif'; |
| | | const text = item.value || '-'; |
| | | // å¤çé¿ææ¬æ¢è¡ |
| | | const maxWidth = infoWidth - 10; |
| | | if (ctx.measureText(text).width > maxWidth) { |
| | | let currentText = text; |
| | | while (currentText.length > 0) { |
| | | let line = ''; |
| | | for (let i = 0; i < currentText.length; i++) { |
| | | const testLine = line + currentText[i]; |
| | | if (ctx.measureText(testLine).width > maxWidth) break; |
| | | line = testLine; |
| | | } |
| | | ctx.fillText(line, infoX + 5, y); |
| | | y += 16; |
| | | currentText = currentText.slice(line.length); |
| | | } |
| | | y += 6; |
| | | } else { |
| | | ctx.fillText(text, infoX + 5, y); |
| | | y += lineHeight; |
| | | } |
| | | }); |
| | | |
| | | const link = document.createElement('a'); |
| | | link.href = canvas.toDataURL('image/png'); |
| | | link.download = `barcode_${barcodeData.value.bizCode || 'unknown'}_${Date.now()}.png`; |
| | | link.click(); |
| | | message.success('ä¸è½½æå'); |
| | | }; |
| | | img.src = base64; |
| | | } |
| | | |
| | | async function handleGenerate() { |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal v-model:open="open" title="æ¥çæ¡ç " width="500px"> |
| | | <Modal v-model:open="open" title="æ¥çæ¡ç " width="750px"> |
| | | <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 class="mb-5 flex min-h-50 items-center rounded bg-gray-100 p-5"> |
| | | <div v-if="barcodeData.content" class="flex w-full items-center gap-6"> |
| | | <div class="flex-shrink-0"> |
| | | <WlsBarcode |
| | | ref="barcodeRef" |
| | | :content="barcodeData.content" |
| | | :format="barcodeData.format" |
| | | :height="150" |
| | | :width="280" |
| | | /> |
| | | </div> |
| | | <div class="flex-1"> |
| | | <Descriptions :data="barcodeData"> |
| | | <template #content> |
| | | <Tooltip :title="barcodeData.content"> |
| | | <span |
| | | class="inline-block max-w-60 overflow-hidden text-ellipsis whitespace-nowrap" |
| | | > |
| | | {{ barcodeData.content }} |
| | | </span> |
| | | </Tooltip> |
| | | </template> |
| | | </Descriptions> |
| | | </div> |
| | | </div> |
| | | <Empty v-else description="ææ æ¡ç æ°æ®" /> |
| | | <Empty v-else description="ææ æ¡ç æ°æ®" class="flex-1" /> |
| | | </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"> |
| | |
| | | |
| | | /** 跳转æ¡ç é
ç½® */ |
| | | function handleConfig() { |
| | | router.push({ name: 'WlsBarcodeConfig' }); |
| | | router.push({ path: '/wls/barcode/config' }); |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | |
| | | :content="row.content" |
| | | :format="row.format" |
| | | :height="60" |
| | | :width="140" |
| | | :width="60" |
| | | /> |
| | | </div> |
| | | </template> |
| | |
| | | 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 { Page, useVbenModal } from '@vben/common-ui'; |
| | | import { MesWmItemReceiptStatusEnum } from '@vben/constants'; |
| | | import { downloadFileFromBlobPart } from '@vben/utils'; |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | |
| | | cancelItemReceipt, |
| | | deleteItemReceipt, |
| | | exportItemReceipt, |
| | | generateItemReceiptFromArrivalNotice, |
| | | getItemReceiptPage, |
| | | } from '#/api/mes/wm/itemreceipt'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | import AnSelectDialog from './modules/an-select-dialog.vue'; |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [AnSelectModal, anSelectModalApi] = useVbenModal({ |
| | | connectedComponent: AnSelectDialog, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | |
| | | handleRefresh(); |
| | | } |
| | | |
| | | /** ä»å°è´§éç¥çæéè´å
¥åºå */ |
| | | async function handleGenerateFromAN() { |
| | | anSelectModalApi.open(); |
| | | } |
| | | |
| | | /** å°è´§éç¥éæ©åè° */ |
| | | async function handleArrivalNoticeSelected(arrivalNoticeId: number) { |
| | | const hideLoading = message.loading({ |
| | | content: 'æ£å¨çæéè´å
¥åºå...', |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | const id = await generateItemReceiptFromArrivalNotice(arrivalNoticeId); |
| | | message.success('éè´å
¥åºåçææå'); |
| | | // 跳转å°ç¼è¾é¡µ |
| | | formModalApi.setData({ formType: 'update', id }).open(); |
| | | handleRefresh(); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | | } |
| | | |
| | | /** 导åºè¡¨æ ¼ */ |
| | | async function handleExport() { |
| | | const data = await exportItemReceipt(await gridApi.formApi.getValues()); |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <Page auto-content-height><FormModal @success="handleRefresh" /> |
| | | <Page auto-content-height> |
| | | <FormModal @success="handleRefresh" /> |
| | | <AnSelectModal @selected="handleArrivalNoticeSelected" /> |
| | | |
| | | <Grid table-title="éè´å
¥åºåå表"> |
| | | <template #toolbar-tools> |
| | |
| | | onClick: handleCreate, |
| | | }, |
| | | { |
| | | label: 'ä»å°è´§éç¥çæ', |
| | | type: 'primary', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:wm-item-receipt:create'], |
| | | onClick: handleGenerateFromAN, |
| | | }, |
| | | { |
| | | label: $t('ui.actionTitle.export'), |
| | | type: 'primary', |
| | | icon: ACTION_ICON.DOWNLOAD, |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { MesWmArrivalNoticeApi } from '#/api/mes/wm/arrivalnotice'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { Page, useVbenModal } from '@vben/common-ui'; |
| | | import { MesWmArrivalNoticeStatusEnum } from '@vben/constants'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getArrivalNoticePage } from '#/api/mes/wm/arrivalnotice'; |
| | | |
| | | const emit = defineEmits<{ |
| | | selected: [arrivalNoticeId: number]; |
| | | }>(); |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | | formOptions: { |
| | | schema: [ |
| | | { |
| | | fieldName: 'code', |
| | | label: 'éç¥åå·', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥éç¥åå·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorName', |
| | | label: 'ä¾åºå', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥ä¾åºååç§°', |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | gridOptions: { |
| | | columns: [ |
| | | { |
| | | type: 'radio', |
| | | width: 60, |
| | | }, |
| | | { |
| | | field: 'code', |
| | | title: 'éç¥åå·', |
| | | minWidth: 160, |
| | | }, |
| | | { |
| | | field: 'name', |
| | | title: 'éç¥ååç§°', |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'vendorName', |
| | | title: 'ä¾åºååç§°', |
| | | minWidth: 120, |
| | | }, |
| | | { |
| | | field: 'purchaseOrderNo', |
| | | title: 'éè´è®¢åå·', |
| | | minWidth: 140, |
| | | }, |
| | | { |
| | | field: 'arrivalDate', |
| | | title: 'å°è´§æ¥æ', |
| | | width: 180, |
| | | formatter: 'formatDate', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'ç¶æ', |
| | | width: 100, |
| | | cellRender: { |
| | | name: 'CellDict', |
| | | props: { type: 'mes_wm_arrival_notice_status' }, |
| | | }, |
| | | }, |
| | | ], |
| | | height: 'auto', |
| | | keepSource: true, |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | return await getArrivalNoticePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | status: MesWmArrivalNoticeStatusEnum.PENDING_RECEIPT, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | | }, |
| | | }, |
| | | rowConfig: { |
| | | keyField: 'id', |
| | | isHover: true, |
| | | }, |
| | | toolbarConfig: { |
| | | refresh: true, |
| | | search: true, |
| | | }, |
| | | } as VxeTableGridOptions<MesWmArrivalNoticeApi.ArrivalNotice>, |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const selectedRows = gridApi.grid.getRadioRecord(); |
| | | if (!selectedRows) { |
| | | message.warning('è¯·éæ©å°è´§éç¥å'); |
| | | return; |
| | | } |
| | | emit('selected', selectedRows.id); |
| | | await modalApi.close(); |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (isOpen) { |
| | | await gridApi.query(); |
| | | } |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal title="éæ©å°è´§éç¥å" class="w-2/3"> |
| | | <Grid table-title="å°è´§éç¥åå表" /> |
| | | </Modal> |
| | | </template> |
| | |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | | import { confirm, useVbenModal } from '../../../../packages/effects/common-ui/src'; |
| | | import { MesWmItemReceiptStatusEnum } from '../../../../packages/constants/src'; |
| | | import { confirm, useVbenModal } from '@vben/common-ui'; |
| | | import { MesWmItemReceiptStatusEnum } from '@vben/constants'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | |
| | | getItemReceipt, |
| | | stockItemReceipt, |
| | | submitItemReceipt, |
| | | submitItemReceiptApproval, |
| | | updateItemReceipt, |
| | | } from '#/api/mes/wm/itemreceipt'; |
| | | import { $t } from '#/locales'; |
| | |
| | | const canSubmit = computed( |
| | | () => |
| | | // æ¯å¦å¯æäº¤ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmItemReceiptStatusEnum.PREPARE, |
| | | ); |
| | | const canSubmitApproval = computed( |
| | | () => |
| | | // æ¯å¦å¯æäº¤å®¡æ¹ |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmItemReceiptStatusEnum.PREPARE, |
| | | ); |
| | |
| | | try { |
| | | await finishItemReceipt(formData.value.id); |
| | | message.success('å
¥åºæå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** æäº¤å®¡æ¹ */ |
| | | async function handleSubmitApproval() { |
| | | if (!formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | // 使ç¨é»è®¤æµç¨keyï¼å®é
项ç®ä¸å¯è½éè¦å¼¹çªéæ© |
| | | const processDefinitionKey = 'item_receipt_approval'; |
| | | await submitItemReceiptApproval(formData.value.id, processDefinitionKey); |
| | | message.success('æäº¤å®¡æ¹æå'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | |
| | | > |
| | | <Button type="primary">æäº¤</Button> |
| | | </Popconfirm> |
| | | <Button v-if="canSubmitApproval" type="primary" @click="handleSubmitApproval"> |
| | | æäº¤å®¡æ¹ |
| | | </Button> |
| | | <Button v-if="isStock" type="primary" @click="confirmStock"> |
| | | æ§è¡ä¸æ¶ |
| | | </Button> |
| | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { ErpPurchaseOrderSelect } from '#/views/erp/purchase/order/components'; |
| | | import { WmBatchSelect } from '#/views/wls/batch/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderCode', |
| | | label: 'éè´è®¢åå·', |
| | | fieldName: 'vendorName', |
| | | label: '', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderId', |
| | | label: 'éè´è®¢å', |
| | | component: markRaw(ErpPurchaseOrderSelect), |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥éè´è®¢åå·', |
| | | placeholder: 'è¯·éæ©éè´è®¢å', |
| | | onChange: (item: any) => { |
| | | if (item?.supplierId && formApi) { |
| | | formApi.setFieldValue('vendorId', item.supplierId); |
| | | formApi.setFieldValue('vendorName', item.supplierName); |
| | | } |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | |
| | | component: markRaw(MdVendorSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['vendorName'], |
| | | componentProps: (values) => ({ |
| | | placeholder: 'è¯·éæ©ä¾åºå', |
| | | disabled: true, |
| | | vendorName: values.vendorName as string, |
| | | }), |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | defineOptions({ name: 'WlsArea' }); |
| | | |
| | | const route = useRoute(); |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | defineOptions({ name: 'WlsWarehouse' }); |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const [FormModal, formModalApi] = useVbenModal({ |
| | |
| | | /** 跳转åºåºå表 */ |
| | | function handleOpenLocation(row: MesWmWarehouseApi.Warehouse) { |
| | | router.push({ |
| | | name: 'WlsLocation', |
| | | path: '/wls/location', |
| | | query: { warehouseId: String(row.id) }, |
| | | }); |
| | | } |
| | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | | import Form from './modules/form.vue'; |
| | | |
| | | defineOptions({ name: 'WlsLocation' }); |
| | | |
| | | const route = useRoute(); |
| | | const router = useRouter(); |
| | | |
| | |
| | | /** 跳转åºä½å表 */ |
| | | function handleOpenArea(row: MesWmWarehouseLocationApi.WarehouseLocation) { |
| | | router.push({ |
| | | name: 'WlsArea', |
| | | path: '/wls/area', |
| | | query: { locationId: String(row.id) }, |
| | | }); |
| | | } |
| | |
| | | oxc: { |
| | | enable: false, |
| | | }, |
| | | optimizeDeps: { |
| | | include: [ |
| | | "vue", |
| | | "vue-router", |
| | | "pinia", |
| | | "ant-design-vue", |
| | | "dayjs", |
| | | "@vueuse/core", |
| | | "axios", |
| | | ], |
| | | exclude: [ |
| | | "dhtmlx-gantt", |
| | | "tinymce", |
| | | "bpmn-js", |
| | | "bpmn-js-properties-panel", |
| | | "video.js", |
| | | ], |
| | | }, |
| | | build: { |
| | | rollupOptions: { |
| | | output: { |
| | | manualChunks: { |
| | | "vendor-vue": ["vue", "vue-router", "pinia"], |
| | | "vendor-ui": ["ant-design-vue", "@vueuse/core"], |
| | | "vendor-utils": ["dayjs", "axios", "@vee-validate/zod", "zod"], |
| | | "vendor-editor": [ |
| | | "tinymce", |
| | | "@tinymce/tinymce-vue", |
| | | "@form-create/ant-design-vue", |
| | | ], |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | | server: { |
| | | allowedHosts: true, |
| | | watch: { |