From 99a5ffe50a0441dbd09f9b9af027f8941f33b3ac Mon Sep 17 00:00:00 2001 From: qingyiay <2386314947@qq.com> Date: 星期二, 01 八月 2023 08:19:15 +0800 Subject: [PATCH] 称重增加异常功能 --- pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue | 212 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 181 insertions(+), 31 deletions(-) diff --git a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue index 2baa004..9f7d048 100644 --- a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue +++ b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue @@ -5,8 +5,8 @@ background-size: cover;"> <view class="top"> <view class="top_left"> - <text>{{ realTimeWeigh }}</text> - <!-- <text>{{ globalweigh }}</text> --> + <!-- <text>{{ realTimeWeigh }}</text> --> + <text>{{ globalweigh }}</text> </view> <view class="top_right"> <view class=""> @@ -183,7 +183,29 @@ class="jiajian" v-if="outBuy"></u-button> </view> - <!-- <view class="four" v-if="weighList.orderType !== '澶栬喘'">濡傛偍闇�瑕佽皟鏁磋杞借揣鍝佸惃鏁帮紝璇风偣鍑昏繑鍥炲姞鍑忓惃</view> --> + <view style="width: 200rpx;margin: auto;position: relative;" + v-if="historyBtn"><u-button type="primary" + text="鏄剧ず鍘嗗彶鐨噸" + @click.stop="displayHistory"></u-button></view> + <Transition name="slide-fade"> + <view class="history-skin" + v-if="historyShow"> + <view class="history-skin_item" + v-for="item in tmTaskCoalList"> + <view class="createTime"> + 鏃ユ湡:{{item.createTime.slice(0,10)}} + </view> + <view class="skin"> + <view class=""> + 鐨噸: + </view> + <view class=""> + {{item.skin}} + </view> + </view> + </view> + </view> + </Transition> <!-- 鏀剧┖寮圭獥 --> <view class="evacuationModal"> <u-modal :show="evacuationModalShow" @@ -192,6 +214,29 @@ :showCancelButton="true" @confirm="evacuationConfirm" @cancel="evacuationCancel"></u-modal> + </view> + <!-- 绉伴噸寮傚父寮圭獥 --> + <view class=""> + <u-modal :show="abnormalModalShow" + title="寮傚父鍘熷洜" + :showCancelButton="true" + @confirm="abnormalConfirm" + @cancel="abnormalCancel" + confirmText="鎻愪氦"> + <view class="slot-content"> + <u--form labelPosition="top"> + <u-form-item> + <u-textarea v-model="abnormalContent" + confirmType="done" + placeholder="璇疯緭鍏ュ紓甯稿師鍥�" + height='140' + count + border="surround" + autoHeight></u-textarea> + </u-form-item> + </u--form> + </view> + </u-modal> </view> </view> </template> @@ -271,39 +316,57 @@ isfocus1: false, isfocus2: false, // 澶栬喘绗竴娆$О姣涢噸涓嶉渶瑕佸姞鍑忓惃 - outBuy: true + outBuy: true, + // 鐨噸寮傚父鐩稿叧 + abnormalContent: '', + avgSkin: null, // 骞冲潎鐨噸 + tmTaskCoalList: [], + abnormalModalShow: false, + historyBtn: false, + historyShow: false }; }, watch: { realTimeWeigh(newV, oldV) { - if (this.weighList.orderType == '澶栭攢' || this.weighList.orderType == '鍐呴攢' || this.weighList.orderType == - '杞嚭') { - if (this.weighList.skin == 0) { - // this.temporaryWeighObj.skin = this.realTimeWeigh; - this.temporaryWeighObj.skin = newV; - } else { - // this.temporaryWeighObj.hair = this.realTimeWeigh; - this.temporaryWeighObj.hair = newV; - this.temporaryWeighObj.clean = (this.temporaryWeighObj.hair - this.weighList.skin).toFixed(2); - this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this.temporaryWeighObj - .clean < 0; - } - } else if (this.weighList.orderType == '澶栬喘' || this.weighList.orderType == '鍐呰喘' || this.weighList - .orderType == '杞叆') { - if (this.weighList.hair == 0) { - this.temporaryWeighObj.hair = newV; - } else { - this.temporaryWeighObj.skin = newV; - this.temporaryWeighObj.clean = (this.weighList.hair - this.temporaryWeighObj.skin).toFixed(2); - this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this.temporaryWeighObj - .clean < 0; - } - } + }, // 鐩戝惉閲嶉噺鍙樺寲 - globalweigh(newV) { - this.weighData.weigh = this.realTimeWeigh = newV; - console.log(this.realTimeWeigh, '鐪熷疄閲嶉噺鏀瑰彉浜�'); + globalweigh: { + deep: true, + handler: function(newV) { + this.weighData.weigh = this.realTimeWeigh = newV; + if (this.weighList.orderType == '澶栭攢' || this.weighList.orderType == '鍐呴攢' || this.weighList + .orderType == + '杞嚭') { + if (this.weighList.skin == 0) { + this.getAverageSkin() + this.temporaryWeighObj.skin = newV; + if (this.avgSkin < newV) { + this.abnormalModalShow = true + this.historyBtn = true + } + } else { + this.temporaryWeighObj.hair = newV; + this.temporaryWeighObj.clean = (this.temporaryWeighObj.hair - this.weighList.skin).toFixed( + 2); + this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this + .temporaryWeighObj + .clean < 0; + } + } else if (this.weighList.orderType == '澶栬喘' || this.weighList.orderType == '鍐呰喘' || this.weighList + .orderType == '杞叆') { + if (this.weighList.hair == 0) { + this.temporaryWeighObj.hair = newV; + } else { + this.temporaryWeighObj.skin = newV; + this.temporaryWeighObj.clean = (this.weighList.hair - this.temporaryWeighObj.skin).toFixed( + 2); + this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this + .temporaryWeighObj + .clean < 0; + } + } + } } }, onShow() { @@ -346,10 +409,14 @@ methods: { ...mapMutations(['changeweighHouseCode', 'changeisLogin']), init() { + uni.showLoading({ + title: "鍔犺浇涓�" + }) // 鑾峰彇绉伴噸淇℃伅 this.$reqGet('weighList', { id: this.takeCoalId }).then(res => { console.log(res, '鑾峰彇绉伴噸淇℃伅'); if (res.code == 0) { + uni.hideLoading() this.weighList = res.data; this.weighData.deptId = res.data.deptId; this.weighData.tmId = res.data.id; @@ -370,6 +437,9 @@ } else { this.isInputOrigin = true; } + } else { + uni.hideLoading() + this.$u.toast('鍔犺浇澶辫触') } }); }, @@ -478,6 +548,46 @@ if (this.weighData.coalContactHair > 0 && this.weighData.coalContactSkin > 0) { this.isInputOrigin = true; } + }, + getAverageSkin() { + uni.showLoading({ + title: "鍔犺浇涓�" + }) + this.$reqGet('getAvgSkin').then(res => { + if (res.code === 0) { + uni.hideLoading() + this.avgSkin = res.data.avgSkin + this.tmTaskCoalList = res.data.tmTaskCoalList + } else { + uni.hideLoading() + this.$u.toast('鍔犺浇澶辫触') + } + }) + }, + abnormalCancel() { + this.abnormalModalShow = false + }, + abnormalConfirm() { + uni.showLoading({ + title: "鎻愪氦涓�" + }) + this.$reqPost('tmAbnormalTextAdd', { tmId: this.weighData.tmId, abnormalText: this.abnormalContent }, + 'params').then( + res => { + if (res.code == 0) { + uni.hideLoading() + this.$u.toast('鎻愪氦鎴愬姛') + this.abnormalModalShow = false + } else { + uni.hideLoading() + this.$u.toast('鎻愪氦澶辫触') + this.abnormalModalShow = true + } + }) + }, + displayHistory() { + this.historyShow = true + } } }; @@ -493,9 +603,14 @@ ::v-deep.weighingDevice { width: 100%; - height: 100vh; + height: 100%; display: flex; flex-direction: column; + + .slot-content { + width: 96%; + border: 1rpx solid rgb(220, 223, 230); + } .one { // flex: 3; @@ -716,6 +831,41 @@ margin-top: vww(5); text-align: center; } + + .slide-fade-enter-active { + transition: all 0.3s ease-out; + } + + .history-skin { + width: 96%; + height: vww(300); + margin: vww(50) auto; + margin-top: vww(10); + background: #ffffff; + box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12); + border-radius: 20rpx; + overflow: scroll; + color: #000; + + + .history-skin_item { + width: 80%; + height: vww(30); + @include flex; + margin: vww(10) auto; + + .createTime { + color: rgb(60, 156, 255); + } + + .skin { + color: #f81414; + @include flex; + width: 180rpx; + height: vww(30); + } + } + } } .secondary-confirmation__main { -- Gitblit v1.9.1