新增MES混炼示方模块,包括主表及子表结构、控制器、服务和映射器的实现,支持增删改查功能,优化数据验证和用户体验,增强系统稳定性。
This commit is contained in:
@@ -111,3 +111,24 @@ jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslFormulaSpecService.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslFormulaSpecServiceImpl.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixerPsCompileServiceImpl.java
|
||||
|
||||
-- author:cursor---date:20260522--for: 【XSLMES-20260522-A17】新增MES技术管理-混炼示方1主4子表及紧凑页 ---
|
||||
jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_98__mes_xsl_mixing_spec.sql
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixingSpec.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixingSpecMaterial.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixingSpecStep.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixingSpecDownStep.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixingSpecTcu.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslMixingSpecPage.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslMixingSpecMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslMixingSpecMaterialMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslMixingSpecStepMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslMixingSpecDownStepMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslMixingSpecTcuMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslMixingSpecService.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslMixingSpecServiceImpl.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslMixingSpecController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/MesXslMixingSpec.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/MesXslMixingSpec.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/MesXslMixingSpecList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixingSpec/components/MesXslMixingSpecModal.vue
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpec;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMixingSpecService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 混炼示方
|
||||
*/
|
||||
@Tag(name = "MES混炼示方")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslMixingSpec")
|
||||
public class MesXslMixingSpecController extends JeecgController<MesXslMixingSpec, IMesXslMixingSpecService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslMixingSpecService mesXslMixingSpecService;
|
||||
|
||||
@Operation(summary = "MES混炼示方-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslMixingSpec>> queryPageList(
|
||||
MesXslMixingSpec model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "keyword", required = false) String keyword,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslMixingSpec> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方列表关键字查询-----------
|
||||
if (oConvertUtils.isNotEmpty(keyword)) {
|
||||
queryWrapper.and(w -> w.like("spec_name", keyword).or().like("issue_number", keyword).or().like("purpose", keyword).or().like("machine_name", keyword));
|
||||
}
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方列表关键字查询-----------
|
||||
queryWrapper.orderByDesc("update_time").orderByDesc("create_time");
|
||||
Page<MesXslMixingSpec> page = new Page<>(pageNo, pageSize);
|
||||
return Result.OK(mesXslMixingSpecService.page(page, queryWrapper));
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES混炼示方-添加")
|
||||
@Operation(summary = "MES混炼示方-添加")
|
||||
@RequiresPermissions("xslmes:mes_xsl_mixing_spec:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslMixingSpecPage page) {
|
||||
String err = validateMain(page);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
MesXslMixingSpec main = new MesXslMixingSpec();
|
||||
BeanUtils.copyProperties(page, main);
|
||||
mesXslMixingSpecService.saveMain(main, page.getMaterialList(), page.getStepList(), page.getDownStepList(), page.getTcuList());
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES混炼示方-编辑")
|
||||
@Operation(summary = "MES混炼示方-编辑")
|
||||
@RequiresPermissions("xslmes:mes_xsl_mixing_spec:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslMixingSpecPage page) {
|
||||
String err = validateMain(page);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
MesXslMixingSpec main = new MesXslMixingSpec();
|
||||
BeanUtils.copyProperties(page, main);
|
||||
mesXslMixingSpecService.updateMain(main, page.getMaterialList(), page.getStepList(), page.getDownStepList(), page.getTcuList());
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES混炼示方-删除")
|
||||
@Operation(summary = "MES混炼示方-通过id删除")
|
||||
@RequiresPermissions("xslmes:mes_xsl_mixing_spec:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslMixingSpecService.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES混炼示方-批量删除")
|
||||
@Operation(summary = "MES混炼示方-批量删除")
|
||||
@RequiresPermissions("xslmes:mes_xsl_mixing_spec:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslMixingSpecService.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES混炼示方-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslMixingSpecPage> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslMixingSpecPage page = mesXslMixingSpecService.queryPageById(id);
|
||||
if (page == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(page);
|
||||
}
|
||||
|
||||
@Operation(summary = "MES混炼示方-发行编号候选")
|
||||
@GetMapping(value = "/queryIssueNumberOptions")
|
||||
public Result<List<Map<String, String>>> queryIssueNumberOptions(
|
||||
@RequestParam(name = "keyword", required = false) String keyword) {
|
||||
return Result.OK(mesXslMixingSpecService.queryIssueNumberOptions(keyword));
|
||||
}
|
||||
|
||||
@Operation(summary = "MES混炼示方-用途候选")
|
||||
@GetMapping(value = "/queryPurposeOptions")
|
||||
public Result<List<Map<String, String>>> queryPurposeOptions(
|
||||
@RequestParam(name = "keyword", required = false) String keyword) {
|
||||
return Result.OK(mesXslMixingSpecService.queryPurposeOptions(keyword));
|
||||
}
|
||||
|
||||
@RequiresPermissions("xslmes:mes_xsl_mixing_spec:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslMixingSpec model) {
|
||||
return super.exportXls(request, model, MesXslMixingSpec.class, "混炼示方");
|
||||
}
|
||||
|
||||
@RequiresPermissions("xslmes:mes_xsl_mixing_spec:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, MesXslMixingSpec.class);
|
||||
}
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方主子保存校验-----------
|
||||
private String validateMain(MesXslMixingSpecPage page) {
|
||||
if (oConvertUtils.isEmpty(page.getSpecName())) {
|
||||
return "请填写规格";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(page.getPurpose())) {
|
||||
return "请选择用途";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(page.getIssueNumber())) {
|
||||
return "请选择发行编号";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方主子保存校验-----------
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 混炼示方主表
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_mixing_spec")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES混炼示方")
|
||||
public class MesXslMixingSpec implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
@Excel(name = "规格", width = 16)
|
||||
@Schema(description = "规格")
|
||||
private String specName;
|
||||
|
||||
@Excel(name = "用途", width = 24)
|
||||
@Schema(description = "用途")
|
||||
private String purpose;
|
||||
|
||||
@Schema(description = "机台ID")
|
||||
private String machineId;
|
||||
|
||||
@Excel(name = "机台", width = 14)
|
||||
@Schema(description = "机台")
|
||||
private String machineName;
|
||||
|
||||
@Excel(name = "制作日期", width = 14, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "制作日期")
|
||||
private Date makeDate;
|
||||
|
||||
@Excel(name = "发行编号", width = 16)
|
||||
@Schema(description = "发行编号")
|
||||
private String issueNumber;
|
||||
|
||||
@Schema(description = "换算系数")
|
||||
private BigDecimal convertFactor;
|
||||
|
||||
@Schema(description = "填充体积")
|
||||
private BigDecimal fillVolume;
|
||||
|
||||
@Schema(description = "回收炭黑(秒)")
|
||||
private Integer recycleCarbonSec;
|
||||
|
||||
@Schema(description = "母胶比重")
|
||||
private BigDecimal motherRubberSg;
|
||||
|
||||
@Schema(description = "终炼胶比重")
|
||||
private BigDecimal finalRubberSg;
|
||||
|
||||
@Schema(description = "适用工厂")
|
||||
private String applyFactory;
|
||||
|
||||
@Schema(description = "段数")
|
||||
private Integer stageCount;
|
||||
|
||||
@Schema(description = "纯混炼时间(秒)")
|
||||
private Integer pureMixSec;
|
||||
|
||||
@Schema(description = "回收炭黑(KG)")
|
||||
private BigDecimal recycleCarbonKg;
|
||||
|
||||
@Schema(description = "自动小料打印设定")
|
||||
private String autoSmallPrintSetting;
|
||||
|
||||
@Schema(description = "设定车数")
|
||||
private Integer setTrainCount;
|
||||
|
||||
@Schema(description = "侧壁水温")
|
||||
private BigDecimal sideWallWaterTemp;
|
||||
|
||||
@Schema(description = "超时排胶时间")
|
||||
private Integer overtimeDischargeSec;
|
||||
|
||||
@Schema(description = "超温排胶时间")
|
||||
private Integer overtempDischargeSec;
|
||||
|
||||
@Schema(description = "超温排胶温度")
|
||||
private BigDecimal overtempDischargeTemp;
|
||||
|
||||
@Schema(description = "卸料门水温")
|
||||
private BigDecimal doorWaterTemp;
|
||||
|
||||
@Schema(description = "转子水温")
|
||||
private BigDecimal rotorWaterTemp;
|
||||
|
||||
@Schema(description = "最高进料温度")
|
||||
private BigDecimal maxFeedTemp;
|
||||
|
||||
@Schema(description = "起草人")
|
||||
private String draftBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "起草时间")
|
||||
private Date draftTime;
|
||||
|
||||
@Schema(description = "校对人")
|
||||
private String proofreadBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "校对时间")
|
||||
private Date proofreadTime;
|
||||
|
||||
@Schema(description = "审核人")
|
||||
private String auditBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "审核时间")
|
||||
private Date auditTime;
|
||||
|
||||
@Schema(description = "批准人")
|
||||
private String approveBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "批准时间")
|
||||
private Date approveTime;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "变更日期")
|
||||
private Date changeDate;
|
||||
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 混炼示方明细3:下密炼机混炼条件
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_mixing_spec_down_step")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "混炼示方下密炼机混炼条件")
|
||||
public class MesXslMixingSpecDownStep implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "主表ID")
|
||||
private String mixingSpecId;
|
||||
|
||||
@Schema(description = "行序")
|
||||
private Integer sortNo;
|
||||
|
||||
@Schema(description = "动作")
|
||||
private String actionName;
|
||||
|
||||
@Schema(description = "时间(秒)")
|
||||
private Integer actionSec;
|
||||
|
||||
@Schema(description = "保护时间")
|
||||
private Integer protectSec;
|
||||
|
||||
@Schema(description = "温度(℃)")
|
||||
private BigDecimal tempC;
|
||||
|
||||
@Schema(description = "功率(Kw)")
|
||||
private BigDecimal powerKw;
|
||||
|
||||
@Schema(description = "能量(Kwh)")
|
||||
private BigDecimal energyKwh;
|
||||
|
||||
@Schema(description = "组合")
|
||||
private String comboMode;
|
||||
|
||||
@Schema(description = "转速(rpm)")
|
||||
private BigDecimal speedRpm;
|
||||
|
||||
@Schema(description = "压力(Mpa)")
|
||||
private BigDecimal pressureMpa;
|
||||
|
||||
@Schema(description = "栓(%)")
|
||||
private BigDecimal boltPercent;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 混炼示方明细1:橡胶及配合剂
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_mixing_spec_material")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "混炼示方橡胶及配合剂")
|
||||
public class MesXslMixingSpecMaterial implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "主表ID")
|
||||
private String mixingSpecId;
|
||||
|
||||
@Schema(description = "行序")
|
||||
private Integer sortNo;
|
||||
|
||||
@Schema(description = "物料大类")
|
||||
private String materialMajor;
|
||||
|
||||
@Schema(description = "物料小类")
|
||||
private String materialMinor;
|
||||
|
||||
@Schema(description = "种类")
|
||||
private String materialKind;
|
||||
|
||||
@Schema(description = "密炼物料名称")
|
||||
private String mixerMaterialName;
|
||||
|
||||
@Schema(description = "密炼物料描述")
|
||||
private String mixerMaterialDesc;
|
||||
|
||||
@Schema(description = "单重")
|
||||
private BigDecimal unitWeight;
|
||||
|
||||
@Schema(description = "累计")
|
||||
private BigDecimal accumWeight;
|
||||
|
||||
@Schema(description = "顺序")
|
||||
private Integer seqNo;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 混炼示方明细2:混合步骤
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_mixing_spec_step")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "混炼示方混合步骤")
|
||||
public class MesXslMixingSpecStep implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "主表ID")
|
||||
private String mixingSpecId;
|
||||
|
||||
@Schema(description = "行序")
|
||||
private Integer sortNo;
|
||||
|
||||
@Schema(description = "动作")
|
||||
private String actionName;
|
||||
|
||||
@Schema(description = "时间(秒)")
|
||||
private Integer actionSec;
|
||||
|
||||
@Schema(description = "保护时间")
|
||||
private Integer protectSec;
|
||||
|
||||
@Schema(description = "温度(℃)")
|
||||
private BigDecimal tempC;
|
||||
|
||||
@Schema(description = "功率(Kw)")
|
||||
private BigDecimal powerKw;
|
||||
|
||||
@Schema(description = "能量(Kwh)")
|
||||
private BigDecimal energyKwh;
|
||||
|
||||
@Schema(description = "组合")
|
||||
private String comboMode;
|
||||
|
||||
@Schema(description = "转速(rpm)")
|
||||
private BigDecimal speedRpm;
|
||||
|
||||
@Schema(description = "压力(Mpa)")
|
||||
private BigDecimal pressureMpa;
|
||||
|
||||
@Schema(description = "栓(%)")
|
||||
private BigDecimal boltPercent;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 混炼示方明细4:TCU温度条件
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_mixing_spec_tcu")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "混炼示方TCU温度条件")
|
||||
public class MesXslMixingSpecTcu implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "主表ID")
|
||||
private String mixingSpecId;
|
||||
|
||||
@Schema(description = "行序")
|
||||
private Integer sortNo;
|
||||
|
||||
@Schema(description = "区分(字典xslmes_mixing_tcu_section)")
|
||||
private String sectionType;
|
||||
|
||||
@Schema(description = "前转子温度")
|
||||
private BigDecimal frontRotorTemp;
|
||||
|
||||
@Schema(description = "后转子温度")
|
||||
private BigDecimal rearRotorTemp;
|
||||
|
||||
@Schema(description = "前混炼室温度")
|
||||
private BigDecimal frontChamberTemp;
|
||||
|
||||
@Schema(description = "后混炼室温度")
|
||||
private BigDecimal rearChamberTemp;
|
||||
|
||||
@Schema(description = "上下顶栓温度")
|
||||
private BigDecimal topPlugTemp;
|
||||
|
||||
@Schema(description = "药品称量位置(字典xslmes_mixing_drug_weigh_pos)")
|
||||
private String drugWeighPos;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecDownStep;
|
||||
|
||||
public interface MesXslMixingSpecDownStepMapper extends BaseMapper<MesXslMixingSpecDownStep> {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpec;
|
||||
|
||||
public interface MesXslMixingSpecMapper extends BaseMapper<MesXslMixingSpec> {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecMaterial;
|
||||
|
||||
public interface MesXslMixingSpecMaterialMapper extends BaseMapper<MesXslMixingSpecMaterial> {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecStep;
|
||||
|
||||
public interface MesXslMixingSpecStepMapper extends BaseMapper<MesXslMixingSpecStep> {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecTcu;
|
||||
|
||||
public interface MesXslMixingSpecTcuMapper extends BaseMapper<MesXslMixingSpecTcu> {}
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpec;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecDownStep;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecMaterial;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecStep;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecTcu;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
|
||||
|
||||
public interface IMesXslMixingSpecService extends IService<MesXslMixingSpec> {
|
||||
void saveMain(
|
||||
MesXslMixingSpec main,
|
||||
List<MesXslMixingSpecMaterial> materialList,
|
||||
List<MesXslMixingSpecStep> stepList,
|
||||
List<MesXslMixingSpecDownStep> downStepList,
|
||||
List<MesXslMixingSpecTcu> tcuList);
|
||||
|
||||
void updateMain(
|
||||
MesXslMixingSpec main,
|
||||
List<MesXslMixingSpecMaterial> materialList,
|
||||
List<MesXslMixingSpecStep> stepList,
|
||||
List<MesXslMixingSpecDownStep> downStepList,
|
||||
List<MesXslMixingSpecTcu> tcuList);
|
||||
|
||||
void delMain(String id);
|
||||
|
||||
void delBatchMain(Collection<? extends Serializable> idList);
|
||||
|
||||
MesXslMixingSpecPage queryPageById(String id);
|
||||
|
||||
List<Map<String, String>> queryIssueNumberOptions(String keyword);
|
||||
|
||||
List<Map<String, String>> queryPurposeOptions(String keyword);
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpec;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecDownStep;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecMaterial;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecStep;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecTcu;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecDownStepMapper;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecMapper;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecMaterialMapper;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecStepMapper;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecTcuMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMixingSpecService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@Service
|
||||
public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMapper, MesXslMixingSpec>
|
||||
implements IMesXslMixingSpecService {
|
||||
|
||||
private static final String TCU_UP = "up_mixer";
|
||||
private static final String TCU_DOWN = "down_mixer";
|
||||
|
||||
@Resource
|
||||
private MesXslMixingSpecMaterialMapper materialMapper;
|
||||
@Resource
|
||||
private MesXslMixingSpecStepMapper stepMapper;
|
||||
@Resource
|
||||
private MesXslMixingSpecDownStepMapper downStepMapper;
|
||||
@Resource
|
||||
private MesXslMixingSpecTcuMapper tcuMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveMain(
|
||||
MesXslMixingSpec main,
|
||||
List<MesXslMixingSpecMaterial> materialList,
|
||||
List<MesXslMixingSpecStep> stepList,
|
||||
List<MesXslMixingSpecDownStep> downStepList,
|
||||
List<MesXslMixingSpecTcu> tcuList) {
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方主子表新增保存-----------
|
||||
normalizeMain(main);
|
||||
this.save(main);
|
||||
saveChildren(main.getId(), materialList, stepList, downStepList, tcuList);
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方主子表新增保存-----------
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateMain(
|
||||
MesXslMixingSpec main,
|
||||
List<MesXslMixingSpecMaterial> materialList,
|
||||
List<MesXslMixingSpecStep> stepList,
|
||||
List<MesXslMixingSpecDownStep> downStepList,
|
||||
List<MesXslMixingSpecTcu> tcuList) {
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方主子表编辑保存-----------
|
||||
normalizeMain(main);
|
||||
this.updateById(main);
|
||||
clearChildren(main.getId());
|
||||
saveChildren(main.getId(), materialList, stepList, downStepList, tcuList);
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】混炼示方主子表编辑保存-----------
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delMain(String id) {
|
||||
clearChildren(id);
|
||||
this.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
if (CollectionUtils.isEmpty(idList)) {
|
||||
return;
|
||||
}
|
||||
for (Serializable id : idList) {
|
||||
if (id != null) {
|
||||
delMain(String.valueOf(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MesXslMixingSpecPage queryPageById(String id) {
|
||||
MesXslMixingSpec main = this.getById(id);
|
||||
if (main == null) {
|
||||
return null;
|
||||
}
|
||||
MesXslMixingSpecPage page = new MesXslMixingSpecPage();
|
||||
page.setId(main.getId());
|
||||
page.setTenantId(main.getTenantId());
|
||||
page.setSpecName(main.getSpecName());
|
||||
page.setPurpose(main.getPurpose());
|
||||
page.setMachineId(main.getMachineId());
|
||||
page.setMachineName(main.getMachineName());
|
||||
page.setMakeDate(main.getMakeDate());
|
||||
page.setIssueNumber(main.getIssueNumber());
|
||||
page.setConvertFactor(main.getConvertFactor());
|
||||
page.setFillVolume(main.getFillVolume());
|
||||
page.setRecycleCarbonSec(main.getRecycleCarbonSec());
|
||||
page.setMotherRubberSg(main.getMotherRubberSg());
|
||||
page.setFinalRubberSg(main.getFinalRubberSg());
|
||||
page.setApplyFactory(main.getApplyFactory());
|
||||
page.setStageCount(main.getStageCount());
|
||||
page.setPureMixSec(main.getPureMixSec());
|
||||
page.setRecycleCarbonKg(main.getRecycleCarbonKg());
|
||||
page.setAutoSmallPrintSetting(main.getAutoSmallPrintSetting());
|
||||
page.setSetTrainCount(main.getSetTrainCount());
|
||||
page.setSideWallWaterTemp(main.getSideWallWaterTemp());
|
||||
page.setOvertimeDischargeSec(main.getOvertimeDischargeSec());
|
||||
page.setOvertempDischargeSec(main.getOvertempDischargeSec());
|
||||
page.setOvertempDischargeTemp(main.getOvertempDischargeTemp());
|
||||
page.setDoorWaterTemp(main.getDoorWaterTemp());
|
||||
page.setRotorWaterTemp(main.getRotorWaterTemp());
|
||||
page.setMaxFeedTemp(main.getMaxFeedTemp());
|
||||
page.setDraftBy(main.getDraftBy());
|
||||
page.setDraftTime(main.getDraftTime());
|
||||
page.setProofreadBy(main.getProofreadBy());
|
||||
page.setProofreadTime(main.getProofreadTime());
|
||||
page.setAuditBy(main.getAuditBy());
|
||||
page.setAuditTime(main.getAuditTime());
|
||||
page.setApproveBy(main.getApproveBy());
|
||||
page.setApproveTime(main.getApproveTime());
|
||||
page.setChangeDate(main.getChangeDate());
|
||||
page.setSysOrgCode(main.getSysOrgCode());
|
||||
page.setCreateBy(main.getCreateBy());
|
||||
page.setCreateTime(main.getCreateTime());
|
||||
page.setUpdateBy(main.getUpdateBy());
|
||||
page.setUpdateTime(main.getUpdateTime());
|
||||
page.setDelFlag(main.getDelFlag());
|
||||
|
||||
page.setMaterialList(queryMaterialByMainId(id));
|
||||
page.setStepList(queryStepByMainId(id));
|
||||
page.setDownStepList(queryDownStepByMainId(id));
|
||||
page.setTcuList(fillDefaultTcuRows(queryTcuByMainId(id)));
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> queryIssueNumberOptions(String keyword) {
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】发行编号联想取密炼PS-----------
|
||||
LambdaQueryWrapper<MesXslMixingSpec> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.like(MesXslMixingSpec::getIssueNumber, keyword);
|
||||
}
|
||||
queryWrapper.isNotNull(MesXslMixingSpec::getIssueNumber)
|
||||
.orderByDesc(MesXslMixingSpec::getUpdateTime)
|
||||
.orderByDesc(MesXslMixingSpec::getCreateTime)
|
||||
.last("limit 30");
|
||||
List<MesXslMixingSpec> rows = this.list(queryWrapper);
|
||||
List<Map<String, String>> options = new ArrayList<>();
|
||||
for (MesXslMixingSpec row : rows) {
|
||||
if (StringUtils.isBlank(row.getIssueNumber())) {
|
||||
continue;
|
||||
}
|
||||
options.add(Map.of("label", row.getIssueNumber(), "value", row.getIssueNumber()));
|
||||
}
|
||||
return options;
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】发行编号联想取密炼PS-----------
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> queryPurposeOptions(String keyword) {
|
||||
LambdaQueryWrapper<MesXslMixingSpec> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.like(MesXslMixingSpec::getPurpose, keyword);
|
||||
}
|
||||
queryWrapper.isNotNull(MesXslMixingSpec::getPurpose)
|
||||
.orderByDesc(MesXslMixingSpec::getUpdateTime)
|
||||
.orderByDesc(MesXslMixingSpec::getCreateTime)
|
||||
.last("limit 50");
|
||||
List<MesXslMixingSpec> rows = this.list(queryWrapper);
|
||||
List<Map<String, String>> options = new ArrayList<>();
|
||||
for (MesXslMixingSpec row : rows) {
|
||||
if (StringUtils.isBlank(row.getPurpose())) {
|
||||
continue;
|
||||
}
|
||||
options.add(Map.of("label", row.getPurpose(), "value", row.getPurpose()));
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
private void normalizeMain(MesXslMixingSpec main) {
|
||||
if (main.getDraftTime() == null) {
|
||||
main.setDraftTime(new Date());
|
||||
}
|
||||
if (main.getDelFlag() == null) {
|
||||
main.setDelFlag(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearChildren(String mainId) {
|
||||
materialMapper.delete(new LambdaQueryWrapper<MesXslMixingSpecMaterial>().eq(MesXslMixingSpecMaterial::getMixingSpecId, mainId));
|
||||
stepMapper.delete(new LambdaQueryWrapper<MesXslMixingSpecStep>().eq(MesXslMixingSpecStep::getMixingSpecId, mainId));
|
||||
downStepMapper.delete(new LambdaQueryWrapper<MesXslMixingSpecDownStep>().eq(MesXslMixingSpecDownStep::getMixingSpecId, mainId));
|
||||
tcuMapper.delete(new LambdaQueryWrapper<MesXslMixingSpecTcu>().eq(MesXslMixingSpecTcu::getMixingSpecId, mainId));
|
||||
}
|
||||
|
||||
private void saveChildren(
|
||||
String mainId,
|
||||
List<MesXslMixingSpecMaterial> materialList,
|
||||
List<MesXslMixingSpecStep> stepList,
|
||||
List<MesXslMixingSpecDownStep> downStepList,
|
||||
List<MesXslMixingSpecTcu> tcuList) {
|
||||
Date now = new Date();
|
||||
int sort = 0;
|
||||
if (!CollectionUtils.isEmpty(materialList)) {
|
||||
for (MesXslMixingSpecMaterial row : materialList) {
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
row.setId(null);
|
||||
row.setMixingSpecId(mainId);
|
||||
row.setSortNo(sort++);
|
||||
if (row.getCreateTime() == null) {
|
||||
row.setCreateTime(now);
|
||||
}
|
||||
materialMapper.insert(row);
|
||||
}
|
||||
}
|
||||
sort = 0;
|
||||
if (!CollectionUtils.isEmpty(stepList)) {
|
||||
for (MesXslMixingSpecStep row : stepList) {
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
row.setId(null);
|
||||
row.setMixingSpecId(mainId);
|
||||
row.setSortNo(sort++);
|
||||
if (row.getCreateTime() == null) {
|
||||
row.setCreateTime(now);
|
||||
}
|
||||
stepMapper.insert(row);
|
||||
}
|
||||
}
|
||||
sort = 0;
|
||||
if (!CollectionUtils.isEmpty(downStepList)) {
|
||||
for (MesXslMixingSpecDownStep row : downStepList) {
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
row.setId(null);
|
||||
row.setMixingSpecId(mainId);
|
||||
row.setSortNo(sort++);
|
||||
if (row.getCreateTime() == null) {
|
||||
row.setCreateTime(now);
|
||||
}
|
||||
downStepMapper.insert(row);
|
||||
}
|
||||
}
|
||||
List<MesXslMixingSpecTcu> tcuRows = fillDefaultTcuRows(tcuList);
|
||||
sort = 0;
|
||||
for (MesXslMixingSpecTcu row : tcuRows) {
|
||||
row.setId(null);
|
||||
row.setMixingSpecId(mainId);
|
||||
row.setSortNo(sort++);
|
||||
if (row.getCreateTime() == null) {
|
||||
row.setCreateTime(now);
|
||||
}
|
||||
if (TCU_DOWN.equals(row.getSectionType())) {
|
||||
row.setDrugWeighPos(null);
|
||||
}
|
||||
tcuMapper.insert(row);
|
||||
}
|
||||
}
|
||||
|
||||
private List<MesXslMixingSpecMaterial> queryMaterialByMainId(String mainId) {
|
||||
return materialMapper.selectList(
|
||||
new LambdaQueryWrapper<MesXslMixingSpecMaterial>()
|
||||
.eq(MesXslMixingSpecMaterial::getMixingSpecId, mainId)
|
||||
.orderByAsc(MesXslMixingSpecMaterial::getSortNo)
|
||||
.orderByAsc(MesXslMixingSpecMaterial::getId));
|
||||
}
|
||||
|
||||
private List<MesXslMixingSpecStep> queryStepByMainId(String mainId) {
|
||||
return stepMapper.selectList(
|
||||
new LambdaQueryWrapper<MesXslMixingSpecStep>()
|
||||
.eq(MesXslMixingSpecStep::getMixingSpecId, mainId)
|
||||
.orderByAsc(MesXslMixingSpecStep::getSortNo)
|
||||
.orderByAsc(MesXslMixingSpecStep::getId));
|
||||
}
|
||||
|
||||
private List<MesXslMixingSpecDownStep> queryDownStepByMainId(String mainId) {
|
||||
return downStepMapper.selectList(
|
||||
new LambdaQueryWrapper<MesXslMixingSpecDownStep>()
|
||||
.eq(MesXslMixingSpecDownStep::getMixingSpecId, mainId)
|
||||
.orderByAsc(MesXslMixingSpecDownStep::getSortNo)
|
||||
.orderByAsc(MesXslMixingSpecDownStep::getId));
|
||||
}
|
||||
|
||||
private List<MesXslMixingSpecTcu> queryTcuByMainId(String mainId) {
|
||||
return tcuMapper.selectList(
|
||||
new LambdaQueryWrapper<MesXslMixingSpecTcu>()
|
||||
.eq(MesXslMixingSpecTcu::getMixingSpecId, mainId)
|
||||
.orderByAsc(MesXslMixingSpecTcu::getSortNo)
|
||||
.orderByAsc(MesXslMixingSpecTcu::getId));
|
||||
}
|
||||
|
||||
private List<MesXslMixingSpecTcu> fillDefaultTcuRows(List<MesXslMixingSpecTcu> source) {
|
||||
List<MesXslMixingSpecTcu> rows = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(source)) {
|
||||
rows.addAll(source);
|
||||
}
|
||||
boolean hasUp = rows.stream().anyMatch(r -> TCU_UP.equals(r.getSectionType()));
|
||||
boolean hasDown = rows.stream().anyMatch(r -> TCU_DOWN.equals(r.getSectionType()));
|
||||
if (!hasUp) {
|
||||
MesXslMixingSpecTcu up = new MesXslMixingSpecTcu();
|
||||
up.setSectionType(TCU_UP);
|
||||
rows.add(0, up);
|
||||
}
|
||||
if (!hasDown) {
|
||||
MesXslMixingSpecTcu down = new MesXslMixingSpecTcu();
|
||||
down.setSectionType(TCU_DOWN);
|
||||
rows.add(down);
|
||||
}
|
||||
rows.sort((a, b) -> {
|
||||
int ai = TCU_UP.equals(a.getSectionType()) ? 0 : TCU_DOWN.equals(a.getSectionType()) ? 1 : 2;
|
||||
int bi = TCU_UP.equals(b.getSectionType()) ? 0 : TCU_DOWN.equals(b.getSectionType()) ? 1 : 2;
|
||||
return Integer.compare(ai, bi);
|
||||
});
|
||||
if (rows.size() > 2) {
|
||||
return new ArrayList<>(rows.subList(0, 2));
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpec;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecDownStep;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecMaterial;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecStep;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecTcu;
|
||||
|
||||
/**
|
||||
* 混炼示方主子保存VO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MesXslMixingSpecPage extends MesXslMixingSpec {
|
||||
private List<MesXslMixingSpecMaterial> materialList;
|
||||
private List<MesXslMixingSpecStep> stepList;
|
||||
private List<MesXslMixingSpecDownStep> downStepList;
|
||||
private List<MesXslMixingSpecTcu> tcuList;
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT IGNORE INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
VALUES ('1995000000000000098', '混炼TCU区分', 'xslmes_mixing_tcu_section', '混炼示方TCU区分', 0, 'admin', NOW(), 0, 1002);
|
||||
|
||||
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
VALUES ('1995000000000009801', '1995000000000000098', '上密炼机', 'up_mixer', 1, 1, 'admin', NOW());
|
||||
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
VALUES ('1995000000000009802', '1995000000000000098', '下密炼机', 'down_mixer', 2, 1, 'admin', NOW());
|
||||
|
||||
INSERT IGNORE INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
VALUES ('1995000000000000099', '混炼药品称量位置', 'xslmes_mixing_drug_weigh_pos', '混炼示方药品称量位置', 0, 'admin', NOW(), 0, 1002);
|
||||
|
||||
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
VALUES ('1995000000000009901', '1995000000000000099', '药品称', 'drug_scale', 1, 1, 'admin', NOW());
|
||||
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
VALUES ('1995000000000009902', '1995000000000000099', '胶料称', 'rubber_scale', 2, 1, 'admin', NOW());
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_mixing_spec` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户ID',
|
||||
`spec_name` varchar(120) DEFAULT NULL COMMENT '规格',
|
||||
`purpose` varchar(300) DEFAULT NULL COMMENT '用途',
|
||||
`machine_id` varchar(32) DEFAULT NULL COMMENT '机台ID',
|
||||
`machine_name` varchar(120) DEFAULT NULL COMMENT '机台',
|
||||
`make_date` date DEFAULT NULL COMMENT '制作日期',
|
||||
`issue_number` varchar(120) DEFAULT NULL COMMENT '发行编号',
|
||||
`convert_factor` decimal(18,6) DEFAULT NULL COMMENT '换算系数',
|
||||
`fill_volume` decimal(18,6) DEFAULT NULL COMMENT '填充体积',
|
||||
`recycle_carbon_sec` int DEFAULT NULL COMMENT '回收炭黑(秒)',
|
||||
`mother_rubber_sg` decimal(18,6) DEFAULT NULL COMMENT '母胶比重',
|
||||
`final_rubber_sg` decimal(18,6) DEFAULT NULL COMMENT '终炼胶比重',
|
||||
`apply_factory` varchar(120) DEFAULT NULL COMMENT '适用工厂',
|
||||
`stage_count` int DEFAULT NULL COMMENT '段数',
|
||||
`pure_mix_sec` int DEFAULT NULL COMMENT '纯混炼时间(秒)',
|
||||
`recycle_carbon_kg` decimal(18,6) DEFAULT NULL COMMENT '回收炭黑(KG)',
|
||||
`auto_small_print_setting` varchar(200) DEFAULT NULL COMMENT '自动小料打印设定',
|
||||
`set_train_count` int DEFAULT NULL COMMENT '设定车数',
|
||||
`side_wall_water_temp` decimal(18,6) DEFAULT NULL COMMENT '侧壁水温',
|
||||
`overtime_discharge_sec` int DEFAULT NULL COMMENT '超时排胶时间',
|
||||
`overtemp_discharge_sec` int DEFAULT NULL COMMENT '超温排胶时间',
|
||||
`overtemp_discharge_temp` decimal(18,6) DEFAULT NULL COMMENT '超温排胶温度',
|
||||
`door_water_temp` decimal(18,6) DEFAULT NULL COMMENT '卸料门水温',
|
||||
`rotor_water_temp` decimal(18,6) DEFAULT NULL COMMENT '转子水温',
|
||||
`max_feed_temp` decimal(18,6) DEFAULT NULL COMMENT '最高进料温度',
|
||||
`draft_by` varchar(80) DEFAULT NULL COMMENT '起草人',
|
||||
`draft_time` datetime DEFAULT NULL COMMENT '起草时间',
|
||||
`proofread_by` varchar(80) DEFAULT NULL COMMENT '校对人',
|
||||
`proofread_time` datetime DEFAULT NULL COMMENT '校对时间',
|
||||
`audit_by` varchar(80) DEFAULT NULL COMMENT '审核人',
|
||||
`audit_time` datetime DEFAULT NULL COMMENT '审核时间',
|
||||
`approve_by` varchar(80) DEFAULT NULL COMMENT '批准人',
|
||||
`approve_time` datetime DEFAULT NULL COMMENT '批准时间',
|
||||
`change_date` date DEFAULT NULL COMMENT '变更日期',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '所属部门',
|
||||
`create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(50) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
`del_flag` int NOT NULL DEFAULT 0 COMMENT '逻辑删除',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxmix_issue_number` (`issue_number`),
|
||||
KEY `idx_mxmix_spec_name` (`spec_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES混炼示方';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_mixing_spec_material` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`mixing_spec_id` varchar(32) NOT NULL COMMENT '混炼示方主表ID',
|
||||
`sort_no` int DEFAULT NULL COMMENT '行序号',
|
||||
`material_major` varchar(120) DEFAULT NULL COMMENT '物料大类',
|
||||
`material_minor` varchar(120) DEFAULT NULL COMMENT '物料小类',
|
||||
`material_kind` varchar(120) DEFAULT NULL COMMENT '种类',
|
||||
`mixer_material_name` varchar(200) DEFAULT NULL COMMENT '密炼物料名称',
|
||||
`mixer_material_desc` varchar(300) DEFAULT NULL COMMENT '密炼物料描述',
|
||||
`unit_weight` decimal(18,6) DEFAULT NULL COMMENT '单重',
|
||||
`accum_weight` decimal(18,6) DEFAULT NULL COMMENT '累计',
|
||||
`seq_no` int DEFAULT NULL COMMENT '顺序',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户ID',
|
||||
`create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(50) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxmix_mat_main` (`mixing_spec_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES混炼示方明细-橡胶及配合剂';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_mixing_spec_step` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`mixing_spec_id` varchar(32) NOT NULL COMMENT '混炼示方主表ID',
|
||||
`sort_no` int DEFAULT NULL COMMENT '行序号',
|
||||
`action_name` varchar(120) DEFAULT NULL COMMENT '动作',
|
||||
`action_sec` int DEFAULT NULL COMMENT '时间(秒)',
|
||||
`protect_sec` int DEFAULT NULL COMMENT '保护时间',
|
||||
`temp_c` decimal(18,6) DEFAULT NULL COMMENT '温度(℃)',
|
||||
`power_kw` decimal(18,6) DEFAULT NULL COMMENT '功率(Kw)',
|
||||
`energy_kwh` decimal(18,6) DEFAULT NULL COMMENT '能量(Kwh)',
|
||||
`combo_mode` varchar(120) DEFAULT NULL COMMENT '组合',
|
||||
`speed_rpm` decimal(18,6) DEFAULT NULL COMMENT '转速(rpm)',
|
||||
`pressure_mpa` decimal(18,6) DEFAULT NULL COMMENT '压力(Mpa)',
|
||||
`bolt_percent` decimal(18,6) DEFAULT NULL COMMENT '栓(%)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户ID',
|
||||
`create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(50) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxmix_step_main` (`mixing_spec_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES混炼示方明细-混合步骤';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_mixing_spec_down_step` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`mixing_spec_id` varchar(32) NOT NULL COMMENT '混炼示方主表ID',
|
||||
`sort_no` int DEFAULT NULL COMMENT '行序号',
|
||||
`action_name` varchar(120) DEFAULT NULL COMMENT '动作',
|
||||
`action_sec` int DEFAULT NULL COMMENT '时间(秒)',
|
||||
`protect_sec` int DEFAULT NULL COMMENT '保护时间',
|
||||
`temp_c` decimal(18,6) DEFAULT NULL COMMENT '温度(℃)',
|
||||
`power_kw` decimal(18,6) DEFAULT NULL COMMENT '功率(Kw)',
|
||||
`energy_kwh` decimal(18,6) DEFAULT NULL COMMENT '能量(Kwh)',
|
||||
`combo_mode` varchar(120) DEFAULT NULL COMMENT '组合',
|
||||
`speed_rpm` decimal(18,6) DEFAULT NULL COMMENT '转速(rpm)',
|
||||
`pressure_mpa` decimal(18,6) DEFAULT NULL COMMENT '压力(Mpa)',
|
||||
`bolt_percent` decimal(18,6) DEFAULT NULL COMMENT '栓(%)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户ID',
|
||||
`create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(50) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxmix_down_step_main` (`mixing_spec_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES混炼示方明细-下密炼机混炼条件';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_mixing_spec_tcu` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`mixing_spec_id` varchar(32) NOT NULL COMMENT '混炼示方主表ID',
|
||||
`sort_no` int DEFAULT NULL COMMENT '行序号',
|
||||
`section_type` varchar(32) DEFAULT NULL COMMENT '区分(上密炼机/下密炼机)',
|
||||
`front_rotor_temp` decimal(18,6) DEFAULT NULL COMMENT '前转子温度',
|
||||
`rear_rotor_temp` decimal(18,6) DEFAULT NULL COMMENT '后转子温度',
|
||||
`front_chamber_temp` decimal(18,6) DEFAULT NULL COMMENT '前混炼室温度',
|
||||
`rear_chamber_temp` decimal(18,6) DEFAULT NULL COMMENT '后混炼室温度',
|
||||
`top_plug_temp` decimal(18,6) DEFAULT NULL COMMENT '上下顶栓温度',
|
||||
`drug_weigh_pos` varchar(32) DEFAULT NULL COMMENT '药品称量位置',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户ID',
|
||||
`create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(50) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxmix_tcu_main` (`mixing_spec_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES混炼示方明细-TCU温度条件';
|
||||
|
||||
UPDATE `sys_permission`
|
||||
SET `is_leaf` = 0, `update_time` = NOW()
|
||||
WHERE `id` = '1900000000000000810' AND `is_leaf` = 1;
|
||||
|
||||
INSERT IGNORE INTO `sys_permission` (
|
||||
`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`,
|
||||
`menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`,
|
||||
`hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`,
|
||||
`del_flag`, `rule_flag`, `status`, `internal_or_external`
|
||||
) VALUES (
|
||||
'177925970995540', '1900000000000000810', '混炼示方', '/xslmes/mesXslMixingSpec',
|
||||
'xslmes/mesXslMixingSpec/MesXslMixingSpecList', 1, 'MesXslMixingSpecList', NULL,
|
||||
1, NULL, '0', 2.00, 0, 'ant-design:table-outlined', 0, 1,
|
||||
0, 0, 'MES混炼示方', 'admin', NOW(), 'admin', NOW(),
|
||||
0, 0, '1', 0
|
||||
);
|
||||
|
||||
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
VALUES ('177925970995541', '177925970995540', '新增', 2, 'xslmes:mes_xsl_mixing_spec:add', '1', 1.00, 0, 1, 0, '1', 0, 'admin', NOW());
|
||||
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
VALUES ('177925970995542', '177925970995540', '编辑', 2, 'xslmes:mes_xsl_mixing_spec:edit', '1', 2.00, 0, 1, 0, '1', 0, 'admin', NOW());
|
||||
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
VALUES ('177925970995543', '177925970995540', '删除', 2, 'xslmes:mes_xsl_mixing_spec:delete', '1', 3.00, 0, 1, 0, '1', 0, 'admin', NOW());
|
||||
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
VALUES ('177925970995544', '177925970995540', '批量删除', 2, 'xslmes:mes_xsl_mixing_spec:deleteBatch', '1', 4.00, 0, 1, 0, '1', 0, 'admin', NOW());
|
||||
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
VALUES ('177925970995545', '177925970995540', '导出', 2, 'xslmes:mes_xsl_mixing_spec:exportXls', '1', 5.00, 0, 1, 0, '1', 0, 'admin', NOW());
|
||||
INSERT IGNORE INTO `sys_permission` (`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
VALUES ('177925970995546', '177925970995540', '导入', 2, 'xslmes:mes_xsl_mixing_spec:importExcel', '1', 6.00, 0, 1, 0, '1', 0, 'admin', NOW());
|
||||
|
||||
INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.id, p.id, NULL, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'177925970995540', '177925970995541', '177925970995542',
|
||||
'177925970995543', '177925970995544', '177925970995545', '177925970995546'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.id AND rp.`permission_id` = p.id
|
||||
);
|
||||
@@ -0,0 +1,37 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslMixingSpec/list',
|
||||
save = '/xslmes/mesXslMixingSpec/add',
|
||||
edit = '/xslmes/mesXslMixingSpec/edit',
|
||||
deleteOne = '/xslmes/mesXslMixingSpec/delete',
|
||||
deleteBatch = '/xslmes/mesXslMixingSpec/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslMixingSpec/importExcel',
|
||||
exportXls = '/xslmes/mesXslMixingSpec/exportXls',
|
||||
queryById = '/xslmes/mesXslMixingSpec/queryById',
|
||||
queryIssueNumberOptions = '/xslmes/mesXslMixingSpec/queryIssueNumberOptions',
|
||||
queryPurposeOptions = '/xslmes/mesXslMixingSpec/queryPurposeOptions',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
export const getImportUrl = Api.importExcel;
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
|
||||
export const queryIssueNumberOptions = (params) => defHttp.get({ url: Api.queryIssueNumberOptions, params });
|
||||
export const queryPurposeOptions = (params) => defHttp.get({ url: Api.queryPurposeOptions, params });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
Modal.confirm({
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () =>
|
||||
defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => handleSuccess()),
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,587 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
|
||||
import { createLocalStorage } from '/@/utils/cache';
|
||||
import { buildUUID } from '/@/utils/uuid';
|
||||
|
||||
const mixingMaterialColumnStorage = createLocalStorage();
|
||||
|
||||
/** 橡胶及配合剂明细列隐藏偏好 localStorage 键 */
|
||||
export const MIXING_MATERIAL_COLUMN_CACHE_KEY = 'mes_xsl_mixing_spec_material_hidden_columns';
|
||||
|
||||
/** 橡胶及配合剂明细列宽偏好 localStorage 键 */
|
||||
export const MIXING_MATERIAL_COLUMN_WIDTH_CACHE_KEY = 'mes_xsl_mixing_spec_material_column_widths_v2';
|
||||
|
||||
/** 行号列宽度(与 JVxeTable rowNumber 默认一致) */
|
||||
export const MIXING_MATERIAL_ROW_NUMBER_WIDTH = 60;
|
||||
|
||||
/** 橡胶及配合剂明细列可缩小到的最小宽度 */
|
||||
export const MIXING_MATERIAL_MIN_COLUMN_WIDTH = 40;
|
||||
|
||||
/** 默认隐藏的明细列 */
|
||||
export const MIXING_MATERIAL_DEFAULT_HIDDEN_COLUMN_KEYS = ['materialMajor', 'materialKind'];
|
||||
|
||||
/** 不允许隐藏的明细列 */
|
||||
export const MIXING_MATERIAL_LOCKED_COLUMN_KEYS = ['mixerMaterialName'];
|
||||
|
||||
export interface MixingMaterialColumnSettingItem {
|
||||
key: string;
|
||||
title: string;
|
||||
locked?: boolean;
|
||||
}
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '规格', align: 'center', dataIndex: 'specName', width: 160, fixed: 'left' },
|
||||
{ title: '用途', align: 'center', dataIndex: 'purpose', width: 180 },
|
||||
{ title: '机台', align: 'center', dataIndex: 'machineName', width: 120 },
|
||||
{ title: '制作日期', align: 'center', dataIndex: 'makeDate', width: 120 },
|
||||
{ title: '发行编号', align: 'center', dataIndex: 'issueNumber', width: 150 },
|
||||
{ title: '段数', align: 'center', dataIndex: 'stageCount', width: 80 },
|
||||
{ title: '纯混炼时间(秒)', align: 'center', dataIndex: 'pureMixSec', width: 130 },
|
||||
{ title: '变更日期', align: 'center', dataIndex: 'changeDate', width: 120 },
|
||||
{ title: '修改时间', align: 'center', dataIndex: 'updateTime', width: 165 },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '关键字', field: 'keyword', component: 'Input', colProps: { span: 8 }, componentProps: { placeholder: '规格/用途/发行编号/机台' } },
|
||||
{ label: '制作日期起', field: 'makeDate_begin', component: 'DatePicker', colProps: { span: 8 }, componentProps: { valueFormat: 'YYYY-MM-DD' } },
|
||||
{ label: '制作日期止', field: 'makeDate_end', component: 'DatePicker', colProps: { span: 8 }, componentProps: { valueFormat: 'YYYY-MM-DD' } },
|
||||
];
|
||||
|
||||
export const mainSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '规格', field: 'specName', component: 'Input', required: true, colProps: { span: 8 } },
|
||||
{ label: '用途', field: 'purpose', component: 'AutoComplete', required: true, colProps: { span: 8 } },
|
||||
{ label: '机台', field: 'machineName', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '制作日期', field: 'makeDate', component: 'DatePicker', colProps: { span: 8 }, componentProps: { valueFormat: 'YYYY-MM-DD' } },
|
||||
{ label: '发行编号', field: 'issueNumber', component: 'AutoComplete', required: true, colProps: { span: 8 } },
|
||||
{ label: '换算系数', field: 'convertFactor', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||
{ label: '填充体积', field: 'fillVolume', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||
{ label: '回收炭黑(秒)', field: 'recycleCarbonSec', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 0, style: { width: '100%' } } },
|
||||
{ label: '母胶比重', field: 'motherRubberSg', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||
{ label: '终炼胶比重', field: 'finalRubberSg', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||
{ label: '适用工厂', field: 'applyFactory', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '段数', field: 'stageCount', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 0, style: { width: '100%' } } },
|
||||
{ label: '纯混炼时间(秒)', field: 'pureMixSec', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 0, style: { width: '100%' } } },
|
||||
{ label: '回收炭黑(KG)', field: 'recycleCarbonKg', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||
{ label: '自动小料打印设定', field: 'autoSmallPrintSetting', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '设定车数', field: 'setTrainCount', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 0, style: { width: '100%' } } },
|
||||
{ label: '侧壁水温', field: 'sideWallWaterTemp', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||
{ label: '超时排胶时间', field: 'overtimeDischargeSec', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 0, style: { width: '100%' } } },
|
||||
{ label: '超温排胶时间', field: 'overtempDischargeSec', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 0, style: { width: '100%' } } },
|
||||
{ label: '超温排胶温度', field: 'overtempDischargeTemp', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||
{ label: '卸料门水温', field: 'doorWaterTemp', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||
{ label: '转子水温', field: 'rotorWaterTemp', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||
{ label: '最高进料温度', field: 'maxFeedTemp', component: 'InputNumber', colProps: { span: 8 }, componentProps: { precision: 6, style: { width: '100%' } } },
|
||||
{ label: '起草人', field: 'draftBy', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '起草时间', field: 'draftTime', component: 'DatePicker', colProps: { span: 8 }, componentProps: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss' } },
|
||||
{ label: '校对人', field: 'proofreadBy', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '校对时间', field: 'proofreadTime', component: 'DatePicker', colProps: { span: 8 }, componentProps: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss' } },
|
||||
{ label: '审核人', field: 'auditBy', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '审核时间', field: 'auditTime', component: 'DatePicker', colProps: { span: 8 }, componentProps: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss' } },
|
||||
{ label: '批准人', field: 'approveBy', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '批准时间', field: 'approveTime', component: 'DatePicker', colProps: { span: 8 }, componentProps: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss' } },
|
||||
{ label: '变更日期', field: 'changeDate', component: 'DatePicker', colProps: { span: 8 }, componentProps: { valueFormat: 'YYYY-MM-DD' } },
|
||||
];
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】橡胶及配合剂明细列展示设置-----------
|
||||
export const materialColumns: JVxeColumn[] = [
|
||||
{ title: '物料大类', key: 'materialMajor', type: JVxeTypes.input, width: 100, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH },
|
||||
{ title: '物料小类', key: 'materialMinor', type: JVxeTypes.input, width: 120, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH },
|
||||
{ title: '种类', key: 'materialKind', type: JVxeTypes.input, width: 80, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH },
|
||||
{ title: '密炼物料名称', key: 'mixerMaterialName', type: JVxeTypes.input, width: 160, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH },
|
||||
{ title: '密炼物料描述', key: 'mixerMaterialDesc', type: JVxeTypes.input, width: 220, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH },
|
||||
{ title: '单重', key: 'unitWeight', type: JVxeTypes.inputNumber, width: 72, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '累计', key: 'accumWeight', type: JVxeTypes.inputNumber, width: 72, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '顺序', key: 'seqNo', type: JVxeTypes.inputNumber, width: 64, minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
];
|
||||
|
||||
/** 橡胶及配合剂明细列设置项 */
|
||||
export function getMixingMaterialColumnSettingItems(): MixingMaterialColumnSettingItem[] {
|
||||
return materialColumns.map((col) => ({
|
||||
key: String(col.key),
|
||||
title: String(col.title),
|
||||
locked: MIXING_MATERIAL_LOCKED_COLUMN_KEYS.includes(String(col.key)),
|
||||
}));
|
||||
}
|
||||
|
||||
/** 读取已隐藏的橡胶及配合剂明细列 key */
|
||||
export function loadMixingMaterialHiddenColumnKeys(): string[] {
|
||||
const saved = mixingMaterialColumnStorage.get(MIXING_MATERIAL_COLUMN_CACHE_KEY);
|
||||
const validKeys = new Set(getMixingMaterialColumnSettingItems().map((item) => item.key));
|
||||
if (!Array.isArray(saved)) {
|
||||
return MIXING_MATERIAL_DEFAULT_HIDDEN_COLUMN_KEYS.filter((key) => validKeys.has(key));
|
||||
}
|
||||
return saved.filter(
|
||||
(key) => typeof key === 'string' && !MIXING_MATERIAL_LOCKED_COLUMN_KEYS.includes(key) && validKeys.has(key),
|
||||
);
|
||||
}
|
||||
|
||||
/** 保存已隐藏的橡胶及配合剂明细列 key */
|
||||
export function saveMixingMaterialHiddenColumnKeys(hiddenKeys: string[]) {
|
||||
const validKeys = hiddenKeys.filter((key) => !MIXING_MATERIAL_LOCKED_COLUMN_KEYS.includes(key));
|
||||
if (validKeys.length) {
|
||||
mixingMaterialColumnStorage.set(MIXING_MATERIAL_COLUMN_CACHE_KEY, validKeys);
|
||||
return;
|
||||
}
|
||||
mixingMaterialColumnStorage.remove(MIXING_MATERIAL_COLUMN_CACHE_KEY);
|
||||
}
|
||||
|
||||
/** 按隐藏配置过滤橡胶及配合剂明细列 */
|
||||
export function applyMixingMaterialColumnVisibility(columns: JVxeColumn[], hiddenKeys: string[]): JVxeColumn[] {
|
||||
if (!hiddenKeys?.length) {
|
||||
return columns;
|
||||
}
|
||||
const hiddenSet = new Set(hiddenKeys);
|
||||
return columns.filter((col) => !col.key || !hiddenSet.has(String(col.key)));
|
||||
}
|
||||
|
||||
/** 读取已保存的橡胶及配合剂明细列宽 */
|
||||
export function loadMixingMaterialColumnWidths(): Record<string, number> {
|
||||
const saved = mixingMaterialColumnStorage.get(MIXING_MATERIAL_COLUMN_WIDTH_CACHE_KEY);
|
||||
const validKeys = new Set(materialColumns.map((col) => String(col.key)));
|
||||
if (!saved || typeof saved !== 'object') {
|
||||
return {};
|
||||
}
|
||||
const result: Record<string, number> = {};
|
||||
Object.entries(saved as Record<string, unknown>).forEach(([key, value]) => {
|
||||
if (validKeys.has(key) && typeof value === 'number' && value > 0) {
|
||||
result[key] = value;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 保存橡胶及配合剂明细列宽 */
|
||||
export function saveMixingMaterialColumnWidths(widthMap: Record<string, number>) {
|
||||
const validKeys = new Set(materialColumns.map((col) => String(col.key)));
|
||||
const next: Record<string, number> = {};
|
||||
Object.entries(widthMap || {}).forEach(([key, value]) => {
|
||||
if (validKeys.has(key) && typeof value === 'number' && value > 0) {
|
||||
next[key] = value;
|
||||
}
|
||||
});
|
||||
if (Object.keys(next).length) {
|
||||
mixingMaterialColumnStorage.set(MIXING_MATERIAL_COLUMN_WIDTH_CACHE_KEY, next);
|
||||
return;
|
||||
}
|
||||
mixingMaterialColumnStorage.remove(MIXING_MATERIAL_COLUMN_WIDTH_CACHE_KEY);
|
||||
}
|
||||
|
||||
/** 应用已保存列宽(minWidth 保持最小值,允许拖拽缩小) */
|
||||
export function applyMixingMaterialColumnWidths(columns: JVxeColumn[], widthMap: Record<string, number>): JVxeColumn[] {
|
||||
return columns.map((col) => {
|
||||
const savedWidth = widthMap[String(col.key)];
|
||||
const nextCol = {
|
||||
...col,
|
||||
minWidth: MIXING_MATERIAL_MIN_COLUMN_WIDTH,
|
||||
};
|
||||
if (savedWidth) {
|
||||
nextCol.width = savedWidth;
|
||||
}
|
||||
return nextCol;
|
||||
});
|
||||
}
|
||||
|
||||
/** 计算橡胶及配合剂明细表总宽度 */
|
||||
export function calcMixingMaterialTableWidth(columns: JVxeColumn[], widthMap: Record<string, number> = {}) {
|
||||
const dataWidth = columns.reduce((sum, col) => {
|
||||
const key = String(col.key);
|
||||
const width = widthMap[key] ?? Number(col.width) ?? 80;
|
||||
return sum + width;
|
||||
}, 0);
|
||||
return MIXING_MATERIAL_ROW_NUMBER_WIDTH + dataWidth + 1;
|
||||
}
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A17】橡胶及配合剂明细列展示设置-----------
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A20】明细表默认列宽对齐参考图-----------
|
||||
/** 混合步骤/下密炼机明细列可缩小到的最小宽度 */
|
||||
export const MIXING_STEP_MIN_COLUMN_WIDTH = 48;
|
||||
|
||||
export const stepColumns: JVxeColumn[] = [
|
||||
{ title: '动作', key: 'actionName', type: JVxeTypes.input, width: 120, minWidth: MIXING_STEP_MIN_COLUMN_WIDTH },
|
||||
{ title: '时间(")', key: 'actionSec', type: JVxeTypes.inputNumber, width: 80, minWidth: MIXING_STEP_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '保护时间', key: 'protectSec', type: JVxeTypes.inputNumber, width: 80, minWidth: MIXING_STEP_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '温度(℃)', key: 'tempC', type: JVxeTypes.inputNumber, width: 80, minWidth: MIXING_STEP_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '功率(Kw)', key: 'powerKw', type: JVxeTypes.inputNumber, width: 80, minWidth: MIXING_STEP_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '能量(Kwh)', key: 'energyKwh', type: JVxeTypes.inputNumber, width: 80, minWidth: MIXING_STEP_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '组合', key: 'comboMode', type: JVxeTypes.input, width: 72, minWidth: MIXING_STEP_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '转速(rpm)', key: 'speedRpm', type: JVxeTypes.inputNumber, width: 80, minWidth: MIXING_STEP_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '压力(Mpa)', key: 'pressureMpa', type: JVxeTypes.inputNumber, width: 80, minWidth: MIXING_STEP_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '栓(%)', key: 'boltPercent', type: JVxeTypes.inputNumber, width: 72, minWidth: MIXING_STEP_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
];
|
||||
|
||||
/** 混合步骤/下密炼机明细列宽偏好 localStorage 键(两表共用同步) */
|
||||
export const MIXING_STEP_COLUMN_WIDTH_CACHE_KEY = 'mes_xsl_mixing_spec_step_column_widths_v1';
|
||||
|
||||
/** 读取已保存的混合步骤明细列宽 */
|
||||
export function loadMixingStepColumnWidths(): Record<string, number> {
|
||||
const saved = mixingMaterialColumnStorage.get(MIXING_STEP_COLUMN_WIDTH_CACHE_KEY);
|
||||
const validKeys = new Set(stepColumns.map((col) => String(col.key)));
|
||||
if (!saved || typeof saved !== 'object') {
|
||||
return {};
|
||||
}
|
||||
const result: Record<string, number> = {};
|
||||
Object.entries(saved as Record<string, unknown>).forEach(([key, value]) => {
|
||||
if (validKeys.has(key) && typeof value === 'number' && value > 0) {
|
||||
result[key] = value;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 保存混合步骤明细列宽 */
|
||||
export function saveMixingStepColumnWidths(widthMap: Record<string, number>) {
|
||||
const validKeys = new Set(stepColumns.map((col) => String(col.key)));
|
||||
const next: Record<string, number> = {};
|
||||
Object.entries(widthMap || {}).forEach(([key, value]) => {
|
||||
if (validKeys.has(key) && typeof value === 'number' && value > 0) {
|
||||
next[key] = value;
|
||||
}
|
||||
});
|
||||
if (Object.keys(next).length) {
|
||||
mixingMaterialColumnStorage.set(MIXING_STEP_COLUMN_WIDTH_CACHE_KEY, next);
|
||||
return;
|
||||
}
|
||||
mixingMaterialColumnStorage.remove(MIXING_STEP_COLUMN_WIDTH_CACHE_KEY);
|
||||
}
|
||||
|
||||
/** 应用已保存混合步骤列宽(minWidth 保持最小值,允许拖拽缩小) */
|
||||
export function applyMixingStepColumnWidths(columns: JVxeColumn[], widthMap: Record<string, number>): JVxeColumn[] {
|
||||
return columns.map((col) => {
|
||||
const savedWidth = widthMap[String(col.key)];
|
||||
const nextCol = {
|
||||
...col,
|
||||
minWidth: MIXING_STEP_MIN_COLUMN_WIDTH,
|
||||
};
|
||||
if (savedWidth) {
|
||||
nextCol.width = savedWidth;
|
||||
}
|
||||
return nextCol;
|
||||
});
|
||||
}
|
||||
|
||||
/** 计算混合步骤/下密炼机明细表总宽度 */
|
||||
export function calcMixingStepTableWidth(columns: JVxeColumn[] = stepColumns, widthMap: Record<string, number> = {}) {
|
||||
const dataWidth = columns.reduce((sum, col) => {
|
||||
const key = String(col.key);
|
||||
const width = widthMap[key] ?? Number(col.width) ?? Number(col.minWidth) ?? 80;
|
||||
return sum + width;
|
||||
}, 0);
|
||||
return MIXING_MATERIAL_ROW_NUMBER_WIDTH + dataWidth + 1;
|
||||
}
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A20】明细表默认列宽对齐参考图-----------
|
||||
|
||||
export const downStepColumns: JVxeColumn[] = [...stepColumns];
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A19】TCU温度条件表列宽可调且表头换行-----------
|
||||
/** TCU 温度条件明细列宽偏好 localStorage 键 */
|
||||
export const MIXING_TCU_COLUMN_WIDTH_CACHE_KEY = 'mes_xsl_mixing_spec_tcu_column_widths_v2';
|
||||
|
||||
/** TCU 温度条件明细列可缩小到的最小宽度 */
|
||||
export const MIXING_TCU_MIN_COLUMN_WIDTH = 48;
|
||||
|
||||
export const tcuColumns: JVxeColumn[] = [
|
||||
{ title: '区分', key: 'sectionType', type: JVxeTypes.select, dictCode: 'xslmes_mixing_tcu_section', width: 96, minWidth: MIXING_TCU_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '前转子温度', key: 'frontRotorTemp', type: JVxeTypes.inputNumber, width: 76, minWidth: MIXING_TCU_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '后转子温度', key: 'rearRotorTemp', type: JVxeTypes.inputNumber, width: 76, minWidth: MIXING_TCU_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '前混炼室温度', key: 'frontChamberTemp', type: JVxeTypes.inputNumber, width: 76, minWidth: MIXING_TCU_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '后混炼室温度', key: 'rearChamberTemp', type: JVxeTypes.inputNumber, width: 76, minWidth: MIXING_TCU_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '上下顶栓温度', key: 'topPlugTemp', type: JVxeTypes.inputNumber, width: 76, minWidth: MIXING_TCU_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
{ title: '药品称量位置', key: 'drugWeighPos', type: JVxeTypes.select, dictCode: 'xslmes_mixing_drug_weigh_pos', width: 76, minWidth: MIXING_TCU_MIN_COLUMN_WIDTH, align: 'center' },
|
||||
];
|
||||
|
||||
/** 读取已保存的 TCU 温度条件明细列宽 */
|
||||
export function loadMixingTcuColumnWidths(): Record<string, number> {
|
||||
const saved = mixingMaterialColumnStorage.get(MIXING_TCU_COLUMN_WIDTH_CACHE_KEY);
|
||||
const validKeys = new Set(tcuColumns.map((col) => String(col.key)));
|
||||
if (!saved || typeof saved !== 'object') {
|
||||
return {};
|
||||
}
|
||||
const result: Record<string, number> = {};
|
||||
Object.entries(saved as Record<string, unknown>).forEach(([key, value]) => {
|
||||
if (validKeys.has(key) && typeof value === 'number' && value > 0) {
|
||||
result[key] = value;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 保存 TCU 温度条件明细列宽 */
|
||||
export function saveMixingTcuColumnWidths(widthMap: Record<string, number>) {
|
||||
const validKeys = new Set(tcuColumns.map((col) => String(col.key)));
|
||||
const next: Record<string, number> = {};
|
||||
Object.entries(widthMap || {}).forEach(([key, value]) => {
|
||||
if (validKeys.has(key) && typeof value === 'number' && value > 0) {
|
||||
next[key] = value;
|
||||
}
|
||||
});
|
||||
if (Object.keys(next).length) {
|
||||
mixingMaterialColumnStorage.set(MIXING_TCU_COLUMN_WIDTH_CACHE_KEY, next);
|
||||
return;
|
||||
}
|
||||
mixingMaterialColumnStorage.remove(MIXING_TCU_COLUMN_WIDTH_CACHE_KEY);
|
||||
}
|
||||
|
||||
/** 应用已保存 TCU 列宽(minWidth 保持最小值,允许拖拽缩小) */
|
||||
export function applyMixingTcuColumnWidths(columns: JVxeColumn[], widthMap: Record<string, number>): JVxeColumn[] {
|
||||
return columns.map((col) => {
|
||||
const savedWidth = widthMap[String(col.key)];
|
||||
const nextCol = {
|
||||
...col,
|
||||
minWidth: MIXING_TCU_MIN_COLUMN_WIDTH,
|
||||
};
|
||||
if (savedWidth) {
|
||||
nextCol.width = savedWidth;
|
||||
}
|
||||
return nextCol;
|
||||
});
|
||||
}
|
||||
|
||||
/** 计算 TCU 温度条件明细表总宽度 */
|
||||
export function calcMixingTcuTableWidth(columns: JVxeColumn[] = tcuColumns, widthMap: Record<string, number> = {}) {
|
||||
const dataWidth = columns.reduce((sum, col) => {
|
||||
const key = String(col.key);
|
||||
const width = widthMap[key] ?? Number(col.width) ?? Number(col.minWidth) ?? 80;
|
||||
return sum + width;
|
||||
}, 0);
|
||||
return MIXING_MATERIAL_ROW_NUMBER_WIDTH + dataWidth + 1;
|
||||
}
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A19】TCU温度条件表列宽可调且表头换行-----------
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A26】TCU紧凑两行且胶料表向下扩展-----------
|
||||
/** TCU 温度条件固定行数(上密炼机/下密炼机) */
|
||||
export const DEFAULT_MIXING_TCU_ROW_COUNT = 2;
|
||||
|
||||
/** TCU 表头高度(列标题换行) */
|
||||
export const MIXING_TCU_HEADER_HEIGHT = 48;
|
||||
|
||||
/** 计算 TCU 温度条件表格高度(仅展示固定两行) */
|
||||
export function calcMixingTcuTableHeight(rowCount = DEFAULT_MIXING_TCU_ROW_COUNT) {
|
||||
const rows = Math.max(1, rowCount);
|
||||
return MIXING_TCU_HEADER_HEIGHT + rows * MIXING_VXE_MINI_ROW_HEIGHT + 2;
|
||||
}
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A26】TCU紧凑两行且胶料表向下扩展-----------
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A22】明细表默认空行数-----------
|
||||
/** 橡胶及配合剂明细默认行数 */
|
||||
export const DEFAULT_MIXING_MATERIAL_ROW_COUNT = 20;
|
||||
|
||||
/** 混合步骤明细默认行数 */
|
||||
export const DEFAULT_MIXING_STEP_ROW_COUNT = 30;
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A30】胶料/混合步骤列表默认展示高度-----------
|
||||
/** 橡胶及配合剂明细列表默认展示行数(可视高度) */
|
||||
export const MIXING_MATERIAL_VISIBLE_ROW_COUNT = 17;
|
||||
|
||||
/** 混合步骤明细列表默认展示行数(可视高度) */
|
||||
export const MIXING_STEP_VISIBLE_ROW_COUNT = 15;
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A30】胶料/混合步骤列表默认展示高度-----------
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A27】下密炼机混炼条件默认行数改为4-----------
|
||||
/** 下密炼机混炼条件明细默认行数 */
|
||||
export const DEFAULT_MIXING_DOWN_STEP_ROW_COUNT = 4;
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A27】下密炼机混炼条件默认行数改为4-----------
|
||||
|
||||
/** vxe mini 表头高度 */
|
||||
export const MIXING_VXE_MINI_HEADER_HEIGHT = 36;
|
||||
|
||||
/** vxe mini 行高 */
|
||||
export const MIXING_VXE_MINI_ROW_HEIGHT = 32;
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A29】胶料/混合步骤表格高度按行数完整展示-----------
|
||||
/** 计算橡胶及配合剂明细表格展示高度 */
|
||||
export function calcMixingMaterialTableHeight(rowCount = MIXING_MATERIAL_VISIBLE_ROW_COUNT) {
|
||||
const rows = Math.max(1, rowCount);
|
||||
return MIXING_VXE_MINI_HEADER_HEIGHT + rows * MIXING_VXE_MINI_ROW_HEIGHT + 4;
|
||||
}
|
||||
|
||||
/** 计算混合步骤明细表格展示高度 */
|
||||
export function calcMixingStepTableHeight(rowCount = MIXING_STEP_VISIBLE_ROW_COUNT) {
|
||||
const rows = Math.max(1, rowCount);
|
||||
return MIXING_VXE_MINI_HEADER_HEIGHT + rows * MIXING_VXE_MINI_ROW_HEIGHT + 4;
|
||||
}
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A31】下密炼机4行表格高度微调-----------
|
||||
/** 计算下密炼机混炼条件表格高度(默认完整展示4行) */
|
||||
export function calcMixingDownStepTableHeight(rowCount = DEFAULT_MIXING_DOWN_STEP_ROW_COUNT) {
|
||||
const rows = Math.max(1, rowCount);
|
||||
// 额外留白补偿边框与 vxe 内边距,避免第4行底部被裁切
|
||||
return MIXING_VXE_MINI_HEADER_HEIGHT + rows * MIXING_VXE_MINI_ROW_HEIGHT + 12;
|
||||
}
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A31】下密炼机4行表格高度微调-----------
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A29】胶料/混合步骤表格高度按行数完整展示-----------
|
||||
|
||||
//update-begin---author:cursor ---date:20260522 for:【XSLMES-20260522-A32】四明细表行高/展示行数设置持久化-----------
|
||||
/** 混炼示方明细表标识 */
|
||||
export type MixingDetailTableKey = 'material' | 'tcu' | 'step' | 'downStep';
|
||||
|
||||
/** 明细表行高与展示行数偏好 */
|
||||
export interface MixingTableHeightPreference {
|
||||
rowHeight: number;
|
||||
visibleRowCount: number;
|
||||
}
|
||||
|
||||
/** 明细表行高设置元数据 */
|
||||
export interface MixingTableHeightSettingMeta {
|
||||
key: MixingDetailTableKey;
|
||||
label: string;
|
||||
defaultRowHeight: number;
|
||||
defaultVisibleRowCount: number;
|
||||
minVisibleRowCount: number;
|
||||
maxVisibleRowCount: number;
|
||||
headerHeight: number;
|
||||
extraPadding: number;
|
||||
}
|
||||
|
||||
/** 明细表行高 localStorage 键 */
|
||||
export const MIXING_TABLE_HEIGHT_PREF_CACHE_KEY = 'mes_xsl_mixing_spec_table_height_prefs_v1';
|
||||
|
||||
/** 行高可调范围(px) */
|
||||
export const MIXING_TABLE_ROW_HEIGHT_MIN = 24;
|
||||
export const MIXING_TABLE_ROW_HEIGHT_MAX = 56;
|
||||
|
||||
export const MIXING_TABLE_HEIGHT_SETTING_META: Record<MixingDetailTableKey, MixingTableHeightSettingMeta> = {
|
||||
material: {
|
||||
key: 'material',
|
||||
label: '橡胶及配合剂',
|
||||
defaultRowHeight: MIXING_VXE_MINI_ROW_HEIGHT,
|
||||
defaultVisibleRowCount: MIXING_MATERIAL_VISIBLE_ROW_COUNT,
|
||||
minVisibleRowCount: 5,
|
||||
maxVisibleRowCount: 30,
|
||||
headerHeight: MIXING_VXE_MINI_HEADER_HEIGHT,
|
||||
extraPadding: 4,
|
||||
},
|
||||
tcu: {
|
||||
key: 'tcu',
|
||||
label: 'TCU温度条件',
|
||||
defaultRowHeight: MIXING_VXE_MINI_ROW_HEIGHT,
|
||||
defaultVisibleRowCount: DEFAULT_MIXING_TCU_ROW_COUNT,
|
||||
minVisibleRowCount: 2,
|
||||
maxVisibleRowCount: 6,
|
||||
headerHeight: MIXING_TCU_HEADER_HEIGHT,
|
||||
extraPadding: 2,
|
||||
},
|
||||
step: {
|
||||
key: 'step',
|
||||
label: '混合步骤',
|
||||
defaultRowHeight: MIXING_VXE_MINI_ROW_HEIGHT,
|
||||
defaultVisibleRowCount: MIXING_STEP_VISIBLE_ROW_COUNT,
|
||||
minVisibleRowCount: 5,
|
||||
maxVisibleRowCount: 40,
|
||||
headerHeight: MIXING_VXE_MINI_HEADER_HEIGHT,
|
||||
extraPadding: 4,
|
||||
},
|
||||
downStep: {
|
||||
key: 'downStep',
|
||||
label: '下密炼机混炼条件',
|
||||
defaultRowHeight: MIXING_VXE_MINI_ROW_HEIGHT,
|
||||
defaultVisibleRowCount: DEFAULT_MIXING_DOWN_STEP_ROW_COUNT,
|
||||
minVisibleRowCount: 2,
|
||||
maxVisibleRowCount: 12,
|
||||
headerHeight: MIXING_VXE_MINI_HEADER_HEIGHT,
|
||||
extraPadding: 12,
|
||||
},
|
||||
};
|
||||
|
||||
function clampMixingTableNumber(value: unknown, min: number, max: number, fallback: number) {
|
||||
const num = Number(value);
|
||||
if (Number.isNaN(num)) {
|
||||
return fallback;
|
||||
}
|
||||
return Math.min(max, Math.max(min, Math.round(num)));
|
||||
}
|
||||
|
||||
/** 获取明细表默认行高偏好 */
|
||||
export function getMixingTableHeightDefault(tableKey: MixingDetailTableKey): MixingTableHeightPreference {
|
||||
const meta = MIXING_TABLE_HEIGHT_SETTING_META[tableKey];
|
||||
return {
|
||||
rowHeight: meta.defaultRowHeight,
|
||||
visibleRowCount: meta.defaultVisibleRowCount,
|
||||
};
|
||||
}
|
||||
|
||||
/** 规范化明细表行高偏好 */
|
||||
export function normalizeMixingTableHeightPreference(
|
||||
tableKey: MixingDetailTableKey,
|
||||
preference?: Partial<MixingTableHeightPreference> | null,
|
||||
): MixingTableHeightPreference {
|
||||
const meta = MIXING_TABLE_HEIGHT_SETTING_META[tableKey];
|
||||
const defaults = getMixingTableHeightDefault(tableKey);
|
||||
return {
|
||||
rowHeight: clampMixingTableNumber(
|
||||
preference?.rowHeight,
|
||||
MIXING_TABLE_ROW_HEIGHT_MIN,
|
||||
MIXING_TABLE_ROW_HEIGHT_MAX,
|
||||
defaults.rowHeight,
|
||||
),
|
||||
visibleRowCount: clampMixingTableNumber(
|
||||
preference?.visibleRowCount,
|
||||
meta.minVisibleRowCount,
|
||||
meta.maxVisibleRowCount,
|
||||
defaults.visibleRowCount,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
/** 读取明细表行高偏好 */
|
||||
export function loadMixingTableHeightPreference(tableKey: MixingDetailTableKey): MixingTableHeightPreference {
|
||||
const saved = mixingMaterialColumnStorage.get(MIXING_TABLE_HEIGHT_PREF_CACHE_KEY);
|
||||
const tableSaved =
|
||||
saved && typeof saved === 'object' ? (saved as Record<string, Partial<MixingTableHeightPreference>>)[tableKey] : null;
|
||||
return normalizeMixingTableHeightPreference(tableKey, tableSaved);
|
||||
}
|
||||
|
||||
/** 保存明细表行高偏好 */
|
||||
export function saveMixingTableHeightPreference(tableKey: MixingDetailTableKey, preference: MixingTableHeightPreference) {
|
||||
const saved = mixingMaterialColumnStorage.get(MIXING_TABLE_HEIGHT_PREF_CACHE_KEY);
|
||||
const next =
|
||||
saved && typeof saved === 'object'
|
||||
? { ...(saved as Record<string, MixingTableHeightPreference>) }
|
||||
: ({} as Record<string, MixingTableHeightPreference>);
|
||||
next[tableKey] = normalizeMixingTableHeightPreference(tableKey, preference);
|
||||
mixingMaterialColumnStorage.set(MIXING_TABLE_HEIGHT_PREF_CACHE_KEY, next);
|
||||
}
|
||||
|
||||
/** 计算明细表展示区域高度 */
|
||||
export function calcMixingDetailTableViewportHeight(
|
||||
tableKey: MixingDetailTableKey,
|
||||
preference?: Partial<MixingTableHeightPreference>,
|
||||
) {
|
||||
const meta = MIXING_TABLE_HEIGHT_SETTING_META[tableKey];
|
||||
const normalized = normalizeMixingTableHeightPreference(tableKey, preference);
|
||||
return meta.headerHeight + normalized.visibleRowCount * normalized.rowHeight + meta.extraPadding;
|
||||
}
|
||||
|
||||
/** 构建 JVxeTable rowConfig */
|
||||
export function buildMixingTableRowConfig(preference: MixingTableHeightPreference) {
|
||||
return {
|
||||
isHover: true,
|
||||
height: preference.rowHeight,
|
||||
};
|
||||
}
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A32】四明细表行高/展示行数设置持久化-----------
|
||||
|
||||
function createEmptyMixingRows(count: number): Recordable[] {
|
||||
return Array.from({ length: count }, () => ({ id: buildUUID() }));
|
||||
}
|
||||
|
||||
/** 创建橡胶及配合剂默认空行 */
|
||||
export function createEmptyMaterialRows(count = DEFAULT_MIXING_MATERIAL_ROW_COUNT): Recordable[] {
|
||||
return createEmptyMixingRows(count);
|
||||
}
|
||||
|
||||
/** 创建混合步骤默认空行 */
|
||||
export function createEmptyStepRows(count = DEFAULT_MIXING_STEP_ROW_COUNT): Recordable[] {
|
||||
return createEmptyMixingRows(count);
|
||||
}
|
||||
|
||||
/** 创建下密炼机混炼条件默认空行 */
|
||||
export function createEmptyDownStepRows(count = DEFAULT_MIXING_DOWN_STEP_ROW_COUNT): Recordable[] {
|
||||
return createEmptyMixingRows(count);
|
||||
}
|
||||
|
||||
/** 确保明细行具备唯一 id(JVxeTable 依赖 rowKey=id) */
|
||||
export function normalizeMixingDetailRows(rows: Recordable[] = []): Recordable[] {
|
||||
return (rows || []).map((row) => ({ ...row, id: row?.id || buildUUID() }));
|
||||
}
|
||||
//update-end---author:cursor ---date:20260522 for:【XSLMES-20260522-A22】明细表默认空行数-----------
|
||||
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'xslmes:mes_xsl_mixing_spec:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增 </a-button>
|
||||
<a-button type="primary" v-auth="'xslmes:mes_xsl_mixing_spec:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 </a-button>
|
||||
<j-upload-button type="primary" v-auth="'xslmes:mes_xsl_mixing_spec:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">
|
||||
导入
|
||||
</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined" />
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'xslmes:mes_xsl_mixing_spec:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableActions(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslMixingSpecModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslMixingSpec" setup>
|
||||
import { reactive } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslMixingSpecModal from './components/MesXslMixingSpecModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslMixingSpec.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslMixingSpec.api';
|
||||
|
||||
const queryParam = reactive<any>({});
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '混炼示方',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 90,
|
||||
autoSubmitOnEnter: true,
|
||||
},
|
||||
actionColumn: {
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
slots: { customRender: 'action' },
|
||||
},
|
||||
beforeFetch: (params) => Object.assign(params, queryParam),
|
||||
},
|
||||
exportConfig: {
|
||||
name: '混炼示方',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
function batchHandleDelete() {
|
||||
batchDelete({ ids: selectedRowKeys.value.join(',') }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
selectedRowKeys.value = [];
|
||||
}
|
||||
|
||||
function getTableActions(record: Recordable) {
|
||||
return [
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_mixing_spec:edit' },
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
auth: 'xslmes:mes_xsl_mixing_spec:delete',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<Popover
|
||||
v-model:open="popoverOpen"
|
||||
trigger="click"
|
||||
placement="bottomRight"
|
||||
:overlayClassName="`${prefixCls}__popover`"
|
||||
@open-change="handleOpenChange"
|
||||
>
|
||||
<template #title>
|
||||
<div :class="`${prefixCls}__title`">
|
||||
<Checkbox :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange">列展示</Checkbox>
|
||||
</div>
|
||||
</template>
|
||||
<template #content>
|
||||
<div :class="`${prefixCls}__list`">
|
||||
<CheckboxGroup v-model:value="draftCheckedList" :options="columnOptions" />
|
||||
</div>
|
||||
<div :class="`${prefixCls}__footer`">
|
||||
<a-button size="small" @click="handleReset">重置</a-button>
|
||||
<a-button size="small" type="primary" @click="handleSave">保存</a-button>
|
||||
</div>
|
||||
</template>
|
||||
<a-tooltip title="列设置">
|
||||
<a-button size="small" class="mixing-material-column-setting-btn" @click.stop>
|
||||
<Icon icon="ant-design:setting-outlined" />
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</Popover>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, type PropType } from 'vue';
|
||||
import { Popover, Checkbox } from 'ant-design-vue';
|
||||
import type { CheckboxChangeEvent } from 'ant-design-vue/lib/checkbox/interface';
|
||||
import { Icon } from '/@/components/Icon';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import {
|
||||
MIXING_MATERIAL_LOCKED_COLUMN_KEYS,
|
||||
getMixingMaterialColumnSettingItems,
|
||||
saveMixingMaterialHiddenColumnKeys,
|
||||
type MixingMaterialColumnSettingItem,
|
||||
} from '../MesXslMixingSpec.data';
|
||||
|
||||
const CheckboxGroup = Checkbox.Group;
|
||||
const prefixCls = 'mixing-material-column-setting';
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const props = defineProps({
|
||||
hiddenKeys: {
|
||||
type: Array as PropType<string[]>,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:hiddenKeys', value: string[]): void;
|
||||
(e: 'change', value: string[]): void;
|
||||
}>();
|
||||
|
||||
const popoverOpen = ref(false);
|
||||
const columnItems = ref<MixingMaterialColumnSettingItem[]>(getMixingMaterialColumnSettingItems());
|
||||
const allKeys = computed(() => columnItems.value.map((item) => item.key));
|
||||
const lockableKeys = computed(() => columnItems.value.filter((item) => !item.locked).map((item) => item.key));
|
||||
const draftCheckedList = ref<string[]>([]);
|
||||
|
||||
const columnOptions = computed(() =>
|
||||
columnItems.value.map((item) => ({
|
||||
label: item.title,
|
||||
value: item.key,
|
||||
disabled: item.locked,
|
||||
})),
|
||||
);
|
||||
|
||||
const checkAll = computed(() => {
|
||||
const keys = lockableKeys.value;
|
||||
return keys.length > 0 && keys.every((key) => draftCheckedList.value.includes(key));
|
||||
});
|
||||
|
||||
const indeterminate = computed(() => {
|
||||
const keys = lockableKeys.value;
|
||||
const checkedCount = keys.filter((key) => draftCheckedList.value.includes(key)).length;
|
||||
return checkedCount > 0 && checkedCount < keys.length;
|
||||
});
|
||||
|
||||
function ensureLockedChecked() {
|
||||
const next = new Set(draftCheckedList.value);
|
||||
MIXING_MATERIAL_LOCKED_COLUMN_KEYS.forEach((key) => next.add(key));
|
||||
draftCheckedList.value = Array.from(next);
|
||||
}
|
||||
|
||||
function syncDraftFromHidden(hiddenKeys: string[]) {
|
||||
const hiddenSet = new Set(hiddenKeys || []);
|
||||
draftCheckedList.value = allKeys.value.filter((key) => !hiddenSet.has(key));
|
||||
ensureLockedChecked();
|
||||
}
|
||||
|
||||
function buildHiddenKeysFromDraft() {
|
||||
ensureLockedChecked();
|
||||
return allKeys.value.filter((key) => !draftCheckedList.value.includes(key));
|
||||
}
|
||||
|
||||
function handleOpenChange(open: boolean) {
|
||||
if (open) {
|
||||
syncDraftFromHidden(props.hiddenKeys);
|
||||
}
|
||||
}
|
||||
|
||||
function onCheckAllChange(e: CheckboxChangeEvent) {
|
||||
draftCheckedList.value = e.target.checked ? [...allKeys.value] : [...MIXING_MATERIAL_LOCKED_COLUMN_KEYS];
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
draftCheckedList.value = [...allKeys.value];
|
||||
}
|
||||
|
||||
function handleSave() {
|
||||
const hiddenKeys = buildHiddenKeysFromDraft();
|
||||
saveMixingMaterialHiddenColumnKeys(hiddenKeys);
|
||||
emit('update:hiddenKeys', hiddenKeys);
|
||||
emit('change', hiddenKeys);
|
||||
createMessage.success('保存成功');
|
||||
popoverOpen.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.mixing-material-column-setting-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-inline: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="less">
|
||||
.mixing-material-column-setting__popover {
|
||||
.mixing-material-column-setting__title {
|
||||
min-width: 180px;
|
||||
}
|
||||
|
||||
.mixing-material-column-setting__list {
|
||||
max-height: 320px;
|
||||
overflow-y: auto;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.ant-checkbox-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.ant-checkbox-group-item {
|
||||
margin-inline-start: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.mixing-material-column-setting__footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding-top: 4px;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<Popover
|
||||
v-model:open="popoverOpen"
|
||||
trigger="click"
|
||||
placement="bottomRight"
|
||||
:overlayClassName="`${prefixCls}__popover`"
|
||||
@open-change="handleOpenChange"
|
||||
>
|
||||
<template #title>
|
||||
<div :class="`${prefixCls}__title`">{{ meta.label }} - 行高设置</div>
|
||||
</template>
|
||||
<template #content>
|
||||
<div :class="`${prefixCls}__form`">
|
||||
<div :class="`${prefixCls}__field`">
|
||||
<span class="field-label">行高(px)</span>
|
||||
<InputNumber
|
||||
v-model:value="draftRowHeight"
|
||||
:min="MIXING_TABLE_ROW_HEIGHT_MIN"
|
||||
:max="MIXING_TABLE_ROW_HEIGHT_MAX"
|
||||
:step="1"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
<div :class="`${prefixCls}__field`">
|
||||
<span class="field-label">展示行数</span>
|
||||
<InputNumber
|
||||
v-model:value="draftVisibleRowCount"
|
||||
:min="meta.minVisibleRowCount"
|
||||
:max="meta.maxVisibleRowCount"
|
||||
:step="1"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
<div :class="`${prefixCls}__hint`">展示行数为列表可视区域高度,数据超出时可滚动查看。</div>
|
||||
</div>
|
||||
<div :class="`${prefixCls}__footer`">
|
||||
<a-button size="small" @click="handleReset">重置</a-button>
|
||||
<a-button size="small" type="primary" @click="handleSave">保存</a-button>
|
||||
</div>
|
||||
</template>
|
||||
<a-tooltip title="行高设置">
|
||||
<a-button size="small" :class="`${prefixCls}-btn`" @click.stop>
|
||||
<Icon icon="ant-design:column-height-outlined" />
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</Popover>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, type PropType } from 'vue';
|
||||
import { Popover, InputNumber } from 'ant-design-vue';
|
||||
import { Icon } from '/@/components/Icon';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import {
|
||||
MIXING_TABLE_HEIGHT_SETTING_META,
|
||||
MIXING_TABLE_ROW_HEIGHT_MAX,
|
||||
MIXING_TABLE_ROW_HEIGHT_MIN,
|
||||
getMixingTableHeightDefault,
|
||||
normalizeMixingTableHeightPreference,
|
||||
saveMixingTableHeightPreference,
|
||||
type MixingDetailTableKey,
|
||||
type MixingTableHeightPreference,
|
||||
} from '../MesXslMixingSpec.data';
|
||||
|
||||
const prefixCls = 'mixing-table-row-height-setting';
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const props = defineProps({
|
||||
tableKey: {
|
||||
type: String as PropType<MixingDetailTableKey>,
|
||||
required: true,
|
||||
},
|
||||
preference: {
|
||||
type: Object as PropType<MixingTableHeightPreference>,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:preference', value: MixingTableHeightPreference): void;
|
||||
(e: 'change', value: MixingTableHeightPreference): void;
|
||||
}>();
|
||||
|
||||
const popoverOpen = ref(false);
|
||||
const meta = computed(() => MIXING_TABLE_HEIGHT_SETTING_META[props.tableKey]);
|
||||
const draftRowHeight = ref(meta.value.defaultRowHeight);
|
||||
const draftVisibleRowCount = ref(meta.value.defaultVisibleRowCount);
|
||||
|
||||
function syncDraftFromPreference(preference: MixingTableHeightPreference) {
|
||||
const normalized = normalizeMixingTableHeightPreference(props.tableKey, preference);
|
||||
draftRowHeight.value = normalized.rowHeight;
|
||||
draftVisibleRowCount.value = normalized.visibleRowCount;
|
||||
}
|
||||
|
||||
function handleOpenChange(open: boolean) {
|
||||
if (open) {
|
||||
syncDraftFromPreference(props.preference);
|
||||
}
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
syncDraftFromPreference(getMixingTableHeightDefault(props.tableKey));
|
||||
}
|
||||
|
||||
function handleSave() {
|
||||
const next = normalizeMixingTableHeightPreference(props.tableKey, {
|
||||
rowHeight: draftRowHeight.value,
|
||||
visibleRowCount: draftVisibleRowCount.value,
|
||||
});
|
||||
saveMixingTableHeightPreference(props.tableKey, next);
|
||||
emit('update:preference', next);
|
||||
emit('change', next);
|
||||
createMessage.success('保存成功');
|
||||
popoverOpen.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.mixing-table-row-height-setting-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-inline: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="less">
|
||||
.mixing-table-row-height-setting__popover {
|
||||
.mixing-table-row-height-setting__title {
|
||||
min-width: 180px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.mixing-table-row-height-setting__form {
|
||||
width: 220px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.mixing-table-row-height-setting__field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
|
||||
.field-label {
|
||||
font-size: 12px;
|
||||
color: #595959;
|
||||
}
|
||||
}
|
||||
|
||||
.mixing-table-row-height-setting__hint {
|
||||
font-size: 12px;
|
||||
color: #8c8c8c;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.mixing-table-row-height-setting__footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding-top: 4px;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user