基础资料限制修改

This commit is contained in:
2026-07-29 10:23:32 +08:00
parent 442a4c8ae2
commit 2310f79f43
10 changed files with 117 additions and 110 deletions

View File

@@ -1248,7 +1248,7 @@ jeecgboot-vue3/src/views/xslmes/mesXslDryingProcessSwitch/MesXslDryingProcessSwi
jeecgboot-vue3/src/views/xslmes/mesXslDryingProcessSwitch/MesXslDryingProcessSwitch.api.ts jeecgboot-vue3/src/views/xslmes/mesXslDryingProcessSwitch/MesXslDryingProcessSwitch.api.ts
-- author:jiangxh---date:20260708--for: 【MES】烘胶流程开启总开关+二次确认,不校验烘胶房日期) --- -- author:jiangxh---date:20260708--for: 【MES】烘胶流程开启总开关+二次确认,不校验烘胶房日期) ---
-- author:xsl---date:20260720--for: <20><>APPԭ<50><D4AD><EFBFBD><EFBFBD><EFBFBD>ͼ졿<CDBC>ֳֶ˰<D6B6><CBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ/<2F>ͼ<EFBFBD><><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD> --- -- author:xsl---date:20260720--for: <20><>APPԭ<50><D4AD><EFBFBD><EFBFBD><EFBFBD>ͼ졿<CDBC>ֳֶ˰<D6B6><CBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ/<2F>ͼ<EFBFBD><><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD>ҳ<EFBFBD><D2B3> ---
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/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/controller/MesXslRawMaterialInspectAppController.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRawMaterialInspectRecordService.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/rawMaterialInspect.vue
JeecgUniapp-master/src/pages/rawMaterialInspect/inspectResult.vue JeecgUniapp-master/src/pages/rawMaterialInspect/inspectResult.vue
JeecgUniapp-master/src/common/work.ts JeecgUniapp-master/src/common/work.ts
-- author:jiangxh---date:20260728--for: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD>Ϊͬһ<CDAC><EFBFBD><E8B1B8>Ψһ ---
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

View File

@@ -110,31 +110,43 @@ public class MesXslMixerConditionController
return Result.OK(entity); return Result.OK(entity);
} }
@Operation(summary = "校验条件名称是否重复") @Operation(summary = "校验条件名称是否重复(同一设备下)")
@GetMapping("/checkConditionName") @GetMapping("/checkConditionName")
public Result<String> checkConditionName( public Result<String> checkConditionName(
@RequestParam(name = "conditionName", required = true) String conditionName, @RequestParam(name = "conditionName", required = true) String conditionName,
@RequestParam(name = "equipmentId", required = false) String equipmentId,
@RequestParam(name = "dataId", required = false) String dataId) { @RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(conditionName) || conditionName.trim().isEmpty()) { if (oConvertUtils.isEmpty(conditionName) || conditionName.trim().isEmpty()) {
return Result.OK("该值可用!"); return Result.OK("该值可用!");
} }
if (mesXslMixerConditionService.isConditionNameDuplicated(conditionName, dataId)) { //update-begin---author:jiangxh ---date:20260728 for【密炼机条件】条件名称按设备唯一-----------
return Result.error("条件名称不能重复"); 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("该值可用!"); return Result.OK("该值可用!");
} }
@Operation(summary = "校验条件代码是否重复") @Operation(summary = "校验条件代码是否重复(同一设备下)")
@GetMapping("/checkConditionCode") @GetMapping("/checkConditionCode")
public Result<String> checkConditionCode( public Result<String> checkConditionCode(
@RequestParam(name = "conditionCode", required = true) String conditionCode, @RequestParam(name = "conditionCode", required = true) String conditionCode,
@RequestParam(name = "equipmentId", required = false) String equipmentId,
@RequestParam(name = "dataId", required = false) String dataId) { @RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(conditionCode) || conditionCode.trim().isEmpty()) { if (oConvertUtils.isEmpty(conditionCode) || conditionCode.trim().isEmpty()) {
return Result.OK("该值可用!"); return Result.OK("该值可用!");
} }
if (mesXslMixerConditionService.isConditionCodeDuplicated(conditionCode, dataId)) { //update-begin---author:jiangxh ---date:20260728 for【密炼机条件】条件代码按设备唯一-----------
return Result.error("条件代码不能重复"); 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("该值可用!"); return Result.OK("该值可用!");
} }
@@ -153,16 +165,20 @@ public class MesXslMixerConditionController
return "条件名称不能为空"; return "条件名称不能为空";
} }
model.setConditionName(model.getConditionName().trim()); model.setConditionName(model.getConditionName().trim());
if (mesXslMixerConditionService.isConditionNameDuplicated(model.getConditionName(), excludeId)) { //update-begin---author:jiangxh ---date:20260728 for【密炼机条件】条件名称/代码按设备唯一-----------
return "条件名称不能重复"; if (mesXslMixerConditionService.isConditionNameDuplicated(
model.getConditionName(), model.getEquipmentId(), excludeId)) {
return "同一设备下条件名称不能重复";
} }
if (oConvertUtils.isEmpty(model.getConditionCode()) || StringUtils.isBlank(model.getConditionCode())) { if (oConvertUtils.isEmpty(model.getConditionCode()) || StringUtils.isBlank(model.getConditionCode())) {
return "条件代码不能为空"; return "条件代码不能为空";
} }
model.setConditionCode(model.getConditionCode().trim()); model.setConditionCode(model.getConditionCode().trim());
if (mesXslMixerConditionService.isConditionCodeDuplicated(model.getConditionCode(), excludeId)) { if (mesXslMixerConditionService.isConditionCodeDuplicated(
return "条件代码不能重复"; model.getConditionCode(), model.getEquipmentId(), excludeId)) {
return "同一设备下条件代码不能重复";
} }
//update-end---author:jiangxh ---date:20260728 for【密炼机条件】条件名称/代码按设备唯一-----------
return null; return null;
} }
} }

View File

@@ -7,7 +7,9 @@ public interface IMesXslMixerConditionService extends IService<MesXslMixerCondit
void fillEquipmentName(MesXslMixerCondition model); void fillEquipmentName(MesXslMixerCondition model);
boolean isConditionNameDuplicated(String conditionName, String excludeId); //update-begin---author:jiangxh ---date:20260728 for【密炼机条件】条件名称/代码按设备唯一-----------
boolean isConditionNameDuplicated(String conditionName, String equipmentId, String excludeId);
boolean isConditionCodeDuplicated(String conditionCode, String excludeId); boolean isConditionCodeDuplicated(String conditionCode, String equipmentId, String excludeId);
//update-end---author:jiangxh ---date:20260728 for【密炼机条件】条件名称/代码按设备唯一-----------
} }

View File

@@ -18,13 +18,16 @@ public class MesXslMixerConditionServiceImpl
@Autowired private MesXslEquipmentLedgerMapper equipmentLedgerMapper; @Autowired private MesXslEquipmentLedgerMapper equipmentLedgerMapper;
//update-begin---author:jiangxh ---date:20260728 for【密炼机条件】条件名称/代码按设备唯一-----------
@Override @Override
public boolean isConditionNameDuplicated(String conditionName, String excludeId) { public boolean isConditionNameDuplicated(String conditionName, String equipmentId, String excludeId) {
if (StringUtils.isBlank(conditionName)) { if (StringUtils.isBlank(conditionName) || StringUtils.isBlank(equipmentId)) {
return false; return false;
} }
LambdaQueryWrapper<MesXslMixerCondition> wrapper = LambdaQueryWrapper<MesXslMixerCondition> wrapper =
new LambdaQueryWrapper<MesXslMixerCondition>().eq(MesXslMixerCondition::getConditionName, conditionName.trim()); new LambdaQueryWrapper<MesXslMixerCondition>()
.eq(MesXslMixerCondition::getEquipmentId, equipmentId.trim())
.eq(MesXslMixerCondition::getConditionName, conditionName.trim());
if (StringUtils.isNotBlank(excludeId)) { if (StringUtils.isNotBlank(excludeId)) {
wrapper.ne(MesXslMixerCondition::getId, excludeId.trim()); wrapper.ne(MesXslMixerCondition::getId, excludeId.trim());
} }
@@ -32,17 +35,20 @@ public class MesXslMixerConditionServiceImpl
} }
@Override @Override
public boolean isConditionCodeDuplicated(String conditionCode, String excludeId) { public boolean isConditionCodeDuplicated(String conditionCode, String equipmentId, String excludeId) {
if (StringUtils.isBlank(conditionCode)) { if (StringUtils.isBlank(conditionCode) || StringUtils.isBlank(equipmentId)) {
return false; return false;
} }
LambdaQueryWrapper<MesXslMixerCondition> wrapper = LambdaQueryWrapper<MesXslMixerCondition> wrapper =
new LambdaQueryWrapper<MesXslMixerCondition>().eq(MesXslMixerCondition::getConditionCode, conditionCode.trim()); new LambdaQueryWrapper<MesXslMixerCondition>()
.eq(MesXslMixerCondition::getEquipmentId, equipmentId.trim())
.eq(MesXslMixerCondition::getConditionCode, conditionCode.trim());
if (StringUtils.isNotBlank(excludeId)) { if (StringUtils.isNotBlank(excludeId)) {
wrapper.ne(MesXslMixerCondition::getId, excludeId.trim()); wrapper.ne(MesXslMixerCondition::getId, excludeId.trim());
} }
return this.count(wrapper) > 0; return this.count(wrapper) > 0;
} }
//update-end---author:jiangxh ---date:20260728 for【密炼机条件】条件名称/代码按设备唯一-----------
@Override @Override
public void fillEquipmentName(MesXslMixerCondition model) { public void fillEquipmentName(MesXslMixerCondition model) {

View File

@@ -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/MesXslRubberQuickTestRecord.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue
-- author:xsl---date:20260720--for: <20><>IM<49><4D><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> WebSocket<65><74>ͬ<EFBFBD>˺<EFBFBD> PC/APP <20><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>ʾ --- -- author:xsl---date:20260720--for: <20><>IM<49><4D><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD> WebSocket<65><74>ͬ<EFBFBD>˺<EFBFBD> PC/APP <20><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>ʾ ---
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/im/service/impl/SysImChatServiceImpl.java 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/imCache.ts
jeecgboot-vue3/src/views/system/im/ImChat.vue jeecgboot-vue3/src/views/system/im/ImChat.vue

View File

@@ -4,7 +4,7 @@ import { checkEquipmentCode, checkEquipmentName } from './MesXslEquipmentLedger.
const colHalf = { span: 12 }; const colHalf = { span: 12 };
export const columns: BasicColumn[] = [ 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: 'equipmentCode', width: 130 },
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 160 }, { title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 160 },
{ title: '工序', align: 'center', dataIndex: 'processOperationName', width: 120 }, { 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: 'equipmentTypeName', width: 110 },
{ title: '设备厂家', align: 'center', dataIndex: 'manufacturerName', width: 120 }, { title: '设备厂家', align: 'center', dataIndex: 'manufacturerName', width: 120 },
{ title: '所属工厂', align: 'center', dataIndex: 'factoryName', 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: 'equipmentStatus_dictText', width: 90 },
{ title: '是否启用', align: 'center', dataIndex: 'enabledFlag_dictText', width: 90 }, { title: '是否启用', align: 'center', dataIndex: 'enabledFlag_dictText', width: 90 },
{ title: '设备型号', align: 'center', dataIndex: 'equipmentModel', width: 110, defaultHidden: true }, { 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: 'equipmentCategoryId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择设备类别' }] },
{ label: '', field: 'equipmentTypeId', 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: 'factoryId', component: 'Input', show: false },
{
label: '所属工序',
field: 'processOperationName',
component: 'Input',
slot: 'processOperationPicker',
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择所属工序' }],
},
{ {
label: '系统编号', label: '系统编号',
field: 'ledgerNo', field: 'ledgerNo',
@@ -100,6 +94,30 @@ export const formSchema: FormSchema[] = [
colProps: colHalf, colProps: colHalf,
componentProps: { readonly: true, placeholder: '保存时从001起自动生成' }, 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: '设备编号', label: '设备编号',
field: 'equipmentCode', field: 'equipmentCode',
@@ -153,22 +171,6 @@ export const formSchema: FormSchema[] = [
slot: 'manufacturerPicker', slot: 'manufacturerPicker',
colProps: colHalf, 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: '所属工厂', label: '所属工厂',
field: 'factoryName', field: 'factoryName',

View File

@@ -10,13 +10,6 @@
@ok="handleSubmit" @ok="handleSubmit"
> >
<BasicForm @register="registerForm"> <BasicForm @register="registerForm">
<template #processOperationPicker="{ model, field }">
<a-input-group compact style="display: flex; width: 100%">
<a-input v-model:value="model[field]" read-only placeholder="请选择工序" style="flex: 1" />
<a-button type="primary" :disabled="isDetail" @click="openProcessSelect">选择</a-button>
<a-button v-if="model.processOperationId && !isDetail" @click="clearProcess(model)">清除</a-button>
</a-input-group>
</template>
<template #manufacturerPicker="{ model, field }"> <template #manufacturerPicker="{ model, field }">
<a-input-group compact style="display: flex; width: 100%"> <a-input-group compact style="display: flex; width: 100%">
<a-input v-model:value="model[field]" read-only placeholder="请选择设备厂家" style="flex: 1" /> <a-input v-model:value="model[field]" read-only placeholder="请选择设备厂家" style="flex: 1" />
@@ -24,13 +17,6 @@
<a-button v-if="model.manufacturerId && !isDetail" @click="clearManufacturer(model)">清除</a-button> <a-button v-if="model.manufacturerId && !isDetail" @click="clearManufacturer(model)">清除</a-button>
</a-input-group> </a-input-group>
</template> </template>
<template #equipmentCategoryPicker="{ model, field }">
<a-input-group compact style="display: flex; width: 100%">
<a-input v-model:value="model[field]" read-only placeholder="请选择设备类别" style="flex: 1" />
<a-button type="primary" :disabled="isDetail" @click="openCategorySelect">选择</a-button>
<a-button v-if="model.equipmentCategoryId && !isDetail" @click="clearCategory(model)">清除</a-button>
</a-input-group>
</template>
<template #equipmentTypePicker="{ model, field }"> <template #equipmentTypePicker="{ model, field }">
<a-input-group compact style="display: flex; width: 100%"> <a-input-group compact style="display: flex; width: 100%">
<a-input v-model:value="model[field]" read-only placeholder="请选择设备类型" style="flex: 1" /> <a-input v-model:value="model[field]" read-only placeholder="请选择设备类型" style="flex: 1" />
@@ -46,13 +32,11 @@
</a-input-group> </a-input-group>
</template> </template>
</BasicForm> </BasicForm>
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
<MesXslManufacturerSelectModal <MesXslManufacturerSelectModal
@register="registerManufacturerModal" @register="registerManufacturerModal"
:modal-title="manufacturerModalTitle" :modal-title="manufacturerModalTitle"
@select="onManufacturerSelect" @select="onManufacturerSelect"
/> />
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
<MesXslEquipmentTypeSelectModal @register="registerTypeModal" @select="onTypeSelect" /> <MesXslEquipmentTypeSelectModal @register="registerTypeModal" @select="onTypeSelect" />
</BasicModal> </BasicModal>
</template> </template>
@@ -61,14 +45,14 @@
import { computed, ref, unref, onMounted } from 'vue'; import { computed, ref, unref, onMounted } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal'; import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index'; import { BasicForm, useForm } from '/@/components/Form/index';
import { useMessage } from '/@/hooks/web/useMessage';
import { formSchema } from '../MesXslEquipmentLedger.data'; import { formSchema } from '../MesXslEquipmentLedger.data';
import { fetchNextLedgerNo, saveOrUpdate } from '../MesXslEquipmentLedger.api'; import { fetchNextLedgerNo, saveOrUpdate } from '../MesXslEquipmentLedger.api';
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
import MesXslManufacturerSelectModal from './MesXslManufacturerSelectModal.vue'; import MesXslManufacturerSelectModal from './MesXslManufacturerSelectModal.vue';
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
import MesXslEquipmentTypeSelectModal from './MesXslEquipmentTypeSelectModal.vue'; import MesXslEquipmentTypeSelectModal from './MesXslEquipmentTypeSelectModal.vue';
const emit = defineEmits(['register', 'success']); const emit = defineEmits(['register', 'success']);
const { createMessage } = useMessage();
const isUpdate = ref(true); const isUpdate = ref(true);
const isDetail = ref(false); const isDetail = ref(false);
@@ -89,9 +73,7 @@
manufacturerPickTarget.value === 'factory' ? '选择所属工厂' : '选择设备厂家', manufacturerPickTarget.value === 'factory' ? '选择所属工厂' : '选择设备厂家',
); );
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
const [registerManufacturerModal, { openModal: openManufacturerModal }] = useModal(); const [registerManufacturerModal, { openModal: openManufacturerModal }] = useModal();
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
const [registerTypeModal, { openModal: openTypeModal }] = useModal(); const [registerTypeModal, { openModal: openTypeModal }] = useModal();
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({ const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
@@ -127,11 +109,6 @@
!unref(isUpdate) ? '新增设备台账' : unref(isDetail) ? '设备台账详情' : '编辑设备台账', !unref(isUpdate) ? '新增设备台账' : unref(isDetail) ? '设备台账详情' : '编辑设备台账',
); );
function openProcessSelect() {
const v = getFieldsValue();
openProcessModal(true, { processOperationId: v?.processOperationId });
}
function openManufacturerSelect(target: 'manufacturer' | 'factory') { function openManufacturerSelect(target: 'manufacturer' | 'factory') {
manufacturerPickTarget.value = target; manufacturerPickTarget.value = target;
const v = getFieldsValue(); const v = getFieldsValue();
@@ -140,23 +117,11 @@
}); });
} }
function openCategorySelect() {
const v = getFieldsValue();
openCategoryModal(true, { equipmentCategoryId: v?.equipmentCategoryId });
}
function openTypeSelect() { function openTypeSelect() {
const v = getFieldsValue(); const v = getFieldsValue();
openTypeModal(true, { equipmentTypeId: v?.equipmentTypeId }); openTypeModal(true, { equipmentTypeId: v?.equipmentTypeId });
} }
function onProcessSelect(payload: Recordable) {
setFieldsValue({
processOperationId: payload.processOperationId,
processOperationName: payload.processOperationName,
});
}
function onManufacturerSelect(payload: Recordable) { function onManufacturerSelect(payload: Recordable) {
if (manufacturerPickTarget.value === 'factory') { if (manufacturerPickTarget.value === 'factory') {
setFieldsValue({ setFieldsValue({
@@ -171,27 +136,17 @@
} }
} }
function onCategorySelect(payload: Recordable) {
setFieldsValue({
equipmentCategoryId: payload.equipmentCategoryId,
equipmentCategoryName: payload.equipmentCategoryName,
});
}
function onTypeSelect(payload: Recordable) { function onTypeSelect(payload: Recordable) {
setFieldsValue({ setFieldsValue({
equipmentTypeId: payload.equipmentTypeId, equipmentTypeId: payload.equipmentTypeId || '',
equipmentTypeName: payload.equipmentTypeName, equipmentTypeName: payload.equipmentTypeName || '',
equipmentCategoryId: payload.equipmentCategoryId || getFieldsValue()?.equipmentCategoryId, equipmentCategoryId: payload.equipmentCategoryId || '',
equipmentCategoryName: payload.equipmentCategoryName || getFieldsValue()?.equipmentCategoryName, equipmentCategoryName: payload.equipmentCategoryName || '',
processOperationId: payload.processOperationId || '',
processOperationName: payload.processOperationName || '',
}); });
} }
function clearProcess(model: Recordable) {
model.processOperationId = '';
model.processOperationName = '';
}
function clearManufacturer(model: Recordable) { function clearManufacturer(model: Recordable) {
model.manufacturerId = ''; model.manufacturerId = '';
model.manufacturerName = ''; model.manufacturerName = '';
@@ -202,26 +157,38 @@
model.factoryName = ''; model.factoryName = '';
} }
function clearCategory(model: Recordable) {
model.equipmentCategoryId = '';
model.equipmentCategoryName = '';
}
function clearType(model: Recordable) { function clearType(model: Recordable) {
model.equipmentTypeId = ''; model.equipmentTypeId = '';
model.equipmentTypeName = ''; model.equipmentTypeName = '';
model.equipmentCategoryId = '';
model.equipmentCategoryName = '';
model.processOperationId = '';
model.processOperationName = '';
} }
async function handleSubmit() { async function handleSubmit() {
try { try {
const values = await validate(); // validate 结果可能不含隐藏字段最新值,与 getFieldsValue 合并
const values = { ...(getFieldsValue() || {}), ...(await validate()) };
if (!values.equipmentTypeId) {
createMessage.warning('请选择设备类型');
return;
}
if (!values.processOperationId) { if (!values.processOperationId) {
createMessage.warning('所选设备类型未绑定工序,请先维护设备类型');
return;
}
if (!values.equipmentCategoryId) {
createMessage.warning('所选设备类型未绑定设备类别,请先维护设备类型');
return; return;
} }
setModalProps({ confirmLoading: true }); setModalProps({ confirmLoading: true });
await saveOrUpdate(values, isUpdate.value); await saveOrUpdate(values, isUpdate.value);
closeModal(); closeModal();
emit('success'); emit('success');
} catch (e) {
// 表单校验失败时 ant-design 会标红;此处避免未捕获异常导致“点保存无反应”
console.warn('[设备台账] 保存校验未通过', e);
} finally { } finally {
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
} }

View File

@@ -79,6 +79,8 @@
equipmentTypeName: '', equipmentTypeName: '',
equipmentCategoryId: '', equipmentCategoryId: '',
equipmentCategoryName: '', equipmentCategoryName: '',
processOperationId: '',
processOperationName: '',
}); });
closeModal(); closeModal();
return; return;
@@ -88,6 +90,8 @@
equipmentTypeName: row.typeName || '', equipmentTypeName: row.typeName || '',
equipmentCategoryId: row.equipmentCategoryId || '', equipmentCategoryId: row.equipmentCategoryId || '',
equipmentCategoryName: row.equipmentCategoryName || '', equipmentCategoryName: row.equipmentCategoryName || '',
processOperationId: row.processOperationId || '',
processOperationName: row.processOperationName || '',
}); });
closeModal(); closeModal();
} }

