From cd3c5e597ad75051941dab65119b510fb16485e1 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期四, 28 八月 2025 15:10:29 +0800
Subject: [PATCH] 文件修改增加对比

---
 src/views/flowmgr/taskassign.vue |   72 +++++++++++++++++++++++++++++++++---
 1 files changed, 66 insertions(+), 6 deletions(-)

diff --git a/src/views/flowmgr/taskassign.vue b/src/views/flowmgr/taskassign.vue
index 54faafc..0ce10ea 100644
--- a/src/views/flowmgr/taskassign.vue
+++ b/src/views/flowmgr/taskassign.vue
@@ -8,7 +8,7 @@
 -->
 <template>
   <basic-container>
-    <avue-form ref="form" :option="attachOption" v-model="attachForm" @submit="formSubmit"></avue-form>
+    <avue-form ref="form" :option="attachOption" v-model="attachForm" @submit="formSubmit" @blur="handleTrim"></avue-form>
   </basic-container>
 </template>
 
@@ -41,10 +41,9 @@
     
     var isTempFlow = getQueryString("isTempFlow");
     isTempFlow = isTempFlow === 'Y'?'Y':'N';
-    console.log('isTempFlow='+isTempFlow);
+    
     var that = this;
     return {
-      isTempFlow:isTempFlow,//鏄惁涓存椂娴佺▼
       form: {},
       machineCodeList: [],
       attachOption: {
@@ -59,7 +58,10 @@
             type: 'input',
             span: 24,
             dataType: 'string',
-            rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+            rules: [{ required: true, message: '蹇呭~'}],
+            blur: (col) => {
+              this.handleTrim(col)
+            }
           },
           {
             label: '闆剁粍浠跺彿',
@@ -67,6 +69,9 @@
             type: 'input',
             span: 12,
             dataType: 'string',
+            blur: (col) => {
+              this.handleTrim(col)
+            },
             rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
           },
           {
@@ -76,6 +81,9 @@
             span: 12,
             dataType: 'string',
             rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+            blur: (col) => {
+              this.handleTrim(col)
+            },
           },
           {
             label: '浜у搧鍨嬪彿',
@@ -84,6 +92,9 @@
             span: 12,
             dataType: 'string',
             rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+            blur: (col) => {
+              this.handleTrim(col)
+            },
           },
           {
             label: '宸ュ簭鍙�',
@@ -93,8 +104,10 @@
             step: 1,
             precision: 0,
             dataType: 'string',
-            max: 999,
             rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+            blur: (col) => {
+              this.handleTrim(col)
+            },
           },
           {
             label: '宸ュ簭鍚嶇О',
@@ -103,6 +116,9 @@
             span: 12,
             dataType: 'string',
             rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+            blur: (col) => {
+              this.handleTrim(col)
+            },
           },
           {
             label: '宸ュ簭鐗堟',
@@ -111,6 +127,9 @@
             span: 12,
             dataType: 'string',
             rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+            blur: (col) => {
+              this.handleTrim(col)
+            },
           },
           {
             label: '宸ヨ壓鐗堟',
@@ -119,8 +138,11 @@
             type: 'input',
             span: 12,
             dataType: 'string',
-            maxlength: 2,
+            maxlength: 10,
             rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+            blur: (col) => {
+              this.handleTrim(col)
+            },
           },
           {
             label: '鍔犲伐鏈哄簥',
@@ -167,6 +189,9 @@
             type: 'input',
             span: 12,
             dataType: 'string',
+            blur: (col) => {
+              this.handleTrim(col)
+            },
             // rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
           }
         ],
@@ -175,6 +200,19 @@
     };
   },
   methods: {
+    
+    handleTrim(col){
+      //console.log(col)
+      let value = this.attachForm[col.column.prop];
+      if (typeof value === 'string') {
+            const trimmedValue = value.trim();
+            // 鍙湁褰撳�肩‘瀹炲彂鐢熷彉鍖栨椂鎵嶆洿鏂�
+            if (trimmedValue !== value) {
+                this.attachForm[col.column.prop] = trimmedValue;
+            }
+        }
+     // this.attachForm[col.column.prop]='dddd'
+    },
     formSubmit(form, done) {
       var form = { ...form };
       this.machineCodeList.forEach(item => {
@@ -201,6 +239,28 @@
           done();
         }
       );
+    },
+    handleGlobalBlur( {prop, value} ) {
+      console.log('prop')
+      // 1. 绛涢�夐渶瑕佸鐞嗙殑瀛楁绫诲瀷锛堜粎杈撳叆绫伙細input/textarea锛�
+      const inputTypes = ["input", "textarea"];
+      const currentColumn = this.attachOption.column.find(item => item.prop === prop);
+      
+      // 2. 鑻ヤ负杈撳叆绫诲瓧娈碉紝涓斿�间负瀛楃涓诧紝鎵ц trim 澶勭悊
+      if (currentColumn && inputTypes.includes(currentColumn.type) && typeof value === "string") {
+        const trimmedValue = value.trim();
+        // 3. 鍚屾澶勭悊鍚庣殑鍊煎埌琛ㄥ崟 model锛堥伩鍏嶇洿鎺ヤ慨鏀� prop锛岄�氳繃 $set 纭繚鍝嶅簲寮忥級
+        this.$set(this.attachForm, prop, trimmedValue);
+      }
+    },
+    handleBlur(prop, value) {
+        if (typeof value === 'string') {
+            const trimmedValue = value.trim();
+            // 鍙湁褰撳�肩‘瀹炲彂鐢熷彉鍖栨椂鎵嶆洿鏂�
+            if (trimmedValue !== value) {
+                this.attachForm[prop] = trimmedValue;
+            }
+        }
     }
   },
 };

--
Gitblit v1.9.3