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/produce/createReportWork.vue | 664 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 664 insertions(+), 0 deletions(-) diff --git a/pages/product/produce/createReportWork.vue b/pages/product/produce/createReportWork.vue new file mode 100644 index 0000000..06ce357 --- /dev/null +++ b/pages/product/produce/createReportWork.vue @@ -0,0 +1,664 @@ +<template> + <view class="page"> + <view class="production-index-bg" /> + <u-navbar title="浜у嚭" :background="background" :border-bottom="false" :title-bold="true" title-color="#000" + back-icon-color="#000" /> + <view class="wrap"> + <view class="content"> + <view class="content-body"> + <view class="content-body-item param-extra" v-if="info.type!='group'"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">鐢熶骇浜哄憳锛�</text> + </view> + <view class="content-body-item-right"> + <wu-button shape="circle" size="small" type="primary" @click="toDutyPerson"> + 鐐瑰嚮閫夋嫨 + </wu-button> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">闆朵欢缂栧彿锛�</text> + </view> + <view class="content-body-item-right"> + <text class="_text">{{ info.partNo }}</text> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">闆朵欢鍚嶇О锛�</text> + </view> + <view class="content-body-item-right"> + <text class="_text">{{ info.partName }}</text> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">SN鍙凤細</text> + </view> + <view class="content-body-item-right"> + <text class="_text">{{ info.outBatchNo }}</text> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">杞藉叿缂栧彿锛�</text> + </view> + <view class="content-body-item-right"> + <input class="_text u-input" v-model="info.reelNumber" placeholder="璇峰~鍐�" /> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">浜у嚭濂楁暟锛�</text> + </view> + <view class="content-body-item-right"> + <input class="_text" type="number" v-model="info.disNumber" placeholder-style="color:#F76260" placeholder="璇峰~鍐�(蹇呭~)" /> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">姣忓浜ч噺锛�</text> + </view> + <view class="content-body-item-right"> + <text class="_text">{{ info.productQty }}</text> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">璧峰鏁伴噺锛�</text> + </view> + <view class="content-body-item-right"> + <input class="_text" type="number" v-model="info.startMeterMark" placeholder-style="color:#F76260" placeholder="璇峰~鍐�(蹇呭~)" @blur="startMeterBlur" /> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">鎴鏁伴噺锛�</text> + </view> + <view class="content-body-item-right"> + <input class="_text" type="number" v-model="info.endMeterMark" placeholder-style="color:#F76260" placeholder="璇峰~鍐�(蹇呭~)" @blur="endMeterBlur" /> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">璁¢噺鍗曚綅锛�</text> + </view> + <view class="content-body-item-right"> + <text class="_text">{{info.unit}}</text> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">鐢熶骇璇存槑锛�</text> + </view> + <view class="content-body-item-right"> + <input class="_text" v-model="info.segmentDesc" placeholder="璇峰~鍐�" /> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">鎶ュ簾鏁伴噺锛�</text> + </view> + <view class="content-body-item-right"> + <input class="_text" v-model="info.scrapQty" placeholder="璇峰~鍐�" /> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">杞藉叿閲嶉噺锛�</text> + </view> + <view class="content-body-item-right"> + <input class="_text" v-model="info.reelWeight" placeholder="璇峰~鍐�" /> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">浜у嚭姣涢噸锛�</text> + </view> + <view class="content-body-item-right"> + <input class="_text" v-model="info.grossWeight" placeholder="璇峰~鍐�" /> + </view> + </view> + <view class="content-body-item param-extra"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">鐢熶骇浜哄憳锛�</text> + </view> + <view class="content-body-item-right"> + <text class="_text">{{ info.staffName }}</text> + </view> + </view> + <view class="content-body-item"> + <view class="content-body-item-left"> + <text class="slot-box slot-text">澶囨敞璇存槑锛�</text> + </view> + <view class="content-body-item-right"> + <input class="_text" v-model="info.mainRemark" placeholder="璇峰~鍐�" /> + </view> + </view> + </view> + <view class="bottom"> + <view class="bottom-btn"> + <wu-button :custom-style="customStyleOne" size="normal" @click="onCancel"> + 鍙栨秷 + </wu-button> + </view> + <view class="bottom-btn"> + <wu-button :custom-style="customStyleTwo" size="normal" @click="onSubmit"> + 纭畾 + </wu-button> + </view> + </view> + <!-- </form> --> + </view> + </view> + </view> +</template> +<script> + import content_bg from '@/static/custom/product/productBg.png' + + export default { + components: {}, + computed: { + customStyleOne() { + return { + color: '#666666', + background: '#FFFFFF', + width: '350rpx' + } + }, + customStyleTwo() { + return { + color: '#FFFFFF', + background: '#234EED', + width: '350rpx' + } + }, + }, + data() { + return { + background: { + backgroundImage: `url(${content_bg})`, + backgroundAttachment: 'fixed', + backgroundSize: '100% auto', + backgroundRepeat: 'no-repeat', + }, + info: { + partId: null, + partNo: null, + partName: null, + outBatchNo: null, + reelNumber: null, + disNumber: 1, + productQty: null, + startMeterMark: 0, + endMeterMark: null, + unit: null, + segmentDesc: null, + scrapQty: null, + reelWeight: null, + grossWeight: null, + staffName: null, + mainRemark: null, + productStaffIds: [], + productStaffs: [], + workstationId: null, + operationTaskId: null, + dutyRecordId: null, + }, + dutyForm: [], + personInitList: [], + personBoardList: [], + products: [], + }; + }, + onLoad(option) { + if (option.params) { + const params = JSON.parse(decodeURIComponent(option.params)); + this.info.partId = params.partId; + this.info.partNo = params.partNo; + this.info.partName = params.partName; + this.info.unit = params.unit; + this.info.workstationId = params.workstationId; + this.info.operationTaskId = params.operationTaskId; + this.info.dutyRecordId = params.dutyRecordId; + this.info.type = params.type; + + //鑾峰彇褰撶彮浜哄憳 + this.getPerson() + } + }, + onShow() { + + }, + methods: { + onCancel() { + // 杩斿洖涓婁竴椤� + uni.navigateBack({ + delta: 1 + }) + }, + async getPerson() { + let queryParam = { + id: this.info.workstationId + } + + let queryUserParam = { + id: this.info.dutyRecordId + } + + let resUser = await this.$u.api.outputRegister.getPersonByDutyRecordId(queryUserParam) + + let userList = resUser.data + if (userList.length > 0) { + this.personInitList = [] + this.$set(this.info, 'staffName', ""); + let staffName = "" + userList.map((item, index) => { + + if (index == userList.length - 1) { + staffName = staffName + item.staffName + } else { + staffName = staffName + item.staffName + "," + } + + let data = { + staffId: item.staffId, + staffName: item.staffName, + staffNo: item.staffNo, + checked: false + } + + this.personInitList.push(data) + }); + + //type:shift 鎸夌彮缁� person 鎸変汉鍛� + if (this.info.type == "group") { + this.personBoardList = this.personInitList + this.$set(this.info, 'staffName', staffName); + } else { + this.personBoardList = [] + this.$set(this.info, 'staffName', ""); + } + } + }, + setProducts() { + let productStaffs = [] + let productStaffIds = [] + let newProduct = {} + this.products = [] + //type:group 鎸夌彮缁� person 鎸変汉鍛� + if (this.info.type == "group") { + // 鎸夌彮缁勬姤宸ワ紝涓�鏉¤褰� + let staffName = '' + let staffNo = '' + for (let i = 0; i < this.personBoardList.length; i++) { + staffName += this.personBoardList[i].staffName + ',' + staffNo += this.personBoardList[i].staffNo + ',' + productStaffs.push(this.personBoardList[i].staffNo) + productStaffIds.push(this.personBoardList[i].staffId) + } + + staffName = staffName.substring(0, staffName.length - 1) + staffNo = staffNo.substring(0, staffNo.length - 1) + + newProduct = {} + newProduct.staffName = staffName + newProduct.staffNo = staffNo + newProduct.productNo = null + newProduct.partId = this.info.partId + newProduct.partNo = this.info.partNo + newProduct.partName = this.info.partName + newProduct.outBatchNo = null + newProduct.disNumber = this.info.disNumber + newProduct.productQty = 0 + newProduct.sproductQty = 0 + newProduct.ifsBatchNo = null + newProduct.unit = this.info.unit + newProduct.productStaffs = productStaffs + newProduct.productStaffIds = productStaffIds + newProduct.status = false + newProduct.systemNo = null + newProduct.date = this.info.date + newProduct.dutyRecordId = this.info.dutyRecordId + newProduct.startMeterMark = this.info.startMeterMark + newProduct.endMeterMark = this.info.endMeterMark + newProduct.scrapQty = this.info.scrapQty + newProduct.segmentDesc = this.info.segmentDesc + newProduct.remark = null + newProduct.outBatchNo = null + newProduct.reelNumber = this.info.reelNumber + this.products.push(newProduct) + + } else { + let newProduct + for (let i = 0; i < this.personBoardList.length; i++) { + newProduct = {} + productStaffs = [] + productStaffIds = [] + productStaffIds.push(this.personBoardList[i].staffId) + productStaffs.push(this.personBoardList[i].staffNo) + newProduct.staffName = this.personBoardList[i].staffName + newProduct.staffNo = this.personBoardList[i].staffNo + newProduct.productNo = null + newProduct.partId = this.info.partId + newProduct.partNo = this.info.partNo + newProduct.partName = this.info.partName + newProduct.outBatchNo = null + newProduct.disNumber = this.info.disNumber + newProduct.productQty = 0 + newProduct.sproductQty = 0 + newProduct.unit = this.info.unit + newProduct.productStaffs = productStaffs + newProduct.productStaffIds = productStaffIds + newProduct.status = true + newProduct.systemNo = null + newProduct.date = this.info.date + newProduct.dutyRecordId = this.info.dutyRecordId + newProduct.startMeterMark = this.info.startMeterMark + newProduct.endMeterMark = this.info.endMeterMark + newProduct.reelNumber = this.info.reelNumber + newProduct.ifsBatchNo = null + newProduct.scrapQty = this.info.scrapQty + newProduct.segmentDesc = this.info.segmentDesc + newProduct.remark = null + this.products.push(newProduct) + } + } + }, + async onSubmit() { + + // 鐢熶骇浜哄憳 + if (this.info.staffName==""||this.info.staffName==undefined||this.info.staffName==null) { + + this.$u.toast('鐢熶骇浜哄憳涓嶈兘涓虹┖') + return + } + + //璁剧疆宸ュ崟淇℃伅 + this.setProducts(); + + for (let i = 0; i < this.products.length; i++) { + + // 鐩樻暟鏍¢獙 + if (!this.isPositiveIntegerNumber(this.products[i].disNumber)) { + + this.$u.toast('绗�' + (i + 1) + '琛岋紝銆愮洏鏁般�戣杈撳叆姝f暣鏁帮紒') + return + } + // 璧峰绫虫爣鏍¢獙 + if (!this.isNumber(this.products[i].startMeterMark)) { + this.$u.toast('绗�' + (i + 1) + '琛岋紝銆愯捣濮嬬背鏍囥�戣杈撳叆闈炶礋鏁帮紝灏忔暟浣嶆渶澶�4浣嶏紒') + return + } + // 鎴绫虫爣鏍¢獙 + if (!this.isNumber(this.products[i].endMeterMark)) { + this.$u.toast('绗�' + (i + 1) + '琛岋紝銆愭埅姝㈢背鏍囥�戣杈撳叆闈炶礋鏁帮紝灏忔暟浣嶆渶澶�4浣嶏紒') + return + } + // 鎴绫虫爣闇�澶т簬寮�濮嬬背鏍� + if ( + Number(this.products[i].endMeterMark) < + Number(this.products[i].startMeterMark) + ) { + this.$u.toast('绗�' + (i + 1) + '琛岋紝銆愭埅姝㈢背鏍囥�戦渶澶т簬銆愯捣濮嬬背鏍囥��') + return + } + } + + // 褰撳墠鏄骇鍑虹殑鏂板 + const list = [] + for (let i = 0; i < this.products.length; i++) { + let productVo = {} + productVo.isChangeShift = false + productVo.id = null + productVo.workstationId = this.info.workstationId + productVo.operationTaskId = this.info.operationTaskId + productVo.discsNumber = this.products[i].disNumber + let productOuts = [] + let productOut = {} + productOut.workstationId = this.info.workstationId + productOut.operationTaskId = this.info.operationTaskId + productOut.partId = this.products[i].partId + productOut.disNumber = this.products[i].disNumber + productOut.productQty = this.products[i].productQty + productOut.sproductQty = this.products[i].sproductQty + productOut.productStaffs = this.products[i].productStaffs + productOut.productStaffIds = this.products[i].productStaffIds + productOut.outBatchNo = this.products[i].outBatchNo + productOut.status = this.products[i].status + productOut.dutyRecordId = this.products[i].dutyRecordId + productOut.startMeterMark = this.products[i].startMeterMark + productOut.endMeterMark = this.products[i].endMeterMark + + productOut.outBatchNo = this.products[i].outBatchNo + productOut.reelNumber = this.products[i].reelNumber + productOut.ifsBatchNo = this.products[i].ifsBatchNo + productOut.scrapQty = this.products[i].scrapQty + productOut.segmentDesc = this.products[i].segmentDesc + productOut.remark = this.products[i].remark + + productOuts.push(productOut) + productVo.productOutputList = productOuts + list.push(productVo) + } + + let res = await this.$u.api.outputRegister.batchSaveProductMain(list) + let that = this + + if (res.code == 0) { + uni.showModal({ + title: '鎻愮ず', + content: '鎻愪氦鎴愬姛', + showCancel: false, + success: function() { + that.refreshLastPage() + } + }) + + } 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 + } + } + }, + isPositiveIntegerNumber(value) { + var reg = /^[1-9]\d*$/ + if ( + value == undefined || + value == null || + value === '' || + value.trim === '' + ) { + return false + } else { + if (!reg.test(value)) { + return false + } else { + return true + } + } + }, + startMeterBlur(obj) { + if ((this.info.startMeterMark != "" ) && (this.info.endMeterMark!= "")) { + let qty = parseFloat(this.info.endMeterMark) - parseFloat(this.info.startMeterMark) + qty = parseFloat(qty.toFixed(4)) + this.$set(this.info, 'productQty', qty); + } + }, + endMeterBlur(obj) { + if ((this.info.startMeterMark != "" ) && (this.info.endMeterMark!= "")) { + let qty = parseFloat(this.info.endMeterMark) - parseFloat(this.info.startMeterMark) + qty = parseFloat(qty.toFixed(4)) + this.$set(this.info, 'productQty', qty); + } + }, + toDutyPerson() { + if (this.personInitList.length > 0) { + uni.navigateTo({ + url: '/pages/product/outputRegister/dutyPersonList?item=' + encodeURIComponent(JSON + .stringify(this.personInitList)) + }) + } + }, + setProductPerson(userList) { + //type:group 鎸夌彮缁� person 鎸変汉鍛� + if (this.info.type == "person") { + //杩囨护鎺夐�変腑鐨勪汉鍛樹俊鎭� + userList = userList.filter(item => item.checked == true) + this.personBoardList = [] + this.$set(this.info, 'staffName', ""); + // this.personBoardList = userList + if (userList.length > 0) { + let staffName = "" + userList.map((item, index) => { + + if (index == userList.length - 1) { + staffName = staffName + item.staffName + } else { + staffName = staffName + item.staffName + "," + } + + let data = { + staffId: item.staffId, + staffName: item.staffName, + staffNo: item.staffNo, + checked: item.checked + } + + this.personBoardList.push(data) + }); + this.$set(this.info, 'staffName', staffName); + } + } + }, + //鍒锋柊涓婁竴涓〉闈� + refreshLastPage() { + // 鍛婄煡 A.vue 鏇存柊鏁版嵁 + // 鑾峰彇椤甸潰鏍� + let pages = getCurrentPages() + + // 鑾峰彇涓婁竴椤垫爤 + let prevPage = pages[pages.length - 2] + + // 瑙﹀彂涓婁竴椤� upData 鍑芥暟(骞舵惡甯﹀弬鏁�) + prevPage.$vm.refreshTrackingRecord() + + // 杩斿洖涓婁竴椤� + uni.navigateBack({ + delta: 1 + }) + } + } + }; +</script> +<style lang="scss" scoped> + .production-index-bg { + background-color: #F6F9FF; + background-image: url('~@/static/custom/product/productBg.png'); + // background: linear-gradient(180deg,rgba(206,227,254,1),rgba(206,227,254,1) 20%,rgba(206,227,254,0.5) 40%,rgba(206,227,254,0.25) 60%,rgba(206,227,254,0.08) 80%,rgba(206,227,254,0)); + padding: 0 20rpx; + background-attachment: fixed; + background-size: 100% auto; + background-repeat: no-repeat; + position: fixed; + top: 0; + bottom: 0; + width: 100%; + z-index: -1; + } + + .content { + font-size: 12px; + background-color: rgba(250, 252, 255, 0.36); + box-sizing: border-box; + border-radius: 10rpx; + margin: 0rpx 0rpx 24rpx; + height: calc(100vh - var(--window-top) - var(--window-bottom) - 334rpx); + padding: 10rpx 20rpx; + box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(127, 127, 127, 0.1) !important; + position: relative; + + .content-body { + margin-top: 20rpx; + background-color: white; + // height: 1030rpx; + + .content-body-title { + font-size: 35rpx; + font-weight: bolder; + color: #1D2541; + } + + .content-body-item { + // height: 90rpx; + border: 1px solid #ADC8E4; + line-height: 100rpx; + display: flex; + justify-content: space-between; + border: none; + margin: 0rpx 40rpx; + align-items: center; + + .content-body-item-left { + line-height: 100rpx; + + + .slot-box { + font-size: 32rpx; + } + } + + .content-body-item-right { + width: 400rpx; + line-height: 30rpx; + text-align: right; + ._text { + font-size: 26rpx; + } + } + } + + .param-extra { + border-bottom: 1px solid #D5D5D5; + } + } + + .content-footer { + margin-top: 30rpx; + display: flex; + justify-content: flex-end; + + .footer-button { + margin-right: 35rpx; + } + } + + .bottom { + display: flex; + justify-content: space-between; + height: 100rpx; + margin-top: 30rpx; + } + } +</style> \ No newline at end of file -- Gitblit v1.9.3