From 1ed040591afdcbe3c5df42ad5e02e2cfa56edd87 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 20 十月 2026 11:19:20 +0800
Subject: [PATCH] feat(mobile): 优化移动端质检记录界面功能

---
 src/views/mes/qc/seedQuality/index.vue |   54 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/src/views/mes/qc/seedQuality/index.vue b/src/views/mes/qc/seedQuality/index.vue
index 6e2bc93..e69dfe3 100644
--- a/src/views/mes/qc/seedQuality/index.vue
+++ b/src/views/mes/qc/seedQuality/index.vue
@@ -11,6 +11,7 @@
 import {
   resolveSeedQuality,
   submitSeedQualityGroup,
+  getSeedIndicatorRanges,
 } from '#/api/mes/qc/seedQuality';
 import { getWarehouseSimpleList } from '#/api/mes/wm/warehouse';
 
@@ -54,17 +55,31 @@
 const qualifiedWarehouseId = ref<number>();
 
 const indicators = ref<IndicatorForm[]>([
-  { code: 'purity', label: '绾害', unit: '%', minValue: 0, maxValue: 100 },
-  { code: 'cleanliness', label: '鍑�搴�', unit: '%', minValue: 0, maxValue: 100 },
-  { code: 'germination_rate', label: '鍙戣娊鐜�', unit: '%', minValue: 0, maxValue: 100 },
-  { code: 'moisture', label: '姘村垎', unit: '%', minValue: 0, maxValue: 100 },
+  { code: 'purity', label: '绾害', unit: '%' },
+  { code: 'cleanliness', label: '鍑�搴�', unit: '%' },
+  { code: 'germination_rate', label: '鍙戣娊鐜�', unit: '%' },
+  { code: 'moisture', label: '姘村垎', unit: '%' },
 ]);
+const rangesReady = computed(() => indicators.value.every((item) =>
+  item.minValue !== undefined && item.maxValue !== undefined));
+
+async function loadRanges() {
+  const ranges = await getSeedIndicatorRanges();
+  for (const item of indicators.value) {
+    const range = ranges.find((row) => row.indicatorCode === item.code);
+    item.minValue = range?.minValue === undefined ? undefined : Number(range.minValue);
+    item.maxValue = range?.maxValue === undefined ? undefined : Number(range.maxValue);
+  }
+}
 
 const pendingCount = computed(() => target.value?.pendingBagIds?.length ?? 0);
 const completedCount = computed(() => target.value?.completedBagIds?.length ?? 0);
 const enteredCount = computed(() => indicators.value.filter((item) => item.value !== undefined && item.value !== null).length);
 const passedCount = computed(() => indicators.value.filter(isPassed).length);
-const allEntered = computed(() => enteredCount.value === indicators.value.length);
+const allEntered = computed(() => indicators.value.every((item) =>
+  item.value !== undefined && item.value !== null
+  && item.minValue !== undefined && item.minValue !== null
+  && item.maxValue !== undefined && item.maxValue !== null));
 const overallPassed = computed(() => allEntered.value && passedCount.value === indicators.value.length);
 const isGroupScan = computed(() => scanType.value !== 'BAG');
 const qualifiedWarehouseOptions = computed(() =>
@@ -99,8 +114,6 @@
   reason.value = '';
   indicators.value.forEach((item) => {
     item.value = undefined;
-    item.minValue = 0;
-    item.maxValue = 100;
   });
 }
 
@@ -129,6 +142,7 @@
   resolving.value = true;
   submittedCount.value = undefined;
   try {
+    await loadRanges().catch(() => undefined);
     const data = await resolveSeedQuality(value, scanType.value);
     if (data.canceled) {
       target.value = undefined;
@@ -163,7 +177,7 @@
     return;
   }
   if (!allEntered.value) {
-    message.warning('璇峰厛濉啓鍥涢」鎸囨爣鐨勫疄娴嬪��');
+    message.warning('璇峰~鍐欏洓椤规寚鏍囩殑瀹炴祴鍊煎拰鏈鍚堟牸涓婁笅闄�');
     return;
   }
   if (indicators.value.some((item) => item.minValue === undefined || item.maxValue === undefined || item.minValue > item.maxValue)) {
@@ -187,8 +201,8 @@
     Modal.confirm({
       title: overallPassed.value ? '纭鎻愪氦鍚堟牸缁撴灉锛�' : '纭鎻愪氦涓嶅悎鏍肩粨鏋滐紵',
       content: overallPassed.value
-        ? `鏈 ${count} 琚嬪皢缁熶竴鍒ゅ畾鍚堟牸锛屽苟浠庢殏瀛樺簱瀛樿浆鍏ユ墍閫夊悎鏍煎簱銆�${scopeNote}`
-        : `鏈 ${count} 琚嬪皢浠庢殏瀛樺簱瀛樹腑娓呴櫎骞舵爣璁颁笉鍚堟牸锛屽悓鏃朵繚鐣欎笉鍚堟牸鍘熷洜鐢ㄤ簬璐ㄩ噺鍒嗘瀽銆�${scopeNote}`,
+        ? `鏈 ${count} 琚嬪皢缁熶竴璁板綍涓哄垵妫�鍚堟牸锛屽緟鍒濇瀹℃牳閫氳繃鍚庡妫�锛涘妫�瀹℃牳閫氳繃鍚庢墠杞叆鍚堟牸搴撱��${scopeNote}`
+        : `鏈 ${count} 琚嬪皢璁板綍涓哄垵妫�涓嶅悎鏍硷紝淇濈暀鏆傚瓨搴撳瓨锛涘垵妫�瀹℃牳鍚庡喅瀹氭槸鍚﹁繘鍏ュ妫�銆�${scopeNote}`,
       okText: '纭鎻愪氦',
       cancelText: '杩斿洖淇敼',
       okButtonProps: { danger: !overallPassed.value },
@@ -216,7 +230,7 @@
       })),
     });
     submittedCount.value = result.processedCount;
