| | |
| | | |
| | | import { useVbenForm } from "#/adapter/form"; |
| | | import { TableAction, useVbenVxeGrid } from "#/adapter/vxe-table"; |
| | | import { createBatch, getBatch, updateBatch } from "#/api/mes/pro/batch"; |
| | | import { |
| | | createBatch, |
| | | fillBatchInfo, |
| | | getBatch, |
| | | updateBatch, |
| | | } from "#/api/mes/pro/batch"; |
| | | import { $t } from "#/locales"; |
| | | import { UserSelect } from "#/views/system/user/components"; |
| | | |
| | |
| | | const formData = ref<MesProBatchApi.Batch>(); |
| | | |
| | | const isEditable = computed(() => |
| | | ["create", "update"].includes(formType.value) |
| | | ["create", "update", "fill"].includes(formType.value) |
| | | ); |
| | | |
| | | const getTitle = computed(() => { |
| | |
| | | } |
| | | case "update": { |
| | | return $t("ui.actionTitle.edit", ["生产批次"]); |
| | | } |
| | | case "fill": { |
| | | return "补录批次信息"; |
| | | } |
| | | default: { |
| | | return $t("ui.actionTitle.create", ["生产批次"]); |
| | |
| | | modalApi.lock(); |
| | | try { |
| | | const data = (await formApi.getValues()) as MesProBatchApi.Batch; |
| | | if (formData.value?.id) { |
| | | if (formType.value === "fill") { |
| | | await fillBatchInfo({ ...data, id: formData.value!.id, workers }); |
| | | } else if (formData.value?.id) { |
| | | await updateBatch({ ...data, id: formData.value.id, workers }); |
| | | } else { |
| | | await createBatch({ ...data, workers }); |