From 40d0394df1e68081b004b7e720c815c9927357b0 Mon Sep 17 00:00:00 2001
From: 周宾 <2802492122@qq.com>
Date: 星期三, 10 十二月 2025 14:32:15 +0800
Subject: [PATCH] 海川开心-修改仓储物流

---
 src/views/basicData/product/index.vue |  107 +++++++++++++++++++++++++++++------------------------
 1 files changed, 58 insertions(+), 49 deletions(-)

diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index 3aa263e..6c7e31d 100644
--- a/src/views/basicData/product/index.vue
+++ b/src/views/basicData/product/index.vue
@@ -146,7 +146,7 @@
             <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model">
               <el-input
                 v-model="modelForm.model"
-                placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"
+                placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�(g*琚嬫暟)"
                 clearable
                 @keydown.enter.prevent
               />
@@ -162,6 +162,24 @@
                 clearable
                 @keydown.enter.prevent
               />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="缁戝畾鏈哄櫒锛�" prop="speculativeTradingName">
+              <el-select
+                v-model="modelForm.speculativeTradingName"
+                placeholder="璇烽�夋嫨缁戝畾鏈哄櫒"
+                multiple
+                clearable
+                style="width: 100%"
+              >
+                <el-option label="鐐掓満1" value="鐐掓満1" />
+                <el-option label="鐐掓満2" value="鐐掓満2" />
+                <el-option label="鐐掓満3" value="鐐掓満3" />
+                <el-option label="鐐掓満4" value="鐐掓満4" />
+              </el-select>
             </el-form-item>
           </el-col>
         </el-row>
@@ -213,6 +231,10 @@
     prop: "unit",
   },
   {
+    label: "缁戝畾鏈哄櫒",
+    prop: "speculativeTradingName",
+  },
+  {
     dataType: "action",
     label: "鎿嶄綔",
     align: "center",
@@ -246,10 +268,19 @@
   modelForm: {
     model: "",
     unit: "",
+    speculativeTradingName: [],
   },
   modelRules: {
-    model: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    model: [
+      { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+      { 
+        pattern: /^[0-9*]*$/, 
+        message: "鍙兘杈撳叆鏁板瓧鍜�*鍙�", 
+        trigger: "blur" 
+      }
+    ],
     unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    speculativeTradingName: [{ required: false, message: "璇烽�夋嫨缁戝畾鏈哄櫒", trigger: "change" }],
   },
 });
 const { form, rules, modelForm, modelRules } = toRefs(data);
@@ -286,10 +317,15 @@
   modelOperationType.value = type;
   modelDia.value = true;
   modelForm.value.model = "";
-  modelForm.value.model = "";
+  modelForm.value.unit = "";
+  modelForm.value.speculativeTradingName = [];
   modelForm.value.id = "";
   if (type === "edit") {
     modelForm.value = { ...data };
+    // 濡傛灉鍚庣杩斿洖鐨勬槸瀛楃涓诧紝闇�瑕佽浆鎹负鏁扮粍
+    if (data.speculativeTradingName && typeof data.speculativeTradingName === 'string') {
+      modelForm.value.speculativeTradingName = data.speculativeTradingName.split(',');
+    }
   }
 };
 // 鎻愪氦浜у搧鍚嶇О淇敼
@@ -319,53 +355,17 @@
   proxy.$refs.formRef.resetFields();
   productDia.value = false;
 };
-// 灏佽涓�涓畨鍏ㄧ殑纭妗嗭紝褰诲簳闃绘Enter閿Е鍙�
-const safeConfirm = (message, title) => {
-  // 鏍囪鏄惁鏄紶鏍囩偣鍑伙紙鐐瑰嚮鎸夐挳浼氳Е鍙慺ocus浜嬩欢锛�
-  let isMouseClick = false;
 
-  return new Promise((resolve, reject) => {
-    const box = ElMessageBox.confirm(message, title, {
-      confirmButtonText: "纭",
-      cancelButtonText: "鍙栨秷",
-      type: "warning",
-      beforeClose: (action, instance, done) => {
-        if (action === "confirm") {
-          // 鍙湁榧犳爣鐐瑰嚮鏃舵墠鍏佽纭
-          if (isMouseClick) {
-            done();
-            resolve();
-          } else {
-            // Enter閿Е鍙戞椂闃绘
-            done(false);
-          }
-        } else {
-          // 鍙栨秷鎿嶄綔鐩存帴鍏佽
-          done();
-          reject();
-        }
-      }
-    });
-
-    // 鐩戝惉纭鎸夐挳鐨刦ocus浜嬩欢锛堥紶鏍囩偣鍑讳細瑙﹀彂锛孍nter閿笉浼氾級
-    setTimeout(() => {
-      const confirmBtn = document.querySelector('.el-message-box__btns .el-button--primary');
-      if (confirmBtn) {
-        confirmBtn.addEventListener('focus', () => {
-          isMouseClick = true;
-        });
-      }
-    }, 0); // 寤惰繜鑾峰彇锛岀‘淇滵OM宸叉覆鏌�
-  });
-};
-// 鍒犻櫎浜у搧
 // 鍒犻櫎浜у搧
 const remove = (node, data) => {
-  let ids = [data.id];
-  // 浣跨敤灏佽鐨剆afeConfirm
-  safeConfirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず")
+  let ids = [];
+  ids.push(data.id);
+  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  })
     .then(() => {
-      // 纭鍒犻櫎閫昏緫
       tableLoading.value = true;
       delProduct(ids)
         .then((res) => {
@@ -394,8 +394,13 @@
 const submitModelForm = () => {
   proxy.$refs.modelFormRef.validate((valid) => {
     if (valid) {
-      modelForm.value.productId = currentId.value;
-      addOrEditProductModel(modelForm.value).then((res) => {
+      // 灏嗛�変腑鐨勬満鍣ㄦ暟缁勮浆鎹负閫楀彿鍒嗛殧鐨勫瓧绗︿覆
+      const submitData = {
+        ...modelForm.value,
+        productId: currentId.value,
+        speculativeTradingName: modelForm.value.speculativeTradingName.join(',')
+      };
+      addOrEditProductModel(submitData).then((res) => {
         proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
         closeModelDia();
         getModelList();
@@ -441,7 +446,11 @@
     proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
     return;
   }
-  safeConfirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず")
+  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  })
     .then(() => {
       tableLoading.value = true;
       delProductModel(ids)

--
Gitblit v1.9.3