From 64a7f738aadbf552bfb1ce24c46b1924767bf526 Mon Sep 17 00:00:00 2001 From: Mr.Zhang <710666463@qq.com> Date: 星期二, 05 九月 2023 16:00:16 +0800 Subject: [PATCH] 小程序 --- minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue | 224 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 189 insertions(+), 35 deletions(-) diff --git a/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue b/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue index 85ca4fc..a3859e1 100644 --- a/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue +++ b/minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue @@ -1,7 +1,7 @@ <template> <view> <view class="tips-label">褰撳墠浠诲姟闇�瑕佽川妫�锛涗骇鍑哄悗锛岃鑰愬績绛夊緟璐ㄦ鍛樻楠岋紝骞舵牴鎹楠岀粨鏋滆皟鏁翠骇鍑烘暟鎹悗鍐嶆姤宸ャ��</view> - <workOrderInfo :orederMessage="{proUserList:[]}" /> + <workOrderInfo :orederMessage="info" /> <!-- <u-tabs :list="tab" lineColor="#305ED5" :activeStyle="{color:'#305ED5'}" lineWidth="50%" :itemStyle="{width: '50%', boxSizing: 'border-box', height: '88rpx'}" @click="click"></u-tabs> --> <view class="bg_cate"> <view @click="clickIten(index)" :class="typeView == index ? 'bg_cate_item active' : 'bg_cate_item'" @@ -14,7 +14,9 @@ <div class="bg_list_item_top_left_x bg_m"></div> <span>鎶曟枡鏄庣粏</span> </div> - <div class="bg_list_item_top_right" @click="jumpTL"> + <!-- proxy.$auth('h5:workorderinput:create') && --> + <div class="bg_list_item_top_right" @click="jumpTL" + v-if="info.bomType !== 1 || info.bomType == 0 || !info.bomType"> <!-- v-if="proxy.$auth('h5:workorderinput:create') && (info.bomType !== 1 || info.bomType == 0 || !info.bomType)" --> <!-- <img src="@/assets/icon/gongdan_ic_shoudong@2x.png" alt="" /> --> <!-- <img src="@/static/gongdan_ic_shoudong@2x.ong" alt="" /> --> @@ -174,7 +176,8 @@ </div> <div class="details_dj" v-if="typeView === 1"> - <div class="details_dj_list"> + <div class="details_dj_list"> + <u-swipe-action> <u-swipe-action-item v-for="(item, index) in djData" :key="index" :options="options" @click="dele(item.id)"> @@ -205,11 +208,10 @@ <view class="c2 b tc">涓嶈壇椤�</view> <view class="content bl_list"> <div class="bl_list_item" v-for="(item, i) in cateList" :key="i" @click="changeChecked(i)"> - <div class="bl_list_item_left"> - <u-checkbox-group> - <u-checkbox :key="index" :checked="item.active" :label="item.name" - :name="item.name"> - </u-checkbox> + <div class="bl_list_item_left"> + <u-checkbox-group @change="changeChecked(i)"> + <u-checkbox :key="index" :checked="item.active" :label="item.name" :name="item.name"> + </u-checkbox> </u-checkbox-group> </div> <div class="bl_list_item_right"> @@ -227,6 +229,26 @@ <script> import workOrderInfo from '@/components/workOrderInfo.vue' + import { + getBarcodeContent, + queryById, + getOrocessRecord, + deleteCT, + updateById, + comfirmDone, + comfirmDoneStandard, + getListByCondition, + allForStandard, + pageDJ, + deletedj, + dealWorkorderRecordStandard, + getWorkorderRecordListStandard + } from '@/util/api/WorkOrderAPI' + import { + categoryExtList, + queryOne, + queryList + } from '@/util/api/PlanningAPI' export default { components: { workOrderInfo @@ -252,18 +274,22 @@ TimeShow: false, badShow: false, typeView: 0, - feedingData: [{ - id: 0, - materialName: '澧欎綋鐮�', - procedureName: '鍘嬪埗', - qualityType: 1, - locationName: 'CP-01', - batch: '20230713', - num: 2, - maxNum: 10, - unitAttribute: 1, - unitName: '鍧�' - }], + workorderId: '', + info: {}, + feedingData: [ + // { + // id: 0, + // materialName: '澧欎綋鐮�', + // procedureName: '鍘嬪埗', + // qualityType: 1, + // locationName: 'CP-01', + // batch: '20230713', + // num: 2, + // maxNum: 10, + // unitAttribute: 1, + // unitName: '鍧�' + // }, + ], options: [{ text: '鍒犻櫎', style: { @@ -286,7 +312,7 @@ qualifiedId: '', qualified: '', // 鍚堟牸 undesirableId: '', - undesirable: 5 // 涓嶈壇 + undesirable: '' // 涓嶈壇 }, djData: [{ attrName: '鍑烘按鏃堕棿', @@ -294,12 +320,25 @@ userName: '寮犱笁 ', createTime: '2022-05-28 16:32:' }], - cateList: [{ - active: false, - name: '姣涘埡', - num: 0 - }] + cateList: [ + // { + // active: false, + // name: '姣涘埡', + // num: 0 + // }, + ], + pages: { + capacity: 10, + page: 1, + total: 0 + } }; + }, + onLoad(obj) { + this.workorderId = obj.id + this.queryByIds() + this.getOrocessRecords() + this.getData() }, computed: { expectedSalary() { @@ -320,10 +359,10 @@ return (Number(h) * (this.arrType[this.form.index].salary / 10 / 10)).toFixed(2) || 0 } }, - complianceRate() { - if (this.arrType.length === 0) return 0; - if (!this.produceFrom.qualified && !this.produceFrom.undesirable) return 0; - if (!this.form.duration) return 0; + complianceRate() { + if (this.arrType.length === 0) return 0; + if (!this.produceFrom.qualified && !this.produceFrom.undesirable) return 0; + if (!this.form.duration) return 0; if (!this.arrType[this.form.index].num) return 0; // 鎸変欢璁$畻 // if (infoBox.value.type == 0) { @@ -334,15 +373,64 @@ return ((Number(a) / Number(b)) * 100).toFixed(2) // let total = (Number(from.qualified) + Number(from.undesirable)) / ((from.duration * 60 * 60) * infoBox.value.num / ) // return total * infoBox.value.salary; - } else { + } else { let a = (this.produceFrom.qualified / (this.form.duration / 3600)).toFixed(2) - let b = (this.arrType[this.form.index].num / (this.arrType[this.form.index].times / 3600)).toFixed(2) + let b = (this.arrType[this.form.index].num / (this.arrType[this.form.index].times / 3600)).toFixed(2) return ((Number(a) / Number(b)) * 100).toFixed(2) // return Number(from.qualified) * infoBox.value.salary; } } }, methods: { + queryByIds() { + queryById(this.workorderId) + .then(res => { + this.info = res.data + queryList({ + deleted: 0, + departId: res.data.factoryId, + materialId: res.data.materialId, + procedureId: res.data.procedureId + }).then(result => { + if (result.code === 200) { + if (result.data && result.data.length > 0) { + result.data.forEach((item, index) => { + item.name = item.type == 0 ? '璁′欢' : '璁℃椂' + item.id = item.type + item.active = index == 0 + }) + this.arrType = result.data + } else { + this.arrType = [] + } + } + }) + }) + }, + getOrocessRecords() { + this.feedingData = [] + allForStandard({ + workorderId: this.workorderId, + type: 0 + }).then(res => { + if (res.code === 200) { + this.feedingData = res.data + } + }) + }, + getData() { + categoryExtList({ + cateType: "3" + }).then(res => { + if (res.code === 200) { + res.data.forEach(item => { + item.active = false + item.num = '' + }) + this.cateList = res.data + } + }) + }, click() { }, @@ -410,12 +498,42 @@ // } // }) }, + 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:'浜у嚭鏁伴噺涓嶈兘澶т簬璁″垝鏁伴噺', duration: 2000, icon:'none' }) + return + } + if (num >= 0) { + this.form.defective = [] + this.form.defectiveName = '' + // dealWorkorderRecordStandard({ + // downType, num, recordId, workorderId: route.query.id + // }).then(res => { + // if (res.code === 200) { + // getOrocessRecordCC() + // } + // }) + } else { + if (downType == 0) { + this.produceFrom.qualified = 0 + } else { + this.produceFrom.undesirable = 0 + } + uni.showToast({ title:'浜у嚭鏁伴噺涓嶈兘灏忎簬', duration: 2000, icon:'none' }) + } + }, clickPerformanceType(item, index) { this.form.index = index this.form.type = item.type }, submit() {}, - jumpdj() {}, + jumpdj() { + uni.navigateTo({ + url: `/pages_adjust/pages/spotCheck/spotCheck?id=${this.workorderId}` + }) + }, pageDJs() {}, dele(id) { // deletedj(id) @@ -429,12 +547,48 @@ // } // }) }, - confirm() { - // console.log('confirm'); + confirm() { + console.log('confirm', this.cateList); + let isOpen = false + this.cateList.forEach((item, index) => { + if (item.active) { + isOpen = true + } + }) + if (!isOpen) { + uni.showToast({ title:'璇烽�夋嫨涓嶈壇椤�', duration: 2000, icon:'none' }) + return + } + let arr = [] + let total = 0 + let name = '' + this.cateList.forEach((item, index) => { + if (item.active) { + if (item.num <= 0) { + uni.showToast({ title:'涓嶈壇鏁伴噺蹇呴』澶т簬0', duration: 2000, icon:'none' }) + return + } + total = total += item.num + arr.push(item) + name += item.name + item.num + '锛�' + } + }) + if (total != Number(this.produceFrom.undesirable)) { + uni.showToast({ title:'涓嶈壇鏁板繀椤荤瓑浜庝骇鍑轰笉鑹暟', duration: 2000, icon:'none' }) + return + } + this.form.defective = arr + this.form.defectiveName = name this.badShow = false }, changeChecked(i) { this.cateList[i].active = !this.cateList[i].active + }, + jumpTL() { + uni.navigateTo({ + // url: '' + url: `/pages_adjust/pages/manualFeed/manualFeed?id=${this.workorderId}` + }) } } } -- Gitblit v1.9.3