赵士淞
2022-12-15 7f251396c21cc2c68075a533921df728bf2b6d3f
级别管理
10 files added
6 files modified
1590 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysLevel.java 193 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysLevelRepository.java 39 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java 7 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysLevelController.java 95 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysLevelService.java 83 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysLevelDto.java 126 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysLevelQueryCriteria.java 37 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/JobServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysLevelServiceImpl.java 155 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysLevelMapper.java 32 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/system/configProportion.js 2 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/system/job.js 11 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/system/level.js 35 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/utils/constant.js 145 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/system/level/index.vue 618 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/system/user/index.vue 7 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysLevel.java
New file
@@ -0,0 +1,193 @@
/*
*  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-14
**/
@Entity
@Data
@Table(name="sys_level")
public class SysLevel extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "ID")
    private Long id;
    @Column(name = "`job_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "岗位ID")
    private Long jobId;
    @Column(name = "`name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "名称")
    private String name;
    @Column(name = "`description`")
    @ApiModelProperty(value = "描述")
    private String description;
    @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 = "`accumulation_radix`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "公积金基数")
    private BigDecimal accumulationRadix;
    @Column(name = "`accumulation_personal_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "公积金个人缴纳比例")
    private Double accumulationPersonalProportion;
    @Column(name = "`accumulation_company_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "公积金公司缴纳比例")
    private Double accumulationCompanyProportion;
    @Column(name = "`pension_radix`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "养老险基数")
    private BigDecimal pensionRadix;
    @Column(name = "`pension_personal_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "养老险个人缴纳比例")
    private Double pensionPersonalProportion;
    @Column(name = "`pension_company_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "养老险公司缴纳比例")
    private Double pensionCompanyProportion;
    @Column(name = "`medical_radix`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "医疗险基数")
    private BigDecimal medicalRadix;
    @Column(name = "`medical_personal_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "医疗险个人缴纳比例")
    private Double medicalPersonalProportion;
    @Column(name = "`medical_company_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "医疗险公司缴纳比例")
    private Double medicalCompanyProportion;
    @Column(name = "`unemployment_radix`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "失业险基数")
    private BigDecimal unemploymentRadix;
    @Column(name = "`unemployment_personal_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "失业险个人缴纳比例")
    private Double unemploymentPersonalProportion;
    @Column(name = "`unemployment_company_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "失业险公司缴纳比例")
    private Double unemploymentCompanyProportion;
    @Column(name = "`maternity_radix`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "生育险基数")
    private BigDecimal maternityRadix;
    @Column(name = "`maternity_personal_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "生育险个人缴纳比例")
    private Double maternityPersonalProportion;
    @Column(name = "`maternity_company_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "生育险公司缴纳比例")
    private Double maternityCompanyProportion;
    @Column(name = "`industrial_injury_radix`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "工伤险基数")
    private BigDecimal industrialInjuryRadix;
    @Column(name = "`industrial_injury_personal_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "工伤险个人缴纳比例")
    private Double industrialInjuryPersonalProportion;
    @Column(name = "`industrial_injury_company_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "工伤险公司缴纳比例")
    private Double industrialInjuryCompanyProportion;
    @Column(name = "`personal_performance_proportion`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "个人业绩比例")
    private Double personalPerformanceProportion;
    @Column(name = "`annual_leave_days`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "年假天数")
    private Integer annualLeaveDays;
    @Column(name = "`remarks`")
    @ApiModelProperty(value = "备注")
    private String remarks;
    public void copy(SysLevel source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysLevelRepository.java
New file
@@ -0,0 +1,39 @@
/*
*  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.SysLevel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.Set;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2022-12-14
**/
public interface SysLevelRepository extends JpaRepository<SysLevel, Long>, JpaSpecificationExecutor<SysLevel> {
    /**
     * 根据岗位查询
     * @param jobIds /
     * @return /
     */
    @Query(value = "SELECT count(1) FROM sys_level WHERE job_id IN ?1", nativeQuery = true)
    int countByJobs(Set<Long> jobIds);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java
@@ -60,6 +60,13 @@
        return new ResponseEntity<>(jobService.queryAll(criteria, pageable),HttpStatus.OK);
    }
    @ApiOperation("查询岗位")
    @GetMapping(value = "/all")
    @PreAuthorize("@el.check('job:list','user:list')")
    public ResponseEntity<Object> queryJob(JobQueryCriteria criteria){
        return new ResponseEntity<>(jobService.queryAll(criteria),HttpStatus.OK);
    }
    @Log("新增岗位")
    @ApiOperation("新增岗位")
    @PostMapping
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysLevelController.java
New file
@@ -0,0 +1,95 @@
/*
*  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.SysLevel;
import me.zhengjie.modules.system.service.SysLevelService;
import me.zhengjie.modules.system.service.dto.SysLevelQueryCriteria;
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-14
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "级别管理")
@RequestMapping("/api/sysLevel")
public class SysLevelController {
    private final SysLevelService sysLevelService;
    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('sysLevel:download')")
    public void exportSysLevel(HttpServletResponse response, SysLevelQueryCriteria criteria) throws IOException {
        sysLevelService.download(sysLevelService.queryAll(criteria), response);
    }
    @GetMapping
    @Log("查询级别")
    @ApiOperation("查询级别")
    @PreAuthorize("@el.check('sysLevel:list')")
    public ResponseEntity<Object> querySysLevel(SysLevelQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(sysLevelService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @GetMapping(value = "/all")
    @Log("查询级别")
    @ApiOperation("查询级别")
    @PreAuthorize("@el.check('sysLevel:list')")
    public ResponseEntity<Object> querySysLevel(SysLevelQueryCriteria criteria){
        return new ResponseEntity<>(sysLevelService.queryAll(criteria),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增级别")
    @ApiOperation("新增级别")
    @PreAuthorize("@el.check('sysLevel:add')")
    public ResponseEntity<Object> createSysLevel(@Validated @RequestBody SysLevel resources){
        return new ResponseEntity<>(sysLevelService.create(resources),HttpStatus.CREATED);
    }
    @PutMapping
    @Log("修改级别")
    @ApiOperation("修改级别")
    @PreAuthorize("@el.check('sysLevel:edit')")
    public ResponseEntity<Object> updateSysLevel(@Validated @RequestBody SysLevel resources){
        sysLevelService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @DeleteMapping
    @Log("删除级别")
    @ApiOperation("删除级别")
    @PreAuthorize("@el.check('sysLevel:del')")
    public ResponseEntity<Object> deleteSysLevel(@RequestBody Long[] ids) {
        sysLevelService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysLevelService.java
New file
@@ -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.SysLevel;
import me.zhengjie.modules.system.service.dto.SysLevelDto;
import me.zhengjie.modules.system.service.dto.SysLevelQueryCriteria;
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-14
**/
public interface SysLevelService {
    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(SysLevelQueryCriteria criteria, Pageable pageable);
    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<SysLevelDto>
    */
    List<SysLevelDto> queryAll(SysLevelQueryCriteria criteria);
    /**
     * 根据ID查询
     * @param id ID
     * @return SysLevelDto
     */
    SysLevelDto findById(Long id);
    /**
    * 创建
    * @param resources /
    * @return SysLevelDto
    */
    SysLevelDto create(SysLevel resources);
    /**
    * 编辑
    * @param resources /
    */
    void update(SysLevel resources);
    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Long[] ids);
    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<SysLevelDto> all, HttpServletResponse response) throws IOException;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysLevelDto.java
New file
@@ -0,0 +1,126 @@
/*
*  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-14
**/
@Data
public class SysLevelDto extends BaseDTO implements Serializable {
    /** ID */
    private Long id;
    /** 岗位ID */
    private Long jobId;
    /** 名称 */
    private String name;
    /** 描述 */
    private String description;
    /** 级别工资 */
    private BigDecimal levelWage;
    /** 基本工资比例 */
    private Double basicWageProportion;
    /** 绩效工资比例 */
    private Double achievementsWageProportion;
    /** 业绩工资比例 */
    private Double performanceWageProportion;
    /** 团队工资比例 */
    private Double teamWageProportion;
    /** 公积金基数 */
    private BigDecimal accumulationRadix;
    /** 公积金个人缴纳比例 */
    private Double accumulationPersonalProportion;
    /** 公积金公司缴纳比例 */
    private Double accumulationCompanyProportion;
    /** 养老险基数 */
    private BigDecimal pensionRadix;
    /** 养老险个人缴纳比例 */
    private Double pensionPersonalProportion;
    /** 养老险公司缴纳比例 */
    private Double pensionCompanyProportion;
    /** 医疗险基数 */
    private BigDecimal medicalRadix;
    /** 医疗险个人缴纳比例 */
    private Double medicalPersonalProportion;
    /** 医疗险公司缴纳比例 */
    private Double medicalCompanyProportion;
    /** 失业险基数 */
    private BigDecimal unemploymentRadix;
    /** 失业险个人缴纳比例 */
    private Double unemploymentPersonalProportion;
    /** 失业险公司缴纳比例 */
    private Double unemploymentCompanyProportion;
    /** 生育险基数 */
    private BigDecimal maternityRadix;
    /** 生育险个人缴纳比例 */
    private Double maternityPersonalProportion;
    /** 生育险公司缴纳比例 */
    private Double maternityCompanyProportion;
    /** 工伤险基数 */
    private BigDecimal industrialInjuryRadix;
    /** 工伤险个人缴纳比例 */
    private Double industrialInjuryPersonalProportion;
    /** 工伤险公司缴纳比例 */
    private Double industrialInjuryCompanyProportion;
    /** 个人业绩比例 */
    private Double personalPerformanceProportion;
    /** 年假天数 */
    private Integer annualLeaveDays;
    /** 备注 */
    private String remarks;
    /** 岗位名称 */
    private String jobName;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysLevelQueryCriteria.java
New file
@@ -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-14
**/
@Data
public class SysLevelQueryCriteria{
    /** 精确 */
    @Query
    private Long jobId;
    /** 模糊 */
    @Query(type = Query.Type.INNER_LIKE)
    private String name;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/JobServiceImpl.java
@@ -19,6 +19,7 @@
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.exception.EntityExistException;
import me.zhengjie.modules.system.domain.Job;
import me.zhengjie.modules.system.repository.SysLevelRepository;
import me.zhengjie.modules.system.repository.UserRepository;
import me.zhengjie.modules.system.service.dto.JobQueryCriteria;
import me.zhengjie.utils.*;
@@ -50,6 +51,7 @@
    private final JobMapper jobMapper;
    private final RedisUtils redisUtils;
    private final UserRepository userRepository;
    private final SysLevelRepository sysLevelRepository;
    @Override
    public Map<String,Object> queryAll(JobQueryCriteria criteria, Pageable pageable) {
@@ -121,5 +123,8 @@
        if(userRepository.countByJobs(ids) > 0){
            throw new BadRequestException("所选的岗位中存在用户关联,请解除关联再试!");
        }
        if(sysLevelRepository.countByJobs(ids) > 0) {
            throw new BadRequestException("所选的岗位中存在级别关联,请解除关联再试!");
        }
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/SysLevelServiceImpl.java
New file
@@ -0,0 +1,155 @@
/*
*  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.Job;
import me.zhengjie.modules.system.domain.SysLevel;
import me.zhengjie.modules.system.repository.JobRepository;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.system.repository.SysLevelRepository;
import me.zhengjie.modules.system.service.SysLevelService;
import me.zhengjie.modules.system.service.dto.SysLevelDto;
import me.zhengjie.modules.system.service.dto.SysLevelQueryCriteria;
import me.zhengjie.modules.system.service.mapstruct.SysLevelMapper;
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;
import java.util.function.Function;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author 赵士淞
* @date 2022-12-14
**/
@Service
@RequiredArgsConstructor
public class SysLevelServiceImpl implements SysLevelService {
    private final SysLevelRepository sysLevelRepository;
    private final SysLevelMapper sysLevelMapper;
    private final JobRepository jobRepository;
    @Override
    public Map<String,Object> queryAll(SysLevelQueryCriteria criteria, Pageable pageable){
        Page<SysLevel> page = sysLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        // 将实体类转换为DTO(重写)
        Function<SysLevel, SysLevelDto> func = new Function<SysLevel, SysLevelDto>(){
            @Override
            public SysLevelDto apply(SysLevel t) {
                // 将实体类转换成DTO
                SysLevelDto sysLevelDto = sysLevelMapper.toDto(t);
                // 根据岗位ID查询岗位信息
                Job job = jobRepository.findById(sysLevelDto.getJobId()).orElseGet(Job::new);
                ValidationUtil.isNull(job.getId(),"Job","id",sysLevelDto.getJobId());
                // 岗位名称
                sysLevelDto.setJobName(job.getName());
                // 返回处理好的DTO
                return sysLevelDto;
            }
        };
        return PageUtil.toPage(page.map(func));
    }
    @Override
    public List<SysLevelDto> queryAll(SysLevelQueryCriteria criteria){
        return sysLevelMapper.toDto(sysLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
    }
    @Override
    @Transactional
    public SysLevelDto findById(Long id) {
        SysLevel sysLevel = sysLevelRepository.findById(id).orElseGet(SysLevel::new);
        ValidationUtil.isNull(sysLevel.getId(),"SysLevel","id",id);
        return sysLevelMapper.toDto(sysLevel);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public SysLevelDto create(SysLevel resources) {
        return sysLevelMapper.toDto(sysLevelRepository.save(resources));
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(SysLevel resources) {
        SysLevel sysLevel = sysLevelRepository.findById(resources.getId()).orElseGet(SysLevel::new);
        ValidationUtil.isNull( sysLevel.getId(),"SysLevel","id",resources.getId());
        sysLevel.copy(resources);
        sysLevelRepository.save(sysLevel);
    }
    @Override
    public void deleteAll(Long[] ids) {
        for (Long id : ids) {
            sysLevelRepository.deleteById(id);
        }
    }
    @Override
    public void download(List<SysLevelDto> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (SysLevelDto sysLevel : all) {
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("岗位ID", sysLevel.getJobId());
            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.getAccumulationRadix());
            map.put("公积金个人缴纳比例", sysLevel.getAccumulationPersonalProportion());
            map.put("公积金公司缴纳比例", sysLevel.getAccumulationCompanyProportion());
            map.put("养老险基数", sysLevel.getPensionRadix());
            map.put("养老险个人缴纳比例", sysLevel.getPensionPersonalProportion());
            map.put("养老险公司缴纳比例", sysLevel.getPensionCompanyProportion());
            map.put("医疗险基数", sysLevel.getMedicalRadix());
            map.put("医疗险个人缴纳比例", sysLevel.getMedicalPersonalProportion());
            map.put("医疗险公司缴纳比例", sysLevel.getMedicalCompanyProportion());
            map.put("失业险基数", sysLevel.getUnemploymentRadix());
            map.put("失业险个人缴纳比例", sysLevel.getUnemploymentPersonalProportion());
            map.put("失业险公司缴纳比例", sysLevel.getUnemploymentCompanyProportion());
            map.put("生育险基数", sysLevel.getMaternityRadix());
            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.getRemarks());
            map.put("创建者", sysLevel.getCreateBy());
            map.put("创建时间", sysLevel.getCreateTime());
            map.put("更新者", sysLevel.getUpdateBy());
            map.put("更新时间", sysLevel.getUpdateTime());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysLevelMapper.java
New file
@@ -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.SysLevel;
import me.zhengjie.modules.system.service.dto.SysLevelDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2022-12-14
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysLevelMapper extends BaseMapper<SysLevelDto, SysLevel> {
}
eladmin-web-master/src/api/system/configProportion.js
@@ -32,4 +32,4 @@
  })
}
export default { add, edit, del }
export default { getAll, add, edit, del }
eladmin-web-master/src/api/system/job.js
@@ -1,13 +1,8 @@
import request from '@/utils/request'
export function getAllJob() {
  const params = {
    page: 0,
    size: 9999,
    enabled: true
  }
export function getAll(params) {
  return request({
    url: 'api/job',
    url: 'api/job/all',
    method: 'get',
    params
  })
@@ -37,4 +32,4 @@
  })
}
export default { add, edit, del }
export default { getAll, add, edit, del }
eladmin-web-master/src/api/system/level.js
New file
@@ -0,0 +1,35 @@
import request from '@/utils/request'
export function getAll(params) {
  return request({
    url: 'api/sysLevel/all',
    method: 'get',
    params
  })
}
export function add(data) {
  return request({
    url: 'api/sysLevel',
    method: 'post',
    data
  })
}
export function del(ids) {
  return request({
    url: 'api/sysLevel/',
    method: 'delete',
    data: ids
  })
}
export function edit(data) {
  return request({
    url: 'api/sysLevel',
    method: 'put',
    data
  })
}
export default { getAll, add, edit, del }
eladmin-web-master/src/utils/constant.js
@@ -1,97 +1,54 @@
// 最大页数
export const MAX_PAGE = 0
// 最大条数
export const MAX_SIZE = 99999
// 真
export const TRUE = true
// 假
export const FALSE = false
// 默认部门
export const DEFAULT_DEPT = 1
// 默认岗位
export const DEFAULT_JOBS = 1
// 国家:中国
export const COUNTRY_CHINA = '中国'
// 国家:日本
export const COUNTRY_JAPAN = '日本'
// 配置:寄件码打印标题
export const CONFIG_PRINT_TITLE = '寄件码打印标题'
// 使用情况
export const USE_CASE = 'use_case'
// 使用状态
export const USAGE_STATUS = 'usage_status'
// 使用状态:使用中
export const USAGE_STATUS_USED = 'usage_status_used'
// 使用状态:已停用
export const USAGE_STATUS_DEACTIVATED = 'usage_status_deactivated'
// 包裹状态
export const PACKAGE_STATUS = 'package_status'
// 包裹状态:等待处理
export const PACKAGE_STATUS_WAITING = 'package_status_waiting'
// 包裹状态:已取件
export const PACKAGE_STATUS_PICKED = 'package_status_picked'
// 包裹状态:已入库
export const PACKAGE_STATUS_WAREHOUSING = 'package_status_warehousing'
// 包裹状态:已发货
export const PACKAGE_STATUS_SHIPPED = 'package_status_shipped'
// 预约状态
export const APPOINTMENT_STATUS = 'appointment_status'
// 预约状态:等待处理
export const APPOINTMENT_STATUS_WAITING = 'appointment_status_waiting'
// 预约状态:已取消
export const APPOINTMENT_STATUS_CANCELED = 'appointment_status_canceled'
// 预约状态:预约成功
export const APPOINTMENT_STATUS_SUCCESS = 'appointment_status_success'
// 预约状态:已完成
export const APPOINTMENT_STATUS_COMPLETED = 'appointment_status_completed'
// 地址类型
export const ADDRESS_TYPE = 'address_type'
// 地址类型:中国地址
export const ADDRESS_TYPE_CHINA = 'address_type_china'
// 地址类型:日本地址
export const ADDRESS_TYPE_JAPEN = 'address_type_japen'
// 地址类型:国际地址
export const ADDRESS_TYPE_INTERNATIONAL = 'address_type_international'
// 包裹分类:XX杂货(用于模糊查询判定是否为杂货)
export const PACKAGE_CLASSIFICATION_GROCERY = '杂货'
// 比例配置:基本工资比例
export const CONFIG_PROPORTION_BASIC_WAGE = '基本工资比例'
// 比例配置:绩效工资比例
export const CONFIG_PROPORTION_MERIT_WAGE = '绩效工资比例'
// 比例配置:业绩工资比例
export const CONFIG_PROPORTION_ACHIEVEMENT_WAGE = '业绩工资比例'
// 比例配置:团队工资比例
export const CONFIG_PROPORTION_TEAM_WAGE = '团队工资比例'
// 比例配置:公积金个人缴纳比例
export const CONFIG_PROPORTION_ACCUMULATION_FUND_PERSONAL = '公积金个人缴纳比例'
// 比例配置:公积金公司缴纳比例
export const CONFIG_PROPORTION_ACCUMULATION_FUND_COMPANY = '公积金公司缴纳比例'
// 比例配置:养老险个人缴纳比例
export const CONFIG_PROPORTION_PENSION_INSURANCE_PERSONAL = '养老险个人缴纳比例'
// 比例配置:养老险公司缴纳比例
export const CONFIG_PROPORTION_PENSION_INSURANCE_COMPANY = '养老险公司缴纳比例'
// 比例配置:医疗险个人缴纳比例
export const CONFIG_PROPORTION_MEDICAL_INSURANCE_PERSONAL = '医疗险个人缴纳比例'
// 比例配置:医疗险公司缴纳比例
export const CONFIG_PROPORTION_MEDICAL_INSURANCE_COMPANY = '医疗险公司缴纳比例'
// 比例配置:失业险个人缴纳比例
export const CONFIG_PROPORTION_UNEMPLOYMENT_INSURANCE_PERSONAL = '失业险个人缴纳比例'
// 比例配置:失业险公司缴纳比例
export const CONFIG_PROPORTION_UNEMPLOYMENT_INSURANCE_COMPANY = '失业险公司缴纳比例'
// 比例配置:生育险个人缴纳比例
export const CONFIG_PROPORTION_MATERNITY_INSURANCE_PERSONAL = '生育险个人缴纳比例'
// 比例配置:生育险公司缴纳比例
export const CONFIG_PROPORTION_MATERNITY_INSURANCE_COMPANY = '生育险公司缴纳比例'
// 比例配置:工伤险个人缴纳比例
export const CONFIG_PROPORTION_INDUSTRIAL_INJURY_INSURANCE_PERSONAL = '工伤险个人缴纳比例'
// 比例配置:工伤险公司缴纳比例
export const CONFIG_PROPORTION_INDUSTRIAL_INJURY_INSURANCE_COMPANY = '工伤险公司缴纳比例'
// 比例配置:个人业绩比例
export const CONFIG_PROPORTION_PERSONAL_PERFORMANCE = '个人业绩比例'
export default {
  MAX_PAGE,
  MAX_SIZE,
  TRUE,
  FALSE,
  DEFAULT_DEPT,
  DEFAULT_JOBS,
  COUNTRY_CHINA,
  COUNTRY_JAPAN,
  CONFIG_PRINT_TITLE,
  USE_CASE,
  USAGE_STATUS,
  USAGE_STATUS_USED,
  USAGE_STATUS_DEACTIVATED,
  PACKAGE_STATUS,
  PACKAGE_STATUS_WAITING,
  PACKAGE_STATUS_PICKED,
  PACKAGE_STATUS_WAREHOUSING,
  PACKAGE_STATUS_SHIPPED,
  APPOINTMENT_STATUS,
  APPOINTMENT_STATUS_WAITING,
  APPOINTMENT_STATUS_CANCELED,
  APPOINTMENT_STATUS_SUCCESS,
  APPOINTMENT_STATUS_COMPLETED,
  ADDRESS_TYPE,
  ADDRESS_TYPE_CHINA,
  ADDRESS_TYPE_JAPEN,
  ADDRESS_TYPE_INTERNATIONAL,
  PACKAGE_CLASSIFICATION_GROCERY
  CONFIG_PROPORTION_BASIC_WAGE,
  CONFIG_PROPORTION_MERIT_WAGE,
  CONFIG_PROPORTION_ACHIEVEMENT_WAGE,
  CONFIG_PROPORTION_TEAM_WAGE,
  CONFIG_PROPORTION_ACCUMULATION_FUND_PERSONAL,
  CONFIG_PROPORTION_ACCUMULATION_FUND_COMPANY,
  CONFIG_PROPORTION_PENSION_INSURANCE_PERSONAL,
  CONFIG_PROPORTION_PENSION_INSURANCE_COMPANY,
  CONFIG_PROPORTION_MEDICAL_INSURANCE_PERSONAL,
  CONFIG_PROPORTION_MEDICAL_INSURANCE_COMPANY,
  CONFIG_PROPORTION_UNEMPLOYMENT_INSURANCE_PERSONAL,
  CONFIG_PROPORTION_UNEMPLOYMENT_INSURANCE_COMPANY,
  CONFIG_PROPORTION_MATERNITY_INSURANCE_PERSONAL,
  CONFIG_PROPORTION_MATERNITY_INSURANCE_COMPANY,
  CONFIG_PROPORTION_INDUSTRIAL_INJURY_INSURANCE_PERSONAL,
  CONFIG_PROPORTION_INDUSTRIAL_INJURY_INSURANCE_COMPANY,
  CONFIG_PROPORTION_PERSONAL_PERFORMANCE
}
eladmin-web-master/src/views/system/level/index.vue
New file
@@ -0,0 +1,618 @@
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-select v-model="query.jobId" filterable clearable placeholder="所属岗位" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in jobs"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          />
        </el-select>
        <el-input v-model="query.name" clearable placeholder="名称" 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="150px">
          <el-form-item label="所属岗位" prop="jobId">
            <el-select v-model="form.jobId" filterable clearable placeholder="所属岗位" style="width: 300px;">
              <el-option
                v-for="item in jobs"
                :key="item.id"
                :label="item.name"
                :value="item.id"
                :disabled="!item.enabled"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="名称" prop="name">
            <el-input v-model="form.name" style="width: 300px;" />
          </el-form-item>
          <el-form-item label="描述">
            <el-input v-model="form.description" :rows="3" type="textarea" style="width: 300px;" />
          </el-form-item>
          <el-form-item label="级别工资" prop="levelWage">
            <money-input :key="random" v-model="form.levelWage" :width="300" />
          </el-form-item>
          <el-form-item label="基本工资比例" prop="basicWageProportion">
            <el-input v-model="form.basicWageProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="绩效工资比例" prop="achievementsWageProportion">
            <el-input v-model="form.achievementsWageProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="业绩工资比例" prop="performanceWageProportion">
            <el-input v-model="form.performanceWageProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="团队工资比例" prop="teamWageProportion">
            <el-input v-model="form.teamWageProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="公积金基数" prop="accumulationRadix">
            <money-input :key="random" v-model="form.accumulationRadix" :width="300" />
          </el-form-item>
          <el-form-item label="公积金个人缴纳比例" prop="accumulationPersonalProportion">
            <el-input v-model="form.accumulationPersonalProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="公积金公司缴纳比例" prop="accumulationCompanyProportion">
            <el-input v-model="form.accumulationCompanyProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="养老险基数" prop="pensionRadix">
            <money-input :key="random" v-model="form.pensionRadix" :width="300" />
          </el-form-item>
          <el-form-item label="养老险个人缴纳比例" prop="pensionPersonalProportion">
            <el-input v-model="form.pensionPersonalProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="养老险公司缴纳比例" prop="pensionCompanyProportion">
            <el-input v-model="form.pensionCompanyProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="医疗险基数" prop="medicalRadix">
            <money-input :key="random" v-model="form.medicalRadix" :width="300" />
          </el-form-item>
          <el-form-item label="医疗险个人缴纳比例" prop="medicalPersonalProportion">
            <el-input v-model="form.medicalPersonalProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="医疗险公司缴纳比例" prop="medicalCompanyProportion">
            <el-input v-model="form.medicalCompanyProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="失业险基数" prop="unemploymentRadix">
            <money-input :key="random" v-model="form.unemploymentRadix" :width="300" />
          </el-form-item>
          <el-form-item label="失业险个人缴纳比例" prop="unemploymentPersonalProportion">
            <el-input v-model="form.unemploymentPersonalProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="失业险公司缴纳比例" prop="unemploymentCompanyProportion">
            <el-input v-model="form.unemploymentCompanyProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="生育险基数" prop="maternityRadix">
            <money-input :key="random" v-model="form.maternityRadix" :width="300" />
          </el-form-item>
          <el-form-item label="生育险个人缴纳比例" prop="maternityPersonalProportion">
            <el-input v-model="form.maternityPersonalProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="生育险公司缴纳比例" prop="maternityCompanyProportion">
            <el-input v-model="form.maternityCompanyProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="工伤险基数" prop="industrialInjuryRadix">
            <money-input :key="random" v-model="form.industrialInjuryRadix" :width="300" />
          </el-form-item>
          <el-form-item label="工伤险个人缴纳比例" prop="industrialInjuryPersonalProportion">
            <el-input v-model="form.industrialInjuryPersonalProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="工伤险公司缴纳比例" prop="industrialInjuryCompanyProportion">
            <el-input v-model="form.industrialInjuryCompanyProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="个人业绩比例" prop="personalPerformanceProportion">
            <el-input v-model="form.personalPerformanceProportion" style="width: 300px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="年假天数" prop="annualLeaveDays">
            <el-input v-model="form.annualLeaveDays" style="width: 300px;" />
          </el-form-item>
          <el-form-item label="备注">
            <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 300px;" />
          </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 :show-overflow-tooltip="true" prop="jobName" label="岗位名称" width="100">
          <template slot-scope="scope">
            <el-tag>{{ scope.row.jobName }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="name" label="名称" width="100" />
        <el-table-column :show-overflow-tooltip="true" prop="description" label="描述" width="140" />
        <el-table-column :show-overflow-tooltip="true" prop="levelWage" label="级别工资" width="100">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.levelWage) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="basicWageProportion" label="基本工资比例" width="100">
          <template slot-scope="scope">
            {{ scope.row.basicWageProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="achievementsWageProportion" label="绩效工资比例" width="100">
          <template slot-scope="scope">
            {{ scope.row.achievementsWageProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="performanceWageProportion" label="业绩工资比例" width="100">
          <template slot-scope="scope">
            {{ scope.row.performanceWageProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="teamWageProportion" label="团队工资比例" width="100">
          <template slot-scope="scope">
            {{ scope.row.teamWageProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="accumulationRadix" label="公积金基数" width="100">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.accumulationRadix) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="accumulationPersonalProportion" label="公积金个人缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.accumulationPersonalProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="accumulationCompanyProportion" label="公积金公司缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.accumulationCompanyProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="pensionRadix" label="养老险基数" width="100">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.pensionRadix) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="pensionPersonalProportion" label="养老险个人缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.pensionPersonalProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="pensionCompanyProportion" label="养老险公司缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.pensionCompanyProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="medicalRadix" label="医疗险基数" width="100">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.medicalRadix) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="medicalPersonalProportion" label="医疗险个人缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.medicalPersonalProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="medicalCompanyProportion" label="医疗险公司缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.medicalCompanyProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="unemploymentRadix" label="失业险基数" width="100">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.unemploymentRadix) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="unemploymentPersonalProportion" label="失业险个人缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.unemploymentPersonalProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="unemploymentCompanyProportion" label="失业险公司缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.unemploymentCompanyProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="maternityRadix" label="生育险基数" width="100">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.maternityRadix) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="maternityPersonalProportion" label="生育险个人缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.maternityPersonalProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="maternityCompanyProportion" label="生育险公司缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.maternityCompanyProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="industrialInjuryRadix" label="工伤险基数" width="100">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.industrialInjuryRadix) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="industrialInjuryPersonalProportion" label="工伤险个人缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.industrialInjuryPersonalProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="industrialInjuryCompanyProportion" label="工伤险公司缴纳比例" width="130">
          <template slot-scope="scope">
            {{ scope.row.industrialInjuryCompanyProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="personalPerformanceProportion" label="个人业绩比例" width="100">
          <template slot-scope="scope">
            {{ scope.row.personalPerformanceProportion }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="annualLeaveDays" label="年假天数" width="100">
          <template slot-scope="scope">
            {{ scope.row.annualLeaveDays }}天
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" width="140" />
        <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" width="140" />
        <el-table-column v-if="checkPer(['admin','sysLevel:edit','sysLevel:del'])" label="操作" width="150px" align="center" fixed="right">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
<script>
import crudSysLevel from '@/api/system/level'
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'
import moneyInput from '../../assembly/moneyInput/index.vue'
import constant from '../../../utils/constant.js'
import crudJob from '@/api/system/job'
import crudConfigProportion from '@/api/system/configProportion'
const defaultForm = { id: null, jobId: null, name: null, description: null, levelWage: null, basicWageProportion: null, achievementsWageProportion: null, performanceWageProportion: null, teamWageProportion: null, accumulationRadix: null, accumulationPersonalProportion: null, accumulationCompanyProportion: null, pensionRadix: null, pensionPersonalProportion: null, pensionCompanyProportion: null, medicalRadix: null, medicalPersonalProportion: null, medicalCompanyProportion: null, unemploymentRadix: null, unemploymentPersonalProportion: null, unemploymentCompanyProportion: null, maternityRadix: null, maternityPersonalProportion: null, maternityCompanyProportion: null, industrialInjuryRadix: null, industrialInjuryPersonalProportion: null, industrialInjuryCompanyProportion: null, personalPerformanceProportion: null, annualLeaveDays: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'SysLevel',
  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '级别', url: 'api/sysLevel', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysLevel }})
  },
  data() {
    // 工资(千万内)验证
    var wageValidate = (rule, value, callback) => {
      if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 10000000)) {
        callback(new Error('请输入 一千万 以内的正整数或两位小数'))
      } else {
        callback()
      }
    }
    // 比例(百内)验证
    var proportionValidate = (rule, value, callback) => {
      const reg = /^([0-9]|[1-9]\d)(\.\d{1,2})?$|100$/
      if (value != null && value !== '' && !reg.test(value)) {
        callback(new Error('请输入 一百 以内的正整数或两位小数'))
      } else {
        callback()
      }
    }
    // 天数(百内)验证
    var dayValidate = (rule, value, callback) => {
      const reg = /^([0-9]|[1-9]\d)$|100$/
      if (value != null && value !== '' && !reg.test(value)) {
        callback(new Error('请输入 一百 以内的正整数'))
      } else {
        callback()
      }
    }
    return {
      permission: {
        add: ['admin', 'sysLevel:add'],
        edit: ['admin', 'sysLevel:edit'],
        del: ['admin', 'sysLevel:del'],
        download: ['admin', 'sysLevel:download']
      },
      rules: {
        jobId: [
          { required: true, message: '所属岗位不能为空', trigger: 'change' }
        ],
        name: [
          { required: true, message: '名称不能为空', trigger: 'blur' },
          { max: 100, message: '最大长度 100 个字符', trigger: 'blur' }
        ],
        levelWage: [
          { required: true, message: '级别工资不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        basicWageProportion: [
          { required: true, message: '基本工资比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        achievementsWageProportion: [
          { required: true, message: '绩效工资比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        performanceWageProportion: [
          { required: true, message: '业绩工资比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        teamWageProportion: [
          { required: true, message: '团队工资比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        accumulationRadix: [
          { required: true, message: '公积金基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        accumulationPersonalProportion: [
          { required: true, message: '公积金个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        accumulationCompanyProportion: [
          { required: true, message: '公积金公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        pensionRadix: [
          { required: true, message: '养老险基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        pensionPersonalProportion: [
          { required: true, message: '养老险个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        pensionCompanyProportion: [
          { required: true, message: '养老险公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        medicalRadix: [
          { required: true, message: '医疗险基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        medicalPersonalProportion: [
          { required: true, message: '医疗险个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        medicalCompanyProportion: [
          { required: true, message: '医疗险公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        unemploymentRadix: [
          { required: true, message: '失业险基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        unemploymentPersonalProportion: [
          { required: true, message: '失业险个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        unemploymentCompanyProportion: [
          { required: true, message: '失业险公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        maternityRadix: [
          { required: true, message: '生育险基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        maternityPersonalProportion: [
          { required: true, message: '生育险个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        maternityCompanyProportion: [
          { required: true, message: '生育险公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        industrialInjuryRadix: [
          { required: true, message: '工伤险基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        industrialInjuryPersonalProportion: [
          { required: true, message: '工伤险个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        industrialInjuryCompanyProportion: [
          { required: true, message: '工伤险公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        personalPerformanceProportion: [
          { required: true, message: '个人业绩比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        annualLeaveDays: [
          { required: true, message: '年假天数不能为空', trigger: 'blur' },
          { validator: dayValidate, trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'jobId', display_name: '岗位ID' },
        { key: 'name', display_name: '名称' }
      ],
      // 比例配置:基本工资比例
      configProportionBasicWage: constant.CONFIG_PROPORTION_BASIC_WAGE,
      // 比例配置:绩效工资比例
      configProportionMeritWage: constant.CONFIG_PROPORTION_MERIT_WAGE,
      // 比例配置:业绩工资比例
      configProportionAchievementWage: constant.CONFIG_PROPORTION_ACHIEVEMENT_WAGE,
      // 比例配置:团队工资比例
      configProportionTeamWage: constant.CONFIG_PROPORTION_TEAM_WAGE,
      // 比例配置:公积金个人缴纳比例
      configProportionAccumulationFundPersonal: constant.CONFIG_PROPORTION_ACCUMULATION_FUND_PERSONAL,
      // 比例配置:公积金公司缴纳比例
      configProportionAccumulationFundCompany: constant.CONFIG_PROPORTION_ACCUMULATION_FUND_COMPANY,
      // 比例配置:养老险个人缴纳比例
      configProportionPensionInsurancePersonal: constant.CONFIG_PROPORTION_PENSION_INSURANCE_PERSONAL,
      // 比例配置:养老险公司缴纳比例
      configProportionPensionInsuranceCompany: constant.CONFIG_PROPORTION_PENSION_INSURANCE_COMPANY,
      // 比例配置:医疗险个人缴纳比例
      configProportionMedicalInsurancePersonal: constant.CONFIG_PROPORTION_MEDICAL_INSURANCE_PERSONAL,
      // 比例配置:医疗险公司缴纳比例
      configProportionMedicalInsuranceCompany: constant.CONFIG_PROPORTION_MEDICAL_INSURANCE_COMPANY,
      // 比例配置:失业险个人缴纳比例
      configProportionUnemploymentInsurancePersonal: constant.CONFIG_PROPORTION_UNEMPLOYMENT_INSURANCE_PERSONAL,
      // 比例配置:失业险公司缴纳比例
      configProportionUnemploymentInsuranceCompany: constant.CONFIG_PROPORTION_UNEMPLOYMENT_INSURANCE_COMPANY,
      // 比例配置:生育险个人缴纳比例
      configProportionMaternityInsurancePersonal: constant.CONFIG_PROPORTION_MATERNITY_INSURANCE_PERSONAL,
      // 比例配置:生育险公司缴纳比例
      configProportionMaternityInsuranceCompany: constant.CONFIG_PROPORTION_MATERNITY_INSURANCE_COMPANY,
      // 比例配置:工伤险个人缴纳比例
      configProportionIndustrialInjuryInsurancePersonal: constant.CONFIG_PROPORTION_INDUSTRIAL_INJURY_INSURANCE_PERSONAL,
      // 比例配置:工伤险公司缴纳比例
      configProportionIndustrialInjuryInsuranceCompany: constant.CONFIG_PROPORTION_INDUSTRIAL_INJURY_INSURANCE_COMPANY,
      // 比例配置:个人业绩比例
      configProportionPersonalPerformance: constant.CONFIG_PROPORTION_PERSONAL_PERFORMANCE,
      // 岗位列表
      jobs: [],
      // 比例列表
      proportions: [],
      // 随机数
      random: 0
    }
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      // 获取所有岗位
      this.getAllJob()
      // 获取比例配置
      this.getAllProportion()
      return true
    },
    // 获取所有岗位
    getAllJob() {
      // 获取所有岗位
      crudJob.getAll().then(res => {
        // 岗位列表
        this.jobs = res
      }).catch(() => {
      })
    },
    // 获取比例配置
    getAllProportion() {
      // 获取比例配置
      crudConfigProportion.getAll().then(res => {
        // 比例列表
        this.proportions = res
      }).catch(() => {
      })
    },
    // 钩子: 开始 "新建/编辑" - 之前
    [CRUD.HOOK.beforeToCU]() {
      // 随机数
      this.random = Math.random()
    },
    // 钩子:新建 - 之前
    [CRUD.HOOK.beforeToAdd]() {
      // 循环比例列表
      for (const item of this.proportions) {
        // 判断比例配置
        if (item.title === this.configProportionBasicWage) {
          // 基本工资比例
          this.form.basicWageProportion = item.proportion
        } else if (item.title === this.configProportionMeritWage) {
          // 绩效工资比例
          this.form.achievementsWageProportion = item.proportion
        } else if (item.title === this.configProportionAchievementWage) {
          // 业绩工资比例
          this.form.performanceWageProportion = item.proportion
        } else if (item.title === this.configProportionTeamWage) {
          // 团队工资比例
          this.form.teamWageProportion = item.proportion
        } else if (item.title === this.configProportionAccumulationFundPersonal) {
          // 公积金个人缴纳比例
          this.form.accumulationPersonalProportion = item.proportion
        } else if (item.title === this.configProportionAccumulationFundCompany) {
          // 公积金公司缴纳比例
          this.form.accumulationCompanyProportion = item.proportion
        } else if (item.title === this.configProportionPensionInsurancePersonal) {
          // 养老险个人缴纳比例
          this.form.pensionPersonalProportion = item.proportion
        } else if (item.title === this.configProportionPensionInsuranceCompany) {
          // 养老险公司缴纳比例
          this.form.pensionCompanyProportion = item.proportion
        } else if (item.title === this.configProportionMedicalInsurancePersonal) {
          // 医疗险个人缴纳比例
          this.form.medicalPersonalProportion = item.proportion
        } else if (item.title === this.configProportionMedicalInsuranceCompany) {
          // 医疗险公司缴纳比例
          this.form.medicalCompanyProportion = item.proportion
        } else if (item.title === this.configProportionUnemploymentInsurancePersonal) {
          // 失业险个人缴纳比例
          this.form.unemploymentPersonalProportion = item.proportion
        } else if (item.title === this.configProportionUnemploymentInsuranceCompany) {
          // 失业险公司缴纳比例
          this.form.unemploymentCompanyProportion = item.proportion
        } else if (item.title === this.configProportionMaternityInsurancePersonal) {
          // 生育险个人缴纳比例
          this.form.maternityPersonalProportion = item.proportion
        } else if (item.title === this.configProportionMaternityInsuranceCompany) {
          // 生育险公司缴纳比例
          this.form.maternityCompanyProportion = item.proportion
        } else if (item.title === this.configProportionIndustrialInjuryInsurancePersonal) {
          // 工伤险个人缴纳比例
          this.form.industrialInjuryPersonalProportion = item.proportion
        } else if (item.title === this.configProportionIndustrialInjuryInsuranceCompany) {
          // 工伤险公司缴纳比例
          this.form.industrialInjuryCompanyProportion = item.proportion
        } else if (item.title === this.configProportionPersonalPerformance) {
          // 个人业绩比例
          this.form.personalPerformanceProportion = item.proportion
        }
      }
    }
  }
}
</script>
<style scoped>
</style>
eladmin-web-master/src/views/system/user/index.vue
@@ -97,6 +97,7 @@
                  :key="item.name"
                  :label="item.name"
                  :value="item.id"
                  :disabled="!item.enabled"
                />
              </el-select>
            </el-form-item>
@@ -192,7 +193,7 @@
import { isvalidPhone } from '@/utils/validate'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { getAll, getLevel } from '@/api/system/role'
import { getAllJob } from '@/api/system/job'
import crudJob from '@/api/system/job'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
@@ -460,8 +461,8 @@
    },
    // 获取弹窗内岗位数据
    getJobs() {
      getAllJob().then(res => {
        this.jobs = res.content
      crudJob.getAll().then(res => {
        this.jobs = res
      }).catch(() => { })
    },
    // 获取权限级别