This commit is contained in:
zlwu committed 2026-06-26 22:33:05 +08:00
1 parent 0c7034e932
commit 4daf990fab
39 files changed
+3303 -3084

No files matched your search

@@ -0,0 +1,75 @@
<template>
<div v-if="!readonly" class="step-detail-action-bar">
<template v-if="editor.mode.value === 'execution' && editor.selectedStep.value">
<el-tag
:type="editor.stepStatusTag(editor.selectedStep.value.stepStatus || 'dzx').type"
size="small"
>
{{ editor.stepStatusTag(editor.selectedStep.value.stepStatus || 'dzx').label }}
</el-tag>
<el-button
v-if="
editor.mode.value === 'execution' &&
editor.canEditStep(editor.selectedStep.value) &&
editor.selectedStep.value.stepStatus === 'dzx'
"
class="btn-main task-exec-toolbar-btn"
type="primary"
:loading="editor.stepActionLoading.value"
:disabled="editor.manualSaveLoading.value"
@click="editor.handleStartStep(editor.selectedStep.value)"
>
<el-icon><VideoPlay /></el-icon>执行此步骤
</el-button>
<el-button
v-if="
editor.mode.value === 'execution' &&
editor.canEditStep(editor.selectedStep.value) &&
editor.selectedStep.value.stepStatus === 'jxz'
"
class="btn-main task-exec-toolbar-btn"
type="success"
:loading="editor.stepActionLoading.value"
:disabled="editor.manualSaveLoading.value"
@click="editor.handleCompleteStep(editor.selectedStep.value)"
>
<el-icon><Check /></el-icon>完成步骤
</el-button>
</template>
<el-button
v-if="
editor.selectedStep.value &&
(editor.canEditStep(editor.selectedStep.value) ||
(editor.canEditStepDispatch() && !readonly))
"
class="task-exec-toolbar-btn task-exec-save-btn"
type="danger"
:loading="editor.manualSaveLoading.value"
:disabled="editor.stepActionLoading.value"
@click="editor.handleManualSave"
>
<el-icon><Check /></el-icon>保存
</el-button>
</div>
</template>
<script setup lang="ts">
import { Check, VideoPlay } from '@element-plus/icons-vue'
import { useTaskStepEditor } from './useTaskStepEditor'
defineOptions({ name: 'StepDetailActionBar' })
defineProps<{
editor: ReturnType<typeof useTaskStepEditor>
readonly?: boolean
}>()
</script>
<style scoped lang="scss">
.step-detail-action-bar {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
@@ -2,59 +2,9 @@
<template>
<div class="route-config-right">
<template v-if="editor.selectedStep.value">
<div class="route-config-right-header">
<div v-if="!hideHeader" class="route-config-right-header">
<h3>步骤详情</h3>
<div v-if="!readonly" class="step-status-bar">
<template v-if="editor.mode.value === 'execution' && editor.selectedStep.value">
<el-tag
:type="editor.stepStatusTag(editor.selectedStep.value.stepStatus || 'dzx').type"
size="small"
>
{{ editor.stepStatusTag(editor.selectedStep.value.stepStatus || 'dzx').label }}
</el-tag>
<el-button
v-if="
editor.mode.value === 'execution' &&
editor.canEditStep(editor.selectedStep.value) &&
editor.selectedStep.value.stepStatus === 'dzx'
"
class="btn-main task-exec-toolbar-btn"
type="primary"
:loading="editor.stepActionLoading.value"
:disabled="editor.manualSaveLoading.value"
@click="editor.handleStartStep(editor.selectedStep.value)"
>
<el-icon><VideoPlay /></el-icon>执行此步骤
</el-button>
<el-button
v-if="
editor.mode.value === 'execution' &&
editor.canEditStep(editor.selectedStep.value) &&
editor.selectedStep.value.stepStatus === 'jxz'
"
class="btn-main task-exec-toolbar-btn"
type="success"
:loading="editor.stepActionLoading.value"
:disabled="editor.manualSaveLoading.value"
@click="editor.handleCompleteStep(editor.selectedStep.value)"
>
<el-icon><Check /></el-icon>完成步骤
</el-button>
</template>
<el-button
v-if="
editor.canEditStep(editor.selectedStep.value) ||
(editor.canEditStepDispatch() && !readonly)
"
class="btn-main task-exec-toolbar-btn"
type="primary"
:loading="editor.manualSaveLoading.value"
:disabled="editor.stepActionLoading.value"
@click="editor.handleManualSave"
>
<el-icon><Check /></el-icon>保存
</el-button>
</div>
<StepDetailActionBar :editor="editor" :readonly="readonly" />
</div>
<div class="route-config-right-body">
<el-form label-position="top" class="route-config-step-form">
@@ -934,16 +884,19 @@
<script setup lang="ts">
import { computed } from 'vue'
import { Check, Delete, Plus, Rank, VideoPlay } from '@element-plus/icons-vue'
import { Delete, Plus, Rank } from '@element-plus/icons-vue'
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import { SHOW_PROCESS_REAGENT_CONSUMABLE } from '@/utils/process-material-ui'
import { formatPlannedStartDate } from '@/utils/production-labels'
import StepDetailActionBar from './StepDetailActionBar.vue'
import { useTaskStepEditor } from './useTaskStepEditor'
const props = defineProps<{
editor: ReturnType<typeof useTaskStepEditor>
readonly?: boolean
/** 任务执行弹窗:标题与按钮栏由外层固定,面板仅渲染表单内容 */
hideHeader?: boolean
}>()
/** 弹窗可编辑但当前步骤非本人负责(mine 执行)时为只读 */
@@ -1026,11 +979,10 @@
<style scoped lang="scss">
@use '../../../styles/route-config' as *;
.step-status-bar {
display: flex;
align-items: center;
gap: 8px;
margin-left: 12px;
.route-config-right-header {
:deep(.step-detail-action-bar) {
margin-left: 12px;
}
}
/* 4 列栅格下各占半行(2/4 列) */
@@ -326,14 +326,24 @@
:items="editor.taskOutputs.value"
:loading="false"
:disabled="readonly"
:saving="editor.outputSaving.value"
hide-save-footer
:unit-options="editor.itemUnitOptions.value"
:unit-options-loading="editor.itemUnitOptionsLoading.value"
@update:items="(items: Record<string, any>[]) => (editor.taskOutputs.value = items)"
@search-unit="(q: string) => editor.searchItemUnitOptions(q)"
@save="editor.saveTaskOutputs"
/>
</div>
<div v-if="!readonly" class="execution-detail-step-footer">
<el-button
class="task-exec-toolbar-btn task-exec-save-btn"
type="danger"
:loading="editor.outputSaving.value"
@click="editor.saveTaskOutputs"
>
<el-icon><Check /></el-icon>
保存
</el-button>
</div>
</template>
<!-- 线下纸质文档 -->
@@ -345,16 +355,47 @@
<TaskPaperAttachmentsPanel
:attachments="editor.taskAttachments.value"
:disabled="readonly"
:saving="editor.attachmentSaving.value"
hide-save-footer
@update:attachments="(items) => (editor.taskAttachments.value = items)"
@save="editor.saveTaskAttachments"
/>
</div>
<div v-if="!readonly" class="execution-detail-step-footer">
<el-button
class="task-exec-toolbar-btn task-exec-save-btn"
type="danger"
:loading="editor.attachmentSaving.value"
@click="editor.saveTaskAttachments"
>
<el-icon><Check /></el-icon>
保存
</el-button>
</div>
</template>
<!-- 步骤详情 -->
<template v-else>
<StepDetailPanel :editor="editor" :readonly="readonly" />
<template v-if="editor.selectedStep.value">
<div class="execution-detail-header">
<h3>
步骤详情
<span
v-if="editor.selectedStep.value.processName"
class="execution-detail-subtitle"
>
— {{ editor.selectedStep.value.processName }}
</span>
</h3>
</div>
</template>
<div class="execution-detail-body execution-detail-body--step">
<StepDetailPanel :editor="editor" :readonly="readonly" hide-header />
</div>
<div
v-if="editor.selectedStep.value && !readonly"
class="execution-detail-step-footer"
>
<StepDetailActionBar :editor="editor" :readonly="readonly" />
</div>
</template>
</div>
</div>
@@ -384,6 +425,7 @@
import { VueDraggable as draggable } from 'vue-draggable-plus'
import { useTaskStepEditor } from './useTaskStepEditor'
import StepDetailPanel from './StepDetailPanel.vue'
import StepDetailActionBar from './StepDetailActionBar.vue'
import TaskInputEnhancedTable from './TaskInputEnhancedTable.vue'
import TaskOutputList from './TaskOutputList.vue'
import TaskPaperAttachmentsPanel from './TaskPaperAttachmentsPanel.vue'
@@ -794,6 +836,7 @@
align-items: center;
justify-content: space-between;
flex-shrink: 0;
background: #fff;
h3 {
margin: 0;
font-size: 14px;
@@ -801,6 +844,19 @@
color: #1e293b;
}
}
.execution-detail-subtitle {
font-weight: 500;
color: var(--mint-text-muted, #64748b);
}
.execution-detail-step-footer {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 12px 16px;
border-top: 1px solid #e5e7eb;
background: #fff;
}
.execution-detail-actions {
display: flex;
gap: 8px;
@@ -810,6 +866,18 @@
min-height: 0;
overflow-y: auto;
padding: 16px;
&.execution-detail-body--step {
padding: 0;
overflow: hidden;
display: flex;
flex-direction: column;
:deep(.route-config-right) {
flex: 1;
min-height: 0;
}
}
}
.section-bar {
@@ -863,5 +931,37 @@
font-size: 14px;
}
}
.task-exec-save-btn.el-button:not(.el-button--text):not(.el-button--link) {
--el-button-bg-color: #dc2626;
--el-button-border-color: #dc2626;
--el-button-hover-bg-color: #b91c1c;
--el-button-hover-border-color: #b91c1c;
--el-button-active-bg-color: #991b1b;
--el-button-active-border-color: #991b1b;
color: #fff !important;
background: #dc2626 !important;
border-color: #dc2626 !important;
&:hover,
&:focus {
color: #fff !important;
background: #b91c1c !important;
border-color: #b91c1c !important;
}
&:active {
color: #fff !important;
background: #991b1b !important;
border-color: #991b1b !important;
}
&.is-disabled,
&.is-disabled:hover {
color: #fff !important;
background: #fca5a5 !important;
border-color: #fca5a5 !important;
}
}
}
</style>
@@ -160,8 +160,8 @@
<div v-if="!disabled" class="list-save-footer">
<el-button
class="btn-main task-exec-toolbar-btn"
type="primary"
class="task-exec-toolbar-btn task-exec-save-btn"
type="danger"
:loading="saving"
@click="emit('save')"
>
@@ -94,10 +94,10 @@
</div>
</div>
<div v-if="!disabled" class="list-save-footer">
<div v-if="!disabled && !hideSaveFooter" class="list-save-footer">
<el-button
class="btn-main task-exec-toolbar-btn"
type="primary"
class="task-exec-toolbar-btn task-exec-save-btn"
type="danger"
:loading="saving"
@click="emit('save')"
>
@@ -130,8 +130,10 @@
unitOptionsLoading: boolean
disabled?: boolean
saving?: boolean
/** 任务执行弹窗:保存按钮由外层底栏承载 */
hideSaveFooter?: boolean
}>(),
{ disabled: false, saving: false }
{ disabled: false, saving: false, hideSaveFooter: false }
)
const emit = defineEmits<{
@@ -114,7 +114,7 @@
v-model="formData.viability"
:min="0"
:max="100"
:precision="1"
:step="0.01"
controls-position="right"
style="width: 100%"
/>
@@ -227,7 +227,7 @@
v-model="row.viability"
:min="0"
:max="100"
:precision="1"
:step="0.01"
controls-position="right"
style="width: 100%"
/>
@@ -18,10 +18,10 @@
/>
</template>
<div v-if="!disabled" class="list-save-footer">
<div v-if="!disabled && !hideSaveFooter" class="list-save-footer">
<el-button
class="btn-main task-exec-toolbar-btn"
type="primary"
class="task-exec-toolbar-btn task-exec-save-btn"
type="danger"
:loading="saving"
@click="emit('save')"
>
@@ -46,8 +46,10 @@
attachments: FinanceAttachmentItem[]
disabled?: boolean
saving?: boolean
/** 任务执行弹窗:保存按钮由外层底栏承载 */
hideSaveFooter?: boolean
}>(),
{ disabled: false, saving: false }
{ disabled: false, saving: false, hideSaveFooter: false }
)
const emit = defineEmits<{
@@ -1595,6 +1595,18 @@ export function useTaskStepEditor() {
return null
}
function validateAllStepsComplete(): string | null {
if (!stepList.value.length) return null
const pending = stepList.value.filter((s) => s.stepStatus !== 'ywc')
if (!pending.length) return null
const preview = pending
.slice(0, 3)
.map((s) => s.processName || '未命名步骤')
.join('、')
const suffix = pending.length > 3 ? ` 等 ${pending.length} 个步骤` : ''
return `尚有未完成的工艺步骤(${preview}${suffix}),请完成全部步骤后再完成任务`
}
const completeConclusionVisible = ref(false)
const completeConclusionIsEdit = ref(false)
const completeConclusionInitial = reactive({ conclusion: '', remark: '' })
@@ -1612,6 +1624,11 @@ export function useTaskStepEditor() {
await ElMessageBox.alert(ioErr, '无法完成任务', { type: 'warning' })
return
}
const stepErr = validateAllStepsComplete()
if (stepErr) {
await ElMessageBox.alert(stepErr, '无法完成任务', { type: 'warning' })
return
}
}
completeConclusionVisible.value = true
}