14 files added
7 files modified
| New file |
| | |
| | | /* |
| | | * 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 wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="sys_config_individual_income_tax") |
| | | public class SysConfigIndividualIncomeTax extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`gear_amount`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "档位金额") |
| | | private BigDecimal gearAmount; |
| | | |
| | | @Column(name = "`tax_rate`") |
| | | @ApiModelProperty(value = "税率") |
| | | private Double taxRate; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | |
| | | public void copy(SysConfigIndividualIncomeTax source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| | |
| | | * @date 2022-12-12 |
| | | **/ |
| | | public interface SysConfigHolidayRepository extends JpaRepository<SysConfigHoliday, Long>, JpaSpecificationExecutor<SysConfigHoliday> { |
| | | |
| | | /** 根据日期查询 */ |
| | | @Query(value = "SELECT * FROM `sys_config_holiday` WHERE holiday_date = ? ", nativeQuery = true) |
| | | SysConfigHoliday findByHolidayDate(String holidayDate); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.SysConfigHoliday; |
| | | import me.zhengjie.modules.system.domain.SysConfigIndividualIncomeTax; |
| | | 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 wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | public interface SysConfigIndividualIncomeTaxRepository extends JpaRepository<SysConfigIndividualIncomeTax, Long>, JpaSpecificationExecutor<SysConfigIndividualIncomeTax> { |
| | | |
| | | /** 根据金额查询个人所得税表 */ |
| | | @Query(value = "SELECT * FROM `sys_config_individual_income_tax` WHERE gear_amount = ?", nativeQuery = true) |
| | | SysConfigIndividualIncomeTax findByGearAmount(String gearAmount); |
| | | } |
| | |
| | | * @date 2022-12-13 |
| | | **/ |
| | | public interface SysConfigProportionRepository extends JpaRepository<SysConfigProportion, Long>, JpaSpecificationExecutor<SysConfigProportion> { |
| | | |
| | | @Query(value = "SELECT * from sys_config_proportion WHERE title = ?", nativeQuery = true) |
| | | SysConfigProportion findByTitle(String title); |
| | | } |
| | |
| | | * @date 2022-12-13 |
| | | **/ |
| | | public interface SysRosteringRepository extends JpaRepository<SysRostering, Long>, JpaSpecificationExecutor<SysRostering> { |
| | | |
| | | @Query(value = "SELECT * FROM `sys_rostering` WHERE name = ?",nativeQuery = true) |
| | | SysRostering findByName(String name); |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.SysConfigIndividualIncomeTax; |
| | | import me.zhengjie.modules.system.service.SysConfigIndividualIncomeTaxService; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigIndividualIncomeTaxQueryCriteria; |
| | | 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 wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "个人所得税管理") |
| | | @RequestMapping("/api/sysConfigIndividualIncomeTax") |
| | | public class SysConfigIndividualIncomeTaxController { |
| | | |
| | | private final SysConfigIndividualIncomeTaxService sysConfigIndividualIncomeTaxService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('sysConfigIndividualIncomeTax:list')") |
| | | public void exportSysConfigIndividualIncomeTax(HttpServletResponse response, SysConfigIndividualIncomeTaxQueryCriteria criteria) throws IOException { |
| | | sysConfigIndividualIncomeTaxService.download(sysConfigIndividualIncomeTaxService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询个人所得税") |
| | | @ApiOperation("查询个人所得税") |
| | | @PreAuthorize("@el.check('sysConfigIndividualIncomeTax:list')") |
| | | public ResponseEntity<Object> querySysConfigIndividualIncomeTax(SysConfigIndividualIncomeTaxQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysConfigIndividualIncomeTaxService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询个人所得税") |
| | | @ApiOperation("查询个人所得税") |
| | | @PreAuthorize("@el.check('sysConfigIndividualIncomeTax:list')") |
| | | public ResponseEntity<Object> querySysConfigIndividualIncomeTax(SysConfigIndividualIncomeTaxQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysConfigIndividualIncomeTaxService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增个人所得税") |
| | | @ApiOperation("新增个人所得税") |
| | | @PreAuthorize("@el.check('sysConfigIndividualIncomeTax:add')") |
| | | public ResponseEntity<Object> createSysConfigIndividualIncomeTax(@Validated @RequestBody SysConfigIndividualIncomeTax resources){ |
| | | return new ResponseEntity<>(sysConfigIndividualIncomeTaxService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改个人所得税") |
| | | @ApiOperation("修改个人所得税") |
| | | @PreAuthorize("@el.check('sysConfigIndividualIncomeTax:edit')") |
| | | public ResponseEntity<Object> updateSysConfigIndividualIncomeTax(@Validated @RequestBody SysConfigIndividualIncomeTax resources){ |
| | | sysConfigIndividualIncomeTaxService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除个人所得税") |
| | | @ApiOperation("删除个人所得税") |
| | | @PreAuthorize("@el.check('sysConfigIndividualIncomeTax:del')") |
| | | public ResponseEntity<Object> deleteSysConfigIndividualIncomeTax(@RequestBody Long[] ids) { |
| | | sysConfigIndividualIncomeTaxService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.SysConfigIndividualIncomeTax; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigIndividualIncomeTaxDto; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigIndividualIncomeTaxQueryCriteria; |
| | | 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 wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | public interface SysConfigIndividualIncomeTaxService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysConfigIndividualIncomeTaxQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SysConfigIndividualIncomeTaxDto> |
| | | */ |
| | | List<SysConfigIndividualIncomeTaxDto> queryAll(SysConfigIndividualIncomeTaxQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SysConfigIndividualIncomeTaxDto |
| | | */ |
| | | SysConfigIndividualIncomeTaxDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SysConfigIndividualIncomeTaxDto |
| | | */ |
| | | SysConfigIndividualIncomeTaxDto create(SysConfigIndividualIncomeTax resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysConfigIndividualIncomeTax resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysConfigIndividualIncomeTaxDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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 wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @Data |
| | | public class SysConfigIndividualIncomeTaxDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 档位金额 */ |
| | | private BigDecimal gearAmount; |
| | | |
| | | /** 税率 */ |
| | | private Double taxRate; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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.math.BigDecimal; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @Data |
| | | public class SysConfigIndividualIncomeTaxQueryCriteria{ |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private BigDecimal gearAmount; |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysConfigHolidayDto create(SysConfigHoliday resources) { |
| | | SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findByHolidayDate(resources.getHolidayDate().toString()); |
| | | if(ObjectUtils.isNotEmpty(sysConfigHoliday)){ |
| | | throw new BadRequestException("节日日期已存在"); |
| | | } |
| | | //判断日期是否存在 |
| | | getInfo(resources,null); |
| | | return sysConfigHolidayMapper.toDto(sysConfigHolidayRepository.save(resources)); |
| | | } |
| | | |
| | |
| | | public void update(SysConfigHoliday resources) { |
| | | SysConfigHoliday sysConfigHoliday = sysConfigHolidayRepository.findById(resources.getId()).orElseGet(SysConfigHoliday::new); |
| | | ValidationUtil.isNull( sysConfigHoliday.getId(),"SysConfigHoliday","id",resources.getId()); |
| | | SysConfigHoliday configHoliday = sysConfigHolidayRepository.findByHolidayDate(resources.getHolidayDate().toString()); |
| | | //判断日期是否存在 |
| | | getInfo(resources,sysConfigHoliday); |
| | | sysConfigHoliday.copy(resources); |
| | | if (configHoliday != null && !sysConfigHoliday.getId().equals(configHoliday.getId())) { |
| | | throw new BadRequestException("节日日期已存在"); |
| | | } |
| | | sysConfigHolidayRepository.save(sysConfigHoliday); |
| | | } |
| | | |
| | | /** |
| | | * 判断日期是否存在 |
| | | */ |
| | | public void getInfo(SysConfigHoliday resources,SysConfigHoliday sysConfigHoliday){ |
| | | //根据日期查询 |
| | | SysConfigHoliday configHoliday = sysConfigHolidayRepository.findByHolidayDate(resources.getHolidayDate().toString()); |
| | | //id不是空就是添加,否则就是修改验证 |
| | | if(ObjectUtils.isNotEmpty(resources.getId())){ |
| | | if (configHoliday != null && !sysConfigHoliday.getId().equals(configHoliday.getId())) { |
| | | throw new BadRequestException("节日日期已存在"); |
| | | } |
| | | }else{ |
| | | if (configHoliday != null) { |
| | | throw new BadRequestException("节日日期已存在"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| New file |
| | |
| | | /* |
| | | * 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.exception.BadRequestException; |
| | | import me.zhengjie.modules.system.domain.SysConfigIndividualIncomeTax; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.SysConfigIndividualIncomeTaxRepository; |
| | | import me.zhengjie.modules.system.service.SysConfigIndividualIncomeTaxService; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigIndividualIncomeTaxDto; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigIndividualIncomeTaxQueryCriteria; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysConfigIndividualIncomeTaxMapper; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | 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 wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SysConfigIndividualIncomeTaxServiceImpl implements SysConfigIndividualIncomeTaxService { |
| | | |
| | | private final SysConfigIndividualIncomeTaxRepository sysConfigIndividualIncomeTaxRepository; |
| | | private final SysConfigIndividualIncomeTaxMapper sysConfigIndividualIncomeTaxMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysConfigIndividualIncomeTaxQueryCriteria criteria, Pageable pageable){ |
| | | Page<SysConfigIndividualIncomeTax> page = sysConfigIndividualIncomeTaxRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(sysConfigIndividualIncomeTaxMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysConfigIndividualIncomeTaxDto> queryAll(SysConfigIndividualIncomeTaxQueryCriteria criteria){ |
| | | return sysConfigIndividualIncomeTaxMapper.toDto(sysConfigIndividualIncomeTaxRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public SysConfigIndividualIncomeTaxDto findById(Long id) { |
| | | SysConfigIndividualIncomeTax sysConfigIndividualIncomeTax = sysConfigIndividualIncomeTaxRepository.findById(id).orElseGet(SysConfigIndividualIncomeTax::new); |
| | | ValidationUtil.isNull(sysConfigIndividualIncomeTax.getId(),"SysConfigIndividualIncomeTax","id",id); |
| | | return sysConfigIndividualIncomeTaxMapper.toDto(sysConfigIndividualIncomeTax); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysConfigIndividualIncomeTaxDto create(SysConfigIndividualIncomeTax resources) { |
| | | //判断金额是否存在 |
| | | getInfo(resources,null); |
| | | return sysConfigIndividualIncomeTaxMapper.toDto(sysConfigIndividualIncomeTaxRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(SysConfigIndividualIncomeTax resources) { |
| | | SysConfigIndividualIncomeTax sysConfigIndividualIncomeTax = sysConfigIndividualIncomeTaxRepository.findById(resources.getId()).orElseGet(SysConfigIndividualIncomeTax::new); |
| | | ValidationUtil.isNull( sysConfigIndividualIncomeTax.getId(),"SysConfigIndividualIncomeTax","id",resources.getId()); |
| | | //判断金额是否存在 |
| | | getInfo(resources,sysConfigIndividualIncomeTax); |
| | | sysConfigIndividualIncomeTax.copy(resources); |
| | | sysConfigIndividualIncomeTaxRepository.save(sysConfigIndividualIncomeTax); |
| | | } |
| | | |
| | | /** |
| | | * 判断金额是否存在 |
| | | */ |
| | | public void getInfo(SysConfigIndividualIncomeTax resources,SysConfigIndividualIncomeTax sysConfigIndividualIncomeTax){ |
| | | // 根据金额查询 |
| | | SysConfigIndividualIncomeTax configIndividualIncomeTax = sysConfigIndividualIncomeTaxRepository.findByGearAmount(resources.getGearAmount().toString()); |
| | | //id不是空就是添加,否则就是修改验证 |
| | | if(ObjectUtils.isNotEmpty(resources.getId())){ |
| | | if(configIndividualIncomeTax != null && configIndividualIncomeTax.getId() != sysConfigIndividualIncomeTax.getId()){ |
| | | throw new BadRequestException("档位金额已存在"); |
| | | } |
| | | }else{ |
| | | if(configIndividualIncomeTax != null){ |
| | | throw new BadRequestException("档位金额已存在"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | sysConfigIndividualIncomeTaxRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<SysConfigIndividualIncomeTaxDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (SysConfigIndividualIncomeTaxDto sysConfigIndividualIncomeTax : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("档位金额", sysConfigIndividualIncomeTax.getGearAmount()); |
| | | map.put("税率", sysConfigIndividualIncomeTax.getTaxRate()); |
| | | map.put("备注", sysConfigIndividualIncomeTax.getRemarks()); |
| | | map.put("创建者", sysConfigIndividualIncomeTax.getCreateBy()); |
| | | map.put("创建时间", sysConfigIndividualIncomeTax.getCreateTime()); |
| | | map.put("更新者", sysConfigIndividualIncomeTax.getUpdateBy()); |
| | | map.put("更新时间", sysConfigIndividualIncomeTax.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysConfigProportionDto create(SysConfigProportion resources) { |
| | | SysConfigProportion sysConfigProportion = sysConfigProportionRepository.findByTitle(resources.getTitle()); |
| | | if(ObjectUtils.isNotEmpty(sysConfigProportion)){ |
| | | throw new BadRequestException("标题已存在"); |
| | | } |
| | | return sysConfigProportionMapper.toDto(sysConfigProportionRepository.save(resources)); |
| | | } |
| | | |
| | |
| | | public void update(SysConfigProportion resources) { |
| | | SysConfigProportion sysConfigProportion = sysConfigProportionRepository.findById(resources.getId()).orElseGet(SysConfigProportion::new); |
| | | ValidationUtil.isNull( sysConfigProportion.getId(),"SysConfigProportion","id",resources.getId()); |
| | | SysConfigProportion configProportion = sysConfigProportionRepository.findByTitle(resources.getTitle()); |
| | | sysConfigProportion.copy(resources); |
| | | if(configProportion != null && sysConfigProportion.getId() != configProportion.getId()){ |
| | | throw new BadRequestException("标题已存在"); |
| | | } |
| | | sysConfigProportionRepository.save(sysConfigProportion); |
| | | } |
| | | |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysRosteringDto create(SysRostering resources) { |
| | | SysRostering sysRostering = sysRosteringRepository.findByName(resources.getName()); |
| | | if(ObjectUtils.isNotEmpty(sysRostering)){ |
| | | throw new BadRequestException("排班名称已存在"); |
| | | } |
| | | return sysRosteringMapper.toDto(sysRosteringRepository.save(resources)); |
| | | } |
| | | |
| | |
| | | public void update(SysRostering resources) { |
| | | SysRostering sysRostering = sysRosteringRepository.findById(resources.getId()).orElseGet(SysRostering::new); |
| | | ValidationUtil.isNull( sysRostering.getId(),"SysRostering","id",resources.getId()); |
| | | SysRostering rostering = sysRosteringRepository.findByName(resources.getName()); |
| | | sysRostering.copy(resources); |
| | | if(rostering != null && !sysRostering.getId().equals(rostering.getId())){ |
| | | throw new BadRequestException("排班名称已存在"); |
| | | } |
| | | sysRosteringRepository.save(sysRostering); |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * 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.SysConfigIndividualIncomeTax; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigIndividualIncomeTaxDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysConfigIndividualIncomeTaxMapper extends BaseMapper<SysConfigIndividualIncomeTaxDto, SysConfigIndividualIncomeTax> { |
| | | |
| | | } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysConfigIndividualIncomeTax', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/sysConfigIndividualIncomeTax/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/sysConfigIndividualIncomeTax', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| New file |
| | |
| | | // 最大页数 |
| | | 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 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 |
| | | } |
| New file |
| | |
| | | <template> |
| | | <div> |
| | | <el-upload |
| | | ref="upload" |
| | | class="upload-demo" |
| | | :headers="headers" |
| | | :action="fileUploadApi + '?name=' + new Date().getTime()" |
| | | :file-list="fileList" |
| | | :auto-upload="false" |
| | | drag |
| | | multiple |
| | | :limit="limit" |
| | | :on-change="handleChange" |
| | | :on-exceed="handleExceed" |
| | | :on-remove="handleRemove" |
| | | :on-success="handleSuccess" |
| | | :on-error="handleError" |
| | | :on-preview="handlePreview" |
| | | :disabled="disabled" |
| | | > |
| | | <i class="el-icon-upload" /> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | | <div slot="tip" class="el-upload__tip" /> |
| | | </el-upload> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapGetters } from 'vuex' |
| | | import { getToken } from '@/utils/auth' |
| | | export default { |
| | | name: 'FileUpload', |
| | | props: { |
| | | fileUrl: { |
| | | type: String, |
| | | default() { |
| | | return null |
| | | } |
| | | }, |
| | | limit: { |
| | | type: Number, |
| | | default() { |
| | | return 1 |
| | | } |
| | | }, |
| | | disabled: { |
| | | type: Boolean, |
| | | default() { |
| | | return false |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | // 请求头 |
| | | headers: { 'Authorization': getToken() }, |
| | | // 文件列表 |
| | | fileList: [] |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'fileUploadApi', |
| | | 'baseApi' |
| | | ]) |
| | | }, |
| | | mounted() { |
| | | // 判断文件路径参数是否为空 |
| | | if (this.fileUrl !== null) { |
| | | // 文件路径数组 |
| | | const fileUrlList = this.fileUrl.split(',') |
| | | // 循环文件路径数组 |
| | | for (let i = 0; i < fileUrlList.length; i++) { |
| | | // 临时集合 |
| | | const tempOption = {} |
| | | // 临时集合添加文件路径参数 |
| | | tempOption.url = this.baseApi + fileUrlList[i] |
| | | tempOption.name = fileUrlList[i].substring(fileUrlList[i].lastIndexOf('/') + 1, fileUrlList[i].lastIndexOf('-')) + fileUrlList[i].substring(fileUrlList[i].lastIndexOf('.'), fileUrlList[i].length) |
| | | // 文件列表添加临时集合 |
| | | this.fileList.push(tempOption) |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // 改变事件 |
| | | handleChange(file, fileList) { |
| | | // 文件列表赋值 |
| | | this.fileList = fileList |
| | | }, |
| | | // 个数限制事件 |
| | | handleExceed(files, fileList) { |
| | | this.$message.warning('文件个数超出上限,请先移除文件再上传!') |
| | | }, |
| | | // 移除事件 |
| | | handleRemove(file, fileList) { |
| | | // 文件列表赋值 |
| | | this.fileList = fileList |
| | | }, |
| | | // 成功事件 |
| | | handleSuccess(response, file, fileList) { |
| | | // 循环文件列表 |
| | | for (let i = 0; i < fileList.length; i++) { |
| | | // 判断文件状态 |
| | | if (fileList[i].status === 'ready' || fileList[i].status === 'uploading') { |
| | | // 终止 |
| | | return |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === fileList.length - 1) { |
| | | // 向父页面发送参数:“fileInfo”是参数名,“fileList”是参数值。 |
| | | this.$emit('fileInfo', fileList) |
| | | } |
| | | } |
| | | }, |
| | | // 失败事件 |
| | | handleError(err) { |
| | | console.log(err) |
| | | }, |
| | | // 点击事件 |
| | | handlePreview(file) { |
| | | var a = document.createElement('a') |
| | | var event = new MouseEvent('click') |
| | | a.download = file.name |
| | | a.href = file.url |
| | | a.target = '_blank' |
| | | a.dispatchEvent(event) |
| | | }, |
| | | // 上传文件 |
| | | submit() { |
| | | // 判断文件列表长度 |
| | | if (this.fileList.length === 0) { |
| | | // 向父页面发送参数:“fileInfo”是参数名,“this.fileList”是参数值。 |
| | | this.$emit('fileInfo', this.fileList) |
| | | // 终止 |
| | | return |
| | | } |
| | | // 循环文件列表 |
| | | for (let i = 0; i < this.fileList.length; i++) { |
| | | // 判断文件状态 |
| | | if (this.fileList[i].status === 'ready') { |
| | | // 将指定组件别名进行提交 |
| | | this.$refs.upload.submit() |
| | | // 终止 |
| | | return |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === this.fileList.length - 1) { |
| | | // 向父页面发送参数:“fileInfo”是参数名,“this.fileList”是参数值。 |
| | | this.$emit('fileInfo', this.fileList) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div> |
| | | <el-upload |
| | | ref="upload" |
| | | :class="{disButtonSty: noneBtnImg}" |
| | | :headers="headers" |
| | | :action="imagesUploadApi + '?name=' + new Date().getTime()" |
| | | :file-list="fileList" |
| | | list-type="picture-card" |
| | | :disabled="disabled" |
| | | :auto-upload="false" |
| | | :before-upload="beforeAvatarUpload" |
| | | :on-change="handleChange" |
| | | :on-preview="handlePictureCardPreview" |
| | | :on-remove="handleRemove" |
| | | :on-success="handleSuccess" |
| | | :on-error="handleError" |
| | | > |
| | | <i slot="default" class="el-icon-plus" /> |
| | | </el-upload> |
| | | <!-- 放大事件显示框 --> |
| | | <el-dialog :visible.sync="dialogVisible" :modal="false"> |
| | | <img width="100%" :src="dialogImageUrl" alt=""> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapGetters } from 'vuex' |
| | | import { getToken } from '@/utils/auth' |
| | | export default { |
| | | name: 'ImageUpload', |
| | | props: { |
| | | imageUrl: { |
| | | type: String, |
| | | default() { |
| | | return null |
| | | } |
| | | }, |
| | | limit: { |
| | | type: Number, |
| | | default() { |
| | | return 1 |
| | | } |
| | | }, |
| | | disabled: { |
| | | type: Boolean, |
| | | default() { |
| | | return false |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | // 控制图片上传按钮是否隐藏 |
| | | noneBtnImg: false, |
| | | // 请求头 |
| | | headers: { 'Authorization': getToken() }, |
| | | // 放大事件显示框图片路径 |
| | | dialogImageUrl: '', |
| | | // 放大事件显示框显示状态 |
| | | dialogVisible: false, |
| | | // 图片墙列表 |
| | | fileList: [] |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'imagesUploadApi', |
| | | 'baseApi' |
| | | ]) |
| | | }, |
| | | mounted() { |
| | | // 判断图片路径参数是否为空 |
| | | if (this.imageUrl !== null) { |
| | | // 图片路径数组 |
| | | const imageUrlList = this.imageUrl.split(',') |
| | | // 循环 |
| | | for (let i = 0; i < imageUrlList.length; i++) { |
| | | // 临时集合 |
| | | const itemOption = {} |
| | | // 临时集合添加图片路径参数 |
| | | itemOption.url = imageUrlList[i].indexOf('https:') === -1 ? this.baseApi + imageUrlList[i] : imageUrlList[i] |
| | | // 图片墙列表添加临时集合 |
| | | this.fileList.push(itemOption) |
| | | // 判断图片列表数量 |
| | | if (this.fileList.length >= this.limit) { |
| | | // 上传按钮隐藏 |
| | | this.noneBtnImg = true |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // 提交前校验 |
| | | beforeAvatarUpload(file) { |
| | | const isJPG = file.type === 'image/jpg' |
| | | const isJPEG = file.type === 'image/jpeg' |
| | | const isPNG = file.type === 'image/png' |
| | | const isGIF = file.type === 'image/gif' |
| | | if (!isJPG && !isJPEG && !isPNG && !isGIF) { |
| | | this.$message.error('上传头像图片只能是 JPG/JPEG/PNG/GIF 格式!') |
| | | } |
| | | return isJPG || isJPEG || isPNG || isGIF |
| | | }, |
| | | // 改变事件 |
| | | handleChange(file, fileList) { |
| | | // 图片墙列表赋值 |
| | | this.fileList = fileList |
| | | // 判断图片列表数量 |
| | | if (fileList.length >= this.limit) { |
| | | // 上传按钮隐藏 |
| | | this.noneBtnImg = true |
| | | } |
| | | }, |
| | | // 放大事件 |
| | | handlePictureCardPreview(file) { |
| | | // 放大事件显示框图片路径赋值 |
| | | this.dialogImageUrl = file.url |
| | | // 放大事件显示框显示 |
| | | this.dialogVisible = true |
| | | }, |
| | | // 移除事件 |
| | | handleRemove(file, fileList) { |
| | | // 图片墙列表赋值 |
| | | this.fileList = fileList |
| | | // 判断图片列表数量 |
| | | if (fileList.length < this.limit) { |
| | | // 上传按钮隐藏 |
| | | this.noneBtnImg = false |
| | | } |
| | | }, |
| | | // 成功事件 |
| | | handleSuccess(response, file, fileList) { |
| | | // 循环图片墙列表 |
| | | for (let i = 0; i < fileList.length; i++) { |
| | | // 判断图片状态 |
| | | if (fileList[i].status === 'ready' || fileList[i].status === 'uploading') { |
| | | // 终止 |
| | | return |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === fileList.length - 1) { |
| | | // 向父页面发送参数:“imageInfo”是参数名,“fileList”是参数值。 |
| | | this.$emit('imageInfo', fileList) |
| | | } |
| | | } |
| | | }, |
| | | // 失败事件 |
| | | handleError(err) { |
| | | console.log(err) |
| | | }, |
| | | // 上传图片 |
| | | submit() { |
| | | // 判断图片墙长度 |
| | | if (this.fileList.length === 0) { |
| | | // 向父页面发送参数:“imageInfo”是参数名,“this.fileList”是参数值。 |
| | | this.$emit('imageInfo', this.fileList) |
| | | // 终止 |
| | | return |
| | | } |
| | | // 循环图片墙列表 |
| | | for (let i = 0; i < this.fileList.length; i++) { |
| | | // 判断图片状态 |
| | | if (this.fileList[i].status === 'ready') { |
| | | // 将指定组件别名进行提交 |
| | | this.$refs.upload.submit() |
| | | // 终止 |
| | | return |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === this.fileList.length - 1) { |
| | | // 向父页面发送参数:“imageInfo”是参数名,“this.fileList”是参数值。 |
| | | this.$emit('imageInfo', this.fileList) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .disButtonSty .el-upload--picture-card{ |
| | | display: none; /* 上传按钮隐藏 */ |
| | | } |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div> |
| | | <!-- 金额标准输入框 --> |
| | | <el-input |
| | | ref="value" |
| | | v-model="value" |
| | | :style="{width: width + 'px'}" |
| | | :class="{'web-display-none': showDisplay, 'web-display-inline': !showDisplay}" |
| | | :disabled="disabled" |
| | | @blur="moneyBlur($event.target.value)" |
| | | /> |
| | | <!-- 金额格式输入框 --> |
| | | <el-input |
| | | v-model="valueStr" |
| | | :style="{width: width + 'px'}" |
| | | :class="{'web-display-none': !showDisplay, 'web-display-inline': showDisplay}" |
| | | :disabled="disabled" |
| | | @focus="moneyFocus($event.target.value)" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'AssemblyMoneyInput', |
| | | model: { |
| | | // 指向props的参数名 |
| | | prop: 'modelVal', |
| | | // 事件名称 |
| | | event: 'change' |
| | | }, |
| | | props: { |
| | | modelVal: { |
| | | type: Number, |
| | | default() { |
| | | return null |
| | | } |
| | | }, |
| | | width: { |
| | | type: Number, |
| | | default() { |
| | | return 200 |
| | | } |
| | | }, |
| | | disabled: { |
| | | type: Boolean, |
| | | default() { |
| | | return false |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | // 金额输入框显示状态 |
| | | showDisplay: false, |
| | | // 金额标准输入框数据 |
| | | value: null, |
| | | // 金额格式输入框数据 |
| | | valueStr: null |
| | | } |
| | | }, |
| | | watch: { |
| | | // 监听金额标准输入框数据变化:赋值给modelVal |
| | | value(val) { |
| | | this.$emit('change', Number(val)) |
| | | } |
| | | }, |
| | | mounted() { |
| | | // 金额标准输入框初始化 |
| | | this.value = this.modelVal |
| | | // 金额输入框显示初始化 |
| | | this.showDisplay = false |
| | | // 判断是否有初始金额 |
| | | if (this.value != null) { |
| | | // 金额标准输入框失去焦点触发 |
| | | this.moneyBlur(this.value) |
| | | } |
| | | }, |
| | | methods: { |
| | | // 金额标准输入框失去焦点触发 |
| | | moneyBlur(el) { |
| | | // 金额输入框显示状态切换 |
| | | this.showDisplay = true |
| | | // 金额格式化 |
| | | this.getInputValue(el) |
| | | // 函数回调 |
| | | this.$emit('onBlur') |
| | | }, |
| | | // 金额格式输入框获取焦点触发 |
| | | moneyFocus(el) { |
| | | // 金额输入框显示状态切换 |
| | | this.showDisplay = false |
| | | // 自动获取焦点 |
| | | this.$nextTick(() => { |
| | | this.$refs.value.focus() |
| | | }) |
| | | }, |
| | | // 金额格式化 |
| | | getInputValue(el) { |
| | | // 金额 |
| | | const inputVal = el.toString() || '' |
| | | // 金额添加千分位(金额去除千分位(金额)) |
| | | this.comdify(this.delcommafy(inputVal)) |
| | | }, |
| | | // 金额去除千分位 |
| | | delcommafy(num) { |
| | | if (!num) return num |
| | | num = num.toString() |
| | | num = num.replace(/,/gi, '') |
| | | return num |
| | | }, |
| | | // 金额添加千分位 |
| | | comdify(n) { |
| | | if (!n) return n |
| | | const str = n.split('.') |
| | | const re = /\d{1,3}(?=(\d{3})+$)/g |
| | | const n1 = str[0].replace(re, '$&,') |
| | | // 金额格式输入框数据 |
| | | this.valueStr = str.length > 1 && str[1].length > 2 ? `${n1}.${str[1].substring(0, 2)}` : str.length > 1 && str[1].length > 1 ? `${n1}.${str[1]}` : str.length > 1 && str[1].length ? `${n1}.${str[1]}0` : `${n1}.00` |
| | | // 金额标准输入框数据 |
| | | this.value = str.length > 1 && str[1].length > 2 ? Number(`${str[0]}.${str[1].substring(0, 2)}`) : str.length > 1 && str[1].length > 1 ? Number(`${str[0]}.${str[1]}`) : str.length > 1 && str[1].length ? Number(`${str[0]}.${str[1]}0`) : Number(`${str[0]}.00`) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .web-display-none { |
| | | display: none !important; |
| | | } |
| | | .web-display-inline { |
| | | display: inline-block !important; |
| | | } |
| | | </style> |
| | |
| | | <el-table-column prop="name" label="名称" show-overflow-tooltip /> |
| | | <el-table-column prop="dateType" label="日期类型"> |
| | | <template slot-scope="scope"> |
| | | {{ dict.label.date_type[scope.row.dateType] }} |
| | | <el-tag>{{ dict.label.date_type[scope.row.dateType] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-input |
| | | v-model="query.gearAmount" |
| | | clearable |
| | | placeholder="请输入档位金额" |
| | | style="width: 200px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <rrOperation /> |
| | | </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="档位金额" prop="gearAmount"> |
| | | <money-input :key="random" v-model="form.gearAmount" :width="370" /> |
| | | </el-form-item> |
| | | <el-form-item label="税率" prop="taxRate"> |
| | | <el-input v-model="form.taxRate" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remarks"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" maxlength="1000" 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="gearAmount" label="档位金额(元)" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.gearAmount) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="taxRate" label="税率" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taxRate + '%' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','sysConfigIndividualIncomeTax:edit','sysConfigIndividualIncomeTax: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 crudSysConfigIndividualIncomeTax from '@/api/system/configIndividualIncomeTax' |
| | | 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' |
| | | |
| | | const defaultForm = { id: null, gearAmount: null, taxRate: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'ConfigIndividualIncomeTax', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '个人所得税', url: 'api/sysConfigIndividualIncomeTax', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysConfigIndividualIncomeTax }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'sysConfigIndividualIncomeTax:add'], |
| | | edit: ['admin', 'sysConfigIndividualIncomeTax:edit'], |
| | | del: ['admin', 'sysConfigIndividualIncomeTax:del'], |
| | | download: ['admin', 'sysConfigIndividualIncomeTax:download'] |
| | | }, |
| | | rules: { |
| | | gearAmount: [ |
| | | { required: true, message: '档位金额不能为空', trigger: 'blur' } |
| | | ], |
| | | taxRate: [ |
| | | { pattern: /^[0-9]+([.]{1}[0-9]+){0,1}$/, message: '只能为小数或整数', trigger: 'blur' } |
| | | ], |
| | | remarks: [ |
| | | { min: 1, max: 1000, message: '长度不超过1000个字符', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | random: 0 } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | }, |
| | | // 钩子: 在新增前执行 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | this.random = Math.random() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |