From 4c308eab6106324bd40e6ad7fd9e769a5cedcedf Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期一, 25 八月 2025 15:46:58 +0800
Subject: [PATCH] 代码同步

---
 项目代码/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Boxing/AddInfo.vue |   91 ++++++++++++++++++++++++++++++---------------
 1 files changed, 60 insertions(+), 31 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Boxing/AddInfo.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Boxing/AddInfo.vue"
index b057651..0291c02 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Boxing/AddInfo.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/widesea_wms/stock/Boxing/AddInfo.vue"
@@ -2,22 +2,42 @@
   <vol-box v-model="show" title="缁勭洏" :width="800" :height="600">
     <template #content>
       <el-form :model="formData" label-width="100px">
-        <!-- <el-form-item label="杈撳叆椤�"> -->
-        <el-form-item label="鏂欑鍙�/鎵樼洏鍙�" style="width: 50%">
-          <el-input type="text" v-model="this.palletCode" placeholder="璇锋壂鐮佹潯鐮�"> </el-input>
+        <el-form-item label="鏉$爜" style="width: 50%">
+          <el-input type="text" v-model="palletCode" placeholder="璇锋壂鐮佹潯鐮�"> </el-input>
         </el-form-item>
+        
+        <!-- 閬嶅巻鐗╂枡鍒楄〃 -->
         <el-form-item v-for="(item, index) in formData.items" :key="index" style="width: 70%">
-          <el-select size="mini" clearable  v-model="item.MaterilName" placeholder="璇烽�夋嫨">
-            <el-option v-for="item in GetMatetils()" :value="item.value" :label="item.text"
-              :key="item.value"></el-option>
+          <el-select 
+            size="mini" 
+            clearable  
+            filterable
+            v-model="item.MaterilName" 
+            placeholder="璇烽�夋嫨鐗╂枡"
+            style="width: 45%; margin-right: 5%"
+          >
+            <!-- 閬垮厤浣跨敤涓庡惊鐜彉閲忕浉鍚岀殑item鍚嶇О -->
+            <el-option 
+              v-for="material in GetMatetils()" 
+              :value="material.value" 
+              :label="material.text"
+              :key="material.value"
+            ></el-option>
           </el-select>
-          <!-- <el-input v-model="item.MaterilName" placeholder="璇疯緭鍏ョ墿鏂欏悕绉�" style="width: 50%"></el-input> -->
-          <el-input v-model="item.num" placeholder="璇疯緭鍏ユ暟閲�" style="width: 70%"></el-input>
+          
+          <!-- 鏁伴噺搴旇鏄暟瀛楃被鍨� -->
+          <el-input 
+            v-model="item.num" 
+            placeholder="璇疯緭鍏ユ暟閲�" 
+            style="width: 35%; margin-right: 5%"
+            type="number"  
+          ></el-input>
+          
           <el-button v-if="index > 0" type="danger" @click="removeItem(index)">X</el-button>
         </el-form-item>
-        <!-- </el-form-item> -->
       </el-form>
-      <el-button type="primary" @click="addItem">
+      
+      <el-button type="primary" @click="addItem" style="margin-top: 10px;">
         娣诲姞鐗╂枡
       </el-button>
     </template>
@@ -40,37 +60,43 @@
   data() {
     return {
       formData: {
-        items: [{ MaterilName: '' }, { num: '' }],
+        // 姣忎釜item搴旇鏄竴涓寘鍚玀aterilName鍜宯um鐨勫璞�
+        items: [{ MaterilName: '', num: '' }],
       },
-      index: 1,
       palletCode: "",
       show: false,
-      MatetilList: []
+      MatetilList: [] // 鍋囪杩欓噷浼氳濉厖鐗╂枡鏁版嵁
     };
   },
   methods: {
     addItem() {
-      this.formData.items.push([{ MaterilName: '' }, { num: '' }]);
+      // 淇濇寔涓庡垵濮嬫暟鎹粨鏋勪竴鑷达紝娣诲姞涓�涓璞¤�屼笉鏄暟缁�
+      this.formData.items.push({ MaterilName: '', num: '' });
     },
     removeItem(index) {
       this.formData.items.splice(index, 1);
     },
 
-    //鑾峰彇鐗╂枡淇℃伅
+    // 鑾峰彇鐗╂枡淇℃伅
     GetMatetils() {
-      var data = [];
-      this.MatetilList.forEach((t) => {
-        data.push(t);
-      });
-      return data;
+      // 绠�鍖栦唬鐮侊紝鐩存帴杩斿洖鍒楄〃
+      return this.MatetilList;
     },
 
     submitForm() {
-      if (
-        !this.palletCode ||
-        this.palletCode == ""
-      ) {
+      // 楠岃瘉鏉$爜
+      if (!this.palletCode.trim()) {
         this.$message.error("璇锋壂鐮�");
+        return;
+      }
+
+      // 楠岃瘉鑷冲皯鏈変竴涓墿鏂欎笖鏁伴噺鏈夋晥
+      const hasValidItem = this.formData.items.some(item => 
+        item.MaterilName && item.num && Number(item.num) > 0
+      );
+      
+      if (!hasValidItem) {
+        this.$message.error("璇锋坊鍔犳湁鏁堢殑鐗╂枡鍜屾暟閲�");
         return;
       }
 
@@ -79,24 +105,27 @@
           jsonData: JSON.parse(JSON.stringify(this.formData.items)),
           palletCode: this.palletCode,
         }
-
       };
-
 
       this.http.post("/api/BoxingInfo/AddBoxingInfo", params, true).then((x) => {
         if (!x.status) {
           this.$message.error(x.message);
         } else {
-          this.$Message.success("鎴愬姛");
+          this.$message.success("鎿嶄綔鎴愬姛");
+          // 閲嶇疆琛ㄥ崟
           this.palletCode = '';
-          this.formData.items = [];
+          this.formData.items = [{ MaterilName: '', num: '' }];
           this.show = false;
-          $vue.refresh();
+          // 閫氱煡鐖剁粍浠跺埛鏂版暟鎹�
+          if (window.$vue && $vue.refresh) {
+            $vue.refresh();
+          }
         }
+      }).catch(error => {
+        this.$message.error("鎻愪氦澶辫触锛�" + (error.message || "缃戠粶閿欒"));
       });
     },
   },
-
 };
 </script>
 
@@ -104,4 +133,4 @@
 .container {
   font-family: 'Inter', system-ui, sans-serif;
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3