Compare commits

..

2 Commits

7 changed files with 48 additions and 18 deletions

View File

@ -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);
}

View File

@ -55,7 +55,7 @@ public class MachineParamServiceImpl extends ServiceImpl<MachineParamMapper, Mac
}
wrapper.eq(MachineParamEntity::getDeleteMark, 0);
wrapper.orderByDesc(MachineParamEntity::getCreatorTime);
wrapper.orderByDesc(MachineParamEntity::getId);
if ("0".equals(machineParamPagination.getDataType())) {
Page<MachineParamEntity> page = new Page<>(machineParamPagination.getCurrentPage(), machineParamPagination.getPageSize());

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -177,6 +177,8 @@ export default {
this.materialOptions = res.data.map(item => ({
label: item.matName,
value: String(item.id),
matCode: item.matCode || '',
matName: item.matName || '',
}))
})
},
@ -214,7 +216,7 @@ export default {
},
getMaterialName(matCode) {
const item = this.materialOptions.find(opt => opt.value === matCode)
return item ? item.label : ''
return item ? `${item.matCode}-${item.matName}` : ''
},
getEnabledStatusName(status) {
const item = this.enabledStatusOptions.find(opt => opt.id === status)

View File

@ -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>
@ -209,6 +209,7 @@ export default {
this.dataForm.id = id || '';
this.dialogVisible = true;
this.loading = true;
this.machineOptions = []; //
this.$nextTick(() => {
if (this.$refs.formRef) {
this.$refs.formRef.resetFields();
@ -228,6 +229,13 @@ export default {
matCode: String(data.matCode || ''),
enabledStatus: String(data.enabledStatus || '1'),
};
// ID
if (data.procId) {
this.dataForm.procId = data.procId;
this.loadMachineList(data.procId);
}
//
if (data.detailList && Array.isArray(data.detailList)) {
this.paramList = data.detailList.map(item => {
@ -289,7 +297,6 @@ export default {
loadBaseData() {
this.loadProcList();
this.loadMaterialList();
this.loadMachineList();
this.loadParamNameOptions();
},
loadParamNameOptions() {
@ -319,7 +326,7 @@ export default {
lowerLimit: undefined,
upperLimit: undefined,
dev: undefined,
isAlert: '0',
isAlert: '1',
remark: undefined,
});
},
@ -379,7 +386,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 +394,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);