批量派工时根据数量和额定工时计算预估工时

dev
qiuhongwu 3 months ago
parent c2e7d4c438
commit a9c98ebc90

@ -9,6 +9,7 @@
<el-col>
<!-- <el-button type="primary" size="large" @click="onAddItem">线</el-button> -->
<el-button type="primary" size="large" @click="onAddItem"></el-button>
<span style="margin-left: 20px">总数量{{ sum }}</span>
</el-col>
<el-col>
<el-card class="hl-incard">
@ -280,7 +281,6 @@ const formData = ref({
]
})
const subFormRef = ref() // Ref
const deptTree = ref() //
const subFormRules = reactive({
procedureId: [{ required: true, message: '工序不能为空', trigger: 'blur' }],
owner: [{ required: true, message: '负责人不能为空', trigger: 'blur' }],
@ -291,10 +291,11 @@ const subFormRules = reactive({
})
/** 打开弹窗 */
const open = async (id: []) => {
const sum = ref(0)
const open = async (id: [], fsum: number) => {
sum.value = 0
resetForm()
console.log(id)
sum.value = fsum
formData.value.dispatchIds = id
dialogVisible.value = true
dialogTitle.value = t('生产派工')
@ -355,21 +356,6 @@ const onAddItem = () => {
formData.value.taskDispatchDetails.push(row)
}
// const endTimeChange = (val) => {
// if(val.startTime&&val.endTime&&val.amount){
// // startTimeendTimeUnix
// const startDate = new Date(val.startTime)
// const endDate = new Date(val.endTime)
// //
// const diffInMilliseconds = endDate.getTime() - startDate.getTime()
// //
// const diffInDays = diffInMilliseconds / (1000 * 60 * 60 * 24) + 1 //
// // console.log(`${diffInDays}`)
// // console.log('', val.amount / diffInDays)
// val.dailyCapacity = (val.amount / diffInDays).toFixed(2)
// }
// }
/** 删除子项操作 */
const onDeleteItem = async (index) => {
formData.value.taskDispatchDetails.splice(index, 1)
@ -378,31 +364,29 @@ const onDeleteItem = async (index) => {
//
const ratiodialogref = ref()
const openratioDetail = (val, index) => {
if (val.owners == undefined) {
message.error('请先选择责任人')
} else {
const datalist: any = []
// console.log(val.ratioSettings)
// const openratioDetail = (val, index) => {
// if (val.owners == undefined) {
// message.error('')
// } else {
// const datalist: any = []
// // console.log(val.ratioSettings)
for (var i = 0; i < val.owners.length; i++) {
let ratios = val.ratioSettings[i] ? Reflect.get(val.ratioSettings[i], 'ratio') : undefined
datalist.push({
id: undefined,
detailOwnerId: val.id,
owner: val.owners[i],
ownerNames: val.ownerNames[i],
ratio: ratios
})
}
ratiodialogref.value.open(datalist, val.id, index)
}
}
// for (var i = 0; i < val.owners.length; i++) {
// let ratios = val.ratioSettings[i] ? Reflect.get(val.ratioSettings[i], 'ratio') : undefined
// datalist.push({
// id: undefined,
// detailOwnerId: val.id,
// owner: val.owners[i],
// ownerNames: val.ownerNames[i],
// ratio: ratios
// })
// }
// ratiodialogref.value.open(datalist, val.id, index)
// }
// }
//
const handlratioClick = (vals) => {
// console.log(vals)
formData.value.taskDispatchDetails[vals.index].ratioSettings = [...vals.ratioSettingss]
// console.log(formData.value.taskDispatchDetails[vals.index].ratioResults,'--------------');
}
//
@ -413,8 +397,8 @@ const userDialogref = ref()
const openuserDialog = (index) => {
userDialogref.value.open(index)
}
const ownerIds = ref([])
const ownerNames = ref([])
// const ownerIds = ref([])
// const ownerNames = ref([])
const handleuserClick = (val, index) => {
// reactive
formData.value.taskDispatchDetails[index].owners = val.map((item) => item.id)
@ -422,19 +406,19 @@ const handleuserClick = (val, index) => {
}
const handleSelectedProcedure = async (row: any, newValue: any) => {
// console.log(row, newValue);
if (newValue) {
row.procedureId = newValue.id
// row.procedureCode = newValue.code
// row.isReport = newValue.isReport
row.workTime=newValue.standard1Time*sum.value
} else {
row.procedureId = undefined
// row.procedureCode = undefined
// row.isReport = undefined
row.workTime=undefined
}
}
const handleSelectedUser = (currentIndex, newValue: any) => {
formData.value.taskDispatchDetails[currentIndex].owner = newValue?.id
}
// const handleSelectedUser = (currentIndex, newValue: any) => {
// formData.value.taskDispatchDetails[currentIndex].owner = newValue?.id
// }
const handleSelectedequip = (currentIndex: number, newValue: any) => {
formData.value.taskDispatchDetails[currentIndex].deviceModel = newValue?.id

@ -335,6 +335,7 @@ const clearSelections = (multipleSelection: []) => {
}
const Dispatchingref = ref()
const fuid = ref([])
const fusum = ref(0)
const openDispatching = () => {
if (multipleSelection.value.length === 0) {
message.warning('请至少选择一条数据')
@ -348,11 +349,13 @@ const openDispatching = () => {
}
fuid.value = []
fusum.value = 0
multipleSelection.value.filter((item) => {
fuid.value.push(item.id)
fusum.value += item.amount
})
// console.log(fuid.value);
Dispatchingref.value.open(fuid.value)
// console.log(fuid.value, fusum.value)
Dispatchingref.value.open(fuid.value, fusum.value)
}
const formData = ref({

Loading…
Cancel
Save