-    message.success(`鏈 ${result.processedCount} 琚嬪凡鎻愪氦锛�${passed ? '璐ㄦ鍚堟牸锛屽凡杞叆鎵�閫夊悎鏍煎簱' : '璐ㄦ涓嶅悎鏍硷紝宸茶褰曞師鍥犲苟绉婚櫎鏆傚瓨搴撳瓨'}`);
+    message.success(`鏈 ${result.processedCount} 琚嬪凡鎻愪氦鍒濇锛屽緟鍒濇瀹℃牳`);
     if (pageRoot.value && !window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
       gsap.fromTo('.result-card', { scale: 0.97, autoAlpha: 0.5 }, { scale: 1, autoAlpha: 1, duration: 0.35, ease: 'power2.out' });
     }
@@ -232,6 +246,11 @@
 }
 
 onMounted(async () => {
+  try {
+    await loadRanges();
+  } catch (error) {
+    message.error(errorText(error));
+  }
   try {
     const warehouses = await getWarehouseSimpleList();
     qualifiedWarehouses.value = (warehouses ?? []).filter(
@@ -263,7 +282,7 @@
       <div>
         <div class="eyebrow">MES / 璐ㄩ噺绠$悊</div>
         <h1>绉嶅瓙璐ㄦ</h1>
-        <p>閫夋嫨琚嬬爜銆佹墭鐩樼爜鎴栨壒娆$爜璇嗗埆寰呮鑼冨洿锛屽綍鍏ョ函搴︺�佸噣搴︺�佸彂鑺界巼鍜屾按鍒嗭紝绯荤粺鑷姩鍒ゅ畾妫�楠岀粨璁�</p>
+        <p>璇嗗埆寰呮鑼冨洿骞跺綍鍏ュ洓椤规寚鏍囷紱鍒濇瀹℃牳鍚庡妫�锛屽妫�瀹℃牳鍚庡叆搴撴垨澶勭疆</p>
       </div>
       <div class="header-badge"><IconifyIcon icon="ep:checked" /> 琚嬬爜 / 鎵樼洏鐮� / 鎵规鐮�</div>
     </header>
@@ -315,17 +334,18 @@
             </a-form-item>
           </div>
           <p v-if="!qualifiedWarehouses.length" class="target-warning">鏆傛棤鍙敤鍚堟牸搴擄紝璇疯仈绯荤鐞嗗憳閰嶇疆鍚庡啀鎻愪氦璐ㄦ銆�</p>
+          <a-alert v-if="!rangesReady" class="target-empty" type="info" show-icon message="鏈璇锋墜鍔ㄥ~鍐欏悎鏍艰寖鍥�" description="绠$悊鍛樺皻鏈厤缃畬鏁撮粯璁よ寖鍥达紱浠嶅彲鎵嬪姩濉啓鍥涢」鎸囨爣鐨勫悎鏍间笂涓嬮檺銆�" />
 
           <a-divider orientation="left">鎸囨爣缁撴灉</a-divider>
           <div class="indicator-list">
-            <div v-for="item in indicators" :key="item.code" class="indicator-row" :class="{ failed: !isPassed(item) }">
+            <div v-for="item in indicators" :key="item.code" class="indicator-row" :class="{ failed: allEntered && !isPassed(item) }">
               <div class="indicator-name"><span class="indicator-dot" :class="isPassed(item) ? 'pass' : 'fail'" /><strong>{{ item.label }}</strong><small>{{ item.unit }}</small></div>
               <a-input-number v-model:value="item.value" class="indicator-input" :disabled="loading" :min="0" :precision="3" placeholder="瀹炴祴鍊�" />
               <span class="range-separator">鑼冨洿</span>
-              <a-input-number v-model:value="item.minValue" class="range-input" :disabled="loading" :min="0" :precision="3" placeholder="涓嬮檺" />
+              <a-input-number v-model:value="item.minValue" class="range-input" :disabled="loading" :min="0" :max="100" :precision="3" placeholder="涓嬮檺" />
               <span>鈥�</span>
-              <a-input-number v-model:value="item.maxValue" class="range-input" :disabled="loading" :min="0" :precision="3" placeholder="涓婇檺" />
-              <a-tag :color="isPassed(item) ? 'success' : 'error'">{{ isPassed(item) ? '鍚堟牸' : '瓒呭嚭鑼冨洿' }}</a-tag>
+              <a-input-number v-model:value="item.maxValue" class="range-input" :disabled="loading" :min="0" :max="100" :precision="3" placeholder="涓婇檺" />
+              <a-tag :color="!allEntered ? 'default' : isPassed(item) ? 'success' : 'error'">{{ !allEntered ? '寰呭綍鍏�' : isPassed(item) ? '鍚堟牸' : '瓒呭嚭鑼冨洿' }}</a-tag>
             </div>
           </div>
 
@@ -338,7 +358,7 @@
         <template #title><div class="card-title"><IconifyIcon icon="ep:data-analysis" />鍒ゅ畾璇存槑</div></template>
         <div class="result-hero" :class="overallPassed ? 'passed' : allEntered ? 'failed-result' : 'pending-result'"><IconifyIcon :icon="overallPassed ? 'ep:circle-check-filled' : allEntered ? 'ep:warning-filled' : 'ep:edit-pen'" /><strong>{{ overallPassed ? '褰撳墠缁撴灉鍚堟牸' : allEntered ? '褰撳墠瀛樺湪涓嶅悎鏍奸」' : '绛夊緟褰曞叆鎸囨爣' }}</strong><span>{{ allEntered ? '瀹炴祴鍊奸渶澶勪簬鏈�灏忓�间笌鏈�澶у�间箣闂�' : `宸插綍鍏� ${enteredCount} / 4 椤瑰疄娴嬪�糮 }}</span></div>
         <div class="rule-list"><div><IconifyIcon icon="ep:check" /><span>鍏堣瘑鍒爜鍊煎啀褰曞叆鎸囨爣锛屽洓椤规寚鏍囧繀椤诲叏閮ㄦ彁浜�</span></div><div><IconifyIcon icon="ep:check" /><span>杈圭晫鍊兼寜鍚堟牸澶勭悊</span></div><div><IconifyIcon icon="ep:check" /><span>鎵樼洏鐮併�佹壒娆$爜鐨勭粨璁哄簲鐢ㄤ簬鏈鍏ㄩ儴寰呮琚�</span></div><div><IconifyIcon icon="ep:check" /><span>涓嶅悎鏍肩粨鏋滈渶淇濈暀鍘熷洜</span></div><div><IconifyIcon icon="ep:check" /><span>璐ㄦ鍛樹笌妫�楠屾椂闂寸敱鏈嶅姟绔褰�</span></div></div>
-        <a-alert message="搴撳瓨娴佽浆鐢卞悗绔鐞�" description="鍚堟牸琚嬪皢浠庢殏瀛樺簱瀛樿浆鍏ユ墍閫夊悎鏍煎簱锛涗笉鍚堟牸琚嬪皢鐩存帴娓呴櫎鏆傚瓨搴撳瓨骞朵繚鐣欎笉鍚堟牸鍘熷洜銆傛彁浜ゆ椂鏈嶅姟绔細閲嶆柊鏍稿鏈寰呮琚嬫竻鍗曪紝娓呭崟鍙樺寲闇�閲嶆柊璇嗗埆銆�" type="info" show-icon />
+        <a-alert message="澶嶆瀹℃牳瀹屾垚鍚庢祦杞簱瀛�" description="鍒濇鍙婂妫�鏈熼棿琚嬬爜鐣欏湪鏆傚瓨搴撱�傚垵妫�瀹℃牳閫氳繃鍚庤繘鍏ュ妫�锛涘妫�鍚堟牸骞跺鏍搁�氳繃鎵嶈浆鍏ュ悎鏍煎簱锛屽妫�涓嶅悎鏍肩粡纭鍚庢墠鎶ュ簾銆�" type="info" show-icon />
         <div v-if="submittedCount" class="success-note"><IconifyIcon icon="ep:success-filled" /><span>鏈�杩戞彁浜よ川妫�锛�<strong>{{ submittedCount }} 琚�</strong></span></div>
       </a-card>
     </section>

--
Gitblit v1.9.3