|
|
@ -423,8 +423,17 @@
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column fixed="right" label="操作" align="center" min-width="100">
|
|
|
|
<el-table-column fixed="right" label="操作" align="center" min-width="120">
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
v-if="'detail' != active && scope.row.procedureStatus == 0"
|
|
|
|
|
|
|
|
link
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
|
|
@click.prevent="openratioDetail(scope.row, scope.$index)"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
编辑
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
|
v-if="'detail' != active && scope.row.procedureStatus == 0"
|
|
|
|
v-if="'detail' != active && scope.row.procedureStatus == 0"
|
|
|
|
link
|
|
|
|
link
|
|
|
@ -505,6 +514,7 @@
|
|
|
|
</el-card>
|
|
|
|
</el-card>
|
|
|
|
<UserDialog ref="userDialogref" @success="handleuserClick" />
|
|
|
|
<UserDialog ref="userDialogref" @success="handleuserClick" />
|
|
|
|
<ProductFrom ref="productref" @success="handleproductClick" />
|
|
|
|
<ProductFrom ref="productref" @success="handleproductClick" />
|
|
|
|
|
|
|
|
<Ratiodialog ref="ratiodialogref" @success="handlratioClick" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
@ -527,11 +537,12 @@ import { Search } from '@element-plus/icons-vue'
|
|
|
|
import * as ProcedureApi from '@/api/biz/procedure'
|
|
|
|
import * as ProcedureApi from '@/api/biz/procedure'
|
|
|
|
import UserDialog from './userselect.vue'
|
|
|
|
import UserDialog from './userselect.vue'
|
|
|
|
import ProductFrom from './productFrom.vue'
|
|
|
|
import ProductFrom from './productFrom.vue'
|
|
|
|
|
|
|
|
import Ratiodialog from './ratiodialog.vue'
|
|
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'TaskDispatchDetail' })
|
|
|
|
defineOptions({ name: 'TaskDispatchDetail' })
|
|
|
|
const goEasy: any = inject('goEasy')
|
|
|
|
const goEasy: any = inject('goEasy')
|
|
|
|
|
|
|
|
|
|
|
|
const reload = inject('reload')
|
|
|
|
const reload: any = inject('reload')
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
const commonStore = useCommonStore()
|
|
|
|
const commonStore = useCommonStore()
|
|
|
@ -636,12 +647,8 @@ const queryData = async (id?: number) => {
|
|
|
|
formLoading.value = true
|
|
|
|
formLoading.value = true
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
formData.value = await TaskDispatchApi.getTaskDispatch(id)
|
|
|
|
formData.value = await TaskDispatchApi.getTaskDispatch(id)
|
|
|
|
|
|
|
|
|
|
|
|
// formData.value.spec=await MaterialApi.getMaterial(formData.value.projectSubId)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
formData.value.taskDispatchDetails =
|
|
|
|
formData.value.taskDispatchDetails =
|
|
|
|
await TaskDispatchApi.getTaskDispatchDetailListByDispatchId(id)
|
|
|
|
await TaskDispatchApi.getTaskDispatchDetailListByDispatchId(id)
|
|
|
|
// formData.value.bomCode = 'BOM-' + formData.value.projectSubCode
|
|
|
|
|
|
|
|
formData.value.taskDispatchDetails.forEach((item) => {
|
|
|
|
formData.value.taskDispatchDetails.forEach((item) => {
|
|
|
|
const startDate = new Date(item.startTime)
|
|
|
|
const startDate = new Date(item.startTime)
|
|
|
|
const endDate = new Date(item.endTime)
|
|
|
|
const endDate = new Date(item.endTime)
|
|
|
@ -649,9 +656,8 @@ const queryData = async (id?: number) => {
|
|
|
|
const diffInMilliseconds = endDate.getTime() - startDate.getTime()
|
|
|
|
const diffInMilliseconds = endDate.getTime() - startDate.getTime()
|
|
|
|
// 将时间差转换为天数
|
|
|
|
// 将时间差转换为天数
|
|
|
|
const diffInDays = diffInMilliseconds / (1000 * 60 * 60 * 24) + 1 // 转换公式
|
|
|
|
const diffInDays = diffInMilliseconds / (1000 * 60 * 60 * 24) + 1 // 转换公式
|
|
|
|
// console.log(`预计结束日期与预计开始日期相差${diffInDays}天`)
|
|
|
|
|
|
|
|
// console.log('每日产能', val.amount / diffInDays)
|
|
|
|
|
|
|
|
item.dailyCapacity = (item.amount / diffInDays).toFixed(2)
|
|
|
|
item.dailyCapacity = (item.amount / diffInDays).toFixed(2)
|
|
|
|
|
|
|
|
item.ratioSettings = []
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if (formData.value.dispatchStatus == 2) {
|
|
|
|
if (formData.value.dispatchStatus == 2) {
|
|
|
@ -713,21 +719,6 @@ const submitForm = async (operate) => {
|
|
|
|
if (operate == 'SUBMIT') {
|
|
|
|
if (operate == 'SUBMIT') {
|
|
|
|
jumpActive = 'detail'
|
|
|
|
jumpActive = 'detail'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// goEasy.publish({
|
|
|
|
|
|
|
|
// channel: 'mayJoysChannel',
|
|
|
|
|
|
|
|
// message: 'Hello, GoEasy!'
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// goEasy.pubsub.publish({
|
|
|
|
|
|
|
|
// channel: "mayJoysChannel",
|
|
|
|
|
|
|
|
// message: 'Hello, GoEasy!',
|
|
|
|
|
|
|
|
// // onSuccess: function () {
|
|
|
|
|
|
|
|
// // content.value = "";
|
|
|
|
|
|
|
|
// // console.log("send message success");
|
|
|
|
|
|
|
|
// // },
|
|
|
|
|
|
|
|
// // onFailed: function (error) {
|
|
|
|
|
|
|
|
// // unshiftMessage("消息发送失败,错误编码:" + error.code + " 错误信息:" + error.content);
|
|
|
|
|
|
|
|
// // }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
commonStore.setStore('active', jumpActive)
|
|
|
|
commonStore.setStore('active', jumpActive)
|
|
|
|
commonStore.setStore('id', dataId)
|
|
|
|
commonStore.setStore('id', dataId)
|
|
|
|
reload()
|
|
|
|
reload()
|
|
|
@ -749,7 +740,8 @@ const onAddItem = () => {
|
|
|
|
status: 1,
|
|
|
|
status: 1,
|
|
|
|
procedureStatus: 0,
|
|
|
|
procedureStatus: 0,
|
|
|
|
dispatchId: undefined,
|
|
|
|
dispatchId: undefined,
|
|
|
|
dailyCapacity: undefined
|
|
|
|
dailyCapacity: undefined,
|
|
|
|
|
|
|
|
ratioSettings: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
row.amount = formData.value.amount
|
|
|
|
row.amount = formData.value.amount
|
|
|
|
row.dispatchId = formData.value.id
|
|
|
|
row.dispatchId = formData.value.id
|
|
|
@ -765,6 +757,30 @@ const goback = () => {
|
|
|
|
router.back()
|
|
|
|
router.back()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//编辑工时
|
|
|
|
|
|
|
|
const ratiodialogref = ref()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 删除子项操作 */
|
|
|
|
/** 删除子项操作 */
|
|
|
|
const onDeleteItem = async (index) => {
|
|
|
|
const onDeleteItem = async (index) => {
|
|
|
|
let deletedItems = formData.value.taskDispatchDetails.splice(index, 1)
|
|
|
|
let deletedItems = formData.value.taskDispatchDetails.splice(index, 1)
|
|
|
@ -793,7 +809,6 @@ const handleuserClick = (val, index) => {
|
|
|
|
// console.log(formData.value.taskDispatchDetails[index].ownerNames);
|
|
|
|
// console.log(formData.value.taskDispatchDetails[index].ownerNames);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const handleproductClick = (vals) => {
|
|
|
|
const handleproductClick = (vals) => {
|
|
|
|
console.log(vals)
|
|
|
|
|
|
|
|
vals.forEach((item) => {
|
|
|
|
vals.forEach((item) => {
|
|
|
|
item.id = undefined
|
|
|
|
item.id = undefined
|
|
|
|
item.amount = formData.value.amount
|
|
|
|
item.amount = formData.value.amount
|
|
|
@ -805,6 +820,12 @@ const handleproductClick = (vals) => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handlratioClick = (vals) => {
|
|
|
|
|
|
|
|
// console.log(vals)
|
|
|
|
|
|
|
|
formData.value.taskDispatchDetails[vals.index].ratioSettings = [...vals.ratioSettingss]
|
|
|
|
|
|
|
|
// console.log(formData.value.taskDispatchDetails[vals.index].ratioResults,'--------------');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleSelectedProcedure = async (row: any, newValue: any) => {
|
|
|
|
const handleSelectedProcedure = async (row: any, newValue: any) => {
|
|
|
|
if (newValue) {
|
|
|
|
if (newValue) {
|
|
|
|
row.procedureId = newValue.id
|
|
|
|
row.procedureId = newValue.id
|
|
|
|