| | |
| | | single |
| | | /> |
| | | |
| | | <!-- 用料产品选择弹窗 --> |
| | | <ProductSelectDialog |
| | | v-model="showMaterialProductDialog" |
| | | @confirm="handleMaterialProductSelect" |
| | | /> |
| | | |
| | | <!-- 生产任务 --> |
| | | <div class="section-card"> |
| | | <div class="section-header"> |
| | |
| | | <el-table-column type="index" label="序号" width="60" /> |
| | | <el-table-column label="工序名称" min-width="150"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.processName" placeholder="请输入工序名称" /> |
| | | <el-select |
| | | v-model="row.processId" |
| | | placeholder="请选择工序" |
| | | style="width: 100%" |
| | | @change="(val) => handleProcessChange(val, row)" |
| | | > |
| | | <el-option |
| | | v-for="item in processOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="计划数" min-width="120"> |
| | |
| | | import { Plus, Delete, Upload } from '@element-plus/icons-vue'; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | import {addProductOrder, listProcessRoute} from "@/api/productionManagement/productionOrder.js"; |
| | | import {list as listProcess} from "@/api/productionManagement/productionProcess.js"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | |
| | | // 用料清单列表 |
| | | const materialList = ref([]); |
| | | |
| | | // 工序列表 |
| | | const processOptions = ref([]); |
| | | |
| | | // 文件列表 |
| | | const fileList = ref([]); |
| | | |
| | |
| | | }); |
| | | |
| | | const showProductSelectDialog = ref(false); |
| | | const showMaterialProductDialog = ref(false); |
| | | |
| | | // 获取工序列表 |
| | | const fetchProcessOptions = () => { |
| | | listProcess().then(res => { |
| | | processOptions.value = res.data || []; |
| | | }); |
| | | }; |
| | | |
| | | // 组件挂载时获取工序列表 |
| | | fetchProcessOptions(); |
| | | |
| | | let { proxy } = getCurrentInstance() |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | // 工序选择变化处理 |
| | | const handleProcessChange = (processId, row) => { |
| | | const selectedProcess = processOptions.value.find(item => item.id === processId); |
| | | if (selectedProcess) { |
| | | row.processName = selectedProcess.name; |
| | | row.processNo = selectedProcess.no; |
| | | } |
| | | }; |
| | | |
| | | // 添加生产任务 |
| | | const addProductionTask = () => { |
| | | productionTaskList.value.push({ |
| | | processId: undefined, |
| | | processName: "", |
| | | planQuantity: 0, |
| | | processNo: "", |
| | | planQuantity: 1, |
| | | reportPermission: "", |
| | | planStartTime: "", |
| | | planEndTime: "", |
| | |
| | | productionTaskList.value.splice(index, 1); |
| | | }; |
| | | |
| | | // 添加用料 |
| | | // 添加用料 - 弹出产品选择框 |
| | | const addMaterialItem = () => { |
| | | showMaterialProductDialog.value = true; |
| | | }; |
| | | |
| | | // 处理用料产品选择 |
| | | const handleMaterialProductSelect = (products) => { |
| | | if (products && products.length > 0) { |
| | | products.forEach(product => { |
| | | materialList.value.push({ |
| | | drawingNumber: "", |
| | | productName: "", |
| | | unitQuantity: 0, |
| | | productModelId: product.id, |
| | | drawingNumber: product.model, |
| | | productName: product.productName, |
| | | unit: product.unit, |
| | | unitQuantity: 1, |
| | | inventoryQuantity: 0, |
| | | }); |
| | | }); |
| | | } |
| | | showMaterialProductDialog.value = false; |
| | | }; |
| | | |
| | | // 删除用料 |