Jelajahi Sumber

排班代码生成

wukai 7 bulan lalu
induk
melakukan
cabbd365fc

+ 128 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/controller/TwinEmpController.java

@@ -0,0 +1,128 @@
+package com.ruoyi.biz.controller;
+
+import com.ruoyi.biz.domain.TwinEmp;
+import com.ruoyi.biz.service.ITwinEmpService;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 员工排班Controller
+ *
+ * @author ruoyi
+ * @date 2024-12-19
+ */
+@Controller
+@RequestMapping("/biz/emp")
+public class TwinEmpController extends BaseController {
+    private String prefix = "biz/emp";
+
+    @Autowired
+    private ITwinEmpService twinEmpService;
+
+    @RequiresPermissions("biz:emp:view")
+    @GetMapping()
+    public String emp() {
+        return prefix + "/emp";
+    }
+
+    /**
+     * 查询员工排班列表
+     */
+    @RequiresPermissions("biz:emp:list")
+    @PostMapping("/list")
+    @ResponseBody
+    public TableDataInfo list(TwinEmp twinEmp) {
+        startPage();
+        List<TwinEmp> list = twinEmpService.selectTwinEmpList(twinEmp);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出员工排班列表
+     */
+    @RequiresPermissions("biz:emp:export")
+    @Log(title = "员工排班", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(TwinEmp twinEmp) {
+        List<TwinEmp> list = twinEmpService.selectTwinEmpList(twinEmp);
+        ExcelUtil<TwinEmp> util = new ExcelUtil<TwinEmp>(TwinEmp.class);
+        return util.exportExcel(list, "员工排班数据");
+    }
+
+    /**
+     * 新增员工排班
+     */
+    @GetMapping("/add")
+    public String add() {
+        return prefix + "/add";
+    }
+
+    /**
+     * 新增保存员工排班
+     */
+    @RequiresPermissions("biz:emp:add")
+    @Log(title = "员工排班", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public AjaxResult addSave(TwinEmp twinEmp) {
+        TwinEmp search = new TwinEmp();
+        search.setEmpDate(twinEmp.getEmpDate());
+        List list = twinEmpService.selectTwinEmpList(search);
+        if (list.size() > 0) {
+            return AjaxResult.error("已经有\"" + DateUtils.parseDateToStr(twinEmp.getEmpDate()) + "\"排班,请到对应排班日期修改");
+        } else {
+            if (StringUtils.isNull(twinEmp.getTwinEmpDetailListA()) || StringUtils.isNull(twinEmp.getTwinEmpDetailListB())) {
+                return AjaxResult.error("AB班员工排班明细不能为空");
+            } else {
+                return toAjax(twinEmpService.insertTwinEmp(twinEmp));
+            }
+        }
+    }
+
+    /**
+     * 修改员工排班
+     */
+    @RequiresPermissions("biz:emp:edit")
+    @GetMapping("/edit/{empId}")
+    public String edit(@PathVariable("empId") Long empId, ModelMap mmap) {
+        TwinEmp twinEmp = twinEmpService.selectTwinEmpByEmpId(empId);
+        mmap.put("twinEmp", twinEmp);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 修改保存员工排班
+     */
+    @RequiresPermissions("biz:emp:edit")
+    @Log(title = "员工排班", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    @ResponseBody
+    public AjaxResult editSave(TwinEmp twinEmp) {
+        return toAjax(twinEmpService.updateTwinEmp(twinEmp));
+    }
+
+    /**
+     * 删除员工排班
+     */
+    @RequiresPermissions("biz:emp:remove")
+    @Log(title = "员工排班", businessType = BusinessType.DELETE)
+    @PostMapping("/remove")
+    @ResponseBody
+    public AjaxResult remove(String ids) {
+        return toAjax(twinEmpService.deleteTwinEmpByEmpIds(ids));
+    }
+}

+ 41 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/domain/TwinEmp.java

@@ -0,0 +1,41 @@
+package com.ruoyi.biz.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 员工排班对象 twin_emp
+ *
+ * @author ruoyi
+ * @date 2024-12-19
+ */
+@ApiModel(value = "ITwinEmp", description = "员工排班")
+@Data
+public class TwinEmp extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 排班ID
+     */
+    private Long empId;
+
+    /**
+     * 时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @ApiModelProperty("时间")
+    private Date empDate;
+
+    private List<TwinEmpDetail> twinEmpDetailList;
+    private List<TwinEmpDetail> twinEmpDetailListA;
+    private List<TwinEmpDetail> twinEmpDetailListB;
+
+}

+ 94 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/domain/TwinEmpDetail.java

@@ -0,0 +1,94 @@
+package com.ruoyi.biz.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 员工排班明细对象 twin_emp_detail
+ * 
+ * @author ruoyi
+ * @date 2024-12-19
+ */
+public class TwinEmpDetail extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 明细ID */
+    private Long detailId;
+
+    /** 排班ID */
+    @Excel(name = "排班ID")
+    private Long empId;
+
+    /** 姓名 */
+    @Excel(name = "姓名")
+    private String empName;
+
+    /** 班组 */
+    @Excel(name = "班组")
+    private String empTeam;
+
+    /** 机台号 */
+    @Excel(name = "机台号")
+    private String devices;
+
+    public void setDetailId(Long detailId) 
+    {
+        this.detailId = detailId;
+    }
+
+    public Long getDetailId() 
+    {
+        return detailId;
+    }
+    public void setEmpId(Long empId) 
+    {
+        this.empId = empId;
+    }
+
+    public Long getEmpId() 
+    {
+        return empId;
+    }
+    public void setEmpName(String empName) 
+    {
+        this.empName = empName;
+    }
+
+    public String getEmpName() 
+    {
+        return empName;
+    }
+    public void setEmpTeam(String empTeam) 
+    {
+        this.empTeam = empTeam;
+    }
+
+    public String getEmpTeam() 
+    {
+        return empTeam;
+    }
+    public void setDevices(String devices) 
+    {
+        this.devices = devices;
+    }
+
+    public String getDevices() 
+    {
+        return devices;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("detailId", getDetailId())
+            .append("empId", getEmpId())
+            .append("empName", getEmpName())
+            .append("empTeam", getEmpTeam())
+            .append("devices", getDevices())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 87 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/mapper/TwinEmpMapper.java

@@ -0,0 +1,87 @@
+package com.ruoyi.biz.mapper;
+
+import com.ruoyi.biz.domain.TwinEmp;
+import com.ruoyi.biz.domain.TwinEmpDetail;
+
+import java.util.List;
+
+/**
+ * 员工排班Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-12-19
+ */
+public interface TwinEmpMapper {
+    /**
+     * 查询员工排班
+     *
+     * @param empId 员工排班主键
+     * @return 员工排班
+     */
+    public TwinEmp selectTwinEmpByEmpId(Long empId);
+
+    /**
+     * 查询员工排班列表
+     *
+     * @param twinEmp 员工排班
+     * @return 员工排班集合
+     */
+    public List<TwinEmp> selectTwinEmpList(TwinEmp twinEmp);
+
+    /**
+     * 新增员工排班
+     *
+     * @param twinEmp 员工排班
+     * @return 结果
+     */
+    public int insertTwinEmp(TwinEmp twinEmp);
+
+    /**
+     * 修改员工排班
+     *
+     * @param twinEmp 员工排班
+     * @return 结果
+     */
+    public int updateTwinEmp(TwinEmp twinEmp);
+
+    /**
+     * 删除员工排班
+     *
+     * @param empId 员工排班主键
+     * @return 结果
+     */
+    public int deleteTwinEmpByEmpId(Long empId);
+
+    /**
+     * 批量删除员工排班
+     *
+     * @param empIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTwinEmpByEmpIds(String[] empIds);
+
+    /**
+     * 批量删除员工排班明细
+     *
+     * @param empIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTwinEmpDetailByEmpIds(String[] empIds);
+
+    /**
+     * 批量新增员工排班明细
+     *
+     * @param twinEmpDetailList 员工排班明细列表
+     * @return 结果
+     */
+    public int batchTwinEmpDetail(List<TwinEmpDetail> twinEmpDetailList);
+
+
+    /**
+     * 通过员工排班主键删除员工排班明细信息
+     *
+     * @param empId 员工排班ID
+     * @return 结果
+     */
+    public int deleteTwinEmpDetailByEmpId(Long empId);
+}

+ 61 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/service/ITwinEmpService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.biz.service;
+
+import java.util.List;
+import com.ruoyi.biz.domain.TwinEmp;
+
+/**
+ * 员工排班Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-12-19
+ */
+public interface ITwinEmpService 
+{
+    /**
+     * 查询员工排班
+     * 
+     * @param empId 员工排班主键
+     * @return 员工排班
+     */
+    public TwinEmp selectTwinEmpByEmpId(Long empId);
+
+    /**
+     * 查询员工排班列表
+     * 
+     * @param twinEmp 员工排班
+     * @return 员工排班集合
+     */
+    public List<TwinEmp> selectTwinEmpList(TwinEmp twinEmp);
+
+    /**
+     * 新增员工排班
+     * 
+     * @param twinEmp 员工排班
+     * @return 结果
+     */
+    public int insertTwinEmp(TwinEmp twinEmp);
+
+    /**
+     * 修改员工排班
+     * 
+     * @param twinEmp 员工排班
+     * @return 结果
+     */
+    public int updateTwinEmp(TwinEmp twinEmp);
+
+    /**
+     * 批量删除员工排班
+     * 
+     * @param empIds 需要删除的员工排班主键集合
+     * @return 结果
+     */
+    public int deleteTwinEmpByEmpIds(String empIds);
+
+    /**
+     * 删除员工排班信息
+     * 
+     * @param empId 员工排班主键
+     * @return 结果
+     */
+    public int deleteTwinEmpByEmpId(Long empId);
+}

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/biz/service/impl/AsyncServiceImpl.java

@@ -100,7 +100,7 @@ public class AsyncServiceImpl {
             "Alarm_unit_19", "Alarm_unit_20", "Alarm_unit_21", "Alarm_unit_22", "Alarm_unit_23",
             "Alarm_unit_24", "Alarm_unit_25", "Alarm_unit_26", "Alarm_unit_27", "Capacity_data_33",
             "Capacity_data_15", "Capacity_data_16", "Capacity_data_17", "Capacity_data_18", "Capacity_data_19",
-            "Capacity_data_34"
+            "Capacity_data_34", "Formula_data_24"
     };
 
 

+ 136 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/service/impl/TwinEmpServiceImpl.java

@@ -0,0 +1,136 @@
+package com.ruoyi.biz.service.impl;
+
+import com.ruoyi.biz.domain.TwinEmp;
+import com.ruoyi.biz.domain.TwinEmpDetail;
+import com.ruoyi.biz.mapper.TwinEmpMapper;
+import com.ruoyi.biz.service.ITwinEmpService;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.utils.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 员工排班Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-12-19
+ */
+@Service
+public class TwinEmpServiceImpl implements ITwinEmpService {
+    @Resource
+    private TwinEmpMapper twinEmpMapper;
+
+    /**
+     * 查询员工排班
+     *
+     * @param empId 员工排班主键
+     * @return 员工排班
+     */
+    @Override
+    public TwinEmp selectTwinEmpByEmpId(Long empId) {
+        TwinEmp twinEmp = twinEmpMapper.selectTwinEmpByEmpId(empId);
+        List<TwinEmpDetail> listA = twinEmp.getTwinEmpDetailList().stream().filter(d -> "A".equals(d.getEmpTeam())).collect(Collectors.toList());
+        List<TwinEmpDetail> listB = twinEmp.getTwinEmpDetailList().stream().filter(d -> "B".equals(d.getEmpTeam())).collect(Collectors.toList());
+        twinEmp.setTwinEmpDetailListA(listA);
+        twinEmp.setTwinEmpDetailListB(listB);
+        return twinEmp;
+    }
+
+    /**
+     * 查询员工排班列表
+     *
+     * @param twinEmp 员工排班
+     * @return 员工排班
+     */
+    @Override
+    public List<TwinEmp> selectTwinEmpList(TwinEmp twinEmp) {
+        return twinEmpMapper.selectTwinEmpList(twinEmp);
+    }
+
+    /**
+     * 新增员工排班
+     *
+     * @param twinEmp 员工排班
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int insertTwinEmp(TwinEmp twinEmp) {
+        int rows = twinEmpMapper.insertTwinEmp(twinEmp);
+        insertTwinEmpDetail(twinEmp);
+        return rows;
+    }
+
+    /**
+     * 修改员工排班
+     *
+     * @param twinEmp 员工排班
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int updateTwinEmp(TwinEmp twinEmp) {
+        twinEmpMapper.deleteTwinEmpDetailByEmpId(twinEmp.getEmpId());
+        insertTwinEmpDetail(twinEmp);
+        return twinEmpMapper.updateTwinEmp(twinEmp);
+    }
+
+    /**
+     * 批量删除员工排班
+     *
+     * @param empIds 需要删除的员工排班主键
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int deleteTwinEmpByEmpIds(String empIds) {
+        twinEmpMapper.deleteTwinEmpDetailByEmpIds(Convert.toStrArray(empIds));
+        return twinEmpMapper.deleteTwinEmpByEmpIds(Convert.toStrArray(empIds));
+    }
+
+    /**
+     * 删除员工排班信息
+     *
+     * @param empId 员工排班主键
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int deleteTwinEmpByEmpId(Long empId) {
+        twinEmpMapper.deleteTwinEmpDetailByEmpId(empId);
+        return twinEmpMapper.deleteTwinEmpByEmpId(empId);
+    }
+
+    /**
+     * 新增员工排班明细信息
+     *
+     * @param twinEmp 员工排班对象
+     */
+    public void insertTwinEmpDetail(TwinEmp twinEmp) {
+        List<TwinEmpDetail> twinEmpDetailList = new ArrayList<>();
+        twinEmp.getTwinEmpDetailListA().forEach(d -> {
+            d.setEmpTeam("A");
+            twinEmpDetailList.add(d);
+        });
+        twinEmp.getTwinEmpDetailListB().forEach(d -> {
+            d.setEmpTeam("B");
+            twinEmpDetailList.add(d);
+        });
+        Long empId = twinEmp.getEmpId();
+        if (StringUtils.isNotNull(twinEmpDetailList)) {
+            List<TwinEmpDetail> list = new ArrayList<TwinEmpDetail>();
+            for (TwinEmpDetail twinEmpDetail : twinEmpDetailList) {
+                twinEmpDetail.setEmpId(empId);
+                list.add(twinEmpDetail);
+            }
+            if (list.size() > 0) {
+                twinEmpMapper.batchTwinEmpDetail(list);
+            }
+        }
+    }
+}

+ 93 - 0
ruoyi-admin/src/main/resources/mapper/biz/TwinEmpMapper.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.biz.mapper.TwinEmpMapper">
+
+    <resultMap type="TwinEmp" id="TwinEmpResult">
+        <result property="empId"    column="EMP_ID"    />
+        <result property="empDate"    column="EMP_DATE"    />
+    </resultMap>
+
+    <resultMap id="TwinEmpTwinEmpDetailResult" type="TwinEmp" extends="TwinEmpResult">
+        <collection property="twinEmpDetailList" notNullColumn="sub_DETAIL_ID" javaType="java.util.List" resultMap="TwinEmpDetailResult" />
+    </resultMap>
+
+    <resultMap type="TwinEmpDetail" id="TwinEmpDetailResult">
+        <result property="detailId"    column="sub_DETAIL_ID"    />
+        <result property="empId"    column="sub_EMP_ID"    />
+        <result property="empName"    column="sub_EMP_NAME"    />
+        <result property="empTeam"    column="sub_EMP_TEAM"    />
+        <result property="devices"    column="sub_DEVICES"    />
+        <result property="remark"    column="sub_REMARK"    />
+    </resultMap>
+
+    <sql id="selectTwinEmpVo">
+        select EMP_ID, EMP_DATE from twin_emp
+    </sql>
+
+    <select id="selectTwinEmpList" parameterType="TwinEmp" resultMap="TwinEmpResult">
+        <include refid="selectTwinEmpVo"/>
+        <where>
+            <if test="empDate != null "> and EMP_DATE = #{empDate}</if>
+        </where>
+        order by emp_date desc
+    </select>
+
+    <select id="selectTwinEmpByEmpId" parameterType="Long" resultMap="TwinEmpTwinEmpDetailResult">
+        select a.EMP_ID, a.EMP_DATE,
+ b.DETAIL_ID as sub_DETAIL_ID, b.EMP_ID as sub_EMP_ID, b.EMP_NAME as sub_EMP_NAME, b.EMP_TEAM as sub_EMP_TEAM, b.DEVICES as sub_DEVICES, b.REMARK as sub_REMARK
+        from twin_emp a
+        left join twin_emp_detail b on b.EMP_ID = a.EMP_ID
+        where a.EMP_ID = #{empId}
+        order by b.DETAIL_ID
+    </select>
+
+    <insert id="insertTwinEmp" parameterType="TwinEmp" useGeneratedKeys="true" keyProperty="empId">
+        insert into twin_emp
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="empDate != null">EMP_DATE,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="empDate != null">#{empDate},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTwinEmp" parameterType="TwinEmp">
+        update twin_emp
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="empDate != null">EMP_DATE = #{empDate},</if>
+        </trim>
+        where EMP_ID = #{empId}
+    </update>
+
+    <delete id="deleteTwinEmpByEmpId" parameterType="Long">
+        delete from twin_emp where EMP_ID = #{empId}
+    </delete>
+
+    <delete id="deleteTwinEmpByEmpIds" parameterType="String">
+        delete from twin_emp where EMP_ID in
+        <foreach item="empId" collection="array" open="(" separator="," close=")">
+            #{empId}
+        </foreach>
+    </delete>
+
+    <delete id="deleteTwinEmpDetailByEmpIds" parameterType="String">
+        delete from twin_emp_detail where EMP_ID in
+        <foreach item="empId" collection="array" open="(" separator="," close=")">
+            #{empId}
+        </foreach>
+    </delete>
+
+    <delete id="deleteTwinEmpDetailByEmpId" parameterType="Long">
+        delete from twin_emp_detail where EMP_ID = #{empId}
+    </delete>
+
+    <insert id="batchTwinEmpDetail">
+        insert into twin_emp_detail( DETAIL_ID, EMP_ID, EMP_NAME, EMP_TEAM, DEVICES, REMARK) values
+		<foreach item="item" index="index" collection="list" separator=",">
+            ( #{item.detailId}, #{item.empId}, #{item.empName}, #{item.empTeam}, #{item.devices}, #{item.remark})
+        </foreach>
+    </insert>
+
+</mapper>

+ 187 - 0
ruoyi-admin/src/main/resources/templates/biz/emp/add.html

@@ -0,0 +1,187 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <th:block th:include="include :: header('新增员工排班')"/>
+    <th:block th:include="include :: datetimepicker-css"/>
+</head>
+<body class="white-bg">
+<div class="wrapper wrapper-content animated fadeInRight ibox-content">
+    <form class="form-horizontal m" id="form-emp-add">
+<!--        <h4 class="form-header h4">员工排班信息</h4>-->
+        <div class="form-group">
+            <label class="col-sm-2 control-label">时间:</label>
+            <div class="col-sm-2">
+                <div class="input-group date">
+                    <input name="empDate" class="form-control" placeholder="yyyy-MM-dd" type="text" th:value="${#dates.format(new java.util.Date(), 'yyyy-MM-dd')}">
+                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                </div>
+            </div>
+        </div>
+        <div class="row">
+            <div class="col-sm-6">
+                <h4 class="form-header h4">员工排班明细(A班)</h4>
+                <button type="button" class="btn btn-white btn-sm" onclick="addRowA()"><i class="fa fa-plus"> 增加</i>
+                </button>
+                <span style="color:red;">多个机台号请使用英文逗号”,“分隔,连续机台号使用”-“,例:1 4 5机台号填写为”1,4,5“,1至12号填写为”1-12",1至12号加36号填写为“1-12,36”</span>
+                <div class="col-sm-6 select-table table-striped">
+                    <table id="bootstrap-table-a"></table>
+                </div>
+            </div>
+            <div class="col-sm-6">
+                <h4 class="form-header h4">员工排班明细(B班)</h4>
+                <button type="button" class="btn btn-white btn-sm" onclick="addRowB()"><i class="fa fa-plus"> 增加</i>
+                </button>
+                <span style="color:red;">多个机台号请使用英文逗号”,“分隔,连续机台号使用”-“,例:1 4 5机台号填写为”1,4,5“,1至12号填写为”1-12",1至12号加36号填写为“1-12,36”</span>
+                <div class="col-sm-6 select-table table-striped">
+                    <table id="bootstrap-table-b"></table>
+                </div>
+            </div>
+        </div>
+    </form>
+</div>
+<th:block th:include="include :: footer"/>
+<th:block th:include="include :: datetimepicker-js"/>
+<script th:inline="javascript">
+    var prefix = ctx + "biz/emp"
+    $("#form-emp-add").validate({
+        focusCleanup: true
+    });
+
+    function submitHandler() {
+        if ($.validate.form()) {
+            $.operate.save(prefix + "/add", $('#form-emp-add').serialize());
+        }
+    }
+
+    $("input[name='empDate']").datetimepicker({
+        format: "yyyy-mm-dd",
+        minView: "month",
+        autoclose: true,
+        default: new Date()
+    });
+
+    $(function () {
+        var options = {
+            id: "bootstrap-table-a",
+            pagination: false,
+            showSearch: false,
+            showRefresh: false,
+            showToggle: false,
+            showColumns: false,
+            sidePagination: "client",
+            columns: [
+                {
+                    field: 'index',
+                    align: 'center',
+                    title: "序号",
+                    formatter: function (value, row, index) {
+                        var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
+                        return columnIndex + $.table.serialNumber(index);
+                    }
+                },
+                {
+                    field: 'empName',
+                    align: 'center',
+                    title: '姓名',
+                    formatter: function (value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinEmpDetailListA[%s].empName' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'devices',
+                    align: 'center',
+                    title: '机台号',
+                    formatter: function (value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinEmpDetailListA[%s].devices' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function (value, row, index) {
+                        var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
+                        return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
+                    }
+                }]
+        };
+        $.table.init(options);
+
+        let b_options = {
+            id: "bootstrap-table-b",
+            pagination: false,
+            showSearch: false,
+            showRefresh: false,
+            showToggle: false,
+            showColumns: false,
+            sidePagination: "client",
+            columns: [
+                {
+                    field: 'index',
+                    align: 'center',
+                    title: "序号",
+
+                    formatter: function (value, row, index) {
+                        var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
+                        return columnIndex + $.table.serialNumber(index);
+                    }
+                },
+                {
+                    field: 'empName',
+                    align: 'center',
+                    title: '姓名',
+                    formatter: function (value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinEmpDetailListB[%s].empName' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'devices',
+                    align: 'center',
+                    title: '机台号',
+                    formatter: function (value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinEmpDetailListB[%s].devices' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function (value, row, index) {
+                        var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
+                        return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
+                    }
+                }]
+        };
+        $.table.init(b_options);
+    });
+
+    function addRowA() {
+        table.set('bootstrap-table-a');
+        var count = $("#" + table.options.id).bootstrapTable('getData').length;
+        var row = {
+            index: $.table.serialNumber(count),
+            empName: "",
+            empTeam: "A",
+            devices: "",
+            remark: "",
+        }
+        sub.addRow(row);
+    }
+
+    function addRowB() {
+        table.set('bootstrap-table-b');
+        var count = $("#" + table.options.id).bootstrapTable('getData').length;
+        var row = {
+            index: $.table.serialNumber(count),
+            empName: "",
+            empTeam: "B",
+            devices: "",
+            remark: "",
+        }
+        sub.addRow(row);
+    }
+</script>
+</body>
+</html>

+ 185 - 0
ruoyi-admin/src/main/resources/templates/biz/emp/edit.html

@@ -0,0 +1,185 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('修改员工排班')" />
+    <th:block th:include="include :: datetimepicker-css" />
+</head>
+<body class="white-bg">
+    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
+        <form class="form-horizontal m" id="form-emp-edit" th:object="${twinEmp}">
+<!--            <h4 class="form-header h4">员工排班信息</h4>-->
+            <input name="empId" th:field="*{empId}" type="hidden">
+            <div class="form-group">
+                <label class="col-sm-2 control-label">时间:</label>
+                <div class="col-sm-2">
+                    <div class="input-group date">
+                        <input name="empDate" th:value="${#dates.format(twinEmp.empDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                    </div>
+                </div>
+            </div>
+            <div class="col-sm-6">
+                <h4 class="form-header h4">员工排班明细(A班)</h4>
+                <button type="button" class="btn btn-white btn-sm" onclick="addRowA()"><i class="fa fa-plus"> 增加</i>
+                </button>
+                <span style="color:red;">多个机台号请使用英文逗号”,“分隔,连续机台号使用”-“,例:1 4 5机台号填写为”1,4,5“,1至12号填写为”1-12",1至12号加36号填写为“1-12,36”</span>
+                <div class="col-sm-6 select-table table-striped">
+                    <table id="bootstrap-table-a"></table>
+                </div>
+            </div>
+            <div class="col-sm-6">
+                <h4 class="form-header h4">员工排班明细(B班)</h4>
+                <button type="button" class="btn btn-white btn-sm" onclick="addRowB()"><i class="fa fa-plus"> 增加</i>
+                </button>
+                <span style="color:red;">多个机台号请使用英文逗号”,“分隔,连续机台号使用”-“,例:1 4 5机台号填写为”1,4,5“,1至12号填写为”1-12",1至12号加36号填写为“1-12,36”</span>
+                <div class="col-sm-6 select-table table-striped">
+                    <table id="bootstrap-table-b"></table>
+                </div>
+            </div>
+        </form>
+    </div>
+    <th:block th:include="include :: footer" />
+    <th:block th:include="include :: datetimepicker-js" />
+    <script th:inline="javascript">
+        var prefix = ctx + "biz/emp";
+        $("#form-emp-edit").validate({
+            focusCleanup: true
+        });
+
+        function submitHandler() {
+            if ($.validate.form()) {
+                $.operate.save(prefix + "/edit", $('#form-emp-edit').serialize());
+            }
+        }
+
+        $("input[name='empDate']").datetimepicker({
+            format: "yyyy-mm-dd",
+            minView: "month",
+            autoclose: true
+        });
+
+        $(function() {
+            let options = {
+                id: "bootstrap-table-a",
+                data: [[${twinEmp.twinEmpDetailListA}]],
+                pagination: false,
+                showSearch: false,
+                showRefresh: false,
+                showToggle: false,
+                showColumns: false,
+                sidePagination: "client",
+                columns: [
+                {
+                    field: 'index',
+                    align: 'center',
+                    title: "序号",
+                    formatter: function (value, row, index) {
+                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
+                    	return columnIndex + $.table.serialNumber(index);
+                    }
+                },
+                {
+                    field: 'empName',
+                    align: 'center',
+                    title: '姓名',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinEmpDetailListA[%s].empName' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'devices',
+                    align: 'center',
+                    title: '机台号',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinEmpDetailListA[%s].devices' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function(value, row, index) {
+                        var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
+                        return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
+                    }
+                }]
+            };
+            $.table.init(options);
+            let b_options = {
+                id: "bootstrap-table-b",
+                data: [[${twinEmp.twinEmpDetailListB}]],
+                pagination: false,
+                showSearch: false,
+                showRefresh: false,
+                showToggle: false,
+                showColumns: false,
+                sidePagination: "client",
+                columns: [
+                    {
+                        field: 'index',
+                        align: 'center',
+                        title: "序号",
+                        formatter: function (value, row, index) {
+                            var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
+                            return columnIndex + $.table.serialNumber(index);
+                        }
+                    },
+                    {
+                        field: 'empName',
+                        align: 'center',
+                        title: '姓名',
+                        formatter: function(value, row, index) {
+                            var html = $.common.sprintf("<input class='form-control' type='text' name='twinEmpDetailListB[%s].empName' value='%s'>", index, value);
+                            return html;
+                        }
+                    },
+                    {
+                        field: 'devices',
+                        align: 'center',
+                        title: '机台号',
+                        formatter: function(value, row, index) {
+                            var html = $.common.sprintf("<input class='form-control' type='text' name='twinEmpDetailListB[%s].devices' value='%s'>", index, value);
+                            return html;
+                        }
+                    },
+                    {
+                        title: '操作',
+                        align: 'center',
+                        formatter: function(value, row, index) {
+                            var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
+                            return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
+                        }
+                    }]
+            };
+            $.table.init(b_options);
+        });
+
+        function addRowA() {
+            table.set('bootstrap-table-a');
+            var count = $("#" + table.options.id).bootstrapTable('getData').length;
+            var row = {
+                index: $.table.serialNumber(count),
+                empName: "",
+                empTeam: "A",
+                devices: "",
+                remark: "",
+            }
+            sub.addRow(row);
+        }
+
+        function addRowB() {
+            table.set('bootstrap-table-b');
+            var count = $("#" + table.options.id).bootstrapTable('getData').length;
+            var row = {
+                index: $.table.serialNumber(count),
+                empName: "",
+                empTeam: "B",
+                devices: "",
+                remark: "",
+            }
+            sub.addRow(row);
+        }
+    </script>
+</body>
+</html>

+ 86 - 0
ruoyi-admin/src/main/resources/templates/biz/emp/emp.html

@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+    <th:block th:include="include :: header('员工排班列表')" />
+</head>
+<body class="gray-bg">
+     <div class="container-div">
+        <div class="row">
+            <div class="col-sm-12 search-collapse">
+                <form id="formId">
+                    <div class="select-list">
+                        <ul>
+                            <li>
+                                <label>时间:</label>
+                                <input type="text" class="time-input" placeholder="请选择时间" name="empDate"/>
+                            </li>
+                            <li>
+                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
+                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
+                            </li>
+                        </ul>
+                    </div>
+                </form>
+            </div>
+
+            <div class="btn-group-sm" id="toolbar" role="group">
+                <a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="biz:emp:add">
+                    <i class="fa fa-plus"></i> 添加
+                </a>
+                <a class="btn btn-primary single disabled" onclick="$.operate.editFull()" shiro:hasPermission="biz:emp:edit">
+                    <i class="fa fa-edit"></i> 修改
+                </a>
+                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="biz:emp:remove">
+                    <i class="fa fa-remove"></i> 删除
+                </a>
+                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="biz:emp:export">
+                    <i class="fa fa-download"></i> 导出
+                </a>
+            </div>
+            <div class="col-sm-12 select-table table-striped">
+                <table id="bootstrap-table"></table>
+            </div>
+        </div>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+        var editFlag = [[${@permission.hasPermi('biz:emp:edit')}]];
+        var removeFlag = [[${@permission.hasPermi('biz:emp:remove')}]];
+        var prefix = ctx + "biz/emp";
+
+        $(function() {
+            var options = {
+                url: prefix + "/list",
+                createUrl: prefix + "/add",
+                updateUrl: prefix + "/edit/{id}",
+                removeUrl: prefix + "/remove",
+                exportUrl: prefix + "/export",
+                modalName: "员工排班",
+                columns: [{
+                    checkbox: true
+                },
+                {
+                    field: 'empId',
+                    title: '排班ID',
+                    visible: false
+                },
+                {
+                    field: 'empDate',
+                    title: '时间'
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function(value, row, index) {
+                        var actions = [];
+                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.empId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.empId + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        return actions.join('');
+                    }
+                }]
+            };
+            $.table.init(options);
+        });
+    </script>
+</body>
+</html>

TEMPAT SAMPAH
ruoyi-admin/src/main/resources/tpl/productivity-day.xlsx