排班管理,前台都加show-overflow-tooltip,
10 files added
3 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; |
| | | import java.time.LocalTime; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="sys_rostering") |
| | | public class SysRostering extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`name`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "名称") |
| | | private String name; |
| | | |
| | | @Column(name = "`work_start_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工作开始时间") |
| | | private LocalTime workStartTime; |
| | | |
| | | @Column(name = "`work_end_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "工作结束时间") |
| | | private LocalTime workEndTime; |
| | | |
| | | @Column(name = "`lunch_start_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "午休开始时间") |
| | | private LocalTime lunchStartTime; |
| | | |
| | | @Column(name = "`lunch_end_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "午休结束时间") |
| | | private LocalTime lunchEndTime; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | |
| | | public void copy(SysRostering 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.SysRostering; |
| | | 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 SysRosteringRepository extends JpaRepository<SysRostering, Long>, JpaSpecificationExecutor<SysRostering> { |
| | | |
| | | @Query(value = "SELECT * FROM `sys_rostering` WHERE name = ?",nativeQuery = true) |
| | | SysRostering findByName(String name); |
| | | } |
| | |
| | | return new ResponseEntity<>(sysConfigHolidayService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询节日配置") |
| | | @ApiOperation("查询节日配置") |
| | | @PreAuthorize("@el.check('sysConfigHoliday:list')") |
| | | public ResponseEntity<Object> querySysConfigHoliday(SysConfigHolidayQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysConfigHolidayService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增节日配置") |
| | | @ApiOperation("新增节日配置") |
| 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.SysRostering; |
| | | import me.zhengjie.modules.system.service.SysRosteringService; |
| | | import me.zhengjie.modules.system.service.dto.SysRosteringQueryCriteria; |
| | | 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/sysRostering") |
| | | public class SysRosteringController { |
| | | |
| | | private final SysRosteringService sysRosteringService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('sysRostering:download')") |
| | | public void exportSysRostering(HttpServletResponse response, SysRosteringQueryCriteria criteria) throws IOException { |
| | | sysRosteringService.download(sysRosteringService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询排班") |
| | | @ApiOperation("查询排班") |
| | | @PreAuthorize("@el.check('sysRostering:list')") |
| | | public ResponseEntity<Object> querySysRostering(SysRosteringQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysRosteringService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询排班") |
| | | @ApiOperation("查询排班") |
| | | @PreAuthorize("@el.check('sysRostering:list')") |
| | | public ResponseEntity<Object> querySysRostering(SysRosteringQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysRosteringService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增排班") |
| | | @ApiOperation("新增排班") |
| | | @PreAuthorize("@el.check('sysRostering:add')") |
| | | public ResponseEntity<Object> createSysRostering(@Validated @RequestBody SysRostering resources){ |
| | | return new ResponseEntity<>(sysRosteringService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改排班") |
| | | @ApiOperation("修改排班") |
| | | @PreAuthorize("@el.check('sysRostering:edit')") |
| | | public ResponseEntity<Object> updateSysRostering(@Validated @RequestBody SysRostering resources){ |
| | | sysRosteringService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除排班") |
| | | @ApiOperation("删除排班") |
| | | @PreAuthorize("@el.check('sysRostering:del')") |
| | | public ResponseEntity<Object> deleteSysRostering(@RequestBody Long[] ids) { |
| | | sysRosteringService.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.SysRostering; |
| | | import me.zhengjie.modules.system.service.dto.SysRosteringDto; |
| | | import me.zhengjie.modules.system.service.dto.SysRosteringQueryCriteria; |
| | | 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 SysRosteringService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysRosteringQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SysRosteringDto> |
| | | */ |
| | | List<SysRosteringDto> queryAll(SysRosteringQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SysRosteringDto |
| | | */ |
| | | SysRosteringDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SysRosteringDto |
| | | */ |
| | | SysRosteringDto create(SysRostering resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysRostering resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysRosteringDto> 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; |
| | | import java.time.LocalTime; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author wcd |
| | | * @date 2022-12-13 |
| | | **/ |
| | | @Data |
| | | public class SysRosteringDto extends BaseDTO implements Serializable { |
| | | |
| | | /** ID */ |
| | | private Long id; |
| | | |
| | | /** 名称 */ |
| | | private String name; |
| | | |
| | | /** 工作开始时间 */ |
| | | private LocalTime workStartTime; |
| | | |
| | | /** 工作结束时间 */ |
| | | private LocalTime workEndTime; |
| | | |
| | | /** 午休开始时间 */ |
| | | private LocalTime lunchStartTime; |
| | | |
| | | /** 午休结束时间 */ |
| | | private LocalTime lunchEndTime; |
| | | |
| | | /** 备注 */ |
| | | 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 SysRosteringQueryCriteria{ |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private 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.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.system.domain.SysRostering; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.SysRosteringRepository; |
| | | import me.zhengjie.modules.system.service.SysRosteringService; |
| | | import me.zhengjie.modules.system.service.dto.SysRosteringDto; |
| | | import me.zhengjie.modules.system.service.dto.SysRosteringQueryCriteria; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysRosteringMapper; |
| | | 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 SysRosteringServiceImpl implements SysRosteringService { |
| | | |
| | | private final SysRosteringRepository sysRosteringRepository; |
| | | private final SysRosteringMapper sysRosteringMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysRosteringQueryCriteria criteria, Pageable pageable){ |
| | | Page<SysRostering> page = sysRosteringRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(sysRosteringMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysRosteringDto> queryAll(SysRosteringQueryCriteria criteria){ |
| | | return sysRosteringMapper.toDto(sysRosteringRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public SysRosteringDto findById(Long id) { |
| | | SysRostering sysRostering = sysRosteringRepository.findById(id).orElseGet(SysRostering::new); |
| | | ValidationUtil.isNull(sysRostering.getId(),"SysRostering","id",id); |
| | | return sysRosteringMapper.toDto(sysRostering); |
| | | } |
| | | |
| | | @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)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | 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); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | sysRosteringRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<SysRosteringDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | 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.getRemarks()); |
| | | map.put("创建者", sysRostering.getCreateBy()); |
| | | map.put("创建时间", sysRostering.getCreateTime()); |
| | | map.put("更新者", sysRostering.getUpdateBy()); |
| | | map.put("更新时间", sysRostering.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| 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.SysRostering; |
| | | import me.zhengjie.modules.system.service.dto.SysRosteringDto; |
| | | 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 SysRosteringMapper extends BaseMapper<SysRosteringDto, SysRostering> { |
| | | |
| | | } |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/sysConfigHoliday/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysConfigHoliday', |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| | | export default { getAll, add, edit, del } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/sysRostering/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysRostering', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/sysRostering/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/sysRostering', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del } |
| | |
| | | <!--表格渲染--> |
| | | <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="holidayDate" label="节日日期"> |
| | | <el-table-column prop="holidayDate" label="节日日期" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.holidayDate) }} |
| | | </template> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <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','sysConfigHoliday:edit','sysConfigHoliday:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-input |
| | | v-model="query.name" |
| | | 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="110px"> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="工作开始时间" prop="workStartTime" label-width="110px"> |
| | | <el-time-picker |
| | | v-model="form.workStartTime" |
| | | format="HH:mm:ss" |
| | | value-format="HH:mm" |
| | | :picker-options="{ |
| | | selectableRange: '00:00:00 - ' + (form.workEndTime ? form.workEndTime+':00' : '23:59:00') |
| | | }" |
| | | placeholder="选择工作开始时间" |
| | | style="width: 340px;" |
| | | @change="startChange()" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="工作结束时间" prop="workEndTime" label-width="110px"> |
| | | <el-time-picker |
| | | v-model="form.workEndTime" |
| | | format="HH:mm:ss" |
| | | value-format="HH:mm" |
| | | :picker-options="{ |
| | | selectableRange: (form.workStartTime ? form.workStartTime+':00' : '00:00:00') + ' - 23:59:00' |
| | | }" |
| | | placeholder="选择工作结束时间" |
| | | style="width: 340px;" |
| | | @change="endChange()" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="午休开始时间" prop="lunchStartTime" label-width="110px"> |
| | | <el-time-picker |
| | | v-model="form.lunchStartTime" |
| | | format="HH:mm:ss" |
| | | value-format="HH:mm" |
| | | :picker-options="{ |
| | | selectableRange: (form.workStartTime ? form.workStartTime+':00' : '00:00:00') + ' - ' + (form.lunchEndTime ? form.lunchEndTime+':00' : (form.workEndTime ? form.workEndTime+':00' : '23:59:00')) |
| | | }" |
| | | :disabled="!(form.workStartTime && form.workEndTime)" |
| | | placeholder="选择午休开始时间" |
| | | style="width: 340px;" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="午休结束时间" prop="lunchEndTime" label-width="110px"> |
| | | <el-time-picker |
| | | v-model="form.lunchEndTime" |
| | | format="HH:mm:ss" |
| | | value-format="HH:mm" |
| | | :picker-options="{ |
| | | selectableRange: (form.lunchStartTime ? form.lunchStartTime+':00' : (form.workStartTime ? form.workStartTime+':00' : '00:00:00')) + ' - ' + (form.workEndTime ? form.workEndTime+':00' : '23:59:00') |
| | | }" |
| | | :disabled="!(form.workStartTime && form.workEndTime)" |
| | | placeholder="选择休息结束时间" |
| | | style="width: 340px;" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remarks" label-width="110px"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" maxlength="1000" style="width: 340px;" /> |
| | | </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="name" label="名称" show-overflow-tooltip /> |
| | | <el-table-column prop="workStartTime" label="工作开始时间" show-overflow-tooltip /> |
| | | <el-table-column prop="workEndTime" label="工作结束时间" show-overflow-tooltip /> |
| | | <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 v-if="checkPer(['admin','sysRostering:edit','sysRostering: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 crudSysRostering from '@/api/system/rostering' |
| | | 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, name: null, workStartTime: null, workEndTime: null, lunchStartTime: null, lunchEndTime: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'Rostering', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '排班', url: 'api/sysRostering', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysRostering }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'sysRostering:add'], |
| | | edit: ['admin', 'sysRostering:edit'], |
| | | del: ['admin', 'sysRostering:del'], |
| | | download: ['admin', 'sysRostering:download'] |
| | | }, |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' }, |
| | | { min: 1, max: 100, message: '长度不超过100个字符', trigger: 'blur' } |
| | | ], |
| | | workStartTime: [ |
| | | { required: true, message: '工作开始时间不能为空', trigger: 'blur' } |
| | | ], |
| | | workEndTime: [ |
| | | { required: true, message: '工作结束时间不能为空', trigger: 'blur' } |
| | | ], |
| | | lunchStartTime: [ |
| | | { required: true, message: '午休开始时间不能为空', trigger: 'blur' } |
| | | ], |
| | | lunchEndTime: [ |
| | | { required: true, 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 |
| | | }, |
| | | startChange() { |
| | | if ( |
| | | this.form.workStartTime >= this.form.lunchStartTime && this.form.lunchStartTime !== '' |
| | | ) { |
| | | this.$message({ |
| | | type: 'error', |
| | | message: '休息时间与休息结束时间必须在工作时间内!' |
| | | }) |
| | | this.form.lunchStartTime = '' |
| | | this.form.lunchEndTime = '' |
| | | } |
| | | }, |
| | | endChange() { |
| | | if ( |
| | | this.form.workEndTime < this.form.lunchStartTime && this.form.lunchStartTime !== '' || |
| | | this.form.workEndTime < this.form.lunchEndTime && this.form.lunchEndTime !== '' |
| | | ) { |
| | | this.$message({ |
| | | type: 'error', |
| | | message: '休息时间与休息结束时间必须在工作时间内!' |
| | | }) |
| | | this.form.lunchStartTime = '' |
| | | this.form.lunchEndTime = '' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |