|
|
|
@ -1,5 +1,17 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<Dialog v-model="previewVisible" title="排产甘特图预览" width="100%" align-center>
|
|
|
|
<Dialog v-model="previewVisible" title="排产甘特图预览" width="100%" align-center>
|
|
|
|
|
|
|
|
<div class="preview-options">
|
|
|
|
|
|
|
|
<el-form :inline="true">
|
|
|
|
|
|
|
|
<el-form-item label="领料人">
|
|
|
|
|
|
|
|
<el-select v-model="scheduleOptions.workerId" clearable filterable placeholder="请选择领料人" style="width: 200px">
|
|
|
|
|
|
|
|
<el-option v-for="item in workerList" :key="item.id" :label="item.nickname" :value="item.id" />
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="是否计算损耗">
|
|
|
|
|
|
|
|
<el-switch v-model="scheduleOptions.isCalculateLoss" />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<ScheduleGanttPanelEditable :schedule-list="previewScheduleList" height="800px" />
|
|
|
|
<ScheduleGanttPanelEditable :schedule-list="previewScheduleList" height="800px" />
|
|
|
|
<template #footer>
|
|
|
|
<template #footer>
|
|
|
|
<el-button type="primary" :loading="previewSaveLoading" @click="handlePreviewSave">保存</el-button>
|
|
|
|
<el-button type="primary" :loading="previewSaveLoading" @click="handlePreviewSave">保存</el-button>
|
|
|
|
@ -10,6 +22,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { PlanApi } from '@/api/mes/plan'
|
|
|
|
import { PlanApi } from '@/api/mes/plan'
|
|
|
|
|
|
|
|
import * as UserApi from '@/api/system/user'
|
|
|
|
import ScheduleGanttPanelEditable from './ScheduleGanttPanelEditable.vue'
|
|
|
|
import ScheduleGanttPanelEditable from './ScheduleGanttPanelEditable.vue'
|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
|
|
|
|
|
|
|
@ -28,11 +41,31 @@ const emit = defineEmits<{
|
|
|
|
const message = useMessage()
|
|
|
|
const message = useMessage()
|
|
|
|
const previewSaveLoading = ref(false)
|
|
|
|
const previewSaveLoading = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const workerList = ref<UserApi.UserVO[]>([])
|
|
|
|
|
|
|
|
const scheduleOptions = reactive({
|
|
|
|
|
|
|
|
workerId: undefined as number | undefined,
|
|
|
|
|
|
|
|
isCalculateLoss: true
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const loadWorkerList = async () => {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
workerList.value = await UserApi.getSimpleUserList()
|
|
|
|
|
|
|
|
} catch {
|
|
|
|
|
|
|
|
workerList.value = []
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const previewVisible = computed({
|
|
|
|
const previewVisible = computed({
|
|
|
|
get: () => props.modelValue,
|
|
|
|
get: () => props.modelValue,
|
|
|
|
set: (value: boolean) => emit('update:modelValue', value)
|
|
|
|
set: (value: boolean) => emit('update:modelValue', value)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(previewVisible, (visible) => {
|
|
|
|
|
|
|
|
if (visible && workerList.value.length === 0) {
|
|
|
|
|
|
|
|
loadWorkerList()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const previewScheduleList = computed(() => (Array.isArray(props.scheduleList) ? props.scheduleList : []))
|
|
|
|
const previewScheduleList = computed(() => (Array.isArray(props.scheduleList) ? props.scheduleList : []))
|
|
|
|
|
|
|
|
|
|
|
|
const handlePreviewSave = async () => {
|
|
|
|
const handlePreviewSave = async () => {
|
|
|
|
@ -56,7 +89,8 @@ const handlePreviewSave = async () => {
|
|
|
|
planStartTime: startValue.isValid() ? startValue.valueOf() : undefined,
|
|
|
|
planStartTime: startValue.isValid() ? startValue.valueOf() : undefined,
|
|
|
|
planEndTime: endValue.isValid() ? endValue.valueOf() : undefined,
|
|
|
|
planEndTime: endValue.isValid() ? endValue.valueOf() : undefined,
|
|
|
|
reyaNumber: Number(plan?.reyaNumber ?? plan?.planNumber ?? 0),
|
|
|
|
reyaNumber: Number(plan?.reyaNumber ?? plan?.planNumber ?? 0),
|
|
|
|
workerId: plan?.workerId,
|
|
|
|
workerId: scheduleOptions.workerId ?? plan?.workerId,
|
|
|
|
|
|
|
|
isCalculateLoss: scheduleOptions.isCalculateLoss,
|
|
|
|
feedingPipeline: plan?.feedingPipeline ?? device?.deviceId,
|
|
|
|
feedingPipeline: plan?.feedingPipeline ?? device?.deviceId,
|
|
|
|
deviceId: device?.deviceId ?? plan?.deviceId,
|
|
|
|
deviceId: device?.deviceId ?? plan?.deviceId,
|
|
|
|
deliveryDate: deliveryDateValue.isValid() ? deliveryDateValue.valueOf() : undefined,
|
|
|
|
deliveryDate: deliveryDateValue.isValid() ? deliveryDateValue.valueOf() : undefined,
|
|
|
|
|