| | |
| | | }); |
| | | } |
| | | |
| | | // 生产订单下:新增工艺路线项目 |
| | | export function addRouteItem(data) { |
| | | return request({ |
| | | url: "/productProcessRoute/addRouteItem", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // 获取生产订单关联的工艺路线主信息 |
| | | export function listMain(orderId) { |
| | | return request({ |
| | |
| | | }); |
| | | } |
| | | |
| | | // 删除客户档案 |
| | | export function deleteRouteItem(ids) { |
| | | // 删除工艺路线项目(路由后拼接 id) |
| | | export function deleteRouteItem(id) { |
| | | return request({ |
| | | url: '/productProcessRoute/deleteRouteItem', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | url: `/productProcessRoute/deleteRouteItem/${id}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | export function productOrderListPage(query) { |
| | | return request({ |
| | | url: "/productOrder/page", |
| | |
| | | }); |
| | | } |
| | | |
| | | // 生产订单-按产品型号查询可用工艺路线列表 |
| | | export function listProcessRoute(query) { |
| | | return request({ |
| | | url: "/productOrder/listProcessRoute", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // 生产订单-绑定工艺路线 |
| | | export function bindingRoute(data) { |
| | | return request({ |
| | | url: "/productOrder/bindingRoute", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // 获取炒机正在工作量数据 |
| | | export function schedulingList(query) { |
| | | return request({ |
| | |
| | | <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, |
| | | // 编辑:生产订单下使用 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(); |
| | |
| | | const idx = routeItems.value.findIndex(item => item.id === row.id); |
| | | console.log(idx, "idx"); |
| | | if (row.id) { |
| | | deleteRouteItemByIds({ id: row.id }, idx); |
| | | deleteRouteItemByIds(row.id, idx); |
| | | } else { |
| | | removeItem(dragSortx); |
| | | } |
| | |
| | | } |
| | | }; |
| | | |
| | | const deleteRouteItemByIds = (ids, index) => { |
| | | deleteRouteItem(ids).then(res => { |
| | | const deleteRouteItemByIds = (id, index) => { |
| | | deleteRouteItem(id).then(res => { |
| | | routeItems.value.splice(index, 1); |
| | | updateDragSort(); |
| | | nextTick(() => initSortable()); |
| | |
| | | placeholder="请输入" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 200px;" |
| | | style="width: 160px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="合同号:"> |
| | |
| | | placeholder="请输入" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 200px;" |
| | | style="width: 160px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="产品名称:"> |
| | |
| | | placeholder="请输入" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 200px;" |
| | | style="width: 160px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="规格:"> |
| | |
| | | placeholder="请输入" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 200px;" |
| | | style="width: 160px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination"></PIMTable> |
| | | @pagination="pagination"> |
| | | <template #completionStatus="{ row }"> |
| | | <el-progress |
| | | :percentage="toProgressPercentage(row?.completionStatus)" |
| | | :color="progressColor(toProgressPercentage(row?.completionStatus))" |
| | | :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" |
| | | /> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <process-route-item-form v-if="isShowItemModal" |
| | | v-model:visible="isShowItemModal" |
| | | :record="record" |
| | | @completed="getList" /> |
| | | <el-dialog v-model="bindRouteDialogVisible" |
| | | title="绑定工艺路线" |
| | | width="500px"> |
| | | <el-form label-width="90px"> |
| | | <el-form-item label="工艺路线"> |
| | | <el-select v-model="bindForm.routeId" |
| | | placeholder="请选择工艺路线" |
| | | style="width: 100%;" |
| | | :loading="bindRouteLoading"> |
| | | <el-option v-for="item in routeOptions" |
| | | :key="item.id" |
| | | :label="`${item.processRouteCode || ''}`" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </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> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { useRouter } from "vue-router"; |
| | | import { productOrderListPage } from "@/api/productionManagement/productionOrder.js"; |
| | | import { |
| | | productOrderListPage, |
| | | listProcessRoute, |
| | | bindingRoute, |
| | | } from "@/api/productionManagement/productionOrder.js"; |
| | | import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import ProcessRouteItemForm from "@/views/productionManagement/productionOrder/ProcessRouteItemForm.vue"; |
| | |
| | | { |
| | | label: "生产订单号", |
| | | prop: "npsNo", |
| | | width: '120px', |
| | | }, |
| | | { |
| | | label: "销售合同号", |
| | | prop: "salesContractNo", |
| | | width: '150px', |
| | | }, |
| | | { |
| | | label: "客户名称", |
| | | prop: "customerName", |
| | | width: '200px', |
| | | }, |
| | | { |
| | | label: "产品名称", |
| | | prop: "productCategory", |
| | | width: '120px', |
| | | }, |
| | | { |
| | | label: "规格", |
| | | prop: "specificationModel", |
| | | width: '120px', |
| | | }, |
| | | { |
| | | label: "工艺路线编号", |
| | | prop: "processRouteCode", |
| | | width: '140px', |
| | | }, |
| | | { |
| | | label: "需求数量", |
| | | prop: "quantity", |
| | | }, |
| | | { |
| | | label: "完成数量", |
| | | prop: "completeQuantity", |
| | | }, |
| | | { |
| | | dataType: "slot", |
| | | label: "完成进度", |
| | | prop: "completionStatus", |
| | | slot: "completionStatus", |
| | | width: 180, |
| | | }, |
| | | { |
| | | label: "开始日期", |
| | | prop: "startTime", |
| | | formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""), |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "结束日期", |
| | | prop: "endTime", |
| | | formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""), |
| | | width: 120, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | |
| | | type: "text", |
| | | clickFun: row => { |
| | | showRouteItemModal(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "绑定工艺路线", |
| | | type: "text", |
| | | showHide: row => !row.processRouteCode, |
| | | clickFun: row => { |
| | | openBindRouteDialog(row); |
| | | }, |
| | | }, |
| | | ], |
| | |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | const toProgressPercentage = val => { |
| | | const n = Number(val); |
| | | if (!Number.isFinite(n)) return 0; |
| | | if (n <= 0) return 0; |
| | | if (n >= 100) return 100; |
| | | return Math.round(n); |
| | | }; |
| | | |
| | | // 30/50/80/100 分段颜色:红/橙/蓝/绿 |
| | | const progressColor = percentage => { |
| | | const p = toProgressPercentage(percentage); |
| | | if (p < 30) return "#f56c6c"; |
| | | if (p < 50) return "#e6a23c"; |
| | | if (p < 80) return "#409eff"; |
| | | return "#67c23a"; |
| | | }; |
| | | |
| | | // 绑定工艺路线弹框 |
| | | 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 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; |
| | | } |
| | | }; |
| | | |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | | <style scoped lang="scss"> |
| | | .search_form{ |
| | | align-items: start; |
| | | }</style> |