diff --git a/jnpf-java-boot/jnpf-web/src/views/example/machineparam/form.vue b/jnpf-java-boot/jnpf-web/src/views/example/machineparam/form.vue index 6afdc9e..88644fe 100644 --- a/jnpf-java-boot/jnpf-web/src/views/example/machineparam/form.vue +++ b/jnpf-java-boot/jnpf-web/src/views/example/machineparam/form.vue @@ -31,13 +31,13 @@ - + - + @@ -58,9 +58,9 @@ - + @@ -217,7 +217,45 @@ export default { url: `/api/example/machineparam/${this.dataForm.id}`, method: 'get' }).then(res => { - this.dataForm = res.data; + const data = res.data; + // 统一转换为字符串类型 + this.dataForm = { + ...data, + procCd: String(data.procCd || ''), + machineCd: String(data.machineCd || ''), + matCode: String(data.matCode || ''), + enabledStatus: String(data.enabledStatus || '1'), + }; + // 回显工艺参数列表 + if (data.detailList && Array.isArray(data.detailList)) { + this.paramList = data.detailList.map(item => { + // 优先使用后端返回的ID + let procParamId = String(item.procParamId || item.paramId || ''); + const paramName = item.procParamName || item.paramName; + + // 如果没有ID但有名称,根据名称查找对应的ID + if (!procParamId && paramName) { + const paramOption = this.paramNameOptions.find(opt => opt.label === paramName); + if (paramOption) { + procParamId = paramOption.value; + } + } + + return { + procParamId: procParamId || undefined, + procParamName: paramName, + standardValue: item.standardValue, + lowerLimit: item.lowerLimit || item.minValue, + upperLimit: item.upperLimit || item.maxValue, + dev: item.dev || item.deviation, + procParamUnit: item.procParamUnit || item.unit, + isAlert: String(item.isAlert || item.isWarning || '0'), + remark: item.remark, + }; + }); + } else { + this.paramList = []; + } this.loading = false; }).catch(() => { this.loading = false; @@ -225,6 +263,7 @@ export default { } else { this.loading = false; this.resetFormData(); + this.paramList = []; } }); }, @@ -259,18 +298,19 @@ export default { const list = res.data || []; this.paramNameOptions = list.map(item => ({ label: item.name || '', - value: item.id || '', + value: String(item.id || ''), })); }); }, addParamItem() { this.paramList.push({ + procParamId: undefined, procParamName: undefined, + procParamUnit: undefined, standardValue: undefined, lowerLimit: undefined, upperLimit: undefined, dev: undefined, - procParamUnit: undefined, isAlert: '0', remark: undefined, }); @@ -278,6 +318,14 @@ export default { removeParamItem(index) { this.paramList.splice(index, 1); }, + handleProcParamNameChange(val, row) { + const item = this.paramNameOptions.find(opt => opt.value === val); + if (item) { + row.procParamName = item.label; + } else { + row.procParamName = undefined; + } + }, loadProcList() { request({ url: `/api/example/proc/getProcList`, @@ -301,7 +349,7 @@ export default { this.materialList = res.data || []; this.materialOptions = this.materialList.map(item => ({ label: `${item.matName}`, - value: item.id, + value: String(item.id), matName: item.name, id: item.id, spec: item.spec @@ -317,7 +365,7 @@ export default { this.machineList = res.data || []; this.machineOptions = this.machineList.map(item => ({ label: `${item.name}`, - value: item.id, + value: String(item.id), machineName: item.name, id: item.id })); diff --git a/jnpf-java-boot/jnpf-web/src/views/example/machineparam/index.vue b/jnpf-java-boot/jnpf-web/src/views/example/machineparam/index.vue index 7494b4c..e7dddac 100644 --- a/jnpf-java-boot/jnpf-web/src/views/example/machineparam/index.vue +++ b/jnpf-java-boot/jnpf-web/src/views/example/machineparam/index.vue @@ -63,6 +63,7 @@ + @@ -70,6 +71,7 @@ import request from "@/utils/request"; import { mapGetters } from "vuex"; import JNPFForm from "./form"; +import JNPFDetail from "./detail"; import jnpf from "@/utils/jnpf"; import { enabledStatusOptions, getLabel } from '../common/dict' @@ -77,6 +79,7 @@ export default { name: "machineparam", components: { JNPFForm, + JNPFDetail, }, data() { return { @@ -102,6 +105,7 @@ export default { sidx: "", }, formVisible: false, + detailVisible: false, enabledStatusOptions, enabledStatusProps: { label: "fullName", value: "id" }, specOptions: [], @@ -145,9 +149,9 @@ export default { }); }, handleDetail(id) { - this.formVisible = true; + this.detailVisible = true; this.$nextTick(() => { - this.$refs.JNPFForm.init(id, 'detail'); + this.$refs.JNPFDetail.init(id); }); }, handleDelete(id) { diff --git a/jnpf-java-boot/jnpf-web/src/views/example/procparam/form.vue b/jnpf-java-boot/jnpf-web/src/views/example/procparam/form.vue index 7e0df9b..ab7caa3 100644 --- a/jnpf-java-boot/jnpf-web/src/views/example/procparam/form.vue +++ b/jnpf-java-boot/jnpf-web/src/views/example/procparam/form.vue @@ -224,7 +224,7 @@ export default { }, handleClose() { this.dialogVisible = false; - this.$emit('refresh', false) + this.$emit('refresh', true) }, } }