From c2e8526f8f857be5e3a8c6f2b39c5efd424de33e Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 15 十月 2026 11:50:24 +0800
Subject: [PATCH] refactor(auth): 优化认证逻辑和界面组件结构

---
 src/views/mes/qc/indicatorresult/components/form.vue |   41 +++++++++++++++++++++++++++++++++++------
 1 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/src/views/mes/qc/indicatorresult/components/form.vue b/src/views/mes/qc/indicatorresult/components/form.vue
index c6481b2..3984da5 100644
--- a/src/views/mes/qc/indicatorresult/components/form.vue
+++ b/src/views/mes/qc/indicatorresult/components/form.vue
@@ -40,11 +40,14 @@
 
 const emit = defineEmits(['success']);
 const formType = ref<FormType>('create');
+const isDetail = computed(() => formType.value === 'detail');
 const items = ref<MesQcIndicatorResultApi.IndicatorResultDetail[]>([]);
 const ctxData = ref<CtxData>();
 
 const getTitle = computed(() =>
-  formType.value === 'update'
+  isDetail.value
+    ? '妫�娴嬬粨鏋滆鎯�'
+    : formType.value === 'update'
     ? $t('ui.actionTitle.edit', ['妫�楠岀粨鏋�'])
     : $t('ui.actionTitle.create', ['妫�楠岀粨鏋�']),
 );
@@ -73,9 +76,21 @@
     : [];
 }
 
+function getDisplayValue(item: MesQcIndicatorResultApi.IndicatorResultDetail) {
+  if (item.value === undefined || item.value === null || item.value === '') {
+    return '鏈~鍐�';
+  }
+  if (item.valueType === MesQcResultValueType.DICT) {
+    return getValueOptions(item.valueSpecification).find(
+      (option) => option.value === String(item.value),
+    )?.label ?? item.value;
+  }
+  return item.value;
+}
+
 const [Modal, modalApi] = useVbenModal({
   async onConfirm() {
-    if (!ctxData.value) {
+    if (!ctxData.value || isDetail.value) {
       return;
     }
     const { valid } = await formApi.validate();
@@ -130,11 +145,18 @@
       items.value = [];
       return;
     }
-    formApi.setState({ schema: useQcIndicatorResultFormSchema(formApi) });
     // 鍔犺浇鏁版嵁
     const data = modalApi.getData<CtxData>();
     ctxData.value = data;
     formType.value = data.formType;
+    formApi.setState({
+      schema: useQcIndicatorResultFormSchema(formApi, isDetail.value),
+    });
+    formApi.setDisabled(isDetail.value);
+    modalApi.setState({
+      showConfirmButton: !isDetail.value,
+      cancelText: isDetail.value ? '鍏抽棴' : $t('common.cancel'),
+    });
     modalApi.lock();
     try {
       const detail = await getIndicatorResultDetail(
@@ -148,7 +170,9 @@
         valueNumber:
           (item.valueType === MesQcResultValueType.FLOAT ||
             item.valueType === MesQcResultValueType.INTEGER) &&
-          item.value !== null
+          item.value != null &&
+          String(item.value).trim() !== '' &&
+          Number.isFinite(Number(item.value))
             ? Number(item.value)
             : undefined,
       }));
@@ -157,7 +181,6 @@
         id: detail.id,
         code: detail.code,
         remark: detail.remark,
-        sn: detail.sn,
       });
     } finally {
       modalApi.unlock();
@@ -181,8 +204,14 @@
           <AForm.Item
             :label="`妫�娴嬮」${index + 1}锛�${item.indicatorName ?? ''}`"
           >
+            <div v-if="isDetail" class="whitespace-pre-wrap break-words py-1">
+              {{ getDisplayValue(item) }}
+              <div v-if="item.remark" class="mt-1 text-sm text-muted-foreground">
+                澶囨敞锛歿{ item.remark }}
+              </div>
+            </div>
             <InputNumber
-              v-if="
+              v-else-if="
                 item.valueType === MesQcResultValueType.FLOAT ||
                 item.valueType === MesQcResultValueType.INTEGER
               "

--
Gitblit v1.9.3