From 21fb37c7162d5b47a14d6438870377c85fcc0b52 Mon Sep 17 00:00:00 2001 From: qingyiay <2386314947@qq.com> Date: 星期六, 07 十月 2023 10:23:21 +0800 Subject: [PATCH] 修改装卸员页面 调整websocket逻辑 --- pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue | 149 ++++++++++++++++++++++++++++++------------------- 1 files changed, 91 insertions(+), 58 deletions(-) diff --git a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue index 8a1686f..3661fb7 100644 --- a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue +++ b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue @@ -2,6 +2,9 @@ <view class="bill-of-lading-details"> <view class="top-banner" style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/loadingbanner.png') no-repeat;background-size: cover;"> + <u-notice-bar :text="originInfoNotice" + v-if="originInfoVisible" + fontSize='36'></u-notice-bar> <view class="top-information"> <view class="cutomer-name" v-if="orderType == '杞叆' || orderType == '杞嚭'">鐓ゅ満:{{ coalDetailsData.toFiledName || '' }}</view> @@ -22,7 +25,7 @@ <view class="status-button" style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/statusbutton.png') no-repeat; background-size: cover;"> - {{ coalStatus[coalDetailsData.status] || '' }} + {{coalStatus[correctStatus]}} </view> </view> <view class="time"> @@ -63,6 +66,7 @@ <view class="origin-info_content"> <view class="first-line"><combined-title title="鍘熷彂淇℃伅"></combined-title></view> <u-form :model="originInfoForm" + :rules="rules" label-position="top" label-width="160" :label-style="{'marginLeft':'9px'}" @@ -130,7 +134,7 @@ height="150" :previewFullImage="true" :disabled="isModifyoriginInfo" - :deletable='!deletable'></u-upload> + :deletable="!deletable"></u-upload> </u-form-item> </u-form> <view class="submit-button"> @@ -168,7 +172,7 @@ plain @click="rcsqClick" shape="circle" - :disabled="coalDetailsData.status === 3"></u-button> + :disabled="correctStatus>= 3"></u-button> </view> <view class="bottom-button"> <u-button text="鏀剧┖" @@ -241,7 +245,7 @@ </view> <!-- 纾呮埧蹇欑鎻愮ず寮圭獥 --> <view class=""> - <u-modal :show="wsgVisiable" + <u-modal :show="wsgShow" title="鎻愮ず" :content="wsgContent" @confirm="wsgContentConfirm"></u-modal> @@ -256,10 +260,13 @@ import combinedTitle from '@/components/combined-title/combined-title.vue'; import BigNumber from "bignumber.js" const dayjs = require('dayjs') - import isBetween from 'dayjs/plugin/isBetween' export default { components: { combinedTitle + }, + onPullDownRefresh() { + this.getTakeCoal(); //鑾峰彇鎻愮叅鍗曡鎯� + uni.stopPullDownRefresh(); }, onLoad(value) { this.orderPlanId = value.orderPlanId; @@ -270,15 +277,18 @@ this.getWeightHouseObj.overTmWaixiao = value.overTmWaixiao } this.fileList1 = [] - dayjs.extend(isBetween) + this.changeglobalIsFirstWeighing(1) if (this.globalIsFirstWeighing === 1) { + console.log('鑾峰彇璇︽儏 onload'); this.getTakeCoal(); //鑾峰彇鎻愮叅鍗曡鎯� } this.init(); //鑾峰彇鏃ュ織 + this.getgetService(); //鑾峰彇瀹㈡湇 }, onShow() { this.coalDayPage(); //鑾峰彇鏃ュ織 瀹氭椂浠诲姟 if (this.globalIsFirstWeighing === 2) { + console.log('鑾峰彇璇︽儏 onShow'); this.getTakeCoal(); //鑾峰彇鎻愮叅鍗曡鎯� } }, @@ -326,7 +336,7 @@ serviecePhone: '' }, coalStatus: ['棰嗗彇', '棰勭害', '绛惧埌', '鍏ュ満', '绉扮毊', '绉版瘺', '绂诲満', '鍏ョ鎴�', '鍑虹鎴�', '鍏ョ叅浠�', '鍑虹叅浠�', '鏀剧┖', '浣滃簾', '鍏ュ満鐢宠', - '杩涘叆鍦洪櫌', '寮傚父瀹℃牳涓�' + '杩涘叆鍦洪櫌', '寮傚父瀹℃牳涓�', '杩斿洖鍔犲噺鍚�', '瓒呮椂', '鎵撳嵃涓�', '鎵撳嵃涓�' ], // 鐘舵�� weighHouseCode: '', // 鏀剧┖寮圭獥鎺у埗鍙橀噺 @@ -381,29 +391,20 @@ originInfoVisible: false, fileList1: [], //鍥剧墖鍒楄〃 deletable: true, - rules: { - contactPicture: { - type: 'string', - required: true, - message: '璇蜂笂浼犲師鍙戠鍗曞浘鐗�', - trigger: ['blur', 'change'] - }, - coalContactHair: { - type: 'string', - required: true, - message: '璇疯緭鍏ユ瘺閲�', - trigger: ['blur', 'change'] - }, - coalContactSkin: { - type: 'string', - required: true, - message: '璇疯緭鍏ョ毊閲�', - trigger: ['blur', 'change'] - } - }, + rules: {}, timeout: '0', - + wsgShow: false, + timeLineStatus: null, + originInfoNotice: '濉啓鍘熷彂淇℃伅鍚庡彲涓婄璁¢噺' }; + }, + watch: { + '$store.state.wsgVisiable': { + deep: true, + handler: function(val) { + this.wsgShow = val + } + } }, computed: { ...mapState(['globalweigh', 'globalinfraredStatus', 'wsgVisiable', 'wsgContent', 'globalIsFirstWeighing']), @@ -428,7 +429,7 @@ return this.coalDetailsData.hair !== 0 || this.coalDetailsData.skin !== 0; }, isapproach() { - return this.currentPageCoalStatus !== 3; + return this.correctStatus !== 3 }, coalContactClean() { let xx = BigNumber(this.originInfoForm.coalContactHair ? this.originInfoForm.coalContactHair : 0) @@ -444,6 +445,10 @@ let minutes = ("0" + currentDate.getMinutes()).slice(-2); let formattedDate = year + "-" + month + "-" + date + " " + hours + ":" + minutes; return formattedDate + }, + correctStatus() { + return this.currentPageCoalStatus === this.timeLineStatus ? this.currentPageCoalStatus : this + .timeLineStatus } }, methods: { @@ -451,7 +456,7 @@ init() { this.$reqGet('coalDayPage', { id: this.orderPlanId, timeout: this.timeout }).then(res => { if (res.code == 0) { - // this.dayRZ = res.data; + this.timeLineStatus = res.data[0].taskStatus this.dayRZ = res.data.map(v => { let slicedate = v.taskStatusDes.slice(0, 10); if (slicedate == this.currentDate) { @@ -480,7 +485,7 @@ uni.setStorageSync('customeropenId', this.serviceInfoObj.openId); uni.setStorageSync('customerName', this.serviceInfoObj.openName); } - }); + }) }, // 鑾峰彇鎻愮叅鍗曡鎯� getTakeCoal() { @@ -517,24 +522,17 @@ this.primarySkin = this.coalDetailsData.skinTwo; this.primaryHair = this.coalDetailsData.hairTwo; this.primaryClean = this.coalDetailsData.cleanTwo; - // 鍒ゆ柇褰撳墠鏃堕棿鏄惁瓒呭嚭棰勭害鏃堕棿 - let endTime = this.coalDetailsData.yuYueSection.slice(0, 10) + ' ' + this.coalDetailsData - .yuYueSection.slice(-5); - if (dayjs(this.currentTime).isAfter(endTime) && this.coalDetailsData.status <= 1) { - this.$u.toast('宸茶秴鍑洪绾︽椂闂�,鍙偣鍑诲叆鍦虹敵璇烽噸鏂板叆鍦�') - this.timeout = '1' - } // 鍏ラ棬璇� 鍜� 鍑洪棬璇� 鏄惁鏄剧ず this.ablePrintInduction = this.coalDetailsData.hair || this.coalDetailsData.skin this.ablePrintOut = this.coalDetailsData.hair && this.coalDetailsData.skin || this .coalDetailsData.status === 6 // 鍘熷彂淇℃伅鍥炴樉浠ュ強鎺у埗鏄惁鍙慨鏀� - this.haveInputOrigin = !this.coalDetailsData.skinTwo && this.coalDetailsData.orderType === '澶栬喘' - this.deletable = this.isModifyoriginInfo = this.coalDetailsData.status > 3 + this.deletable = this.coalDetailsData.status > 3 this.originInfoForm.coalContactSkin = this.coalDetailsData.skinTwo; this.originInfoForm.coalContactHair = this.coalDetailsData.hairTwo; + this.originInfoForm.contactPicture = this.coalDetailsData.contactPicture if (this.coalDetailsData.contactPicture) { this.fileList1 = this.coalDetailsData.contactPicture.split(',').map(v => { return { @@ -565,7 +563,16 @@ } } }).then(() => { - this.getgetService(); //鑾峰彇瀹㈡湇 + // 鍒ゆ柇褰撳墠鏃堕棿鏄惁瓒呭嚭棰勭害鏃堕棿 + setTimeout(() => { + let endTime = this.coalDetailsData.yuYueSection.slice(0, 10) + ' ' + this + .coalDetailsData + .yuYueSection.slice(-5); + if (dayjs(this.currentTime).isAfter(endTime) && this.coalDetailsData.status <= 1) { + this.$u.toast('宸茶秴鍑洪绾︽椂闂�,鍙偣鍑诲叆鍦虹敵璇烽噸鏂板叆鍦�') + this.timeout = '1' + } + }, 1000) }) }, // 鏃ュ織鏌ヨ @@ -573,6 +580,7 @@ this.interval = setInterval(() => { this.$reqGet('coalDayPage', { id: this.orderPlanId, timeout: this.timeout }).then(res => { if (res.code == 0) { + this.timeLineStatus = res.data[0].taskStatus this.dayRZ = res.data.map(v => { let slicedate = v.taskStatusDes.slice(0, 10); if (slicedate == this.currentDate) { @@ -681,6 +689,13 @@ this.weighData.gateCameraId = res.data.lastEquipmentId; this.weighData.equipmentCode = res.data.lastEquipmentCode; this.weighData.sceneInOut = res.data.sceneInOut; + let form = { + sceneId: this.weighData.sceneId, + gateCameraId: this.weighData.gateCameraId, + equipmentCode: this.weighData.equipmentCode, + sceneInOut: this.weighData.sceneInOut, + } + uni.setStorageSync('WeighHouseForm', JSON.stringify(form)) this.weighHouseCode = res.data.code; uni.navigateTo({ url: `/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}&sceneId=${ @@ -737,24 +752,33 @@ title: '姝e湪鎵撳嵃涓�,璇风◢鍚�' }) this.enterLoading = true - this.$reqGet('printer', { type: 2, tmId: this.coalDetailsData.id }).then(res => { - uni.hideLoading() - this.enterLoading = false - console.log(res); - if (res.code === 0) { - this.$u.toast('鎵撳嵃鎴愬姛') - } else { - this.$u.toast(res.msg ? res.msg : '鎵撳嵃澶辫触') - } - }) + this.$reqGet('printer', { type: 2, tmId: this.coalDetailsData.id, weighingNumber: 1 }).then( + res => { + uni.hideLoading() + this.enterLoading = false + console.log(res); + if (res.code === 0) { + this.$u.toast('鎵撳嵃鎴愬姛') + } else { + this.$u.toast(res.msg ? res.msg : '鎵撳嵃澶辫触') + } + }) }, // 鎵撳嵃鍑洪棬璇� printExitPermit() { uni.showLoading({ title: '姝e湪鎵撳嵃涓�,璇风◢鍚�' }) + let form = { + deptId: this.getWeightHouseObj.deptId, + tmId: this.getWeightHouseObj.tmId, + carNo: uni.getStorageSync('carNo'), + type: 3, + weighingNumber: 2 + } this.outLoading = true - this.$reqGet('printer', { type: 3, tmId: this.coalDetailsData.id }).then(res => { + this.$reqPost('printer', Object.assign(form, JSON.parse(uni.getStorageSync('WeighHouseForm'))), + 'json').then(res => { uni.hideLoading() this.outLoading = false if (res.code === 0) { @@ -781,7 +805,8 @@ this.isfocus2 = false; }, inputChange() { - if (Number(this.originInfoForm.coalContactHair) > 0 && Number(this.originInfoForm.coalContactSkin > 0)) { + if (Number(this.originInfoForm.coalContactHair) > 0 && Number(this.originInfoForm.coalContactSkin > + 0)) { this.isInputOrigin = true; } }, @@ -823,7 +848,8 @@ name: 'file', success: res => { if (num == 1) { - this.originInfoForm.contactPicture = JSON.parse(res.data).data.url; + this.originInfoForm.contactPicture = JSON.parse(res.data) + .data.url; resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`); } } @@ -843,18 +869,25 @@ taskCoalCode: this.coalDetailsData.code, carNo: this.coalDetailsData.carNo, } - this.$refs.originInfoRef.validate().then(res => { + if (this.originInfoForm.coalContactSkin && this.originInfoForm.coalContactHair && this + .originInfoForm + .contactPicture) { this.$reqPost('appSaveContact', form, 'json').then(res => { if (res.code === 0) { this.$u.toast('鎻愪氦鎴愬姛') - this.getTakeCoal() } else { + this.isModifyoriginInfo = true this.$u.toast(res.msg ? res.msg : '鎻愪氦澶辫触') + } + }).then(() => { + setTimeout(() => { + this.getTakeCoal() + }, 1000) }) - }).catch(errors => { + } else { uni.$u.toast('璇峰~鍐欏畬鏁村師鍙戜俊鎭�') - }) + } } } }; -- Gitblit v1.9.1