From 4e60ba038a1fbd0808a4cadd83e04606e6865bd4 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期二, 14 十一月 2023 10:14:47 +0800 Subject: [PATCH] 工艺信息的更新按钮加载更换方式 --- src/views/dashboard/components/TaskControl.vue | 35 ++++++++++++++++++++++++----------- 1 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/views/dashboard/components/TaskControl.vue b/src/views/dashboard/components/TaskControl.vue index 47b9945..e8e60e1 100644 --- a/src/views/dashboard/components/TaskControl.vue +++ b/src/views/dashboard/components/TaskControl.vue @@ -21,8 +21,10 @@ 寮�濮嬬敓浜� </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="纭畾" @@ -36,17 +38,18 @@ @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' @@ -57,6 +60,7 @@ 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 @@ -80,14 +84,14 @@ * 瀹屾垚浠诲姟 */ 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) @@ -105,6 +109,10 @@ } } +function onProduceStart() { + emit('shouldReload', task!.value as Task) +} + /** * 鏍煎紡鍖栨椂闂存埑 * @param timestamp 鍚庣杩旂殑10浣嶆椂闂存埑 @@ -113,9 +121,14 @@ 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; -- Gitblit v1.8.0