From 8772f19134cb56750473bf957f01f35fab6a814c Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期五, 30 五月 2025 08:29:25 +0800
Subject: [PATCH] 1.补充选择项内容

---
 H5/Js/Xcsl.js |  300 +++++++++++++++++++----------------------------------------
 1 files changed, 99 insertions(+), 201 deletions(-)

diff --git a/H5/Js/Xcsl.js b/H5/Js/Xcsl.js
index ac17cad..0e183cf 100644
--- a/H5/Js/Xcsl.js
+++ b/H5/Js/Xcsl.js
@@ -14,9 +14,16 @@
             GX: "G007:鏍稿閫佹",
             Xvalue:4,
             XbarInfo: [],
-            DAA001: [],
+            DAA001: "",
+            DAA021: "",
             DAANum: "",
-            ItemDetail: [],
+            xcslItemList: [], //鏉愭枡鍒楄〃
+            xcslWjsBarList: [],//鏈帴鏀跺垪琛�
+            xcslYjsBarList: [],//宸叉帴鏀跺垪琛�
+            selectKey: "",//鏌ヨ鍏抽敭瀛�
+            actions: [],//鍒楄〃鐨勫��
+            show: false,//鍒楄〃灞曠ず
+
         }
     },
     mounted() {
@@ -27,253 +34,144 @@
         };
     },
     methods: {
-        getKbBarInfo() {
+        GetItemsXcsl() {
             var that = this;
+
+            if (!that.DAA001 || that.DAA001.length <= 0) {
+                that.$toast.fail("宸ュ崟鍗曞彿涓嶈兘涓虹┖锛�");
+                that.$refs.DAA001.focus();
+                return;
+            }
+
             that.isLoading = true;
-            that.AxiosHttp("post", 'Womdaa/getKbBarInfo', {
-                Xt: that.GX,
-                Kbbarcode: that.KbBar
+            that.AxiosHttp("post", 'Womdaa/GetItemsXcsl', {
+                daa001: that.DAA001
             }, false)
                 .then(function (res) {
                     var json = res;
                     if (json.status == 0) {
-                        that.KbBarInfo = json.data.tbBillList.kbBarInfo[0];
-                        that.DAA001 = that.KbBarInfo.daA001;
-                        that.KbBarMxInfo = json.data.tbBillList.kbBarMxInfo;
-                        that.$refs.XBar.focus();
-                        that.XbarInfo = [];
-                        that.XBar = "";
+                        that.DAANum = json.data.tbBillList.gD_Num;
+                        that.DAA021 = json.data.tbBillList.workNo;
+                        that.xcslItemList = json.data.tbBillList.xcslItemList;
+                        that.xcslWjsBarList = json.data.tbBillList.xcslWjsBarList;
+                        that.xcslYjsBarList = json.data.tbBillList.xcslYjsBarList;
+                        that.$refs.Bar.focus();
                     }
                     else {
                         that.$toast.fail(json.message);
-                        that.$refs.KbBar.focus();
-                        that.KbBar = "";
+                        that.$refs.DAA001.focus();
+                        that.DAA001 = "";
                     }
                     that.isLoading = false;
                 })
                 .catch(function (error) {
                     that.isLoading = false;
                     that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
-                    that.$refs.KbBar.focus();
-                    that.KbBar = "";
                 });
         },
-        getXBarInfo() {
+        ScanXcsl() {
+            // 娣诲姞闃叉姈鍒ゆ柇
+            if (this.isLoading) {
+                return;
+            }
+
             var that = this;
-            if (that.KbBar.length <= 0) {
-                that.$toast.fail("鍗℃澘鏉$爜涓嶈兘涓虹┖锛�");
-                that.$refs.KbBar.focus();
-                that.XBar = "";
+            if (!that.Bar ||that.Bar.length <= 0) {
+                that.$toast.fail("鐗╂枡鏉$爜涓嶈兘涓虹┖锛�");
+                that.$refs.Bar.focus();
                 return;
             }
 
-            if (that.DAA001.length <= 0) {
-                that.$toast.fail("鎸囦护宸ュ崟涓嶈兘涓虹┖锛�");
-                that.$refs.KbBar.focus();
-                that.XBar = "";
-                return;
-            }
 
-            // 妫�鏌ユ槸鍚﹁秴杩囪绠辨暟
-            if (that.XbarInfo.length >= that.Xvalue) {
-                that.$toast.fail(`宸茶揪鍒拌绠辨暟闄愬埗(${that.Xvalue})`);
-                that.XBar = "";
-                return;
-            }
-
-            // 妫�鏌ユ潯鐮佹槸鍚﹀凡瀛樺湪
-            const isExist = that.XbarInfo.some(item => item.iteM_BARCODE === that.XBar);
-            if (isExist) {
-                that.$toast.fail("璇ョ鏉$爜宸插瓨鍦紝璇峰嬁閲嶅鎵弿");
-                that.XBar = "";
+            if (!that.DAA001 ||that.DAA001.length <= 0) {
+                that.$toast.fail("宸ュ崟鍗曞彿涓嶈兘涓虹┖锛�");
+                that.$refs.DAA001.focus();
                 return;
             }
 
             that.isLoading = true;
-            that.AxiosHttp("post", 'Womdaa/getXBarInfo', {
-                Kbbarcode: that.KbBar,
+            that.AxiosHttp("post", 'Womdaa/ScanXcsl', {
                 DAA001: that.DAA001,
-                Xbarcode: that.XBar
-            }, false)
-                .then(function (res) {
-                    var json = res;
-                    if (json.status == 0) {
-                        that.XbarInfo.push(json.data.tbBillList.xBarInfo[0]);
-                        that.$refs.XBar.focus();
-                        that.XBar = "";
-                    }
-                    else {
-                        that.$toast.fail(json.message);
-                    }
-                    that.isLoading = false;
-                })
-                .catch(function (error) {
-                    that.isLoading = false;
-                    that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
-                });
-        },
-
-
-        productBinding() {
-            var that = this;
-            if (that.ZsBar.length <= 0) {
-                that.$toast.fail("杩芥函鐮佷笉鑳戒负绌猴紒");
-                return;
-            }
-            if (that.LsBar.length <= 0) {
-                that.$toast.fail("鍚庣洊鐮佷笉鑳戒负绌猴紒");
-                return;
-            }
-
-            that.isLoading = true;
-            that.AxiosHttp("post", 'Womdaa/ProductBinding', {
-                ZsBar: that.ZsBar,
-                LsBar: that.LsBar,
-                userName: that.userInfo.loginAccount,
+                Bar: that.Bar,
+                userAccount: that.userInfo.loginAccount,
             }, false)
                 .then(function (res) {
                     var json = res;
                     if (json.status == 0) {
                         // that.scanInfo = json.data.tbBillList;
                         that.$notify({ type: 'success', message: json.message });
-                        that.$refs.ZsBar.focus();
-                        that.ZsBar = null;
-                        that.ZsBar = null;
+                        that.GetItemsXcsl();
                     }
                     else {
                         that.$toast.fail(json.message);
-                        that.$refs.ZsBar.focus();
-                        that.ZsBar = null;
-                        that.ZsBar = null;
                     }
-                    
+                    that.isLoading = false;
+                    that.$refs.Bar.focus();
+                    that.Bar = "";
+                })
+                .catch(function (error) {
+                    that.isLoading = false;
+                    that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                });
+        },
+        //鑾峰彇宸ュ崟淇℃伅
+        getInfo() {
+            this.show = true;
+            var that = this;
+            that.actions = [];
+            that.isLoading = true;
+            that.AxiosHttp("post", 'Womdaa/GetXcslDaa', {
+                selectKey: that.selectKey,
+            }, false)
+                .then(function (res) {
+                    var json = res;
+                    if (json.status == 0) {
+
+                        if (json.data.tbBillList.length <= 0) {
+                            that.$toast.fail("娌℃湁鍙敤鐨勬暟鎹�");
+                            that.$playSound('error');
+                        } else {
+                            that.itemInfo = json.data.tbBillList;
+                            that.actions = json.data.tbBillList.map(item => {
+                                return {
+                                    name: item.daaInfo  // 鎷兼帴瀛楁
+
+                                };
+                            });
+                        }
+                    }
+                    else {
+                        that.$toast.fail(json.message);
+                        that.$playSound('error');
+                    }
                     that.isLoading = false;
                 })
                 .catch(function (error) {
                     that.isLoading = false;
                     that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
-                    that.$refs.ZsBar.focus();
-                    that.ZsBar = null;
-                    that.ZsBar = null;
+                    that.$playSound('error');
+                    console.log(error);
                 });
         },
-        //鎵撳嵃鏈烘敞閲�
-        //selectPrinter(printer) {
-        //    this.selectedPrinter = printer.printerId; // 鏇存柊閫変腑鐨勬墦鍗版満缂栧彿
-        //},
-        //confirmSelection() {
-        //    if (this.selectedPrinter) {
-        //        alert(`鎮ㄩ�夋嫨浜嗘墦鍗版満锛�${this.selectedPrinter}`);
-        //        // 鍦ㄨ繖閲屽鐞嗛�夋嫨缁撴灉锛屼緥濡傝皟鐢ㄦ帴鍙f垨鏇存柊鐘舵��
-        //        this.isPrinterPopupVisible = false; // 鍏抽棴寮圭獥
-        //    } else {
-        //        alert('璇烽�夋嫨涓�涓墦鍗版満锛�');
-        //    }
-        //},
-        //onPrinterSelected(value) {
-        //    console.log('褰撳墠閫変腑鐨勬墦鍗版満缂栧彿:', value);
-        //},
-        checkProductBarcode() {
-            var that = this;
-            if (!that.LsBar) {
-                that.$toast.fail("璇疯緭鍏ヤ骇鍝佹潯鐮�");
-                return;
-            }
+        onSelect(item) {
+            // 榛樿鎯呭喌涓嬬偣鍑婚�夐」鏃朵笉浼氳嚜鍔ㄦ敹璧�
+            // 鍙互閫氳繃 close-on-click-action 灞炴�у紑鍚嚜鍔ㄦ敹璧�
+            this.show = false;
+            console.log(item);
+            // 姝e垯鍖归厤绗竴涓柟鎷彿鍐呭
+            const regex = /\[([^\]]+)\]/;
+            const matchResult = item.name.match(regex);
             
-            // 鍦╔barInfo涓煡鎵惧尮閰嶇殑鏉$爜
-            const matchedItem = that.XbarInfo.find(item => 
-                item.iteM_BARCODE === that.LsBar
-            );
-            
-            if (matchedItem) {
-                if (matchedItem.is_hedui === "1") {
-                    that.$toast("宸叉牳瀵�");
-                } else {
-                    that.$set(matchedItem, 'is_hedui', "1");
-                    that.$notify({ type: 'success', message: "鏍稿鎴愬姛" });
-                    that.LsBar = "";
-                    // 妫�鏌ユ槸鍚︽墍鏈夎閮藉凡鏍稿
-                    const allChecked = that.XbarInfo.every(item => item.is_hedui === "1");
-                    if (allChecked && that.XbarInfo.length > 0) {
-                        that.submitAllChecked();
-                    }
-                }
+            if (matchResult && matchResult[1]) {
+                this.DAA001 = matchResult[1]; // PPBOM00000088-1
+                console.log('鎻愬彇鐨凞AA001:', this.DAA001);
             } else {
-                that.$toast.fail("鏈壘鍒板尮閰嶇殑绠辨潯鐮�");
+                this.$toast.fail('宸ュ崟鍙锋牸寮忓紓甯�');
+                this.DAA001 = '';
             }
-            
-            that.LsBar = ""; // 娓呯┖杈撳叆妗�
-        },
+            this.GetItemsXcsl();
+            //this.$toast(item.name);
 
-        // 鏂板鏂规硶锛氭彁浜ゆ墍鏈夊凡鏍稿鐨勬暟鎹�
-        submitAllChecked() {
-            var that = this;
-            that.isLoading = true;
-            
-            that.AxiosHttp("post", 'Womdaa/submitAllChecked', {
-                XbarInfo: that.XbarInfo,
-                KbBar: that.KbBar,
-                userName: that.userInfo.loginAccount
-            }, false)
-                .then(function (res) {
-                    var json = res;
-                    if (json.status == 0) {
-                        that.$notify({ type: 'success', message: json.message });
-                        that.getKbBarInfo();
-                    } else {
-                        that.$toast.fail(json.message);
-                        that.XbarInfo = [];
-                        that.XBar = "";
-                        that.LsBar = "";
-                        that.$refs.XBar.focus();
-                    }
-                    that.isLoading = false;
-                })
-                .catch(function (error) {
-                    that.isLoading = false;
-                    that.$toast.fail("缁戝畾澶辫触锛岃閲嶈瘯锛�");
-                });
-        },
-        handleSubmit() {
-            var that = this;
-            if (!that.KbBar) {
-                that.$toast.fail("璇峰厛鎵弿鍗℃澘鏉$爜");
-                return;
-            }
-    
-            // 璁$畻鍙鏁板拰宸茶鏁�
-            const oldqty = +(that.KbBarInfo.oldqty || 0);
-            const ySum = +(that.KbBarInfo.ySum || 0);
-            
-            if (oldqty !== ySum) {
-                that.$toast.fail(`瑁呮澘鏈畬鎴愶紝寰呰鏁帮細${oldqty - ySum}`);
-                return;
-            }
-    
-            that.isLoading = true;
-            that.AxiosHttp("post", 'Womdaa/submitInspection', {
-                KbBar: that.KbBar,
-                userAccount: that.userInfo.loginAccount
-            }, false)
-                .then(function (res) {
-                    var json = res;
-                    if (json.status == 0) {
-                        that.$notify({ type: 'success', message: json.tbBillList.message });
-                        // 娓呯┖鏁版嵁
-                        that.KbBar = "";
-                        that.XbarInfo = [];
-                        that.KbBarInfo = [];
-                        that.$refs.KbBar.focus();
-                    } else {
-                        that.$toast.fail(json.message);
-                    }
-                    that.isLoading = false;
-                })
-                .catch(function (error) {
-                    that.isLoading = false;
-                    that.$toast.fail("鎻愪氦澶辫触锛岃閲嶈瘯锛�");
-                    that.$refs.KbBar.focus();
-                });
         },
     }
 })
\ No newline at end of file

--
Gitblit v1.9.3