更新胶料信息处理逻辑,优化字段描述及数据验证,增强系统稳定性和用户体验。

This commit is contained in:
geht
2026-05-20 19:06:58 +08:00
parent 9f37292eea
commit a10aae420a
17 changed files with 1731 additions and 0 deletions

View File

@@ -0,0 +1,261 @@
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.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
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.system.query.QueryRuleEnum;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
import org.jeecg.modules.xslmes.service.IMesXslMixerPsCompileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
/**
* MES 密炼PS编制
*/
@Tag(name = "MES密炼PS编制")
@RestController
@RequestMapping("/xslmes/mesXslMixerPsCompile")
@Slf4j
public class MesXslMixerPsCompileController extends JeecgController<MesXslMixerPsCompile, IMesXslMixerPsCompileService> {
@Autowired
private IMesXslMixerPsCompileService mesXslMixerPsCompileService;
@Autowired
private ISysDepartService sysDepartService;
@Operation(summary = "MES密炼PS编制-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslMixerPsCompile>> queryPageList(
MesXslMixerPsCompile model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
customeRuleMap.put("psCode", QueryRuleEnum.LIKE);
customeRuleMap.put("title", QueryRuleEnum.LIKE);
QueryWrapper<MesXslMixerPsCompile> queryWrapper =
QueryGenerator.initQueryWrapper(model, req.getParameterMap(), customeRuleMap);
queryWrapper.orderByDesc("issue_date", "create_time");
Page<MesXslMixerPsCompile> page = new Page<>(pageNo, pageSize);
IPage<MesXslMixerPsCompile> pageList = mesXslMixerPsCompileService.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "MES密炼PS编制-添加")
@Operation(summary = "MES密炼PS编制-添加")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MesXslMixerPsCompile model) {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
String err = validateAndFill(model);
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
mesXslMixerPsCompileService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "MES密炼PS编制-编辑")
@Operation(summary = "MES密炼PS编制-编辑")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslMixerPsCompile model) {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
String err = validateAndFill(model);
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
MesXslMixerPsCompile existing = mesXslMixerPsCompileService.getById(model.getId());
if (existing == null) {
return Result.error("未找到对应数据");
}
if (!"compile".equals(existing.getStatus())) {
return Result.error("仅编制状态的单据允许编辑");
}
model.setStatus("compile");
model.setProofreadBy(existing.getProofreadBy());
model.setProofreadTime(existing.getProofreadTime());
model.setAuditBy(existing.getAuditBy());
model.setAuditTime(existing.getAuditTime());
model.setApproveBy(existing.getApproveBy());
model.setApproveTime(existing.getApproveTime());
mesXslMixerPsCompileService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "MES密炼PS编制-删除")
@Operation(summary = "MES密炼PS编制-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
MesXslMixerPsCompile existing = mesXslMixerPsCompileService.getById(id);
String err = assertCompileStatusForDelete(existing);
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
mesXslMixerPsCompileService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "MES密炼PS编制-批量删除")
@Operation(summary = "MES密炼PS编制-批量删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
if (oConvertUtils.isEmpty(ids)) {
return Result.error("请选择要删除的记录");
}
for (String id : ids.split(",")) {
if (oConvertUtils.isEmpty(id)) {
continue;
}
MesXslMixerPsCompile existing = mesXslMixerPsCompileService.getById(id.trim());
String err = assertCompileStatusForDelete(existing);
if (err != null) {
return Result.error(err);
}
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
mesXslMixerPsCompileService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "MES密炼PS编制-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslMixerPsCompile> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslMixerPsCompile entity = mesXslMixerPsCompileService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslMixerPsCompile model) {
return super.exportXls(request, model, MesXslMixerPsCompile.class, "密炼PS编制");
}
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, MesXslMixerPsCompile.class);
}
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】校对/审核/批准-----------
@AutoLog(value = "MES密炼PS编制-校对")
@Operation(summary = "MES密炼PS编制-校对")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:proofread")
@PostMapping(value = "/proofread")
public Result<String> proofread(@RequestParam(name = "ids") String ids) {
return doChangeStatus(ids, "compile", "proofread", "校对");
}
@AutoLog(value = "MES密炼PS编制-审核")
@Operation(summary = "MES密炼PS编制-审核")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:audit")
@PostMapping(value = "/audit")
public Result<String> audit(@RequestParam(name = "ids") String ids) {
return doChangeStatus(ids, "proofread", "audit", "审核");
}
@AutoLog(value = "MES密炼PS编制-批准")
@Operation(summary = "MES密炼PS编制-批准")
@RequiresPermissions("xslmes:mes_xsl_mixer_ps_compile:approve")
@PostMapping(value = "/approve")
public Result<String> approve(@RequestParam(name = "ids") String ids) {
return doChangeStatus(ids, "audit", "approve", "批准");
}
private Result<String> doChangeStatus(String ids, String expectedStatus, String targetStatus, String actionLabel) {
String err = mesXslMixerPsCompileService.changeStatusBatch(
ids, expectedStatus, targetStatus, actionLabel, getOperatorName());
if (err != null) {
return Result.error(err);
}
return Result.OK(actionLabel + "成功!");
}
private String getOperatorName() {
LoginUser loginUser = null;
try {
loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
} catch (Exception e) {
log.debug("获取当前登录用户失败", e);
}
if (loginUser == null) {
return null;
}
if (oConvertUtils.isNotEmpty(loginUser.getRealname())) {
return loginUser.getRealname();
}
return loginUser.getUsername();
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】校对/审核/批准-----------
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
private String validateAndFill(MesXslMixerPsCompile model) {
if (oConvertUtils.isEmpty(model.getReceiveDeptId())) {
return "请选择收信部门";
}
if (oConvertUtils.isEmpty(model.getReferenceDeptId())) {
return "请选择参照部门";
}
if (oConvertUtils.isEmpty(model.getTitle())) {
return "请输入标题";
}
if (oConvertUtils.isEmpty(model.getStatus())) {
model.setStatus("compile");
}
if (oConvertUtils.isNotEmpty(model.getFactoryId())) {
SysDepart factory = sysDepartService.getById(model.getFactoryId());
if (factory == null) {
return "所选所属工厂不存在,请重新选择";
}
model.setFactoryName(factory.getDepartName());
} else {
model.setFactoryName(null);
}
return null;
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】保存前校验与冗余回填-----------
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
private String assertCompileStatusForDelete(MesXslMixerPsCompile entity) {
if (entity == null) {
return "记录不存在或已删除";
}
String status = entity.getStatus() == null ? "" : entity.getStatus();
if (!"compile".equals(status)) {
String psCode = oConvertUtils.isEmpty(entity.getPsCode()) ? entity.getId() : entity.getPsCode();
return "PS编码[" + psCode + "]当前状态不允许删除,仅编制状态可删除";
}
return null;
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】仅编制状态允许删除-----------
}

View File

@@ -0,0 +1,152 @@
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.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* MES 密炼PS编制
*/
@Data
@TableName("mes_xsl_mixer_ps_compile")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES密炼PS编制")
public class MesXslMixerPsCompile implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "所属工厂", width = 20)
@Schema(description = "所属工厂名称冗余(公司)")
private String factoryName;
@Schema(description = "所属工厂IDsys_depart.id公司")
private String factoryId;
@Excel(name = "PS编码", width = 18)
@Schema(description = "PS编码")
private String psCode;
@Excel(name = "类型", width = 15, dicCode = "xslmes_ps_belong")
@Dict(dicCode = "xslmes_ps_belong")
@Schema(description = "类型字典PS归属")
private String psType;
@Excel(name = "施工代号", width = 15, dicCode = "xslmes_construction_code")
@Dict(dicCode = "xslmes_construction_code")
@Schema(description = "施工代号")
private String constructionCode;
@Excel(name = "发放日期", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(description = "发放日期")
private Date issueDate;
@Excel(name = "发送部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Schema(description = "发送部门ID")
private String sendDeptId;
@Excel(name = "收信部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Schema(description = "收信部门ID")
private String receiveDeptId;
@Excel(name = "参照部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Schema(description = "参照部门ID")
private String referenceDeptId;
@Excel(name = "标题", width = 25)
@Schema(description = "标题")
private String title;
@Excel(name = "目的", width = 30)
@Schema(description = "目的")
private String purpose;
@Excel(name = "依据", width = 30)
@Schema(description = "依据")
private String basis;
@Excel(name = "内容", width = 40)
@Schema(description = "内容")
private String content;
@Excel(name = "担当", width = 12)
@Schema(description = "担当")
private String responsiblePerson;
@Excel(name = "状态", width = 10, dicCode = "xslmes_mixer_ps_status")
@Dict(dicCode = "xslmes_mixer_ps_status")
@Schema(description = "状态")
private String status;
@Excel(name = "校对人", width = 15)
@Schema(description = "校对人")
private String proofreadBy;
@Excel(name = "校对时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "校对时间")
private Date proofreadTime;
@Excel(name = "审核人", width = 15)
@Schema(description = "审核人")
private String auditBy;
@Excel(name = "审核时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "审核时间")
private Date auditTime;
@Excel(name = "批准人", width = 15)
@Schema(description = "批准人")
private String approveBy;
@Excel(name = "批准时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "批准时间")
private Date approveTime;
@Excel(name = "创建人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】创建人翻译为姓名供编制人展示-----------
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】创建人翻译为姓名供编制人展示-----------
private String createBy;
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@Excel(name = "修改人", width = 15)
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;
@Schema(description = "租户ID")
private Integer tenantId;
private String sysOrgCode;
private Integer delFlag;
}

View File

@@ -0,0 +1,12 @@
package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
/**
* MES 密炼PS编制 Mapper
*/
@Mapper
public interface MesXslMixerPsCompileMapper extends BaseMapper<MesXslMixerPsCompile> {
}

View File

@@ -0,0 +1,19 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
/**
* MES 密炼PS编制
*/
public interface IMesXslMixerPsCompileService extends IService<MesXslMixerPsCompile> {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】批量流转状态-----------
/**
* 批量变更状态(校验当前状态后更新,并记录操作人/时间)
*
* @return 失败原因null 表示成功
*/
String changeStatusBatch(String ids, String expectedStatus, String targetStatus, String actionLabel, String operatorName);
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】批量流转状态-----------
}

View File

@@ -0,0 +1,64 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
import org.jeecg.modules.xslmes.mapper.MesXslMixerPsCompileMapper;
import org.jeecg.modules.xslmes.service.IMesXslMixerPsCompileService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* MES 密炼PS编制
*/
@Service
public class MesXslMixerPsCompileServiceImpl extends ServiceImpl<MesXslMixerPsCompileMapper, MesXslMixerPsCompile>
implements IMesXslMixerPsCompileService {
//update-begin---author:jiangxh ---date:20260520 for【密炼PS编制】批量流转状态-----------
@Override
@Transactional(rollbackFor = Exception.class)
public String changeStatusBatch(String ids, String expectedStatus, String targetStatus, String actionLabel,
String operatorName) {
if (oConvertUtils.isEmpty(ids)) {
return "请选择要" + actionLabel + "的记录";
}
List<String> idList = Arrays.asList(ids.split(","));
Date now = new Date();
for (String id : idList) {
if (oConvertUtils.isEmpty(id)) {
continue;
}
MesXslMixerPsCompile entity = getById(id.trim());
if (entity == null) {
return "记录不存在或已删除";
}
String current = entity.getStatus() == null ? "" : entity.getStatus();
if (!expectedStatus.equals(current)) {
String psCode = oConvertUtils.isEmpty(entity.getPsCode()) ? id : entity.getPsCode();
return "PS编码[" + psCode + "]当前状态不允许" + actionLabel + ",请先完成上一环节";
}
entity.setStatus(targetStatus);
fillWorkflowInfo(entity, targetStatus, operatorName, now);
updateById(entity);
}
return null;
}
private void fillWorkflowInfo(MesXslMixerPsCompile entity, String targetStatus, String operatorName, Date now) {
if ("proofread".equals(targetStatus)) {
entity.setProofreadBy(operatorName);
entity.setProofreadTime(now);
} else if ("audit".equals(targetStatus)) {
entity.setAuditBy(operatorName);
entity.setAuditTime(now);
} else if ("approve".equals(targetStatus)) {
entity.setApproveBy(operatorName);
entity.setApproveTime(now);
}
}
//update-end---author:jiangxh ---date:20260520 for【密炼PS编制】批量流转状态-----------
}

View File

@@ -0,0 +1,47 @@
-- MES 字典PS归属施工代号租户 1002
SET NAMES utf8mb4;
INSERT IGNORE INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
VALUES ('1995000000000000001', 'PS归属', 'xslmes_ps_belong', 'MES PS归属', 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 ('1995000000000000101', '1995000000000000001', '密炼示方', 'ml_formula', 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 ('1995000000000000102', '1995000000000000001', '原材料检验标准', 'raw_inspect_std', 2, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000103', '1995000000000000001', '密炼作业指导书', 'ml_work_instruction', 3, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
VALUES ('1995000000000000002', '施工代号', 'xslmes_construction_code', 'MES 施工代号', 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 ('1995000000000000201', '1995000000000000002', '实验施工', 'exp_construction', 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 ('1995000000000000202', '1995000000000000002', '量试施工', 'trial_construction', 2, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000203', '1995000000000000002', '正规施工', 'formal_construction', 3, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000204', '1995000000000000002', '混配合', 'mixing_compound', 4, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000205', '1995000000000000002', '药品计量', 'chemical_dosing', 5, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000206', '1995000000000000002', '硫化施工', 'vulcanization_construction', 6, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000207', '1995000000000000002', '原材料检测标准', 'raw_test_std', 7, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000208', '1995000000000000002', '硫化作业指导书', 'vulcanization_work_instruction', 8, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000209', '1995000000000000002', '密炼作业指导书', 'ml_work_instruction', 9, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000210', '1995000000000000002', '半制品作业指导书', 'semi_product_work_instruction', 10, 1, 'admin', NOW());

View File

@@ -0,0 +1,96 @@
-- 密炼PS编制状态字典 + 建表 + 菜单 MES技术管理+ admin 授权
SET NAMES utf8mb4;
INSERT IGNORE INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
VALUES ('1995000000000000003', '密炼PS状态', 'xslmes_mixer_ps_status', 'MES密炼PS编制状态', 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 ('1995000000000000301', '1995000000000000003', '编制', 'compile', 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 ('1995000000000000302', '1995000000000000003', '校对', 'proofread', 2, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000303', '1995000000000000003', '审核', 'audit', 3, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000304', '1995000000000000003', '批准', 'approve', 4, 1, 'admin', NOW());
CREATE TABLE IF NOT EXISTS `mes_xsl_mixer_ps_compile` (
`id` varchar(32) NOT NULL COMMENT '主键',
`factory_id` varchar(32) DEFAULT NULL COMMENT '所属工厂IDsys_depart.id公司',
`factory_name` varchar(200) DEFAULT NULL COMMENT '所属工厂名称冗余',
`ps_code` varchar(100) DEFAULT NULL COMMENT 'PS编码',
`ps_type` varchar(64) DEFAULT NULL COMMENT '类型字典xslmes_ps_belong',
`construction_code` varchar(64) DEFAULT NULL COMMENT '施工代号字典xslmes_construction_code',
`issue_date` date DEFAULT NULL COMMENT '发放日期',
`send_dept_id` varchar(32) DEFAULT NULL COMMENT '发送部门ID',
`receive_dept_id` varchar(32) DEFAULT NULL COMMENT '收信部门ID',
`reference_dept_id` varchar(32) DEFAULT NULL COMMENT '参照部门ID',
`title` varchar(500) DEFAULT NULL COMMENT '标题',
`purpose` text COMMENT '目的',
`basis` text COMMENT '依据',
`content` text COMMENT '内容',
`responsible_person` varchar(100) DEFAULT NULL COMMENT '担当',
`status` varchar(32) DEFAULT 'compile' COMMENT '状态字典xslmes_mixer_ps_status',
`tenant_id` int DEFAULT NULL COMMENT '租户ID',
`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 '逻辑删除0正常 1已删除',
PRIMARY KEY (`id`),
KEY `idx_mxmps_ps_code` (`ps_code`),
KEY `idx_mxmps_issue_date` (`issue_date`),
KEY `idx_mxmps_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES密炼PS编制';
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 (
'177925970995518', '1900000000000000810', '密炼PS编制', '/xslmes/mesXslMixerPsCompile',
'xslmes/mesXslMixerPsCompile/MesXslMixerPsCompileList', 1, 'MesXslMixerPsCompileList', NULL,
1, NULL, '0', 3.00, 0, 'ant-design:file-text-outlined', 0, 1,
0, 0, 'MES密炼PS编制', '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 ('177925970995519', '177925970995518', '新增', 2, 'xslmes:mes_xsl_mixer_ps_compile: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 ('177925970995520', '177925970995518', '编辑', 2, 'xslmes:mes_xsl_mixer_ps_compile: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 ('177925970995521', '177925970995518', '删除', 2, 'xslmes:mes_xsl_mixer_ps_compile: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 ('177925970995522', '177925970995518', '批量删除', 2, 'xslmes:mes_xsl_mixer_ps_compile: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 ('177925970995523', '177925970995518', '导出', 2, 'xslmes:mes_xsl_mixer_ps_compile: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 ('177925970995524', '177925970995518', '导入', 2, 'xslmes:mes_xsl_mixer_ps_compile: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 (
'177925970995518', '177925970995519', '177925970995520',
'177925970995521', '177925970995522', '177925970995523', '177925970995524'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.id AND rp.`permission_id` = p.id
);

View File

@@ -0,0 +1,36 @@
-- 密炼PS编制状态字典调整为 编制校对审核批准并增加按钮权限
SET NAMES utf8mb4;
UPDATE `sys_dict_item`
SET `item_text` = '校对', `item_value` = 'proofread', `sort_order` = 2, `update_by` = 'admin', `update_time` = NOW()
WHERE `dict_id` = '1995000000000000003' AND (`item_value` = 'submitted' OR `id` = '1995000000000000302');
UPDATE `sys_dict_item`
SET `item_text` = '审核', `item_value` = 'audit', `sort_order` = 3, `update_by` = 'admin', `update_time` = NOW()
WHERE `dict_id` = '1995000000000000003' AND (`item_value` = 'approved' OR `id` = '1995000000000000303');
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000304', '1995000000000000003', '批准', 'approve', 4, 1, 'admin', NOW());
UPDATE `mes_xsl_mixer_ps_compile` SET `status` = 'proofread' WHERE `status` = 'submitted';
UPDATE `mes_xsl_mixer_ps_compile` SET `status` = 'audit' WHERE `status` = 'approved';
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 ('177925970995525', '177925970995518', '校对', 2, 'xslmes:mes_xsl_mixer_ps_compile:proofread', '1', 7.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 ('177925970995526', '177925970995518', '审核', 2, 'xslmes:mes_xsl_mixer_ps_compile:audit', '1', 8.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 ('177925970995527', '177925970995518', '批准', 2, 'xslmes:mes_xsl_mixer_ps_compile:approve', '1', 9.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 ('177925970995525', '177925970995526', '177925970995527')
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.id AND rp.`permission_id` = p.id
);

View File

@@ -0,0 +1,52 @@
-- 密炼PS编制校对/审核/批准人时间字段收信/参照部门支持多选逗号分隔存储
SET NAMES utf8mb4;
SET @db = DATABASE();
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'proofread_by') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `proofread_by` varchar(50) DEFAULT NULL COMMENT ''校对人'' AFTER `status`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'proofread_time') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `proofread_time` datetime DEFAULT NULL COMMENT ''校对时间'' AFTER `proofread_by`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'audit_by') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `audit_by` varchar(50) DEFAULT NULL COMMENT ''审核人'' AFTER `proofread_time`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'audit_time') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `audit_time` datetime DEFAULT NULL COMMENT ''审核时间'' AFTER `audit_by`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'approve_by') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `approve_by` varchar(50) DEFAULT NULL COMMENT ''批准人'' AFTER `audit_time`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_xsl_mixer_ps_compile' AND COLUMN_NAME = 'approve_time') = 0,
'ALTER TABLE `mes_xsl_mixer_ps_compile` ADD COLUMN `approve_time` datetime DEFAULT NULL COMMENT ''批准时间'' AFTER `approve_by`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
ALTER TABLE `mes_xsl_mixer_ps_compile`
MODIFY COLUMN `receive_dept_id` varchar(500) DEFAULT NULL COMMENT '收信部门ID多个逗号分隔';
ALTER TABLE `mes_xsl_mixer_ps_compile`
MODIFY COLUMN `reference_dept_id` varchar(500) DEFAULT NULL COMMENT '参照部门ID多个逗号分隔';

View File

@@ -0,0 +1,44 @@
-- PS审批历史状态展示字典键值与原状态一致批准改为正式发布+ 菜单
SET NAMES utf8mb4;
INSERT IGNORE INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
VALUES ('1995000000000000004', '密炼PS审批历史状态', 'xslmes_mixer_ps_history_status', 'PS审批历史状态展示approve显示为正式发布', 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 ('1995000000000000401', '1995000000000000004', '编制', 'compile', 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 ('1995000000000000402', '1995000000000000004', '校对', 'proofread', 2, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000403', '1995000000000000004', '审核', 'audit', 3, 1, 'admin', NOW());
INSERT IGNORE INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
VALUES ('1995000000000000404', '1995000000000000004', '正式发布', 'approve', 4, 1, 'admin', NOW());
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 (
'177925970995528', '1900000000000000810', 'PS审批历史', '/xslmes/mesXslMixerPsHistory',
'xslmes/mesXslMixerPsHistory/MesXslMixerPsHistoryList', 1, 'MesXslMixerPsHistoryList', NULL,
1, NULL, '0', 4.00, 0, 'ant-design:history-outlined', 0, 1,
0, 0, '查询密炼PS编制已批准记录', '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 ('177925970995529', '177925970995528', '导出', 2, 'xslmes:mes_xsl_mixer_ps_history:exportXls', '1', 1.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 ('177925970995528', '177925970995529')
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.id AND rp.`permission_id` = p.id
);

View File

@@ -0,0 +1,39 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslMixerPsCompile/list',
save = '/xslmes/mesXslMixerPsCompile/add',
edit = '/xslmes/mesXslMixerPsCompile/edit',
deleteOne = '/xslmes/mesXslMixerPsCompile/delete',
deleteBatch = '/xslmes/mesXslMixerPsCompile/deleteBatch',
importExcel = '/xslmes/mesXslMixerPsCompile/importExcel',
exportXls = '/xslmes/mesXslMixerPsCompile/exportXls',
queryById = '/xslmes/mesXslMixerPsCompile/queryById',
proofread = '/xslmes/mesXslMixerPsCompile/proofread',
audit = '/xslmes/mesXslMixerPsCompile/audit',
approve = '/xslmes/mesXslMixerPsCompile/approve',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const deleteOne = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const batchDelete = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const saveOrUpdate = (params, isUpdate) => {
const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url, params }, { successMessageMode: 'none' });
};
export const getExportUrl = Api.exportXls;
export const getImportUrl = Api.importExcel;
export const proofread = (params: { ids: string }) => defHttp.post({ url: Api.proofread, params }, { joinParamsToUrl: true });
export const audit = (params: { ids: string }) => defHttp.post({ url: Api.audit, params }, { joinParamsToUrl: true });
export const approve = (params: { ids: string }) => defHttp.post({ url: Api.approve, params }, { joinParamsToUrl: true });

View File

@@ -0,0 +1,286 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
const colHalf = { span: 12 };
const deptSelectBase = {
sync: false,
checkStrictly: true,
defaultExpandLevel: 2,
};
const deptSelectSingleProps = {
...deptSelectBase,
multiple: false,
};
const deptSelectProps = {
...deptSelectBase,
multiple: true,
};
const hasWorkflowInfo = ({ values }) =>
!!(values.proofreadBy || values.proofreadTime || values.auditBy || values.auditTime || values.approveBy || values.approveTime);
function sectionDivider(label: string, field: string, ifShow?: FormSchema['ifShow']): FormSchema {
return {
field,
label,
component: 'Divider',
componentProps: { orientation: 'left', plain: false },
colProps: { span: 24 },
ifShow,
};
}
export const columns: BasicColumn[] = [
{ title: 'PS编码', align: 'center', dataIndex: 'psCode', width: 140 },
{ title: '类型', align: 'center', dataIndex: 'psType_dictText', width: 110 },
{ title: '发放日期', align: 'center', dataIndex: 'issueDate', width: 110 },
{ title: '发送部门', align: 'center', dataIndex: 'sendDeptId_dictText', width: 120 },
{ title: '收信部门', align: 'center', dataIndex: 'receiveDeptId_dictText', width: 160 },
{ title: '参照部门', align: 'center', dataIndex: 'referenceDeptId_dictText', width: 160 },
{ title: '标题', align: 'center', dataIndex: 'title', width: 180 },
{ title: '目的', align: 'center', dataIndex: 'purpose', width: 160, defaultHidden: true },
{ title: '依据', align: 'center', dataIndex: 'basis', width: 160, defaultHidden: true },
{ title: '担当', align: 'center', dataIndex: 'responsiblePerson', width: 90 },
{ title: '状态', align: 'center', dataIndex: 'status_dictText', width: 90 },
{
title: '编制人',
align: 'center',
dataIndex: 'compileBy',
width: 100,
customRender: ({ record }) => record?.createBy_dictText || record?.createBy || '',
},
{ title: '校对人', align: 'center', dataIndex: 'proofreadBy', width: 100, defaultHidden: true },
{ title: '校对时间', align: 'center', dataIndex: 'proofreadTime', width: 165, defaultHidden: true },
{ title: '审核人', align: 'center', dataIndex: 'auditBy', width: 100, defaultHidden: true },
{ title: '审核时间', align: 'center', dataIndex: 'auditTime', width: 165, defaultHidden: true },
{ title: '批准人', align: 'center', dataIndex: 'approveBy', width: 100, defaultHidden: true },
{ title: '批准时间', align: 'center', dataIndex: 'approveTime', width: 165, defaultHidden: true },
{ title: '所属工厂', align: 'center', dataIndex: 'factoryName', width: 120, defaultHidden: true },
{ title: '施工代号', align: 'center', dataIndex: 'constructionCode_dictText', width: 110, defaultHidden: true },
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100, defaultHidden: true },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 },
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100, defaultHidden: true },
{ title: '修改时间', align: 'center', dataIndex: 'updateTime', width: 165, defaultHidden: true },
];
export const searchFormSchema: FormSchema[] = [
{ label: 'PS编码', field: 'psCode', component: 'JInput', colProps: { span: 6 } },
{ label: '标题', field: 'title', component: 'JInput', colProps: { span: 6 } },
{
label: '状态',
field: 'status',
component: 'JDictSelectTag',
defaultValue: 'compile',
componentProps: { dictCode: 'xslmes_mixer_ps_status', placeholder: '请选择状态' },
colProps: { span: 6 },
},
{
label: '开始日期',
field: 'issueDate_begin',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '发放日期起' },
colProps: { span: 6 },
},
{
label: '结束日期',
field: 'issueDate_end',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '发放日期止' },
colProps: { span: 6 },
},
{
label: '类型',
field: 'psType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_ps_belong' },
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
sectionDivider('基本信息', 'dividerBasic'),
{
label: 'PS编码',
field: 'psCode',
component: 'Input',
colProps: colHalf,
componentProps: { placeholder: '请输入PS编码', allowClear: true },
},
{
label: 'PS归属',
field: 'psType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_ps_belong', placeholder: '请选择PS归属' },
colProps: colHalf,
},
{
label: '施工代号',
field: 'constructionCode',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_construction_code', placeholder: '请选择施工代号' },
colProps: colHalf,
},
{
label: '发放日期',
field: 'issueDate',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' }, placeholder: '请选择发放日期' },
colProps: colHalf,
},
{
label: '状态',
field: 'status',
component: 'JDictSelectTag',
defaultValue: 'compile',
componentProps: { dictCode: 'xslmes_mixer_ps_status', disabled: true },
colProps: colHalf,
},
{
label: '编制人',
field: 'compileBy',
component: 'Input',
componentProps: { disabled: true, bordered: false, placeholder: '保存后按创建人显示' },
colProps: colHalf,
itemProps: { class: 'ps-workflow-item' },
},
{
label: '担当',
field: 'responsiblePerson',
component: 'Input',
colProps: colHalf,
componentProps: { placeholder: '请输入担当', allowClear: true },
},
{
label: '标题',
field: 'title',
component: 'Input',
colProps: { span: 24 },
componentProps: { placeholder: '请输入标题', allowClear: true },
dynamicRules: () => [{ required: true, message: '请输入标题' }],
},
sectionDivider('组织与部门', 'dividerDept'),
{
label: '所属工厂',
field: 'factoryId',
component: 'JSelectDept',
componentProps: deptSelectSingleProps,
colProps: colHalf,
},
{
label: '发送部门',
field: 'sendDeptId',
component: 'JSelectDept',
componentProps: deptSelectSingleProps,
colProps: colHalf,
},
{
label: '收信部门',
field: 'receiveDeptId',
component: 'JSelectDept',
componentProps: deptSelectProps,
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择收信部门' }],
},
{
label: '参照部门',
field: 'referenceDeptId',
component: 'JSelectDept',
componentProps: deptSelectProps,
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择参照部门' }],
},
sectionDivider('文档内容', 'dividerContent'),
{
label: '目的',
field: 'purpose',
component: 'InputTextArea',
componentProps: { rows: 3, placeholder: '请输入目的', maxlength: 500, showCount: true },
colProps: colHalf,
},
{
label: '依据',
field: 'basis',
component: 'InputTextArea',
componentProps: { rows: 3, placeholder: '请输入依据', maxlength: 500, showCount: true },
colProps: colHalf,
},
{
label: '内容',
field: 'content',
component: 'InputTextArea',
componentProps: { rows: 5, placeholder: '请输入内容', maxlength: 2000, showCount: true },
colProps: { span: 24 },
},
sectionDivider('审批记录', 'dividerWorkflow', hasWorkflowInfo),
{
label: '校对人',
field: 'proofreadBy',
component: 'Input',
componentProps: { disabled: true, bordered: false },
colProps: colHalf,
itemProps: { class: 'ps-workflow-item' },
ifShow: ({ values }) => !!values.proofreadBy,
},
{
label: '校对时间',
field: 'proofreadTime',
component: 'Input',
componentProps: { disabled: true, bordered: false },
colProps: colHalf,
itemProps: { class: 'ps-workflow-item' },
ifShow: ({ values }) => !!values.proofreadTime,
},
{
label: '审核人',
field: 'auditBy',
component: 'Input',
componentProps: { disabled: true, bordered: false },
colProps: colHalf,
itemProps: { class: 'ps-workflow-item' },
ifShow: ({ values }) => !!values.auditBy,
},
{
label: '审核时间',
field: 'auditTime',
component: 'Input',
componentProps: { disabled: true, bordered: false },
colProps: colHalf,
itemProps: { class: 'ps-workflow-item' },
ifShow: ({ values }) => !!values.auditTime,
},
{
label: '批准人',
field: 'approveBy',
component: 'Input',
componentProps: { disabled: true, bordered: false },
colProps: colHalf,
itemProps: { class: 'ps-workflow-item' },
ifShow: ({ values }) => !!values.approveBy,
},
{
label: '批准时间',
field: 'approveTime',
component: 'Input',
componentProps: { disabled: true, bordered: false },
colProps: colHalf,
itemProps: { class: 'ps-workflow-item' },
ifShow: ({ values }) => !!values.approveTime,
},
];
export const superQuerySchema = {
psCode: { title: 'PS编码', order: 0, view: 'text' },
psType: { title: '类型', order: 1, view: 'list', dictCode: 'xslmes_ps_belong' },
constructionCode: { title: '施工代号', order: 2, view: 'list', dictCode: 'xslmes_construction_code' },
issueDate: { title: '发放日期', order: 3, view: 'date' },
title: { title: '标题', order: 4, view: 'text' },
status: { title: '状态', order: 5, view: 'list', dictCode: 'xslmes_mixer_ps_status' },
responsiblePerson: { title: '担当', order: 6, view: 'text' },
};

View File

@@ -0,0 +1,242 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_mixer_ps_compile:add'"
@click="handleAdd"
preIcon="ant-design:plus-outlined"
>
新增
</a-button>
<a-button
v-auth="'xslmes:mes_xsl_mixer_ps_compile:proofread'"
:disabled="selectedRowKeys.length === 0"
preIcon="ant-design:check-circle-outlined"
@click="handleProofread"
>
校对
</a-button>
<a-button
v-auth="'xslmes:mes_xsl_mixer_ps_compile:audit'"
:disabled="selectedRowKeys.length === 0"
preIcon="ant-design:audit-outlined"
@click="handleAudit"
>
审核
</a-button>
<a-button
v-auth="'xslmes:mes_xsl_mixer_ps_compile:approve'"
:disabled="selectedRowKeys.length === 0"
preIcon="ant-design:safety-certificate-outlined"
@click="handleApprove"
>
批准
</a-button>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_mixer_ps_compile:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<j-upload-button
type="primary"
v-auth="'xslmes:mes_xsl_mixer_ps_compile:importExcel'"
preIcon="ant-design:import-outlined"
@click="onImportXls"
>
导入
</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0 && hasCompileSelection">
<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_mixer_ps_compile:deleteBatch'">
批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'xslmes:mes_xsl_mixer_ps_compile:edit',
ifShow: isCompileStatus(record),
},
]"
:dropDownActions="getDropDownAction(record)"
/>
</template>
</BasicTable>
<MesXslMixerPsCompileModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslMixerPsCompile" setup>
import { computed, reactive } from 'vue';
import { Modal } from 'ant-design-vue';
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import { useMessage } from '/@/hooks/web/useMessage';
import Icon from '/@/components/Icon';
import MesXslMixerPsCompileModal from './components/MesXslMixerPsCompileModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './MesXslMixerPsCompile.data';
import {
list,
deleteOne,
batchDelete,
getExportUrl,
getImportUrl,
proofread,
audit,
approve,
} from './MesXslMixerPsCompile.api';
const { createMessage } = useMessage();
const queryParam = reactive<any>({});
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '密炼PS编制',
api: list,
columns,
canResize: true,
tableSetting: { cacheKey: 'mesXslMixerPsCompile_v20260520' },
formConfig: {
schemas: searchFormSchema,
labelWidth: 90,
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
actionColumn: {
title: '操作',
dataIndex: 'action',
width: 160,
fixed: 'right',
slots: { customRender: 'action' },
},
beforeFetch: (params) => Object.assign(params, queryParam),
},
exportConfig: {
name: '密炼PS编制',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys, selectedRows }] = tableContext;
const superQueryConfig = reactive(superQuerySchema);
const isCompileStatus = (record?: Recordable) => !record?.status || record.status === 'compile';
const hasCompileSelection = computed(
() => selectedRows.value.length > 0 && selectedRows.value.every((row) => isCompileStatus(row)),
);
function handleSuperQuery(params) {
Object.keys(params).forEach((k) => {
queryParam[k] = params[k];
});
reload();
}
function handleAdd() {
openModal(true, { isUpdate: false, showFooter: true });
}
function handleEdit(record: Recordable) {
if (record.status && record.status !== 'compile') {
createMessage.warning('仅编制状态的单据允许编辑');
return;
}
openModal(true, { record, isUpdate: true, showFooter: true });
}
function handleStatusAction(action: 'proofread' | 'audit' | 'approve', label: string) {
if (selectedRowKeys.value.length === 0) {
createMessage.warning('请先选择要' + label + '的记录');
return;
}
Modal.confirm({
title: '确认' + label,
content: `确定对选中的 ${selectedRowKeys.value.length} 条记录执行${label}吗?`,
okText: '确认',
cancelText: '取消',
onOk: async () => {
const ids = selectedRowKeys.value.join(',');
const fn = action === 'proofread' ? proofread : action === 'audit' ? audit : approve;
await fn({ ids });
createMessage.success(label + '成功');
handleSuccess();
},
});
}
function handleProofread() {
handleStatusAction('proofread', '校对');
}
function handleAudit() {
handleStatusAction('audit', '审核');
}
function handleApprove() {
handleStatusAction('approve', '批准');
}
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
function handleDelete(record: Recordable) {
if (!isCompileStatus(record)) {
createMessage.warning('仅编制状态的单据允许删除');
return;
}
deleteOne({ id: record.id }, handleSuccess);
}
function batchHandleDelete() {
if (!hasCompileSelection.value) {
createMessage.warning('仅编制状态的单据允许删除,请取消已流转记录的勾选');
return;
}
batchDelete({ ids: selectedRowKeys.value.join(',') }, handleSuccess);
}
function handleSuccess() {
reload();
selectedRowKeys.value = [];
}
function getDropDownAction(record: Recordable) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'xslmes:mes_xsl_mixer_ps_compile:delete',
ifShow: isCompileStatus(record),
},
];
}
</script>

View File

@@ -0,0 +1,195 @@
<template>
<BasicModal
v-bind="$attrs"
@register="registerModal"
destroyOnClose
:title="title"
:width="1000"
wrapClassName="ps-compile-modal-wrap"
@ok="handleSubmit"
>
<div class="ps-compile-modal-body">
<BasicForm @register="registerForm" />
</div>
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { useMessage } from '/@/hooks/web/useMessage';
import { useUserStore } from '/@/store/modules/user';
import { formSchema } from '../MesXslMixerPsCompile.data';
import { saveOrUpdate } from '../MesXslMixerPsCompile.api';
const { createMessage } = useMessage();
const userStore = useUserStore();
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
const modalTitleOverride = ref('');
const statusDictCode = ref('xslmes_mixer_ps_status');
const [registerForm, { setProps, resetFields, setFieldsValue, validate, scrollToField, updateSchema }] = useForm({
labelWidth: 96,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 },
rowProps: { gutter: 16 },
compact: true,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: !!data?.showFooter, showOkBtn: !!data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
modalTitleOverride.value = data?.modalTitle || '';
statusDictCode.value = data?.statusDictCode || 'xslmes_mixer_ps_status';
await updateSchema([
{
field: 'status',
componentProps: { dictCode: statusDictCode.value, disabled: true },
},
]);
if (unref(isUpdate)) {
await setFieldsValue(normalizeRecord(data.record));
} else {
await setFieldsValue({ compileBy: resolveCompileBy() });
}
setProps({ disabled: !data?.showFooter });
});
const title = computed(() => {
if (modalTitleOverride.value) {
return modalTitleOverride.value;
}
return !unref(isUpdate) ? '新增PS' : unref(isDetail) ? 'PS详情' : '编辑PS';
});
function parseDeptIds(value: unknown): string[] {
if (Array.isArray(value)) {
return value.filter((v) => v != null && String(v).trim() !== '').map(String);
}
if (value == null || value === '') {
return [];
}
return String(value)
.split(',')
.map((v) => v.trim())
.filter(Boolean);
}
function joinDeptIds(value: unknown): string {
const arr = parseDeptIds(value);
return arr.length ? arr.join(',') : '';
}
function resolveCompileBy(record?: Recordable) {
if (record?.createBy_dictText || record?.createBy) {
return record.createBy_dictText || record.createBy || '';
}
const user = userStore.getUserInfo;
return user?.realname || user?.username || '';
}
function normalizeRecord(record?: Recordable) {
if (!record) {
return record;
}
return {
...record,
compileBy: resolveCompileBy(record),
receiveDeptId: parseDeptIds(record.receiveDeptId),
referenceDeptId: parseDeptIds(record.referenceDeptId),
};
}
async function handleSubmit() {
try {
const values = await validate();
delete values.compileBy;
values.receiveDeptId = joinDeptIds(values.receiveDeptId);
values.referenceDeptId = joinDeptIds(values.referenceDeptId);
if (!values.receiveDeptId) {
createMessage.warning('请选择收信部门');
return;
}
if (!values.referenceDeptId) {
createMessage.warning('请选择参照部门');
return;
}
setModalProps({ confirmLoading: true });
await saveOrUpdate(values, unref(isUpdate));
createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功');
closeModal();
emit('success');
} catch (e: any) {
if (e?.errorFields) {
const firstField = e.errorFields[0];
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(e);
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>
<style lang="less" scoped>
.ps-compile-modal-body {
padding: 4px 8px 0;
max-height: calc(100vh - 220px);
overflow-y: auto;
}
:deep(.ant-picker) {
width: 100%;
}
:deep(.ant-divider-horizontal.ant-divider-with-text-left) {
margin: 8px 0 12px;
font-size: 14px;
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
&::before,
&::after {
border-color: #e8e8e8;
}
}
:deep(.ant-form-item) {
margin-bottom: 14px;
}
:deep(.ps-workflow-item) {
margin-bottom: 8px;
.ant-form-item-label > label {
color: rgba(0, 0, 0, 0.45);
}
.ant-input[disabled] {
color: rgba(0, 0, 0, 0.75);
cursor: default;
padding-left: 0;
}
}
:deep(.JSelectDept .j-select-row) {
width: 100%;
}
</style>
<style lang="less">
.ps-compile-modal-wrap {
.ant-modal-body {
padding-top: 12px;
padding-bottom: 8px;
}
}
</style>

View File

@@ -0,0 +1,2 @@
/** 复用密炼PS编制接口仅查询已批准approve记录 */
export { list, getExportUrl } from '../mesXslMixerPsCompile/MesXslMixerPsCompile.api';

View File

@@ -0,0 +1,89 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
/** PS审批历史专用状态字典键值与原状态一致批准显示为正式发布 */
export const PS_HISTORY_STATUS_DICT = 'xslmes_mixer_ps_history_status';
const historyStatusTextMap: Record<string, string> = {
compile: '编制',
proofread: '校对',
audit: '审核',
approve: '正式发布',
};
export function renderHistoryStatus(text?: string) {
if (!text) {
return '';
}
return historyStatusTextMap[text] || text;
}
export const columns: BasicColumn[] = [
{ title: 'PS编码', align: 'center', dataIndex: 'psCode', width: 140 },
{ title: '类型', align: 'center', dataIndex: 'psType_dictText', width: 110 },
{ title: '发放日期', align: 'center', dataIndex: 'issueDate', width: 110 },
{ title: '发送部门', align: 'center', dataIndex: 'sendDeptId_dictText', width: 120 },
{ title: '收信部门', align: 'center', dataIndex: 'receiveDeptId_dictText', width: 160 },
{ title: '参照部门', align: 'center', dataIndex: 'referenceDeptId_dictText', width: 160 },
{ title: '标题', align: 'center', dataIndex: 'title', width: 180 },
{ title: '担当', align: 'center', dataIndex: 'responsiblePerson', width: 90 },
{
title: '状态',
align: 'center',
dataIndex: 'status',
width: 100,
customRender: ({ text }) => renderHistoryStatus(text),
},
{
title: '编制人',
align: 'center',
dataIndex: 'compileBy',
width: 100,
customRender: ({ record }) => record?.createBy_dictText || record?.createBy || '',
},
{ title: '校对人', align: 'center', dataIndex: 'proofreadBy', width: 100 },
{ title: '校对时间', align: 'center', dataIndex: 'proofreadTime', width: 165 },
{ title: '审核人', align: 'center', dataIndex: 'auditBy', width: 100 },
{ title: '审核时间', align: 'center', dataIndex: 'auditTime', width: 165 },
{ title: '发布人', align: 'center', dataIndex: 'approveBy', width: 100 },
{ title: '发布时间', align: 'center', dataIndex: 'approveTime', width: 165 },
{ title: '所属工厂', align: 'center', dataIndex: 'factoryName', width: 120, defaultHidden: true },
{ title: '施工代号', align: 'center', dataIndex: 'constructionCode_dictText', width: 110, defaultHidden: true },
{ title: '目的', align: 'center', dataIndex: 'purpose', width: 160, defaultHidden: true },
{ title: '依据', align: 'center', dataIndex: 'basis', width: 160, defaultHidden: true },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165, defaultHidden: true },
];
export const searchFormSchema: FormSchema[] = [
{
label: '开始日期',
field: 'issueDate_begin',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '发放日期起' },
colProps: { span: 6 },
},
{
label: '结束日期',
field: 'issueDate_end',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '发放日期止' },
colProps: { span: 6 },
},
{ label: 'PS编码', field: 'psCode', component: 'JInput', colProps: { span: 6 } },
{ label: '标题', field: 'title', component: 'JInput', colProps: { span: 6 } },
{
label: '类型',
field: 'psType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_ps_belong' },
colProps: { span: 6 },
},
];
export const superQuerySchema = {
psCode: { title: 'PS编码', order: 0, view: 'text' },
psType: { title: '类型', order: 1, view: 'list', dictCode: 'xslmes_ps_belong' },
constructionCode: { title: '施工代号', order: 2, view: 'list', dictCode: 'xslmes_construction_code' },
issueDate: { title: '发放日期', order: 3, view: 'date' },
title: { title: '标题', order: 4, view: 'text' },
responsiblePerson: { title: '担当', order: 5, view: 'text' },
};

View File

@@ -0,0 +1,95 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_mixer_ps_history:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
]"
/>
</template>
</BasicTable>
<MesXslMixerPsCompileModal @register="registerModal" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslMixerPsHistory" setup>
import { reactive } from 'vue';
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslMixerPsCompileModal from '../mesXslMixerPsCompile/components/MesXslMixerPsCompileModal.vue';
import { PS_HISTORY_STATUS_DICT, columns, searchFormSchema, superQuerySchema } from './MesXslMixerPsHistory.data';
import { list, getExportUrl } from './MesXslMixerPsHistory.api';
const APPROVED_STATUS = 'approve';
const queryParam = reactive<any>({ status: APPROVED_STATUS });
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: 'PS审批历史',
api: list,
columns,
canResize: true,
tableSetting: { cacheKey: 'mesXslMixerPsHistory_v20260520' },
formConfig: {
schemas: searchFormSchema,
labelWidth: 90,
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
actionColumn: {
title: '操作',
dataIndex: 'action',
width: 100,
fixed: 'right',
slots: { customRender: 'action' },
},
beforeFetch: (params) => {
params.status = APPROVED_STATUS;
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: 'PS审批历史',
url: getExportUrl,
params: queryParam,
},
});
const [registerTable, { reload }] = tableContext;
const superQueryConfig = reactive(superQuerySchema);
function handleSuperQuery(params) {
Object.keys(params).forEach((k) => {
queryParam[k] = params[k];
});
queryParam.status = APPROVED_STATUS;
reload();
}
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
modalTitle: 'PS审批历史详情',
statusDictCode: PS_HISTORY_STATUS_DICT,
});
}
</script>