diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 index 07b7171a..84d9ad0a 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/doc/代码修改日志 @@ -1248,7 +1248,7 @@ jeecgboot-vue3/src/views/xslmes/mesXslDryingProcessSwitch/MesXslDryingProcessSwi jeecgboot-vue3/src/views/xslmes/mesXslDryingProcessSwitch/MesXslDryingProcessSwitch.api.ts -- author:jiangxh---date:20260708--for: 【MES】烘胶流程开启(总开关+二次确认,不校验烘胶房日期) --- --- author:xsl---date:20260720--for: APPԭͼ졿ֳֶ˰ѯ/ͼ/¼ӿҳ --- +-- author:xsl---date:20260720--for: ��APPԭ�����ͼ졿�ֳֶ˰������ѯ/�ͼ�/¼��������ӿ���ҳ�� --- jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslRawMaterialInspectAppScanVo.java jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRawMaterialInspectAppController.java jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRawMaterialInspectRecordService.java @@ -1257,3 +1257,10 @@ JeecgUniapp-master/src/service/xslmes/rawMaterialInspect.ts JeecgUniapp-master/src/pages/rawMaterialInspect/rawMaterialInspect.vue JeecgUniapp-master/src/pages/rawMaterialInspect/inspectResult.vue JeecgUniapp-master/src/common/work.ts + +-- author:jiangxh---date:20260728--for: ����������������������/�����Ϊͬһ�豸��Ψһ --- +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerConditionService.java +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerConditionServiceImpl.java +jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerConditionController.java +jeecgboot-vue3/src/views/xslmes/mesXslMixerCondition/MesXslMixerCondition.api.ts +jeecgboot-vue3/src/views/xslmes/mesXslMixerCondition/MesXslMixerCondition.data.ts diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerConditionController.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerConditionController.java index 90dfc038..f30ebd8d 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerConditionController.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixerConditionController.java @@ -110,31 +110,43 @@ public class MesXslMixerConditionController return Result.OK(entity); } - @Operation(summary = "校验条件名称是否重复") + @Operation(summary = "校验条件名称是否重复(同一设备下)") @GetMapping("/checkConditionName") public Result checkConditionName( @RequestParam(name = "conditionName", required = true) String conditionName, + @RequestParam(name = "equipmentId", required = false) String equipmentId, @RequestParam(name = "dataId", required = false) String dataId) { if (oConvertUtils.isEmpty(conditionName) || conditionName.trim().isEmpty()) { return Result.OK("该值可用!"); } - if (mesXslMixerConditionService.isConditionNameDuplicated(conditionName, dataId)) { - return Result.error("条件名称不能重复"); + //update-begin---author:jiangxh ---date:20260728 for:【密炼机条件】条件名称按设备唯一----------- + if (oConvertUtils.isEmpty(equipmentId) || equipmentId.trim().isEmpty()) { + return Result.OK("该值可用!"); } + if (mesXslMixerConditionService.isConditionNameDuplicated(conditionName, equipmentId, dataId)) { + return Result.error("同一设备下条件名称不能重复"); + } + //update-end---author:jiangxh ---date:20260728 for:【密炼机条件】条件名称按设备唯一----------- return Result.OK("该值可用!"); } - @Operation(summary = "校验条件代码是否重复") + @Operation(summary = "校验条件代码是否重复(同一设备下)") @GetMapping("/checkConditionCode") public Result checkConditionCode( @RequestParam(name = "conditionCode", required = true) String conditionCode, + @RequestParam(name = "equipmentId", required = false) String equipmentId, @RequestParam(name = "dataId", required = false) String dataId) { if (oConvertUtils.isEmpty(conditionCode) || conditionCode.trim().isEmpty()) { return Result.OK("该值可用!"); } - if (mesXslMixerConditionService.isConditionCodeDuplicated(conditionCode, dataId)) { - return Result.error("条件代码不能重复"); + //update-begin---author:jiangxh ---date:20260728 for:【密炼机条件】条件代码按设备唯一----------- + if (oConvertUtils.isEmpty(equipmentId) || equipmentId.trim().isEmpty()) { + return Result.OK("该值可用!"); } + if (mesXslMixerConditionService.isConditionCodeDuplicated(conditionCode, equipmentId, dataId)) { + return Result.error("同一设备下条件代码不能重复"); + } + //update-end---author:jiangxh ---date:20260728 for:【密炼机条件】条件代码按设备唯一----------- return Result.OK("该值可用!"); } @@ -153,16 +165,20 @@ public class MesXslMixerConditionController return "条件名称不能为空"; } model.setConditionName(model.getConditionName().trim()); - if (mesXslMixerConditionService.isConditionNameDuplicated(model.getConditionName(), excludeId)) { - return "条件名称不能重复"; + //update-begin---author:jiangxh ---date:20260728 for:【密炼机条件】条件名称/代码按设备唯一----------- + if (mesXslMixerConditionService.isConditionNameDuplicated( + model.getConditionName(), model.getEquipmentId(), excludeId)) { + return "同一设备下条件名称不能重复"; } if (oConvertUtils.isEmpty(model.getConditionCode()) || StringUtils.isBlank(model.getConditionCode())) { return "条件代码不能为空"; } model.setConditionCode(model.getConditionCode().trim()); - if (mesXslMixerConditionService.isConditionCodeDuplicated(model.getConditionCode(), excludeId)) { - return "条件代码不能重复"; + if (mesXslMixerConditionService.isConditionCodeDuplicated( + model.getConditionCode(), model.getEquipmentId(), excludeId)) { + return "同一设备下条件代码不能重复"; } + //update-end---author:jiangxh ---date:20260728 for:【密炼机条件】条件名称/代码按设备唯一----------- return null; } } diff --git a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerConditionService.java b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerConditionService.java index 76952369..79d9eab2 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerConditionService.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixerConditionService.java @@ -7,7 +7,9 @@ public interface IMesXslMixerConditionService extends IService wrapper = - new LambdaQueryWrapper().eq(MesXslMixerCondition::getConditionName, conditionName.trim()); + new LambdaQueryWrapper() + .eq(MesXslMixerCondition::getEquipmentId, equipmentId.trim()) + .eq(MesXslMixerCondition::getConditionName, conditionName.trim()); if (StringUtils.isNotBlank(excludeId)) { wrapper.ne(MesXslMixerCondition::getId, excludeId.trim()); } @@ -32,17 +35,20 @@ public class MesXslMixerConditionServiceImpl } @Override - public boolean isConditionCodeDuplicated(String conditionCode, String excludeId) { - if (StringUtils.isBlank(conditionCode)) { + public boolean isConditionCodeDuplicated(String conditionCode, String equipmentId, String excludeId) { + if (StringUtils.isBlank(conditionCode) || StringUtils.isBlank(equipmentId)) { return false; } LambdaQueryWrapper wrapper = - new LambdaQueryWrapper().eq(MesXslMixerCondition::getConditionCode, conditionCode.trim()); + new LambdaQueryWrapper() + .eq(MesXslMixerCondition::getEquipmentId, equipmentId.trim()) + .eq(MesXslMixerCondition::getConditionCode, conditionCode.trim()); if (StringUtils.isNotBlank(excludeId)) { wrapper.ne(MesXslMixerCondition::getId, excludeId.trim()); } return this.count(wrapper) > 0; } + //update-end---author:jiangxh ---date:20260728 for:【密炼机条件】条件名称/代码按设备唯一----------- @Override public void fillEquipmentName(MesXslMixerCondition model) { diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/docs/代码修改日志 b/jeecg-boot/jeecg-module-system/jeecg-system-biz/docs/代码修改日志 index 606f54c1..1a5ec7ff 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/docs/代码修改日志 +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/docs/代码修改日志 @@ -602,7 +602,7 @@ jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecord.data.ts jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue --- author:xsl---date:20260720--for: IMͬͷҲ WebSocketͬ˺ PC/APP ͬʾ --- +-- author:xsl---date:20260720--for: ��IM���ͬ�������ͷ�Ҳ���� WebSocket��ͬ�˺� PC/APP ����ͬ����ʾ --- jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/im/service/impl/SysImChatServiceImpl.java jeecgboot-vue3/src/views/system/im/imCache.ts jeecgboot-vue3/src/views/system/im/ImChat.vue diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts b/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts index 70318c1f..b5459a70 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts +++ b/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts @@ -4,7 +4,7 @@ import { checkEquipmentCode, checkEquipmentName } from './MesXslEquipmentLedger. const colHalf = { span: 12 }; export const columns: BasicColumn[] = [ - { title: '系统编号', align: 'center', dataIndex: 'ledgerNo', width: 100 }, + { title: '系统编号', align: 'center', dataIndex: 'ledgerNo', width: 100, defaultHidden: true }, { title: '设备编号', align: 'center', dataIndex: 'equipmentCode', width: 130 }, { title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 160 }, { title: '工序', align: 'center', dataIndex: 'processOperationName', width: 120 }, @@ -12,6 +12,8 @@ export const columns: BasicColumn[] = [ { title: '设备类型', align: 'center', dataIndex: 'equipmentTypeName', width: 110 }, { title: '设备厂家', align: 'center', dataIndex: 'manufacturerName', width: 120 }, { title: '所属工厂', align: 'center', dataIndex: 'factoryName', width: 120 }, + { title: '设备描述', align: 'left', dataIndex: 'equipmentDesc', width: 200, ellipsis: true }, + { title: '受控PDA', align: 'center', dataIndex: 'controlledPda', width: 120 }, { title: '设备状态', align: 'center', dataIndex: 'equipmentStatus_dictText', width: 90 }, { title: '是否启用', align: 'center', dataIndex: 'enabledFlag_dictText', width: 90 }, { title: '设备型号', align: 'center', dataIndex: 'equipmentModel', width: 110, defaultHidden: true }, @@ -85,14 +87,6 @@ export const formSchema: FormSchema[] = [ { label: '', field: 'equipmentCategoryId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择设备类别' }] }, { label: '', field: 'equipmentTypeId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择设备类型' }] }, { label: '', field: 'factoryId', component: 'Input', show: false }, - { - label: '所属工序', - field: 'processOperationName', - component: 'Input', - slot: 'processOperationPicker', - colProps: colHalf, - dynamicRules: () => [{ required: true, message: '请选择所属工序' }], - }, { label: '系统编号', field: 'ledgerNo', @@ -100,6 +94,30 @@ export const formSchema: FormSchema[] = [ colProps: colHalf, componentProps: { readonly: true, placeholder: '保存时从001起自动生成' }, }, + { + label: '设备类型', + field: 'equipmentTypeName', + component: 'Input', + slot: 'equipmentTypePicker', + colProps: colHalf, + dynamicRules: () => [{ required: true, message: '请选择设备类型' }], + }, + { + label: '所属工序', + field: 'processOperationName', + component: 'Input', + colProps: colHalf, + componentProps: { readonly: true, placeholder: '选择设备类型后自动带出' }, + dynamicRules: () => [{ required: true, message: '请先选择设备类型' }], + }, + { + label: '设备类别', + field: 'equipmentCategoryName', + component: 'Input', + colProps: colHalf, + componentProps: { readonly: true, placeholder: '选择设备类型后自动带出' }, + dynamicRules: () => [{ required: true, message: '请先选择设备类型' }], + }, { label: '设备编号', field: 'equipmentCode', @@ -153,22 +171,6 @@ export const formSchema: FormSchema[] = [ slot: 'manufacturerPicker', colProps: colHalf, }, - { - label: '设备类别', - field: 'equipmentCategoryName', - component: 'Input', - slot: 'equipmentCategoryPicker', - colProps: colHalf, - dynamicRules: () => [{ required: true, message: '请选择设备类别' }], - }, - { - label: '设备类型', - field: 'equipmentTypeName', - component: 'Input', - slot: 'equipmentTypePicker', - colProps: colHalf, - dynamicRules: () => [{ required: true, message: '请选择设备类型' }], - }, { label: '所属工厂', field: 'factoryName', diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentLedgerModal.vue b/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentLedgerModal.vue index 63f9dc77..4f1d6329 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentLedgerModal.vue +++ b/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentLedgerModal.vue @@ -10,13 +10,6 @@ @ok="handleSubmit" > - - - - @@ -61,14 +45,14 @@ import { computed, ref, unref, onMounted } from 'vue'; import { BasicModal, useModalInner, useModal } from '/@/components/Modal'; import { BasicForm, useForm } from '/@/components/Form/index'; + import { useMessage } from '/@/hooks/web/useMessage'; import { formSchema } from '../MesXslEquipmentLedger.data'; import { fetchNextLedgerNo, saveOrUpdate } from '../MesXslEquipmentLedger.api'; - import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue'; import MesXslManufacturerSelectModal from './MesXslManufacturerSelectModal.vue'; - import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue'; import MesXslEquipmentTypeSelectModal from './MesXslEquipmentTypeSelectModal.vue'; const emit = defineEmits(['register', 'success']); + const { createMessage } = useMessage(); const isUpdate = ref(true); const isDetail = ref(false); @@ -89,9 +73,7 @@ manufacturerPickTarget.value === 'factory' ? '选择所属工厂' : '选择设备厂家', ); - const [registerProcessModal, { openModal: openProcessModal }] = useModal(); const [registerManufacturerModal, { openModal: openManufacturerModal }] = useModal(); - const [registerCategoryModal, { openModal: openCategoryModal }] = useModal(); const [registerTypeModal, { openModal: openTypeModal }] = useModal(); const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({ @@ -127,11 +109,6 @@ !unref(isUpdate) ? '新增设备台账' : unref(isDetail) ? '设备台账详情' : '编辑设备台账', ); - function openProcessSelect() { - const v = getFieldsValue(); - openProcessModal(true, { processOperationId: v?.processOperationId }); - } - function openManufacturerSelect(target: 'manufacturer' | 'factory') { manufacturerPickTarget.value = target; const v = getFieldsValue(); @@ -140,23 +117,11 @@ }); } - function openCategorySelect() { - const v = getFieldsValue(); - openCategoryModal(true, { equipmentCategoryId: v?.equipmentCategoryId }); - } - function openTypeSelect() { const v = getFieldsValue(); openTypeModal(true, { equipmentTypeId: v?.equipmentTypeId }); } - function onProcessSelect(payload: Recordable) { - setFieldsValue({ - processOperationId: payload.processOperationId, - processOperationName: payload.processOperationName, - }); - } - function onManufacturerSelect(payload: Recordable) { if (manufacturerPickTarget.value === 'factory') { setFieldsValue({ @@ -171,27 +136,17 @@ } } - function onCategorySelect(payload: Recordable) { - setFieldsValue({ - equipmentCategoryId: payload.equipmentCategoryId, - equipmentCategoryName: payload.equipmentCategoryName, - }); - } - function onTypeSelect(payload: Recordable) { setFieldsValue({ - equipmentTypeId: payload.equipmentTypeId, - equipmentTypeName: payload.equipmentTypeName, - equipmentCategoryId: payload.equipmentCategoryId || getFieldsValue()?.equipmentCategoryId, - equipmentCategoryName: payload.equipmentCategoryName || getFieldsValue()?.equipmentCategoryName, + equipmentTypeId: payload.equipmentTypeId || '', + equipmentTypeName: payload.equipmentTypeName || '', + equipmentCategoryId: payload.equipmentCategoryId || '', + equipmentCategoryName: payload.equipmentCategoryName || '', + processOperationId: payload.processOperationId || '', + processOperationName: payload.processOperationName || '', }); } - function clearProcess(model: Recordable) { - model.processOperationId = ''; - model.processOperationName = ''; - } - function clearManufacturer(model: Recordable) { model.manufacturerId = ''; model.manufacturerName = ''; @@ -202,26 +157,38 @@ model.factoryName = ''; } - function clearCategory(model: Recordable) { - model.equipmentCategoryId = ''; - model.equipmentCategoryName = ''; - } - function clearType(model: Recordable) { model.equipmentTypeId = ''; model.equipmentTypeName = ''; + model.equipmentCategoryId = ''; + model.equipmentCategoryName = ''; + model.processOperationId = ''; + model.processOperationName = ''; } async function handleSubmit() { try { - const values = await validate(); + // validate 结果可能不含隐藏字段最新值,与 getFieldsValue 合并 + const values = { ...(getFieldsValue() || {}), ...(await validate()) }; + if (!values.equipmentTypeId) { + createMessage.warning('请选择设备类型'); + return; + } if (!values.processOperationId) { + createMessage.warning('所选设备类型未绑定工序,请先维护设备类型'); + return; + } + if (!values.equipmentCategoryId) { + createMessage.warning('所选设备类型未绑定设备类别,请先维护设备类型'); return; } setModalProps({ confirmLoading: true }); await saveOrUpdate(values, isUpdate.value); closeModal(); emit('success'); + } catch (e) { + // 表单校验失败时 ant-design 会标红;此处避免未捕获异常导致“点保存无反应” + console.warn('[设备台账] 保存校验未通过', e); } finally { setModalProps({ confirmLoading: false }); } diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentTypeSelectModal.vue b/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentTypeSelectModal.vue index 9ce6537f..57951dc0 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentTypeSelectModal.vue +++ b/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentTypeSelectModal.vue @@ -79,6 +79,8 @@ equipmentTypeName: '', equipmentCategoryId: '', equipmentCategoryName: '', + processOperationId: '', + processOperationName: '', }); closeModal(); return; @@ -88,6 +90,8 @@ equipmentTypeName: row.typeName || '', equipmentCategoryId: row.equipmentCategoryId || '', equipmentCategoryName: row.equipmentCategoryName || '', + processOperationId: row.processOperationId || '', + processOperationName: row.processOperationName || '', }); closeModal(); } diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslMixerCondition/MesXslMixerCondition.api.ts b/jeecgboot-vue3/src/views/xslmes/mesXslMixerCondition/MesXslMixerCondition.api.ts index a381d3ec..f857e08c 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslMixerCondition/MesXslMixerCondition.api.ts +++ b/jeecgboot-vue3/src/views/xslmes/mesXslMixerCondition/MesXslMixerCondition.api.ts @@ -14,10 +14,10 @@ enum Api { export const list = (params) => defHttp.get({ url: Api.list, params }); -export const checkConditionName = (params: { conditionName: string; dataId?: string }) => +export const checkConditionName = (params: { conditionName: string; equipmentId?: string; dataId?: string }) => defHttp.get({ url: Api.checkConditionName, params }, { successMessageMode: 'none', errorMessageMode: 'none' }); -export const checkConditionCode = (params: { conditionCode: string; dataId?: string }) => +export const checkConditionCode = (params: { conditionCode: string; equipmentId?: string; dataId?: string }) => defHttp.get({ url: Api.checkConditionCode, params }, { successMessageMode: 'none', errorMessageMode: 'none' }); export const deleteOne = (params, handleSuccess) => diff --git a/jeecgboot-vue3/src/views/xslmes/mesXslMixerCondition/MesXslMixerCondition.data.ts b/jeecgboot-vue3/src/views/xslmes/mesXslMixerCondition/MesXslMixerCondition.data.ts index 3de40e0a..aac08657 100644 --- a/jeecgboot-vue3/src/views/xslmes/mesXslMixerCondition/MesXslMixerCondition.data.ts +++ b/jeecgboot-vue3/src/views/xslmes/mesXslMixerCondition/MesXslMixerCondition.data.ts @@ -42,11 +42,13 @@ export const formSchema: FormSchema[] = [ validator: async (_rule, value) => { const v = value == null ? '' : String(value).trim(); if (!v) return Promise.resolve(); + // 未选设备时不做跨设备校验,保存时仍会强制校验 + if (!model?.equipmentId) return Promise.resolve(); try { - await checkConditionName({ conditionName: v, dataId: model?.id }); + await checkConditionName({ conditionName: v, equipmentId: model.equipmentId, dataId: model?.id }); return Promise.resolve(); } catch (e: any) { - return Promise.reject(e?.response?.data?.message || e?.message || '条件名称不能重复'); + return Promise.reject(e?.response?.data?.message || e?.message || '同一设备下条件名称不能重复'); } }, trigger: 'blur', @@ -64,11 +66,12 @@ export const formSchema: FormSchema[] = [ validator: async (_rule, value) => { const v = value == null ? '' : String(value).trim(); if (!v) return Promise.resolve(); + if (!model?.equipmentId) return Promise.resolve(); try { - await checkConditionCode({ conditionCode: v, dataId: model?.id }); + await checkConditionCode({ conditionCode: v, equipmentId: model.equipmentId, dataId: model?.id }); return Promise.resolve(); } catch (e: any) { - return Promise.reject(e?.response?.data?.message || e?.message || '条件代码不能重复'); + return Promise.reject(e?.response?.data?.message || e?.message || '同一设备下条件代码不能重复'); } }, trigger: 'blur',