From 46b0b4d41a260e44e5e648d79cac60e97fe17789 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期三, 13 九月 2023 14:45:59 +0800
Subject: [PATCH] 小程序
---
minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue | 573 ++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 484 insertions(+), 89 deletions(-)
diff --git a/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue b/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue
index 192b5f4..1cbbb33 100644
--- a/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue
+++ b/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue
@@ -125,7 +125,7 @@
<image src="../../../static/ic_ar@2x.png" class="img_ar" mode=""></image>
</div>
</div>
- <div class="bg_list_item" v-if="arrType && arrType.length > 0">
+ <div class="bg_list_item" v-if="form.duration && arrType && arrType.length > 0">
<div class="bg_list_item_top">
<div class="bg_list_item_top_left">
<div class="bg_list_item_top_left_x bg_m"></div>
@@ -189,7 +189,7 @@
</div>
</div>
<!-- v-if="info.status === 2 || info.procedureNeedcheck === 1" -->
- <template>
+ <template v-if="info.status === 2 || info.procedureNeedcheck === 1">
<div class="bh_zw"></div>
<div class="bg_footer bg_f7">
<div class="bg_footer_submit bg_m" v-if="typeView == 0" @click="submit">纭鎶ュ伐</div>
@@ -223,6 +223,39 @@
</view>
</view>
</u-popup>
+ <u-popup :show="statistics" @close="statistics=false" :round="8" closeable zIndex="20000">
+ <div class="tg">
+ <div class="tg_header">璇风‘璁ゆ姤宸ヤ俊鎭�</div>
+ <div class="tg_table">
+ <div class="tg_table_header">
+ <div class="tg_table_header_item">绫诲瀷</div>
+ <div class="tg_table_header_item">鐗╂枡鍚嶇О</div>
+ <!-- <div class="tg_table_header_item">宸ヨ鏁伴噺</div> -->
+ <div class="tg_table_header_item">鐗╂枡鏁伴噺</div>
+ </div>
+ <div class="nr" v-if="statisticsData.length > 0">
+ <div class="tg_table_nr" v-for="(item, index) in statisticsData" :key="index">
+ <div class="tg_table_nr_item">{{ item.name }}</div>
+ <div class="tg_table_nr_item">{{ item.materialName }}</div>
+ <!-- <div class="tg_table_nr_item">{{item.gznum}}</div> -->
+ <div class="tg_table_nr_item" :style="item.name === '宸ュ崟鏈姇鏂�' ? 'color: #DE5243' : ''">
+ {{ item.num }}
+ </div>
+ </div>
+ </div>
+ <div class="nr" v-else>
+ <div class="tg_table_nr">
+ <div class="tg_table_nr_item1">鏆傛棤鏁版嵁</div>
+ </div>
+ </div>
+ </div>
+ <div class="tg_footer">
+ <!-- proxy.$auth('h5:workorderoutput:confirm') && -->
+ <button class="tg_footer_qr" @click="submitBG" v-if="isSubmit">纭鎶ュ伐</button>
+ <div class="tg_footer_fh" @click="gofh" v-else-if="!isSubmit">杩斿洖淇敼</div>
+ </div>
+ </div>
+ </u-popup>
</view>
</template>
@@ -247,8 +280,10 @@
categoryExtList,
queryOne,
queryList
- } from '@/util/api/PlanningAPI'
- import { REGULAR } from '@/util/utils'
+ } from '@/util/api/PlanningAPI'
+ import {
+ REGULAR
+ } from '@/util/utils'
export default {
components: {
workOrderInfo
@@ -291,7 +326,7 @@
undesirableId: '',
undesirable: '' // 涓嶈壇
},
- triggered: false,
+ triggered: false,
finished: true,
djData: [],
cateList: [],
@@ -299,19 +334,25 @@
capacity: 10,
page: 1,
total: 0
- }
+ },
+ statisticsData: [],
+ isSubmit: false,
+ statistics: false
};
},
onLoad(obj) {
this.workorderId = obj.id
this.queryByIds()
this.getOrocessRecords()
- this.getData()
- uni.$on('spotAdd', () => {
- if (this.typeView == 1) {
- this.pages.page = 1
- this.pageDJs()
- }
+ this.getData()
+ uni.$on('spotAdd', () => {
+ if (this.typeView == 1) {
+ this.pages.page = 1
+ this.pageDJs()
+ }
+ })
+ uni.$on('addMaterial', () => {
+ this.getOrocessRecords()
})
},
computed: {
@@ -410,7 +451,7 @@
},
clickIten(index) {
this.typeView = index
- if (this.typeView == 1) {
+ if (this.typeView == 1) {
this.pages.page = 1
this.pageDJs()
}
@@ -439,46 +480,39 @@
if (unitAttribute == 0 && num != '') {
if (!REGULAR.positiveInteger.test(num)) {
obj.num = obj.ynum
- Toast({
- message: '鍙兘杈撳叆姝f暣鏁�'
- })
+ uni.$u.toast('鍙兘杈撳叆姝f暣鏁�')
return
}
}
if (unitAttribute == 1 && num != '') {
if (!REGULAR.number.test(num)) {
- Toast({
- message: '鍙兘杈撳叆姝f暣鏁版垨灏忔暟锛堟渶澶氬洓浣嶏級'
- })
+ uni.$u.toast('鍙兘杈撳叆姝f暣鏁版垨灏忔暟锛堟渶澶氬洓浣嶏級')
obj.num = obj.ynum
return
}
}
if (num > maxNum) {
obj.num = obj.ynum
- Toast.fail({
- message: '瓒呭嚭宸ヨ鎬绘暟'
- })
+ uni.$u.toast('瓒呭嚭宸ヨ鎬绘暟')
return
}
} else if (type === 'C' && num > info.value.planNum) {
obj.num = obj.ynum
- Toast.fail({
- message: '浜у嚭鏁伴噺涓嶈兘瓒呰繃璁″垝鏁伴噺'
- })
+ uni.$u.toast('浜у嚭鏁伴噺涓嶈兘瓒呰繃璁″垝鏁伴噺')
return
}
- // updateById({ id, num }).then(res => {
- // if (res.code === 200 && type === 'T') {
- // getOrocessRecords()
- // } else if (res.code === 200 && type === 'C') {
- // // getOrocessRecordCC()
- // }
- // })
+ updateById({
+ id,
+ num
+ })
+ .then(res => {
+ if (res.code === 200 && type === 'T') {
+ this.getOrocessRecords()
+ }
+ })
},
changeCC(downType, num, recordId) {
if (!num) return
- console.log(Number(this.produceFrom.qualified) + Number(this.produceFrom.undesirable))
if ((Number(this.produceFrom.qualified) + Number(this.produceFrom.undesirable)) > this.info.planNum) {
uni.showToast({
title: '浜у嚭鏁伴噺涓嶈兘澶т簬璁″垝鏁伴噺',
@@ -514,67 +548,291 @@
this.form.index = index
this.form.type = item.type
},
- submit() {
- let createUnqualifiedDTOList = this.form.defective.map((item) => {
- return {
- categoryId: item.id,
- unQualifiedNum: item.num
- }
- })
- let createWorkorderRecordDTO = {
- workorderId: this.workorderId,
- duration: this.form.duration ? this.form.duration : 0,
- qualifiedNum: this.produceFrom.qualified ? this.produceFrom.qualified : 0,
- unQualifiedNum: this.produceFrom.undesirable ? this.produceFrom.undesirable : 0
- }
- // id: route.query.id
- comfirmDoneStandard({
- createUnqualifiedDTOList,
- createWorkorderRecordDTO
- }).then(res => {
- if (res.code === 200) {
- uni.$u.toast('鎶ュ伐鎴愬姛')
- setTimeout(() => {
- uni.navigateBack({ data: 2})
- }, 2000)
- }
- })
+ getGroupNum(arr) {
+ let newArry = {};
+ for (let i = 0; i < arr.length; i++) {
+ if (newArry[arr[i].materialName]) {
+ newArry[arr[i].materialName].push(arr[i])
+ } else {
+ newArry[arr[i].materialName] = [arr[i]]
+ }
+ }
+ return newArry;
},
+ submit() {
+ let res = this.getGroupNum(this.feedingData)
+ if (this.info.bomType === 1) { // 鎷夊紡
+ console.log('鎷夊紡')
+ this.statisticsData = []
+ if (this.produceFrom.qualified <= 0 && this.produceFrom.undesirable <= 0) {
+ uni.$u.toast('浜у嚭鏄庣粏涓嶈兘涓虹┖')
+ return
+ }
+ if (this.info.hasBom === 0) {
+ console.log('鏃燽om')
+ let arr = []
+ let tl = 0
+ for (let i in res) {
+ let num = 0
+ res[i].forEach(item => {
+ num += Number(item.num)
+ })
+ arr.push({
+ name: '宸ュ崟鎶曟枡',
+ materialName: i + res[i][0].procedureName,
+ num: num
+ })
+ }
+ this.feedingData.forEach(item => {
+ tl += Number(item.num)
+ })
+ this.statisticsData = [...this.statisticsData, ...arr]
+ this.statisticsData.push({
+ name: '宸ュ崟鍚堟牸浜у嚭',
+ materialName: this.info.mmodel.name + '-' + this.info.procedureName,
+ num: this.produceFrom.qualified
+ })
+ this.infostatisticsData.push({
+ name: '宸ュ崟涓嶈壇浜у嚭',
+ materialName: this.info.mmodel.name + '-' + this.info.procedureName,
+ num: this.produceFrom.undesirable
+ })
+ this.statisticsData.push({
+ name: '宸ュ崟鏈姇鏂�',
+ materialName: '',
+ num: this.info.planNum - Number(this.produceFrom.qualified) - Number(this.produceFrom
+ .undesirable)
+ })
+ let total = this.info.planNum - (Number(this.produceFrom.qualified) + Number(this.produceFrom
+ .undesirable))
+ if (total === 0) {
+ this.isSubmit = true
+ } else {
+ this.isSubmit = false
+ }
+ } else if (this.info.hasBom === 1) { // 鏈塨om鎯呭喌
+ console.log('鏈塨om')
+ let arr = []
+ let tl = 0
+ // let res = getGroupNum(feedingData)
+ for (let i in res) {
+ let num = 0
+ res[i].forEach(item => {
+ num += Number(item.num)
+ })
+ arr.push({
+ name: '宸ュ崟鎶曟枡',
+ materialName: i,
+ num: num
+ })
+ }
+ this.feedingData.forEach(item => {
+ tl += Number(item.num)
+ })
+ this.statisticsData = [...this.statisticsData, ...arr]
+ this.statisticsData.push({
+ name: '宸ュ崟鍚堟牸浜у嚭',
+ materialName: this.info.mmodel.name + '-' + this.info.procedureName,
+ num: this.produceFrom.qualified
+ })
+ this.statisticsData.push({
+ name: '宸ュ崟涓嶈壇浜у嚭',
+ materialName: this.info.mmodel.name + '-' + this.info.procedureName,
+ num: this.produceFrom.undesirable
+ })
+ this.isSubmit = Number(this.produceFrom.qualified) + Number(this.produceFrom.undesirable) <= this
+ .info.planNum;
+ }
+ } else {
+ console.log('鎺ㄥ紡')
+ if (this.feedingData.length === 0) {
+ uni.$u.toast('鎶曟枡鏄庣粏涓嶈兘涓虹┖')
+
+ return
+ }
+ if (this.produceFrom.qualified <= 0 && this.produceFrom.undesirable <= 0) {
+ uni.$u.toast('浜у嚭鏄庣粏涓嶈兘涓虹┖')
+
+ return
+ }
+ this.statisticsData = []
+ if (this.info.hasBom === 0) {
+ console.log('鏃燽om')
+ let arr = []
+ let tl = 0
+ for (let i in res) {
+ let num = 0
+ res[i].forEach(item => {
+ num += Number(item.num)
+ })
+ arr.push({
+ name: '宸ュ崟鎶曟枡',
+ materialName: i + '-' + res[i][0].procedureName,
+ num: num
+ })
+ }
+ this.feedingData.forEach(item => {
+ tl += Number(item.num)
+ })
+ this.statisticsData = [...this.statisticsData, ...arr]
+ this.statisticsData.push({
+ name: '宸ュ崟鍚堟牸浜у嚭',
+ materialName: this.info.mmodel.name + '-' + this.info.procedureName,
+ num: this.produceFrom.qualified
+ })
+ this.statisticsData.push({
+ name: '宸ュ崟涓嶈壇浜у嚭',
+ materialName: this.info.mmodel.name + '-' + this.info.procedureName,
+ num: this.produceFrom.undesirable
+ })
+ if (Number(tl) <= this.info.planNum) {
+ let total = Number(tl) - Number(this.produceFrom.qualified) - Number(this.produceFrom
+ .undesirable) // 鏄惁鏈変綑
+ this.statisticsData.push({
+ name: '宸ュ崟鏈姇鏂�',
+ materialName: '',
+ num: (Number(tl) - Number(this.produceFrom.qualified) - Number(this.produceFrom
+ .undesirable))
+ .toFixed(2)
+ })
+ if (total === 0) {
+ this.isSubmit = true
+ } else {
+ this.isSubmit = false
+ }
+ } else {
+ this.isSubmit = false
+ }
+ } else if (this.info.hasBom === 1) { // 鏈塨om鎯呭喌
+ console.log('鏈塨om')
+ let arr = []
+ let tl = 0
+ for (let i in res) {
+ let num = 0
+ res[i].forEach(item => {
+ num += Number(item.num)
+ })
+ arr.push({
+ name: '宸ュ崟鎶曟枡',
+ materialName: i,
+ num: num
+ })
+ }
+ this.feedingData.forEach(item => {
+ tl += Number(item.num)
+ })
+ this.statisticsData = [...this.statisticsData, ...arr]
+ this.statisticsData.push({
+ name: '宸ュ崟鍚堟牸浜у嚭',
+ materialName: this.info.mmodel.name + '-' + this.info.procedureName,
+ num: this.produceFrom.qualified
+ })
+ this.statisticsData.push({
+ name: '宸ュ崟涓嶈壇浜у嚭',
+ materialName: this.info.mmodel.name + '-' + this.info.procedureName,
+ num: this.produceFrom.undesirable
+ })
+ // isSubmit.value = produceFrom.qualified + produceFrom.undesirable <= info.value.planNum;
+ this.isSubmit = true
+ }
+ }
+ this.statistics = true
+ },
+ submitBG() {
+ let createUnqualifiedDTOList = this.form.defective.map((item) => {
+ return {
+ categoryId: item.id,
+ unQualifiedNum: item.num
+ }
+ })
+ let createWorkorderRecordDTO = {
+ workorderId: this.workorderId,
+ duration: this.form.duration ? this.form.duration : 0,
+ qualifiedNum: this.produceFrom.qualified ? this.produceFrom.qualified : 0,
+ unQualifiedNum: this.produceFrom.undesirable ? this.produceFrom.undesirable : 0
+ }
+ // id: route.query.id
+ comfirmDoneStandard({
+ createUnqualifiedDTOList,
+ createWorkorderRecordDTO
+ }).then(res => {
+ if (res.code === 200) {
+ uni.$u.toast('鎶ュ伐鎴愬姛')
+ setTimeout(() => {
+ uni.navigateBack({
+ data: 2
+ })
+ }, 2000)
+ }
+ })
+ },
+ // => {
+ // // if (!from.duration || from.duration <= 0) {
+ // // return Toast('鎶ュ伐鏃堕暱涓嶈兘涓虹┖')
+ // // }
+ // let createUnqualifiedDTOList = from.defective.map(item => {
+ // return {
+ // categoryId: item.id,
+ // unQualifiedNum: item.num
+ // }
+ // })
+ // let createWorkorderRecordDTO = {
+ // workorderId: route.query.id,
+ // duration: from.duration ? from.duration : 0,
+ // qualifiedNum: produceFrom.qualified ? produceFrom.qualified : 0,
+ // unQualifiedNum: produceFrom.undesirable ? produceFrom.undesirable : 0
+ // }
+ // // id: route.query.id
+ // comfirmDoneStandard({
+ // createUnqualifiedDTOList,
+ // createWorkorderRecordDTO
+ // }).then(res => {
+ // if (res.code === 200) {
+ // Toast.success({ message: '鎶ュ伐鎴愬姛', forbidClick: true, duration: 2000 })
+ // setTimeout(() => {
+ // router.go(-2)
+ // }, 2000)
+ // }
+ // })
+ // }
+
jumpdj() {
uni.navigateTo({
url: `/pages_adjust/pages/spotCheck/spotCheck?id=${this.workorderId}`
})
- },
- getLists() {
- if (!this.finished) {
- return
- }
- this.finished = false
- this.pages.page += 1
- this.pageDJs()
},
- pageDJs() {
-
+ getLists() {
+ if (!this.finished) {
+ return
+ }
+ this.finished = false
+ this.pages.page += 1
+ this.pageDJs()
+ },
+ pageDJs() {
+
pageDJ({
- capacity: this.pages.capacity,
- page: this.pages.page,
- model: {
- workorderId: this.workorderId
- }
- }).then(res => {
- let {data} = res
- if (data.page == 1) {
- this.djData = []
- }
- this.djData.push(...data.records)
- // loading.value = false
- }).catch(err => {
- // loading.value = false
- // finished.value = true
- })
- .finally(() => {
- this.finished = true
- })
+ capacity: this.pages.capacity,
+ page: this.pages.page,
+ model: {
+ workorderId: this.workorderId
+ }
+ }).then(res => {
+ let {
+ data
+ } = res
+ if (data.page == 1) {
+ this.djData = []
+ }
+ this.djData.push(...data.records)
+ // loading.value = false
+ }).catch(err => {
+ // loading.value = false
+ // finished.value = true
+ })
+ .finally(() => {
+ this.finished = true
+ })
},
dele(id) {
deletedj(id)
@@ -638,6 +896,26 @@
uni.navigateTo({
// url: ''
url: `/pages_adjust/pages/manualFeed/manualFeed?id=${this.workorderId}`
+ })
+ },
+ deleItem(id, type) {
+ uni.showModal({
+ title: '鎻愮ず',
+ content: '纭畾鍒犻櫎姝ゆ潯璁板綍鍚楋紵',
+ success: (res) => {
+ if (res.confirm) {
+ deleteCT(id)
+ .then(res => {
+ this.getOrocessRecords()
+ // if (type === 'C') {
+ // this.getOrocessRecordCC()
+ // } else if (type === 'T') {
+ // this.getOrocessRecords()
+ // }
+ })
+ .catch(err => {})
+ }
+ }
})
}
}
@@ -1019,6 +1297,7 @@
width: 100%;
padding: 30rpx 30rpx 60rpx 30rpx;
box-sizing: border-box;
+ z-index: 9999;
.bg_footer_submit1 {
width: 690rpx;
@@ -1173,8 +1452,9 @@
.bl_list_item_right {
flex: 1;
height: 50rpx;
- text-align: right;
-
+ text-align: right;
+ display: flex;
+ justify-content: flex-end;
input {
padding-left: 5rpx;
width: 160rpx;
@@ -1197,4 +1477,119 @@
}
}
}
+
+ .tg {
+ width: 100%;
+ height: 800rpx;
+ padding: 30rpx;
+ box-sizing: border-box;
+
+ .tg_header {
+ width: 100%;
+ height: 45rpx;
+ text-align: center;
+ line-height: 45rpx;
+ font-size: 30rpx;
+ font-weight: 500;
+ color: #222222;
+ }
+
+ .tg_table {
+ width: 100%;
+ margin-top: 40rpx;
+
+ .tg_table_header {
+ width: 100%;
+ height: 72rpx;
+ background: #EFF2FC;
+ display: flex;
+ align-items: center;
+
+ .tg_table_header_item {
+ flex: 1;
+ font-size: 26rpx;
+ font-weight: 500;
+ color: #333333;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ }
+ }
+
+ .nr {
+ width: 100%;
+ max-height: calc(100% - 133rpx);
+ overflow-x: scroll;
+
+ .tg_table_nr {
+ width: 100%;
+ padding: 24rpx 10rpx;
+ box-sizing: border-box;
+ display: flex;
+ align-items: center;
+ background: white;
+ box-shadow: inset 0px -2rpx 0px 0px #E5E5E5;
+
+ .tg_table_nr_item {
+ flex: 1;
+ font-size: 26rpx;
+ font-weight: 500;
+ color: #333333;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .tg_table_nr_item1 {
+ flex: 1;
+ font-size: 26rpx;
+ font-weight: 500;
+ color: #333333;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ }
+ }
+ }
+
+ .tg_footer {
+ width: calc(100% - 60rpx);
+ position: fixed;
+ bottom: 0;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ box-sizing: border-box;
+ padding-bottom: 40rpx;
+
+ .tg_footer_fh {
+ width: 100%;
+ height: 88rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: rgba(66, 117, 252, 0.05);
+ border-radius: 8rpx;
+ border: 1rPX solid #4275FC;
+ font-size: 32rpx;
+ font-weight: 500;
+ color: $nav-color;
+ }
+
+ .tg_footer_qr {
+ width: 100%;
+ height: 88rpx;
+ border: none;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: $nav-color;
+ border-radius: 8rpx;
+ font-size: 32rpx;
+ font-weight: 500;
+ color: #FFFFFF;
+ }
+ }
</style>
--
Gitblit v1.9.3