From 2bdda9b2bedb8f084e364e92627f19e1938dceca Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期二, 21 四月 2026 11:05:57 +0800
Subject: [PATCH] 1

---
 项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue |  675 +++++++++++++++++++++++++------------------------------
 1 files changed, 304 insertions(+), 371 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue"
index 8e14b29..a8d5da4 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue"
@@ -1,9 +1,10 @@
 <template>
   <div>
+    <!-- 搴撳瓨鎸囧畾寮圭獥 -->
     <vol-box
       v-model="showDetialBox"
       :lazy="true"
-      width="60%"
+      width="80%"
       :padding="15"
       title="鎸囧畾搴撳瓨"
     >
@@ -11,13 +12,19 @@
         <el-alert :closable="false" style="width: 100%">
           <el-row>
             <el-col :span="16">
+              <span class="less-style">鍗曟嵁缂栧彿锛歿{ mainOrderNo }}</span>
+              <el-divider direction="vertical"></el-divider>
               <span class="less-style">鐗╂枡鍚嶇О锛� {{ row.materielName }} </span>
               <el-divider direction="vertical"></el-divider>
               <span class="less-style">鐗╂枡缂栧彿锛� {{ row.materielCode }} </span>
               <el-divider direction="vertical"></el-divider>
-              <span class="less-style">闇�姹傛暟閲忥細 {{ row.qty }} </span>
+              <span class="less-style">
+                闇�姹傛暟閲忥細 {{ requireQuantity }}
+              </span>
               <el-divider direction="vertical"></el-divider>
-              <span :class="selectionClass">宸查�夋暟閲忥細 {{ selectionSum }} </span>
+              <span :class="selectionClass">
+                宸查�夋暟閲忥細 {{ selectionSum }}
+              </span>
             </el-col>
             <el-col :span="8">
               <el-link
@@ -27,64 +34,10 @@
                 @click="getData"
                 >鍒锋柊</el-link
               >
-              <el-link
-                type="primary"
-                size="small"
-                style="float: right; height: 20px; margin-right: 10px"
-                @click="openOutboundDialog"
-                >鐩存帴鍑哄簱</el-link
-              >
             </el-col>
           </el-row>
         </el-alert>
       </div>
-
-      <!-- 鏂板绛涢�夊尯鍩� -->
-      <div class="filter-area" style="margin: 10px 0; padding: 10px; background: #f8f9fa; border-radius: 4px;">
-        <el-form :model="filterForm" inline @submit.prevent>
-          <el-form-item label="鐗╂枡缂栧彿锛�">
-            <el-input
-              v-model="filterForm.materielCode"
-              placeholder="妯$硦绛涢�夌墿鏂欑紪鍙�"
-              clearable
-              style="width: 180px"
-              @input="filterTable"
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="鐗╂枡鏉$爜锛�">
-            <el-input
-              v-model="filterForm.barcode"
-              placeholder="妯$硦绛涢�夌墿鏂欐潯鐮�"
-              clearable
-              style="width: 180px"
-              @input="filterTable"
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="鎵樼洏缂栧彿锛�">
-            <el-input
-              v-model="filterForm.palletCode"
-              placeholder="妯$硦绛涢�夋墭鐩樼紪鍙�"
-              clearable
-              style="width: 180px"
-              @input="filterTable"
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="璐т綅缂栧彿锛�">
-            <el-input
-              v-model="filterForm.locationCode"
-              placeholder="妯$硦绛涢�夎揣浣嶇紪鍙�"
-              clearable
-              style="width: 180px"
-              @input="filterTable"
-            ></el-input>
-          </el-form-item>
-          <el-form-item>
-            <el-button type="primary" @click="filterTable">鎼滅储</el-button>
-            <el-button @click="resetFilter">閲嶇疆</el-button>
-          </el-form-item>
-        </el-form>
-      </div>
-
       <div class="box-table" style="margin-top: 1%">
         <el-table
           ref="singleTable"
@@ -94,6 +47,8 @@
           @row-click="handleRowClick"
           height="500px"
           @selection-change="handleSelectionChange"
