feat:生产报表-添加详情页
parent
c09828701a
commit
b0c7be253f
@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<div v-loading="detailLoading" class="production-report-detail-body">
|
||||
<el-descriptions :column="3" class="production-report-detail-desc">
|
||||
<el-descriptions-item :label="t('ProductionReport.Index.tableCode')">
|
||||
{{ detailData?.code ?? '' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('ProductionReport.Index.tableOrderDate')">
|
||||
{{ formatDetailDate(detailData?.orderDate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('ProductionReport.Index.tableDeliveryDate')">
|
||||
{{ formatDetailDate(detailData?.deliveryDate ?? detailData?.finishDate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('ProductionReport.Index.tableStatus')">
|
||||
<dict-tag :type="DICT_TYPE.MES_TASK_STATUS" :value="detailData?.status" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('ProductionReport.Index.tableIsScheduled')">
|
||||
<el-tag :type="detailData?.isScheduled ? 'success' : 'info'">
|
||||
{{ detailData?.isScheduled ? t('ProductionReport.Index.yes') : t('ProductionReport.Index.no') }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('ProductionReport.Index.tableProductionProgress')">
|
||||
<div class="production-progress-cell">
|
||||
<el-progress
|
||||
type="circle"
|
||||
:percentage="productionProgress"
|
||||
:width="40"
|
||||
:stroke-width="4"
|
||||
:show-text="false"
|
||||
:color="productionProgress === 100 ? '#67c23a' : undefined"
|
||||
/>
|
||||
<span class="production-progress-text">{{ productionProgress }}%</span>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('ProductionReport.Index.tableRemark')" :span="3">
|
||||
{{ detailData?.remark ?? '' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<div class="production-report-detail-tabs">
|
||||
<el-tabs v-model="activeTabName" class="mt-12px">
|
||||
<el-tab-pane :label="t('ProductionReport.Index.detailTabBasicInfo')" name="basicInfo">
|
||||
<ProductionReportBasicInfo :task-id="taskId" :task-delivery-date="detailData?.deliveryDate" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="t('ProductionReport.Index.detailTabRelatedPlan')" name="relatedPlan">
|
||||
<ProductionReportRelatedPlan :task-id="taskId" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="t('ProductionReport.Index.detailTabQualityInfo')" name="qualityInfo">
|
||||
<ProductionReportQualityInfo :task-id="taskId" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="t('ProductionReport.Index.detailTabBaogongInfo')" name="baogongInfo">
|
||||
<ProductionReportBaogongInfo :task-id="taskId" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { TaskApi, TaskVO } from '@/api/mes/task'
|
||||
import ProductionReportBasicInfo from '../components/ProductionReportBasicInfo.vue'
|
||||
import ProductionReportRelatedPlan from '../components/ProductionReportRelatedPlan.vue'
|
||||
import ProductionReportQualityInfo from '../components/ProductionReportQualityInfo.vue'
|
||||
import ProductionReportBaogongInfo from '../components/ProductionReportBaogongInfo.vue'
|
||||
import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||
|
||||
defineOptions({ name: 'MesProductionReportDetail' })
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
const route = useRoute()
|
||||
const { delView } = useTagsViewStore()
|
||||
const { currentRoute } = useRouter()
|
||||
|
||||
const taskId = computed(() => Number(route.params.id))
|
||||
const detailLoading = ref(false)
|
||||
const detailData = ref<TaskVO | null>(null)
|
||||
const activeTabName = ref('basicInfo')
|
||||
|
||||
const formatDetailDate = (value: any) => {
|
||||
if (!value) return ''
|
||||
return formatDate(new Date(value), 'YYYY-MM-DD')
|
||||
}
|
||||
|
||||
const productionProgress = computed(() => {
|
||||
const storedPlanNumber = Number(detailData.value?.storedPlanNumber ?? 0)
|
||||
const totalNumber = Number(detailData.value?.totalNumber ?? detailData.value?.number ?? 0)
|
||||
if (!Number.isFinite(storedPlanNumber) || !Number.isFinite(totalNumber) || totalNumber <= 0) return 0
|
||||
const rawPercent = (storedPlanNumber / totalNumber) * 100
|
||||
return Math.max(0, Math.min(100, Number(rawPercent.toFixed(2))))
|
||||
})
|
||||
|
||||
const getDetail = async () => {
|
||||
if (!taskId.value) {
|
||||
message.warning(t('ProductionReport.Detail.invalidId'))
|
||||
delView(unref(currentRoute))
|
||||
return
|
||||
}
|
||||
detailLoading.value = true
|
||||
try {
|
||||
detailData.value = await TaskApi.getTask(taskId.value)
|
||||
} finally {
|
||||
detailLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getDetail()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.production-report-detail-body {
|
||||
max-height: 85vh;
|
||||
}
|
||||
|
||||
.production-report-detail-desc {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.production-report-detail-tabs {
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__content) {
|
||||
max-height: 65vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.production-progress-cell {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
flex-wrap: nowrap;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.production-progress-cell :deep(.el-progress-circle) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.production-progress-text {
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue