feat(machineparam): 优化机台参数表单的工序和机台关联功能
This commit is contained in:
parent
5558910d5c
commit
a6bb78590c
@ -29,5 +29,5 @@ public interface MachineService extends IService<MachineEntity> {
|
||||
String checkForm(MachineForm form, int i);
|
||||
void saveOrUpdate(MachineForm machineForm, String id, boolean isSave) throws Exception;
|
||||
|
||||
List<MachineEntity> getMachineList(String keyWord);
|
||||
List<MachineEntity> getMachineList(String keyWord, String procId);
|
||||
}
|
||||
|
||||
@ -172,11 +172,16 @@ public class MachineServiceImpl extends ServiceImpl<MachineMapper, MachineEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MachineEntity> getMachineList(String keyWord) {
|
||||
public List<MachineEntity> getMachineList(String keyWord, String procId) {
|
||||
LambdaQueryWrapper<MachineEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MachineEntity::getEnabledStatus, "1");
|
||||
wrapper.eq(MachineEntity::getDeleteMark, 0);
|
||||
wrapper.like(MachineEntity::getMachineName, keyWord);
|
||||
if (!"0".equals(procId)) {
|
||||
wrapper.eq(MachineEntity::getBelgProcId, procId);
|
||||
}
|
||||
if (StringUtil.isNotEmpty(keyWord)) {
|
||||
wrapper.like(MachineEntity::getMachineName, keyWord);
|
||||
}
|
||||
wrapper.orderByDesc(MachineEntity::getId);
|
||||
return this.list(wrapper);
|
||||
}
|
||||
|
||||
@ -159,6 +159,8 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, MaterialEnt
|
||||
LambdaQueryWrapper<MaterialEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MaterialEntity::getEnabledStatus, 1);
|
||||
wrapper.eq(MaterialEntity::getDeleteMark, 0);
|
||||
wrapper.eq(MaterialEntity::getMatType, "3");
|
||||
|
||||
if (StringUtil.isNotEmpty(keyWord)) {
|
||||
wrapper.like(MaterialEntity::getMatName, keyWord);
|
||||
}
|
||||
|
||||
@ -156,8 +156,9 @@ public class MachineController {
|
||||
//获取机台下拉列表
|
||||
@Operation(summary = "获取机台下拉列表")
|
||||
@GetMapping("/getMachineList")
|
||||
public ActionResult getMachineList(@RequestParam(required = false, defaultValue = "", value = "keyWord") String keyWord) {
|
||||
List<MachineEntity> list = machineService.getMachineList(keyWord);
|
||||
public ActionResult getMachineList(@RequestParam(required = false, defaultValue = "", value = "keyWord") String keyWord,
|
||||
@RequestParam(required = false, value = "procId", defaultValue = "0") String procId) {
|
||||
List<MachineEntity> list = machineService.getMachineList(keyWord, procId);
|
||||
List<Map<String, Object>> result = list.stream()
|
||||
.map(entity -> {
|
||||
Map<String, Object> map = JsonUtil.entityToMap(entity);
|
||||
@ -169,6 +170,4 @@ public class MachineController {
|
||||
.collect(Collectors.toList());
|
||||
return ActionResult.success(result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -11,13 +11,13 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工序" prop="procCd">
|
||||
<JnpfSelect v-model="dataForm.procCd" placeholder="请选择工序" :options="procOptions" :props="procProps" filterable clearable :disabled="!!dataForm.id" :style="{ width: '100%' }">
|
||||
<JnpfSelect v-model="dataForm.procCd" placeholder="请选择工序" :options="procOptions" :props="procProps" filterable clearable :disabled="!!dataForm.id" :style="{ width: '100%' }" @change="handleProcChange">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="机台" prop="machineCd">
|
||||
<JnpfSelect v-model="dataForm.machineCd" placeholder="请选择机台" :options="machineOptions" :props="machineProps" filterable clearable :disabled="!!dataForm.id" :style="{ width: '100%' }">
|
||||
<JnpfSelect v-model="dataForm.machineCd" placeholder="请选择机台" :options="machineOptions" :props="machineProps" filterable clearable :disabled="!!dataForm.id || !dataForm.procCd" :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -289,7 +289,6 @@ export default {
|
||||
loadBaseData() {
|
||||
this.loadProcList();
|
||||
this.loadMaterialList();
|
||||
this.loadMachineList();
|
||||
this.loadParamNameOptions();
|
||||
},
|
||||
loadParamNameOptions() {
|
||||
@ -319,7 +318,7 @@ export default {
|
||||
lowerLimit: undefined,
|
||||
upperLimit: undefined,
|
||||
dev: undefined,
|
||||
isAlert: '0',
|
||||
isAlert: '1',
|
||||
remark: undefined,
|
||||
});
|
||||
},
|
||||
@ -379,7 +378,7 @@ export default {
|
||||
}).then(res => {
|
||||
this.materialList = res.data || [];
|
||||
this.materialOptions = this.materialList.map(item => ({
|
||||
label: `${item.matName}`,
|
||||
label: `${item.matCode}-${item.matName}`,
|
||||
value: String(item.id),
|
||||
matName: item.name,
|
||||
id: item.id,
|
||||
@ -387,21 +386,36 @@ export default {
|
||||
}));
|
||||
});
|
||||
},
|
||||
loadMachineList() {
|
||||
loadMachineList(procId) {
|
||||
request({
|
||||
url: `/api/example/machine/getMachineList`,
|
||||
method: 'get',
|
||||
params: { keyWord: '' }
|
||||
data: { procId: procId || '' }
|
||||
}).then(res => {
|
||||
this.machineList = res.data || [];
|
||||
this.machineOptions = this.machineList.map(item => ({
|
||||
label: `${item.name}`,
|
||||
label: item.name || '',
|
||||
value: String(item.id),
|
||||
machineName: item.name,
|
||||
machineName: item.name || '',
|
||||
id: item.id
|
||||
}));
|
||||
});
|
||||
},
|
||||
handleProcChange(value) {
|
||||
this.dataForm.machineCd = undefined;
|
||||
if (value) {
|
||||
const proc = this.procOptions.find(item => item.value === value);
|
||||
if (proc) {
|
||||
this.dataForm.procId = proc.id;
|
||||
this.dataForm.procName = proc.procName;
|
||||
this.loadMachineList(proc.id);
|
||||
}
|
||||
} else {
|
||||
this.dataForm.procId = undefined;
|
||||
this.dataForm.procName = undefined;
|
||||
this.machineOptions = [];
|
||||
}
|
||||
},
|
||||
handleMaterialChange(value) {
|
||||
if (value) {
|
||||
const material = this.materialOptions.find(item => item.value === value);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user