|
|
|
@ -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){
|
|
|
|
|
// // 确保startTime和endTime都是时间戳(这里假设它们已经是正确的Unix时间戳,单位为秒)
|
|
|
|
|
// 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
|
|
|
|
|