From 989b55ce011c7f296e9a5b9a048bf4c539083553 Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Thu, 22 Dec 2022 03:28:01 +0000
Subject: [PATCH] 用户级别工资
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelWageServiceImpl.java | 125 +++++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserLevelWage.java | 98 +++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageDto.java | 66 +++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java | 37 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelWageService.java | 83 ++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysLevelServiceImpl.java | 39 +-
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelWageController.java | 87 +++++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserLevelWageMapper.java | 32 +
eladmin-web-master/src/api/sysUserLevelWage.js | 27 +
eladmin-web-master/src/views/system/user/index.vue | 107 ++++--
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserDto.java | 2
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageQueryCriteria.java | 37 ++
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java | 5
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java | 73 ++++
eladmin-web-master/src/views/system/userLevelWage/index.vue | 149 ++++++++
15 files changed, 912 insertions(+), 55 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserLevelWage.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserLevelWage.java
new file mode 100644
index 0000000..8cca448
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysUserLevelWage.java
@@ -0,0 +1,98 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.domain;
+
+import lombok.Data;
+import cn.hutool.core.bean.BeanUtil;
+import io.swagger.annotations.ApiModelProperty;
+import cn.hutool.core.bean.copier.CopyOptions;
+import me.zhengjie.base.BaseEntity;
+
+import javax.persistence.*;
+import javax.validation.constraints.*;
+import java.sql.Timestamp;
+import java.math.BigDecimal;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author 赵士淞
+* @date 2022-12-19
+**/
+@Entity
+@Data
+@Table(name="sys_user_level_wage")
+public class SysUserLevelWage extends BaseEntity implements Serializable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "`id`")
+ @ApiModelProperty(value = "ID")
+ private Long id;
+
+ @Column(name = "`user_id`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "用户ID")
+ private Long userId;
+
+ @Column(name = "`level_id`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "级别ID")
+ private Long levelId;
+
+ @Column(name = "`start_date`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "开始日期")
+ private Timestamp startDate;
+
+ @Column(name = "`end_date`")
+ @ApiModelProperty(value = "结束日期")
+ private Timestamp endDate;
+
+ @Column(name = "`level_wage`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "级别工资")
+ private BigDecimal levelWage;
+
+ @Column(name = "`basic_wage_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "基本工资比例")
+ private Double basicWageProportion;
+
+ @Column(name = "`achievements_wage_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "绩效工资比例")
+ private Double achievementsWageProportion;
+
+ @Column(name = "`performance_wage_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "业绩工资比例")
+ private Double performanceWageProportion;
+
+ @Column(name = "`team_wage_proportion`",nullable = false)
+ @NotNull
+ @ApiModelProperty(value = "团队工资比例")
+ private Double teamWageProportion;
+
+ @Column(name = "`remarks`")
+ @ApiModelProperty(value = "备注")
+ private String remarks;
+
+ public void copy(SysUserLevelWage source){
+ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
+ }
+}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java
index d75b365..9ee29e8 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java
@@ -100,6 +100,11 @@
@ApiModelProperty(value = "排班")
private SysRostering sysRostering;
+ @NotBlank
+ @JoinColumn(name = "level_id")
+ @ApiModelProperty(value = "级别ID")
+ private Long levelId;
+
@ApiModelProperty(value = "用户性别")
private String gender;
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java
new file mode 100644
index 0000000..0ded7bc
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java
@@ -0,0 +1,37 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.repository;
+
+import me.zhengjie.modules.system.domain.SysUserLevelWage;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2022-12-19
+**/
+public interface SysUserLevelWageRepository extends JpaRepository<SysUserLevelWage, Long>, JpaSpecificationExecutor<SysUserLevelWage> {
+
+ /**
+ * 根据用户ID查询最新记录
+ * @param userId /
+ * @return /
+ */
+ @Query(value = "SELECT * FROM sys_user_level_wage WHERE user_id = ?1 ORDER BY start_date DESC, create_time DESC LIMIT 1", nativeQuery = true)
+ SysUserLevelWage findLastByUserId(Long userId);
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelWageController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelWageController.java
new file mode 100644
index 0000000..3463076
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysUserLevelWageController.java
@@ -0,0 +1,87 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.rest;
+
+import me.zhengjie.annotation.Log;
+import me.zhengjie.modules.system.domain.SysUserLevelWage;
+import me.zhengjie.modules.system.service.SysUserLevelWageService;
+import me.zhengjie.modules.system.service.dto.SysUserLevelWageQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.*;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2022-12-19
+**/
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "用户级别工资管理")
+@RequestMapping("/api/sysUserLevelWage")
+public class SysUserLevelWageController {
+
+ private final SysUserLevelWageService sysUserLevelWageService;
+
+ @Log("导出数据")
+ @ApiOperation("导出数据")
+ @GetMapping(value = "/download")
+ @PreAuthorize("@el.check('sysUserLevelWage:download')")
+ public void exportSysUserLevelWage(HttpServletResponse response, SysUserLevelWageQueryCriteria criteria) throws IOException {
+ sysUserLevelWageService.download(sysUserLevelWageService.queryAll(criteria), response);
+ }
+
+ @GetMapping
+ @Log("查询用户级别工资")
+ @ApiOperation("查询用户级别工资")
+ @PreAuthorize("@el.check('sysUserLevelWage:list')")
+ public ResponseEntity<Object> querySysUserLevelWage(SysUserLevelWageQueryCriteria criteria, Pageable pageable){
+ return new ResponseEntity<>(sysUserLevelWageService.queryAll(criteria,pageable),HttpStatus.OK);
+ }
+
+ @PostMapping
+ @Log("新增用户级别工资")
+ @ApiOperation("新增用户级别工资")
+ @PreAuthorize("@el.check('sysUserLevelWage:add')")
+ public ResponseEntity<Object> createSysUserLevelWage(@Validated @RequestBody SysUserLevelWage resources){
+ return new ResponseEntity<>(sysUserLevelWageService.create(resources),HttpStatus.CREATED);
+ }
+
+ @PutMapping
+ @Log("修改用户级别工资")
+ @ApiOperation("修改用户级别工资")
+ @PreAuthorize("@el.check('sysUserLevelWage:edit')")
+ public ResponseEntity<Object> updateSysUserLevelWage(@Validated @RequestBody SysUserLevelWage resources){
+ sysUserLevelWageService.update(resources);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+
+ @DeleteMapping
+ @Log("删除用户级别工资")
+ @ApiOperation("删除用户级别工资")
+ @PreAuthorize("@el.check('sysUserLevelWage:del')")
+ public ResponseEntity<Object> deleteSysUserLevelWage(@RequestBody Long[] ids) {
+ sysUserLevelWageService.deleteAll(ids);
+ return new ResponseEntity<>(HttpStatus.OK);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelWageService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelWageService.java
new file mode 100644
index 0000000..156e153
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysUserLevelWageService.java
@@ -0,0 +1,83 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.service;
+
+import me.zhengjie.modules.system.domain.SysUserLevelWage;
+import me.zhengjie.modules.system.service.dto.SysUserLevelWageDto;
+import me.zhengjie.modules.system.service.dto.SysUserLevelWageQueryCriteria;
+import org.springframework.data.domain.Pageable;
+import java.util.Map;
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+* @website https://eladmin.vip
+* @description 服务接口
+* @author 赵士淞
+* @date 2022-12-19
+**/
+public interface SysUserLevelWageService {
+
+ /**
+ * 查询数据分页
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map<String,Object>
+ */
+ Map<String,Object> queryAll(SysUserLevelWageQueryCriteria criteria, Pageable pageable);
+
+ /**
+ * 查询所有数据不分页
+ * @param criteria 条件参数
+ * @return List<SysUserLevelWageDto>
+ */
+ List<SysUserLevelWageDto> queryAll(SysUserLevelWageQueryCriteria criteria);
+
+ /**
+ * 根据ID查询
+ * @param id ID
+ * @return SysUserLevelWageDto
+ */
+ SysUserLevelWageDto findById(Long id);
+
+ /**
+ * 创建
+ * @param resources /
+ * @return SysUserLevelWageDto
+ */
+ SysUserLevelWageDto create(SysUserLevelWage resources);
+
+ /**
+ * 编辑
+ * @param resources /
+ */
+ void update(SysUserLevelWage resources);
+
+ /**
+ * 多选删除
+ * @param ids /
+ */
+ void deleteAll(Long[] ids);
+
+ /**
+ * 导出数据
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
+ void download(List<SysUserLevelWageDto> all, HttpServletResponse response) throws IOException;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageDto.java
new file mode 100644
index 0000000..7e57b3f
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageDto.java
@@ -0,0 +1,66 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.service.dto;
+
+import lombok.Data;
+import me.zhengjie.base.BaseDTO;
+
+import java.sql.Timestamp;
+import java.math.BigDecimal;
+import java.io.Serializable;
+
+/**
+* @website https://eladmin.vip
+* @description /
+* @author 赵士淞
+* @date 2022-12-19
+**/
+@Data
+public class SysUserLevelWageDto extends BaseDTO implements Serializable {
+
+ /** ID */
+ private Long id;
+
+ /** 用户ID */
+ private Long userId;
+
+ /** 级别ID */
+ private Long levelId;
+
+ /** 开始日期 */
+ private Timestamp startDate;
+
+ /** 结束日期 */
+ private Timestamp endDate;
+
+ /** 级别工资 */
+ private BigDecimal levelWage;
+
+ /** 基本工资比例 */
+ private Double basicWageProportion;
+
+ /** 绩效工资比例 */
+ private Double achievementsWageProportion;
+
+ /** 业绩工资比例 */
+ private Double performanceWageProportion;
+
+ /** 团队工资比例 */
+ private Double teamWageProportion;
+
+ /** 备注 */
+ private String remarks;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageQueryCriteria.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageQueryCriteria.java
new file mode 100644
index 0000000..63dbde5
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysUserLevelWageQueryCriteria.java
@@ -0,0 +1,37 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.service.dto;
+
+import lombok.Data;
+import java.util.List;
+import me.zhengjie.annotation.Query;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2022-12-19
+**/
+@Data
+public class SysUserLevelWageQueryCriteria{
+
+ /** 精确 */
+ @Query
+ private Long userId;
+
+ /** 精确 */
+ @Query
+ private Long levelId;
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserDto.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserDto.java
index 48aa415..5b938a4 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserDto.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/UserDto.java
@@ -60,6 +60,8 @@
private SysRosteringDto sysRostering;
+ private Long levelId;
+
private String gender;
private String avatarName;
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysLevelServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysLevelServiceImpl.java
index cc3b8aa..c2716f9 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysLevelServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysLevelServiceImpl.java
@@ -114,35 +114,36 @@
public void download(List<SysLevelDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (SysLevelDto sysLevel : all) {
+ String jobName = sysLevel.getJobId() != null ? jobRepository.findById(sysLevel.getJobId()).orElseGet(Job::new).getName() : "";
Map<String,Object> map = new LinkedHashMap<>();
- map.put("岗位ID", sysLevel.getJobId());
+ map.put("岗位名称", jobName);
map.put("名称", sysLevel.getName());
map.put("描述", sysLevel.getDescription());
map.put("级别工资", sysLevel.getLevelWage());
- map.put("基本工资比例", sysLevel.getBasicWageProportion());
- map.put("绩效工资比例", sysLevel.getAchievementsWageProportion());
- map.put("业绩工资比例", sysLevel.getPerformanceWageProportion());
- map.put("团队工资比例", sysLevel.getTeamWageProportion());
+ map.put("基本工资比例", sysLevel.getBasicWageProportion() + "%");
+ map.put("绩效工资比例", sysLevel.getAchievementsWageProportion() + "%");
+ map.put("业绩工资比例", sysLevel.getPerformanceWageProportion() + "%");
+ map.put("团队工资比例", sysLevel.getTeamWageProportion() + "%");
map.put("公积金基数", sysLevel.getAccumulationRadix());
- map.put("公积金个人缴纳比例", sysLevel.getAccumulationPersonalProportion());
- map.put("公积金公司缴纳比例", sysLevel.getAccumulationCompanyProportion());
+ map.put("公积金个人缴纳比例", sysLevel.getAccumulationPersonalProportion() + "%");
+ map.put("公积金公司缴纳比例", sysLevel.getAccumulationCompanyProportion() + "%");
map.put("养老险基数", sysLevel.getPensionRadix());
- map.put("养老险个人缴纳比例", sysLevel.getPensionPersonalProportion());
- map.put("养老险公司缴纳比例", sysLevel.getPensionCompanyProportion());
+ map.put("养老险个人缴纳比例", sysLevel.getPensionPersonalProportion() + "%");
+ map.put("养老险公司缴纳比例", sysLevel.getPensionCompanyProportion() + "%");
map.put("医疗险基数", sysLevel.getMedicalRadix());
- map.put("医疗险个人缴纳比例", sysLevel.getMedicalPersonalProportion());
- map.put("医疗险公司缴纳比例", sysLevel.getMedicalCompanyProportion());
+ map.put("医疗险个人缴纳比例", sysLevel.getMedicalPersonalProportion() + "%");
+ map.put("医疗险公司缴纳比例", sysLevel.getMedicalCompanyProportion() + "%");
map.put("失业险基数", sysLevel.getUnemploymentRadix());
- map.put("失业险个人缴纳比例", sysLevel.getUnemploymentPersonalProportion());
- map.put("失业险公司缴纳比例", sysLevel.getUnemploymentCompanyProportion());
+ map.put("失业险个人缴纳比例", sysLevel.getUnemploymentPersonalProportion() + "%");
+ map.put("失业险公司缴纳比例", sysLevel.getUnemploymentCompanyProportion() + "%");
map.put("生育险基数", sysLevel.getMaternityRadix());
- map.put("生育险个人缴纳比例", sysLevel.getMaternityPersonalProportion());
- map.put("生育险公司缴纳比例", sysLevel.getMaternityCompanyProportion());
+ map.put("生育险个人缴纳比例", sysLevel.getMaternityPersonalProportion() + "%");
+ map.put("生育险公司缴纳比例", sysLevel.getMaternityCompanyProportion() + "%");
map.put("工伤险基数", sysLevel.getIndustrialInjuryRadix());
- map.put("工伤险个人缴纳比例", sysLevel.getIndustrialInjuryPersonalProportion());
- map.put("工伤险公司缴纳比例", sysLevel.getIndustrialInjuryCompanyProportion());
- map.put("个人业绩比例", sysLevel.getPersonalPerformanceProportion());
- map.put("年假天数", sysLevel.getAnnualLeaveDays());
+ map.put("工伤险个人缴纳比例", sysLevel.getIndustrialInjuryPersonalProportion() + "%");
+ map.put("工伤险公司缴纳比例", sysLevel.getIndustrialInjuryCompanyProportion() + "%");
+ map.put("个人业绩比例", sysLevel.getPersonalPerformanceProportion() + "%");
+ map.put("年假天数", sysLevel.getAnnualLeaveDays() + "天");
map.put("备注", sysLevel.getRemarks());
map.put("创建者", sysLevel.getCreateBy());
map.put("创建时间", sysLevel.getCreateTime());
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelWageServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelWageServiceImpl.java
new file mode 100644
index 0000000..b890af8
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysUserLevelWageServiceImpl.java
@@ -0,0 +1,125 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.service.impl;
+
+import me.zhengjie.modules.system.domain.SysLevel;
+import me.zhengjie.modules.system.domain.SysUserLevelWage;
+import me.zhengjie.modules.system.domain.User;
+import me.zhengjie.modules.system.repository.SysLevelRepository;
+import me.zhengjie.modules.system.repository.UserRepository;
+import me.zhengjie.utils.ValidationUtil;
+import me.zhengjie.utils.FileUtil;
+import lombok.RequiredArgsConstructor;
+import me.zhengjie.modules.system.repository.SysUserLevelWageRepository;
+import me.zhengjie.modules.system.service.SysUserLevelWageService;
+import me.zhengjie.modules.system.service.dto.SysUserLevelWageDto;
+import me.zhengjie.modules.system.service.dto.SysUserLevelWageQueryCriteria;
+import me.zhengjie.modules.system.service.mapstruct.SysUserLevelWageMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import me.zhengjie.utils.PageUtil;
+import me.zhengjie.utils.QueryHelp;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+
+/**
+* @website https://eladmin.vip
+* @description 服务实现
+* @author 赵士淞
+* @date 2022-12-19
+**/
+@Service
+@RequiredArgsConstructor
+public class SysUserLevelWageServiceImpl implements SysUserLevelWageService {
+
+ private final SysUserLevelWageRepository sysUserLevelWageRepository;
+ private final SysUserLevelWageMapper sysUserLevelWageMapper;
+ private final UserRepository userRepository;
+ private final SysLevelRepository sysLevelRepository;
+
+ @Override
+ public Map<String,Object> queryAll(SysUserLevelWageQueryCriteria criteria, Pageable pageable){
+ Page<SysUserLevelWage> page = sysUserLevelWageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ return PageUtil.toPage(page.map(sysUserLevelWageMapper::toDto));
+ }
+
+ @Override
+ public List<SysUserLevelWageDto> queryAll(SysUserLevelWageQueryCriteria criteria){
+ return sysUserLevelWageMapper.toDto(sysUserLevelWageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ }
+
+ @Override
+ @Transactional
+ public SysUserLevelWageDto findById(Long id) {
+ SysUserLevelWage sysUserLevelWage = sysUserLevelWageRepository.findById(id).orElseGet(SysUserLevelWage::new);
+ ValidationUtil.isNull(sysUserLevelWage.getId(),"SysUserLevelWage","id",id);
+ return sysUserLevelWageMapper.toDto(sysUserLevelWage);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public SysUserLevelWageDto create(SysUserLevelWage resources) {
+ return sysUserLevelWageMapper.toDto(sysUserLevelWageRepository.save(resources));
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(SysUserLevelWage resources) {
+ SysUserLevelWage sysUserLevelWage = sysUserLevelWageRepository.findById(resources.getId()).orElseGet(SysUserLevelWage::new);
+ ValidationUtil.isNull( sysUserLevelWage.getId(),"SysUserLevelWage","id",resources.getId());
+ sysUserLevelWage.copy(resources);
+ sysUserLevelWageRepository.save(sysUserLevelWage);
+ }
+
+ @Override
+ public void deleteAll(Long[] ids) {
+ for (Long id : ids) {
+ sysUserLevelWageRepository.deleteById(id);
+ }
+ }
+
+ @Override
+ public void download(List<SysUserLevelWageDto> all, HttpServletResponse response) throws IOException {
+ List<Map<String, Object>> list = new ArrayList<>();
+ for (SysUserLevelWageDto sysUserLevelWage : all) {
+ String nickName = sysUserLevelWage.getUserId() != null ? userRepository.findById(sysUserLevelWage.getUserId()).orElseGet(User::new).getNickName() : "";
+ String levelName = sysUserLevelWage.getLevelId() != null ? sysLevelRepository.findById(sysUserLevelWage.getLevelId()).orElseGet(SysLevel::new).getName() : "";
+ Map<String,Object> map = new LinkedHashMap<>();
+ map.put("用户昵称", nickName);
+ map.put("级别名称", levelName);
+ map.put("开始日期", sysUserLevelWage.getStartDate());
+ map.put("结束日期", sysUserLevelWage.getEndDate());
+ map.put("级别工资", sysUserLevelWage.getLevelWage());
+ map.put("基本工资比例", sysUserLevelWage.getBasicWageProportion());
+ map.put("绩效工资比例", sysUserLevelWage.getAchievementsWageProportion());
+ map.put("业绩工资比例", sysUserLevelWage.getPerformanceWageProportion());
+ map.put("团队工资比例", sysUserLevelWage.getTeamWageProportion());
+ map.put("备注", sysUserLevelWage.getRemarks());
+ map.put("创建者", sysUserLevelWage.getCreateBy());
+ map.put("创建时间", sysUserLevelWage.getCreateTime());
+ map.put("更新者", sysUserLevelWage.getUpdateBy());
+ map.put("更新时间", sysUserLevelWage.getUpdateTime());
+ list.add(map);
+ }
+ FileUtil.downloadExcel(list, response);
+ }
+}
\ No newline at end of file
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
index 89ecc05..5202a77 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
@@ -20,12 +20,17 @@
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.security.service.OnlineUserService;
import me.zhengjie.modules.security.service.UserCacheManager;
+import me.zhengjie.modules.system.domain.SysLevel;
+import me.zhengjie.modules.system.domain.SysUserLevelWage;
import me.zhengjie.modules.system.domain.User;
import me.zhengjie.exception.EntityExistException;
import me.zhengjie.exception.EntityNotFoundException;
+import me.zhengjie.modules.system.repository.SysLevelRepository;
+import me.zhengjie.modules.system.repository.SysUserLevelWageRepository;
import me.zhengjie.modules.system.repository.UserRepository;
import me.zhengjie.modules.system.service.UserService;
import me.zhengjie.modules.system.service.dto.*;
+import me.zhengjie.modules.system.service.mapstruct.SysUserLevelWageMapper;
import me.zhengjie.modules.system.service.mapstruct.UserLoginMapper;
import me.zhengjie.modules.system.service.mapstruct.UserMapper;
import me.zhengjie.utils.*;
@@ -40,6 +45,7 @@
import javax.validation.constraints.NotBlank;
import java.io.File;
import java.io.IOException;
+import java.sql.Timestamp;
import java.util.*;
import java.util.stream.Collectors;
@@ -59,6 +65,8 @@
private final UserCacheManager userCacheManager;
private final OnlineUserService onlineUserService;
private final UserLoginMapper userLoginMapper;
+ private final SysLevelRepository sysLevelRepository;
+ private final SysUserLevelWageRepository sysUserLevelWageRepository;
@Override
public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
@@ -94,6 +102,8 @@
throw new EntityExistException(User.class, "phone", resources.getPhone());
}
userRepository.save(resources);
+ // 判断用户级别变更
+ checkUserLevel(resources.getId(), null, resources.getLevelId());
}
@Override
@@ -127,6 +137,8 @@
if(!resources.getEnabled()){
onlineUserService.kickOutForUsername(resources.getUsername());
}
+ // 临时旧用户级别ID
+ Long tempOldLevelId = user.getLevelId();;
user.setUsername(resources.getUsername());
user.setEmail(resources.getEmail());
user.setEnabled(resources.getEnabled());
@@ -140,7 +152,12 @@
user.setAddress(resources.getAddress());
user.setDingding(resources.getDingding());
user.setSysRostering(resources.getSysRostering());
+ user.setLevelId(resources.getLevelId());
+ // 临时新用户级别ID
+ Long tempNewLevelId = user.getLevelId();
userRepository.save(user);
+ // 判断用户级别变更
+ checkUserLevel(user.getId(), tempOldLevelId, tempNewLevelId);
// 清除缓存
delCaches(user.getId(), user.getUsername());
}
@@ -248,14 +265,16 @@
List<Map<String, Object>> list = new ArrayList<>();
for (UserDto userDTO : queryAll) {
List<String> roles = userDTO.getRoles().stream().map(RoleSmallDto::getName).collect(Collectors.toList());
+ String levelName = userDTO.getLevelId() != null ? sysLevelRepository.findById(userDTO.getLevelId()).orElseGet(SysLevel::new).getName() : "";
Map<String, Object> map = new LinkedHashMap<>();
map.put("用户名", userDTO.getUsername());
map.put("角色", roles);
map.put("部门", userDTO.getDept().getName());
map.put("岗位", userDTO.getJobs().stream().map(JobSmallDto::getName).collect(Collectors.toList()));
map.put("邮箱", userDTO.getEmail());
- map.put("钉钉ID", userDTO.getDingding());
- map.put("排班ID", userDTO.getSysRostering().getId());
+ map.put("钉钉号", userDTO.getDingding());
+ map.put("排班", userDTO.getSysRostering().getName());
+ map.put("级别", levelName);
map.put("状态", userDTO.getEnabled() ? "启用" : "禁用");
map.put("手机号码", userDTO.getPhone());
map.put("修改密码的时间", userDTO.getPwdResetTime());
@@ -283,4 +302,54 @@
private void flushCache(String username) {
userCacheManager.cleanUserCache(username);
}
+
+ /**
+ * 判断用户级别变更
+ * @param userId
+ * @param oldLevelId
+ * @param newLevelId
+ */
+ private void checkUserLevel(Long userId, Long oldLevelId, Long newLevelId) {
+ // 判断新旧用户级别ID是否相等
+ if (oldLevelId == null) {
+ // 创建用户级别工资
+ createSysUserLevelWage(userId, newLevelId);
+ } else if (oldLevelId != newLevelId) {
+ // 旧用户级别工资
+ SysUserLevelWage oldSysUserLevelWage = sysUserLevelWageRepository.findLastByUserId(userId);
+ // 判断旧用户级别工资是否为空
+ if (oldSysUserLevelWage != null && oldSysUserLevelWage.getId() != null) {
+ // 旧用户级别工资
+ oldSysUserLevelWage.setEndDate(new Timestamp(new Date().getTime()));
+ // 保存
+ sysUserLevelWageRepository.save(oldSysUserLevelWage);
+ }
+ // 创建用户级别工资
+ createSysUserLevelWage(userId, newLevelId);
+ } else {
+
+ }
+ }
+
+ /**
+ * 创建用户级别工资
+ * @param userId
+ * @param levelId
+ */
+ private void createSysUserLevelWage(Long userId, Long levelId) {
+ // 级别
+ SysLevel sysLevel = sysLevelRepository.findById(levelId).orElseGet(SysLevel::new);
+ // 用户级别工资
+ SysUserLevelWage sysUserLevelWage = new SysUserLevelWage();
+ sysUserLevelWage.setUserId(userId);
+ sysUserLevelWage.setLevelId(levelId);
+ sysUserLevelWage.setStartDate(new Timestamp(new Date().getTime()));
+ sysUserLevelWage.setLevelWage(sysLevel.getLevelWage());
+ sysUserLevelWage.setBasicWageProportion(sysLevel.getBasicWageProportion());
+ sysUserLevelWage.setAchievementsWageProportion(sysLevel.getAchievementsWageProportion());
+ sysUserLevelWage.setPerformanceWageProportion(sysLevel.getPerformanceWageProportion());
+ sysUserLevelWage.setTeamWageProportion(sysLevel.getTeamWageProportion());
+ // 保存
+ sysUserLevelWageRepository.save(sysUserLevelWage);
+ }
}
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserLevelWageMapper.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserLevelWageMapper.java
new file mode 100644
index 0000000..00fe359
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysUserLevelWageMapper.java
@@ -0,0 +1,32 @@
+/*
+* Copyright 2019-2020 Zheng Jie
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package me.zhengjie.modules.system.service.mapstruct;
+
+import me.zhengjie.base.BaseMapper;
+import me.zhengjie.modules.system.domain.SysUserLevelWage;
+import me.zhengjie.modules.system.service.dto.SysUserLevelWageDto;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2022-12-19
+**/
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface SysUserLevelWageMapper extends BaseMapper<SysUserLevelWageDto, SysUserLevelWage> {
+
+}
\ No newline at end of file
diff --git a/eladmin-web-master/src/api/sysUserLevelWage.js b/eladmin-web-master/src/api/sysUserLevelWage.js
new file mode 100644
index 0000000..ed0cdb7
--- /dev/null
+++ b/eladmin-web-master/src/api/sysUserLevelWage.js
@@ -0,0 +1,27 @@
+import request from '@/utils/request'
+
+export function add(data) {
+ return request({
+ url: 'api/sysUserLevelWage',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/sysUserLevelWage/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/sysUserLevelWage',
+ method: 'put',
+ data
+ })
+}
+
+export default { add, edit, del }
diff --git a/eladmin-web-master/src/views/system/user/index.vue b/eladmin-web-master/src/views/system/user/index.vue
index 55e3ed9..949f5ff 100644
--- a/eladmin-web-master/src/views/system/user/index.vue
+++ b/eladmin-web-master/src/views/system/user/index.vue
@@ -74,34 +74,6 @@
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" />
</el-form-item>
- <el-form-item label="部门" prop="dept.id">
- <treeselect
- v-model="form.dept.id"
- :options="depts"
- :load-options="loadDepts"
- style="width: 178px"
- placeholder="选择部门"
- />
- </el-form-item>
- <el-form-item label="岗位" prop="jobs">
- <el-select
- v-model="jobDatas"
- style="width: 178px"
- multiple
- multiple-limit="1"
- placeholder="请选择"
- @remove-tag="deleteTag"
- @change="changeJob"
- >
- <el-option
- v-for="item in jobs"
- :key="item.name"
- :label="item.name"
- :value="item.id"
- :disabled="!item.enabled"
- />
- </el-select>
- </el-form-item>
<el-form-item label="性别">
<el-radio-group v-model="form.gender" style="width: 178px">
<el-radio label="男">男</el-radio>
@@ -116,6 +88,37 @@
placeholder="请选择"
/>
</el-form-item>
+ <el-form-item label="住址" prop="address">
+ <el-input v-model="form.address" style="width: 437px" />
+ </el-form-item>
+ <el-form-item label="部门" prop="dept.id">
+ <treeselect
+ v-model="form.dept.id"
+ :options="depts"
+ :load-options="loadDepts"
+ style="width: 178px"
+ placeholder="选择部门"
+ />
+ </el-form-item>
+ <el-form-item label="岗位" prop="jobs">
+ <el-select
+ v-model="jobDatas"
+ style="width: 178px"
+ multiple
+ :multiple-limit="1"
+ placeholder="请选择"
+ @remove-tag="deleteTag"
+ @change="changeJob"
+ >
+ <el-option
+ v-for="item in jobs"
+ :key="item.name"
+ :label="item.name"
+ :value="item.id"
+ :disabled="!item.enabled"
+ />
+ </el-select>
+ </el-form-item>
<el-form-item label="排班" prop="sysRostering.id">
<el-select v-model="form.sysRostering.id" clearable style="width: 178px" placeholder="请选择">
<el-option
@@ -129,6 +132,16 @@
<el-form-item label="钉钉号" prop="dingding">
<el-input v-model="form.dingding" />
</el-form-item>
+ <el-form-item label="级别" prop="levelId">
+ <el-select v-model="form.levelId" clearable style="width: 178px" placeholder="请选择">
+ <el-option
+ v-for="item in levels"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </el-select>
+ </el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.enabled" :disabled="form.id === user.id">
<el-radio
@@ -138,15 +151,12 @@
>{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
- <el-form-item label="住址" prop="address">
- <el-input v-model="form.address" style="width: 437px" />
- </el-form-item>
<el-form-item style="margin-bottom: 0;" label="角色" prop="roles">
<el-select
v-model="roleDatas"
style="width: 437px"
multiple
- multiple-limit="1"
+ :multiple-limit="1"
placeholder="请选择"
@remove-tag="deleteTag"
@change="changeRole"
@@ -231,9 +241,10 @@
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import crudRostering from '@/api/system/rostering'
+import crudLevel from '@/api/system/level'
let userRoles = []
let userJobs = []
-const defaultForm = { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, sysRostering: { id: null }}
+const defaultForm = { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, sysRostering: { id: null }, levelId: null }
export default {
name: 'User',
components: { Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
@@ -291,6 +302,9 @@
'sysRostering.id': [
{ required: true, message: '请选择排班', trigger: 'change' }
],
+ levelId: [
+ { required: true, message: '请选择级别', trigger: 'change' }
+ ],
dingding: [
{ required: true, message: '请输入钉钉号', trigger: 'blur' },
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
@@ -301,7 +315,9 @@
]
},
// 排班
- rosterings: []
+ rosterings: [],
+ // 级别
+ levels: []
}
},
computed: {
@@ -338,6 +354,10 @@
const job = { id: data }
userJobs.push(job)
})
+ // 获取级别
+ this.getLevel()
+ // 用户表单
+ this.form.levelId = null
},
deleteTag(value) {
userRoles.forEach(function(data, index) {
@@ -382,6 +402,11 @@
_this.jobDatas.push(job.id)
const data = { id: job.id }
userJobs.push(data)
+ // 判断循环是否结束
+ if (index === form.jobs.length - 1) {
+ // 获取级别
+ _this.getLevel()
+ }
})
},
// 提交前做的操作
@@ -526,6 +551,20 @@
},
checkboxT(row, rowIndex) {
return row.id !== this.user.id
+ },
+ // 获取级别
+ getLevel() {
+ // 判断用户岗位列表
+ if (userJobs.length !== 0) {
+ // 获取级别
+ crudLevel.getAll({ jobId: userJobs[0].id }).then(res => {
+ // 级别
+ this.levels = res
+ })
+ } else {
+ // 级别
+ this.levels = []
+ }
}
}
}
diff --git a/eladmin-web-master/src/views/system/userLevelWage/index.vue b/eladmin-web-master/src/views/system/userLevelWage/index.vue
new file mode 100644
index 0000000..6a00759
--- /dev/null
+++ b/eladmin-web-master/src/views/system/userLevelWage/index.vue
@@ -0,0 +1,149 @@
+<template>
+ <div class="app-container">
+ <!--工具栏-->
+ <div class="head-container">
+ <div v-if="crud.props.searchToggle">
+ <!-- 搜索 -->
+ <label class="el-form-item-label">用户ID</label>
+ <el-input v-model="query.userId" clearable placeholder="用户ID" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
+ <label class="el-form-item-label">级别ID</label>
+ <el-input v-model="query.levelId" clearable placeholder="级别ID" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
+ <rrOperation :crud="crud" />
+ </div>
+ <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
+ <crudOperation :permission="permission" />
+ <!--表单组件-->
+ <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
+ <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
+ <el-form-item label="用户ID" prop="userId">
+ 未设置字典,请手动设置 Select
+ </el-form-item>
+ <el-form-item label="级别ID" prop="levelId">
+ 未设置字典,请手动设置 Select
+ </el-form-item>
+ <el-form-item label="开始日期" prop="startDate">
+ <el-date-picker v-model="form.startDate" type="datetime" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="结束日期">
+ <el-date-picker v-model="form.endDate" type="datetime" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="级别工资" prop="levelWage">
+ <el-input v-model="form.levelWage" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="基本工资比例" prop="basicWageProportion">
+ <el-input v-model="form.basicWageProportion" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="绩效工资比例" prop="achievementsWageProportion">
+ <el-input v-model="form.achievementsWageProportion" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="业绩工资比例" prop="performanceWageProportion">
+ <el-input v-model="form.performanceWageProportion" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="团队工资比例" prop="teamWageProportion">
+ <el-input v-model="form.teamWageProportion" style="width: 370px;" />
+ </el-form-item>
+ <el-form-item label="备注">
+ <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 370px;" />
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="text" @click="crud.cancelCU">取消</el-button>
+ <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
+ </div>
+ </el-dialog>
+ <!--表格渲染-->
+ <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
+ <el-table-column type="selection" width="55" />
+ <el-table-column prop="userId" label="用户ID" />
+ <el-table-column prop="levelId" label="级别ID" />
+ <el-table-column prop="startDate" label="开始日期" />
+ <el-table-column prop="endDate" label="结束日期" />
+ <el-table-column prop="levelWage" label="级别工资" />
+ <el-table-column prop="basicWageProportion" label="基本工资比例" />
+ <el-table-column prop="achievementsWageProportion" label="绩效工资比例" />
+ <el-table-column prop="performanceWageProportion" label="业绩工资比例" />
+ <el-table-column prop="teamWageProportion" label="团队工资比例" />
+ <el-table-column prop="remarks" label="备注" />
+ <el-table-column prop="createTime" label="创建时间" />
+ <el-table-column v-if="checkPer(['admin','sysUserLevelWage:edit','sysUserLevelWage:del'])" label="操作" width="150px" align="center">
+ <template slot-scope="scope">
+ <udOperation
+ :data="scope.row"
+ :permission="permission"
+ />
+ </template>
+ </el-table-column>
+ </el-table>
+ <!--分页组件-->
+ <pagination />
+ </div>
+ </div>
+</template>
+
+<script>
+import crudSysUserLevelWage from '@/api/sysUserLevelWage'
+import CRUD, { presenter, header, form, crud } from '@crud/crud'
+import rrOperation from '@crud/RR.operation'
+import crudOperation from '@crud/CRUD.operation'
+import udOperation from '@crud/UD.operation'
+import pagination from '@crud/Pagination'
+
+const defaultForm = { id: null, userId: null, levelId: null, startDate: null, endDate: null, levelWage: null, basicWageProportion: null, achievementsWageProportion: null, performanceWageProportion: null, teamWageProportion: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
+export default {
+ name: 'SysUserLevelWage',
+ components: { pagination, crudOperation, rrOperation, udOperation },
+ mixins: [presenter(), header(), form(defaultForm), crud()],
+ cruds() {
+ return CRUD({ title: '用户级别工资', url: 'api/sysUserLevelWage', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysUserLevelWage }})
+ },
+ data() {
+ return {
+ permission: {
+ add: ['admin', 'sysUserLevelWage:add'],
+ edit: ['admin', 'sysUserLevelWage:edit'],
+ del: ['admin', 'sysUserLevelWage:del']
+ },
+ rules: {
+ userId: [
+ { required: true, message: '用户ID不能为空', trigger: 'blur' }
+ ],
+ levelId: [
+ { required: true, message: '级别ID不能为空', trigger: 'blur' }
+ ],
+ startDate: [
+ { required: true, message: '开始日期不能为空', trigger: 'blur' }
+ ],
+ levelWage: [
+ { required: true, message: '级别工资不能为空', trigger: 'blur' }
+ ],
+ basicWageProportion: [
+ { required: true, message: '基本工资比例不能为空', trigger: 'blur' }
+ ],
+ achievementsWageProportion: [
+ { required: true, message: '绩效工资比例不能为空', trigger: 'blur' }
+ ],
+ performanceWageProportion: [
+ { required: true, message: '业绩工资比例不能为空', trigger: 'blur' }
+ ],
+ teamWageProportion: [
+ { required: true, message: '团队工资比例不能为空', trigger: 'blur' }
+ ]
+ },
+ queryTypeOptions: [
+ { key: 'userId', display_name: '用户ID' },
+ { key: 'levelId', display_name: '级别ID' }
+ ]
+ }
+ },
+ methods: {
+ // 钩子:在获取表格数据之前执行,false 则代表不获取数据
+ [CRUD.HOOK.beforeRefresh]() {
+ return true
+ }
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
--
Gitblit v1.9.3