From b8e49f7a79a880726e459d59c4044d1dc6c159e6 Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期一, 14 四月 2025 17:03:23 +0800
Subject: [PATCH] 1.销售出库优化 2.销售退货优化 3.产品绑定送检优化

---
 H5/Js/LLJ/Add.js |  416 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 366 insertions(+), 50 deletions(-)

diff --git a/H5/Js/LLJ/Add.js b/H5/Js/LLJ/Add.js
index 559a127..50eea2a 100644
--- a/H5/Js/LLJ/Add.js
+++ b/H5/Js/LLJ/Add.js
@@ -27,13 +27,32 @@
             isShowTable: false,
             tableData: [],//杩斿洖鐨勬楠岄」鐩�
             jymxData: [],//灞曠ず鐨勬楠岄」鐩�
-
+            remarks:'',//涓嶅悎鏍兼弿杩�
+            okNum:'',//鍚堟牸鏁�
+            ngNum: '',//涓嶅悎鏍兼暟
             ttrre: false,
-            show: false,
+            show: false,//鏄庣粏闈㈡澘
             tableMxData: [],
             tabActive: 0,
             inputValue: '',//鐗瑰緛鍊艰緭鍏�
             resultValue: '',//妫�楠岀粨鏋滃綍鍏�
+            showButton: false,//鍙充笂瑙掕彍鍗曡Е鍙�
+            okValue: '',//OK-鏁伴噺
+            ngValue: '',//NG-鏁伴噺
+            showDialog: false,//涓嶈壇琛ㄨ堪杈撳叆妗�
+            //鍥剧墖涓婁紶妗�
+            fileList: [
+                //{
+                //    url: 'https://img01.yzcdn.cn/vant/leaf.jpg',
+                //    status: 'uploading',
+                //    message: '涓婁紶涓�...',
+                //},
+                //{
+                //    url: 'https://img01.yzcdn.cn/vant/tree.jpg',
+                //    status: 'failed',
+                //    message: '涓婁紶澶辫触',
+                //},
+            ],
         }
     },
     mounted() {
@@ -48,6 +67,23 @@
         this.init();
     },
     methods: {
+        // 杈撳叆杩囨护
+        handleNumberInput1(value) {
+            // 鍘婚櫎闈炴暟瀛楀苟纭繚棣栦綅涓嶄负0锛堥櫎闈炴槸鍗曠嫭鐨�0锛�
+            this.okValue = value.replace(/[^\d]/g, '') // 鍘婚櫎闈炴暟瀛楀瓧绗�
+                .replace(/^0+(?!$)/, ''); // 鍘婚櫎寮�澶寸殑0锛岄櫎闈炴暣涓瓧绗︿覆鏄�0
+        },
+        handleNumberInput2(value) {
+            // 鍘婚櫎闈炴暟瀛楀苟纭繚棣栦綅涓嶄负0锛堥櫎闈炴槸鍗曠嫭鐨�0锛�
+            this.ngValue = value.replace(/[^\d]/g, '') // 鍘婚櫎闈炴暟瀛楀瓧绗�
+                .replace(/^0+(?!$)/, ''); // 鍘婚櫎寮�澶寸殑0锛岄櫎闈炴暣涓瓧绗︿覆鏄�0
+        },
+        handleNumberInput3(value) {
+            this.inputValue = value.replace(/[^\d.]/g, '')  // 1. 鍘婚櫎闈炴暟瀛楀拰灏忔暟鐐�
+                .replace(/(\..*)\./g, '$1')               // 2. 绂佹澶氫釜灏忔暟鐐�
+                .replace(/^\./g, '');    
+        },
+
         togglePopup(index) {
             // 鍒囨崲鎸囧畾绱㈠紩鐨� popup 鐘舵��
             var that = this;
@@ -63,6 +99,15 @@
             }, true, 1).then(function (res1) {
                 if (res1.rtnCode == 1) {
                     that.tableMxData = res1.rtnData;
+                    // 缁熻鍚堟牸鏁板拰涓嶅悎鏍兼暟
+                    const list = res1.rtnData?.list || []; // 纭繚 list 鏄暟缁勶紝閬垮厤 undefined 閿欒
+                    const okNum = list.filter(item => item.fstand === '鈭�').length;
+                    const ngNum = list.length - okNum;
+
+                    // 灏嗙粨鏋滀繚瀛樺埌鎸囧畾鍙橀噺锛堝 that 鐨勬垚鍛樺睘鎬э級
+                    that.okNum = okNum;
+                    that.ngNum = ngNum;
+
                 } else {
                     that.$toast.fail(res1.rtnMsg);
                 }
@@ -74,14 +119,141 @@
 
         },
 
-        handleTabClick() {
-            console.log(this.tabActive)
-            this.togglePopup(this.tabActive)
+        getInputOK() {
+            var that = this;
+            var jys = that.tableData[that.tabActive].checkQyt;//妫�楠岄」鐩殑妫�楠屾暟
+
+            if (!that.okValue) {
+                this.$toast.fail("OK鏁颁笉鑳戒负绌�");
+                that.isLoading = false;
+                return;
+            }
+
+            if (jys < that.okValue) {
+                that.$toast.fail("褰曞叆鏁伴噺涓嶈兘澶т簬妫�楠屾暟锛�");
+                that.okValue = null;
+                //that.$refs.okValue.focus();
+                return;
+            }
+            // 鍒囨崲鎸囧畾绱㈠紩鐨� popup 鐘舵��
+            var resultValue = "OK-" + this.okValue;
+            this.getInput(resultValue);
+            that.okValue = null;
+        },
+        getInputNG() {
+            var that = this;
+            var jys = that.tableData[that.tabActive].checkQyt;//妫�楠岄」鐩殑妫�楠屾暟
+
+            if (!that.ngValue) {
+                this.$toast.fail("NG鏁颁笉鑳戒负绌�");
+                that.isLoading = false;
+                return;
+            }
+            if (jys < that.ngValue) {
+                that.$toast.fail("褰曞叆鏁伴噺涓嶈兘澶т簬妫�楠屾暟锛�");
+                that.ngValue = null;
+                //that.$refs.ngValue.focus();
+                return;
+            }
+            // 鍒囨崲鎸囧畾绱㈠紩鐨� popup 鐘舵��
+            var resultValue = "NG-" + this.ngValue;
+            this.getInput(resultValue);
+            that.ngValue = null;
         },
 
+        getInput(resultValue) {
+            // 鍒囨崲鎸囧畾绱㈠紩鐨� popup 鐘舵��
+            var that = this;
+            var guid1 = that.formData.guid;//涓昏〃id
+            var mxguid = that.tableData[that.tabActive].guid;//妫�楠岄」鐩殑guid
+            that.isLoading = true;
+            console.log(that.formData);
+            var input = resultValue;//鎷兼帴妫�楠屽��
+            that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EdtModel12', {
+                inOrderGuid1: guid1,
+                inOrderGuid5: mxguid,
+                inP1: input,//鎴栬��0k-19,鎴栬�卬g-19
+            }, true, 1).then(function (res1) {
+                if (res1.rtnCode == 1) {
+                    that.$notify({
+                        type: 'success', message: res1.rtnMsg
+                    });
+                    that.refreshJYItem();//鍒锋柊妫�楠岄」鐩�
+                    //that.tableData = null;
+                    //that.$refs.inputValue.focus();
+                } else {
+                    that.$toast.fail(res1.rtnMsg);
+                }
+                that.isLoading = false;
+            }).catch(function (error) {
+                that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                that.isLoading = false;
+            });
+        },
+
+        getInputTZZ() {
+            // 鍒囨崲鎸囧畾绱㈠紩鐨� popup 鐘舵��
+            var that = this;
+
+            if (!that.inputValue) {
+                this.$toast.fail("鐗瑰緛鍊间笉鑳戒负绌�");
+                that.isLoading = false;
+                return;
+            }
+
+            var mxguid = that.tableData[that.tabActive].guid;//妫�楠岄」鐩殑guid
+            var input = that.inputValue;
+            that.isLoading = true;
+            that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EditYangLi', {
+                dt05Guid: mxguid,
+                fSeq : "pda",
+                fVal : input,
+            }, true, 1).then(function (res1) {
+                if (res1.rtnData.outSum == 1) {
+                    that.$notify({
+                        type: 'success', message: res1.rtnMsg
+                    });
+                    that.okValue = null;
+                    that.refreshJYItem();//鍒锋柊妫�楠岄」鐩�
+                    //that.handleTabClick();//鍒锋柊妫�楠屾槑缁嗛潰鏉�
+                    //that.$refs.inputValue.focus();
+                    that.inputValue = null;
+                } else {
+                    that.$toast.fail(res1.rtnMsg);
+                    that.inputValue = null;
+                }
+                that.isLoading = false;
+            }).catch(function (error) {
+                that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                that.inputValue = null;
+                that.isLoading = false;
+            });
+        },
+
+        handleTabClick() {
+            console.log(this.tabActive)
+            this.togglePopup(this.tabActive);
+        },
+        //妫�楠屾槑缁嗗埛鏂�
+        refreshJYItem() {
+            const that = this;
+            return that.AxiosHttp("post", 'LLJ/getJYItem', {
+                releaseNo: that.formData.releaseNo
+            }, false).then(res1 => {
+                const tableData = res1.data.tbBillList || [];
+                that.tableData = tableData;
+                that.handleTabClick();//鍒锋柊妫�楠屾槑缁嗛潰鏉�
+            }).catch(error => {
+                that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                console.error('Refresh error:', error);
+            });
+        },
+
+        //涓婚〉闈㈠姞杞�
         init() {
             //alert(this.Request("id"));
             var that = this;
+            that.showButton = false;
             that.AxiosHttp("post", 'LLJ/getPage', {
                 id: that.Request("id"),
                 pageIndex: 1,
@@ -91,7 +263,7 @@
                     let data = res.data.tbBillList[0];
                     if (data) {
                         that.formData = data;
-
+                        that.remarks = that.formData.remarks;
                         that.AxiosHttp("post", 'LLJ/getJYItem', {
                             //id: that.formData.guid,
                             releaseNo: that.formData.releaseNo
@@ -108,6 +280,7 @@
                                 }
                             });
                             that.tableData = tableData;
+                            that.GetImageFileByGid();
                             //if (that.tableData.length === 0) {
                             //    that.isShowTable = true;
                             //}
@@ -124,40 +297,15 @@
         },
         submit() {
             var that = this;
-
-            //if (that.formdata.remarks == undefined && that.formdata.fcheckresu == "涓嶅悎鏍�") {
-            //    that.$toast.fail("妫�楠岀粨鏋滀负涓嶅悎鏍兼椂锛岄渶瑕佸~鍐欎笉鍚堟牸鎻忚堪锛�");
-            //    return;
-            //}
-
-
-
             that.ttrre = true;
-
-            //that.AxiosHttp("post", 'LLJ/IqcQaSubmit', {
-            //    userNo: this.userInfo.loginAccount,
-            //    releaseNo: this.formData.releaseNo
-            //}, false).then(function (res1) {
-            //    if (res1.status == 1) {
-            //        that.$toast.fail(res1.message);
-            //    } else {
-            //        that.$notify({ type: 'success', message: '鎻愪氦鎴愬姛' });
-            //        that.init();
-            //    }
-            //    that.ttrre = false
-            //}).catch(function (error) {
-            //    that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
-            //    that.ttrre = false
-            //    console.log(error);
-            //});
             that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EditModelSubmit', {
                 guid: that.formData.guid
             }, true, 1).then(function (res1) {
-                if (res1.rtnCode == 1) {
+                if (res1.rtnData.outSum == 1) {
                     that.$notify({ type: 'success', message: '鎻愪氦鎴愬姛' });
                     that.init();
                 } else {
-                    that.$toast.fail(res1.rtnMsg);
+                    that.$toast.fail(res1.rtnData.outMsg);
                 }
                 that.ttrre = false
             }).catch(function (error) {
@@ -167,27 +315,195 @@
             });
         },
         removeXJ() {
+            const that = this;
+            // 娣诲姞纭寮圭獥
+            that.$dialog.confirm({
+                message: '纭瑕侀噸鏂板姞杞芥楠岄」鐩悧锛�',
+                confirmButtonText: '纭',
+                cancelButtonText: '鍙栨秷'
+            }).then(() => {  // 纭鍥炶皟
+                that.isLoading = true;
+                that.AxiosHttp("post", 'MesQaItemsDetect01Manager/ReloadModel5', {
+                    guid: that.formData.guid
+                }, true, 1).then(res1 => {
+                    if (res1.rtnCode == 1) {
+                        that.$notify({ type: 'success', message: '閲嶆柊鍔犺浇鎴愬姛' });
+                        that.init();
+                    } else {
+                        that.$toast.fail(res1.rtnMsg);
+                    }
+                    that.isLoading = false;
+                }).catch(error => {
+                    that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                    that.isLoading = false;
+                });
 
-            var that = this;
-
-
-            that.AxiosHttp("post", 'MesQaItemsDetect01Manager/ReloadModel5', {
-                guid: that.formData.guid
-            }, true, 1).then(function (res1) {
-                if (res1.rtnCode == 1) {
-                    that.$notify({ type: 'success', message: '閲嶆柊鍔犺浇鎴愬姛' });
-                    that.init();
-                } else {
-                    that.$toast.fail(res1.rtnMsg);
-                }
-            }).catch(function (error) {
-                that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
-                console.log(error);
+            }).catch(() => {  // 鍙栨秷鍥炶皟
+                that.$toast('宸插彇娑堟搷浣�');
             });
-
         },
         GetBack1() {
             window.history.back();
-        }
+        },
+        onClickRight() {
+            
+        },
+        updateRemarks(guid) {
+            this.showDialog= true
+        },
+        deleteDetail13(guid13) {
+            const that = this;
+            
+            // 娣诲姞纭寮圭獥
+            that.$dialog.confirm({
+                message: '纭瑕佸垹闄よ鏍锋湰鍊艰褰曞悧锛�',
+                confirmButtonText: '纭',
+                cancelButtonText: '鍙栨秷'
+            }).then(() => {  // 纭鍥炶皟
+                that.isLoading = true;
+                that.AxiosHttp("post", 'Llj/deleteDetail13', {
+                    id13: guid13
+                }, true, 0).then(res1 => {
+                    if (res1.status == 0) {
+                        that.$notify({ type: 'success', message: '鍒犻櫎鎴愬姛' });
+                        that.refreshJYItem();//鍒锋柊妫�楠岄」鐩�
+                    } else {
+                        that.$toast.fail(res1.rtnMsg);
+                    }
+                    that.isLoading = false;
+                }).catch(error => {
+                    that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                    that.isLoading = false;
+                });
+
+            }).catch(() => {  // 鍙栨秷鍥炶皟
+                that.$toast('宸插彇娑堟搷浣�');
+                that.isLoading = false;
+            });
+        },
+        remarksConfirm() {
+            const that = this;
+            that.isLoading = true;
+            var guid = that.formData.guid;
+            that.AxiosHttp("post", 'Llj/updateRemarks', {
+                gid: guid,
+                Remarks: that.remarks
+            }, true, 0).then(res1 => {
+                if (res1.status == 0) {
+                    that.$notify({ type: 'success', message: '杈撳叆鎴愬姛' });
+                    that.init();//鍒锋柊妫�楠岄」鐩�
+                } else {
+                    that.$toast.fail(res1.rtnMsg);
+                }
+                that.isLoading = false;
+            }).catch(error => {
+                that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                that.isLoading = false;
+            });
+        },
+
+        async afterRead(file) {
+            try {
+                //alert(APIURL_IMAGE);
+                // 1. 鏄剧ず涓婁紶涓姸鎬�
+                file.status = 'uploading';
+                file.message = '涓婁紶涓�...';
+
+                // 2. 鍒涘缓 FormData锛堝叧閿細瀛楁鍚嶅繀椤诲拰鍚庣鍙傛暟鍚嶄竴鑷达級
+                const formData = new FormData();
+
+                // 3. 鏋勯�犳枃浠跺悕锛堟牴鎹悗绔姹傜敤 ~ 鍒嗗壊锛�
+                // 鍋囪闇�瑕� parentGuid锛岃繖閲屼粠缁勪欢鏁版嵁鑾峰彇
+                const parentGuid = this.formData.guid; // 鏍规嵁浣犵殑瀹為檯鏁版嵁婧愯皟鏁�
+                const customFileName = `${parentGuid}~${file.file.name}`;
+
+                // 4. 娣诲姞鏂囦欢锛堢浜屼釜鍙傛暟蹇呴』浣跨敤 new File 鍖呰锛�
+                formData.append('file', new File([file.file], customFileName, {
+                    type: file.file.type
+                }));
+
+                // 5. 璋冪敤缁熶竴灏佽鐨� Axios 鏂规硶
+                const res = await this.AxiosHttp(
+                    'post',
+                    'MesFile/UploadFile', // 鏍规嵁瀹為檯鎺ュ彛璺緞璋冩暣
+                    formData,
+                    true,     // 鏄剧ず鍔犺浇鐘舵��
+                    1     // 瓒呮椂鏃堕棿
+                );
+
+                // 6. 澶勭悊鍝嶅簲
+                if (res.rtnCode === 1) {
+                    file.status = 'done';
+                    file.message = '涓婁紶鎴愬姛';
+                    file.urlPath = res.rtnData.urlPath; // 淇濆瓨杩斿洖鐨勬枃浠惰矾寰�
+                    file.id = res.rtnData.id; // 淇濆瓨杩斿洖鐨勬枃浠秈d
+
+                    // 鍙�夛細涓婁紶鎴愬姛鍚庡埛鏂版枃浠跺垪琛�
+                    // await this.loadFileList(); 
+                } else {
+                    file.status = 'failed';
+                    file.message = res.rtnMsg || '涓婁紶澶辫触';
+                    this.$toast.fail(res.rtnMsg);
+                }
+
+            } catch (error) {
+                // 7. 寮傚父澶勭悊
+                file.status = 'failed';
+                file.message = '涓婁紶寮傚父';
+                this.$toast.fail('缃戠粶閿欒锛岃閲嶈瘯');
+                console.error('涓婁紶閿欒:', error);
+            } finally {
+                // 8. 寮哄埗鏇存柊瑙嗗浘锛圴ant 3+ 鍙兘闇�瑕侊級
+                this.$nextTick();
+            }
+        },
+        //鑾峰彇鍥剧墖淇℃伅
+        GetImageFileByGid() {
+            const that = this;
+            that.AxiosHttp("post", 'MesImage/getImage', {
+                parentId: that.formData.guid,
+            }, true, 0).then(res1 => {
+                if (res1.status === 0) {
+                    // 鍏抽敭杞崲锛氬皢鍚庣鏁版嵁杞崲涓� van-uploader 闇�瑕佺殑鏍煎紡
+                    that.fileList = res1.data.tbBillList.map(item => ({
+                        url: `${APIURL_IMAGE}/${item.urlPath}`,  // 鎷兼帴瀹屾暣璁块棶璺緞
+                        status: 'done',          // 鏍囪涓哄凡涓婁紶鎴愬姛
+                        name: item.fileTitle,    // 鍙�夋樉绀烘枃浠跺悕
+                        message: '宸蹭笂浼�',        // 鍙�夌姸鎬佹枃瀛�
+                        // 淇濈暀鍘熷鏁版嵁锛堟寜闇�锛�
+                        id: item.guid
+                    }));
+                } else {
+                    that.$toast.fail(res1.rtnMsg);
+                }
+            }).catch(error => {
+                that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+            });
+        },
+        handleDelete(file, { index }) {
+            var that = this;
+            that.$dialog.confirm({
+                title: '纭鍒犻櫎',
+                message: '纭畾瑕佸垹闄よ繖寮犲浘鐗囧悧锛�'
+            }).then(() => {
+                // 纭鍒犻櫎閫昏緫
+                console.log(file);
+                that.AxiosHttp("post", 'MesImage/deleteImage', {
+                    id: file.id,
+                }, true, 0).then(res1 => {
+                    if (res1.status === 0) {
+                        that.$notify({ type: 'success', message: '鍒犻櫎鎴愬姛' });
+                        that.init();//鍒锋柊妫�楠岄」鐩�
+                    } else {
+                        that.$toast.fail(res1.rtnMsg);
+                    }
+                }).catch(error => {
+                    that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                });
+
+            }).catch(() => {
+                // 鍙栨秷鎿嶄綔
+            })
+        },
     }
 })
\ No newline at end of file

--
Gitblit v1.9.3