Merge branch 'weicd' of http://192.168.1.110:5678/r/pms-upgrade into master
10 files added
17 files modified
| | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceBusinessTravel; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Modifying; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | |
| | | @Query |
| | | List<AssetUseManagement> findByMeetingId(Long meeting); |
| | | |
| | | // 根据资产id删除数据 |
| | | @Modifying |
| | | @Query(value = "delete from asset_use_management where asset_id = ?1",nativeQuery = true) |
| | | void deleteByAssetId(Long assetId); |
| | | } |
| | |
| | | package me.zhengjie.modules.assetManagement.service.impl; |
| | | |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.assetManagement.repository.AssetUseManagementRepository; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.SysUserCompanyRepository; |
| | |
| | | * @date 2023-02-06 |
| | | **/ |
| | | @Service |
| | | @Transactional |
| | | @RequiredArgsConstructor |
| | | public class AssetManagementServiceImpl implements AssetManagementService { |
| | | |
| | |
| | | private final AssetManagementMapper assetManagementMapper; |
| | | private final SysUserCompanyRepository sysUserCompanyRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final AssetUseManagementRepository assetUseManagementRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(AssetManagementQueryCriteria criteria, Pageable pageable){ |
| | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | // 查询资产使用记录 |
| | | List<AssetUseManagement> assetUseManagements = assetUseManagementRepository.findAllByAssId(id); |
| | | for(int i = 0; i < assetUseManagements.size(); i++){ |
| | | assetUseManagementRepository.deleteByAssetId(assetUseManagements.get(i).getAssetId()); |
| | | } |
| | | assetManagementRepository.deleteById(id); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | @Transient |
| | | @ApiModelProperty(value = "数组") |
| | | private List<Long> assList; |
| | | |
| | | public void copy(MeetingRoom 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.conferenceRoom.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 2023-02-09 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="meeting_room_reservation") |
| | | public class MeetingRoomReservation extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @Column(name = "`meeting_id`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "会议室id") |
| | | private Long meetingId; |
| | | |
| | | @Column(name = "`meeting_theme`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "会议主题") |
| | | private String meetingTheme; |
| | | |
| | | @Column(name = "`start_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "开始时间") |
| | | private Timestamp startTime; |
| | | |
| | | @Column(name = "`end_time`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "结束时间") |
| | | private Timestamp endTime; |
| | | |
| | | @Column(name = "`number_of_participants`") |
| | | @ApiModelProperty(value = "参与人数") |
| | | private Long numberOfParticipants; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(MeetingRoomReservation 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.conferenceRoom.repository; |
| | | |
| | | import me.zhengjie.modules.attendance.domain.AttendanceLeave; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoomReservation; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | public interface MeetingRoomReservationRepository extends JpaRepository<MeetingRoomReservation, Long>, JpaSpecificationExecutor<MeetingRoomReservation> { |
| | | |
| | | // 会议室预约的时候验证时间是否存在(新增) |
| | | @Query(value = "SELECT * FROM meeting_room_reservation WHERE meeting_id = ?3 AND ((start_time >= ?1 and start_time <= ?2) OR \n" + |
| | | "(start_time <= ?1 and end_time >= ?2) OR (end_time >= ?1 and end_time <= ?2) OR (start_time >= ?1 and end_time <= ?2))", nativeQuery = true) |
| | | List<MeetingRoomReservation> checkReservationTime(String startTime, String endTime, Long userId); |
| | | |
| | | // 会议室修改预约的时候验证时间是否存在(编辑) |
| | | @Query(value = "SELECT * FROM meeting_room_reservation WHERE meeting_id = ?3 AND id NOT IN ?4 AND ((start_time >= ?1 and start_time <= ?2) OR \n" + |
| | | "(start_time <= ?1 and end_time >= ?2) OR (end_time >= ?1 and end_time <= ?2) OR (start_time >= ?1 and end_time <= ?2))", nativeQuery = true) |
| | | List<MeetingRoomReservation> checkReservationTimeEdit(String startTime, String endTime, Long userId, Set<Long> 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.conferenceRoom.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoomReservation; |
| | | import me.zhengjie.modules.conferenceRoom.service.MeetingRoomReservationService; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationQueryCriteria; |
| | | 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 2023-02-09 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "会议室预约管理") |
| | | @RequestMapping("/api/meetingRoomReservation") |
| | | public class MeetingRoomReservationController { |
| | | |
| | | private final MeetingRoomReservationService meetingRoomReservationService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:download')") |
| | | public void exportMeetingRoomReservation(HttpServletResponse response, MeetingRoomReservationQueryCriteria criteria) throws IOException { |
| | | meetingRoomReservationService.download(meetingRoomReservationService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询会议室预约") |
| | | @ApiOperation("查询会议室预约") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:list')") |
| | | public ResponseEntity<Object> queryMeetingRoomReservation(MeetingRoomReservationQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(meetingRoomReservationService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询会议室预约") |
| | | @ApiOperation("查询会议室预约") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:list')") |
| | | public ResponseEntity<Object> queryMeetingRoomReservation(MeetingRoomReservationQueryCriteria criteria){ |
| | | return new ResponseEntity<>(meetingRoomReservationService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增会议室预约") |
| | | @ApiOperation("新增会议室预约") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:add')") |
| | | public ResponseEntity<Object> createMeetingRoomReservation(@Validated @RequestBody MeetingRoomReservation resources) throws Exception { |
| | | return new ResponseEntity<>(meetingRoomReservationService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改会议室预约") |
| | | @ApiOperation("修改会议室预约") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:edit')") |
| | | public ResponseEntity<Object> updateMeetingRoomReservation(@Validated @RequestBody MeetingRoomReservation resources) throws Exception { |
| | | meetingRoomReservationService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除会议室预约") |
| | | @ApiOperation("删除会议室预约") |
| | | @PreAuthorize("@el.check('meetingRoomReservation:del')") |
| | | public ResponseEntity<Object> deleteMeetingRoomReservation(@RequestBody Long[] ids) { |
| | | meetingRoomReservationService.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.conferenceRoom.service; |
| | | |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoomReservation; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationDto; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationQueryCriteria; |
| | | 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 2023-02-09 |
| | | **/ |
| | | public interface MeetingRoomReservationService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(MeetingRoomReservationQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<MeetingRoomReservationDto> |
| | | */ |
| | | List<MeetingRoomReservationDto> queryAll(MeetingRoomReservationQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return MeetingRoomReservationDto |
| | | */ |
| | | MeetingRoomReservationDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return MeetingRoomReservationDto |
| | | */ |
| | | MeetingRoomReservationDto create(MeetingRoomReservation resources) throws Exception; |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(MeetingRoomReservation resources) throws Exception; |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<MeetingRoomReservationDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | private List<Long> num; |
| | | |
| | | /** 资产名称数组 */ |
| | | private List<String> snum; |
| | | } |
| 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.conferenceRoom.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 2023-02-09 |
| | | **/ |
| | | @Data |
| | | public class MeetingRoomReservationDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** 会议室id */ |
| | | private Long meetingId; |
| | | |
| | | /** 会议主题 */ |
| | | private String meetingTheme; |
| | | |
| | | /** 开始时间 */ |
| | | private Timestamp startTime; |
| | | |
| | | /** 结束时间 */ |
| | | private Timestamp endTime; |
| | | |
| | | /** 参与人数 */ |
| | | private Long numberOfParticipants; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 会议室名称 */ |
| | | private String meetingName; |
| | | } |
| 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.conferenceRoom.service.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | @Data |
| | | public class MeetingRoomReservationQueryCriteria{ |
| | | |
| | | @Query |
| | | private Long meetingId; |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE, propName = "meetingTheme") |
| | | private String meetingTheme; |
| | | |
| | | @Query(type = Query.Type.BETWEEN, propName = "startTime") |
| | | private List<Timestamp> startTime; |
| | | |
| | | @Query(type = Query.Type.BETWEEN, propName = "endTime") |
| | | private List<Timestamp> endTime; |
| | | } |
| 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.conferenceRoom.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetManagement; |
| | | import me.zhengjie.modules.assetManagement.domain.AssetUseManagement; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceGoOut; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoom; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoomReservation; |
| | | import me.zhengjie.modules.conferenceRoom.repository.MeetingRoomRepository; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomDto; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.CustomerResources; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.conferenceRoom.repository.MeetingRoomReservationRepository; |
| | | import me.zhengjie.modules.conferenceRoom.service.MeetingRoomReservationService; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationDto; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationQueryCriteria; |
| | | import me.zhengjie.modules.conferenceRoom.service.mapstruct.MeetingRoomReservationMapper; |
| | | 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.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class MeetingRoomReservationServiceImpl implements MeetingRoomReservationService { |
| | | |
| | | private final MeetingRoomReservationRepository meetingRoomReservationRepository; |
| | | private final MeetingRoomReservationMapper meetingRoomReservationMapper; |
| | | private final MeetingRoomRepository meetingRoomRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final UserRepository userRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(MeetingRoomReservationQueryCriteria criteria, Pageable pageable){ |
| | | Page<MeetingRoomReservation> page = meetingRoomReservationRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | //将实体转换为Dto(重写) |
| | | Function<MeetingRoomReservation, MeetingRoomReservationDto> func = new Function<MeetingRoomReservation, MeetingRoomReservationDto>(){ |
| | | @Override |
| | | public MeetingRoomReservationDto apply(MeetingRoomReservation meetingRoomReservation) { |
| | | // 将实体类转换成DTO |
| | | MeetingRoomReservationDto meetingRoomReservationDto = meetingRoomReservationMapper.toDto(meetingRoomReservation); |
| | | // 查询会议室 |
| | | MeetingRoom meetingRoom = meetingRoomRepository.findById(meetingRoomReservationDto.getMeetingId()).orElseGet(MeetingRoom::new); |
| | | meetingRoomReservationDto.setMeetingName(meetingRoom.getConferenceRoomName()); |
| | | return meetingRoomReservationDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<MeetingRoomReservationDto> queryAll(MeetingRoomReservationQueryCriteria criteria){ |
| | | return meetingRoomReservationMapper.toDto(meetingRoomReservationRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public MeetingRoomReservationDto findById(Long id) { |
| | | MeetingRoomReservation meetingRoomReservation = meetingRoomReservationRepository.findById(id).orElseGet(MeetingRoomReservation::new); |
| | | ValidationUtil.isNull(meetingRoomReservation.getId(),"MeetingRoomReservation","id",id); |
| | | return meetingRoomReservationMapper.toDto(meetingRoomReservation); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public MeetingRoomReservationDto create(MeetingRoomReservation resources) throws Exception { |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String startTime = df.format(resources.getStartTime()); |
| | | String endTime = df.format(resources.getEndTime()); |
| | | //验证约时间是否冲突 |
| | | List<MeetingRoomReservation> meetingRoomReservations = meetingRoomReservationRepository.checkReservationTime(startTime,endTime,resources.getMeetingId()); |
| | | if(meetingRoomReservations.size() > 0){ |
| | | MeetingRoomReservation errorMeetingRoomReservation = meetingRoomReservations.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | throw new BadRequestException("预约时间冲突," + errorFormat.format(errorMeetingRoomReservation.getStartTime()) + "至" + errorFormat.format(errorMeetingRoomReservation.getEndTime()) |
| | | + "已经存在会议室预约,请调整时间"); |
| | | }else{ |
| | | //调用钉钉公共方法 |
| | | setDingding(resources); |
| | | } |
| | | return meetingRoomReservationMapper.toDto(meetingRoomReservationRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(MeetingRoomReservation resources) throws Exception { |
| | | MeetingRoomReservation meetingRoomReservation = meetingRoomReservationRepository.findById(resources.getId()).orElseGet(MeetingRoomReservation::new); |
| | | ValidationUtil.isNull( meetingRoomReservation.getId(),"MeetingRoomReservation","id",resources.getId()); |
| | | meetingRoomReservation.copy(resources); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String startTime = df.format(resources.getStartTime()); |
| | | String endTime = df.format(resources.getEndTime()); |
| | | // 会议室预约id |
| | | Set<Long> ids = new HashSet<>(); |
| | | ids.add(meetingRoomReservation.getId()); |
| | | //验证时间是否冲突 |
| | | List<MeetingRoomReservation> meetingRoomReservations = meetingRoomReservationRepository.checkReservationTimeEdit(startTime,endTime, resources.getMeetingId(), ids); |
| | | if(meetingRoomReservations.size() > 0){ |
| | | MeetingRoomReservation errorMeetingRoomReservation = meetingRoomReservations.get(0); |
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | throw new BadRequestException("预约时间冲突," + errorFormat.format(errorMeetingRoomReservation.getStartTime()) + "至" + errorFormat.format(errorMeetingRoomReservation.getEndTime()) |
| | | + "已经存在会议室预约,请调整时间"); |
| | | }else{ |
| | | setDingding(resources); |
| | | } |
| | | meetingRoomReservationRepository.save(meetingRoomReservation); |
| | | } |
| | | |
| | | /** |
| | | * 发送钉钉公共方法 |
| | | * @param resources |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public void setDingding(MeetingRoomReservation resources) throws Exception { |
| | | // 获取存储用户钉钉号 |
| | | List<String> dingDingList = new ArrayList<>(); |
| | | // 查询用户 |
| | | List<User> userList = userRepository.findAll(); |
| | | for(User user : userList){ |
| | | Role role = user.getRoles().iterator().next(); |
| | | // 获取项目组长级以上的用户的钉钉id |
| | | if(Long.valueOf(role.getLevel()) <= Constant.ROLE_LEVEL_LEADER){ |
| | | if(ObjectUtils.isNotEmpty(user.getDingding())){ |
| | | dingDingList.add(user.getDingding()); |
| | | } |
| | | } |
| | | } |
| | | // 查询会议室 |
| | | MeetingRoom meetingRoom = meetingRoomRepository.findById(resources.getMeetingId()).orElseGet(MeetingRoom::new); |
| | | // 发送内容至钉钉 |
| | | opaiDingTalkService.sendNotice(dingDingList, "会议室预约提示", "### 会议室预约提示 \n >" + |
| | | " \n 会议室:" + meetingRoom.getConferenceRoomName() + |
| | | " \n 开始时间: " + resources.getStartTime().toString().substring(0,19) + |
| | | " \n 结束时间: " + resources.getEndTime().toString().substring(0,19) + |
| | | " \n 会议室预约有变更,请登录PMS系统查看。", "card"); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | meetingRoomReservationRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<MeetingRoomReservationDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (MeetingRoomReservationDto meetingRoomReservation : all) { |
| | | // 查询会议室 |
| | | MeetingRoom meetingRoom = meetingRoomRepository.findById(meetingRoomReservation.getMeetingId()).orElseGet(MeetingRoom::new); |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("会议室", meetingRoom.getConferenceRoomName()); |
| | | map.put("会议主题", meetingRoomReservation.getMeetingTheme()); |
| | | map.put("开始时间", meetingRoomReservation.getStartTime()); |
| | | map.put("结束时间", meetingRoomReservation.getEndTime()); |
| | | map.put("参与人数", meetingRoomReservation.getNumberOfParticipants()); |
| | | map.put("备注", meetingRoomReservation.getRemarks()); |
| | | map.put("创建者", meetingRoomReservation.getCreateBy()); |
| | | map.put("创建时间", meetingRoomReservation.getCreateTime()); |
| | | map.put("更新者", meetingRoomReservation.getUpdateBy()); |
| | | map.put("更新时间", meetingRoomReservation.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.conferenceRoom.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.conferenceRoom.domain.MeetingRoomReservation; |
| | | import me.zhengjie.modules.conferenceRoom.service.dto.MeetingRoomReservationDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-02-09 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface MeetingRoomReservationMapper extends BaseMapper<MeetingRoomReservationDto, MeetingRoomReservation> { |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "公司id") |
| | | private Long companyId; |
| | | |
| | | @Column(name = "`related_documents`") |
| | | @ApiModelProperty(value = "相关文件") |
| | | private String relatedDocuments; |
| | | |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | |
| | | /** 相关文件 */ |
| | | private String relatedDocuments; |
| | | } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/meetingRoomReservation/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/meetingRoomReservation', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/meetingRoomReservation/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/meetingRoomReservation', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll } |
| | |
| | | }, |
| | | rules: { |
| | | assetId: [ |
| | | { required: true, message: '资产不能为空', trigger: 'blur' } |
| | | { required: true, message: '资产不能为空', trigger: 'change' } |
| | | ], |
| | | useStartTime: [ |
| | | { required: true, message: '使用开始时间不能为空', trigger: 'blur' } |
| | |
| | | <!-- 资产使用 --> |
| | | <el-dialog :close-on-click-modal="false" :before-close="divideClose" :visible.sync="divideStatus" :title="crudStatusTitle" width="500px"> |
| | | <el-form ref="assUserManagementForm" :model="assUserManagementForm" :rules="rules" size="small" label-width="110px"> |
| | | <el-form-item label="所属编号"> |
| | | <el-form-item label="编号"> |
| | | {{ assUserManagementForm.number }} |
| | | </el-form-item> |
| | | <el-form-item label="所属名称"> |
| | | <el-form-item label="名称"> |
| | | {{ assUserManagementForm.name }} |
| | | </el-form-item> |
| | | <el-form-item label="所属员工"> |
| | | <el-form-item label="员工"> |
| | | <el-select v-model="assUserManagementForm.userId" filterable clearable placeholder="请选择" style="width: 330px;"> |
| | | <el-option |
| | | v-for="item in users" |
| | |
| | | v-model="query.outStartTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="外出开始时间" |
| | | end-placeholder="外出开始时间" |
| | | range-separator=" : " |
| | | start-placeholder="开始时间" |
| | | end-placeholder="开始时间" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.outEndTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="外出结束时间" |
| | | end-placeholder="外出结束时间" |
| | | range-separator=" : " |
| | | start-placeholder="结束时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | <rrOperation /> |
| | | </div> |
| | |
| | | v-model="query.leaveStartTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="请假开始日期" |
| | | end-placeholder="请假开始日期" |
| | | range-separator=" : " |
| | | start-placeholder="开始日期" |
| | | end-placeholder="开始日期" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.leaveEndTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="请假结束日期" |
| | | end-placeholder="请假结束日期" |
| | | range-separator=" : " |
| | | start-placeholder="结束日期" |
| | | end-placeholder="结束日期" |
| | | /> |
| | | <rrOperation /> |
| | | </div> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-select v-model="query.meetingId" filterable clearable placeholder="所属会议室" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in meetings" |
| | | :key="item.id" |
| | | :label="item.conferenceRoomName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input |
| | | v-model="query.meetingTheme" |
| | | clearable |
| | | size="small" |
| | | placeholder="会议主题" |
| | | style="width: 185px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.startTime" |
| | | type="daterange" |
| | | clearable |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator=" : " |
| | | start-placeholder="开始时间" |
| | | end-placeholder="开始时间" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.endTime" |
| | | type="daterange" |
| | | clearable |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator=" : " |
| | | start-placeholder="结束时间" |
| | | end-placeholder="结束时间" |
| | | /> |
| | | <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="100px"> |
| | | <el-form-item label="所属会议室" prop="meetingId"> |
| | | <el-select v-model="form.meetingId" filterable clearable placeholder="请选择" style="width: 350px;"> |
| | | <el-option |
| | | v-for="item in meetings" |
| | | :key="item.id" |
| | | :label="item.conferenceRoomName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="会议主题" prop="meetingTheme"> |
| | | <el-input v-model="form.meetingTheme" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="开始时间" prop="startTime"> |
| | | <el-date-picker |
| | | v-model="form.startTime" |
| | | :type="'datetime'" |
| | | placeholder="选择日期时间" |
| | | style="width: 350px;" |
| | | value-format="yyyy-MM-dd HH:mm:00" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.endTime ? time.getTime() > new Date(form.endTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="结束时间" prop="endTime"> |
| | | <el-date-picker |
| | | v-model="form.endTime" |
| | | :type="'datetime'" |
| | | placeholder="选择日期时间" |
| | | style="width: 350px;" |
| | | value-format="yyyy-MM-dd HH:mm:00" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | | return form.startTime ? time.getTime() < new Date(form.startTime).getTime() - 8.64e7 : false; |
| | | } |
| | | }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="参与人数" prop="numberOfParticipants"> |
| | | <el-input v-model="form.numberOfParticipants" style="width: 350px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 350px;" /> |
| | | </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="meetingId" label="所属会议室" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.meetingName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="meetingTheme" label="会议主题" show-overflow-tooltip /> |
| | | <el-table-column prop="startTime" label="开始时间" show-overflow-tooltip /> |
| | | <el-table-column prop="endTime" label="结束时间" show-overflow-tooltip /> |
| | | <el-table-column prop="numberOfParticipants" label="参与人数" show-overflow-tooltip /> |
| | | <el-table-column prop="remarks" label="备注" /> |
| | | <el-table-column prop="createTime" label="创建时间" /> |
| | | <el-table-column v-if="checkPer(['admin','meetingRoomReservation:edit','meetingRoomReservation: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 crudMeetingRoomReservation from '@/api/conferenceRoom/meetingRoomReservation' |
| | | import crudMeetingRoom from '@/api/conferenceRoom/meetingRoom' |
| | | 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, meetingId: null, meetingTheme: null, startTime: null, endTime: null, numberOfParticipants: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'MeetingRoomReservation', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '会议室预约', url: 'api/meetingRoomReservation', idField: 'id', sort: 'id,desc', crudMethod: { ...crudMeetingRoomReservation }}) |
| | | }, |
| | | data() { |
| | | // 工资(千万内)验证 |
| | | var wageValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 10000000)) { |
| | | callback(new Error('请输入 一千万 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'meetingRoomReservation:add'], |
| | | edit: ['admin', 'meetingRoomReservation:edit'], |
| | | del: ['admin', 'meetingRoomReservation:del'], |
| | | download: ['admin', 'meetingRoomReservation:download'] |
| | | }, |
| | | rules: { |
| | | meetingId: [ |
| | | { required: true, message: '会议室id不能为空', trigger: 'blur' } |
| | | ], |
| | | meetingTheme: [ |
| | | { required: true, message: '会议主题不能为空', trigger: 'blur' } |
| | | ], |
| | | startTime: [ |
| | | { required: true, message: '开始时间不能为空', trigger: 'blur' } |
| | | ], |
| | | endTime: [ |
| | | { required: true, message: '结束时间不能为空', trigger: 'blur' } |
| | | ], |
| | | numberOfParticipants: [ |
| | | { validator: wageValidate, trigger: 'blur' } |
| | | ] |
| | | }, |
| | | meetings: [] } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 所属会议室 |
| | | crudMeetingRoom.getAll().then(res => { |
| | | this.meetings = res |
| | | }) |
| | | return true |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | <el-date-picker |
| | | v-model="query.holidayDate" |
| | | clearable |
| | | placeholder="请选择日期" |
| | | placeholder="日期" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd" |
| | |
| | | <el-input |
| | | v-model="query.name" |
| | | clearable |
| | | placeholder="请输入名称" |
| | | placeholder="名称" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-select v-model="query.dateType" filterable clearable placeholder="请选择日期类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.dateType" filterable clearable placeholder="日期类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[dickDateType]" |
| | | :key="item.value" |
| | |
| | | <el-input |
| | | v-model="query.gearAmountStart" |
| | | clearable |
| | | placeholder="请输入档位起始金额" |
| | | placeholder="档位起始金额" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | |
| | | <el-input |
| | | v-model="query.gearAmountEnd" |
| | | clearable |
| | | placeholder="请输入截止金额" |
| | | placeholder="截止金额" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | |
| | | <el-input |
| | | v-model="query.title" |
| | | clearable |
| | | placeholder="请输入标题" |
| | | placeholder="标题" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | |
| | | v-model="query.title" |
| | | clearable |
| | | size="small" |
| | | placeholder="请输入标题" |
| | | placeholder="标题" |
| | | style="width: 200px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <el-select v-model="query.classification" filterable clearable placeholder="请输入分类" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.classification" filterable clearable placeholder="分类" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in classifications" |
| | | :key="item.id" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.remind === dictResourcesTypeRemind" label="请选择" prop="resource"> |
| | | <el-form-item v-if="form.remind === dictResourcesTypeRemind" label="选择类型" prop="resource"> |
| | | <el-radio-group v-model="form.resource" @change="remindChange()"> |
| | | <el-radio label="立即提醒" /> |
| | | <el-radio label="稍后提醒" /> |
| | |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="title" label="标题" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.title }}</el-tag> |
| | | {{ scope.row.title }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="classification" label="分类" show-overflow-tooltip /> |
| | |
| | | <el-table-column prop="recordContent" label="记录内容" show-overflow-tooltip /> |
| | | <el-table-column prop="openingTime" label="提醒时间" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.openingTime == null" type="warning">{{ '不提醒' }}</el-tag> |
| | | <el-tag v-if="scope.row.openingTime == null" type="info">{{ '不提醒' }}</el-tag> |
| | | <el-tag v-if="scope.row.openingTime != null">{{ scope.row.openingTime }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | return CRUD({ title: '客户资源管理', url: 'api/customerResources', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCustomerResources }}) |
| | | }, |
| | | data() { |
| | | var checkv = (rule, value, callback) => { |
| | | if (value == null || value === '') { |
| | | callback(new Error('不能为空')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | var checkRemindPeople = (rule, value, callback) => { |
| | | if (value === 0) { |
| | | callback(new Error('被提醒人不能为空')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'customerResources:add'], |
| | |
| | | { required: true, message: '记录时间不能为空', trigger: 'blur' } |
| | | ], |
| | | remind: [ |
| | | { required: true, message: '不能为空', trigger: 'change' } |
| | | ], |
| | | openingTime: [ |
| | | { required: true, message: '请选择提醒时间', trigger: 'blur' } |
| | | { required: true, message: '提醒不能为空', trigger: 'change' } |
| | | ], |
| | | resource: [ |
| | | { required: true, validator: checkv, trigger: 'change' } |
| | | { required: true, message: '类型不能为空', trigger: 'change' } |
| | | ], |
| | | openingTime: [ |
| | | { required: true, message: '提醒时间不能为空', trigger: 'blur' } |
| | | ], |
| | | remindPeople: [ |
| | | { required: true, validator: checkRemindPeople, trigger: 'change' } |
| | | { required: true, message: '提醒人不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | dictResourceType: constant.RESOURCES_TYPE, |
| | |
| | | }, |
| | | // 输入框获取焦点时调用的方法 |
| | | querySearch(queryString, cb) { |
| | | let results = this.classifications |
| | | let results = [] |
| | | if (queryString === null || queryString === '') { |
| | | cb(results) |
| | | } else { |
| | | results = this.classifications |
| | | results = queryString ? results.filter(this.createFilter(queryString)) : results |
| | | cb(results) |
| | | } |
| | | }, |
| | | createFilter(queryString) { |
| | | return (item) => { |
| | |
| | | <el-input |
| | | v-model="query.name" |
| | | clearable |
| | | placeholder="请输入排班名称" |
| | | placeholder="排班名称" |
| | | style="width: 185px" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.label" clearable size="small" placeholder="输入标题搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-input v-model="query.label" clearable size="small" placeholder="标题搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <rrOperation /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | |
| | | v-model="query.contractName" |
| | | clearable |
| | | size="small" |
| | | placeholder="输入合同名称" |
| | | placeholder="合同名称" |
| | | style="width: 200px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | |
| | | v-model="query.contractStartTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="合同开始日期" |
| | | end-placeholder="合同开始日期" |
| | | range-separator=" : " |
| | | start-placeholder="开始日期" |
| | | end-placeholder="开始日期" |
| | | /> |
| | | <el-date-picker |
| | | v-model="query.contractEndTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | class="date-item" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="请选择日期时间" |
| | | range-separator="至" |
| | | start-placeholder="合同结束日期" |
| | | end-placeholder="合同结束日期" |
| | | range-separator=" : " |
| | | start-placeholder="结束日期" |
| | | end-placeholder="结束日期" |
| | | /> |
| | | <el-select v-model="query.companyId" filterable clearable placeholder="所属公司" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | |
| | | <el-form-item label="备注" prop="remarks"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="相关文件" prop="relatedDocuments"> |
| | | <file-upload :key="random" ref="fileUpload" :file-url="form.relatedDocuments == null || form.relatedDocuments === '' ? null : form.relatedDocuments" :limit="5" @fileInfo="getFileInfo" /> |
| | | </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> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="submitCU">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | |
| | | import pagination from '@crud/Pagination' |
| | | import crudSysUserCompany from '@/api/system/sysUserCompany' |
| | | import crudUser from '@/api/system/user' |
| | | import fileUpload from '../../assembly/fileUpload/index.vue' |
| | | |
| | | const defaultForm = { id: null, userId: null, contractName: null, contractStartTime: null, contractEndTime: null, companyId: null, createBy: null, createTime: null, updateBy: null, updateTime: null, remarks: null } |
| | | const defaultForm = { id: null, userId: null, contractName: null, contractStartTime: null, contractEndTime: null, companyId: null, createBy: null, createTime: null, updateBy: null, updateTime: null, relatedDocuments: null, remarks: null } |
| | | export default { |
| | | name: 'SysUserContract', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | components: { pagination, crudOperation, rrOperation, udOperation, fileUpload }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '合同部分', url: 'api/sysUserContract', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysContract }}) |
| | |
| | | ] |
| | | }, |
| | | companyList: [], |
| | | users: [] } |
| | | users: [], |
| | | // 随机数 |
| | | random: 0 } |
| | | }, |
| | | methods: { |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | |
| | | this.companyList = res |
| | | }) |
| | | return true |
| | | }, |
| | | // 钩子:开始 "新建/编辑" - 之前 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | const that = this |
| | | // 随机数 |
| | | that.random = Math.random() |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | |
| | | } else { |
| | | this.form.companyId = null |
| | | } |
| | | }, |
| | | // 表单提交 |
| | | submitCU() { |
| | | const that = this |
| | | // 通过“that.$refs.fileUpload”找到子页面,“submit”是子页面的方法。 |
| | | that.$refs.fileUpload.submit() |
| | | }, |
| | | // 获取文件信息 |
| | | getFileInfo(info) { |
| | | const that = this |
| | | // 判断返回数据 |
| | | if (info.length === 0) { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocuments = null |
| | | // 表单提交 |
| | | that.crud.submitCU() |
| | | // 终止 |
| | | return |
| | | } |
| | | // 循环返回数据 |
| | | for (let i = 0; i < info.length; i++) { |
| | | // 判断循环下标 |
| | | if (i === 0) { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocuments = info[i].response == null || info[i].response === '' ? info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : '/file/' + info[i].response.type + '/' + info[i].response.realName |
| | | } else { |
| | | // 表单文件路径赋值 |
| | | that.crud.form.relatedDocuments += info[i].response == null || info[i].response === '' ? ',' + info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : ',/file/' + info[i].response.type + '/' + info[i].response.realName |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === info.length - 1) { |
| | | // 表单提交 |
| | | that.crud.submitCU() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |