班次配置页面
This commit is contained in:
parent
d6df78be93
commit
79f612b789
@ -0,0 +1,51 @@
|
|||||||
|
package com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.ibatis.type.JdbcType;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基础实体对象(不带逻辑删除)
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public abstract class BaseDOWithoutLogic implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
/**
|
||||||
|
* 最后更新时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
/**
|
||||||
|
* 创建者,目前使用 SysUser 的 id 编号
|
||||||
|
*
|
||||||
|
* 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR)
|
||||||
|
private String creator;
|
||||||
|
/**
|
||||||
|
* 更新者,目前使用 SysUser 的 id 编号
|
||||||
|
*
|
||||||
|
* 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR)
|
||||||
|
private String updater;
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
package com.ningxia.yunxi.chemmes.framework.mybatis.core.handler;
|
package com.ningxia.yunxi.chemmes.framework.mybatis.core.handler;
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDO;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDOWithoutLogic;
|
||||||
import com.ningxia.yunxi.chemmes.framework.web.core.util.WebFrameworkUtils;
|
import com.ningxia.yunxi.chemmes.framework.web.core.util.WebFrameworkUtils;
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
import org.apache.ibatis.reflection.MetaObject;
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
@ -19,10 +20,33 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertFill(MetaObject metaObject) {
|
public void insertFill(MetaObject metaObject) {
|
||||||
if (Objects.nonNull(metaObject) && metaObject.getOriginalObject() instanceof BaseDO) {
|
if (Objects.isNull(metaObject)) {
|
||||||
BaseDO baseDO = (BaseDO) metaObject.getOriginalObject();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LocalDateTime current = LocalDateTime.now();
|
LocalDateTime current = LocalDateTime.now();
|
||||||
|
Long userId = WebFrameworkUtils.getLoginUserId();
|
||||||
|
|
||||||
|
if (metaObject.getOriginalObject() instanceof BaseDO) {
|
||||||
|
BaseDO baseDO = (BaseDO) metaObject.getOriginalObject();
|
||||||
|
// 创建时间为空,则以当前时间为插入时间
|
||||||
|
if (Objects.isNull(baseDO.getCreateTime())) {
|
||||||
|
baseDO.setCreateTime(current);
|
||||||
|
}
|
||||||
|
// 更新时间为空,则以当前时间为更新时间
|
||||||
|
if (Objects.isNull(baseDO.getUpdateTime())) {
|
||||||
|
baseDO.setUpdateTime(current);
|
||||||
|
}
|
||||||
|
// 当前登录用户不为空,创建人为空,则当前登录用户为创建人
|
||||||
|
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getCreator())) {
|
||||||
|
baseDO.setCreator(userId.toString());
|
||||||
|
}
|
||||||
|
// 当前登录用户不为空,更新人为空,则当前登录用户为更新人
|
||||||
|
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getUpdater())) {
|
||||||
|
baseDO.setUpdater(userId.toString());
|
||||||
|
}
|
||||||
|
} else if (metaObject.getOriginalObject() instanceof BaseDOWithoutLogic) {
|
||||||
|
BaseDOWithoutLogic baseDO = (BaseDOWithoutLogic) metaObject.getOriginalObject();
|
||||||
// 创建时间为空,则以当前时间为插入时间
|
// 创建时间为空,则以当前时间为插入时间
|
||||||
if (Objects.isNull(baseDO.getCreateTime())) {
|
if (Objects.isNull(baseDO.getCreateTime())) {
|
||||||
baseDO.setCreateTime(current);
|
baseDO.setCreateTime(current);
|
||||||
@ -31,8 +55,6 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
|
|||||||
if (Objects.isNull(baseDO.getUpdateTime())) {
|
if (Objects.isNull(baseDO.getUpdateTime())) {
|
||||||
baseDO.setUpdateTime(current);
|
baseDO.setUpdateTime(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
Long userId = WebFrameworkUtils.getLoginUserId();
|
|
||||||
// 当前登录用户不为空,创建人为空,则当前登录用户为创建人
|
// 当前登录用户不为空,创建人为空,则当前登录用户为创建人
|
||||||
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getCreator())) {
|
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getCreator())) {
|
||||||
baseDO.setCreator(userId.toString());
|
baseDO.setCreator(userId.toString());
|
||||||
|
|||||||
@ -1,95 +1,96 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftconfig;
|
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftconfig;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.*;
|
import javax.validation.*;
|
||||||
import javax.servlet.http.*;
|
import javax.servlet.http.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
||||||
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftconfig.vo.*;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftconfig.vo.*;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftconfig.ShiftConfigDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftconfig.ShiftConfigDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.service.shiftconfig.ShiftConfigService;
|
import com.ningxia.yunxi.chemmes.module.biz.service.shiftconfig.ShiftConfigService;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 班次循环配置")
|
@Tag(name = "管理后台 - 班次循环配置")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/biz/shift-config")
|
@RequestMapping("/biz/shift-config")
|
||||||
@Validated
|
@Validated
|
||||||
public class ShiftConfigController {
|
public class ShiftConfigController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ShiftConfigService shiftConfigService;
|
private ShiftConfigService shiftConfigService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建班次循环配置")
|
@Operation(summary = "创建班次循环配置")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-config:create')")
|
@PreAuthorize("@ss.hasPermission('biz:shift-config:create')")
|
||||||
public CommonResult<Integer> createShiftConfig(@Valid @RequestBody ShiftConfigSaveReqVO createReqVO) {
|
public CommonResult<Boolean> createShiftConfig(@Valid @RequestBody ShiftConfigSaveReqVO createReqVO) {
|
||||||
return success(shiftConfigService.createShiftConfig(createReqVO));
|
shiftConfigService.createShiftConfig(createReqVO);
|
||||||
}
|
return success(true);
|
||||||
|
}
|
||||||
@PutMapping("/update")
|
|
||||||
@Operation(summary = "更新班次循环配置")
|
@PutMapping("/update")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-config:update')")
|
@Operation(summary = "更新班次循环配置")
|
||||||
public CommonResult<Boolean> updateShiftConfig(@Valid @RequestBody ShiftConfigSaveReqVO updateReqVO) {
|
@PreAuthorize("@ss.hasPermission('biz:shift-config:update')")
|
||||||
shiftConfigService.updateShiftConfig(updateReqVO);
|
public CommonResult<Boolean> updateShiftConfig(@Valid @RequestBody ShiftConfigSaveReqVO updateReqVO) {
|
||||||
return success(true);
|
shiftConfigService.updateShiftConfig(updateReqVO);
|
||||||
}
|
return success(true);
|
||||||
|
}
|
||||||
@DeleteMapping("/delete")
|
|
||||||
@Operation(summary = "删除班次循环配置")
|
@DeleteMapping("/delete")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Operation(summary = "删除班次循环配置")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-config:delete')")
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
public CommonResult<Boolean> deleteShiftConfig(@RequestParam("id") Integer id) {
|
@PreAuthorize("@ss.hasPermission('biz:shift-config:delete')")
|
||||||
shiftConfigService.deleteShiftConfig(id);
|
public CommonResult<Boolean> deleteShiftConfig(@RequestParam("chgClassType") String chgClassType) {
|
||||||
return success(true);
|
shiftConfigService.deleteShiftConfig(chgClassType);
|
||||||
}
|
return success(true);
|
||||||
|
}
|
||||||
@GetMapping("/get")
|
|
||||||
@Operation(summary = "获得班次循环配置")
|
@GetMapping("/get")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Operation(summary = "获得班次循环配置")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-config:query')")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
public CommonResult<ShiftConfigRespVO> getShiftConfig(@RequestParam("id") Integer id) {
|
@PreAuthorize("@ss.hasPermission('biz:shift-config:query')")
|
||||||
ShiftConfigDO shiftConfig = shiftConfigService.getShiftConfig(id);
|
public CommonResult<ShiftConfigRespVO> getShiftConfig(@RequestParam("id") Integer id) {
|
||||||
return success(BeanUtils.toBean(shiftConfig, ShiftConfigRespVO.class));
|
ShiftConfigDO shiftConfig = shiftConfigService.getShiftConfig(id);
|
||||||
}
|
return success(BeanUtils.toBean(shiftConfig, ShiftConfigRespVO.class));
|
||||||
|
}
|
||||||
@GetMapping("/page")
|
|
||||||
@Operation(summary = "获得班次循环配置分页")
|
@GetMapping("/page")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-config:query')")
|
@Operation(summary = "获得班次循环配置分页")
|
||||||
public CommonResult<PageResult<ShiftConfigRespVO>> getShiftConfigPage(@Valid ShiftConfigPageReqVO pageReqVO) {
|
@PreAuthorize("@ss.hasPermission('biz:shift-config:query')")
|
||||||
PageResult<ShiftConfigDO> pageResult = shiftConfigService.getShiftConfigPage(pageReqVO);
|
public CommonResult<PageResult<ShiftConfigRespVO>> getShiftConfigPage(@Valid ShiftConfigPageReqVO pageReqVO) {
|
||||||
return success(BeanUtils.toBean(pageResult, ShiftConfigRespVO.class));
|
PageResult<ShiftConfigDO> pageResult = shiftConfigService.getShiftConfigPage(pageReqVO);
|
||||||
}
|
return success(BeanUtils.toBean(pageResult, ShiftConfigRespVO.class));
|
||||||
|
}
|
||||||
@GetMapping("/export-excel")
|
|
||||||
@Operation(summary = "导出班次循环配置 Excel")
|
@GetMapping("/export-excel")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-config:export')")
|
@Operation(summary = "导出班次循环配置 Excel")
|
||||||
@OperateLog(type = EXPORT)
|
@PreAuthorize("@ss.hasPermission('biz:shift-config:export')")
|
||||||
public void exportShiftConfigExcel(@Valid ShiftConfigPageReqVO pageReqVO,
|
@OperateLog(type = EXPORT)
|
||||||
HttpServletResponse response) throws IOException {
|
public void exportShiftConfigExcel(@Valid ShiftConfigPageReqVO pageReqVO,
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
HttpServletResponse response) throws IOException {
|
||||||
List<ShiftConfigDO> list = shiftConfigService.getShiftConfigPage(pageReqVO).getList();
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
// 导出 Excel
|
List<ShiftConfigDO> list = shiftConfigService.getShiftConfigPage(pageReqVO).getList();
|
||||||
ExcelUtils.write(response, "班次循环配置.xls", "数据", ShiftConfigRespVO.class,
|
// 导出 Excel
|
||||||
BeanUtils.toBean(list, ShiftConfigRespVO.class));
|
ExcelUtils.write(response, "班次循环配置.xls", "数据", ShiftConfigRespVO.class,
|
||||||
}
|
BeanUtils.toBean(list, ShiftConfigRespVO.class));
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftconfig.vo;
|
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftconfig.vo;
|
||||||
|
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftconfig.ShiftConfigDO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 班次循环配置新增/修改 Request VO")
|
@Schema(description = "管理后台 - 班次循环配置新增/修改 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@ -32,11 +34,11 @@ public class ShiftConfigSaveReqVO {
|
|||||||
private String chgClassType;
|
private String chgClassType;
|
||||||
|
|
||||||
@Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "开始时间不能为空")
|
|
||||||
private LocalTime bgnDtime;
|
private LocalTime bgnDtime;
|
||||||
|
|
||||||
@Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "结束时间不能为空")
|
|
||||||
private LocalTime endDtime;
|
private LocalTime endDtime;
|
||||||
|
|
||||||
|
@Schema(description = "明细集合")
|
||||||
|
private List<ShiftConfigDO> shiftConfigList;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,95 +1,100 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult;
|
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.*;
|
import javax.validation.*;
|
||||||
import javax.servlet.http.*;
|
import javax.servlet.http.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
||||||
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo.*;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo.*;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftresult.ShiftResultDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftresult.ShiftResultDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.service.shiftresult.ShiftResultService;
|
import com.ningxia.yunxi.chemmes.module.biz.service.shiftresult.ShiftResultService;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 班次结果")
|
@Tag(name = "管理后台 - 班次结果")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/biz/shift-result")
|
@RequestMapping("/biz/shift-result")
|
||||||
@Validated
|
@Validated
|
||||||
public class ShiftResultController {
|
public class ShiftResultController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ShiftResultService shiftResultService;
|
private ShiftResultService shiftResultService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建班次结果")
|
@Operation(summary = "创建班次结果")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-result:create')")
|
@PreAuthorize("@ss.hasPermission('biz:shift-result:create')")
|
||||||
public CommonResult<Integer> createShiftResult(@Valid @RequestBody ShiftResultSaveReqVO createReqVO) {
|
public CommonResult<Integer> createShiftResult(@Valid @RequestBody ShiftResultSaveReqVO createReqVO) {
|
||||||
return success(shiftResultService.createShiftResult(createReqVO));
|
return success(shiftResultService.createShiftResult(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新班次结果")
|
@Operation(summary = "更新班次结果")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-result:update')")
|
@PreAuthorize("@ss.hasPermission('biz:shift-result:update')")
|
||||||
public CommonResult<Boolean> updateShiftResult(@Valid @RequestBody ShiftResultSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateShiftResult(@Valid @RequestBody ShiftResultSaveReqVO updateReqVO) {
|
||||||
shiftResultService.updateShiftResult(updateReqVO);
|
shiftResultService.updateShiftResult(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除班次结果")
|
@Operation(summary = "删除班次结果")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-result:delete')")
|
@PreAuthorize("@ss.hasPermission('biz:shift-result:delete')")
|
||||||
public CommonResult<Boolean> deleteShiftResult(@RequestParam("id") Integer id) {
|
public CommonResult<Boolean> deleteShiftResult(@RequestParam("id") Integer id) {
|
||||||
shiftResultService.deleteShiftResult(id);
|
shiftResultService.deleteShiftResult(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得班次结果")
|
@Operation(summary = "获得班次结果")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-result:query')")
|
@PreAuthorize("@ss.hasPermission('biz:shift-result:query')")
|
||||||
public CommonResult<ShiftResultRespVO> getShiftResult(@RequestParam("id") Integer id) {
|
public CommonResult<ShiftResultRespVO> getShiftResult(@RequestParam("id") Integer id) {
|
||||||
ShiftResultDO shiftResult = shiftResultService.getShiftResult(id);
|
ShiftResultDO shiftResult = shiftResultService.getShiftResult(id);
|
||||||
return success(BeanUtils.toBean(shiftResult, ShiftResultRespVO.class));
|
return success(BeanUtils.toBean(shiftResult, ShiftResultRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得班次结果分页")
|
@Operation(summary = "获得班次结果分页")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-result:query')")
|
@PreAuthorize("@ss.hasPermission('biz:shift-result:query')")
|
||||||
public CommonResult<PageResult<ShiftResultRespVO>> getShiftResultPage(@Valid ShiftResultPageReqVO pageReqVO) {
|
public CommonResult<PageResult<ShiftResultRespVO>> getShiftResultPage(@Valid ShiftResultPageReqVO pageReqVO) {
|
||||||
PageResult<ShiftResultDO> pageResult = shiftResultService.getShiftResultPage(pageReqVO);
|
PageResult<ShiftResultDO> pageResult = shiftResultService.getShiftResultPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, ShiftResultRespVO.class));
|
return success(BeanUtils.toBean(pageResult, ShiftResultRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出班次结果 Excel")
|
@Operation(summary = "导出班次结果 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:shift-result:export')")
|
@PreAuthorize("@ss.hasPermission('biz:shift-result:export')")
|
||||||
@OperateLog(type = EXPORT)
|
@OperateLog(type = EXPORT)
|
||||||
public void exportShiftResultExcel(@Valid ShiftResultPageReqVO pageReqVO,
|
public void exportShiftResultExcel(@Valid ShiftResultPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
List<ShiftResultDO> list = shiftResultService.getShiftResultPage(pageReqVO).getList();
|
List<ShiftResultDO> list = shiftResultService.getShiftResultPage(pageReqVO).getList();
|
||||||
// 导出 Excel
|
// 导出 Excel
|
||||||
ExcelUtils.write(response, "班次结果.xls", "数据", ShiftResultRespVO.class,
|
ExcelUtils.write(response, "班次结果.xls", "数据", ShiftResultRespVO.class,
|
||||||
BeanUtils.toBean(list, ShiftResultRespVO.class));
|
BeanUtils.toBean(list, ShiftResultRespVO.class));
|
||||||
}
|
}
|
||||||
|
@PostMapping("/generate")
|
||||||
}
|
@Operation(summary = "生成班次结果")
|
||||||
|
@PreAuthorize("@ss.hasPermission('biz:shift-result:query')")
|
||||||
|
public CommonResult<Boolean> generate(@Valid ShiftResultPageReqVO pageReqVO) {
|
||||||
|
return shiftResultService.generate(pageReqVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo;
|
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -9,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import static com.ningxia.yunxi.chemmes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static com.ningxia.yunxi.chemmes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
@ -20,16 +22,22 @@ public class ShiftResultPageReqVO extends PageParam {
|
|||||||
|
|
||||||
@Schema(description = "状态(1启用 2 未启用)", example = "2")
|
@Schema(description = "状态(1启用 2 未启用)", example = "2")
|
||||||
private Integer enabledStatus;
|
private Integer enabledStatus;
|
||||||
|
/** 年月 */
|
||||||
|
@JsonProperty("years")
|
||||||
|
private Object years;
|
||||||
|
|
||||||
@Schema(description = "开始时间")
|
@Schema(description = "开始时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private LocalDateTime[] bgnDtime;
|
private Date bgnDtime;
|
||||||
|
|
||||||
@Schema(description = "结束时间")
|
@Schema(description = "结束时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
private LocalDateTime[] endDtime;
|
private LocalDateTime[] endDtime;
|
||||||
|
|
||||||
@Schema(description = "排班月份")
|
@Schema(description = "排班月份")
|
||||||
private LocalDate month;
|
private LocalDate month;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "班次代码")
|
||||||
|
private String chgClassType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.KeySequence;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDO;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDOWithoutLogic;
|
||||||
import com.sun.xml.bind.v2.TODO;
|
import com.sun.xml.bind.v2.TODO;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ import java.time.LocalTime;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ShiftConfigDO extends BaseDO {
|
public class ShiftConfigDO extends BaseDOWithoutLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自增字段
|
* 自增字段
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.KeySequence;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDO;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDOWithoutLogic;
|
||||||
import com.sun.xml.bind.v2.TODO;
|
import com.sun.xml.bind.v2.TODO;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ import java.time.LocalDateTime;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ShiftResultDO extends BaseDO {
|
public class ShiftResultDO extends BaseDOWithoutLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自增字段
|
* 自增字段
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.shiftconfig;
|
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.shiftconfig;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@ -21,7 +20,11 @@ public interface ShiftConfigMapper extends BaseMapperX<ShiftConfigDO> {
|
|||||||
return selectPage(reqVO, new LambdaQueryWrapperX<ShiftConfigDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<ShiftConfigDO>()
|
||||||
.eqIfPresent(ShiftConfigDO::getEnabledStatus, reqVO.getEnabledStatus())
|
.eqIfPresent(ShiftConfigDO::getEnabledStatus, reqVO.getEnabledStatus())
|
||||||
.eqIfPresent(ShiftConfigDO::getChgClassType, reqVO.getChgClassType())
|
.eqIfPresent(ShiftConfigDO::getChgClassType, reqVO.getChgClassType())
|
||||||
.orderByDesc(ShiftConfigDO::getId));
|
.orderByAsc(ShiftConfigDO::getSeqNo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default void deleteByChgClassType(String chgClassType) {
|
||||||
|
delete(new LambdaQueryWrapperX<ShiftConfigDO>()
|
||||||
|
.eq(ShiftConfigDO::getChgClassType, chgClassType));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -2,6 +2,8 @@ package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.shiftresult;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.mapper.BaseMapperX;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
@ -18,12 +20,14 @@ import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo.*;
|
|||||||
public interface ShiftResultMapper extends BaseMapperX<ShiftResultDO> {
|
public interface ShiftResultMapper extends BaseMapperX<ShiftResultDO> {
|
||||||
|
|
||||||
default PageResult<ShiftResultDO> selectPage(ShiftResultPageReqVO reqVO) {
|
default PageResult<ShiftResultDO> selectPage(ShiftResultPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<ShiftResultDO>()
|
LambdaQueryWrapperX<ShiftResultDO> wrapper = new LambdaQueryWrapperX<>();
|
||||||
.eqIfPresent(ShiftResultDO::getEnabledStatus, reqVO.getEnabledStatus())
|
wrapper.orderByAsc(ShiftResultDO::getBgnDtime);
|
||||||
.betweenIfPresent(ShiftResultDO::getBgnDtime, reqVO.getBgnDtime())
|
|
||||||
.betweenIfPresent(ShiftResultDO::getEndDtime, reqVO.getEndDtime())
|
if (ObjectUtil.isNotEmpty(reqVO.getYears())) {
|
||||||
.eqIfPresent(ShiftResultDO::getMonth, reqVO.getMonth())
|
wrapper.likeRight(ShiftResultDO::getMonth, reqVO.getYears().toString());
|
||||||
.orderByDesc(ShiftResultDO::getId));
|
}
|
||||||
|
|
||||||
|
return selectPage(reqVO, wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,55 +1,55 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.service.shiftconfig;
|
package com.ningxia.yunxi.chemmes.module.biz.service.shiftconfig;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import javax.validation.*;
|
import javax.validation.*;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftconfig.vo.*;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftconfig.vo.*;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftconfig.ShiftConfigDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftconfig.ShiftConfigDO;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 班次循环配置 Service 接口
|
* 班次循环配置 Service 接口
|
||||||
*
|
*
|
||||||
* @author 管理员
|
* @author 管理员
|
||||||
*/
|
*/
|
||||||
public interface ShiftConfigService {
|
public interface ShiftConfigService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建班次循环配置
|
* 创建班次循环配置
|
||||||
*
|
*
|
||||||
* @param createReqVO 创建信息
|
* @param createReqVO 创建信息
|
||||||
* @return 编号
|
* @return 编号
|
||||||
*/
|
*/
|
||||||
Integer createShiftConfig(@Valid ShiftConfigSaveReqVO createReqVO);
|
void createShiftConfig(@Valid ShiftConfigSaveReqVO createReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新班次循环配置
|
* 更新班次循环配置
|
||||||
*
|
*
|
||||||
* @param updateReqVO 更新信息
|
* @param updateReqVO 更新信息
|
||||||
*/
|
*/
|
||||||
void updateShiftConfig(@Valid ShiftConfigSaveReqVO updateReqVO);
|
void updateShiftConfig(@Valid ShiftConfigSaveReqVO updateReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除班次循环配置
|
* 删除班次循环配置
|
||||||
*
|
*
|
||||||
* @param id 编号
|
* @param chgClassType 类型
|
||||||
*/
|
*/
|
||||||
void deleteShiftConfig(Integer id);
|
void deleteShiftConfig(String chgClassType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得班次循环配置
|
* 获得班次循环配置
|
||||||
*
|
*
|
||||||
* @param id 编号
|
* @param id 编号
|
||||||
* @return 班次循环配置
|
* @return 班次循环配置
|
||||||
*/
|
*/
|
||||||
ShiftConfigDO getShiftConfig(Integer id);
|
ShiftConfigDO getShiftConfig(Integer id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得班次循环配置分页
|
* 获得班次循环配置分页
|
||||||
*
|
*
|
||||||
* @param pageReqVO 分页查询
|
* @param pageReqVO 分页查询
|
||||||
* @return 班次循环配置分页
|
* @return 班次循环配置分页
|
||||||
*/
|
*/
|
||||||
PageResult<ShiftConfigDO> getShiftConfigPage(ShiftConfigPageReqVO pageReqVO);
|
PageResult<ShiftConfigDO> getShiftConfigPage(ShiftConfigPageReqVO pageReqVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.service.shiftconfig;
|
package com.ningxia.yunxi.chemmes.module.biz.service.shiftconfig;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftconfig.vo.ShiftConfigPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftconfig.vo.ShiftConfigPageReqVO;
|
||||||
@ -10,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 班次循环配置 Service 实现类
|
* 班次循环配置 Service 实现类
|
||||||
@ -24,12 +27,21 @@ public class ShiftConfigServiceImpl implements ShiftConfigService {
|
|||||||
private ShiftConfigMapper shiftConfigMapper;
|
private ShiftConfigMapper shiftConfigMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer createShiftConfig(ShiftConfigSaveReqVO createReqVO) {
|
public void createShiftConfig(ShiftConfigSaveReqVO createReqVO) {
|
||||||
// 插入
|
List<ShiftConfigDO> entityList = createReqVO.getShiftConfigList();
|
||||||
ShiftConfigDO shiftConfig = BeanUtils.toBean(createReqVO, ShiftConfigDO.class);
|
|
||||||
shiftConfigMapper.insert(shiftConfig);
|
if (ObjectUtil.isEmpty(entityList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//删除旧数据
|
||||||
|
shiftConfigMapper.deleteByChgClassType(createReqVO.getChgClassType());
|
||||||
|
// 批量设置属性并保存新数据
|
||||||
|
entityList.forEach(entity -> {
|
||||||
|
entity.setChgClassType(createReqVO.getChgClassType());
|
||||||
|
});
|
||||||
|
shiftConfigMapper.insertBatch(entityList);
|
||||||
// 返回
|
// 返回
|
||||||
return shiftConfig.getId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -42,11 +54,9 @@ public class ShiftConfigServiceImpl implements ShiftConfigService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteShiftConfig(Integer id) {
|
public void deleteShiftConfig(String chgClassType) {
|
||||||
// 校验存在
|
|
||||||
validateShiftConfigExists(id);
|
shiftConfigMapper.deleteByChgClassType(chgClassType);
|
||||||
// 删除
|
|
||||||
shiftConfigMapper.deleteById(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateShiftConfigExists(Integer id) {
|
private void validateShiftConfigExists(Integer id) {
|
||||||
|
|||||||
@ -1,55 +1,58 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.service.shiftresult;
|
package com.ningxia.yunxi.chemmes.module.biz.service.shiftresult;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import javax.validation.*;
|
import javax.validation.*;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo.*;
|
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftresult.ShiftResultDO;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo.*;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftresult.ShiftResultDO;
|
||||||
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
/**
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||||
* 班次结果 Service 接口
|
|
||||||
*
|
/**
|
||||||
* @author 管理员
|
* 班次结果 Service 接口
|
||||||
*/
|
*
|
||||||
public interface ShiftResultService {
|
* @author 管理员
|
||||||
|
*/
|
||||||
/**
|
public interface ShiftResultService {
|
||||||
* 创建班次结果
|
|
||||||
*
|
/**
|
||||||
* @param createReqVO 创建信息
|
* 创建班次结果
|
||||||
* @return 编号
|
*
|
||||||
*/
|
* @param createReqVO 创建信息
|
||||||
Integer createShiftResult(@Valid ShiftResultSaveReqVO createReqVO);
|
* @return 编号
|
||||||
|
*/
|
||||||
/**
|
Integer createShiftResult(@Valid ShiftResultSaveReqVO createReqVO);
|
||||||
* 更新班次结果
|
|
||||||
*
|
/**
|
||||||
* @param updateReqVO 更新信息
|
* 更新班次结果
|
||||||
*/
|
*
|
||||||
void updateShiftResult(@Valid ShiftResultSaveReqVO updateReqVO);
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
/**
|
void updateShiftResult(@Valid ShiftResultSaveReqVO updateReqVO);
|
||||||
* 删除班次结果
|
|
||||||
*
|
/**
|
||||||
* @param id 编号
|
* 删除班次结果
|
||||||
*/
|
*
|
||||||
void deleteShiftResult(Integer id);
|
* @param id 编号
|
||||||
|
*/
|
||||||
/**
|
void deleteShiftResult(Integer id);
|
||||||
* 获得班次结果
|
|
||||||
*
|
/**
|
||||||
* @param id 编号
|
* 获得班次结果
|
||||||
* @return 班次结果
|
*
|
||||||
*/
|
* @param id 编号
|
||||||
ShiftResultDO getShiftResult(Integer id);
|
* @return 班次结果
|
||||||
|
*/
|
||||||
/**
|
ShiftResultDO getShiftResult(Integer id);
|
||||||
* 获得班次结果分页
|
|
||||||
*
|
/**
|
||||||
* @param pageReqVO 分页查询
|
* 获得班次结果分页
|
||||||
* @return 班次结果分页
|
*
|
||||||
*/
|
* @param pageReqVO 分页查询
|
||||||
PageResult<ShiftResultDO> getShiftResultPage(ShiftResultPageReqVO pageReqVO);
|
* @return 班次结果分页
|
||||||
|
*/
|
||||||
}
|
PageResult<ShiftResultDO> getShiftResultPage(ShiftResultPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
CommonResult<Boolean> generate(ShiftResultPageReqVO pageReqVO);
|
||||||
|
}
|
||||||
|
|||||||
@ -1,15 +1,31 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.service.shiftresult;
|
package com.ningxia.yunxi.chemmes.module.biz.service.shiftresult;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||||
|
import com.ningxia.yunxi.chemmes.framework.tenant.core.context.TenantContextHolder;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo.ShiftResultPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo.ShiftResultPageReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo.ShiftResultSaveReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.shiftresult.vo.ShiftResultSaveReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftconfig.ShiftConfigDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftresult.ShiftResultDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.shiftresult.ShiftResultDO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.shiftconfig.ShiftConfigMapper;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.shiftresult.ShiftResultMapper;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.shiftresult.ShiftResultMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ningxia.yunxi.chemmes.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 班次结果 Service 实现类
|
* 班次结果 Service 实现类
|
||||||
@ -22,6 +38,8 @@ public class ShiftResultServiceImpl implements ShiftResultService {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ShiftResultMapper shiftResultMapper;
|
private ShiftResultMapper shiftResultMapper;
|
||||||
|
@Resource
|
||||||
|
private ShiftConfigMapper shiftConfigMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer createShiftResult(ShiftResultSaveReqVO createReqVO) {
|
public Integer createShiftResult(ShiftResultSaveReqVO createReqVO) {
|
||||||
@ -65,4 +83,96 @@ public class ShiftResultServiceImpl implements ShiftResultService {
|
|||||||
return shiftResultMapper.selectPage(pageReqVO);
|
return shiftResultMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DataSource dataSource;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<Boolean> generate(ShiftResultPageReqVO pageReqVO) {
|
||||||
|
// 查询班次配置
|
||||||
|
LambdaQueryWrapper<ShiftConfigDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(ShiftConfigDO::getChgClassType, pageReqVO.getChgClassType());
|
||||||
|
queryWrapper.orderByAsc(ShiftConfigDO::getSeqNo);
|
||||||
|
List<ShiftConfigDO> configList = shiftConfigMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(configList)) {
|
||||||
|
return CommonResult.error(400, "该倒班类型" + ("1".equals(pageReqVO.getChgClassType()) ? "四班三倒" : "三班两倒") + "未配置班次信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确定每天的班次数量和工作小时数
|
||||||
|
int shiftsPerDay = "1".equals(pageReqVO.getChgClassType()) ? 3 : ("2".equals(pageReqVO.getChgClassType()) ? 2 : 0);
|
||||||
|
int shiftHour = shiftsPerDay == 3 ? 8 : (shiftsPerDay == 2 ? 12 : 0);
|
||||||
|
if (shiftsPerDay == 0) {
|
||||||
|
return CommonResult.error(400, "不支持的班次类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除全表数据
|
||||||
|
shiftResultMapper.delete(null);
|
||||||
|
|
||||||
|
Long userId = getLoginUserId(); // 用户ID
|
||||||
|
Long tenantId = TenantContextHolder.getTenantId(); // 租户ID
|
||||||
|
// 使用 JDBC 原生批量插入
|
||||||
|
String sql = "INSERT INTO tba_shift_result (class_group, class_rate, bgn_dtime, end_dtime, month, shift_hour, create_time, update_time,creator,updater,tenant_id) VALUES (?, ?, ?, ?, ?, ?, NOW(), NOW(),?,?,?)";
|
||||||
|
int batchSize = 1000;
|
||||||
|
int totalRecords = 366 * shiftsPerDay;
|
||||||
|
|
||||||
|
try (Connection conn = dataSource.getConnection();
|
||||||
|
PreparedStatement ps = conn.prepareStatement(sql)) {
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
|
||||||
|
LocalDate startDate = pageReqVO.getBgnDtime().toInstant().atZone(java.time.ZoneOffset.systemDefault()).toLocalDate();
|
||||||
|
int configSize = configList.size();
|
||||||
|
int batchCount = 0;
|
||||||
|
|
||||||
|
for (int day = 0; day < 366; day++) {
|
||||||
|
LocalDate currentDate = startDate.plusDays(day);
|
||||||
|
LocalDate month = currentDate.withDayOfMonth(1);
|
||||||
|
|
||||||
|
for (int shiftIndex = 0; shiftIndex < shiftsPerDay; shiftIndex++) {
|
||||||
|
int configIndex = (day * shiftsPerDay + shiftIndex) % configSize;
|
||||||
|
ShiftConfigDO config = configList.get(configIndex);
|
||||||
|
|
||||||
|
ps.setString(1, config.getClassGroup());
|
||||||
|
ps.setString(2, config.getClassRate());
|
||||||
|
ps.setObject(3, currentDate.atTime(config.getBgnDtime()));
|
||||||
|
ps.setObject(4, combineDateTime(currentDate, config.getEndDtime()));
|
||||||
|
ps.setObject(5, month);
|
||||||
|
ps.setInt(6, shiftHour);
|
||||||
|
ps.setLong(7, userId); // creator
|
||||||
|
ps.setLong(8, userId); // updater
|
||||||
|
ps.setLong(9, tenantId); // tenant_id
|
||||||
|
ps.addBatch();
|
||||||
|
batchCount++;
|
||||||
|
|
||||||
|
if (batchCount >= batchSize) {
|
||||||
|
ps.executeBatch();
|
||||||
|
conn.commit();
|
||||||
|
batchCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行剩余的批次
|
||||||
|
if (batchCount > 0) {
|
||||||
|
ps.executeBatch();
|
||||||
|
conn.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
return CommonResult.error(500, "批量插入失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return CommonResult.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组合日期和时间,处理结束时间为0点的情况
|
||||||
|
*/
|
||||||
|
private LocalDateTime combineDateTime(LocalDate date, LocalTime localTime) {
|
||||||
|
LocalDateTime result = date.atTime(localTime);
|
||||||
|
// 只有结束时间是 0 点时,日期才自动加一天
|
||||||
|
if (localTime.getHour() == 0 && localTime.getMinute() == 0) {
|
||||||
|
result = result.plusDays(1);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,8 +13,8 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>16</source>
|
<source>1.8</source>
|
||||||
<target>16</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|||||||
@ -1,43 +1,49 @@
|
|||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
|
|
||||||
export interface ShiftConfigVO {
|
export interface ShiftConfigVO {
|
||||||
id: number
|
id: number
|
||||||
classGroup: string
|
classGroup: string
|
||||||
classRate: string
|
classRate: string
|
||||||
enabledStatus: number
|
enabledStatus: number
|
||||||
remark: string
|
remark: string
|
||||||
seqNo: number
|
seqNo: number
|
||||||
chgClassType: string
|
chgClassType: string
|
||||||
bgnDtime: localtime
|
bgnDtime: Date
|
||||||
endDtime: localtime
|
endDtime: Date
|
||||||
}
|
shiftConfigList:[]
|
||||||
|
}
|
||||||
// 查询班次循环配置分页
|
|
||||||
export const getShiftConfigPage = async (params) => {
|
// 查询班次循环配置分页
|
||||||
return await request.get({ url: `/biz/shift-config/page`, params })
|
export const getShiftConfigPage = async (params) => {
|
||||||
}
|
return await request.get({ url: `/biz/shift-config/page`, params })
|
||||||
|
}
|
||||||
// 查询班次循环配置详情
|
|
||||||
export const getShiftConfig = async (id: number) => {
|
// 查询班次循环配置详情
|
||||||
return await request.get({ url: `/biz/shift-config/get?id=` + id })
|
export const getShiftConfig = async (id: number) => {
|
||||||
}
|
return await request.get({ url: `/biz/shift-config/get?id=` + id })
|
||||||
|
}
|
||||||
// 新增班次循环配置
|
|
||||||
export const createShiftConfig = async (data: ShiftConfigVO) => {
|
// 新增班次循环配置
|
||||||
return await request.post({ url: `/biz/shift-config/create`, data })
|
export const createShiftConfig = async (data: ShiftConfigVO) => {
|
||||||
}
|
return await request.post({ url: `/biz/shift-config/create`, data })
|
||||||
|
}
|
||||||
// 修改班次循环配置
|
|
||||||
export const updateShiftConfig = async (data: ShiftConfigVO) => {
|
// 修改班次循环配置
|
||||||
return await request.put({ url: `/biz/shift-config/update`, data })
|
export const updateShiftConfig = async (data: ShiftConfigVO) => {
|
||||||
}
|
return await request.put({ url: `/biz/shift-config/update`, data })
|
||||||
|
}
|
||||||
// 删除班次循环配置
|
|
||||||
export const deleteShiftConfig = async (id: number) => {
|
// 删除班次循环配置
|
||||||
return await request.delete({ url: `/biz/shift-config/delete?id=` + id })
|
export const deleteShiftConfig = async (chgClassType: string) => {
|
||||||
}
|
return await request.delete({ url: `/biz/shift-config/delete?chgClassType=` + chgClassType })
|
||||||
|
}
|
||||||
// 导出班次循环配置 Excel
|
|
||||||
export const exportShiftConfig = async (params) => {
|
// 导出班次循环配置 Excel
|
||||||
return await request.download({ url: `/biz/shift-config/export-excel`, params })
|
export const exportShiftConfig = async (params) => {
|
||||||
}
|
return await request.download({ url: `/biz/shift-config/export-excel`, params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成排班结果
|
||||||
|
export const generateShiftSchedule = async (params) => {
|
||||||
|
return await request.post({ url: `/biz/shift-config/generate`, params })
|
||||||
|
}
|
||||||
|
|||||||
@ -1,43 +1,48 @@
|
|||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
|
|
||||||
export interface ShiftResultVO {
|
export interface ShiftResultVO {
|
||||||
id: number
|
id: number
|
||||||
classGroup: string
|
classGroup: string
|
||||||
classRate: string
|
classRate: string
|
||||||
enabledStatus: number
|
enabledStatus: number
|
||||||
remark: string
|
remark: string
|
||||||
bgnDtime: Date
|
bgnDtime: Date
|
||||||
endDtime: Date
|
endDtime: Date
|
||||||
shiftHour: number
|
shiftHour: number
|
||||||
month: localdate
|
month: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询班次结果分页
|
// 查询班次结果分页
|
||||||
export const getShiftResultPage = async (params) => {
|
export const getShiftResultPage = async (params) => {
|
||||||
return await request.get({ url: `/biz/shift-result/page`, params })
|
return await request.get({ url: `/biz/shift-result/page`, params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询班次结果详情
|
// 查询班次结果详情
|
||||||
export const getShiftResult = async (id: number) => {
|
export const getShiftResult = async (id: number) => {
|
||||||
return await request.get({ url: `/biz/shift-result/get?id=` + id })
|
return await request.get({ url: `/biz/shift-result/get?id=` + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增班次结果
|
// 新增班次结果
|
||||||
export const createShiftResult = async (data: ShiftResultVO) => {
|
export const createShiftResult = async (data: ShiftResultVO) => {
|
||||||
return await request.post({ url: `/biz/shift-result/create`, data })
|
return await request.post({ url: `/biz/shift-result/create`, data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改班次结果
|
// 修改班次结果
|
||||||
export const updateShiftResult = async (data: ShiftResultVO) => {
|
export const updateShiftResult = async (data: ShiftResultVO) => {
|
||||||
return await request.put({ url: `/biz/shift-result/update`, data })
|
return await request.put({ url: `/biz/shift-result/update`, data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除班次结果
|
// 删除班次结果
|
||||||
export const deleteShiftResult = async (id: number) => {
|
export const deleteShiftResult = async (id: number) => {
|
||||||
return await request.delete({ url: `/biz/shift-result/delete?id=` + id })
|
return await request.delete({ url: `/biz/shift-result/delete?id=` + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出班次结果 Excel
|
// 导出班次结果 Excel
|
||||||
export const exportShiftResult = async (params) => {
|
export const exportShiftResult = async (params) => {
|
||||||
return await request.download({ url: `/biz/shift-result/export-excel`, params })
|
return await request.download({ url: `/biz/shift-result/export-excel`, params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生成排班结果
|
||||||
|
export const generateShiftSchedule = async (params) => {
|
||||||
|
return await request.post({ url: `/biz/shift-result/generate`, params })
|
||||||
|
}
|
||||||
|
|||||||
@ -228,6 +228,7 @@ export enum DICT_TYPE {
|
|||||||
MAT_TYPE='mat_type', // 物料类型
|
MAT_TYPE='mat_type', // 物料类型
|
||||||
MAT_UNIT='mat_unit', // 物料单位
|
MAT_UNIT='mat_unit', // 物料单位
|
||||||
SHIFT_WORK_TYPE='shift_work_type', // 倒班类型
|
SHIFT_WORK_TYPE='shift_work_type', // 倒班类型
|
||||||
|
SHIFT_SCHEDULE='shift_schedule', // 班组
|
||||||
TEAM_OR_GROUP='team_or_group', // 班组
|
TEAM_OR_GROUP='team_or_group', // 班组
|
||||||
DEVICE_TYPE='device_type', // 设备类型
|
DEVICE_TYPE='device_type', // 设备类型
|
||||||
DEVICE_STATUS='device_status', // 设备状态
|
DEVICE_STATUS='device_status', // 设备状态
|
||||||
|
|||||||
@ -195,12 +195,11 @@ export function formatPast2(ms) {
|
|||||||
/**
|
/**
|
||||||
* element plus 的时间 Formatter 实现,使用 YYYY-MM-DD HH:mm:ss 格式
|
* element plus 的时间 Formatter 实现,使用 YYYY-MM-DD HH:mm:ss 格式
|
||||||
*
|
*
|
||||||
* @param row 行数据
|
* @param _row 行数据
|
||||||
* @param column 字段
|
* @param _column 字段
|
||||||
* @param cellValue 字段值
|
* @param cellValue 字段值
|
||||||
*/
|
*/
|
||||||
// @ts-ignore
|
export const dateFormatter = (_row, _column, cellValue): string => {
|
||||||
export const dateFormatter = (row, column, cellValue): string => {
|
|
||||||
if (!cellValue) {
|
if (!cellValue) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
@ -210,12 +209,11 @@ export const dateFormatter = (row, column, cellValue): string => {
|
|||||||
/**
|
/**
|
||||||
* element plus 的时间 Formatter 实现,使用 YYYY-MM-DD 格式
|
* element plus 的时间 Formatter 实现,使用 YYYY-MM-DD 格式
|
||||||
*
|
*
|
||||||
* @param row 行数据
|
* @param _row 行数据
|
||||||
* @param column 字段
|
* @param _column 字段
|
||||||
* @param cellValue 字段值
|
* @param cellValue 字段值
|
||||||
*/
|
*/
|
||||||
// @ts-ignore
|
export const dateFormatter2 = (_row, _column, cellValue) => {
|
||||||
export const dateFormatter2 = (row, column, cellValue) => {
|
|
||||||
if (!cellValue) {
|
if (!cellValue) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -224,18 +222,24 @@ export const dateFormatter2 = (row, column, cellValue) => {
|
|||||||
/**
|
/**
|
||||||
* element plus 的时间 Formatter 实现,使用 YYYY-MM 格式
|
* element plus 的时间 Formatter 实现,使用 YYYY-MM 格式
|
||||||
*
|
*
|
||||||
* @param row 行数据
|
* @param _row 行数据
|
||||||
* @param column 字段
|
* @param _column 字段
|
||||||
* @param cellValue 字段值
|
* @param cellValue 字段值
|
||||||
*/
|
*/
|
||||||
// @ts-ignore
|
export const dateFormatter3 = (_row, _column, cellValue) => {
|
||||||
export const dateFormatter3 = (row, column, cellValue) => {
|
|
||||||
if (!cellValue) {
|
if (!cellValue) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return formatDate(cellValue, 'YYYY-MM')
|
return formatDate(cellValue, 'YYYY-MM')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const dateFormatter4 = (_row, _column, cellValue) => {
|
||||||
|
if (!cellValue) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return formatDate(cellValue, 'YYYY-MM-DD HH:mm')
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置起始日期,时间为00:00:00
|
* 设置起始日期,时间为00:00:00
|
||||||
* @param param 传入日期
|
* @param param 传入日期
|
||||||
|
|||||||
@ -106,7 +106,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -150,7 +150,6 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
import * as CustomerApi from '@/api/biz/customer'
|
import * as CustomerApi from '@/api/biz/customer'
|
||||||
import CustomerForm from './CustomerForm.vue'
|
import CustomerForm from './CustomerForm.vue'
|
||||||
@ -243,4 +242,4 @@ const handleExport = async () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1000px" @close="cancel" >
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
@ -7,31 +7,13 @@
|
|||||||
label-width="100px"
|
label-width="100px"
|
||||||
v-loading="formLoading"
|
v-loading="formLoading"
|
||||||
>
|
>
|
||||||
<el-form-item label="班组(甲 乙 丙 丁)" prop="classGroup">
|
<el-form-item label="倒班类型" prop="chgClassType">
|
||||||
<el-input v-model="formData.classGroup" placeholder="请输入班组(甲 乙 丙 丁)" />
|
<el-select
|
||||||
</el-form-item>
|
v-model="formData.chgClassType"
|
||||||
<el-form-item label="班次( 1 白 2 中 3 夜)" prop="classRate">
|
placeholder="请选择倒班类型"
|
||||||
<el-input v-model="formData.classRate" placeholder="请输入班次( 1 白 2 中 3 夜)" />
|
clearable
|
||||||
</el-form-item>
|
class="!w-240px"
|
||||||
<el-form-item label="状态(1启用 2 未启用)" prop="enabledStatus">
|
>
|
||||||
<el-radio-group v-model="formData.enabledStatus">
|
|
||||||
<el-radio
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.value"
|
|
||||||
>
|
|
||||||
{{ dict.label }}
|
|
||||||
</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="备注" prop="remark">
|
|
||||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="序列号" prop="seqNo">
|
|
||||||
<el-input v-model="formData.seqNo" placeholder="请输入序列号" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="倒班类型(1 四班三倒 2 三班两到)" prop="chgClassType">
|
|
||||||
<el-select v-model="formData.chgClassType" placeholder="请选择倒班类型(1 四班三倒 2 三班两到)">
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in getStrDictOptions(DICT_TYPE.SHIFT_WORK_TYPE)"
|
v-for="dict in getStrDictOptions(DICT_TYPE.SHIFT_WORK_TYPE)"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
@ -39,33 +21,129 @@
|
|||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开始时间" prop="bgnDtime">
|
<el-card class="hl-card-info">
|
||||||
<el-date-picker
|
<template #header>
|
||||||
v-model="formData.bgnDtime"
|
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">班次明细</span>
|
||||||
type="date"
|
<el-button type="primary" size="large" @click="onAddItem" style="margin-left: 20px">新增</el-button>
|
||||||
value-format="x"
|
|
||||||
placeholder="选择开始时间"
|
</template>
|
||||||
/>
|
<el-row>
|
||||||
</el-form-item>
|
<el-col>
|
||||||
<el-form-item label="结束时间" prop="endDtime">
|
<el-card class="hl-incard">
|
||||||
<el-date-picker
|
<el-form ref="OrderYsDetailSubFormRef" :model="formData.shiftConfigList" label-width="0" >
|
||||||
v-model="formData.endDtime"
|
<el-table :data="formData.shiftConfigList" class="hl-table" >
|
||||||
type="date"
|
<el-table-column type="index" label="序号" align="center" min-width="60" fixed />
|
||||||
value-format="x"
|
<el-table-column align="center" label="班次">
|
||||||
placeholder="选择结束时间"
|
<template #default="scope">
|
||||||
/>
|
<el-form-item prop="classRate" >
|
||||||
</el-form-item>
|
<el-select
|
||||||
|
v-model="scope.row.classRate"
|
||||||
|
placeholder="请选择"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.SHIFT_SCHEDULE)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column align="center" label="班组">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-form-item prop="classGroup" >
|
||||||
|
<el-select
|
||||||
|
v-model="scope.row.classGroup"
|
||||||
|
placeholder="请选择"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.TEAM_OR_GROUP)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="开始时间" prop="bgnDtime" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-form-item prop="bgnDtime">
|
||||||
|
<el-time-picker
|
||||||
|
v-model="scope.row.bgnDtime"
|
||||||
|
placeholder="请选择"
|
||||||
|
clearable
|
||||||
|
format="HH:mm"
|
||||||
|
value-format="HH:mm"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="结束时间" prop="endDtime" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-form-item prop="endDtime">
|
||||||
|
<el-time-picker
|
||||||
|
v-model="scope.row.endDtime"
|
||||||
|
placeholder="请选择"
|
||||||
|
clearable
|
||||||
|
format="HH:mm"
|
||||||
|
value-format="HH:mm"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="序列号" prop="seqNo" align="center" >
|
||||||
|
<template #default="scope">
|
||||||
|
<el-form-item prop="seqNo">
|
||||||
|
<el-input-number
|
||||||
|
v-model="scope.row.seqNo"
|
||||||
|
placeholder="请输入"
|
||||||
|
:min="0"
|
||||||
|
controls-position="right"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" width="120" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="danger" size="small" @click.prevent="onDeleteItem(scope.$index)" >
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
||||||
import * as ShiftConfigApi from '@/api/biz/shiftconfig'
|
import * as ShiftConfigApi from '@/api/biz/shiftconfig'
|
||||||
|
import {DICT_TYPE, getIntDictOptions, getStrDictOptions} from "@/utils/dict";
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
@ -84,13 +162,17 @@ const formData = ref({
|
|||||||
chgClassType: undefined,
|
chgClassType: undefined,
|
||||||
bgnDtime: undefined,
|
bgnDtime: undefined,
|
||||||
endDtime: undefined,
|
endDtime: undefined,
|
||||||
|
shiftConfigList:[]
|
||||||
})
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
bgnDtime: [{ required: true, message: '开始时间不能为空', trigger: 'blur' }],
|
chgClassType: [{ required: true, message: '倒班类型不能为空', trigger: 'change' }]
|
||||||
endDtime: [{ required: true, message: '结束时间不能为空', trigger: 'blur' }],
|
|
||||||
})
|
})
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
|
const cancel = async () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('success')
|
||||||
|
|
||||||
|
}
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (type: string, id?: number) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
@ -101,7 +183,9 @@ const open = async (type: string, id?: number) => {
|
|||||||
if (id) {
|
if (id) {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
formData.value = await ShiftConfigApi.getShiftConfig(id)
|
const data = await ShiftConfigApi.getShiftConfig(id)
|
||||||
|
|
||||||
|
formData.value = data
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
@ -132,6 +216,23 @@ const submitForm = async () => {
|
|||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** 新增子项按钮操作 */
|
||||||
|
const onAddItem = () => {
|
||||||
|
const row = {
|
||||||
|
id: undefined,
|
||||||
|
classGroup: undefined,
|
||||||
|
classRate:undefined,
|
||||||
|
bgnDtime: undefined,
|
||||||
|
endDtime: undefined,
|
||||||
|
seqNo: undefined,
|
||||||
|
}
|
||||||
|
formData.value.shiftConfigList.push(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除子项操作 */
|
||||||
|
const onDeleteItem = async (index) => {
|
||||||
|
formData.value.shiftConfigList.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
/** 重置表单 */
|
/** 重置表单 */
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
@ -145,7 +246,8 @@ const resetForm = () => {
|
|||||||
chgClassType: undefined,
|
chgClassType: undefined,
|
||||||
bgnDtime: undefined,
|
bgnDtime: undefined,
|
||||||
endDtime: undefined,
|
endDtime: undefined,
|
||||||
|
shiftConfigList:[],
|
||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -6,27 +6,12 @@
|
|||||||
:model="queryParams"
|
:model="queryParams"
|
||||||
ref="queryFormRef"
|
ref="queryFormRef"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
label-width="68px"
|
label-width="80px"
|
||||||
>
|
>
|
||||||
<el-form-item label="状态(1启用 2 未启用)" prop="enabledStatus">
|
<el-form-item label="倒班类型" prop="chgClassType">
|
||||||
<el-select
|
|
||||||
v-model="queryParams.enabledStatus"
|
|
||||||
placeholder="请选择状态(1启用 2 未启用)"
|
|
||||||
clearable
|
|
||||||
class="!w-240px"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="倒班类型(1 四班三倒 2 三班两到)" prop="chgClassType">
|
|
||||||
<el-select
|
<el-select
|
||||||
v-model="queryParams.chgClassType"
|
v-model="queryParams.chgClassType"
|
||||||
placeholder="请选择倒班类型(1 四班三倒 2 三班两到)"
|
placeholder="请选择倒班类型"
|
||||||
clearable
|
clearable
|
||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
>
|
>
|
||||||
@ -45,78 +30,53 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
plain
|
plain
|
||||||
@click="openForm('create')"
|
@click="openForm('create')"
|
||||||
v-hasPermi="['biz:shift-config:create']"
|
|
||||||
>
|
>
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="danger"
|
||||||
plain
|
plain
|
||||||
@click="handleExport"
|
@click="handleDelete"
|
||||||
:loading="exportLoading"
|
:disabled="!queryParams.chgClassType"
|
||||||
v-hasPermi="['biz:shift-config:export']"
|
|
||||||
>
|
>
|
||||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
<Icon icon="ep:delete" class="mr-5px" /> 删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
||||||
<el-table-column label="自增字段" align="center" prop="id" />
|
<el-table-column type="index" label="序号" align="center" min-width="60" />
|
||||||
<el-table-column
|
<el-table-column label="班次" align="center" prop="classRate">
|
||||||
label="创建时间"
|
|
||||||
align="center"
|
|
||||||
prop="createTime"
|
|
||||||
:formatter="dateFormatter"
|
|
||||||
width="180px"
|
|
||||||
/>
|
|
||||||
<el-table-column label="班组(甲 乙 丙 丁)" align="center" prop="classGroup">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.TEAM_OR_GROUP" :value="scope.row.classGroup" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="班次( 1 白 2 中 3 夜)" align="center" prop="classRate">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.SHIFT_SCHEDULE" :value="scope.row.classRate" />
|
<dict-tag :type="DICT_TYPE.SHIFT_SCHEDULE" :value="scope.row.classRate" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态(1启用 2 未启用)" align="center" prop="enabledStatus">
|
<el-table-column label="班组" align="center" prop="classGroup">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
<dict-tag :type="DICT_TYPE.TEAM_OR_GROUP" :value="scope.row.classGroup" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="倒班类型" align="center" prop="chgClassType">
|
||||||
<el-table-column label="序列号" align="center" prop="seqNo" />
|
|
||||||
<el-table-column label="倒班类型(1 四班三倒 2 三班两到)" align="center" prop="chgClassType">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.SHIFT_WORK_TYPE" :value="scope.row.chgClassType" />
|
<dict-tag :type="DICT_TYPE.SHIFT_WORK_TYPE" :value="scope.row.chgClassType" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="开始时间" align="center" prop="bgnDtime" />
|
<el-table-column label="开始时间" align="center" prop="bgnDtime">
|
||||||
<el-table-column label="结束时间" align="center" prop="endDtime" />
|
|
||||||
<el-table-column label="操作" align="center">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<span>{{ formatTime(scope.row.bgnDtime) }}</span>
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
@click="openForm('update', scope.row.id)"
|
|
||||||
v-hasPermi="['biz:shift-config:update']"
|
|
||||||
>
|
|
||||||
编辑
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
link
|
|
||||||
type="danger"
|
|
||||||
@click="handleDelete(scope.row.id)"
|
|
||||||
v-hasPermi="['biz:shift-config:delete']"
|
|
||||||
>
|
|
||||||
删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="结束时间" align="center" prop="endDtime">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ formatTime(scope.row.endDtime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="序列号" align="center" prop="seqNo" />
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination
|
<Pagination
|
||||||
@ -132,18 +92,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
|
||||||
import download from '@/utils/download'
|
|
||||||
import * as ShiftConfigApi from '@/api/biz/shiftconfig'
|
import * as ShiftConfigApi from '@/api/biz/shiftconfig'
|
||||||
import ShiftConfigForm from './ShiftConfigForm.vue'
|
import ShiftConfigForm from './ShiftConfigForm.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'ShiftConfig' })
|
defineOptions({ name: 'shiftConfig' })
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
@ -153,7 +112,6 @@ const queryParams = reactive({
|
|||||||
chgClassType: undefined,
|
chgClassType: undefined,
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
@ -186,35 +144,47 @@ const openForm = (type: string, id?: number) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (id: number) => {
|
const handleDelete = async () => {
|
||||||
|
if (queryParams.chgClassType){
|
||||||
try {
|
try {
|
||||||
// 删除的二次确认
|
// 删除的二次确认
|
||||||
await message.delConfirm()
|
await message.delConfirm()
|
||||||
// 发起删除
|
// 发起删除
|
||||||
await ShiftConfigApi.deleteShiftConfig(id)
|
await ShiftConfigApi.deleteShiftConfig(queryParams.chgClassType)
|
||||||
message.success(t('common.delSuccess'))
|
message.success(t('common.delSuccess'))
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
await getList()
|
await getList()
|
||||||
} catch {}
|
} catch {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
const handleExport = async () => {
|
|
||||||
try {
|
/** 格式化时间显示 HH:mm **/
|
||||||
// 导出的二次确认
|
const formatTime = (time: any) => {
|
||||||
await message.exportConfirm()
|
if (!time) return ''
|
||||||
// 发起导出
|
// 如果是数组格式 [小时, 分钟]
|
||||||
exportLoading.value = true
|
if (Array.isArray(time)) {
|
||||||
const data = await ShiftConfigApi.exportShiftConfig(queryParams)
|
const hours = String(time[0] || 0).padStart(2, '0')
|
||||||
download.excel(data, '班次循环配置.xls')
|
const minutes = String(time[1] || 0).padStart(2, '0')
|
||||||
} catch {
|
return `${hours}:${minutes}`
|
||||||
} finally {
|
|
||||||
exportLoading.value = false
|
|
||||||
}
|
}
|
||||||
|
// 如果是字符串格式
|
||||||
|
const timeStr = String(time)
|
||||||
|
// 如果是完整的日期时间格式,提取 HH:mm
|
||||||
|
if (timeStr.includes('T') || timeStr.includes('-')) {
|
||||||
|
const match = timeStr.match(/(\d{2}):(\d{2})(?::\d{2})?/)
|
||||||
|
if (match) return `${match[1]}:${match[2]}`
|
||||||
|
}
|
||||||
|
// 如果已经是 HH:mm 格式
|
||||||
|
if (timeStr.includes(':')) {
|
||||||
|
return timeStr.substring(0, 5)
|
||||||
|
}
|
||||||
|
return timeStr
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList()
|
// getList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,146 +1,110 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form
|
<el-form class="-mb-15px"
|
||||||
class="-mb-15px"
|
:model="queryParams"
|
||||||
:model="queryParams"
|
ref="queryFormRef"
|
||||||
ref="queryFormRef"
|
:inline="true"
|
||||||
:inline="true"
|
label-width="80px">
|
||||||
label-width="68px"
|
<el-row :gutter="16">
|
||||||
>
|
<el-col :span="6">
|
||||||
<el-form-item label="状态(1启用 2 未启用)" prop="enabledStatus">
|
<el-form-item label="排班年月">
|
||||||
<el-select
|
<el-date-picker
|
||||||
v-model="queryParams.enabledStatus"
|
v-model="queryParams.years"
|
||||||
placeholder="请选择状态(1启用 2 未启用)"
|
value-format="YYYY-MM"
|
||||||
clearable
|
type="month"
|
||||||
class="!w-240px"
|
placeholder="请选择排班年月"
|
||||||
>
|
clearable
|
||||||
<el-option
|
class="!w-240px"
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)"
|
/>
|
||||||
:key="dict.value"
|
</el-form-item>
|
||||||
:label="dict.label"
|
</el-col>
|
||||||
:value="dict.value"
|
<el-col :span="6">
|
||||||
/>
|
<el-form-item>
|
||||||
</el-select>
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
</el-form-item>
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
<el-form-item label="开始时间" prop="bgnDtime">
|
</el-form-item>
|
||||||
<el-date-picker
|
</el-col>
|
||||||
v-model="queryParams.bgnDtime"
|
</el-row>
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
<el-row :gutter="16">
|
||||||
type="daterange"
|
<el-col :span="6">
|
||||||
start-placeholder="开始日期"
|
<el-form-item label="倒班类型">
|
||||||
end-placeholder="结束日期"
|
<el-select
|
||||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
v-model="queryParams.chgClassType"
|
||||||
class="!w-240px"
|
placeholder="请选择倒班类型"
|
||||||
/>
|
clearable
|
||||||
</el-form-item>
|
class="!w-240px"
|
||||||
<el-form-item label="结束时间" prop="endDtime">
|
>
|
||||||
<el-date-picker
|
<el-option
|
||||||
v-model="queryParams.endDtime"
|
v-for="dict in getStrDictOptions(DICT_TYPE.SHIFT_WORK_TYPE)"
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
:key="dict.value"
|
||||||
type="daterange"
|
:label="dict.label"
|
||||||
start-placeholder="开始日期"
|
:value="dict.value"
|
||||||
end-placeholder="结束日期"
|
/>
|
||||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
</el-select>
|
||||||
class="!w-240px"
|
</el-form-item>
|
||||||
/>
|
</el-col>
|
||||||
</el-form-item>
|
<el-col :span="6">
|
||||||
<el-form-item label="排班月份" prop="month">
|
<el-form-item label="开始日期">
|
||||||
<el-input
|
<el-date-picker
|
||||||
v-model="queryParams.month"
|
v-model="queryParams.bgnDtime"
|
||||||
placeholder="请输入排班月份"
|
value-format="YYYY-MM-DD"
|
||||||
clearable
|
type="date"
|
||||||
@keyup.enter="handleQuery"
|
placeholder="请选择开始日期"
|
||||||
class="!w-240px"
|
clearable
|
||||||
/>
|
class="!w-240px"
|
||||||
</el-form-item>
|
:disabled-date="disabledDate"
|
||||||
<el-form-item>
|
/>
|
||||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
</el-form-item>
|
||||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
</el-col>
|
||||||
<el-button
|
<el-col :span="6">
|
||||||
type="primary"
|
<el-form-item>
|
||||||
plain
|
<el-button
|
||||||
@click="openForm('create')"
|
type="success"
|
||||||
v-hasPermi="['biz:shift-result:create']"
|
@click="handleGenerate"
|
||||||
>
|
:loading="generatedLoading"
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
:disabled="generatedLoading"
|
||||||
</el-button>
|
>
|
||||||
<el-button
|
生成排班结果
|
||||||
type="success"
|
</el-button>
|
||||||
plain
|
</el-form-item>
|
||||||
@click="handleExport"
|
</el-col>
|
||||||
:loading="exportLoading"
|
</el-row>
|
||||||
v-hasPermi="['biz:shift-result:export']"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
|
||||||
</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" border>
|
||||||
<el-table-column label="自增字段" align="center" prop="id" />
|
<el-table-column type="index" label="序号" align="center" min-width="60" />
|
||||||
<el-table-column
|
|
||||||
label="创建时间"
|
<el-table-column label="班次" align="center" prop="classRate">
|
||||||
align="center"
|
|
||||||
prop="createTime"
|
|
||||||
:formatter="dateFormatter"
|
|
||||||
width="180px"
|
|
||||||
/>
|
|
||||||
<el-table-column label="班组(甲 乙 丙 丁)" align="center" prop="classGroup">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.TEAM_OR_GROUP" :value="scope.row.classGroup" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="班次( 1 白 2 中 3 夜)" align="center" prop="classRate">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.SHIFT_SCHEDULE" :value="scope.row.classRate" />
|
<dict-tag :type="DICT_TYPE.SHIFT_SCHEDULE" :value="scope.row.classRate" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态(1启用 2 未启用)" align="center" prop="enabledStatus">
|
<el-table-column label="班组" align="center" prop="classGroup">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
<dict-tag :type="DICT_TYPE.TEAM_OR_GROUP" :value="scope.row.classGroup" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="开始时间"
|
label="开始时间"
|
||||||
align="center"
|
align="center"
|
||||||
prop="bgnDtime"
|
prop="bgnDtime"
|
||||||
:formatter="dateFormatter"
|
:formatter="dateFormatter4"
|
||||||
width="180px"
|
width="180px"
|
||||||
/>
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="结束时间"
|
label="结束时间"
|
||||||
align="center"
|
align="center"
|
||||||
prop="endDtime"
|
prop="endDtime"
|
||||||
:formatter="dateFormatter"
|
:formatter="dateFormatter4"
|
||||||
width="180px"
|
width="180px"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="小时数" align="center" prop="shiftHour" />
|
<el-table-column label="小时数" align="center" prop="shiftHour" />
|
||||||
<el-table-column label="排班月份" align="center" prop="month" />
|
<el-table-column label="排班月份" align="center" prop="month" :formatter="dateFormatter3" />
|
||||||
<el-table-column label="操作" align="center">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
@click="openForm('update', scope.row.id)"
|
|
||||||
v-hasPermi="['biz:shift-result:update']"
|
|
||||||
>
|
|
||||||
编辑
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
link
|
|
||||||
type="danger"
|
|
||||||
@click="handleDelete(scope.row.id)"
|
|
||||||
v-hasPermi="['biz:shift-result:delete']"
|
|
||||||
>
|
|
||||||
删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination
|
<Pagination
|
||||||
@ -156,30 +120,46 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
import { dateFormatter3, dateFormatter4} from '@/utils/formatTime'
|
||||||
import download from '@/utils/download'
|
|
||||||
import * as ShiftResultApi from '@/api/biz/shiftresult'
|
import * as ShiftResultApi from '@/api/biz/shiftresult'
|
||||||
import ShiftResultForm from './ShiftResultForm.vue'
|
import ShiftResultForm from './ShiftResultForm.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'ShiftResult' })
|
defineOptions({ name: 'ShiftResult' })
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
|
||||||
|
|
||||||
const loading = ref(true) // 列表的加载中
|
|
||||||
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
|
const generatedLoading = ref(false) // 生成排班结果的加载中
|
||||||
|
|
||||||
|
/** 获取当天日期 YYYY-MM-DD */
|
||||||
|
const getTodayDate = () => {
|
||||||
|
const now = new Date()
|
||||||
|
return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取当月 YYYY-MM */
|
||||||
|
const getCurrentMonth = () => {
|
||||||
|
const now = new Date()
|
||||||
|
return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`
|
||||||
|
}
|
||||||
|
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
enabledStatus: undefined,
|
years: getCurrentMonth(),
|
||||||
bgnDtime: [],
|
chgClassType: undefined,
|
||||||
endDtime: [],
|
bgnDtime: getTodayDate(),
|
||||||
month: undefined,
|
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
|
||||||
|
/** 禁用今天之前的日期 */
|
||||||
|
const disabledDate = (time: Date) => {
|
||||||
|
return time.getTime() < Date.now() - 8.64e7
|
||||||
|
}
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
@ -205,42 +185,33 @@ const resetQuery = () => {
|
|||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
|
||||||
const formRef = ref()
|
|
||||||
const openForm = (type: string, id?: number) => {
|
|
||||||
formRef.value.open(type, id)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 生成排班结果按钮操作 */
|
||||||
const handleDelete = async (id: number) => {
|
const handleGenerate = async () => {
|
||||||
|
if (!queryParams.chgClassType) {
|
||||||
|
message.warning('请先选择倒班类型')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!queryParams.bgnDtime) {
|
||||||
|
message.warning('请先选择开始日期')
|
||||||
|
return
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// 删除的二次确认
|
generatedLoading.value = true
|
||||||
await message.delConfirm()
|
await ShiftResultApi.generateShiftSchedule({
|
||||||
// 发起删除
|
chgClassType: queryParams.chgClassType,
|
||||||
await ShiftResultApi.deleteShiftResult(id)
|
bgnDtime: queryParams.bgnDtime
|
||||||
message.success(t('common.delSuccess'))
|
})
|
||||||
// 刷新列表
|
message.success('排班结果生成成功')
|
||||||
await getList()
|
getList()
|
||||||
} catch {}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
const handleExport = async () => {
|
|
||||||
try {
|
|
||||||
// 导出的二次确认
|
|
||||||
await message.exportConfirm()
|
|
||||||
// 发起导出
|
|
||||||
exportLoading.value = true
|
|
||||||
const data = await ShiftResultApi.exportShiftResult(queryParams)
|
|
||||||
download.excel(data, '班次结果.xls')
|
|
||||||
} catch {
|
} catch {
|
||||||
} finally {
|
} finally {
|
||||||
exportLoading.value = false
|
generatedLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList()
|
// getList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user