| | |
| | | </el-form-item> |
| | | </el-form> |
| | | <div> |
| | | <el-button type="primary" @click="isShowNewModal = true">新增</el-button> |
| | | <el-button type="danger" @click="handleDelete">删除</el-button> |
| | | <el-button @click="handleOut">导出</el-button> |
| | | </div> |
| | | </div> |
| | |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | :row-class-name="tableRowClassName" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="pagination"> |
| | | <template #completionStatus="{ row }"> |
| | | <el-progress |
| | |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <el-dialog v-model="bindRouteDialogVisible" |
| | | <!-- 工艺路线绑定弹窗暂时注释 --> |
| | | <!-- <el-dialog v-model="bindRouteDialogVisible" |
| | | title="绑定工艺路线" |
| | | width="500px"> |
| | | <el-form label-width="90px"> |
| | |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="bindRouteDialogVisible = false">取 消</el-button> |
| | | <el-button type="primary" |
| | | :loading="bindRouteSaving" |
| | | @click="handleBindRouteConfirm">确 认</el-button> |
| | | <el-button @click="bindRouteDialogVisible = false">取 消</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </el-dialog> --> |
| | | |
| | | <new-product-order v-if="isShowNewModal" |
| | | v-model:visible="isShowNewModal" |
| | | @completed="handleQuery" /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { useRouter } from "vue-router"; |
| | | import { |
| | | productOrderListPage, |
| | | listProcessRoute, |
| | | bindingRoute, |
| | | listProcessBom, |
| | | listProcessBom, delProductOrder, |
| | | } from "@/api/productionManagement/productionOrder.js"; |
| | | import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js"; |
| | | import {fileDel} from "@/api/financialManagement/revenueManagement.js"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | const NewProductOrder = defineAsyncComponent(() => import("@/views/productionManagement/productionOrder/New.vue")); |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const router = useRouter(); |
| | | const isShowNewModal = ref(false); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | |
| | | prop: "specificationModel", |
| | | width: '120px', |
| | | }, |
| | | { |
| | | label: "工艺路线编号", |
| | | prop: "processRouteCode", |
| | | width: '200px', |
| | | }, |
| | | // { |
| | | // label: "工艺路线编号", |
| | | // prop: "processRouteCode", |
| | | // width: '200px', |
| | | // }, |
| | | { |
| | | label: "需求数量", |
| | | prop: "quantity", |
| | |
| | | formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""), |
| | | width: 120, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "操作", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 200, |
| | | operation: [ |
| | | { |
| | | name: "工艺路线", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showRouteItemModal(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "绑定工艺路线", |
| | | type: "text", |
| | | showHide: row => !row.processRouteCode, |
| | | clickFun: row => { |
| | | openBindRouteDialog(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "产品结构", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showProductStructure(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | // { |
| | | // dataType: "action", |
| | | // label: "操作", |
| | | // align: "center", |
| | | // fixed: "right", |
| | | // width: 200, |
| | | // operation: [ |
| | | // { |
| | | // name: "工艺路线", |
| | | // type: "text", |
| | | // clickFun: row => { |
| | | // showRouteItemModal(row); |
| | | // }, |
| | | // }, |
| | | // { |
| | | // name: "绑定工艺路线", |
| | | // type: "text", |
| | | // showHide: row => !row.processRouteCode, |
| | | // clickFun: row => { |
| | | // openBindRouteDialog(row); |
| | | // }, |
| | | // }, |
| | | // { |
| | | // name: "产品结构", |
| | | // type: "text", |
| | | // clickFun: row => { |
| | | // showProductStructure(row); |
| | | // }, |
| | | // }, |
| | | //], |
| | | //}, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const selectedRows = ref([]); |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | |
| | | |
| | | // 添加表行类名方法 |
| | | const tableRowClassName = ({ row }) => { |
| | | switch (row.deliveryDaysDiff) { |
| | | case 15: |
| | | return 'yellow' |
| | | case 10: |
| | | return 'red' |
| | | case 2: |
| | | return 'purple' |
| | | if (!row.deliveryDate) return ''; |
| | | if (row.isFh) return ''; |
| | | |
| | | const diff = row.deliveryDaysDiff; |
| | | if (diff === 15) { |
| | | return 'yellow'; |
| | | } else if (diff === 10) { |
| | | return 'pink'; |
| | | } else if (diff === 2) { |
| | | return 'purple'; |
| | | } else if (diff < 2) { |
| | | return 'red'; |
| | | } |
| | | }; |
| | | |
| | | // 绑定工艺路线弹框 |
| | | const bindRouteDialogVisible = ref(false); |
| | | const bindRouteLoading = ref(false); |
| | | const bindRouteSaving = ref(false); |
| | | const routeOptions = ref([]); |
| | | const bindForm = reactive({ |
| | | orderId: null, |
| | | routeId: null, |
| | | }); |
| | | // 工艺路线绑定功能暂时注释 |
| | | // const bindRouteDialogVisible = ref(false); |
| | | // const bindRouteLoading = ref(false); |
| | | // const bindRouteSaving = ref(false); |
| | | // const routeOptions = ref([]); |
| | | // const bindForm = reactive({ |
| | | // orderId: null, |
| | | // routeId: null, |
| | | // }); |
| | | |
| | | const openBindRouteDialog = async row => { |
| | | bindForm.orderId = row.id; |
| | | bindForm.routeId = null; |
| | | bindRouteDialogVisible.value = true; |
| | | routeOptions.value = []; |
| | | if (!row.productModelId) { |
| | | proxy.$modal.msgWarning("当前订单缺少产品型号,无法查询工艺路线"); |
| | | bindRouteDialogVisible.value = false; |
| | | return; |
| | | } |
| | | bindRouteLoading.value = true; |
| | | try { |
| | | const res = await listProcessRoute({ productModelId: row.productModelId }); |
| | | routeOptions.value = res.data || []; |
| | | } catch (e) { |
| | | console.error("获取工艺路线列表失败:", e); |
| | | proxy.$modal.msgError("获取工艺路线列表失败"); |
| | | } finally { |
| | | bindRouteLoading.value = false; |
| | | } |
| | | }; |
| | | // const openBindRouteDialog = async row => { |
| | | // bindForm.orderId = row.id; |
| | | // bindForm.routeId = null; |
| | | // bindRouteDialogVisible.value = true; |
| | | // routeOptions.value = []; |
| | | // if (!row.productModelId) { |
| | | // proxy.$modal.msgWarning("当前订单缺少产品型号,无法查询工艺路线"); |
| | | // bindRouteDialogVisible.value = false; |
| | | // return; |
| | | // } |
| | | // bindRouteLoading.value = true; |
| | | // try { |
| | | // const res = await listProcessRoute({ productModelId: row.productModelId }); |
| | | // routeOptions.value = res.data || []; |
| | | // } catch (e) { |
| | | // console.error("获取工艺路线列表失败:", e); |
| | | // proxy.$modal.msgError("获取工艺路线列表失败"); |
| | | // } finally { |
| | | // bindRouteLoading.value = false; |
| | | // } |
| | | // }; |
| | | |
| | | const handleBindRouteConfirm = async () => { |
| | | if (!bindForm.routeId) { |
| | | proxy.$modal.msgWarning("请选择工艺路线"); |
| | | return; |
| | | } |
| | | bindRouteSaving.value = true; |
| | | try { |
| | | await bindingRoute({ |
| | | id: bindForm.orderId, |
| | | routeId: bindForm.routeId, |
| | | }); |
| | | proxy.$modal.msgSuccess("绑定成功"); |
| | | bindRouteDialogVisible.value = false; |
| | | getList(); |
| | | } catch (e) { |
| | | console.error("绑定工艺路线失败:", e); |
| | | proxy.$modal.msgError("绑定工艺路线失败"); |
| | | } finally { |
| | | bindRouteSaving.value = false; |
| | | } |
| | | }; |
| | | // const handleBindRouteConfirm = async () => { |
| | | // if (!bindForm.routeId) { |
| | | // proxy.$modal.msgWarning("请选择工艺路线"); |
| | | // return; |
| | | // } |
| | | // bindRouteSaving.value = true; |
| | | // try { |
| | | // await bindingRoute({ |
| | | // id: bindForm.orderId, |
| | | // routeId: bindForm.routeId, |
| | | // }); |
| | | // proxy.$modal.msgSuccess("绑定成功"); |
| | | // bindRouteDialogVisible.value = false; |
| | | // getList(); |
| | | // } catch (e) { |
| | | // console.error("绑定工艺路线失败:", e); |
| | | // proxy.$modal.msgError("绑定工艺路线失败"); |
| | | // } finally { |
| | | // bindRouteSaving.value = false; |
| | | // } |
| | | // }; |
| | | |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | |
| | | }); |
| | | }; |
| | | |
| | | const showRouteItemModal = async row => { |
| | | const orderId = row.id; |
| | | try { |
| | | const res = await getOrderProcessRouteMain(orderId); |
| | | const data = res.data || {}; |
| | | if (!data || !data.id) { |
| | | proxy.$modal.msgWarning("未找到关联的工艺路线"); |
| | | return; |
| | | } |
| | | router.push({ |
| | | path: "/productionManagement/processRouteItem", |
| | | query: { |
| | | id: data.id, |
| | | processRouteCode: data.processRouteCode || "", |
| | | productName: data.productName || "", |
| | | model: data.model || "", |
| | | bomNo: data.bomNo || "", |
| | | description: data.description || "", |
| | | orderId, |
| | | type: "order", |
| | | }, |
| | | }); |
| | | } catch (e) { |
| | | console.error("获取工艺路线主信息失败:", e); |
| | | proxy.$modal.msgError("获取工艺路线信息失败"); |
| | | } |
| | | }; |
| | | // 工艺路线详情入口暂时注释 |
| | | // const showRouteItemModal = async row => { |
| | | // const orderId = row.id; |
| | | // try { |
| | | // const res = await getOrderProcessRouteMain(orderId); |
| | | // const data = res.data || {}; |
| | | // if (!data || !data.id) { |
| | | // proxy.$modal.msgWarning("未找到关联的工艺路线"); |
| | | // return; |
| | | // } |
| | | // router.push({ |
| | | // path: "/productionManagement/processRouteItem", |
| | | // query: { |
| | | // id: data.id, |
| | | // processRouteCode: data.processRouteCode || "", |
| | | // productName: data.productName || "", |
| | | // model: data.model || "", |
| | | // bomNo: data.bomNo || "", |
| | | // description: data.description || "", |
| | | // orderId, |
| | | // type: "order", |
| | | // }, |
| | | // }); |
| | | // } catch (e) { |
| | | // console.error("获取工艺路线主信息失败:", e); |
| | | // proxy.$modal.msgError("获取工艺路线信息失败"); |
| | | // } |
| | | // }; |
| | | |
| | | const showProductStructure = row => { |
| | | router.push({ |
| | |
| | | orderId: row.id, |
| | | type: "order", |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | // 表格选择数据 |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("请选择数据"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }).then(() => { |
| | | delProductOrder(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | getList(); |
| | | }); |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | |
| | |
| | | align-items: start; |
| | | } |
| | | |
| | | ::v-deep .yellow { |
| | | :deep(.yellow) { |
| | | background-color: #FAF0DE; |
| | | } |
| | | |
| | | ::v-deep .red { |
| | | :deep(.pink) { |
| | | background-color: #FAE1DE; |
| | | } |
| | | |
| | | ::v-deep .purple{ |
| | | :deep(.red) { |
| | | background-color: #f80202; |
| | | } |
| | | |
| | | :deep(.purple){ |
| | | background-color: #F4DEFA; |
| | | } |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | </style> |