+          @select="selectRowChange"
+          @select-all="selectAllChange"
         >
           <el-table-column type="selection" width="55"> </el-table-column>
           <el-table-column
@@ -111,61 +66,84 @@
             :width="item.width"
             align="center"
           >
-            <template #default="scoped" v-if="item.type == 'icon'">
-              <el-tooltip
-                class="item"
-                effect="dark"
-                :content="item.title"
-                placement="bottom"
-                ><el-button
-                  type="text"
-                  @click="tableButtonClick(scoped.row, item)"
-                  ><i :class="item.icon" style="font-size: 22px"></i></el-button
-              ></el-tooltip>
+            <template #default="scoped">
+              <div v-if="item.type == 'icon'">
+                <el-tooltip
+                  class="item"
+                  effect="dark"
+                  :content="item.title"
+                  placement="bottom"
+                  ><el-button
+                    type="text"
+                    @click="tableButtonClick(scoped.row, item)"
+                    ><i :class="item.icon" style="font-size: 22px"></i></el-button
+                ></el-tooltip>
+              </div>
+              <div v-else-if="item.type == 'tag'">
+                <el-tag size="small">
+                  {{ getDictionary(scoped.row, item) }}
+                </el-tag>
+              </div>
+              <div v-else>
+                {{ scoped.row[item.prop] }}
+              </div>
             </template>
           </el-table-column>
         </el-table>
       </div>
       <template #footer>
-        <!-- 鍘绘帀閿佸畾搴撳瓨鎸夐挳锛屽彧淇濈暀鍏抽棴鎸夐挳 -->
+        <el-button type="primary" size="small" @click="openStationDialog"
+          >鐩存帴鍑哄簱</el-button
+        >
         <el-button type="danger" size="small" @click="showDetialBox = false"
           >鍏抽棴</el-button
         >
       </template>
     </vol-box>
 
-    <!-- 鍑哄簱绔欏彴閫夋嫨寮圭獥锛堥潤鎬佹ā鏉垮疄鐜帮級 -->
+    <!-- 绔欏彴閫夋嫨寮圭獥 -->
     <el-dialog
-      v-model="showOutboundDialog"
-      title="鍑哄簱鎿嶄綔 - 閫夋嫨鍑哄簱绔欏彴"
+      v-model="showStationDialog"
+      title="閫夋嫨鍑哄簱绔欏彴"
       width="500px"
-      :append-to-body="true"
+      :close-on-click-modal="false"
     >
-      <el-form
-        :model="outboundForm"
-        :rules="outboundRules"
-        ref="outboundFormRef"
-        label-width="100px"
-        style="padding: 0 20px"
-      >
-        <el-form-item label="鍑哄簱绔欏彴" prop="selectedPlatform" style="margin-bottom: 24px">
-          <el-select
-            v-model="outboundForm.selectedPlatform"
-            placeholder="璇烽�夋嫨鍑哄簱绔欏彴锛�3-12锛�"
-            style="width: 100%; height: 40px"
-          >
-            <el-option
-              v-for="platform in platformOptions"
-              :key="platform.value"
-              :label="platform.label"
-              :value="platform.value"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-      </el-form>
+      <div class="station-dialog-content">
+        <el-form :model="stationForm" label-width="100px">
+          <el-form-item label="閫夋嫨绔欏彴锛�" required>
+            <el-select
+              v-model="stationForm.selectedPlatform"
+              placeholder="璇烽�夋嫨鍑哄簱绔欏彴"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in stations"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="鍑哄簱鏁伴噺锛�">
+            <el-input
+              v-model="selectionSum"
+              readonly
+              style="width: 100%"
+            ></el-input>
+          </el-form-item>
+          <el-form-item label="鐗╂枡淇℃伅锛�">
+            <div style="font-size: 12px; color: #666; line-height: 1.5">
+              <div>鐗╂枡缂栧彿锛歿{ row.materielCode }}</div>
+              <div>鐗╂枡鍚嶇О锛歿{ row.materielName }}</div>
+            </div>
+          </el-form-item>
+        </el-form>
+      </div>
       <template #footer>
