| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="处理结果:" prop="dealResult"> |
| | | <el-select v-model="form.dealResult" placeholder="请选择" clearable> |
| | | <el-option :label="item.label" :value="item.value" v-for="item in filteredRejectionHandling" :key="item.value" /> |
| | | <el-option :label="item.label" :value="item.value" v-for="item in autoDealResultOptions" :key="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="不合格类型:" prop="dealType"> |
| | | <el-input :model-value="dealTypeLabel(form.dealType)" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="修理工时:" prop="repairWorkHour"> |
| | | <el-input-number |
| | | v-model="form.repairWorkHour" |
| | | :min="0" |
| | | :precision="2" |
| | | style="width: 100%" |
| | | :disabled="Number(form.dealType) !== 0" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref, reactive, toRefs, computed} from "vue"; |
| | | import { ref, reactive, toRefs, computed, getCurrentInstance } from "vue"; |
| | | import {productTreeList} from "@/api/basicData/product.js"; |
| | | import { |
| | | getQualityUnqualifiedInfo, |
| | |
| | | const { proxy } = getCurrentInstance() |
| | | const emit = defineEmits(['close']) |
| | | |
| | | const { rejection_handling } = proxy.useDict("rejection_handling") |
| | | const dialogFormVisible = ref(false); |
| | | const operationType = ref('') |
| | | const data = reactive({ |
| | |
| | | inspectType: '', |
| | | defectivePhenomena: '', |
| | | dealResult: '', |
| | | dealType: null, |
| | | repairWorkHour: 0, |
| | | regenerateNewOrder: 0, |
| | | dealName: '', |
| | | dealTime: '', |
| | | method: undefined |
| | |
| | | checkResult: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | defectivePhenomena: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | dealResult: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | repairWorkHour: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | dealName: [{ required: true, message: "请选择处理人", trigger: "change" }], |
| | | dealTime: [{ required: true, message: "请输入", trigger: "change" }], |
| | | }, |
| | |
| | | const productOptions = ref([]); |
| | | const userList = ref([]); // 处理人下拉列表 |
| | | |
| | | const filteredRejectionHandling = computed(() => { |
| | | const data = rejection_handling.value; |
| | | if (form.value.method) { |
| | | return data.filter(item => item && item.label && item.label !== '返工' && item.label !== '返修') |
| | | const autoDealResultOptions = computed(() => { |
| | | if (Number(form.value.dealType) === 2) { |
| | | return [{ label: "报废", value: "报废" }]; |
| | | } |
| | | return data |
| | | if (Number(form.value.dealType) === 0 || Number(form.value.dealType) === 1) { |
| | | return [{ label: "报工", value: "报工" }]; |
| | | } |
| | | return []; |
| | | }) |
| | | |
| | | const dealTypeLabel = (val) => { |
| | | const type = Number(val); |
| | | if (type === 0) { |
| | | return "轻微返工"; |
| | | } |
| | | if (type === 1) { |
| | | return "严重返工"; |
| | | } |
| | | if (type === 2) { |
| | | return "报废"; |
| | | } |
| | | return "-"; |
| | | }; |
| | | |
| | | |
| | | // 打开弹框 |
| | |
| | | userList.value = []; |
| | | } |
| | | dialogFormVisible.value = true; |
| | | form.value = {}; |
| | | form.value = { |
| | | checkTime: "", |
| | | process: "", |
| | | checkName: "", |
| | | productName: "", |
| | | productId: "", |
| | | model: "", |
| | | unit: "", |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | inspectType: '', |
| | | defectivePhenomena: '', |
| | | dealResult: '', |
| | | dealType: null, |
| | | repairWorkHour: 0, |
| | | regenerateNewOrder: 0, |
| | | dealName: '', |
| | | dealTime: '', |
| | | method: undefined |
| | | }; |
| | | getProductOptions(); |
| | | if (operationType.value === 'edit') { |
| | | getQualityUnqualifiedInfo(row.id).then(res => { |
| | | const { inspectState, ...rest } = (res.data || {}) |
| | | // 有数据就显示默认值,没有就不显示 |
| | | form.value = { ...rest } |
| | | const dealType = rest.dealType === '' || rest.dealType === undefined || rest.dealType === null |
| | | ? null |
| | | : Number(rest.dealType); |
| | | // 用后端返回值回填,避免把不合格类型展示成空 |
| | | form.value = { ...form.value, ...rest, dealType } |
| | | if (!form.value.dealResult) { |
| | | form.value.dealResult = dealType === 2 ? "报废" : "报工"; |
| | | } |
| | | }) |
| | | } |
| | | } |
| | |
| | | if (valid) { |
| | | // 状态字段不在表单填写,也不传给后端;处理统一走 /deal 接口 |
| | | const { inspectState, ...payload } = (form.value || {}) |
| | | if (Number(payload.dealType) === 2) { |
| | | payload.dealResult = "报废"; |
| | | } else { |
| | | payload.dealResult = "报工"; |
| | | } |
| | | if (payload.dealType === 0 && (!payload.repairWorkHour || payload.repairWorkHour <= 0)) { |
| | | proxy.$modal.msgError("轻微返工必须填写大于0的修理工时"); |
| | | return; |
| | | } |
| | | qualityUnqualifiedDeal(payload).then(() => { |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | closeDia(); |
| | |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | | </style> |