| | |
| | | @click="handleProcessClick(process.processId)"> |
| | | <span class="process-name">{{ process.processName }}</span> |
| | | <span class="process-badge" |
| | | v-if="getProcessInfo(parseInt(process.processId)).postPersonnel"> |
| | | {{ getProcessInfo(parseInt(process.processId)).postPersonnel }} |
| | | v-if="getProcessInfo(parseInt(process.processId)).postName"> |
| | | {{ getProcessInfo(parseInt(process.processId)).postName }} |
| | | </span> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="form-grid"> |
| | | <el-form-item label="岗位人员" |
| | | class="form-item"> |
| | | <el-select v-model="getProcessInfo(parseInt(activeProcessId)).postPersonnel" |
| | | <el-select v-model="getProcessInfo(parseInt(activeProcessId)).postName" |
| | | placeholder="请选择岗位人员" |
| | | class="form-select" |
| | | :loading="userLoading"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="设备异常情况" |
| | | class="form-item"> |
| | | <el-input v-model="getProcessInfo(parseInt(activeProcessId)).equipmentAbnormality" |
| | | <el-input v-model="getProcessInfo(parseInt(activeProcessId)).equipmentMalfunction" |
| | | placeholder="请输入设备异常情况" |
| | | type="textarea" |
| | | :rows="2" |
| | |
| | | </el-form-item> |
| | | <el-form-item label="当班设备处置" |
| | | class="form-item"> |
| | | <el-input v-model="getProcessInfo(parseInt(activeProcessId)).equipmentHandling" |
| | | <el-input v-model="getProcessInfo(parseInt(activeProcessId)).equipmentDisposal" |
| | | placeholder="请输入当班设备处置" |
| | | type="textarea" |
| | | :rows="2" |
| | |
| | | </el-form-item> |
| | | <el-form-item label="工艺人员交待" |
| | | class="form-item"> |
| | | <el-input v-model="getProcessInfo(parseInt(activeProcessId)).processInstructions" |
| | | <el-input v-model="getProcessInfo(parseInt(activeProcessId)).processExplained" |
| | | placeholder="请输入工艺人员交待" |
| | | type="textarea" |
| | | :rows="2" |
| | |
| | | :key="param.id" |
| | | :label="param.paramName" |
| | | :label-width="120" |
| | | :required="param.isRequired" |
| | | :prop="`paramGroups.${activeProcessId}.${index}.${param.id}`" |
| | | :rules="param.isRequired ? [{ required: true, message: `请输入${param.paramName}`, trigger: 'blur' }] : []" |
| | | class="param-item"> |
| | | <template v-if="param.paramType == '1'"> |
| | | <!-- 数字类型 --> |
| | |
| | | :key="param.id" |
| | | :min-width="200"> |
| | | <template #header> |
| | | <span :class="{ 'required-label': param.isRequired }">{{ param.paramName }}</span> |
| | | <span>{{ param.paramName }}</span> |
| | | </template> |
| | | <template #default="{ row }"> |
| | | <template v-if="param.paramType == '1'"> |
| | |
| | | import { useRouter, useRoute } from "vue-router"; |
| | | import { getDicts } from "@/api/system/dict/data"; |
| | | import { productOrderListPage } from "@/api/productionManagement/productionOrder.js"; |
| | | import { productionRecordAdd } from "@/api/productionManagement/productProcessRoute.js"; |
| | | import { |
| | | productionRecordAdd, |
| | | productionRecordAddSubmit, |
| | | } from "@/api/productionManagement/productProcessRoute.js"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { getInfo } from "@/api/login.js"; |
| | | import { |
| | | Check, |
| | | Close, |
| | | Delete, |
| | | Plus, |
| | | ArrowLeft, |
| | | ArrowRight, |
| | | Loading, |
| | | Upload, |
| | | } from "@element-plus/icons-vue"; |
| | | import request from "@/utils/request"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import dayjs from "dayjs"; |
| | | |
| | | const router = useRouter(); |
| | | |
| | |
| | | processList.value.forEach(process => { |
| | | form.processStructures[process.processId] = |
| | | process.orderStructureVos || []; |
| | | loadParams(process.processId, orderId); |
| | | }); |
| | | // 如果有工序,默认选择第一个 |
| | | if (processList.value.length > 0) { |
| | |
| | | processId.value = firstProcess.processId; |
| | | form.processId = firstProcess.processId; |
| | | // 加载第一个工序的参数 |
| | | loadParams(firstProcess.processId, orderId); |
| | | // loadParams(firstProcess.processId, orderId); |
| | | } |
| | | } |
| | | }) |
| | |
| | | } |
| | | if (!form.processInfo[processId]) { |
| | | form.processInfo[processId] = { |
| | | postPersonnel: "", |
| | | equipmentAbnormality: "", |
| | | equipmentHandling: "", |
| | | processInstructions: "", |
| | | postName: "", |
| | | equipmentMalfunction: "", |
| | | equipmentDisposal: "", |
| | | processExplained: "", |
| | | files: [], |
| | | consumables: {}, |
| | | }; |
| | |
| | | }; |
| | | |
| | | // 处理文件变更 |
| | | const handleFileChange = (file, fileList) => { |
| | | const handleFileChange = async (file, fileList) => { |
| | | console.log(file, fileList); |
| | | const formData = new FormData(); |
| | | formData.append("file", file.raw); |
| | | |
| | | const uploadRes = await request({ |
| | | url: "/file/upload", |
| | | method: "post", |
| | | data: formData, |
| | | headers: { |
| | | "Content-Type": "multipart/form-data", |
| | | Authorization: `Bearer ${getToken()}`, |
| | | }, |
| | | }); |
| | | console.log(uploadRes); |
| | | if (uploadRes.code === 200) { |
| | | const tempId = uploadRes.data.tempId; |
| | | // 将tempId存储到file对象中 |
| | | file.tempId = tempId; |
| | | } |
| | | const processId = parseInt(activeProcessId.value); |
| | | if (processId) { |
| | | const processInfo = getProcessInfo(processId); |
| | |
| | | } |
| | | }); |
| | | } else if (activeStep.value === 2) { |
| | | // 第三步:验证参数必填项 |
| | | let isValid = true; |
| | | let errorMessage = ""; |
| | | |
| | | // 遍历所有工序 |
| | | for (const process of processList.value) { |
| | | const processId = process.processId; |
| | | const paramGroups = form.paramGroups[processId] || []; |
| | | const processParams = process.orderRouteItemParaVos || []; |
| | | |
| | | // 获取必填参数 |
| | | const requiredParams = processParams.filter(p => p.isRequired); |
| | | |
| | | if (requiredParams.length > 0) { |
| | | // 检查每个参数组中的必填参数 |
| | | for ( |
| | | let groupIndex = 0; |
| | | groupIndex < paramGroups.length; |
| | | groupIndex++ |
| | | ) { |
| | | const group = paramGroups[groupIndex]; |
| | | for (const param of requiredParams) { |
| | | const value = group[param.id]; |
| | | if (value === undefined || value === null || value === "") { |
| | | isValid = false; |
| | | errorMessage = `工序【${process.processName}】参数组${ |
| | | groupIndex + 1 |
| | | }的【${param.paramName}】为必填项`; |
| | | break; |
| | | } |
| | | } |
| | | if (!isValid) break; |
| | | } |
| | | } |
| | | if (!isValid) break; |
| | | } |
| | | |
| | | if (!isValid) { |
| | | ElMessage.error(errorMessage); |
| | | return; |
| | | } |
| | | |
| | | activeStep.value = 3; |
| | | } |
| | | }; |
| | |
| | | formRef.value.validate(valid => { |
| | | if (valid) { |
| | | isSubmitting.value = true; |
| | | // 这里可以调用API进行提交 |
| | | setTimeout(() => { |
| | | ElMessage.success(data.id ? "修改成功" : "新增成功"); |
| | | router.back(); |
| | | isSubmitting.value = false; |
| | | }, 1000); |
| | | |
| | | // 构建请求参数 |
| | | const order = orderList.value.find(item => item.id === form.orderId); |
| | | console.log(order, "order"); |
| | | const submitParams = { |
| | | productOrderId: form.orderId, |
| | | productId: order ? order.productId : null, |
| | | postName: form.createBy, |
| | | schedule: form.teamName, |
| | | // reportingTime: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"), |
| | | qualifiedQuantity: form.outputVolume - form.unqualifiedVolume, |
| | | unqualifiedQuantity: form.unqualifiedVolume, |
| | | quantity: form.outputVolume, |
| | | productionProductRouteItemDtoList: processList.value.map(process => { |
| | | const processInfo = getProcessInfo(process.processId); |
| | | const paramGroups = form.paramGroups[process.processId] || []; |
| | | const productionProductRouteItemParamDtoList = []; |
| | | |
| | | // 添加参数组 |
| | | paramGroups.forEach((group, index) => { |
| | | Object.entries(group).forEach(([paramId, value]) => { |
| | | // 从当前工序的参数列表中查找参数 |
| | | const processData = processList.value.find( |
| | | p => p.processId === process.processId |
| | | ); |
| | | const param = processData |
| | | ? processData.orderRouteItemParaVos.find( |
| | | p => p.id === parseInt(paramId) |
| | | ) |
| | | : null; |
| | | if (param) { |
| | | productionProductRouteItemParamDtoList.push({ |
| | | id: parseInt(paramId), |
| | | standardValue: param.standardValue, |
| | | minValue: param.minValue, |
| | | maxValue: param.maxValue, |
| | | productId: param.productId, |
| | | productValue: value, |
| | | sourceSort: index + 1, |
| | | unit: param.unit, |
| | | isRequired: param.isRequired, |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 添加BOM信息 |
| | | const structures = getProcessStructures(process.processId); |
| | | console.log(structures, "structures"); |
| | | structures.forEach(structure => { |
| | | const consumableValue = getConsumableValue( |
| | | process.processId, |
| | | structure.id |
| | | ); |
| | | if (consumableValue > 0) { |
| | | productionProductRouteItemParamDtoList.push({ |
| | | productId: structure.productModelId, |
| | | bomId: structure.bomId, |
| | | id: null, |
| | | productValue: consumableValue, |
| | | unit: structure.unit, |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | return { |
| | | postName: processInfo.postName, |
| | | equipmentMalfunction: processInfo.equipmentMalfunction, |
| | | equipmentDisposal: processInfo.equipmentDisposal, |
| | | processExplained: processInfo.processExplained, |
| | | processId: process.processId, |
| | | productionProductRouteItemParamDtoList, |
| | | files: processInfo.files.map(file => file.tempId || file.uid), |
| | | }; |
| | | }), |
| | | }; |
| | | // 调用API进行提交 |
| | | productionRecordAddSubmit(submitParams) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success(data.id ? "修改成功" : "新增成功"); |
| | | router.back(); |
| | | } else { |
| | | ElMessage.error(res.msg || "提交失败"); |
| | | } |
| | | }) |
| | | .catch(error => { |
| | | ElMessage.error("提交失败,请稍后重试"); |
| | | console.error("提交错误:", error); |
| | | }) |
| | | .finally(() => { |
| | | isSubmitting.value = false; |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | |
| | | } |
| | | // 创建一个新的参数组,使用默认值 |
| | | const newGroup = {}; |
| | | params.value.forEach(param => { |
| | | newGroup[param.id] = param.standardValue || ""; |
| | | }); |
| | | // 从当前工序的参数列表中获取参数信息 |
| | | const process = processList.value.find( |
| | | p => p.processId === parseInt(processId) |
| | | ); |
| | | if (process) { |
| | | const processParams = process.orderRouteItemParaVos || []; |
| | | processParams.forEach(param => { |
| | | newGroup[param.id] = param.standardValue || ""; |
| | | }); |
| | | } |
| | | form.paramGroups[processId].push(newGroup); |
| | | }; |
| | | |
| | |
| | | font-size: 14px; |
| | | color: #666; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | /* 必填标识样式 */ |
| | | .required-label::before { |
| | | content: "*"; |
| | | color: #f56c6c; |
| | | margin-right: 4px; |
| | | } |
| | | |
| | | .form-grid { |