From aa3438b349bb365bfb4c30a9194b5c10f9f843eb Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期二, 08 四月 2025 17:39:13 +0800 Subject: [PATCH] feat:质检员历史质检单增加上滑更多 --- pages/public-page/selectSpecifications/selectSpecifications.vue | 275 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 232 insertions(+), 43 deletions(-) diff --git a/pages/public-page/selectSpecifications/selectSpecifications.vue b/pages/public-page/selectSpecifications/selectSpecifications.vue index 84004a9..cefbd16 100644 --- a/pages/public-page/selectSpecifications/selectSpecifications.vue +++ b/pages/public-page/selectSpecifications/selectSpecifications.vue @@ -1,15 +1,16 @@ <template> <view class="main"> <u--form labelPosition="top" - labelWidth="25%" + labelWidth="30%" :borderBottom="false" - :rules="rules" + :rules="pageFlag ? rules : rulesGe" :errorType="'border-bottom'" :model="dataForm" ref="uForm"> - <u-form-item + <!-- <u-form-item borderBottom=true label="涓�绾у搧绫�" + v-if="!pageFlag" prop="firstClass" :borderBottom="false"> <u-cell-group> @@ -20,19 +21,27 @@ slot="right-icon" size="30"></u-icon></u-cell> </u-cell-group> - </u-form-item> + </u-form-item> --> <u-form-item borderBottom=true label="浜岀骇鍝佸悕" prop="secondClass" :borderBottom="false"> <u-cell-group> - <u-cell :title="dataForm.secondClass" + <!-- <u-cell :title="dataForm.secondClass" value="璇烽�夋嫨" @click="secondClassSelect"> <u-icon name="arrow-right" slot="right-icon" - size="30"></u-icon></u-cell> + size="30"></u-icon></u-cell> --> + <!-- <niceui-data-select-input + v-model="dataForm.secondClass" + :localdata="secondClassActionsList" + @change="change" + :value="dataForm.secondClass" + class="uni-px-5 uni-pb-5" + ></niceui-data-select-input> --> + <uni-combox :candidates="secondClassActionsList" placeholder="璇烽�夋嫨浜岀骇鍝佸悕" v-model="dataForm.secondClass"></uni-combox> </u-cell-group> </u-form-item> <u-form-item @@ -46,11 +55,32 @@ </u-form-item> <!-- 鏂板涓嶅悎鏍肩О閲� --> <u-form-item label="涓嶅悎鏍奸噸閲�" + v-if="pageFlag" prop="unqualifiedWeight" borderBottom> <u-input v-model="dataForm.unqualifiedWeight" - placeholder="璇疯緭绉伴噸" + placeholder="璇疯緭鍏ラ噸閲�" + type="digit" border="bottom" + @change="v=>checkNum(v,'unqualifiedWeight')" + @input="$u.debounce(specInputHandle, 500)"></u-input> + </u-form-item> + <!-- <u-form-item label="涓嶅悎鏍煎垽瀹�" prop="unqualifiedType"> + <u-radio-group size='32' v-model="dataForm.unqualifiedType"> + <u-radio :label-size="25" :name="'1'" :label="'瓒呭昂鎵g綒'" :disabled="disabled">闀垮害鎵g綒</u-radio> + <u-radio :label-size="25" :name="'2'" :label="'鍘氬害鎵g綒'" :disabled="disabled">鍘氬害鎵g綒</u-radio> + <u-radio :label-size="25" :name="'3'" :label="'瀵嗛棴鍣�'" :disabled="disabled">瀵嗛棴鍣�</u-radio> + </u-radio-group> + </u-form-item> --> + <u-form-item label="鍗曚环" + prop="penaltyUnitPrice" + v-if="pageFlag" + borderBottom> + <u-input v-model="dataForm.penaltyUnitPrice" + placeholder="璇疯緭鍏ヤ笉鍚堟牸鍗曚环" + type="digit" + border="bottom" + @change="v=>checkNum(v,'penaltyUnitPrice')" @input="$u.debounce(specInputHandle, 500)"></u-input> </u-form-item> </u--form> @@ -95,11 +125,15 @@ export default { data() { return { + pageFlag:false, // false:'涓嶅悎鏍�' true :'鍚堟牸鐨�' + dataForm: { firstClass: "", secondClass: "", specifications: "", unqualifiedWeight:'', + // unqualifiedType:'', + penaltyUnitPrice:'' }, index: '', takeCoalId: "", @@ -131,7 +165,7 @@ }, 'specifications': { type: 'string', - required: true, + required: false, message: '璇烽�夋嫨鍊�', trigger: ['blur', 'change'] }, @@ -140,7 +174,52 @@ message: '璇烽�夋嫨鍊�', trigger: ['blur', 'change'] }, + // 'unqualifiedType':{ + // required: true, + // message: '璇烽�夋嫨鍊�', + // trigger: ['blur', 'change'] + // }, + 'penaltyUnitPrice':{ + required: false, + message: '璇烽�夋嫨鍊�', + trigger: ['blur', 'change'] + } }, + rulesGe:{ + 'firstClass': { + type: 'string', + required: true, + message: '璇烽�夋嫨鍊�', + trigger: ['blur', 'change'] + }, + 'secondClass': { + type: 'string', + required: true, + message: '璇烽�夋嫨鍊�', + trigger: ['blur', 'change'] + }, + 'specifications': { + type: 'string', + required: false, + message: '璇烽�夋嫨鍊�', + trigger: ['blur', 'change'] + }, + 'unqualifiedWeight': { + required: false, + message: '璇烽�夋嫨鍊�', + trigger: ['blur', 'change'] + }, + // 'unqualifiedType':{ + // required: true, + // message: '璇烽�夋嫨鍊�', + // trigger: ['blur', 'change'] + // }, + 'penaltyUnitPrice':{ + required: false, + message: '璇烽�夋嫨鍊�', + trigger: ['blur', 'change'] + } + }, // showWeighCopyStorge: [] } @@ -159,8 +238,10 @@ this.params = params; this.productName = params.productName === "true" || false this.unqualified = params.unqualified === "true" || false - this.showWeighCopyStorge = JSON.parse(JSON.stringify(uni.getStorageSync('showWeighCopyStorge'))) - console.log(params,'paramsparamsparams'); + params.pageFlag ? this.pageFlag = false : this.pageFlag = true; + this.showWeighCopyStorge = JSON.parse(JSON.stringify(uni.getStorageSync('showWeighCopyStorgeOther'))) + console.log(params, 'paramsparamsparams'); + if(params.type == 'edit'){ this.init(params) } @@ -171,27 +252,63 @@ uni.showLoading({ title: "鍔犺浇涓�" }) - this.$reqGet("getFirstCategoryName").then(res => { - if (res.code === 0) { - uni.hideLoading() - this.firstClassActionsList = res.data.filter(Boolean).map(v => { - return { - ...v, - name: v && v.firstCategoryName + // this.$reqGet("getFirstCategoryName").then(res => { + // if (res.code === 0) { + // uni.hideLoading() + // this.firstClassActionsList = res.data.filter(Boolean).map(v => { + // return { + // ...v, + // name: v && v.firstCategoryName + // } + // }) + // if(params.type !== 'edit') this.dataForm.firstClass = this.firstClassActionsList[0].firstCategoryName + // //濡傛灉鏄悎鏍肩殑闇�瑕佸洖鏄惧搧鍚嶈鏍� + // + + // } else { + // uni.hideLoading() + // this.$u.toast('鍔犺浇澶辫触') + // } + // // 鍥炴樉浜岀骇鍝佸悕 + this.$reqGet('getSecondCategoryName').then( + res => { + if (res.code === 0) { + uni.hideLoading(); + console.log(res.data,'result') + this.secondClassActionsList = res.data.map(v => { + return v.secondCategoryName + }) + // if(this.secondClassActionsList .length){ + // this.dataForm.secondClass = this.secondClassActionsList[0].value; + // } + // + // } + if(params.actionObj){ + let {breed,spec} = JSON.parse(params.actionObj); + this.secondClassActionsList.unshift(breed) + this.dataForm.specifications= spec;; + this.dataForm.secondClass= breed; + this.dataForm.firstClass= JSON.parse(params.actionObj).firstClass || ''; + console.log(this.secondClassActionsList,'secondClass') } - }) - if(params.type !== 'edit') this.dataForm.firstClass = this.firstClassActionsList[0].firstCategoryName - } else { - uni.hideLoading() - this.$u.toast('鍔犺浇澶辫触') - } - }) + + } else { + uni.hideLoading() + this.$u.toast('鍔犺浇澶辫触') + } + }) + // }) }, init(params){ - let arr = this.globalShowWeigh[params.index]; + let arr = this.showWeighCopyStorge[params.index]; + console.log(this.showWeighCopyStorge,'arr') let {firstClass,secondClass,specifications} = arr.tempArr[params.indexTo]; Object.assign(this.dataForm,{firstClass,secondClass,specifications}); - this.dataForm.unqualifiedWeight = this.globalShowWeigh[params.index].unqualifiedWeights.split(',')[params.indexTo] + this.dataForm.unqualifiedWeight = this.showWeighCopyStorge[params.index].unqualifiedWeights.split(',')[params.indexTo]; + //涓嶅悎鏍肩被鍒ゅ畾 + // this.dataForm.unqualifiedType = this.showWeighCopyStorge[params.index].unqualifiedType.split(',')[params.indexTo]; + //鍗曚环 + this.dataForm.penaltyUnitPrice = this.showWeighCopyStorge[params.index].penaltyUnitPrice.split(',')[params.indexTo]; }, //涓�绾у搧绫昏彍鍗� firstClassSelect() { @@ -202,6 +319,7 @@ }, firstClassSelectClick(val) { this.dataForm.firstClass = val.name + this.secondClassSelect(); }, // 浜岀骇鍝佺被閫夋嫨 getSecondCategoryName() { @@ -215,9 +333,11 @@ this.secondClassActionsList = res.data.map(v => { return { ...v, - name: v.secondCategoryName + value: v.secondCategoryName, + text:v.secondCategoryName } }) + this.dataForm.secondClass = this.secondClassActionsList[0].value; } else { uni.hideLoading() this.$u.toast('鍔犺浇澶辫触') @@ -227,7 +347,7 @@ //浜岀骇鍝佺被鑿滃崟 async secondClassSelect() { await this.getSecondCategoryName() - this.secondClassShow = true + // this.secondClassShow = true }, secondClassClose() { this.secondClassShow = false @@ -259,8 +379,10 @@ formHandle() { console.log(this.globalShowWeigh, this.$refs.uForm,'this.globalShowWeigh'); this.$refs.uForm.validate().then(res => { - uni.$u.toast('鏍¢獙閫氳繃') + // uni.$u.toast('鏍¢獙閫氳繃') + this.showWeighCopyStorge = this.globalShowWeigh; + console.log(this.showWeighCopyStorge,this.index,'this.showWeighCopyStorge[this.index]'); if(this.params.type == 'edit'){ if (this.productName) { this.showWeighCopyStorge[this.index].modifyProductName = this.dataForm.secondClass + '/' + this @@ -273,19 +395,29 @@ .specifications; let tempArr = this.showWeighCopyStorge[this.index].unqualifiedBreed.split(",") let tempWeightArr = this.showWeighCopyStorge[this.index].unqualifiedWeights.split(",") + // let noPinArr =this.showWeighCopyStorge[this.index].unqualifiedType.split(",") + let noPriceArr = this.showWeighCopyStorge[this.index].penaltyUnitPrice.split(","); tempArr[this.params.indexTo] = str; tempWeightArr[this.params.indexTo] = this.dataForm.unqualifiedWeight; + // noPinArr[this.params.indexTo] = this.dataForm.unqualifiedType; + noPriceArr[this.params.indexTo] = this.dataForm.penaltyUnitPrice || '0'; this.showWeighCopyStorge[this.index].unqualifiedBreed = tempArr.join(','); this.showWeighCopyStorge[this.index].unqualifiedWeights = tempWeightArr.join(','); - this.showWeighCopyStorge[this.index].breed = this.dataForm.secondClass - this.showWeighCopyStorge[this.index].spec = this.dataForm.specifications - + // this.showWeighCopyStorge[this.index].unqualifiedType = noPinArr.join(','); + this.showWeighCopyStorge[this.index].penaltyUnitPrice = noPriceArr.join(','); + // this.showWeighCopyStorge[this.index].breed = this.dataForm.secondClass + // this.showWeighCopyStorge[this.index].spec = this.dataForm.specifications + //濡傛灉杩欎釜 tempArr涓嶄负 绌� + if(this.showWeighCopyStorge[this.index].tempArr){ this.showWeighCopyStorge[this.index].tempArr[this.params.indexTo].firstClass = this.dataForm.firstClass; this.showWeighCopyStorge[this.index].tempArr[this.params.indexTo].secondClass = this.dataForm.secondClass; this.showWeighCopyStorge[this.index].tempArr[this.params.indexTo].specifications = this.dataForm.specifications; + }else{ + + + } + } - - }else{ if (this.productName) { this.showWeighCopyStorge[this.index].modifyProductName = this.dataForm.secondClass + '/' + this @@ -296,20 +428,50 @@ if (this.unqualified) { let str = this.dataForm.secondClass + '/' + this.dataForm .specifications; - let tempArr = this.showWeighCopyStorge[this.index].unqualifiedBreed.split(",").filter(Boolean); - let tempWeightArr = this.showWeighCopyStorge[this.index].unqualifiedWeights.split(",").filter(Boolean); + let tempArr; + if( this.showWeighCopyStorge[this.index].unqualifiedBreed){ + tempArr = this.showWeighCopyStorge[this.index].unqualifiedBreed.split(",").filter(Boolean); + }else{ + tempArr = [] + } + + let tempWeightArr; + if(this.showWeighCopyStorge[this.index].unqualifiedWeights){ + tempWeightArr = this.showWeighCopyStorge[this.index].unqualifiedWeights.split(",").filter(Boolean) + }else{ + tempWeightArr = []; + } + // 娣诲姞涓嶅悎鏍煎搧绫诲垽瀹� + // let noPin; + // if(this.showWeighCopyStorge[this.index].unqualifiedType){ + // noPin = this.showWeighCopyStorge[this.index].unqualifiedType.split(",").filter(Boolean) + // }else{ + // noPin = [] + // } + //娣诲姞涓嶅悎鏍煎崟浠� + let noPrice; + if(this.showWeighCopyStorge[this.index].penaltyUnitPrice){ + noPrice = this.showWeighCopyStorge[this.index].penaltyUnitPrice.split(","); + }else{ + noPrice = [] + } + tempWeightArr.push(this.dataForm.unqualifiedWeight); tempArr.push(str); + // noPin.push(this.dataForm.unqualifiedType) + noPrice.push(this.dataForm.penaltyUnitPrice ? this.dataForm.penaltyUnitPrice : '0') this.showWeighCopyStorge[this.index].unqualifiedBreed = tempArr.join(',') this.showWeighCopyStorge[this.index].unqualifiedWeights = tempWeightArr.join(',') - - this.showWeighCopyStorge[this.index].breed = this.dataForm.secondClass - this.showWeighCopyStorge[this.index].spec = this.dataForm.specifications + // this.showWeighCopyStorge[this.index].unqualifiedType = noPin.join(',') + this.showWeighCopyStorge[this.index].penaltyUnitPrice = noPrice.join(',') + + // this.showWeighCopyStorge[this.index].breed = this.dataForm.secondClass + // this.showWeighCopyStorge[this.index].spec = this.dataForm.specifications - // this.showWeighCopyStorge[this.index].firstClass = this.dataForm.firstClass; - // this.showWeighCopyStorge[this.index].secondClass = this.dataForm.secondClass; - // this.showWeighCopyStorge[this.index].specifications = this.dataForm.specifications; + this.showWeighCopyStorge[this.index].firstClass = this.dataForm.firstClass; + this.showWeighCopyStorge[this.index].secondClass = this.dataForm.secondClass; + this.showWeighCopyStorge[this.index].specifications = this.dataForm.specifications; if(!this.showWeighCopyStorge[this.index].tempArr){ this.showWeighCopyStorge[this.index].tempArr = []; @@ -332,11 +494,33 @@ uni.navigateBack({ url: `/pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail?dataForm=${JSON.stringify(this.dataForm)}&orderPlanId=${this.takeCoalId}&index=${this.index}&havedSubmit=${true}` }) + uni.$emit("handClick",{data:this.dataForm,tempArr:this.showWeighCopyStorge[this.index].tempArr,index:this.index,pageFlag:this.pageFlag}); }).catch(errors => { + console.log(errors,'errors') uni.$u.toast('鏍¢獙澶辫触') }) - } + }, + checkNum(value,name){ + if ( + value && + value.indexOf(".") < 0 && + value != "" + ) { + value = parseFloat(value); + value = value + ""; // 鍙樺洖涓哄瓧绗︿覆 + }else{ + value = value.replace(/^(-)*(\d+)\.(\d\d\d\d).*$/,"$1$2.$3"); + + } // 濡傛灉娌℃湁灏忔暟鐐癸紝棣栦綅涓嶈兘涓虹被浼间簬 01銆�02鐨勫�� + this.$nextTick(()=>{ + this.dataForm[name] = value.replace(/[^\d.]/g, ""); + }); + + }, + change(e) { + this.dataForm.secondClass =e; + }, } } </script> @@ -348,6 +532,10 @@ margin: 10px; position: relative; } + /deep/ .uni-combox { + z-index: 99999!important + } + .slide-fade-enter-active { transition: all 0.3s ease-out; @@ -377,4 +565,5 @@ } } } + </style> \ No newline at end of file -- Gitblit v1.9.1