Merge remote-tracking branch 'origin/feature-20240104' into feature-20240104
commit
c4f8888843
@ -0,0 +1,30 @@
|
||||
package com.flossom.common.core.enums;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @author flossom
|
||||
*/
|
||||
public enum ClockStatus
|
||||
{
|
||||
OK(1, "正常"), DISABLE(0, "关闭");
|
||||
|
||||
private final Integer code;
|
||||
private final String info;
|
||||
|
||||
ClockStatus(Integer code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public Integer getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.flossom.common.core.mapper;
|
||||
|
||||
import com.flossom.common.core.domain.entity.IntegralClock;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 打卡奖励积分Mapper接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2024-01-25
|
||||
*/
|
||||
public interface IntegralClockMapper
|
||||
{
|
||||
/**
|
||||
* 查询打卡奖励积分
|
||||
*
|
||||
* @param id 打卡奖励积分主键
|
||||
* @return 打卡奖励积分
|
||||
*/
|
||||
public IntegralClock selectIntegralClockById(Long id);
|
||||
|
||||
/**
|
||||
* 查询打卡奖励积分列表
|
||||
*
|
||||
* @param integralClock 打卡奖励积分
|
||||
* @return 打卡奖励积分集合
|
||||
*/
|
||||
public List<IntegralClock> selectIntegralClockList(IntegralClock integralClock);
|
||||
|
||||
/**
|
||||
* 新增打卡奖励积分
|
||||
*
|
||||
* @param integralClock 打卡奖励积分
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertIntegralClock(IntegralClock integralClock);
|
||||
|
||||
/**
|
||||
* 修改打卡奖励积分
|
||||
*
|
||||
* @param integralClock 打卡奖励积分
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateIntegralClock(IntegralClock integralClock);
|
||||
|
||||
/**
|
||||
* 删除打卡奖励积分
|
||||
*
|
||||
* @param id 打卡奖励积分主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteIntegralClockById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除打卡奖励积分
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteIntegralClockByIds(Long[] ids);
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
<?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.flossom.common.core.mapper.IntegralClockMapper">
|
||||
|
||||
<resultMap type="IntegralClock" id="IntegralClockResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="dailyClockCredit" column="daily_clock_credit" />
|
||||
<result property="isExtraClock" column="is_extra_clock" />
|
||||
<result property="extraClockCredit" column="extra_clock_credit" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectIntegralClockVo">
|
||||
select id, daily_clock_credit, is_extra_clock, extra_clock_credit, start_time, end_time, status, create_by, create_time, update_by, update_time, remark from integral_clock
|
||||
</sql>
|
||||
|
||||
<select id="selectIntegralClockList" parameterType="IntegralClock" resultMap="IntegralClockResult">
|
||||
<include refid="selectIntegralClockVo"/>
|
||||
<where>
|
||||
<if test="dailyClockCredit != null "> and daily_clock_credit = #{dailyClockCredit}</if>
|
||||
<if test="isExtraClock != null "> and is_extra_clock = #{isExtraClock}</if>
|
||||
<if test="extraClockCredit != null "> and extra_clock_credit = #{extraClockCredit}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectIntegralClockById" parameterType="Long" resultMap="IntegralClockResult">
|
||||
<include refid="selectIntegralClockVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertIntegralClock" parameterType="IntegralClock" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into integral_clock
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dailyClockCredit != null">daily_clock_credit,</if>
|
||||
<if test="isExtraClock != null">is_extra_clock,</if>
|
||||
<if test="extraClockCredit != null">extra_clock_credit,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dailyClockCredit != null">#{dailyClockCredit},</if>
|
||||
<if test="isExtraClock != null">#{isExtraClock},</if>
|
||||
<if test="extraClockCredit != null">#{extraClockCredit},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateIntegralClock" parameterType="IntegralClock">
|
||||
update integral_clock
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dailyClockCredit != null">daily_clock_credit = #{dailyClockCredit},</if>
|
||||
<if test="isExtraClock != null">is_extra_clock = #{isExtraClock},</if>
|
||||
<if test="extraClockCredit != null">extra_clock_credit = #{extraClockCredit},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteIntegralClockById" parameterType="Long">
|
||||
delete from integral_clock where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteIntegralClockByIds" parameterType="String">
|
||||
delete from integral_clock where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -0,0 +1,117 @@
|
||||
package com.flossom.system.controller;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.flossom.common.core.domain.entity.IntegralClock;
|
||||
import com.flossom.common.core.utils.poi.ExcelUtil;
|
||||
import com.flossom.common.core.web.controller.BaseController;
|
||||
import com.flossom.common.core.web.domain.AjaxResult;
|
||||
import com.flossom.common.core.web.page.TableDataInfo;
|
||||
import com.flossom.common.log.annotation.Log;
|
||||
import com.flossom.common.log.enums.BusinessType;
|
||||
import com.flossom.common.security.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.flossom.system.service.IIntegralClockService;
|
||||
|
||||
/**
|
||||
* 打卡奖励积分Controller
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2024-01-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/clockIntegral")
|
||||
public class IntegralClockController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IIntegralClockService integralClockService;
|
||||
|
||||
/**
|
||||
* 查询打卡奖励积分列表
|
||||
*/
|
||||
@RequiresPermissions("system:clockIntegral:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(IntegralClock integralClock)
|
||||
{
|
||||
startPage();
|
||||
List<IntegralClock> list = integralClockService.selectIntegralClockList(integralClock);
|
||||
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
for (IntegralClock clock:list) {
|
||||
if (Objects.nonNull(clock.getStartTime())) {
|
||||
clock.getTimeRange().add(sd.format(clock.getStartTime()));
|
||||
}
|
||||
if (Objects.nonNull(clock.getEndTime())) {
|
||||
clock.getTimeRange().add(sd.format(clock.getEndTime()));
|
||||
}
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出打卡奖励积分列表
|
||||
*/
|
||||
@RequiresPermissions("system:clockIntegral:export")
|
||||
@Log(title = "打卡奖励积分", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, IntegralClock integralClock)
|
||||
{
|
||||
List<IntegralClock> list = integralClockService.selectIntegralClockList(integralClock);
|
||||
ExcelUtil<IntegralClock> util = new ExcelUtil<IntegralClock>(IntegralClock.class);
|
||||
util.exportExcel(response, list, "打卡奖励积分数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取打卡奖励积分详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:clockIntegral:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(integralClockService.selectIntegralClockById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增打卡奖励积分
|
||||
*/
|
||||
@RequiresPermissions("system:clockIntegral:add")
|
||||
@Log(title = "打卡奖励积分", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody IntegralClock integralClock)
|
||||
{
|
||||
return toAjax(integralClockService.insertIntegralClock(integralClock));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改打卡奖励积分
|
||||
*/
|
||||
@RequiresPermissions("system:clockIntegral:edit")
|
||||
@Log(title = "打卡奖励积分", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody IntegralClock integralClock)
|
||||
{
|
||||
return toAjax(integralClockService.updateIntegralClock(integralClock));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除打卡奖励积分
|
||||
*/
|
||||
@RequiresPermissions("system:clockIntegral:remove")
|
||||
@Log(title = "打卡奖励积分", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(integralClockService.deleteIntegralClockByIds(ids));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.flossom.system.service;
|
||||
|
||||
import com.flossom.common.core.domain.entity.IntegralClock;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 打卡奖励积分Service接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2024-01-25
|
||||
*/
|
||||
public interface IIntegralClockService
|
||||
{
|
||||
/**
|
||||
* 查询打卡奖励积分
|
||||
*
|
||||
* @param id 打卡奖励积分主键
|
||||
* @return 打卡奖励积分
|
||||
*/
|
||||
public IntegralClock selectIntegralClockById(Long id);
|
||||
|
||||
/**
|
||||
* 查询打卡奖励积分列表
|
||||
*
|
||||
* @param integralClock 打卡奖励积分
|
||||
* @return 打卡奖励积分集合
|
||||
*/
|
||||
public List<IntegralClock> selectIntegralClockList(IntegralClock integralClock);
|
||||
|
||||
/**
|
||||
* 新增打卡奖励积分
|
||||
*
|
||||
* @param integralClock 打卡奖励积分
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertIntegralClock(IntegralClock integralClock);
|
||||
|
||||
/**
|
||||
* 修改打卡奖励积分
|
||||
*
|
||||
* @param integralClock 打卡奖励积分
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateIntegralClock(IntegralClock integralClock);
|
||||
|
||||
/**
|
||||
* 批量删除打卡奖励积分
|
||||
*
|
||||
* @param ids 需要删除的打卡奖励积分主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteIntegralClockByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除打卡奖励积分信息
|
||||
*
|
||||
* @param id 打卡奖励积分主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteIntegralClockById(Long id);
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
package com.flossom.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.flossom.common.core.domain.entity.IntegralClock;
|
||||
import com.flossom.common.core.enums.ClockStatus;
|
||||
import com.flossom.common.core.mapper.IntegralClockMapper;
|
||||
import com.flossom.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.flossom.system.service.IIntegralClockService;
|
||||
|
||||
/**
|
||||
* 打卡奖励积分Service业务层处理
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2024-01-25
|
||||
*/
|
||||
@Service
|
||||
public class IntegralClockServiceImpl implements IIntegralClockService
|
||||
{
|
||||
@Autowired
|
||||
private IntegralClockMapper integralClockMapper;
|
||||
|
||||
/**
|
||||
* 查询打卡奖励积分
|
||||
*
|
||||
* @param id 打卡奖励积分主键
|
||||
* @return 打卡奖励积分
|
||||
*/
|
||||
@Override
|
||||
public IntegralClock selectIntegralClockById(Long id)
|
||||
{
|
||||
return integralClockMapper.selectIntegralClockById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询打卡奖励积分列表
|
||||
*
|
||||
* @param integralClock 打卡奖励积分
|
||||
* @return 打卡奖励积分
|
||||
*/
|
||||
@Override
|
||||
public List<IntegralClock> selectIntegralClockList(IntegralClock integralClock)
|
||||
{
|
||||
return integralClockMapper.selectIntegralClockList(integralClock);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增打卡奖励积分
|
||||
*
|
||||
* @param integralClock 打卡奖励积分
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertIntegralClock(IntegralClock integralClock)
|
||||
{
|
||||
integralClock.setCreateTime(DateUtils.getNowDate());
|
||||
return integralClockMapper.insertIntegralClock(integralClock);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改打卡奖励积分
|
||||
*
|
||||
* @param integralClock 打卡奖励积分
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateIntegralClock(IntegralClock integralClock)
|
||||
{
|
||||
integralClock.setUpdateTime(DateUtils.getNowDate());
|
||||
// if (ClockStatus.DISABLE.getCode() == integralClock.getIsExtraClock().intValue()) {
|
||||
// // 当操作关闭的时候,把其他数据关联数据清空
|
||||
// integralClock.setExtraClockCredit();
|
||||
// }
|
||||
return integralClockMapper.updateIntegralClock(integralClock);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除打卡奖励积分
|
||||
*
|
||||
* @param ids 需要删除的打卡奖励积分主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteIntegralClockByIds(Long[] ids)
|
||||
{
|
||||
return integralClockMapper.deleteIntegralClockByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除打卡奖励积分信息
|
||||
*
|
||||
* @param id 打卡奖励积分主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteIntegralClockById(Long id)
|
||||
{
|
||||
return integralClockMapper.deleteIntegralClockById(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询打卡奖励积分列表
|
||||
export function listClock(query) {
|
||||
return request({
|
||||
url: '/system/clockIntegral/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询打卡奖励积分详细
|
||||
export function getClock(id) {
|
||||
return request({
|
||||
url: '/system/clockIntegral/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增打卡奖励积分
|
||||
export function addClock(data) {
|
||||
return request({
|
||||
url: '/system/clockIntegral',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改打卡奖励积分
|
||||
export function updateClock(data) {
|
||||
return request({
|
||||
url: '/system/clockIntegral',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除打卡奖励积分
|
||||
export function delClock(id) {
|
||||
return request({
|
||||
url: '/system/clockIntegral/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,218 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
|
||||
<el-form-item label="日常打卡奖励:" prop="dailyClockCredit">
|
||||
<el-input v-model="form.dailyClockCredit" placeholder="请输入日常打卡奖励" style="width: 25%;"/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="额外打卡奖励"
|
||||
prop="isExtraClock"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-switch v-model="form.isExtraClock"> </el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="额外打卡奖励积分:" prop="extraClockCredit" v-if="form.isExtraClock">
|
||||
<el-input v-model="form.extraClockCredit" placeholder="请输入额外打卡奖励积分" style="width: 25%;"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="额外打卡时间段:" prop="timeRange" label-width="150px" v-if="form.isExtraClock">
|
||||
<el-date-picker
|
||||
v-model="form.timeRange"
|
||||
type="datetimerange"
|
||||
value-format="yyyy-MM-dd HH:mm"
|
||||
format="yyyy-MM-dd HH:mm"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="margin-left: 70%" >
|
||||
<el-button type="primary" @click="submitForm">提 交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listClock, getClock, delClock, addClock, updateClock } from "@/api/system/clockIntegral";
|
||||
|
||||
export default {
|
||||
name: "Clock",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 打卡奖励积分表格数据
|
||||
clockList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
dailyClockCredit: null,
|
||||
isExtraClock: null,
|
||||
extraClockCredit: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
status: null,
|
||||
timeRange:null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
dailyClockCredit: [
|
||||
{ required: true, message: "日常打卡奖励不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询打卡奖励积分列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listClock(this.queryParams).then(response => {
|
||||
this.form = response.rows.length >0 ? response.rows[0]: {};
|
||||
if (this.form.isExtraClock == 1) {
|
||||
this.form.isExtraClock = true;
|
||||
} else {
|
||||
this.form.isExtraClock = false;
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
dailyClockCredit: null,
|
||||
isExtraClock: null,
|
||||
extraClockCredit: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
status: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
remark: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加打卡奖励积分";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getClock(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改打卡奖励积分";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
const regex = /[^0-9]/g;
|
||||
if (regex.test(this.form.dailyClockCredit)) {
|
||||
this.$modal.msgError("日常打卡奖励积分仅能输入数字");
|
||||
return;
|
||||
}
|
||||
if (this.form.isExtraClock) {
|
||||
if (regex.test(this.form.extraClockCredit)) {
|
||||
this.$modal.msgError("额外打卡奖励积分仅能输入数字");
|
||||
return;
|
||||
}
|
||||
if (!this.form.extraClockCredit) {
|
||||
this.$modal.msgError("积分不能为空");
|
||||
return;
|
||||
}
|
||||
if (this.form.timeRange && this.form.timeRange.length > 0) {
|
||||
this.form.startTime = this.form.timeRange[0]
|
||||
this.form.endTime = this.form.timeRange[1]
|
||||
} else {
|
||||
this.$modal.msgError("打卡时间不能为空");
|
||||
return;
|
||||
}
|
||||
this.form.isExtraClock = 1;
|
||||
} else {
|
||||
this.form.isExtraClock = 0;
|
||||
}
|
||||
if (this.form.id != null) {
|
||||
updateClock(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addClock(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除打卡奖励积分编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delClock(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/clock/export', {
|
||||
...this.queryParams
|
||||
}, `clock_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue