| | |
| | | <PageHeader content="工艺路线项目" /> |
| | | |
| | | <!-- 工艺路线信息展示 --> |
| | | <div v-if="routeInfo.processRouteCode" class="section-title" style="margin-bottom: 12px;">工艺路线信息</div> |
| | | <el-card v-if="routeInfo.processRouteCode" class="route-info-card" shadow="hover"> |
| | | <div class="route-info"> |
| | | <div class="info-item"> |
| | |
| | | import { ref, computed, getCurrentInstance, onMounted, onUnmounted, nextTick } from "vue"; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | import { findProcessRouteItemList, addOrUpdateProcessRouteItem, sortProcessRouteItem, batchDeleteProcessRouteItem } from "@/api/productionManagement/processRouteItem.js"; |
| | | import { findProductProcessRouteItemList } from "@/api/productionManagement/productProcessRoute.js"; |
| | | import { findProductProcessRouteItemList, deleteRouteItem, addRouteItem, addOrUpdateProductProcessRouteItem } from "@/api/productionManagement/productProcessRoute.js"; |
| | | import { processList } from "@/api/productionManagement/productionProcess.js"; |
| | | import { useRoute } from 'vue-router' |
| | | import { ElMessageBox } from 'element-plus' |
| | |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | // 调用批量删除接口,传递id数组 |
| | | batchDeleteProcessRouteItem([row.id]) |
| | | // 生产订单下使用 productProcessRoute 的删除接口(路由后拼接 id),其它情况使用工艺路线项目批量删除接口 |
| | | const deletePromise = |
| | | pageType.value === 'order' |
| | | ? deleteRouteItem(row.id) |
| | | : batchDeleteProcessRouteItem([row.id]); |
| | | |
| | | deletePromise |
| | | .then(() => { |
| | | proxy?.$modal?.msgSuccess('删除成功'); |
| | | getList(); |
| | |
| | | if (valid) { |
| | | submitLoading.value = true; |
| | | |
| | | // 构建提交数据对象(单个对象形式) |
| | | const submitData = { |
| | | routeId: routeId.value, |
| | | processId: form.value.processId, |
| | | productModelId: form.value.productModelId, |
| | | }; |
| | | |
| | | if (operationType.value === 'add') { |
| | | // 新增:传单个对象,包含dragSort字段 |
| | | // dragSort = 当前列表长度 + 1,表示新增记录排在最后 |
| | | const dragSort = tableData.value.length + 1; |
| | | addOrUpdateProcessRouteItem({ |
| | | ...submitData, |
| | | dragSort: dragSort |
| | | }) |
| | | const isOrderPage = pageType.value === 'order'; |
| | | |
| | | const addPromise = isOrderPage |
| | | ? addRouteItem({ |
| | | productOrderId: orderId.value, |
| | | productRouteId: routeId.value, |
| | | processId: form.value.processId, |
| | | productModelId: form.value.productModelId, |
| | | dragSort, |
| | | }) |
| | | : addOrUpdateProcessRouteItem({ |
| | | routeId: routeId.value, |
| | | processId: form.value.processId, |
| | | productModelId: form.value.productModelId, |
| | | dragSort, |
| | | }); |
| | | |
| | | addPromise |
| | | .then(() => { |
| | | proxy?.$modal?.msgSuccess('新增成功'); |
| | | closeDialog(); |
| | |
| | | submitLoading.value = false; |
| | | }); |
| | | } else { |
| | | // 编辑:传单个对象,包含id |
| | | addOrUpdateProcessRouteItem({ |
| | | ...submitData, |
| | | id: form.value.id, |
| | | }) |
| | | // 编辑:生产订单下使用 productProcessRoute/updateRouteItem,其它情况使用工艺路线项目更新接口 |
| | | const isOrderPage = pageType.value === 'order'; |
| | | |
| | | const updatePromise = isOrderPage |
| | | ? addOrUpdateProductProcessRouteItem({ |
| | | id: form.value.id, |
| | | processId: form.value.processId, |
| | | productModelId: form.value.productModelId, |
| | | }) |
| | | : addOrUpdateProcessRouteItem({ |
| | | routeId: routeId.value, |
| | | processId: form.value.processId, |
| | | productModelId: form.value.productModelId, |
| | | id: form.value.id, |
| | | }); |
| | | |
| | | updatePromise |
| | | .then(() => { |
| | | proxy?.$modal?.msgSuccess('修改成功'); |
| | | closeDialog(); |