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 | 441 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 408 insertions(+), 33 deletions(-) diff --git a/H5/Js/LLJ/Add.js b/H5/Js/LLJ/Add.js index 4eb07d3..50eea2a 100644 --- a/H5/Js/LLJ/Add.js +++ b/H5/Js/LLJ/Add.js @@ -25,9 +25,34 @@ boardStyle: "" }, isShowTable: false, - tableData: [], - - ttrre: false + tableData: [],//杩斿洖鐨勬楠岄」鐩� + jymxData: [],//灞曠ず鐨勬楠岄」鐩� + remarks:'',//涓嶅悎鏍兼弿杩� + okNum:'',//鍚堟牸鏁� + ngNum: '',//涓嶅悎鏍兼暟 + ttrre: 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() { @@ -42,9 +67,193 @@ 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; + this.show = true; + console.log(index); + console.log(that.tableData[index].guid); + var mxguid = that.tableData[index].guid; + that.jymxData = that.tableData[index]; + that.tabActive = index; + that.AxiosHttp("post", 'MesQaItemsDetect01Manager/GetModel12', { + parentGuid : "", + guid : mxguid , + }, 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); + } + }).catch(function (error) { + that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�"); + console.log(error); + }); + + + }, + + 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, @@ -54,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 @@ -71,9 +280,10 @@ } }); that.tableData = tableData; - if (that.tableData.length === 0) { - that.isShowTable = true; - } + that.GetImageFileByGid(); + //if (that.tableData.length === 0) { + // that.isShowTable = true; + //} }).catch(function (error) { that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�"); console.log(error); @@ -87,18 +297,15 @@ }, submit() { var that = this; - 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.AxiosHttp("post", 'MesQaItemsDetect01Manager/EditModelSubmit', { + guid: that.formData.guid + }, true, 1).then(function (res1) { + if (res1.rtnData.outSum == 1) { that.$notify({ type: 'success', message: '鎻愪氦鎴愬姛' }); that.init(); + } else { + that.$toast.fail(res1.rtnData.outMsg); } that.ttrre = false }).catch(function (error) { @@ -108,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