feat:添加生产报表页面
parent
75ab2d74d4
commit
20dee1da73
@ -0,0 +1,54 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog v-model="dialogVisible" title="产品信息" width="80%" @close="handleClose">
|
||||||
|
<el-table v-loading="loading" :data="productList" :stripe="true" :show-overflow-tooltip="true">
|
||||||
|
<el-table-column label="产品编码" align="center" prop="id" width="120px" />
|
||||||
|
<el-table-column label="产品名称" align="center" prop="productName" />
|
||||||
|
<el-table-column label="单位" align="center" prop="unitName" width="100px" />
|
||||||
|
<el-table-column label="物料编码" align="center" prop="bomId" width="120px" />
|
||||||
|
<el-table-column label="用量" align="center" prop="usageNumber" width="100px" />
|
||||||
|
<el-table-column label="良率%" align="center" prop="yieldRate" width="100px" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="是否启用" align="center" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag :type="scope.row.isEnable ? 'success' : 'danger'">
|
||||||
|
{{ scope.row.isEnable ? '是' : '否' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { BomApi } from '@/api/mes/bom'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ProductInfoDialog' })
|
||||||
|
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const loading = ref(false)
|
||||||
|
const productList = ref<any[]>([])
|
||||||
|
|
||||||
|
const open = async (productId: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await BomApi.getBomByProductId(productId)
|
||||||
|
productList.value = data || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch product info:', error)
|
||||||
|
productList.value = []
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
productList.value = []
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
<template>
|
||||||
|
<div class="baogong-info-container">
|
||||||
|
<el-table v-loading="loading" :data="baogongList" :stripe="true" :show-overflow-tooltip="true">
|
||||||
|
<el-table-column label="任务单编码" align="center" prop="taskCode" width="150px" />
|
||||||
|
<el-table-column label="计划编码" align="center" prop="planCode" width="150px" />
|
||||||
|
<el-table-column label="员工ID" align="center" prop="employeeId" width="120px" />
|
||||||
|
<el-table-column label="员工名称" align="center" prop="employeeName" width="120px" />
|
||||||
|
<el-table-column label="产品名称" align="center" prop="productName" />
|
||||||
|
<el-table-column label="产品编码" align="center" prop="productCode" width="120px" />
|
||||||
|
<el-table-column label="报工数量" align="center" prop="baogongNum" width="100px" />
|
||||||
|
<el-table-column label="合格数量" align="center" prop="passNum" width="100px" />
|
||||||
|
<el-table-column label="不合格数量" align="center" prop="noPassNum" width="100px" />
|
||||||
|
<el-table-column label="合格率%" align="center" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ ((scope.row.passRate || 0) * 100).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="不合格原因" align="center" prop="reason" />
|
||||||
|
<el-table-column label="报工时间" align="center" prop="baogongTime" width="180px">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatDateTime(scope.row.baogongTime) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
import { BaogongRecordApi } from '@/api/mes/baogongrecord'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ProductionReportBaogongInfo' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
taskId?: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const baogongList = ref<any[]>([])
|
||||||
|
const total = ref(0)
|
||||||
|
const queryParams = reactive({
|
||||||
|
taskId: undefined as number | undefined,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10
|
||||||
|
})
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
if (!queryParams.taskId) return
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await BaogongRecordApi.getBaogongRecordStatPage(queryParams)
|
||||||
|
baogongList.value = data?.list || []
|
||||||
|
total.value = data?.total || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch baogong info:', error)
|
||||||
|
baogongList.value = []
|
||||||
|
total.value = 0
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 监听任务ID变化 */
|
||||||
|
watch(
|
||||||
|
() => props.taskId,
|
||||||
|
(val: number | undefined) => {
|
||||||
|
if (!val) {
|
||||||
|
baogongList.value = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
queryParams.taskId = val as number
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
/** 格式化日期时间 */
|
||||||
|
const formatDateTime = (value: string | Date | null) => {
|
||||||
|
if (!value) return '-'
|
||||||
|
return dayjs(value).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.section-title {
|
||||||
|
margin: 0 0 16px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,112 @@
|
|||||||
|
<template>
|
||||||
|
<div class="quality-info-container">
|
||||||
|
<el-table v-loading="loading" :data="qualityList" :stripe="true" :show-overflow-tooltip="true">
|
||||||
|
<el-table-column label="质检编码" align="center" prop="code" width="150px" />
|
||||||
|
<el-table-column label="质检名称" align="center" prop="name" width="150px" />
|
||||||
|
<el-table-column label="质检类型" align="center" prop="type" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.MES_QUALITY_TYPE" :value="scope.row.type" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="方案名称" align="center" prop="schemaName" width="150px" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag type="status" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="结果" align="center" prop="result" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag :type="scope.row.result === '通过' ? 'success' : 'danger'">
|
||||||
|
{{ scope.row.resultName || scope.row.result || '-' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="执行人" align="center" prop="executorName" width="100px" />
|
||||||
|
<el-table-column label="执行时间" align="center" prop="executeTime" width="180px">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatDateTime(scope.row.executeTime) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180px">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatDateTime(scope.row.createTime) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { ZjTaskApi } from '@/api/mes/zjtask'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ProductionReportQualityInfo' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
taskId?: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const qualityList = ref<any[]>([])
|
||||||
|
const total = ref(0)
|
||||||
|
const queryParams = reactive({
|
||||||
|
ticket: undefined as number | undefined,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10
|
||||||
|
})
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
if (!queryParams.ticket) return
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await ZjTaskApi.getZjTaskPageByTicket(queryParams)
|
||||||
|
qualityList.value = data?.list || []
|
||||||
|
total.value = data?.total || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch quality info:', error)
|
||||||
|
qualityList.value = []
|
||||||
|
total.value = 0
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 监听任务ID变化 */
|
||||||
|
watch(
|
||||||
|
() => props.taskId,
|
||||||
|
(val: number | undefined) => {
|
||||||
|
if (!val) {
|
||||||
|
qualityList.value = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
queryParams.ticket = val as number
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
/** 格式化日期时间 */
|
||||||
|
const formatDateTime = (value: string | Date | null) => {
|
||||||
|
if (!value) return '-'
|
||||||
|
return dayjs(value).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.section-title {
|
||||||
|
margin: 0 0 16px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,118 @@
|
|||||||
|
<template>
|
||||||
|
<div class="related-plan-container">
|
||||||
|
<!-- 加载中状态 -->
|
||||||
|
<div v-if="loading" class="loading-wrapper">
|
||||||
|
<el-skeleton :rows="3" animated />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 空状态 -->
|
||||||
|
<el-empty v-else-if="planList.length === 0" description="暂无关联计划" />
|
||||||
|
|
||||||
|
<!-- 卡片列表 -->
|
||||||
|
<div v-else class="card-list">
|
||||||
|
<ProductionPlanCard
|
||||||
|
v-for="plan in planList"
|
||||||
|
:key="plan.id"
|
||||||
|
:plan="plan"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
v-if="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PlanApi, type PlanVO } from '@/api/mes/plan'
|
||||||
|
import ProductionPlanCard from './ProductionPlanCard.vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ProductionReportRelatedPlan' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
taskId?: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const planList = ref<PlanVO[]>([])
|
||||||
|
const total = ref(0)
|
||||||
|
const queryParams = reactive({
|
||||||
|
taskId: undefined as number | undefined,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取计划列表
|
||||||
|
const getList = async () => {
|
||||||
|
if (!queryParams.taskId) return
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await PlanApi.getPlanPageByTask({
|
||||||
|
taskId: queryParams.taskId,
|
||||||
|
pageNo: queryParams.pageNo,
|
||||||
|
pageSize: queryParams.pageSize
|
||||||
|
})
|
||||||
|
planList.value = data?.list || []
|
||||||
|
total.value = data?.total || 0
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch plan list:', error)
|
||||||
|
planList.value = []
|
||||||
|
total.value = 0
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听任务ID变化
|
||||||
|
watch(
|
||||||
|
() => props.taskId,
|
||||||
|
(val: number | undefined) => {
|
||||||
|
if (!val) {
|
||||||
|
planList.value = []
|
||||||
|
total.value = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
queryParams.taskId = val as number
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
margin: 0 0 16px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-wrapper {
|
||||||
|
background: white;
|
||||||
|
padding: 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-list {
|
||||||
|
animation: fadeIn 0.3s ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeIn {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(10px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,285 @@
|
|||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="auto"
|
||||||
|
label-position="left"
|
||||||
|
>
|
||||||
|
<el-form-item label="任务单编码" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.code"
|
||||||
|
placeholder="请输入任务单编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="下达日期" prop="orderDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.orderDate"
|
||||||
|
@change="handleQuery"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="交货日期" prop="deliveryDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.deliveryDate"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
@change="handleQuery"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.remark"
|
||||||
|
placeholder="请输入备注"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" prop="createTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.createTime"
|
||||||
|
@change="handleQuery"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery">
|
||||||
|
<Icon icon="ep:search" class="mr-5px" /> 搜索
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="resetQuery">
|
||||||
|
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
||||||
|
</el-button>
|
||||||
|
<el-button type="success" plain @click="handleExport" :loading="exportLoading">
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<ContentWrap>
|
||||||
|
<!-- 状态Tabs -->
|
||||||
|
<el-tabs v-model="activeStatusTab" @tab-click="handleTabClick">
|
||||||
|
<el-tab-pane label="全部" name="" />
|
||||||
|
<el-tab-pane label="已下达" name="2" />
|
||||||
|
<el-tab-pane label="部分排产" name="7" />
|
||||||
|
<el-tab-pane label="待生产" name="8" />
|
||||||
|
<el-tab-pane label="生产中" name="9" />
|
||||||
|
<el-tab-pane label="已完成" name="10" />
|
||||||
|
</el-tabs>
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="list"
|
||||||
|
:stripe="true"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
highlight-current-row
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
>
|
||||||
|
<el-table-column label="任务单编码" align="center" prop="code" width="200px" sortable />
|
||||||
|
<el-table-column label="下达日期" align="center" prop="orderDate" :formatter="dateFormatter2" sortable />
|
||||||
|
<el-table-column
|
||||||
|
label="交货日期"
|
||||||
|
align="center"
|
||||||
|
prop="deliveryDate"
|
||||||
|
:formatter="deliveryDateFormatter"
|
||||||
|
sortable
|
||||||
|
/>
|
||||||
|
<el-table-column label="状态" align="center" prop="status" sortable>
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.MES_TASK_STATUS" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="是否排产" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag :type="scope.row.isScheduled ? 'success' : 'info'">{{ scope.row.isScheduled ? '是' : '否' }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="生产进度" align="center" min-width="180px">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="production-progress-cell">
|
||||||
|
<el-tooltip :content="getProductionProgressPercent(scope.row) + '%'" placement="top">
|
||||||
|
<el-progress
|
||||||
|
:percentage="getProductionProgressPercent(scope.row)"
|
||||||
|
:show-text="false"
|
||||||
|
:stroke-width="12"
|
||||||
|
class="production-progress-bar"
|
||||||
|
/>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 详情Tabs -->
|
||||||
|
<ContentWrap v-if="currentRow && currentRow.id">
|
||||||
|
<el-tabs v-model="activeTabName">
|
||||||
|
<!-- 基础信息 -->
|
||||||
|
<el-tab-pane label="基础信息" name="basicInfo">
|
||||||
|
<ProductionReportBasicInfo :task-id="currentRow.id" :task-delivery-date="currentRow.deliveryDate" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<!-- 关联计划 -->
|
||||||
|
<el-tab-pane label="关联计划" name="relatedPlan">
|
||||||
|
<ProductionReportRelatedPlan :task-id="currentRow.id" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<!-- 质检信息 -->
|
||||||
|
<el-tab-pane label="质检信息" name="qualityInfo">
|
||||||
|
<ProductionReportQualityInfo :task-id="currentRow.id" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<!-- 报工信息 -->
|
||||||
|
<el-tab-pane label="报工信息" name="baogongInfo">
|
||||||
|
<ProductionReportBaogongInfo :task-id="currentRow.id" />
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</ContentWrap>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { dateFormatter2 } from '@/utils/formatTime'
|
||||||
|
import download from '@/utils/download'
|
||||||
|
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'
|
||||||
|
|
||||||
|
/** 生产报表 列表 */
|
||||||
|
defineOptions({ name: 'ProductionReport' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const list = ref<TaskVO[]>([]) // 列表的数据
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
code: undefined,
|
||||||
|
orderDate: [],
|
||||||
|
deliveryDate: [],
|
||||||
|
status: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
createTime: []
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
|
||||||
|
const activeTabName = ref('basicInfo') // 当前详情tab
|
||||||
|
const activeStatusTab = ref('') // 当前状态tab
|
||||||
|
|
||||||
|
const deliveryDateFormatter = (_row: any, _column: any, value: any) => {
|
||||||
|
if (value) return dateFormatter2(_row, _column, value)
|
||||||
|
return dateFormatter2(_row, _column, _row?.finishDate)
|
||||||
|
}
|
||||||
|
|
||||||
|
const getProductionProgressPercent = (row: any) => {
|
||||||
|
const storedPlanNumber = Number(row?.storedPlanNumber ?? 0)
|
||||||
|
const totalNumber = Number(row?.totalNumber ?? row?.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 getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await TaskApi.getPlanTaskPage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await TaskApi.exportTask(queryParams)
|
||||||
|
download.excel(data, '生产报表.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 选中行操作 */
|
||||||
|
const currentRow = ref<TaskVO>({} as TaskVO) // 选中行
|
||||||
|
const handleCurrentChange = (row: TaskVO | null) => {
|
||||||
|
if (row) {
|
||||||
|
currentRow.value = row
|
||||||
|
activeTabName.value = 'basicInfo'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** tab 切换 */
|
||||||
|
const handleTabClick = (tab: any) => {
|
||||||
|
queryParams.status = tab.paneName === '' ? undefined : tab.paneName
|
||||||
|
currentRow.value = {} as TaskVO
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.production-progress-cell {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.production-progress-bar {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue