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);
|
String checkForm(MachineForm form, int i);
|
||||||
void saveOrUpdate(MachineForm machineForm, String id, boolean isSave) throws Exception;
|
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
|
@Override
|
||||||
public List<MachineEntity> getMachineList(String keyWord) {
|
public List<MachineEntity> getMachineList(String keyWord, String procId) {
|
||||||
LambdaQueryWrapper<MachineEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MachineEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(MachineEntity::getEnabledStatus, "1");
|
wrapper.eq(MachineEntity::getEnabledStatus, "1");
|
||||||
wrapper.eq(MachineEntity::getDeleteMark, 0);
|
wrapper.eq(MachineEntity::getDeleteMark, 0);
|
||||||
|
if (!"0".equals(procId)) {
|
||||||
|
wrapper.eq(MachineEntity::getBelgProcId, procId);
|
||||||
|
}
|
||||||
|
if (StringUtil.isNotEmpty(keyWord)) {
|
||||||
wrapper.like(MachineEntity::getMachineName, keyWord);
|
wrapper.like(MachineEntity::getMachineName, keyWord);
|
||||||
|
}
|
||||||
wrapper.orderByDesc(MachineEntity::getId);
|
wrapper.orderByDesc(MachineEntity::getId);
|
||||||
return this.list(wrapper);
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -159,6 +159,8 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, MaterialEnt
|
|||||||
LambdaQueryWrapper<MaterialEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MaterialEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(MaterialEntity::getEnabledStatus, 1);
|
wrapper.eq(MaterialEntity::getEnabledStatus, 1);
|
||||||
wrapper.eq(MaterialEntity::getDeleteMark, 0);
|
wrapper.eq(MaterialEntity::getDeleteMark, 0);
|
||||||
|
wrapper.eq(MaterialEntity::getMatType, "3");
|
||||||
|
|
||||||
if (StringUtil.isNotEmpty(keyWord)) {
|
if (StringUtil.isNotEmpty(keyWord)) {
|
||||||
wrapper.like(MaterialEntity::getMatName, keyWord);
|
wrapper.like(MaterialEntity::getMatName, keyWord);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -156,8 +156,9 @@ public class MachineController {
|
|||||||
//获取机台下拉列表
|
//获取机台下拉列表
|
||||||
@Operation(summary = "获取机台下拉列表")
|
@Operation(summary = "获取机台下拉列表")
|
||||||
@GetMapping("/getMachineList")
|
@GetMapping("/getMachineList")
|
||||||
public ActionResult getMachineList(@RequestParam(required = false, defaultValue = "", value = "keyWord") String keyWord) {
|
public ActionResult getMachineList(@RequestParam(required = false, defaultValue = "", value = "keyWord") String keyWord,
|
||||||
List<MachineEntity> list = machineService.getMachineList(keyWord);
|
@RequestParam(required = false, value = "procId", defaultValue = "0") String procId) {
|
||||||
|
List<MachineEntity> list = machineService.getMachineList(keyWord, procId);
|
||||||
List<Map<String, Object>> result = list.stream()
|
List<Map<String, Object>> result = list.stream()
|
||||||
.map(entity -> {
|
.map(entity -> {
|
||||||
Map<String, Object> map = JsonUtil.entityToMap(entity);
|
Map<String, Object> map = JsonUtil.entityToMap(entity);
|
||||||
@ -169,6 +170,4 @@ public class MachineController {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return ActionResult.success(result);
|
return ActionResult.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,13 +11,13 @@
|
|||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="工序" prop="procCd">
|
<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>
|
</JnpfSelect>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="机台" prop="machineCd">
|
<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>
|
</JnpfSelect>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -289,7 +289,6 @@ export default {
|
|||||||
loadBaseData() {
|
loadBaseData() {
|
||||||
this.loadProcList();
|
this.loadProcList();
|
||||||
this.loadMaterialList();
|
this.loadMaterialList();
|
||||||
this.loadMachineList();
|
|
||||||
this.loadParamNameOptions();
|
this.loadParamNameOptions();
|
||||||
},
|
},
|
||||||
loadParamNameOptions() {
|
loadParamNameOptions() {
|
||||||
@ -319,7 +318,7 @@ export default {
|
|||||||
lowerLimit: undefined,
|
lowerLimit: undefined,
|
||||||
upperLimit: undefined,
|
upperLimit: undefined,
|
||||||
dev: undefined,
|
dev: undefined,
|
||||||
isAlert: '0',
|
isAlert: '1',
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -379,7 +378,7 @@ export default {
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.materialList = res.data || [];
|
this.materialList = res.data || [];
|
||||||
this.materialOptions = this.materialList.map(item => ({
|
this.materialOptions = this.materialList.map(item => ({
|
||||||
label: `${item.matName}`,
|
label: `${item.matCode}-${item.matName}`,
|
||||||
value: String(item.id),
|
value: String(item.id),
|
||||||
matName: item.name,
|
matName: item.name,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@ -387,21 +386,36 @@ export default {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadMachineList() {
|
loadMachineList(procId) {
|
||||||
request({
|
request({
|
||||||
url: `/api/example/machine/getMachineList`,
|
url: `/api/example/machine/getMachineList`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: { keyWord: '' }
|
data: { procId: procId || '' }
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.machineList = res.data || [];
|
this.machineList = res.data || [];
|
||||||
this.machineOptions = this.machineList.map(item => ({
|
this.machineOptions = this.machineList.map(item => ({
|
||||||
label: `${item.name}`,
|
label: item.name || '',
|
||||||
value: String(item.id),
|
value: String(item.id),
|
||||||
machineName: item.name,
|
machineName: item.name || '',
|
||||||
id: item.id
|
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) {
|
handleMaterialChange(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
const material = this.materialOptions.find(item => item.value === value);
|
const material = this.materialOptions.find(item => item.value === value);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user