View File

@@ -14,10 +14,10 @@ enum Api {
export const list = (params) => defHttp.get({ url: Api.list, params }); 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' }); 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' }); defHttp.get({ url: Api.checkConditionCode, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const deleteOne = (params, handleSuccess) => export const deleteOne = (params, handleSuccess) =>

View File

@@ -42,11 +42,13 @@ export const formSchema: FormSchema[] = [
validator: async (_rule, value) => { validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim(); const v = value == null ? '' : String(value).trim();
if (!v) return Promise.resolve(); if (!v) return Promise.resolve();
// 未选设备时不做跨设备校验,保存时仍会强制校验
if (!model?.equipmentId) return Promise.resolve();
try { try {
await checkConditionName({ conditionName: v, dataId: model?.id }); await checkConditionName({ conditionName: v, equipmentId: model.equipmentId, dataId: model?.id });
return Promise.resolve(); return Promise.resolve();
} catch (e: any) { } catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '条件名称不能重复'); return Promise.reject(e?.response?.data?.message || e?.message || '同一设备下条件名称不能重复');
} }
}, },
trigger: 'blur', trigger: 'blur',
@@ -64,11 +66,12 @@ export const formSchema: FormSchema[] = [
validator: async (_rule, value) => { validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim(); const v = value == null ? '' : String(value).trim();
if (!v) return Promise.resolve(); if (!v) return Promise.resolve();
if (!model?.equipmentId) return Promise.resolve();
try { try {
await checkConditionCode({ conditionCode: v, dataId: model?.id }); await checkConditionCode({ conditionCode: v, equipmentId: model.equipmentId, dataId: model?.id });
return Promise.resolve(); return Promise.resolve();
} catch (e: any) { } catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '条件代码不能重复'); return Promise.reject(e?.response?.data?.message || e?.message || '同一设备下条件代码不能重复');
} }
}, },
trigger: 'blur', trigger: 'blur',