feat(example): 完善工艺流程管理功能
This commit is contained in:
parent
40be57b9fb
commit
ba7f7b1de1
@ -120,12 +120,19 @@ public class ProLineServiceImpl extends ServiceImpl<ProLineMapper, ProLineEntity
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void saveOrUpdate(ProLineForm proLineForm, String id, boolean isSave) throws Exception {
|
public void saveOrUpdate(ProLineForm proLineForm, String id, boolean isSave) throws Exception {
|
||||||
|
if (isSave){
|
||||||
|
ProLineEntity entity = new ProLineEntity();
|
||||||
|
BeanUtils.copyProperties(proLineForm, entity);
|
||||||
|
entity.setId(null);
|
||||||
|
this.save(entity);
|
||||||
|
}else {
|
||||||
ProLineEntity entity = getInfo(id);
|
ProLineEntity entity = getInfo(id);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
entity = new ProLineEntity();
|
throw new Exception("数据不存在");
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(proLineForm, entity);
|
BeanUtils.copyProperties(proLineForm, entity);
|
||||||
this.saveOrUpdate(entity);
|
this.updateById(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -123,12 +123,20 @@ public class ProcServiceImpl extends ServiceImpl<ProcMapper, ProcEntity> impleme
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void saveOrUpdate(ProcForm procForm, String id, boolean isSave) throws Exception {
|
public void saveOrUpdate(ProcForm procForm, String id, boolean isSave) throws Exception {
|
||||||
|
if (isSave) {
|
||||||
|
ProcEntity entity = new ProcEntity();
|
||||||
|
BeanUtils.copyProperties(procForm, entity);
|
||||||
|
entity.setId(null);
|
||||||
|
this.save(entity);
|
||||||
|
} else {
|
||||||
ProcEntity entity = getInfo(id);
|
ProcEntity entity = getInfo(id);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
entity = new ProcEntity();
|
throw new Exception("数据不存在");
|
||||||
}
|
} else {
|
||||||
BeanUtils.copyProperties(procForm, entity);
|
BeanUtils.copyProperties(procForm, entity);
|
||||||
this.saveOrUpdate(entity);
|
this.updateById(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,7 @@ public class TechProcServiceImpl extends ServiceImpl<TechProcMapper, TechProcEnt
|
|||||||
}
|
}
|
||||||
long count = this.count(wrapper);
|
long count = this.count(wrapper);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
countRecover += "工艺流程已存在,请重新输入!";
|
countRecover += "工艺流程已存在,请重新选择!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,13 +7,13 @@ import jnpf.base.ActionResult;
|
|||||||
import jnpf.base.vo.PageListVO;
|
import jnpf.base.vo.PageListVO;
|
||||||
import jnpf.base.vo.PaginationVO;
|
import jnpf.base.vo.PaginationVO;
|
||||||
import jnpf.model.machine.MachineEntity;
|
import jnpf.model.machine.MachineEntity;
|
||||||
import jnpf.model.proc.ProcEntity;
|
|
||||||
import jnpf.model.proline.ProLineEntity;
|
|
||||||
import jnpf.model.machine.MachineForm;
|
import jnpf.model.machine.MachineForm;
|
||||||
import jnpf.model.machine.MachinePagination;
|
import jnpf.model.machine.MachinePagination;
|
||||||
|
import jnpf.model.proline.ProLineEntity;
|
||||||
|
import jnpf.permission.service.UserService;
|
||||||
import jnpf.service.MachineService;
|
import jnpf.service.MachineService;
|
||||||
import jnpf.service.ProcService;
|
|
||||||
import jnpf.service.ProLineService;
|
import jnpf.service.ProLineService;
|
||||||
|
import jnpf.service.ProcService;
|
||||||
import jnpf.util.JsonUtil;
|
import jnpf.util.JsonUtil;
|
||||||
import jnpf.util.StringUtil;
|
import jnpf.util.StringUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -39,8 +39,6 @@ public class MachineController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ProLineService proLineService;
|
private ProLineService proLineService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ProcService procService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
@ -141,20 +139,6 @@ public class MachineController {
|
|||||||
return ActionResult.success(realList);
|
return ActionResult.success(realList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取工序列表
|
|
||||||
* @return 工序列表
|
|
||||||
*/
|
|
||||||
@Operation(summary = "获取工序列表")
|
|
||||||
@GetMapping("/getProcList")
|
|
||||||
public ActionResult getProcList() {
|
|
||||||
LambdaQueryWrapper<ProcEntity> wrapper = new LambdaQueryWrapper<>();
|
|
||||||
wrapper.eq(ProcEntity::getEnabledStatus, 1);
|
|
||||||
List<ProcEntity> list = procService.list(wrapper);
|
|
||||||
List<Map<String, Object>> realList = list.stream()
|
|
||||||
.map(JsonUtil::entityToMap)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
return ActionResult.success(realList);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package jnpf.controller;
|
package jnpf.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jnpf.base.ActionResult;
|
import jnpf.base.ActionResult;
|
||||||
@ -8,6 +9,8 @@ import jnpf.base.vo.PaginationVO;
|
|||||||
import jnpf.model.proc.ProcEntity;
|
import jnpf.model.proc.ProcEntity;
|
||||||
import jnpf.model.proc.ProcForm;
|
import jnpf.model.proc.ProcForm;
|
||||||
import jnpf.model.proc.ProcPagination;
|
import jnpf.model.proc.ProcPagination;
|
||||||
|
import jnpf.permission.entity.UserEntity;
|
||||||
|
import jnpf.permission.service.UserService;
|
||||||
import jnpf.service.ProcService;
|
import jnpf.service.ProcService;
|
||||||
import jnpf.util.JsonUtil;
|
import jnpf.util.JsonUtil;
|
||||||
import jnpf.util.StringUtil;
|
import jnpf.util.StringUtil;
|
||||||
@ -31,6 +34,9 @@ public class ProcController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ProcService procService;
|
private ProcService procService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
* @param procPagination 分页查询对象
|
* @param procPagination 分页查询对象
|
||||||
@ -114,4 +120,28 @@ public class ProcController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取工序列表
|
||||||
|
* @return 工序列表
|
||||||
|
*/
|
||||||
|
@Operation(summary = "获取工序列表")
|
||||||
|
@GetMapping("/getProcList")
|
||||||
|
public ActionResult getProcList() {
|
||||||
|
LambdaQueryWrapper<ProcEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(ProcEntity::getEnabledStatus, 1);
|
||||||
|
wrapper.orderByAsc(ProcEntity::getProcCd);
|
||||||
|
List<ProcEntity> list = procService.list(wrapper);
|
||||||
|
// 查询创建人
|
||||||
|
list.forEach(item -> {
|
||||||
|
UserEntity userEntity = userService.getById(item.getCreatorUserId());
|
||||||
|
if (userEntity != null) {
|
||||||
|
item.setCreateUserName(userEntity.getRealName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
List<Map<String, Object>> realList = list.stream()
|
||||||
|
.map(JsonUtil::entityToMap)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return ActionResult.success(realList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,4 +41,7 @@ public class ProcEntity {
|
|||||||
@TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED)
|
@TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED)
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String createUserName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,9 @@ public class TechProcEntity {
|
|||||||
@TableField("tech_proc")
|
@TableField("tech_proc")
|
||||||
private String techProc;
|
private String techProc;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String techProcName;
|
||||||
|
|
||||||
@TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED)
|
@TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED)
|
||||||
private Integer enabledStatus;
|
private Integer enabledStatus;
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工艺流程主数据 Form
|
* 工艺流程主数据 Form
|
||||||
@ -29,4 +30,6 @@ public class TechProcForm {
|
|||||||
|
|
||||||
@Schema(description = "流程任务ID")
|
@Schema(description = "流程任务ID")
|
||||||
private String flowTaskId;
|
private String flowTaskId;
|
||||||
|
|
||||||
|
private List<String> procList;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,14 +9,14 @@ export const customerMaps = {
|
|||||||
enabledStatus: { '1': '启用', '2': '未启用' },
|
enabledStatus: { '1': '启用', '2': '未启用' },
|
||||||
|
|
||||||
|
|
||||||
storeType: { '1': '原料库', '2': '在制品库', '3': '成品库' },
|
storeType: { 1: '原料库', 2: '在制品库', 3: '成品库' },
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据映射自动生成下拉选项
|
// 根据映射自动生成下拉选项
|
||||||
export const customerOptions = {}
|
export const customerOptions = {}
|
||||||
for (const key in customerMaps) {
|
for (const key in customerMaps) {
|
||||||
const map = customerMaps[key]
|
const map = customerMaps[key]
|
||||||
customerOptions[key] = Object.entries(map).map(([id, fullName]) => ({ id, fullName }))
|
customerOptions[key] = Object.entries(map).map(([id, fullName]) => ({ id: Number(id), fullName }))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取显示名称
|
// 获取显示名称
|
||||||
|
|||||||
@ -347,7 +347,7 @@ export default {
|
|||||||
|
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
this.$emit('refresh', false)
|
this.$emit('refresh', true)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -190,7 +190,7 @@ export default {
|
|||||||
// 获取工序列表
|
// 获取工序列表
|
||||||
getProcList() {
|
getProcList() {
|
||||||
request({
|
request({
|
||||||
url: `/api/example/machine/getProcList`,
|
url: `/api/example/proc/getProcList`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.procList = res.data || [];
|
this.procList = res.data || [];
|
||||||
|
|||||||
@ -1,18 +1,18 @@
|
|||||||
NEW_FILE_CODE
|
|
||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:title="!dataForm.id ? '新建' : '编辑'"
|
:title="!dataForm.id ? '新建' : '编辑'"
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
width="600px"
|
width="800px"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right">
|
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right">
|
||||||
<template v-if="!loading">
|
<template v-if="!loading">
|
||||||
<el-form-item label="工艺流程" prop="techProc">
|
<el-form-item label="工艺流程" prop="techProc">
|
||||||
<JnpfInput v-model="dataForm.techProc" placeholder="请输入工艺流程" clearable :style="{ width: '100%' }">
|
<JnpfInput v-model="techProcDisplay" placeholder="请选择工序生成工艺流程" clearable :style="{ width: '100%' }" :disabled="true">
|
||||||
</JnpfInput>
|
</JnpfInput>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<input type="hidden" v-model="dataForm.techProc" />
|
||||||
<el-form-item label="状态" prop="enabledStatus">
|
<el-form-item label="状态" prop="enabledStatus">
|
||||||
<JnpfSelect v-model="dataForm.enabledStatus" placeholder="请选择状态" :options="enabledStatusOptions" :props="enabledStatusProps" clearable :style="{ width: '100%' }">
|
<JnpfSelect v-model="dataForm.enabledStatus" placeholder="请选择状态" :options="enabledStatusOptions" :props="enabledStatusProps" clearable :style="{ width: '100%' }">
|
||||||
</JnpfSelect>
|
</JnpfSelect>
|
||||||
@ -21,10 +21,30 @@ NEW_FILE_CODE
|
|||||||
<JnpfTextarea v-model="dataForm.remark" placeholder="请输入备注" :style="{ width: '100%' }" :autoSize="{ minRows: 4, maxRows: 4 }" type="textarea">
|
<JnpfTextarea v-model="dataForm.remark" placeholder="请输入备注" :style="{ width: '100%' }" :autoSize="{ minRows: 4, maxRows: 4 }" type="textarea">
|
||||||
</JnpfTextarea>
|
</JnpfTextarea>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- 分割线 -->
|
||||||
|
<div style="border-top: 1px solid #e8e8e8; margin: 20px 0;"></div>
|
||||||
|
|
||||||
|
<!-- 工序列表 -->
|
||||||
|
<div style="padding: 0 10px;">
|
||||||
|
<div style="font-weight: bold; margin-bottom: 12px; color: #606266;">工序信息</div>
|
||||||
|
<el-table
|
||||||
|
:data="procList"
|
||||||
|
:border="true"
|
||||||
|
:style="{ width: '100%', maxHeight: '300px', overflow: 'auto' }"
|
||||||
|
@selection-change="handleProcSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55"></el-table-column>
|
||||||
|
<el-table-column prop="procCd" label="工序编码" align="center"></el-table-column>
|
||||||
|
<el-table-column prop="procName" label="工序名称" align="center"></el-table-column>
|
||||||
|
<el-table-column prop="remark" label="备注" align="center"></el-table-column>
|
||||||
|
<el-table-column prop="createUserName" label="创建人" align="center"></el-table-column>
|
||||||
|
<el-table-column prop="creatorTime" label="创建时间" align="center" :formatter="jnpf.tableDateFormat1"></el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading" :disabled="!hasSelectedProcs">保 存</el-button>
|
||||||
<el-button @click="handleClose">取 消</el-button>
|
<el-button @click="handleClose">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -44,20 +64,16 @@ export default {
|
|||||||
btnLoading: false,
|
btnLoading: false,
|
||||||
formRef: 'formRef',
|
formRef: 'formRef',
|
||||||
eventType: '',
|
eventType: '',
|
||||||
|
techProcDisplay: '',
|
||||||
dataForm: {
|
dataForm: {
|
||||||
id: '',
|
id: '',
|
||||||
techProc: undefined,
|
techProc: undefined,
|
||||||
enabledStatus: 1,
|
enabledStatus: 1,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
|
procList: []
|
||||||
},
|
},
|
||||||
dataRule: {
|
dataRule: {
|
||||||
techProc: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入工艺流程',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
enabledStatus: [
|
enabledStatus: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@ -71,10 +87,19 @@ export default {
|
|||||||
{ fullName: "未启用", id: 2 },
|
{ fullName: "未启用", id: 2 },
|
||||||
],
|
],
|
||||||
enabledStatusProps: { label: "fullName", value: "id" },
|
enabledStatusProps: { label: "fullName", value: "id" },
|
||||||
|
procList: [],
|
||||||
|
selectedProcs: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['userInfo']),
|
...mapGetters(['userInfo']),
|
||||||
|
// 判断是否有选中的工序
|
||||||
|
hasSelectedProcs() {
|
||||||
|
return this.selectedProcs && this.selectedProcs.length > 0;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getProcList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init(id) {
|
init(id) {
|
||||||
@ -89,6 +114,8 @@ export default {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.dataForm = res.data
|
this.dataForm = res.data
|
||||||
|
// 将存储的编码拼接转换为名称拼接显示
|
||||||
|
this.convertCodeToName(res.data.techProc)
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -96,6 +123,42 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 获取工序列表(不分页)
|
||||||
|
getProcList() {
|
||||||
|
request({
|
||||||
|
url: `/api/example/proc/getProcList`,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.procList = res.data || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 将编码拼接转换为名称拼接显示
|
||||||
|
convertCodeToName(codeStr) {
|
||||||
|
if (!codeStr) {
|
||||||
|
this.techProcDisplay = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const codes = codeStr.split('_')
|
||||||
|
const names = codes.map(code => {
|
||||||
|
const proc = this.procList.find(item => item.procCd === code)
|
||||||
|
return proc ? proc.procName : code
|
||||||
|
})
|
||||||
|
this.techProcDisplay = names.join('_')
|
||||||
|
},
|
||||||
|
// 工序选择变化处理 - 按列表顺序排列
|
||||||
|
handleProcSelectionChange(val) {
|
||||||
|
this.selectedProcs = val;
|
||||||
|
// 获取选中的编码集合
|
||||||
|
const selectedCodes = new Set(val.map(item => item.procCd));
|
||||||
|
// 按列表顺序过滤选中的工序
|
||||||
|
const sortedSelected = this.procList.filter(item => selectedCodes.has(item.procCd));
|
||||||
|
// 显示用:工序名称拼接(按列表顺序)
|
||||||
|
this.techProcDisplay = sortedSelected.map(item => item.procName).join('_');
|
||||||
|
// 存储用:工序编码拼接(按列表顺序)
|
||||||
|
this.dataForm.techProc = sortedSelected.map(item => item.procCd).join('_');
|
||||||
|
// 保存选中的工序编码列表(按列表顺序)
|
||||||
|
this.dataForm.procList = sortedSelected.map(item => item.procCd);
|
||||||
|
},
|
||||||
dataFormSubmit() {
|
dataFormSubmit() {
|
||||||
this.$refs.formRef.validate((valid) => {
|
this.$refs.formRef.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
NEW_FILE_CODE
|
|
||||||
<template>
|
<template>
|
||||||
<div class="JNPF-common-layout techproc_data">
|
<div class="JNPF-common-layout techproc_data">
|
||||||
<div class="JNPF-common-layout-center">
|
<div class="JNPF-common-layout-center">
|
||||||
@ -32,7 +31,11 @@ NEW_FILE_CODE
|
|||||||
<div class="JNPF-common-head-right"></div>
|
<div class="JNPF-common-head-right"></div>
|
||||||
</div>
|
</div>
|
||||||
<JNPF-table v-loading="listLoading" :data="list">
|
<JNPF-table v-loading="listLoading" :data="list">
|
||||||
<el-table-column prop="techProc" label="工艺流程" align="center"/>
|
<el-table-column label="工艺流程" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.techProcDisplay || scope.row.techProc }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="enabledStatus" label="状态" align="center">
|
<el-table-column prop="enabledStatus" label="状态" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag :type="scope.row.enabledStatus == 1 ? 'success' : 'info'" size="small">
|
<el-tag :type="scope.row.enabledStatus == 1 ? 'success' : 'info'" size="small">
|
||||||
@ -94,6 +97,7 @@ export default {
|
|||||||
{ fullName: "未启用", id: 2 },
|
{ fullName: "未启用", id: 2 },
|
||||||
],
|
],
|
||||||
enabledStatusProps: { label: "fullName", value: "id" },
|
enabledStatusProps: { label: "fullName", value: "id" },
|
||||||
|
procList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -106,9 +110,29 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.getProcList();
|
||||||
this.initData();
|
this.initData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 获取工序列表
|
||||||
|
getProcList() {
|
||||||
|
request({
|
||||||
|
url: `/api/example/proc/getProcList`,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.procList = res.data || [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 将编码拼接转换为名称拼接
|
||||||
|
convertCodeToName(codeStr) {
|
||||||
|
if (!codeStr) return '';
|
||||||
|
const codes = codeStr.split('_');
|
||||||
|
const names = codes.map(code => {
|
||||||
|
const proc = this.procList.find(item => item.procCd === code);
|
||||||
|
return proc ? proc.procName : code;
|
||||||
|
});
|
||||||
|
return names.join('_');
|
||||||
|
},
|
||||||
initData() {
|
initData() {
|
||||||
this.listLoading = true;
|
this.listLoading = true;
|
||||||
let _query = {
|
let _query = {
|
||||||
@ -124,6 +148,8 @@ export default {
|
|||||||
var _list = [];
|
var _list = [];
|
||||||
for (let i = 0; i < res.data.list.length; i++) {
|
for (let i = 0; i < res.data.list.length; i++) {
|
||||||
let _data = res.data.list[i];
|
let _data = res.data.list[i];
|
||||||
|
// 将编码转换为名称显示
|
||||||
|
_data.techProcDisplay = this.convertCodeToName(_data.techProc);
|
||||||
_list.push(_data);
|
_list.push(_data);
|
||||||
}
|
}
|
||||||
this.list = _list;
|
this.list = _list;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user