-        <el-button @click="showOutboundDialog = false" style="margin-right: 8px">鍙栨秷</el-button>
-        <el-button type="primary" @click="confirmOutbound">纭畾鍑哄簱</el-button>
+        <span class="dialog-footer">
+          <el-button @click="showStationDialog = false">鍙栨秷</el-button>
+          <el-button type="primary" @click="confirmOutbound">纭鍑哄簱</el-button>
+        </span>
       </template>
     </el-dialog>
   </div>
@@ -173,334 +151,289 @@
 
 <script>
 import VolBox from "@/components/basic/VolBox.vue";
-import { ElMessage } from "element-plus";
+import { stationManager } from "@/../src/uitils/stationManager";
 
 export default {
   components: { VolBox },
   data() {
     return {
-      row: null, // 鎺ユ敹鐖剁粍浠朵紶閫掔殑瀹屾暣鏁版嵁锛堝寘鍚槑缁咺D闆嗗悎锛�
+      row: null,
+      kcname: "",
+      mainOrderNo: "",
+      pkcx: false,
       showDetialBox: false,
+      showStationDialog: false,
       tableData: [],
-      originalTableData: [], // 瀛樺偍鍘熷鏁版嵁锛岀敤浜庣瓫閫�
+      dictionaryList: null,
       tableColumns: [
         { prop: "materielCode", title: "鐗╂枡缂栧彿", type: "string", width: 150 },
-        { prop: "barcode", title: "鐗╂枡鏉$爜", type: "string", width: 150 },
+        { prop: "materielName", title: "鐗╂枡鍚嶇О", type: "string", width: 150 },
         { prop: "palletCode", title: "鎵樼洏缂栧彿", type: "string", width: 150 },
+        { prop: "barcode", title: "鏉$爜", type: "string", width: 150 },
         { prop: "locationCode", title: "璐т綅缂栧彿", type: "string", width: 180 },
         { prop: "useableQuantity", title: "鍙敤鏁伴噺", type: "string" },
+        { prop: "supplyCode", title: "渚涘簲鍟�", type: "string" },
+        { prop: "batchNo", title: "鎵规鍙�", type: "string" },
+        {
+          prop: "stockStatus",
+          title: "搴撳瓨鏄庣粏鐘舵��",
+          type: "tag",
+          width: 90,
+          bindKey: "stockStatusEmun",
+        },
+        { prop: "stockId", title: "搴撳瓨涓婚敭", type: "string" },
+        { prop: "orderDetailId", title: "鍗曟嵁鏄庣粏涓婚敭", type: "string" },
       ],
-      selection: [], // 閫変腑鐨勫簱瀛樻暟鎹�
-      selectionSum: 0, // 宸查�夋暟閲忔�诲拰
+      selection: [],
+      selectionSum: 0,
       selectionClass: "less-style",
       originalQuantity: 0,
 
-      // 绛涢�夎〃鍗曟暟鎹�
-      filterForm: {
-        materielCode: "",
-        barcode: "",
-        palletCode: "",
-        locationCode: ""
-      },
-
-      // 鍑哄簱寮圭獥鐩稿叧鏁版嵁
-      showOutboundDialog: false,
-      outboundForm: { selectedPlatform: "" }, // 琛ㄥ崟缁戝畾鏁版嵁
-      outboundRules: {
-        selectedPlatform: [
-          { required: true, message: "璇烽�夋嫨鍑哄簱绔欏彴", trigger: "change" },
-        ],
-      },
-      platformOptions: [
+      stations: [
         { label: "绔欏彴2", value: "2-1" },
         { label: "绔欏彴3", value: "3-1" },
       ],
-      pkcx: false, // 鏂板锛氶粯璁alse锛堝鏋滈渶瑕佸彲浠庣埗缁勪欢浼犻�掞級
+      stationForm: {
+        selectedPlatform: "",
+      },
+      isProcessingSelect: false,
     };
   },
+  computed: {
+    requireQuantity() {
+      if (!this.row) return 0;
+      return this.row.orderQuantity - this.row.lockQuantity - (this.row.moveQty || 0);
+    },
+    isFull() {
+      return this.selectionSum >= this.requireQuantity && this.requireQuantity > 0;
+    }
+  },
   methods: {
-    // 鎺ユ敹鐖剁粍浠朵紶閫掔殑鏁版嵁锛堝寘鍚槑缁咺D闆嗗悎鍜岀墿鏂欎俊鎭級
-    open(data) {
-      this.row = data; // data缁撴瀯锛歿materielCode, materielName, qty, orderNo, detailIds, mainOrderId, groupRow}
+    open(row, orderNo) {
+      this.row = row;
+      this.mainOrderNo = orderNo;
       this.showDetialBox = true;
-      this.getData(); // 鍔犺浇搴撳瓨鏁版嵁
-      this.updateSelectionClass(); // 鍒濆鍖栧凡閫夋暟閲忔牱寮�
-      console.log("鎺ユ敹鐨勫垎缁勬槑缁咺D闆嗗悎锛�", this.row.detailIds);
-      console.log("鏌ヨ搴撳瓨鐨勭墿鏂欑紪鐮侊細", this.row.materielCode);
+
+      this.originalQuantity = 0;
+      this.selectionSum = 0;
+      this.selection = [];
+
+      this.getDictionaryData();
+      this.getData();
+      this.updateSelectionStyle();
     },
 
-    // 鎵撳紑鍑哄簱寮圭獥
-    openOutboundDialog() {
-      if (this.selection.length === 0) {
-        return ElMessage.error("璇烽�夋嫨搴撳瓨鏁版嵁");
+    getDictionaryData() {
+      if (this.dictionaryList) {
+        return;
       }
-      // 鏍¢獙鏄庣粏ID闆嗗悎
-      if (!this.row?.detailIds || this.row.detailIds.length === 0) {
-        return ElMessage.error("娌℃湁鑾峰彇鍒板崟鎹槑缁咺D锛屾棤娉曞嚭搴�");
-      }
-      // 閲嶇疆琛ㄥ崟閬垮厤娈嬬暀鍊�
-      this.outboundForm.selectedPlatform = "";
-      this.showOutboundDialog = true;
-    },
-
-    // 鏍稿績淇敼锛歎RL鎷兼帴浼犻�抜nt[] orderDetailId锛堥噸澶嶅弬鏁板悕锛夊拰station锛岃姹備綋浼犲簱瀛樻暟鎹�
-    confirmOutbound() {
-      this.$refs.outboundFormRef.validate((valid) => {
-        if (!valid) return;
-
-        // 鏍¢獙閫変腑搴撳瓨鍜屾槑缁咺D
-        if (this.selection.length <= 0) {
-          return this.$message.error("璇峰嬀閫夊簱瀛樻暟鎹�");
-        }
-        if (!this.row?.detailIds || this.row.detailIds.length === 0) {
-          return this.$message.error("娌℃湁鑾峰彇鍒板崟鎹槑缁咺D锛屾棤娉曞嚭搴�");
-        }
-
-        try {
-          // 1. 杞崲ID涓烘暣鏁版暟缁勶紙纭繚鍚庣鑳借瘑鍒负int[]锛�
-          const orderDetailId = this.row.detailIds.map(id => {
-            const num = Number(id);
-            if (isNaN(num) || !Number.isInteger(num)) {
-              throw new Error(`ID ${id} 涓嶆槸鏈夋晥鐨勬暣鏁癭);
-            }
-            return num;
-          });
-
-          // 2. 鎷兼帴URL锛歩nt[] 鐢ㄩ噸澶嶅弬鏁板悕鏍煎紡锛�?orderDetailId=1&orderDetailId=2&...锛�
-          let url = "api/Task/GenerateOutboundTask";
-          // 鎷兼帴ID鏁扮粍鍙傛暟
-          const idParams = orderDetailId.map(id => `orderDetailId=${id}`).join("&");
-          // 鎷兼帴绔欏彴鍙傛暟
-          const stationParam = `station=${encodeURIComponent(this.outboundForm.selectedPlatform)}`;
-          // 瀹屾暣URL锛堝鐞嗗弬鏁版嫾鎺ラ�昏緫锛�
-          const fullUrl = idParams 
-            ? `${url}?${idParams}&${stationParam}` 
-            : `${url}?${stationParam}`;
-
-          console.log("鍑哄簱璇锋眰URL锛�", fullUrl);
-
-          // 3. 鍙戦�佽姹傦細URL鎷兼帴ID鍜岀珯鍙帮紝璇锋眰浣撲紶搴撳瓨鏁版嵁锛堥�傞厤FromBody锛�
-          this.http
-            .post(fullUrl, this.selection, "鏁版嵁澶勭悊涓�")
-            .then((x) => {
-              if (!x.status) return this.$message.error(x.message);
-              this.$message.success("鎿嶄綔鎴愬姛");
-              this.showDetialBox = false;
-              this.$emit("parentCall", ($vue) => {
-                $vue.getData(); // 鍒锋柊鐖剁粍浠舵暟鎹�
-              });
-            })
-            .catch((err) => {
-              console.error("鍑哄簱澶辫触锛�", err);
-              this.$message.error(`鍑哄簱澶辫触锛�${err.message || '璇风◢鍚庨噸璇�'}`);
-            });
-        } catch (err) {
-          this.$message.error(err.message);
+      var param = [];
+      this.tableColumns.forEach((x) => {
+        if (x.type == "tag" && x.bindKey != "") {
+          param.push(x.bindKey);
         }
       });
+      this.http
+        .post("api/Sys_Dictionary/GetVueDictionary", param, "鏌ヨ涓�")
+        .then((x) => {
+          if (x.length > 0) {
+            this.dictionaryList = x;
+          }
+        });
     },
 
-    // 鎸夌涓�涓墿鏂欑紪鐮佹煡璇㈠簱瀛樻暟鎹�
-    getData() {
-      const url = "api/StockInfo/GetSelectViewDTOs?materielCode=";
-      // 浣跨敤鐖剁粍浠朵紶閫掔殑鐗╂枡缂栫爜锛堢涓�涓槑缁嗙殑缂栫爜锛�
+    getDictionary(row, column) {
+      if (this.dictionaryList) {
+        var item = this.dictionaryList.find((x) => x.dicNo == column.bindKey);
+        if (item) {
+          var dicItem = item.data.find((x) => x.key == row[column.prop]);
+          if (dicItem) {
+            return dicItem.value;
+          } else {
+            return row[column.prop];
+          }
+        }
+      }
+      return row[column.prop];
+    },
+
+    openStationDialog() {
+      if (this.selection.length <= 0) {
+        return this.$message.error("璇峰厛鍕鹃�夎鍑哄簱鐨勫簱瀛�");
+      }
+      const cachedStation = stationManager.getStation();
+      this.stationForm.selectedPlatform = cachedStation || "";
+      this.showStationDialog = true;
+    },
+
+    async confirmOutbound() {
+      if (!this.stationForm.selectedPlatform) {
+        return this.$message.error("璇烽�夋嫨鍑哄簱绔欏彴");
+      }
+
+      const requestParams = {
+        detailIds: [this.row.id],
+        outboundTargetLocation: this.stationForm.selectedPlatform,
+        outboundQuantity: this.selectionSum,
+        operator: this.getCurrentOperator(),
+        orderNo: this.mainOrderNo,
+        stockDetailIds: this.selection.map((item) => item.stockId),
+      };
+
+      try {
+        const x = await this.http.post(
+          "api/Outbound/ProcessPickingOutbound",
+          requestParams,
+          "鏁版嵁澶勭悊涓�"
+        );
+        if (!x.status) {
+          return this.$message.error(x.message);
+        }
+        this.$message.success("鍑哄簱浠诲姟鍒涘缓鎴愬姛");
+        this.showStationDialog = false;
+        this.showDetialBox = false;
+        this.$emit("parentCall", ($vue) => {
+          $vue.getData();
+        });
+      } catch (error) {
+        this.$message.error(error.message || "鍑哄簱澶勭悊澶辫触");
+      }
+    },
+
+    getCurrentOperator() {
+      try {
+        const userInfo = JSON.parse(localStorage.getItem("userInfo") || "{}");
+        if (userInfo.userName) {
+          return userInfo.userName;
+        }
+        if (this.$store && this.$store.state.user) {
+          return this.$store.state.user.userName;
+        }
+      } catch (error) {
+        console.error("鑾峰彇鎿嶄綔浜轰俊鎭け璐�:", error);
+      }
+      return "admin";
+    },
+
+    getData(a) {
+      if (!a) this.pkcx = !this.pkcx;
+      let url = this.pkcx
+        ? "api/StockInfo/GetStockSelectViews?materielCode="
+        : "api/StockInfo/GetStockSelectViews?materielCode=";
+      this.kcname = this.pkcx ? "绔嬪簱搴撳瓨" : "骞冲簱搴撳瓨";
       this.http
         .post(
-          url + this.row.materielCode + "&orderNo=" + (this.row.upperOrderNo || this.row.orderNo),
+          url + this.row.materielCode + "&orderId=" + this.row.orderId,
           null,
           "鏌ヨ涓�"
         )
         .then((x) => {
-          this.tableData = x || [];
-          this.originalTableData = [...this.tableData]; // 淇濆瓨鍘熷鏁版嵁
-          // 鍒锋柊鍚庢竻绌轰箣鍓嶇殑閫夋嫨鍜岃鏁�
+          this.tableData = x;
           this.clearSelection();
-          this.selectionSum = 0;
-          this.originalQuantity = 0;
-          this.updateSelectionClass();
-          // 鍒锋柊鍚庨噸缃瓫閫夋潯浠�
-          this.resetFilter();
-        })
-        .catch((err) => {
-          console.error("搴撳瓨鏌ヨ澶辫触锛�", err);
-          ElMessage.error("搴撳瓨鏌ヨ澶辫触锛岃绋嶅悗閲嶈瘯");
-          this.tableData = [];
-          this.originalTableData = [];
         });
     },
 
-    // 鎾ら攢鎸囧畾搴撳瓨锛堝鏋滈渶瑕侊級
-    revokeAssign() {
-      if (!this.row?.detailIds || this.row.detailIds.length === 0) {
-        return ElMessage.error("娌℃湁鑾峰彇鍒板崟鎹槑缁咺D锛屾棤娉曟挙閿�");
-      }
-
-      try {
-        // ID杞负鏁存暟鏁扮粍锛屾嫾鎺RL
-        const detailIds = this.row.detailIds.map(id => Number(id));
-        const idParams = detailIds.map(id => `detailIds=${id}`).join("&");
-        const url = `api/OutboundOrderDetail/RevokeLockOutboundStock?id=${this.row.mainOrderId}&${idParams}`;
-        
-        this.http
-          .post(url, null, "鏁版嵁澶勭悊涓�")
-          .then((x) => {
-            if (!x.status) return ElMessage.error(x.message);
-            ElMessage.success("鎾ら攢鎴愬姛");
-            this.showDetialBox = false;
-            this.$emit("parentCall", ($vue) => {
-              $vue.getData();
-            });
-          });
-      } catch (err) {
-        this.$message.error(`鎾ら攢澶辫触锛�${err.message}`);
-      }
-    },
-
-    // 澶勭悊琛ㄦ牸閫夋嫨鍙樺寲锛堣绠楀凡閫夋暟閲忥級
-    handleSelectionChange(val) {
-      this.selection = val;
-      // 璁$畻宸查�夋暟閲忥紙杞暟瀛楅伩鍏嶅瓧绗︿覆鎷兼帴锛�
-      this.selectionSum = val.reduce(
-        (acc, curr) => acc + Number(curr.useableQuantity || 0),
-        0
-      ) + this.originalQuantity;
-      this.updateSelectionClass();
-    },
-
-    // 鏇存柊宸查�夋暟閲忔牱寮忥紙瀵规瘮鍒嗙粍鎬婚渶姹傛暟閲忥級
-    updateSelectionClass() {
-      if (!this.row) return;
-      if (this.selectionSum === this.row.qty) {
-        this.selectionClass = "equle-style";
-      } else if (this.selectionSum < this.row.qty) {
-        this.selectionClass = "less-style";
-      } else {
-        this.selectionClass = "more-style";
-      }
-    },
-
-    // 鍒囨崲琛ㄦ牸閫夋嫨
-    toggleSelection(rows) {
-      rows 
-        ? rows.forEach((row) => this.$refs.singleTable.toggleRowSelection(row)) 
-        : this.clearSelection();
-    },
-
-    // 娓呯┖閫夋嫨
-    clearSelection() {
-      if (this.$refs.singleTable) {
-        this.$refs.singleTable.clearSelection();
-      }
-    },
-
-    // 琛岀偣鍑讳簨浠�
+    // 鐐瑰嚮琛屽嬀閫� - 鏈�缁堜慨澶嶇増
     handleRowClick(row) {
+      // 鍒ゆ柇褰撳墠琛屾槸鍚﹀凡閫変腑
+      const isSelected = this.selection.some(s => s.stockId === row.stockId);
+      
+      // 宸查�変腑 鈫� 鍏佽鍙栨秷鍕鹃��
+      if (isSelected) {
+        this.$refs.singleTable.toggleRowSelection(row);
+        return;
+      }
+
+      // 鏈�変腑 + 宸叉弧 鈫� 绂佹鏂板锛屾姤閿�
+      if (this.isFull) {
+        this.$message.error(`宸茶揪鍒伴渶姹傛暟閲� ${this.requireQuantity}锛屾棤娉曞啀鍕鹃�夊簱瀛橈紒`);
+        return;
+      }
+
+      // 姝e父鍕鹃��
       this.$refs.singleTable.toggleRowSelection(row);
     },
 
-    // 鍥炬爣鎸夐挳鐐瑰嚮鍗犱綅鏂规硶锛堝彲鏍规嵁闇�姹傛墿灞曪級
-    tableButtonClick(row, item) {
-      console.log("鍥炬爣鎸夐挳鐐瑰嚮锛�", item.title, row);
+    // 鍕鹃�夋閫夋嫨 - 鏈�缁堜慨澶嶇増
+    selectRowChange(selection, row) {
+      if (this.isProcessingSelect) return;
+
+      const isAdding = selection.some(x => x.stockId === row.stockId);
+
+      // 鏂板鍕鹃�� + 宸叉弧 鈫� 鎷︽埅
+      if (isAdding && this.isFull) {
+        this.isProcessingSelect = true;
+        this.$message.error(`宸茶揪鍒伴渶姹傛暟閲� ${this.requireQuantity}锛屾棤娉曞啀鍕鹃�夛紒`);
+        this.$nextTick(() => {
+          this.$refs.singleTable.toggleRowSelection(row, false);
+          this.isProcessingSelect = false;
+        });
+      }
     },
 
-    // 绛涢�夎〃鏍兼暟鎹�
-    filterTable() {
-      if (!this.originalTableData.length) return;
-      
-      // 瑙f瀯绛涢�夋潯浠跺苟杞负灏忓啓锛堝拷鐣ュぇ灏忓啓锛�
-      const { materielCode, barcode, palletCode, locationCode } = this.filterForm;
-      const mc = materielCode.toLowerCase().trim();
-      const bc = barcode.toLowerCase().trim();
-      const pc = palletCode.toLowerCase().trim();
-      const lc = locationCode.toLowerCase().trim();
+    // 鍏ㄩ�� - 鏈�缁堜慨澶嶇増
+    selectAllChange(selection) {
+      if (this.isProcessingSelect) return;
 
-      // 妯$硦绛涢�夐�昏緫
-      this.tableData = this.originalTableData.filter(item => {
-        // 姣忎釜瀛楁閮藉仛绌哄�煎鐞嗗拰灏忓啓杞崲锛屾敮鎸佹ā绯婂尮閰�
-        const itemMc = (item.materielCode || "").toLowerCase();
-        const itemBc = (item.barcode || "").toLowerCase();
-        const itemPc = (item.palletCode || "").toLowerCase();
-        const itemLc = (item.locationCode || "").toLowerCase();
+      const allTotal = this.tableData.reduce((sum, item) => sum + (item.useableQuantity || 0), 0);
+      const need = this.requireQuantity;
 
-        return (
-          itemMc.includes(mc) &&
-          itemBc.includes(bc) &&
-          itemPc.includes(pc) &&
-          itemLc.includes(lc)
-        );
-      });
-
-      // 绛涢�夊悗娓呯┖閫夋嫨鐘舵��
-      this.clearSelection();
-      this.selectionSum = 0;
-      this.updateSelectionClass();
+      if (allTotal > need && selection.length > 0) {
+        this.isProcessingSelect = true;
+        this.$message.error(`鍏ㄩ�夋暟閲忚秴鍑洪渶姹傦紝宸叉竻绌洪�夋嫨锛乣);
+        
+        this.$refs.singleTable.clearSelection();
+        this.selection = [];
+        this.selectionSum = 0;
+        this.updateSelectionStyle();
+        
+        this.$nextTick(() => {
+          this.isProcessingSelect = false;
+        });
+      }
     },
 
-    // 閲嶇疆绛涢�夋潯浠�
-    resetFilter() {
-      this.filterForm = {
-        materielCode: "",
-        barcode: "",
-        palletCode: "",
-        locationCode: ""
-      };
-      // 鎭㈠鍘熷鏁版嵁
-      this.tableData = [...this.originalTableData];
-      // 閲嶇疆閫夋嫨鐘舵��
-      this.clearSelection();
+    // 閫夋嫨璁$畻
+    handleSelectionChange(val) {
+      if (this.isProcessingSelect) return;
+
+      let total = val.reduce((s, i) => s + (i.useableQuantity || 0), 0);
+      const need = this.requireQuantity;
+
+      this.selectionSum = total >= need ? need : total;
+      this.selection = val;
+      this.updateSelectionStyle();
+    },
+
+    updateSelectionStyle() {
+      if (this.isFull) {
+        this.selectionClass = "equle-style";
+      } else {
+        this.selectionClass = "less-style";
+      }
+    },
+
+    clearSelection() {
+      this.$refs.singleTable.clearSelection();
+      this.selection = [];
       this.selectionSum = 0;
-      this.updateSelectionClass();
-    }
+      this.updateSelectionStyle();
+    },
   },
 };
 </script>
 
 <style scoped>
-.less-style {
-  color: black;
-}
-
-.equle-style {
-  color: green;
-}
-
-.more-style {
-  color: red;
-}
-
-/* 绛涢�夊尯鍩熸牱寮忎紭鍖� */
-.filter-area :deep(.el-form-item) {
-  margin-bottom: 0;
-  margin-right: 10px;
-}
-</style>
-
-<style>
-.text-button:hover {
-  background-color: #f0f9eb !important;
-}
-
-.el-table .warning-row {
-  background: oldlace;
-}
-
-.box-table .el-table tbody tr:hover > td {
-  background-color: #d8e0d4 !important;
-}
-
-.box-table .el-table tbody tr.current-row > td {
-  background-color: #f0f9eb !important;
-}
-
-.el-table .success-row {
-  background: #f0f9eb;
-}
-
-.box-table .el-table {
-  border: 1px solid #ebeef5;
-}
-
-.box-head .el-alert__content {
-  width: 100%;
-}
+.less-style { color: black; }
+.equle-style { color: green; }
+.more-style { color: red; }
+.station-dialog-content { padding: 10px 0; }
+.dialog-footer { display: flex; justify-content: flex-end; gap: 10px; }
+.text-button:hover { background-color: #f0f9eb !important; }
+.el-table .warning-row { background: oldlace; }
+.box-table .el-table tbody tr:hover > td { background-color: #d8e0d4 !important; }
+.box-table .el-table tbody tr.current-row > td { background-color: #f0f9eb !important; }
+.el-table .success-row { background: #f0f9eb; }
+.box-table .el-table { border: 1px solid #ebeef5; }
+.box-head .el-alert__content { width: 100%; }
 </style>
\ No newline at end of file

--
Gitblit v1.9.3