From 1db172e1eb09be68008659c9f05bf18144df553a Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期一, 04 十一月 2024 18:54:47 +0800 Subject: [PATCH] feat:集装箱更改 --- pages/driver-page/drvier-my/certifiCate/certifiCate.vue | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 100 insertions(+), 12 deletions(-) diff --git a/pages/driver-page/drvier-my/certifiCate/certifiCate.vue b/pages/driver-page/drvier-my/certifiCate/certifiCate.vue index f966e1e..0459210 100644 --- a/pages/driver-page/drvier-my/certifiCate/certifiCate.vue +++ b/pages/driver-page/drvier-my/certifiCate/certifiCate.vue @@ -83,9 +83,11 @@ label="杞︾墝鍙�" prop="carNo" required> - <u--input v-model="tranSportForm.carNo" + <xm-cell special label="杞︾墝鍙�" :value="tranSportForm.carNo" @show="showKeyboard('xmKeyboard')"></xm-cell> + <xm-keyboard-v2 ref="xmKeyboard" @confirm="(v) => tranSportForm.carNo = v"></xm-keyboard-v2> + <!-- <u--input v-model="tranSportForm.carNo" border="none" - inputAlign="left"></u--input> + inputAlign="left"></u--input> --> </u-form-item> <u-form-item labelWidth="20%" label="浜у搧" @@ -196,6 +198,24 @@ border="none" inputAlign="left"></u--input> </u-form-item> + <u-form-item prop="certificateImg" + label="璧勮川璇佹槑" + labelWidth="20%" + borderBottom + required + @click="beforeRead"> + <u-upload :fileList="item.fileList" + deletable + @afterRead="afterReads" + @delete="deletePics" + multiple + :name="index.toString()" + :maxCount="1" + width="250" + height="150" + :previewFullImage="true"> + </u-upload> + </u-form-item> </view> <u-form-item labelWidth="20%" @@ -229,7 +249,8 @@ supercargoList:[{ driverName:"", driverIdcard:"", - driverPhone:"" + driverPhone:"", + fileList:[] }], userInfo: {}, scoreDetailList: [], @@ -335,6 +356,10 @@ this.previewImageShow = false; }, previewImageOpen() {}, + deletePics(event) { + this.changeisUploadimg(true); + this.supercargoList[event.name].fileList.splice(event.index, 1); + }, // 鍒犻櫎 deletePic(event) { this.changeisUploadimg(true); @@ -385,9 +410,11 @@ } if(data){ this.tranSportForm=Object.assign({},this.tranSportForm,data) - this.supercargoList =this.tranSportForm.supercargoInfo.split(",").map(item=>{ - return {driverName:item.split("|")[0],driverIdcard:item.split("|")[1],driverPhone:item.split("|")[2]} - }) + if((!this.tranSportForm.supercargoInfo==''||null)||(!this.tranSportForm.highlyToxicImg==''||null) ){ + this.supercargoList =this.tranSportForm.supercargoInfo.split(",").map((item,index)=>{ + return {driverName:item.split("|")[0],driverIdcard:item.split("|")[1],driverPhone:item.split("|")[2],fileList:[{url:`${BaseUrl}${this.tranSportForm.highlyToxicImg.split(',')[index]}`}]} + }) + } this.driverList=this.tranSportForm.driverName.split(",").map((item,index)=>{ return {driverName:item,driverIdcard:this.tranSportForm.driverIdcard.split(",")[index]} }) @@ -400,6 +427,9 @@ } }, + showKeyboard(ref){ + this.$refs[ref].toShow(this.tranSportForm.carNo) + }, editTranClose(){ this.editTranShow = false; }, @@ -410,6 +440,7 @@ .then(res => { let submit=true let idcardtext=/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/ + const regex = /\*/; if (this.fileList9.length==0) { uni.showToast({ title: '璇烽�夋嫨閫氳璇侊紒', @@ -433,7 +464,7 @@ duration: 2000 }); submit=false - }else if(!idcardtext.test(item.driverIdcard)){ + }else if(!idcardtext.test(item.driverIdcard)&&!regex.test(item.driverIdcard)){ uni.showToast({ title: `璇锋楠岄┚椹跺憳韬唤璇侊紒`, icon: 'error', @@ -480,6 +511,13 @@ duration: 2000 }); submit=false + }else if(item.fileList.length==0){ + uni.showToast({ + title: `璇蜂笂浼犺祫璐ㄨ瘉鏄庯紒`, + icon: 'error', + duration: 2000 + }); + submit=false } }) } @@ -487,6 +525,7 @@ let driverName="" let driverIdcard="" let supercargoInfo='' + let highlyToxicImg='' driverName = this.driverList.map((item, index) => { return item.driverName; }).join(","); @@ -496,6 +535,9 @@ supercargoInfo = this.supercargoList.map((item, index) => { return item.driverName+ '|'+item.driverIdcard+"|"+item.driverPhone }).join(","); + highlyToxicImg= this.supercargoList.map((item, index) => { + return item.fileList[0].url.replace(BaseUrl,'') + }).join(",") if(this.tranSportForm.id){ this.$reqPut('putJcroadtransport',{ id:this.tranSportForm.id, @@ -512,7 +554,8 @@ userId:this.userInfo.userId, driverName:driverName, driverIdcard:driverIdcard, - supercargoInfo:supercargoInfo + supercargoInfo:supercargoInfo, + highlyToxicImg:highlyToxicImg }, 'json').then(res => { if (res.code == 0) { this.editTranShow = false; @@ -529,7 +572,8 @@ this.supercargoList=[{ driverName:"", driverIdcard:"", - driverPhone:"" + driverPhone:"", + fileList:[] }] this.fileList9=[] this.getData(); @@ -547,7 +591,8 @@ ...this.tranSportForm, driverName:driverName, driverIdcard:driverIdcard, - supercargoInfo:supercargoInfo + supercargoInfo:supercargoInfo, + highlyToxicImg:highlyToxicImg }, 'json').then(res => { if (res.code == 0) { this.editTranShow = false; @@ -564,7 +609,8 @@ this.supercargoList=[{ driverName:"", driverIdcard:"", - driverPhone:"" + driverPhone:"", + fileList:[] }] this.fileList9=[] this.getData(); @@ -579,6 +625,47 @@ } } }) + }, + async afterReads(event) { + // 褰撹缃� mutiple 涓� true 鏃�, file 涓烘暟缁勬牸寮忥紝鍚﹀垯涓哄璞℃牸寮� + let lists = [].concat(event.file); + let fileListLen = this.supercargoList[event.name].fileList.length; + lists.map(item => { + this.supercargoList[event.name].fileList.push({ + ...item, + status: 'uploading', + message: '涓婁紶涓�' + }); + }); + for (let i = 0; i < lists.length; i++) { + const result = await this.uploadFilePromises(lists[i].url, event.name); + let item = this.supercargoList[event.name].fileList[fileListLen]; + this.supercargoList[event.name].fileList.splice( + fileListLen, + 1, + Object.assign(item, { + status: 'success', + message: '涓婁紶鎴愬姛', + url: result + }) + ); + fileListLen++; + } + }, + uploadFilePromises(url, num) { + return new Promise((resolve, reject) => { + let a = uni.uploadFile({ + url: BaseUrl + '/admin/sys-file/uploadUnToken', + filePath: url, + name: 'file', + // formData: { + // user: 'test' + // }, + success: res => { + resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`); + } + }); + }); }, async afterRead(event) { // 褰撹缃� mutiple 涓� true 鏃�, file 涓烘暟缁勬牸寮忥紝鍚﹀垯涓哄璞℃牸寮� @@ -638,7 +725,8 @@ this.supercargoList.push({ driverName:"", driverIdcard:"", - driverPhone:"" + driverPhone:"", + fileList:[] }) }, addDriver(){ -- Gitblit v1.9.1