From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- pages/product/outputRegister/editProductOut.vue | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 270 insertions(+), 0 deletions(-) diff --git a/pages/product/outputRegister/editProductOut.vue b/pages/product/outputRegister/editProductOut.vue new file mode 100644 index 0000000..28061c0 --- /dev/null +++ b/pages/product/outputRegister/editProductOut.vue @@ -0,0 +1,270 @@ +<template> + <view class="wrap"> + <view> + <scroll-view class="scroll-list edit-product-out-scroll" scroll-y="true"> + <u-cell-group class="list" :border="false"> + <u-card :title="item.username" :sub-title="item.phone" v-for="(item, index) in editProductOutList" + :key="item.id" :index="item.id" :showHead="showEditCardHead"> + <view slot="body"> + <view class="row-list"> + <u-row justify="space-between"> + <u-col span="4"> + <span class="span-lable">SN鍙�</span> + </u-col> + <u-col span="8"> + <view> + <span>{{item.outBatchNo}}</span> + </view> + </u-col> + </u-row> + </view> + <view class="row-list"> + <u-row justify="space-between"> + <u-col span="4"> + <span class="span-lable">IFS鎵规鍙�</span> + </u-col> + <u-col span="8"> + <view> + <u-input class="custom-edit-input" v-model="item.ifsBatchNo" type="text" + :clearable=false height="50"></u-input> + </view> + </u-col> + </u-row> + </view> + <view class="row-list"> + <u-row justify="space-between"> + <u-col span="4"> + <span class="span-lable">璧峰绫虫爣</span> + </u-col> + <u-col span="8"> + <view> + <u-input class="custom-edit-input" v-model="item.startMeterMark" type="digit" + :clearable=false height="50" @blur="startMeterBlur(item)"></u-input> + </view> + </u-col> + </u-row> + </view> + <view class="row-list"> + <u-row justify="space-between"> + <u-col span="4"> + <span class="span-lable">鎴绫虫爣</span> + </u-col> + <u-col span="8"> + <view> + <u-input class="custom-edit-input" v-model="item.endMeterMark" + :clearable=false height="50" type="digit" @blur="endMeterBlur(item)"></u-input> + </view> + </u-col> + </u-row> + </view> + <view class="row-list"> + <u-row justify="space-between"> + <u-col span="4"> + <span class="span-lable">鐢熶骇鏁伴噺</span> + </u-col> + <u-col span="8"> + <view> + <span>{{item.productQty}}</span> + </view> + </u-col> + </u-row> + </view> + <view class="row-list"> + <u-row justify="space-between"> + <u-col span="4"> + <span class="span-lable">鎶ュ簾鏁伴噺</span> + </u-col> + <u-col span="8"> + <view> + <u-input class="custom-edit-input" v-model="item.scrapQty" + :clearable=false height="50" type="digit"></u-input> + </view> + </u-col> + </u-row> + </view> + <view class="row-list"> + <u-row justify="space-between"> + <u-col span="4"> + <span class="span-lable">鍒嗘鎻忚堪</span> + </u-col> + <u-col span="8"> + <view> + <u-input class="custom-edit-input" v-model="item.segmentDesc" type="text" + :clearable=false height="50"></u-input> + </view> + </u-col> + </u-row> + </view> + </view> + </u-card> + </u-cell-group> + </scroll-view> + </view> + <view class="edit-product-out-btn-view"> + <u-button text="纭畾" type="success" size="medium" :customStyle="{width:'150rpx'}" @click="updateProductOut"> + 纭畾</u-button> + </view> + </view> +</template> +<script> + export default { + data() { + return { + editProductOutList:[], + showEditCardHead: false + }; + }, + onLoad(params) { + if (params.item) { + let list = JSON.parse(decodeURIComponent(params.item)); + this.editProductOutList =list + } + }, + onShow() { + + }, + methods: { + startMeterBlur(item) + { + if(item.endMeterMark!="") + { + let qty= parseFloat(item.endMeterMark) - parseFloat(item.startMeterMark) + qty = parseFloat(qty.toFixed(4)) + this.$set(item, 'productQty', qty); + } + }, + endMeterBlur(item ) + { + if(item.startMeterMark!="") + { + let qty= parseFloat(item.endMeterMark) - parseFloat(item.startMeterMark) + qty = parseFloat(qty.toFixed(4)) + this.$set(item, 'productQty', qty); + } + }, + async updateProductOut() { + + for (let i = 0; i < this.editProductOutList.length; i++) { + + // 璧峰绫虫爣鏍¢獙 + if (!this.isNumber(this.editProductOutList[i].startMeterMark)) { + this.$u.toast('绗�' + (i + 1) + '琛岋紝銆愯捣濮嬬背鏍囥�戣杈撳叆闈炶礋鏁帮紝灏忔暟浣嶆渶澶�4浣嶏紒') + return + } + // 鎴绫虫爣鏍¢獙 + if (!this.isNumber(this.editProductOutList[i].endMeterMark)) { + this.$u.toast('绗�' + (i + 1) + '琛岋紝銆愭埅姝㈢背鏍囥�戣杈撳叆闈炶礋鏁帮紝灏忔暟浣嶆渶澶�4浣嶏紒') + return + } + // 鎴绫虫爣闇�澶т簬寮�濮嬬背鏍� + if ( + Number(this.editProductOutList[i].endMeterMark) < + Number(this.editProductOutList[i].startMeterMark) + ) { + this.$u.toast('绗�' + (i + 1) + '琛岋紝銆愭埅姝㈢背鏍囥�戦渶澶т簬銆愯捣濮嬬背鏍囥��') + return + } + } + + let data=[] + this.editProductOutList.forEach((el) => { + let productVo = {} + productVo.id = el.id + let productOuts = [] + let productOut = {} + productOut.startMeterMark = parseFloat(el.startMeterMark) + productOut.endMeterMark = parseFloat(el.endMeterMark) + productOut.productQty = el.productQty + productOut.segmentDesc = el.segmentDesc + productOut.scrapQty = el.scrapQty + productOut.ifsBatchNo = el.ifsBatchNo + productOut.reelNumber = el.reelNumber + productOut.remark = el.remark + productOuts.push(productOut) + productVo.productOutputList = productOuts + data.push(productVo) + }) + + let res= await this.$u.api.outputRegister.batchUpdateProductMain(data) + let that = this + if(res.code==0) + { + uni.showModal({ + title: '鎻愮ず', + content: '缂栬緫鎴愬姛', + showCancel: false, + success: function() { + that.refreshLastPage() + // setTimeout(()=> { + // that.refreshLastPage() + // }, 5500); + } + }) + + }else + { + uni.showModal({ + title: '鎻愮ず', + content: '缂栬緫澶辫触', + showCancel: false, + success: function() { + } + }) + } + }, + isNumber(value) { + var reg = /^[0-9]+(.[0-9]{1,4})?$/ + if ( + value == undefined || + value == null || + value === '' || + value.trim === '' + ) { + return false + } else { + if (!reg.test(value)) { + return false + } else { + return true + } + } + }, + //鍒锋柊涓婁竴涓〉闈� + refreshLastPage() { + // 鍛婄煡 A.vue 鏇存柊鏁版嵁 + // 鑾峰彇椤甸潰鏍� + let pages = getCurrentPages() + + // 鑾峰彇涓婁竴椤垫爤 + let prevPage = pages[pages.length - 2] + + // 瑙﹀彂涓婁竴椤� upData 鍑芥暟(骞舵惡甯﹀弬鏁�) + prevPage.$vm.refreshTrackingRecord() + + // 杩斿洖涓婁竴椤� + uni.navigateBack({ + delta: 1 + }) + }, + } + }; +</script> +<style lang="scss"> + .edit-product-out-scroll{ + background-color: #f8f8f8; + } + .edit-product-out-scroll{ + ::v-deep .u-cell-item-box{ + background-color: #f8f8f8; + } + } + .edit-product-out-btn-view{ + display: flex; + justify-content: space-between; + margin-top: 20rpx; + } + .custom-edit-input{ + border-bottom: 2rpx solid #F8F8F8; + } + +</style> -- Gitblit v1.9.3