From c43e9ca8e4baa3e31c1da3c086ec8f1a7d12e438 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期三, 23 八月 2023 18:27:20 +0800
Subject: [PATCH] 大屏
---
h5_standard/src/views/workOrder/reportingForWork.vue | 286 ++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 231 insertions(+), 55 deletions(-)
diff --git a/h5_standard/src/views/workOrder/reportingForWork.vue b/h5_standard/src/views/workOrder/reportingForWork.vue
index f6d30eb..241b071 100644
--- a/h5_standard/src/views/workOrder/reportingForWork.vue
+++ b/h5_standard/src/views/workOrder/reportingForWork.vue
@@ -55,7 +55,7 @@
<span>鏂板鎶曟枡</span>
</div>
</div>
- <template v-if="wuList.length > 0">
+ <template v-if="wuList.length > 0 && !(hasBom == 1 && bomType == 1)">
<van-swipe-cell v-for="(item, index) in wuList" :key="index">
<div class="bg_list_item_h">
<div class="bg_list_item_num">
@@ -82,7 +82,7 @@
</template>
</van-swipe-cell>
</template>
- <template v-else>
+ <template v-else-if="wuList.length == 0 && !(hasBom == 1 && bomType == 1)">
<div class="kong">
<span>鏆傛棤鏁版嵁</span>
</div>
@@ -104,7 +104,7 @@
<span><b>*</b>鑹搧鏁�</span>
<div class="bg_list_item_num_item_sr">
<input type="number" v-model="from.qualified" @input="changeNum(1)" placeholder="璇疯緭鍏�" />
- <span>鍧�</span>
+ <span v-if="from.processPlan">{{from.processPlan.unitName}}</span>
</div>
</div>
</div>
@@ -113,12 +113,12 @@
<span>涓嶈壇鏁�</span>
<div class="bg_list_item_num_item_sr">
<input type="number" v-model="from.undesirable" @input="changeNum(2)" placeholder="璇疯緭鍏�" />
- <span>鍧�</span>
+ <span v-if="from.processPlan">{{from.processPlan.unitName}}</span>
</div>
</div>
</div>
<div class="bg_list_item_num" v-if="from.undesirable > 0">
- <div class="bg_list_item_num_item" @click="show = true">
+ <div class="bg_list_item_num_item" @click="openBL">
<span><b>*</b>涓嶈壇椤�</span>
<div class="bg_list_item_num_item_sr">
<span class="wulll" :style="{color: from.defectiveName ? '#305ED5' : ''}">{{from.defectiveName ? from.defectiveName : '璁剧疆'}}</span>
@@ -130,14 +130,14 @@
</div>
<div class="bg_plan" @click="TimeShow = true">
<div class="bg_plan_label">
- <span><b>*</b>鎶ュ伐鏃堕暱</span>
+ <span>鎶ュ伐鏃堕暱</span>
</div>
<div class="bg_plan_label_val">
<span :style="{color: from.durationName ? '#333' : ''}">{{from.durationName ? from.durationName : '璇烽�夋嫨'}}</span>
<img src="@/assets/icon/ic_ar@2x.png" alt="" />
</div>
</div>
- <div class="bg_list_item" v-if="infoBox">
+ <div class="bg_list_item" v-if="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"></div>
@@ -149,8 +149,9 @@
<div class="bg_list_item_num_item">
<span>璁′欢鏂瑰紡</span>
<div class="bg_list_item_num_item_list">
- <div class="bg_list_item_num_item_list_item active" v-if="infoBox.type == 0">璁′欢</div>
- <div class="bg_list_item_num_item_list_item active" v-if="infoBox.type == 1">璁℃椂</div>
+ <div :class="item.active ? 'bg_list_item_num_item_list_item active' : 'bg_list_item_num_item_list_item'" v-for="(item, index) in arrType" :key="index" @click="clickPerformanceType(index)">{{ item.name }}</div>
+ <!-- <div class="bg_list_item_num_item_list_item active" v-if="infoBox.type == 0">璁′欢</div>
+ <div class="bg_list_item_num_item_list_item active" v-if="infoBox.type == 1">璁℃椂</div> -->
</div>
</div>
</div>
@@ -158,7 +159,8 @@
<div class="bg_list_item_num_item">
<span>宸ヨ祫鍗曚环</span>
<div class="bg_list_item_num_item_sr">
- <span class="color1">{{infoBox.salary}}鍏�/{{infoBox.type == 0 ? '浠�' : '鏃�'}}</span>
+ <span class="color1">{{(arrType[from.index].salary / 10 / 10).toFixed(2)}}鍏�/{{arrType[from.index].type == 0 ? '浠�' : '鏃�'}}</span>
+ <!-- <span class="color1">{{(infoBox.salary / 10 / 10).toFixed(2)}}鍏�/{{infoBox.type == 0 ? '浠�' : '鏃�'}}</span> -->
</div>
</div>
</div>
@@ -184,11 +186,11 @@
<!-- 鎶ュ伐鎸夐挳 -->
<div class="bh_zw"></div>
<div class="bg_footer">
- <div class="bg_footer_submit1">缁х画鎶ュ伐</div>
+ <div class="bg_footer_submit1" @click="continueSubmit">缁х画鎶ュ伐</div>
<div class="bg_footer_submit" @click="submit">鎻愪氦</div>
</div>
<!-- 閫夋嫨涓嶈壇椤� -->
- <van-popup v-model:show="show" round position="bottom" :style="{ height: '53%' }">
+ <van-popup v-model:show="show" round position="bottom">
<div class="bl">
<div class="bl_head">
<img src="@/assets/icon/ic_close@2x.png" style="opacity: 0;" alt="" />
@@ -239,13 +241,15 @@
<script setup lang="ts">
import { onMounted, ref, reactive, getCurrentInstance, computed } from 'vue'
import { useRouter } from 'vue-router'
- import { getDeviceByCondition, getFindAll, queryOne, autoWorkReport, getIdPlansExt, categoryExtList } from '@/apis/PlanningAPI'
+ import { useStore } from 'vuex'
+ import { getDeviceByCondition, getFindAll, queryOne, queryList, autoWorkReport, getIdPlansExt, categoryExtList } from '@/apis/PlanningAPI'
import MaterialY from '@/components/newCom/MaterialY.vue'
import user from '@/components/newCom/user.vue'
import { Toast } from 'vant'
const {$Bus} = getCurrentInstance().appContext.config.globalProperties
const router = useRouter()
+ const store = useStore()
let show = ref(false)
let show1 = ref(false)
let TimeShow = ref(false)
@@ -258,16 +262,21 @@
processPlan: null,
deviceId: '',
deviceName: '',
- userId: '',
- userName: '',
+ userId: store.state.userInfo.id,
+ userName: store.state.userInfo.companyUser.name,
qualified: '', // 鑹搧鏁�
undesirable: '', // 涓嶈壇鏁�
duration: '',
- durationName: '',
+ durationName: '0灏忔椂0鍒嗛挓',
time: '',
defective: [],
- defectiveName: ''
+ defectiveName: '',
+ type: '', // 缁╂晥绫诲瀷
+ index: 0
})
+
+ // { name: '璁′欢', active: false, id: 0 }, { name: '璁℃椂', active: false, id: 1 }
+ let arrType: any = ref([])
let infoBox: any = ref(null) // 宸ヨ祫缁╂晥
@@ -280,8 +289,30 @@
text: 'name'
};
let userShow = ref(false)
- let userList = ref([])
- let wuList: any = ref([])
+ let wuList = ref<Array<any>>([])
+
+ const openBL = () => {
+ cateList.value.forEach((item: any) => {
+ if (!item.active) {
+ item.num = ''
+ }
+ if (item.active && item.num <= 0) {
+ item.active = false
+ }
+ })
+ show.value = true
+ }
+
+ // 鍒囨崲缁╂晥绫诲瀷
+ const clickPerformanceType = (i: number) => {
+ from.index = i
+ arrType.value.forEach((item: any, index: number) => {
+ if (i === index) {
+ from.type = item.id
+ }
+ item.active = index === i
+ })
+ }
// 浜у嚭鏁伴噺楠岃瘉
const changeNum = (type: number) => {
@@ -323,20 +354,100 @@
let arr: any = []
let total: any = 0
let name: any = ''
- cateList.value.forEach((item: any, index: number) => {
- if (item.active) {
- if (item.num <= 0) {
+ for (let i = 0; i < cateList.value.length; i++) {
+ if (cateList.value[i].active) {
+ if (cateList.value[i].num <= 0) {
return Toast('涓嶈壇鏁伴噺蹇呴』澶т簬0')
}
- total = total += item.num
- arr.push(item)
- name += item.name + item.num + '锛�'
+ total = total += cateList.value[i].num
+ arr.push(cateList.value[i])
+ name += cateList.value[i].name + cateList.value[i].num + '锛�'
}
- })
+ }
+ // cateList.value.forEach((item: any, index: number) => {
+ // if (item.active) {
+ // if (item.num <= 0) {
+ // return Toast('涓嶈壇鏁伴噺蹇呴』澶т簬0')
+ // }
+ // total = total += item.num
+ // arr.push(item)
+ // name += item.name + item.num + '锛�'
+ // }
+ // })
if (total !== from.undesirable) return Toast('涓嶈壇鏁板繀椤荤瓑浜庝骇鍑轰笉鑹暟')
from.defective = arr
from.defectiveName = name
show.value = false
+ }
+
+ const continueSubmit = () => {
+ if (!from.processPlan) return Toast('璁″垝涓嶈兘涓虹┖')
+ if (!from.deviceId) return Toast('璁惧涓嶈兘涓虹┖')
+ if (!from.userId) return Toast('鐢熶骇浜哄憳涓嶈兘涓虹┖')
+ if (hasBom.value == 1 && bomType.value == 1) {
+ console.log('涓嶉渶瑕佹姇鏂�')
+ } else {
+ if (!wuList.value.length === 0) return Toast('鎶曟枡涓嶈兘涓虹┖')
+ }
+ if (!from.qualified && !from.undesirable) {
+ return Toast('鑹搧鏁颁笌涓嶈壇鏁颁笉鑳藉悓鏃朵负绌�')
+ }
+ // if (!from.qualified) return Toast('鑹搧鏁颁笉鑳戒负绌�')
+ // 鏈変笉鑹暟
+ if (from.undesirable > 0) {
+ if (from.defective.length === 0) return Toast('涓嶈壇椤逛笉鑳戒负绌�')
+ }
+ // if (!from.duration) return Toast('鎶ュ伐鏃堕暱涓嶈兘涓虹┖')
+ let type = ''
+ arrType.value.forEach((item: any) => {
+ if (item.active) {
+ type = item.id
+ }
+ })
+ autoWorkReport({
+ createWorkorderRecordDTO: {
+ type,
+ duration: from.duration,
+ qualifiedNum: from.qualified ? from.qualified : 0,
+ unQualifiedNum: from.undesirable ? from.undesirable : 0
+ },
+ plansId: from.processPlan.id,
+ proGroupId: deviceId.value,
+ proUserList: [from.userId],
+ recordList: wuList.value.map((item: any) => {
+ return {
+ wstockId: item.id,
+ num: item.num
+ }
+ }),
+ createUnqualifiedDTOList: from.defective.map((item: any) => {
+ return {
+ categoryId: item.id,
+ unQualifiedNum: item.num
+ }
+ })
+ }).then(res => {
+ if (res.code === 200) {
+ Toast.success({message: '鎶ュ伐鎴愬姛锛�'})
+ from.processPlan = null
+ from.deviceId = ''
+ from.deviceName = ''
+ from.userId = ''
+ from.userName = ''
+ from.qualified = ''
+ from.undesirable = ''
+ from.duration = ''
+ from.durationName = '0灏忔椂0鍒嗛挓'
+ from.time = ''
+ from.defective = []
+ from.defectiveName = ''
+ wuList.value = []
+ deviceId.value = ''
+ plansId.value = ''
+ ids.value = ''
+ total.value = ''
+ }
+ })
}
const submit = () => {
@@ -348,17 +459,27 @@
} else {
if (!wuList.value.length === 0) return Toast('鎶曟枡涓嶈兘涓虹┖')
}
- if (!from.qualified) return Toast('鑹搧鏁颁笉鑳戒负绌�')
+ if (!from.qualified && !from.undesirable) {
+ return Toast('鑹搧鏁颁笌涓嶈壇鏁颁笉鑳藉悓鏃朵负绌�')
+ }
+ // if (!from.qualified) return Toast('鑹搧鏁颁笉鑳戒负绌�')
// 鏈変笉鑹暟
if (from.undesirable > 0) {
if (from.defective.length === 0) return Toast('涓嶈壇椤逛笉鑳戒负绌�')
}
- if (!from.duration) return Toast('鎶ュ伐鏃堕暱涓嶈兘涓虹┖')
+ // if (!from.duration) return Toast('鎶ュ伐鏃堕暱涓嶈兘涓虹┖')
+ let type = ''
+ arrType.value.forEach((item: any) => {
+ if (item.active) {
+ type = item.id
+ }
+ })
autoWorkReport({
createWorkorderRecordDTO: {
+ type,
duration: from.duration,
- qualifiedNum: from.qualified,
- unQualifiedNum: from.undesirable
+ qualifiedNum: from.qualified ? from.qualified : 0,
+ unQualifiedNum: from.undesirable ? from.undesirable : 0
},
plansId: from.processPlan.id,
proGroupId: deviceId.value,
@@ -387,43 +508,84 @@
// 棰勮宸ヨ祫
const expectedSalary = computed(() => {
- if (!infoBox.value) return 0
- // 鎸変欢璁$畻
- if (infoBox.value.type == 0) {
- console.log('璁′欢')
+ if (arrType.value.length === 0) return 0;
+ if (arrType.value[from.index].type == 0) {
if (!from.qualified) return 0
- if (infoBox.value.unqualified == 1) { // 鏄惁璁″叆涓嶈壇鍝�
+ if (arrType.value[from.index].unqualified == 1) { // 鏄惁璁″叆涓嶈壇鍝�
let total = Number(from.qualified) + Number(from.undesirable)
- return total * infoBox.value.salary
+ return (total * (arrType.value[from.index].salary / 10 / 10)).toFixed(2)
} else {
- return Number(from.qualified) * infoBox.value.salary
+ return (Number(from.qualified) * (arrType.value[from.index].salary / 10 / 10)).toFixed(2)
}
} else {
- console.log('璁℃椂')
if (!from.duration) return 0;
let h = (from.duration / 60 / 60).toFixed(2)
- return Number(h) * infoBox.value.salary
+ return (Number(h) * (arrType.value[from.index].salary / 10 / 10)).toFixed(2)
}
+ // if (!infoBox.value) return 0;
+ // 鎸変欢璁$畻
+ // if (infoBox.value.type == 0) {
+ // if (!from.qualified) return 0
+ // if (infoBox.value.unqualified == 1) { // 鏄惁璁″叆涓嶈壇鍝�
+ // let total = Number(from.qualified) + Number(from.undesirable)
+ // return (total * (infoBox.value.salary / 10 / 10)).toFixed(2)
+ // } else {
+ // return (Number(from.qualified) * (infoBox.value.salary / 10 / 10)).toFixed(2)
+ // }
+ // } else {
+ // if (!from.duration) return 0;
+ // let h = (from.duration / 60 / 60).toFixed(2)
+ // return (Number(h) * (infoBox.value.salary / 10 / 10)).toFixed(2)
+ // }
})
// 杈炬爣鐜�
const complianceRate = computed(() => {
- if (!infoBox.value) return 0;
- if (!from.qualified) return 0;
+ if (arrType.value.length === 0) return 0;
+ if (!from.qualified && !from.undesirable) return 0;
if (!from.duration) return 0;
+ if (!arrType.value[from.index].num) return 0;
// 鎸変欢璁$畻
// if (infoBox.value.type == 0) {
- // if (infoBox.value.unqualified == 1) { // 鏄惁璁″叆涓嶈壇鍝�
- let a = ((Number(from.qualified) + Number(from.undesirable)) / (from.duration / 60 / 60)).toFixed(2)
- let b = (infoBox.value.num / (infoBox.value.times / 60 / 60)).toFixed(2)
+ if (arrType.value[from.index].unqualified == 1) { // 鏄惁璁″叆涓嶈壇鍝�
+ let a = ((Number(from.qualified) + Number(from.undesirable)) / (from.duration / 3600)).toFixed(2)
+ let b = (arrType.value[from.index].num / (arrType.value[from.index].times / 3600)).toFixed(2)
console.log(a)
console.log(b)
- return (Number(a) / Number(b)).toFixed(2)
+ 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 {
- // return Number(from.qualified) * infoBox.value.salary;
- // }
+ } else {
+ let a = (from.qualified / (from.duration / 3600)).toFixed(2)
+ let b = (arrType.value[from.index].num / (arrType.value[from.index].times / 3600)).toFixed(2)
+ console.log(a)
+ console.log(b)
+ return ((Number(a) / Number(b)) * 100).toFixed(2)
+ // return Number(from.qualified) * infoBox.value.salary;
+ }
+
+ // if (!infoBox.value) return 0;
+ // if (!from.qualified && !from.undesirable) return 0;
+ // if (!from.duration) return 0;
+ // if (!infoBox.value.num) return 0;
+ // // 鎸変欢璁$畻
+ // // if (infoBox.value.type == 0) {
+ // if (infoBox.value.unqualified == 1) { // 鏄惁璁″叆涓嶈壇鍝�
+ // let a = ((Number(from.qualified) + Number(from.undesirable)) / (from.duration / 3600)).toFixed(2)
+ // let b = (infoBox.value.num / (infoBox.value.times / 3600)).toFixed(2)
+ // console.log(a)
+ // console.log(b)
+ // 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 {
+ // let a = (from.qualified / (from.duration / 3600)).toFixed(2)
+ // let b = (infoBox.value.num / (infoBox.value.times / 3600)).toFixed(2)
+ // console.log(a)
+ // console.log(b)
+ // return ((Number(a) / Number(b)) * 100).toFixed(2)
+ // // return Number(from.qualified) * infoBox.value.salary;
+ // }
// } else {
// console.log('鎸夋椂闀�')
// }
@@ -528,13 +690,14 @@
from.deviceId = ''
from.deviceName = ''
deviceId.value = ''
- from.userId = ''
- from.userName = ''
+ // from.userId = ''
+ // from.userName = ''
total.value = res.num - res.workorderDistributNum
// 鑾峰彇璁惧
getDeviceByCondition({ procedureId: res.procedureId })
.then(res1 => {
if (res1.code === 200) {
+ if (res1.data && res1.data.length > 0)
deviceId.value = res1.data[0].id
from.deviceId = res1.data[0].id
from.deviceName = res1.data[0].name
@@ -544,20 +707,30 @@
// 鑾峰彇绫诲瀷
getIdPlansExt(res.id)
.then(res2 => {
- if (res.code === 200) {
+ if (res2.code === 200) {
bomType.value = res2.data.bomType
hasBom.value = res2.data.hasBom
}
})
// 鑾峰彇宸ヨ祫缁╂晥鏁版嵁
- queryOne({
+ queryList({
deleted: 0,
departId: res.factoryId,
materialId: res.materialId,
procedureId: res.procedureId
}).then(result => {
if (result.code === 200) {
- infoBox.value = result.data
+ if (result.data && result.data.length > 0) {
+ result.data.forEach((item: any, index: number) => {
+ item.name = item.type == 0 ? '璁′欢' : '璁℃椂'
+ item.id = item.type
+ item.active = index == 0
+ })
+ arrType.value = result.data
+ } else {
+ arrType.value = []
+ }
+ // infoBox.value = result.data
}
})
})
@@ -843,7 +1016,7 @@
font-size: 28px;
font-weight: 400;
color: #333333;
- padding: 0 30px
+ padding: 0 30px;
}
.wulll {
width: 400px;
@@ -906,12 +1079,15 @@
}
}
.bl {
+ width: 100%;
+ height: 800px;
padding: 30px;
box-sizing: border-box;
display: flex;
flex-direction: column;
.bl_head {
width: 100%;
+ height: 50px;
display: flex;
align-items: center;
justify-content: space-between;
@@ -942,7 +1118,7 @@
}
.bl_list {
width: 100%;
- height: 550px;
+ height: calc(100% - 168px);
overflow-y: scroll;
margin-top: 30px;
.bl_list_item {
--
Gitblit v1.9.3