From 63b4909ac5d0b7355be211cc7080673b41cdb3cc Mon Sep 17 00:00:00 2001
From: zhuguifei <zhuguifei>
Date: 星期三, 04 三月 2026 14:46:02 +0800
Subject: [PATCH] refactor(module(qa)): 代码重构

---
 ruoyi-plus-soybean/src/views/analy/packer/modules/packer-data-operate-drawer.vue |  145 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 105 insertions(+), 40 deletions(-)

diff --git a/ruoyi-plus-soybean/src/views/analy/packer/modules/packer-data-operate-drawer.vue b/ruoyi-plus-soybean/src/views/analy/packer/modules/packer-data-operate-drawer.vue
index 3696912..bce49be 100755
--- a/ruoyi-plus-soybean/src/views/analy/packer/modules/packer-data-operate-drawer.vue
+++ b/ruoyi-plus-soybean/src/views/analy/packer/modules/packer-data-operate-drawer.vue
@@ -1,9 +1,9 @@
 <script setup lang="ts">
 import { computed, ref, watch } from 'vue';
-import { jsonClone } from '~/packages/utils';
 import { fetchCreatePackerData, fetchUpdatePackerData } from '@/service/api/analy/packer-data';
 import { useFormRules, useNaiveForm } from '@/hooks/common/form';
 import { $t } from '@/locales';
+import { jsonClone } from '~/packages/utils';
 
 defineOptions({
   name: 'PackerDataOperateDrawer'
@@ -45,39 +45,34 @@
 
 function createDefaultModel(): Model {
   return {
-      time: null,
-      key: '',
-      online: null,
-      qty: null,
-      badQty: null,
-      xiaohemoVal: null,
-      tiaohemoVal: null,
-      xiaohezhiVal: null,
-      tiaohezhiVal: null,
-      neichenzhiVal: null,
-      runTime: null,
-      stopTime: null,
-      stopTimes: null,
-      speed: null,
-      runStatus: null,
-      tsQty: null,
-      mainQty: null,
-      mainBadQty: null,
-      tbjQty: null,
-      tbjGdQty: null,
-      tbjBadQty: null,
-      pbjQty: null,
-      shift: null,
-      equNo: null
+    time: null,
+    key: '',
+    online: null,
+    qty: null,
+    badQty: null,
+    xiaohemoVal: null,
+    tiaohemoVal: null,
+    xiaohezhiVal: null,
+    tiaohezhiVal: null,
+    neichenzhiVal: null,
+    runTime: null,
+    stopTime: null,
+    stopTimes: null,
+    speed: null,
+    runStatus: null,
+    tsQty: null,
+    mainQty: null,
+    mainBadQty: null,
+    tbjQty: null,
+    tbjGdQty: null,
+    tbjBadQty: null,
+    pbjQty: null,
+    shift: null,
+    equNo: null
   };
 }
 
-type RuleKey = Extract<
-  keyof Model,
-  | 'time'
-  | 'shift'
-  | 'equNo'
->;
+type RuleKey = Extract<keyof Model, 'time' | 'shift' | 'equNo'>;
 
 const rules: Record<RuleKey, App.Global.FormRule> = {
   time: createRequiredRule('鏃堕棿涓嶈兘涓虹┖'),
@@ -100,16 +95,91 @@
 async function handleSubmit() {
   await validate();
 
-  const { time, key, online, qty, badQty, xiaohemoVal, tiaohemoVal, xiaohezhiVal, tiaohezhiVal, neichenzhiVal, runTime, stopTime, stopTimes, speed, runStatus, tsQty, mainQty, mainBadQty, tbjQty, tbjGdQty, tbjBadQty, pbjQty, shift, equNo } = model.value;
+  const {
+    time,
+    key,
+    online,
+    qty,
+    badQty,
+    xiaohemoVal,
+    tiaohemoVal,
+    xiaohezhiVal,
+    tiaohezhiVal,
+    neichenzhiVal,
+    runTime,
+    stopTime,
+    stopTimes,
+    speed,
+    runStatus,
+    tsQty,
+    mainQty,
+    mainBadQty,
+    tbjQty,
+    tbjGdQty,
+    tbjBadQty,
+    pbjQty,
+    shift,
+    equNo
+  } = model.value;
 
   // request
   if (props.operateType === 'add') {
-    const { error } = await fetchCreatePackerData({ time, key, online, qty, badQty, xiaohemoVal, tiaohemoVal, xiaohezhiVal, tiaohezhiVal, neichenzhiVal, runTime, stopTime, stopTimes, speed, runStatus, tsQty, mainQty, mainBadQty, tbjQty, tbjGdQty, tbjBadQty, pbjQty, shift, equNo });
+    const { error } = await fetchCreatePackerData({
+      time,
+      key,
+      online,
+      qty,
+      badQty,
+      xiaohemoVal,
+      tiaohemoVal,
+      xiaohezhiVal,
+      tiaohezhiVal,
+      neichenzhiVal,
+      runTime,
+      stopTime,
+      stopTimes,
+      speed,
+      runStatus,
+      tsQty,
+      mainQty,
+      mainBadQty,
+      tbjQty,
+      tbjGdQty,
+      tbjBadQty,
+      pbjQty,
+      shift,
+      equNo
+    });
     if (error) return;
   }
 
   if (props.operateType === 'edit') {
-    const { error } = await fetchUpdatePackerData({ time, key, online, qty, badQty, xiaohemoVal, tiaohemoVal, xiaohezhiVal, tiaohezhiVal, neichenzhiVal, runTime, stopTime, stopTimes, speed, runStatus, tsQty, mainQty, mainBadQty, tbjQty, tbjGdQty, tbjBadQty, pbjQty, shift, equNo });
+    const { error } = await fetchUpdatePackerData({
+      time,
+      key,
+      online,
+      qty,
+      badQty,
+      xiaohemoVal,
+      tiaohemoVal,
+      xiaohezhiVal,
+      tiaohezhiVal,
+      neichenzhiVal,
+      runTime,
+      stopTime,
+      stopTimes,
+      speed,
+      runStatus,
+      tsQty,
+      mainQty,
+      mainBadQty,
+      tbjQty,
+      tbjGdQty,
+      tbjBadQty,
+      pbjQty,
+      shift,
+      equNo
+    });
     if (error) return;
   }
 
@@ -139,12 +209,7 @@
           />
         </NFormItem>
         <NFormItem label="key" path="key">
-          <NInput
-            v-model:value="model.key"
-            :rows="3"
-            type="textarea"
-            placeholder="璇疯緭鍏ey"
-          />
+          <NInput v-model:value="model.key" :rows="3" type="textarea" placeholder="璇疯緭鍏ey" />
         </NFormItem>
         <NFormItem label="缃戠粶鐘舵��(0寮傚父锛�1姝e父)" path="online">
           <NInput v-model:value="model.online" placeholder="璇疯緭鍏ョ綉缁滅姸鎬�(0寮傚父锛�1姝e父)" />

--
Gitblit v1.9.3