| | |
| | | 开始生产 |
| | | </BigButton> |
| | | <template v-if="task?.Procedure.Status === 2 || task?.Procedure.Status === 3"> |
| | | <BigButton class="btn" bg-color="#ff9933">打印</BigButton> |
| | | <BigButton class="btn" bg-color="#00cc33">报工</BigButton> |
| | | <BigButton class="btn" bg-color="#ff9933" :disabled="task?.Procedure.Status === 3">打印</BigButton> |
| | | <BigButton class="btn" bg-color="#00cc33" :disabled="task?.Procedure.Status === 3" @click="openReportModal"> |
| | | 报工 |
| | | </BigButton> |
| | | <el-popconfirm |
| | | width="340" |
| | | confirm-button-text="确定" |
| | |
| | | @confirm="finishTaskProduce" |
| | | > |
| | | <template #reference> |
| | | <BigButton class="btn" bg-color="#ff0000">完成</BigButton> |
| | | <BigButton class="btn" bg-color="#ff0000" :disabled="task?.Procedure.Status === 3">完成</BigButton> |
| | | </template> |
| | | </el-popconfirm> |
| | | </template> |
| | | </div> |
| | | </div> |
| | | <TaskControlModal |
| | | v-model="showTaskControlModal" |
| | | :task="task" |
| | | @produce-start="emit('shouldReload', task)" |
| | | ></TaskControlModal> |
| | | <TaskControlModal v-model="showTaskControlModal" :task="task" @produce-start="onProduceStart"></TaskControlModal> |
| | | <ReportProductionModal |
| | | v-model="showReportModal" |
| | | @close="showReportModal = false" |
| | | @submit="showReportModal = false" |
| | | ></ReportProductionModal> |
| | | </template> |
| | | <script setup lang="ts"> |
| | | import type { Task } from '@/api/task' |
| | |
| | | import { CircleCloseFilled } from '@element-plus/icons-vue' |
| | | import { finishTask } from '@/api' |
| | | import { ElMessage } from 'element-plus' |
| | | import ReportProductionModal from '@/views/dashboard/components/ReportProductionModal.vue' |
| | | |
| | | const props = defineProps<{ |
| | | task?: Task |
| | |
| | | * 完成任务 |
| | | */ |
| | | function finishTaskProduce() { |
| | | if (task?.value?.Procedure?.ID) { |
| | | if (task?.value && task.value?.Procedure?.ID) { |
| | | finishTask({ id: task!.value.Procedure.ID }).then( |
| | | (res) => { |
| | | ElMessage({ |
| | | message: '操作成功!', |
| | | type: 'success' |
| | | }) |
| | | emit('shouldReload', task.value) |
| | | emit('shouldReload', task.value as Task) |
| | | }, |
| | | (err) => { |
| | | console.error(err) |
| | |
| | | } |
| | | } |
| | | |
| | | function onProduceStart() { |
| | | emit('shouldReload', task!.value as Task) |
| | | } |
| | | |
| | | /** |
| | | * 格式化时间戳 |
| | | * @param timestamp 后端返的10位时间戳 |
| | |
| | | if (!timestamp) { |
| | | return '--' |
| | | } |
| | | const time = useDateFormat(timestamp * 1000, 'YYYY-MM-DD', { locales: 'zh-cn' }) |
| | | const time = useDateFormat(timestamp * 1000, 'YYYY-MM-DD HH:mm:ss', { locales: 'zh-cn' }) |
| | | return time.value |
| | | } |
| | | // 报工 |
| | | const showReportModal = ref(false) |
| | | function openReportModal() { |
| | | showReportModal.value = true |
| | | } |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | $title-text-color: #9599af; |