10 files added
2 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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="sys_config_proportion") |
| | | public class SysConfigProportion extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`title`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "标题 例:公积金个人缴纳比例...") |
| | | private String title; |
| | | |
| | | @Column(name = "`proportion`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "比例") |
| | | private Double proportion; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(SysConfigProportion source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| 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.SysConfigProportion; |
| | | 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 SysConfigProportionRepository extends JpaRepository<SysConfigProportion, Long>, JpaSpecificationExecutor<SysConfigProportion> { |
| | | |
| | | @Query(value = "SELECT * from sys_config_proportion WHERE title = ?", nativeQuery = true) |
| | | SysConfigProportion findByTitle(String title); |
| | | } |
| 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.SysConfigProportion; |
| | | import me.zhengjie.modules.system.service.SysConfigProportionService; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigProportionQueryCriteria; |
| | | 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/sysConfigProportion") |
| | | public class SysConfigProportionController { |
| | | |
| | | private final SysConfigProportionService sysConfigProportionService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('sysConfigProportion:download')") |
| | | public void exportSysConfigProportion(HttpServletResponse response, SysConfigProportionQueryCriteria criteria) throws IOException { |
| | | sysConfigProportionService.download(sysConfigProportionService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询比例") |
| | | @ApiOperation("查询比例") |
| | | @PreAuthorize("@el.check('sysConfigProportion:list')") |
| | | public ResponseEntity<Object> querySysConfigProportion(SysConfigProportionQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysConfigProportionService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询比例") |
| | | @ApiOperation("查询比例") |
| | | @PreAuthorize("@el.check('sysConfigProportion:list')") |
| | | public ResponseEntity<Object> querySysConfigProportion(SysConfigProportionQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysConfigProportionService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增比例") |
| | | @ApiOperation("新增比例") |
| | | @PreAuthorize("@el.check('sysConfigProportion:add')") |
| | | public ResponseEntity<Object> createSysConfigProportion(@Validated @RequestBody SysConfigProportion resources){ |
| | | return new ResponseEntity<>(sysConfigProportionService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改比例") |
| | | @ApiOperation("修改比例") |
| | | @PreAuthorize("@el.check('sysConfigProportion:edit')") |
| | | public ResponseEntity<Object> updateSysConfigProportion(@Validated @RequestBody SysConfigProportion resources){ |
| | | sysConfigProportionService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除比例") |
| | | @ApiOperation("删除比例") |
| | | @PreAuthorize("@el.check('sysConfigProportion:del')") |
| | | public ResponseEntity<Object> deleteSysConfigProportion(@RequestBody Long[] ids) { |
| | | sysConfigProportionService.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.SysConfigProportion; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigProportionDto; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigProportionQueryCriteria; |
| | | 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 SysConfigProportionService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysConfigProportionQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SysConfigProportionDto> |
| | | */ |
| | | List<SysConfigProportionDto> queryAll(SysConfigProportionQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SysConfigProportionDto |
| | | */ |
| | | SysConfigProportionDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SysConfigProportionDto |
| | | */ |
| | | SysConfigProportionDto create(SysConfigProportion resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysConfigProportion resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysConfigProportionDto> 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.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @Data |
| | | public class SysConfigProportionDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 标题 */ |
| | | private String title; |
| | | |
| | | /** 比例 */ |
| | | private Double proportion; |
| | | |
| | | /** 备注 */ |
| | | 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.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @Data |
| | | public class SysConfigProportionQueryCriteria{ |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String title; |
| | | } |
| 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.SysConfigProportion; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.SysConfigProportionRepository; |
| | | import me.zhengjie.modules.system.service.SysConfigProportionService; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigProportionDto; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigProportionQueryCriteria; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysConfigProportionMapper; |
| | | 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 SysConfigProportionServiceImpl implements SysConfigProportionService { |
| | | |
| | | private final SysConfigProportionRepository sysConfigProportionRepository; |
| | | private final SysConfigProportionMapper sysConfigProportionMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysConfigProportionQueryCriteria criteria, Pageable pageable){ |
| | | Page<SysConfigProportion> page = sysConfigProportionRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(sysConfigProportionMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysConfigProportionDto> queryAll(SysConfigProportionQueryCriteria criteria){ |
| | | return sysConfigProportionMapper.toDto(sysConfigProportionRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public SysConfigProportionDto findById(Long id) { |
| | | SysConfigProportion sysConfigProportion = sysConfigProportionRepository.findById(id).orElseGet(SysConfigProportion::new); |
| | | ValidationUtil.isNull(sysConfigProportion.getId(),"SysConfigProportion","id",id); |
| | | return sysConfigProportionMapper.toDto(sysConfigProportion); |
| | | } |
| | | |
| | | @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)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | 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 |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | sysConfigProportionRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<SysConfigProportionDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (SysConfigProportionDto sysConfigProportion : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("标题", sysConfigProportion.getTitle()); |
| | | map.put("比例", sysConfigProportion.getProportion()); |
| | | map.put("备注", sysConfigProportion.getRemarks()); |
| | | map.put("创建者", sysConfigProportion.getCreateBy()); |
| | | map.put("创建时间", sysConfigProportion.getCreateTime()); |
| | | map.put("更新者", sysConfigProportion.getUpdateBy()); |
| | | map.put("更新时间", sysConfigProportion.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| | |
| | | for (SysRosteringDto sysRostering : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("名称", sysRostering.getName()); |
| | | map.put("工作开始时间", sysRostering.getWorkStartTime()); |
| | | map.put("工作结束时间", sysRostering.getWorkEndTime()); |
| | | map.put("午休开始时间", sysRostering.getLunchStartTime()); |
| | | map.put("午休结束时间", sysRostering.getLunchEndTime()); |
| | | map.put("工作开始时间", sysRostering.getWorkStartTime().toString()); |
| | | map.put("工作结束时间", sysRostering.getWorkEndTime().toString()); |
| | | map.put("午休开始时间", sysRostering.getLunchStartTime().toString()); |
| | | map.put("午休结束时间", sysRostering.getLunchEndTime().toString()); |
| | | map.put("备注", sysRostering.getRemarks()); |
| | | map.put("创建者", sysRostering.getCreateBy()); |
| | | map.put("创建时间", sysRostering.getCreateTime()); |
| 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.SysConfigProportion; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigProportionDto; |
| | | 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 SysConfigProportionMapper extends BaseMapper<SysConfigProportionDto, SysConfigProportion> { |
| | | |
| | | } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/sysConfigProportion/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysConfigProportion', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/sysConfigProportion/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/sysConfigProportion', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-input |
| | | v-model="query.title" |
| | | 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="title"> |
| | | <el-input v-model="form.title" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="比例" prop="proportion"> |
| | | <el-input v-model="form.proportion" 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="title" label="标题" show-overflow-tooltip /> |
| | | <el-table-column prop="proportion" label="比例" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.proportion + '%' }} |
| | | </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','sysConfigProportion:edit','sysConfigProportion: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 crudSysConfigProportion from '@/api/system/configProportion' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | |
| | | const defaultForm = { id: null, title: null, proportion: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'ConfigProportion', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '比例', url: 'api/sysConfigProportion', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysConfigProportion }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'sysConfigProportion:add'], |
| | | edit: ['admin', 'sysConfigProportion:edit'], |
| | | del: ['admin', 'sysConfigProportion:del'], |
| | | download: ['admin', 'sysConfigProportion:download'] |
| | | }, |
| | | rules: { |
| | | title: [ |
| | | { required: true, message: '标题不能为空', trigger: 'blur' }, |
| | | { min: 1, max: 100, message: '长度不超过100个字符', trigger: 'blur' } |
| | | ], |
| | | proportion: [ |
| | | { required: true, message: '比例不能为空', trigger: 'blur' }, |
| | | { pattern: /^[0-9]+([.]{1}[0-9]+){0,1}$/, message: '只能为小数或整数', trigger: 'blur' } |
| | | ], |
| | | createBy: [ |
| | | { required: true, message: '创建者不能为空', trigger: 'blur' } |
| | | ], |
| | | createTime: [ |
| | | { required: true, message: '创建时间不能为空', trigger: 'blur' } |
| | | ], |
| | | remarks: [ |
| | | { min: 1, max: 1000, message: '长度不超过1000个字符', trigger: 'blur' } |
| | | ] |
| | | }} |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | return true |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | <el-table-column prop="lunchStartTime" label="午休开始时间" show-overflow-tooltip /> |
| | | <el-table-column prop="lunchEndTime" label="午休结束时间" show-overflow-tooltip /> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','sysRostering:edit','sysRostering:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |