| | |
| | | import { MesAutoCodeRuleCode, MesProFeedbackStatusEnum } from '@vben/constants'; |
| | | import { useUserStore } from '@vben/stores'; |
| | | |
| | | import { Button, message, Popconfirm, Tabs } from 'ant-design-vue'; |
| | | import { Button, Input, message, Popconfirm, Tabs } from 'ant-design-vue'; |
| | | |
| | | import { useVbenForm } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | |
| | | } from '#/api/mes/pro/feedback'; |
| | | import { getRouteProcessByRouteAndProcess } from '#/api/mes/pro/route/process'; |
| | | import { getWorkOrder } from '#/api/mes/pro/workorder'; |
| | | import { getWorkOrderParamRecordPage } from '#/api/mes/pro/workorderparamrecord'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | |
| | | const userStore = useUserStore(); |
| | | const subTabsName = ref('itemConsume'); |
| | | const originalSnapshot = ref(''); // 表单原始数据快照,用于 submit 时跳过未变更的保存请求 |
| | | const paramDetails = ref<Array<{ id: number; paramName?: string; paramCode?: string; unitMeasureName?: string; paramValue?: string }>>([]); |
| | | |
| | | const isEditable = computed(() => |
| | | ['create', 'submit', 'update'].includes(formType.value), |
| | |
| | | /** 读取并按提交规则对齐后的表单数据,用于快照和保存 */ |
| | | async function getAlignedData(): Promise<MesProFeedbackApi.Feedback> { |
| | | const data = (await formApi.getValues()) as MesProFeedbackApi.Feedback; |
| | | syncParamValues(data); |
| | | alignQuantity(data); |
| | | return data; |
| | | } |
| | |
| | | |
| | | const batchDialogRef = ref<InstanceType<typeof BatchInputDialog>>(); |
| | | const batchActionType = ref<'submit' | 'approve'>(''); |
| | | |
| | | async function loadParamDetails(taskId?: number) { |
| | | paramDetails.value = []; |
| | | if (!taskId) return; |
| | | const page = await getWorkOrderParamRecordPage({ taskId, pageNo: 1, pageSize: 1 }); |
| | | const record = page.list?.[0]; |
| | | paramDetails.value = (record?.details ?? []).map((detail) => ({ |
| | | id: detail.id!, |
| | | paramCode: detail.paramCode, |
| | | paramName: detail.paramName, |
| | | unitMeasureName: detail.unitMeasureName, |
| | | paramValue: detail.paramValue, |
| | | })); |
| | | } |
| | | |
| | | function syncParamValues(data: MesProFeedbackApi.Feedback) { |
| | | data.paramValues = paramDetails.value.map((detail) => ({ |
| | | detailId: detail.id, |
| | | value: detail.paramValue, |
| | | })); |
| | | } |
| | | |
| | | /** 执行提交(含批次属性) */ |
| | | async function doSubmit(batchFields?: Record<string, unknown>) { |
| | |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getFeedback(data.id); |
| | | await loadParamDetails(formData.value.taskId); |
| | | const checkFlag = await resolveCheckFlag( |
| | | formData.value.routeId, |
| | | formData.value.processId, |
| | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-3/5"> |
| | | <Form class="mx-4" /> |
| | | <div v-if="paramDetails.length" class="mx-4 mt-4 rounded border border-gray-200 p-4"> |
| | | <div class="mb-3 font-medium">工艺参数</div> |
| | | <div class="grid grid-cols-2 gap-3"> |
| | | <div v-for="detail in paramDetails" :key="detail.id" class="flex items-center gap-2"> |
| | | <span class="w-40 text-right text-sm text-gray-600"> |
| | | {{ detail.paramName || detail.paramCode }}{{ detail.unitMeasureName ? `(${detail.unitMeasureName})` : '' }} |
| | | </span> |
| | | <Input v-model:value="detail.paramValue" :disabled="!isEditable" placeholder="请输入参数值" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <Tabs |
| | | v-if="showSubTabs" |
| | | v-model:active-key="subTabsName" |