| | |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination"> |
| | | <template #completionStatus="{ row }"> |
| | | <el-progress :percentage="toProgressPercentage(row?.completionStatus)" |
| | | :color="progressColor(toProgressPercentage(row?.completionStatus))" |
| | | :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" /> |
| | | <el-table :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="(row) => row.productionOrderId" |
| | | @expand-change="expandChange" |
| | | height="calc(100vh - 22em)"> |
| | | <!-- 展开行列 --> |
| | | <el-table-column type="expand" |
| | | width="60" |
| | | fixed="left"> |
| | | <template #default="props"> |
| | | <el-table :data="props.row.children || []" |
| | | border |
| | | v-loading="childLoading[props.row.productionOrderId]" |
| | | style="margin: 10px 0;"> |
| | | <el-table-column align="center" |
| | | label="序号" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="工单类型" |
| | | prop="workOrderType" |
| | | width="80" /> |
| | | <el-table-column label="工单编号" |
| | | prop="workOrderNo" |
| | | width="140" /> |
| | | <el-table-column label="需求数量" |
| | | prop="planQuantity" |
| | | width="140" /> |
| | | <el-table-column label="完成数量" |
| | | prop="completeQuantity" |
| | | width="140" /> |
| | | <el-table-column label="完成进度" |
| | | width="140"> |
| | | <template #default="scope"> |
| | | <el-progress :percentage="toProgressPercentage(scope.row?.completionStatus)" |
| | | :color="progressColor(toProgressPercentage(scope.row?.completionStatus))" |
| | | :status="toProgressPercentage(scope.row?.completionStatus) >= 100 ? 'success' : ''" /> |
| | | </template> |
| | | </PIMTable> |
| | | </el-table-column> |
| | | <el-table-column label="计划开始时间" |
| | | prop="planStartTime" |
| | | width="140" /> |
| | | <el-table-column label="计划结束时间" |
| | | prop="planEndTime" |
| | | width="140" /> |
| | | <el-table-column label="实际开始时间" |
| | | prop="actualStartTime" |
| | | width="140" /> |
| | | <el-table-column label="实际结束时间" |
| | | prop="actualEndTime" |
| | | width="140" /> |
| | | <el-table-column label="指定报工人" |
| | | prop="userNames" |
| | | width="180" /> |
| | | <el-table-column label="操作" |
| | | width="200" |
| | | align="center" |
| | | fixed="right"> |
| | | <template #default="scope"> |
| | | <el-button link |
| | | type="primary" |
| | | @click="handleEdit(scope.row)"> |
| | | 计划时间 |
| | | </el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="handleAssignReporter(scope.row)"> |
| | | 指定报工人 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- 主表列 --> |
| | | <el-table-column align="center" |
| | | label="序号" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="生产订单号" |
| | | prop="npsNo" |
| | | min-width="140" /> |
| | | <el-table-column label="产品名称" |
| | | prop="productName" |
| | | min-width="140" /> |
| | | <el-table-column label="规格" |
| | | prop="model" |
| | | min-width="100" /> |
| | | <el-table-column label="单位" |
| | | prop="unit" |
| | | min-width="60" /> |
| | | <el-table-column label="工序名称" |
| | | prop="operationName" |
| | | min-width="100" /> |
| | | <el-table-column label="工单数量" |
| | | min-width="80"> |
| | | <template #default="scope"> |
| | | <span>共{{ scope.row.productionTaskCount || 0 }}个</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="计划数量" |
| | | prop="planQuantity" |
| | | min-width="100" /> |
| | | <el-table-column label="完成数量" |
| | | prop="completeQuantity" |
| | | min-width="100" /> |
| | | <el-table-column label="完成进度" |
| | | min-width="140"> |
| | | <template #default="scope"> |
| | | <el-progress :percentage="toProgressPercentage(scope.row?.completionStatus)" |
| | | :color="progressColor(toProgressPercentage(scope.row?.completionStatus))" |
| | | :status="toProgressPercentage(scope.row?.completionStatus) >= 100 ? 'success' : ''" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="报废数量" |
| | | prop="scrapQty" |
| | | min-width="80"> |
| | | <template #default="scope"> |
| | | <span :class="{ 'scrap-text': scope.row.scrapQty > 0 }"> |
| | | {{ scope.row.scrapQty || 0 }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="状态" |
| | | min-width="100" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-tag :type="getStatusTagType(scope.row.status)"> |
| | | {{ getStatusText(scope.row.status) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <PaginationComp v-show="page.total > 0" |
| | | :total="page.total" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="pagination" /> |
| | | </div> |
| | | <el-dialog v-model="editDialogVisible" |
| | | title="编辑计划时间" |
| | |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { |
| | | productWorkOrderPage, |
| | | getWorkOrderListByOrderId, |
| | | updateProductWorkOrder, |
| | | assignProductWorkOrder, |
| | | } from "@/api/productionManagement/workOrder.js"; |
| | | import { listUser } from "@/api/system/user.js"; |
| | | import PaginationComp from "@/components/PIMTable/Pagination.vue"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "工单类型", |
| | | prop: "workOrderType", |
| | | width: "80", |
| | | }, |
| | | { |
| | | label: "工单编号", |
| | | prop: "workOrderNo", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "生产订单号", |
| | | prop: "npsNo", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "产品名称", |
| | | prop: "productName", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "规格", |
| | | prop: "model", |
| | | }, |
| | | { |
| | | label: "单位", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "工序名称", |
| | | prop: "operationName", |
| | | width: "100", |
| | | }, |
| | | { |
| | | label: "需求数量", |
| | | prop: "planQuantity", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "完成数量", |
| | | prop: "completeQuantity", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "完成进度", |
| | | prop: "completionStatus", |
| | | dataType: "slot", |
| | | slot: "completionStatus", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "计划开始时间", |
| | | prop: "planStartTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "计划结束时间", |
| | | prop: "planEndTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "实际开始时间", |
| | | prop: "actualStartTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "实际结束时间", |
| | | prop: "actualEndTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "指定报工人", |
| | | prop: "userNames", |
| | | width: "180", |
| | | }, |
| | | { |
| | | label: "操作", |
| | | width: "200", |
| | | align: "center", |
| | | dataType: "action", |
| | | fixed: "right", |
| | | operation: [ |
| | | { |
| | | name: "计划时间", |
| | | clickFun: row => { |
| | | handleEdit(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "指定报工人", |
| | | clickFun: row => { |
| | | handleAssignReporter(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const statusMap = { |
| | | 1: '待确认', |
| | | 2: '待生产', |
| | | 3: '生产中', |
| | | 4: '已生产', |
| | | }; |
| | | |
| | | const getStatusText = (status) => statusMap[status] || '未知'; |
| | | |
| | | const getStatusTagType = (status) => { |
| | | switch (status) { |
| | | case 1: return 'info'; |
| | | case 2: return 'warning'; |
| | | case 3: return 'primary'; |
| | | case 4: return 'success'; |
| | | default: return 'info'; |
| | | } |
| | | }; |
| | | |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const expandedRowKeys = ref([]); |
| | | const childLoading = ref({}); |
| | | const editDialogVisible = ref(false); |
| | | const editrow = ref(null); |
| | | const page = reactive({ |
| | |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | expandedRowKeys.value = []; |
| | | const params = { ...searchForm.value, ...page }; |
| | | productWorkOrderPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | tableData.value = res.data.records.map(item => ({ |
| | | ...item, |
| | | children: [], |
| | | })); |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | const expandChange = (row, expandedRows) => { |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = []; |
| | | const orderId = row.productionOrderId; |
| | | |
| | | if (row.children && row.children.length > 0) { |
| | | expandedRowKeys.value.push(orderId); |
| | | return; |
| | | } |
| | | |
| | | childLoading.value[orderId] = true; |
| | | |
| | | getWorkOrderListByOrderId(orderId) |
| | | .then(res => { |
| | | childLoading.value[orderId] = false; |
| | | const index = tableData.value.findIndex( |
| | | item => item.productionOrderId === orderId |
| | | ); |
| | | if (index > -1) { |
| | | tableData.value[index].children = res.data || []; |
| | | } |
| | | expandedRowKeys.value.push(orderId); |
| | | }) |
| | | .catch(error => { |
| | | childLoading.value[orderId] = false; |
| | | console.error('加载工单明细失败:', error); |
| | | }); |
| | | } else { |
| | | expandedRowKeys.value = []; |
| | | } |
| | | }; |
| | | |
| | | const handleEdit = row => { |
| | |
| | | color: #606266; |
| | | } |
| | | |
| | | :deep(.el-table__expanded-cell) { |
| | | padding: 10px 30px !important; |
| | | background-color: #fafafa; |
| | | } |
| | | |
| | | .scrap-text { |
| | | color: #f56c6c; |
| | | } |
| | | |
| | | .assign-reporter-content { |
| | | .search-box { |
| | | margin-bottom: 16px; |