Merge branch 'master' of http://192.168.1.110:5678/r/pms-upgrade into weicd
改名
2 files added
14 files modified
10 files renamed
2 files deleted
| | |
| | | import me.zhengjie.modules.project.domain.ProjectCost; |
| | | import me.zhengjie.modules.project.domain.ProjectCostSummary; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | |
| | | */ |
| | | @Query(value = "SELECT COALESCE(SUM(project_cost), 0) AS totalLaborCost FROM project_cost WHERE project_id = ?1", nativeQuery = true) |
| | | ProjectCostSummary findSummaryByProjectId(Long id); |
| | | |
| | | /** |
| | | * 根据用户ID查询参与的项目ID |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT DISTINCT(project_id) FROM project_cost WHERE user_id = ?1", nativeQuery = true) |
| | | List<Long> findProjectIdByUserId(Long userId); |
| | | } |
| | |
| | | package me.zhengjie.modules.project.service.dto; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | |
| | | private Long projectId; |
| | | |
| | | /** 精确 */ |
| | | @Query(propName = "projectId", type = Query.Type.IN) |
| | | private List<Long> projectIdList; |
| | | |
| | | /** 精确 */ |
| | | @Query |
| | | private Long userId; |
| | | |
| | |
| | | @Query |
| | | private Long projectId; |
| | | |
| | | /** 精确 */ |
| | | @Query(propName = "projectId", type = Query.Type.IN) |
| | | private List<Long> projectIdList; |
| | | |
| | | /** 模糊 */ |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String name; |
| | |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | import me.zhengjie.modules.system.repository.SysUserLevelInsuranceRepository; |
| | | import me.zhengjie.modules.system.repository.SysUserLevelWageRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.modules.system.service.dto.SysRosteringDto; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.enums.DataScopeEnum; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | private final SysUserLevelInsuranceRepository sysUserLevelInsuranceRepository; |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final UserService userService; |
| | | private final RoleService roleService; |
| | | |
| | | private final SysLevelRepository sysLevelRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectCostQueryCriteria criteria, Pageable pageable){ |
| | | // 获取当前用户ID |
| | | Long userId = SecurityUtils.getCurrentUserId(); |
| | | // 查询用户角色 |
| | | List<RoleSmallDto> roleSet = roleService.findByUsersId(userId); |
| | | if (roleSet.stream().anyMatch(role -> DataScopeEnum.find(role.getDataScope()) == DataScopeEnum.THIS_LEVEL)) { |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(userId); |
| | | // 根据用户ID查询参与的项目ID |
| | | List<Long> taskUserProjectIdList = projectCostRepository.findProjectIdByUserId(userId); |
| | | // 检索条件 |
| | | List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | criteria.setProjectIdList(totalProjectIdList); |
| | | } |
| | | |
| | | Page<ProjectCost> page = projectCostRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<ProjectCost, ProjectCostDto> func = new Function<ProjectCost, ProjectCostDto>() { |
| | |
| | | // 查询用户角色 |
| | | List<RoleSmallDto> roleSet = roleService.findByUsersId(userId); |
| | | if (roleSet.stream().anyMatch(role -> DataScopeEnum.find(role.getDataScope()) == DataScopeEnum.THIS_LEVEL)) { |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(userId); |
| | | // 根据用户ID查询参与的项目ID |
| | | List<Long> taskUserProjectIdList = projectCostRepository.findProjectIdByUserId(userId); |
| | | // 检索条件 |
| | | List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | criteria.setLiableUserId(userId); |
| | | } |
| | | } |
| | |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | // 检索条件 |
| | | criteria.setIdInList(Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList())); |
| | | List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return Collections.emptyList(); |
| | | } |
| | | criteria.setIdInList(totalProjectIdList); |
| | | } |
| | | return projectMapper.toDto(projectRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectTask; |
| | | import me.zhengjie.modules.project.domain.ProjectType; |
| | | import me.zhengjie.modules.project.repository.ProjectCostRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.dto.ProjectDto; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.enums.DataScopeEnum; |
| | |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | private final ProjectTaskMapper projectTaskMapper; |
| | | private final ProjectRepository projectRepository; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final ProjectCostRepository projectCostRepository; |
| | | private final RoleService roleService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectTaskQueryCriteria criteria, Pageable pageable) { |
| | | // 获取当前用户ID |
| | | Long userId = SecurityUtils.getCurrentUserId(); |
| | | // 查询用户角色 |
| | | List<RoleSmallDto> roleSet = roleService.findByUsersId(userId); |
| | | if (roleSet.stream().anyMatch(role -> DataScopeEnum.find(role.getDataScope()) == DataScopeEnum.THIS_LEVEL)) { |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(userId); |
| | | // 根据用户ID查询参与的项目ID |
| | | List<Long> taskUserProjectIdList = projectCostRepository.findProjectIdByUserId(userId); |
| | | // 检索条件 |
| | | List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | criteria.setProjectIdList(totalProjectIdList); |
| | | } |
| | | |
| | | Page<ProjectTask> page = projectTaskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<ProjectTask, ProjectTaskDto> func = new Function<ProjectTask, ProjectTaskDto>() { |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SystemSetting.java |
| | |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="system_setting") |
| | | public class SystemSetting extends BaseEntity implements Serializable { |
| | | @Table(name="sys_user_company") |
| | | public class SysUserCompany extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | |
| | | @ApiModelProperty(value = "值") |
| | | private String value; |
| | | |
| | | public void copy(SystemSetting source){ |
| | | public void copy(SysUserCompany source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SystemSettingRepository.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SystemSetting; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.sql.Timestamp; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | **/ |
| | | public interface SystemSettingRepository extends JpaRepository<SystemSetting, Long>, JpaSpecificationExecutor<SystemSetting> { |
| | | public interface SysUserCompanyRepository extends JpaRepository<SysUserCompany, Long>, JpaSpecificationExecutor<SysUserCompany> { |
| | | |
| | | /** |
| | | * 根据value查询公司(导出用) |
| | | * @return |
| | | */ |
| | | @Query |
| | | SystemSetting findByValue(String value); |
| | | SysUserCompany findByValue(String value); |
| | | } |
| 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.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.SysUserCompanyService; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | 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-01-30 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "公司管理管理") |
| | | @RequestMapping("/api/sysUserCompany") |
| | | public class SysUserCompanyController { |
| | | |
| | | private final SysUserCompanyService sysUserCompanyService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('sysUserCompany:list')") |
| | | public void exportSystemSetting(HttpServletResponse response, SysUserCompanyQueryCriteria criteria) throws IOException { |
| | | sysUserCompanyService.download(sysUserCompanyService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询公司管理") |
| | | @ApiOperation("查询公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:list')") |
| | | public ResponseEntity<Object> querySystemSetting(SysUserCompanyQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysUserCompanyService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询公司管理") |
| | | @ApiOperation("查询公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:list')") |
| | | public ResponseEntity<Object> querySystemSetting(SysUserCompanyQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysUserCompanyService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增公司管理") |
| | | @ApiOperation("新增公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:add')") |
| | | public ResponseEntity<Object> createSystemSetting(@Validated @RequestBody SysUserCompany resources){ |
| | | return new ResponseEntity<>(sysUserCompanyService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改公司管理") |
| | | @ApiOperation("修改公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:edit')") |
| | | public ResponseEntity<Object> updateSystemSetting(@Validated @RequestBody SysUserCompany resources){ |
| | | sysUserCompanyService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除公司管理") |
| | | @ApiOperation("删除公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:del')") |
| | | public ResponseEntity<Object> deleteSystemSetting(@RequestBody Long[] ids) { |
| | | sysUserCompanyService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PostMapping(value = "/getCompName") |
| | | @Log("选择用户改变公司") |
| | | @ApiOperation("选择用户改变公司") |
| | | public ResponseEntity<Object> getCompName(@Validated @RequestBody SysUserCompanyDto resources){ |
| | | return new ResponseEntity<>(sysUserCompanyService.getCompName(resources), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同部分管理") |
| | | @RequestMapping("/api/sysContract") |
| | | @RequestMapping("/api/sysUserContract") |
| | | public class SysUserContractController { |
| | | |
| | | private final SysUserContractService sysUserContractService; |
| | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | @PreAuthorize("@el.check('sysUserContract:list')") |
| | | public void exportSysContract(HttpServletResponse response, SysUserContractQueryCriteria criteria) throws IOException { |
| | | sysUserContractService.download(sysUserContractService.queryAll(criteria), response); |
| | | } |
| | |
| | | @GetMapping |
| | | @Log("查询合同部分") |
| | | @ApiOperation("查询合同部分") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | @PreAuthorize("@el.check('sysUserContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysUserContractQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysUserContractService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同部分") |
| | | @ApiOperation("查询合同部分") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | @PreAuthorize("@el.check('sysUserContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysUserContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysUserContractService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | |
| | | @PostMapping |
| | | @Log("新增合同部分") |
| | | @ApiOperation("新增合同部分") |
| | | @PreAuthorize("@el.check('sysContract:add')") |
| | | @PreAuthorize("@el.check('sysUserContract:add')") |
| | | public ResponseEntity<Object> createSysContract(@Validated @RequestBody SysUserContract resources){ |
| | | return new ResponseEntity<>(sysUserContractService.create(resources),HttpStatus.CREATED); |
| | | } |
| | |
| | | @PutMapping |
| | | @Log("修改合同部分") |
| | | @ApiOperation("修改合同部分") |
| | | @PreAuthorize("@el.check('sysContract:edit')") |
| | | @PreAuthorize("@el.check('sysUserContract:edit')") |
| | | public ResponseEntity<Object> updateSysContract(@Validated @RequestBody SysUserContract resources){ |
| | | sysUserContractService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | |
| | | @DeleteMapping |
| | | @Log("删除合同部分") |
| | | @ApiOperation("删除合同部分") |
| | | @PreAuthorize("@el.check('sysContract:del')") |
| | | @PreAuthorize("@el.check('sysUserContract:del')") |
| | | public ResponseEntity<Object> deleteSysContract(@RequestBody Long[] ids) { |
| | | sysUserContractService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SystemSettingService.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.service; |
| | | |
| | | import me.zhengjie.modules.system.domain.SystemSetting; |
| | | import me.zhengjie.modules.system.service.dto.SystemSettingDto; |
| | | import me.zhengjie.modules.system.service.dto.SystemSettingQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | **/ |
| | | public interface SystemSettingService { |
| | | public interface SysUserCompanyService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SystemSettingQueryCriteria criteria, Pageable pageable); |
| | | Map<String,Object> queryAll(SysUserCompanyQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SystemSettingDto> |
| | | */ |
| | | List<SystemSettingDto> queryAll(SystemSettingQueryCriteria criteria); |
| | | List<SysUserCompanyDto> queryAll(SysUserCompanyQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SystemSettingDto |
| | | */ |
| | | SystemSettingDto findById(Long id); |
| | | SysUserCompanyDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SystemSettingDto |
| | | */ |
| | | SystemSettingDto create(SystemSetting resources); |
| | | SysUserCompanyDto create(SysUserCompany resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SystemSetting resources); |
| | | void update(SysUserCompany resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SystemSettingDto> all, HttpServletResponse response) throws IOException; |
| | | void download(List<SysUserCompanyDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | SystemSetting getCompName(SystemSettingDto resources); |
| | | SysUserCompany getCompName(SysUserCompanyDto resources); |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingDto.java |
| | |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Data |
| | | public class SystemSettingDto extends BaseDTO implements Serializable { |
| | | public class SysUserCompanyDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingQueryCriteria.java |
| | |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Data |
| | | public class SystemSettingQueryCriteria{ |
| | | public class SysUserCompanyQueryCriteria { |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| 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.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysUserCompanyMapper; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.SysUserCompanyRepository; |
| | | import me.zhengjie.modules.system.service.SysUserCompanyService; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | 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 2023-01-30 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SysUserCompanyServiceImpl implements SysUserCompanyService { |
| | | |
| | | private final SysUserCompanyRepository sysUserCompanyRepository; |
| | | private final SysUserCompanyMapper sysUserCompanyMapper; |
| | | private final UserRepository userRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysUserCompanyQueryCriteria criteria, Pageable pageable){ |
| | | Page<SysUserCompany> page = sysUserCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(sysUserCompanyMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysUserCompanyDto> queryAll(SysUserCompanyQueryCriteria criteria){ |
| | | return sysUserCompanyMapper.toDto(sysUserCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public SysUserCompanyDto findById(Long id) { |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findById(id).orElseGet(SysUserCompany::new); |
| | | ValidationUtil.isNull(sysUserCompany.getId(),"SystemSetting","id",id); |
| | | return sysUserCompanyMapper.toDto(sysUserCompany); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysUserCompanyDto create(SysUserCompany resources) { |
| | | return sysUserCompanyMapper.toDto(sysUserCompanyRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(SysUserCompany resources) { |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findById(resources.getId()).orElseGet(SysUserCompany::new); |
| | | ValidationUtil.isNull( sysUserCompany.getId(),"SystemSetting","id",resources.getId()); |
| | | sysUserCompany.copy(resources); |
| | | sysUserCompanyRepository.save(sysUserCompany); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | sysUserCompanyRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<SysUserCompanyDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (SysUserCompanyDto systemSetting : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("标签", systemSetting.getLabel()); |
| | | map.put("值", systemSetting.getValue()); |
| | | map.put("描述", systemSetting.getDescription()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | @Override |
| | | public SysUserCompany getCompName(SysUserCompanyDto resources) { |
| | | // 查询用户表 |
| | | User user = userRepository.findById(Long.valueOf(resources.getUserId())).orElseGet(User::new); |
| | | // 查询公司表 |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findByValue(user.getCompany()); |
| | | return sysUserCompany; |
| | | } |
| | | } |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.domain.SysUserContract; |
| | | import me.zhengjie.modules.system.domain.SystemSetting; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.SystemSettingRepository; |
| | | import me.zhengjie.modules.system.repository.SysUserCompanyRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.dto.SysUserContractDto; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysUserContractMapper; |
| | |
| | | private final SysUserContractRepository sysUserContractRepository; |
| | | private final SysUserContractMapper sysUserContractMapper; |
| | | private final UserRepository userRepository; |
| | | private final SystemSettingRepository systemSettingRepository; |
| | | private final SysUserCompanyRepository sysUserCompanyRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysUserContractQueryCriteria criteria, Pageable pageable){ |
| | |
| | | User user = userRepository.findById(sysUserContractDto.getUserId()).orElseGet(User::new); |
| | | sysUserContractDto.setUserName(user.getNickName()); |
| | | //查询公司信息 |
| | | SystemSetting systemSetting = systemSettingRepository.findById(sysUserContractDto.getCompanyId()).orElseGet(SystemSetting::new); |
| | | sysUserContractDto.setCompName(systemSetting.getLabel()); |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findById(sysUserContractDto.getCompanyId()).orElseGet(SysUserCompany::new); |
| | | sysUserContractDto.setCompName(sysUserCompany.getLabel()); |
| | | return sysUserContractDto; |
| | | } |
| | | }; |
| | |
| | | for (SysUserContractDto sysContract : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | User user = userRepository.findById(sysContract.getUserId()).orElseGet(User::new); |
| | | SystemSetting systemSetting = systemSettingRepository.findById(sysContract.getCompanyId()).orElseGet(SystemSetting::new); |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findById(sysContract.getCompanyId()).orElseGet(SysUserCompany::new); |
| | | map.put("所属员工", user.getNickName()); |
| | | map.put("合同名称", sysContract.getContractName()); |
| | | map.put("合同开始时间", sysContract.getContractStartTime()); |
| | | map.put("合同结束时间", sysContract.getContractEndTime()); |
| | | map.put("公司", systemSetting.getLabel()); |
| | | map.put("公司", sysUserCompany.getLabel()); |
| | | map.put("创建者", sysContract.getCreateBy()); |
| | | map.put("创建时间", sysContract.getCreateTime()); |
| | | map.put("更新者", sysContract.getUpdateBy()); |
| | |
| | | import me.zhengjie.modules.system.repository.*; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.*; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysUserLevelWageMapper; |
| | | import me.zhengjie.modules.system.service.mapstruct.UserLoginMapper; |
| | | import me.zhengjie.modules.system.service.mapstruct.UserMapper; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final SystemSettingRepository systemSettingRepository; |
| | | private final SysUserCompanyRepository sysUserCompanyRepository; |
| | | |
| | | @Override |
| | | public Object queryAll(UserQueryCriteria criteria, Pageable pageable) { |
| | |
| | | for (UserDto userDTO : queryAll) { |
| | | List<String> roles = userDTO.getRoles().stream().map(RoleSmallDto::getName).collect(Collectors.toList()); |
| | | String levelName = userDTO.getLevelId() != null ? sysLevelRepository.findById(userDTO.getLevelId()).orElseGet(SysLevel::new).getName() : ""; |
| | | SystemSetting systemSetting = systemSettingRepository.findByValue(userDTO.getCompany()); |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findByValue(userDTO.getCompany()); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("用户名", userDTO.getUsername()); |
| | | map.put("角色", roles); |
| | |
| | | map.put("钉钉号", userDTO.getDingding()); |
| | | map.put("排班", userDTO.getSysRostering().getName()); |
| | | map.put("级别", levelName); |
| | | map.put("所属公司", systemSetting == null ? "" : systemSetting.getLabel()); |
| | | map.put("所属公司", sysUserCompany == null ? "" : sysUserCompany.getLabel()); |
| | | map.put("状态", userDTO.getEnabled() ? "启用" : "禁用"); |
| | | map.put("手机号码", userDTO.getPhone()); |
| | | map.put("修改密码的时间", userDTO.getPwdResetTime()); |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SystemSettingMapper.java |
| | |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SystemSetting; |
| | | import me.zhengjie.modules.system.service.dto.SystemSettingDto; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SystemSettingMapper extends BaseMapper<SystemSettingDto, SystemSetting> { |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | |
| | | } |
| | |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | // 检索条件 |
| | | criteria.setProjectIdInList(Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList())); |
| | | List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | criteria.setProjectIdInList(totalProjectIdList); |
| | | } |
| | | Page<TaskDaliy> page = taskDaliyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| | |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | // 检索条件 |
| | | criteria.setProjectIdInList(Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList())); |
| | | List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | criteria.setProjectIdInList(totalProjectIdList); |
| | | } |
| | | // 判断检索条件 |
| | | if (criteria.getName() == null) { |
| | |
| | | // 根据用户ID查询负责的项目ID |
| | | List<Long> projectIdList = projectRepository.findIdByLiableUserId(SecurityUtils.getCurrentUserId()); |
| | | // 检索条件 |
| | | criteria.setProjectIdInList(Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList())); |
| | | List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList()); |
| | | if (totalProjectIdList.size() == 0) { |
| | | return PageUtil.toPage(Collections.emptyList(), 0); |
| | | } |
| | | criteria.setProjectIdInList(totalProjectIdList); |
| | | } |
| | | Page<TaskUser> page = taskUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | // 将实体类转换为DTO(重写) |
| File was renamed from eladmin-web-master/src/api/system/systemSetting.js |
| | |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/systemSetting/all', |
| | | url: 'api/sysUserCompany/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/systemSetting', |
| | | url: 'api/sysUserCompany', |
| | | method: 'post', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/systemSetting/', |
| | | url: 'api/sysUserCompany/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/systemSetting', |
| | | url: 'api/sysUserCompany', |
| | | method: 'put', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function getCompName(data) { |
| | | return request({ |
| | | url: 'api/systemSetting/getCompName', |
| | | url: 'api/sysUserCompany/getCompName', |
| | | method: 'post', |
| | | data |
| | | }) |
| File was renamed from eladmin-web-master/src/api/system/sysContract.js |
| | |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/sysContract/all', |
| | | url: 'api/sysUserContract/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysContract', |
| | | url: 'api/sysUserContract', |
| | | method: 'post', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/sysContract/', |
| | | url: 'api/sysUserContract/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/sysContract', |
| | | url: 'api/sysUserContract', |
| | | method: 'put', |
| | | data |
| | | }) |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="requirement" label="需求说明" width="140" /> |
| | | <el-table-column v-permission="permission.master" :show-overflow-tooltip="true" prop="contractPrice" label="合同总金额" width="100"> |
| | | <el-table-column v-if="checkPer([permission.master])" :show-overflow-tooltip="true" prop="contractPrice" label="合同总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.contractPrice != null && scope.row.contractPrice != '' ? crud.toMoney(scope.row.contractPrice) : '' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="totalTaskTime" label="任务总工时" width="100" /> |
| | | <el-table-column v-permission="permission.master" label="报价"> |
| | | <el-table-column v-if="checkPer([permission.master])" label="报价"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="quotationPrice" label="单金" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.quotationPrice) }} |
| | |
| | | import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' |
| | | import crudRostering from '@/api/system/rostering' |
| | | import crudLevel from '@/api/system/level' |
| | | import crudSystemSetting from '@/api/system/systemSetting' |
| | | import crudSysUserCompany from '@/api/system/sysUserCompany' |
| | | let userRoles = [] |
| | | let userJobs = [] |
| | | const defaultForm = { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, sysRostering: { id: null }, levelId: null } |
| | |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 查询配置参数 |
| | | crudSystemSetting.getAll().then(res => { |
| | | crudSysUserCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | |
| | | // 去合同部分 |
| | | toContract() { |
| | | // 跳转页面 |
| | | this.$router.push({ path: '/system/sysContract' }) |
| | | this.$router.push({ path: '/system/sysUserContract' }) |
| | | } |
| | | } |
| | | } |
| File was renamed from eladmin-web-master/src/views/system/company/index.vue |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="description" label="描述" /> |
| | | <el-table-column prop="createTime" label="创建日期" /> |
| | | <el-table-column v-if="checkPer(['admin','systemSetting:edit','systemSetting:del'])" label="操作" width="150px" align="center"> |
| | | <el-table-column v-if="checkPer(['admin','sysUserCompany:edit','sysUserCompany:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudSystemSetting from '@/api/system/systemSetting' |
| | | import crudSysUserCompany from '@/api/system/sysUserCompany' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | |
| | | |
| | | const defaultForm = { id: null, name: null, description: null, label: null, value: null, createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | export default { |
| | | name: 'SystemSetting', |
| | | name: 'SysUserCompany', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '公司管理', url: 'api/systemSetting', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSystemSetting }}) |
| | | return CRUD({ title: '公司管理', url: 'api/sysUserCompany', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysUserCompany }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'systemSetting:add'], |
| | | edit: ['admin', 'systemSetting:edit'], |
| | | del: ['admin', 'systemSetting:del'], |
| | | download: ['admin', 'systemSetting:download'] |
| | | add: ['admin', 'sysUserCompany:add'], |
| | | edit: ['admin', 'sysUserCompany:edit'], |
| | | del: ['admin', 'sysUserCompany:del'], |
| | | download: ['admin', 'sysUserCompany:download'] |
| | | }, |
| | | rules: { |
| | | label: [ |
| File was renamed from eladmin-web-master/src/views/system/contract/index.vue |
| | |
| | | </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','sysContract:edit','sysContract:del'])" label="操作" width="150px" align="center"> |
| | | <el-table-column v-if="checkPer(['admin','sysUserContract:edit','sysUserContract:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudSysContract from '@/api/system/sysContract' |
| | | import crudSysContract from '@/api/system/sysUserContract' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import crudSystemSetting from '@/api/system/systemSetting' |
| | | import crudSysUserCompany from '@/api/system/sysUserCompany' |
| | | import crudUser from '@/api/system/user' |
| | | |
| | | const defaultForm = { id: null, userId: null, contractName: null, contractStartTime: null, contractEndTime: null, companyId: null, createBy: null, createTime: null, updateBy: null, updateTime: null, remarks: null } |
| | | export default { |
| | | name: 'SysContract', |
| | | name: 'SysUserContract', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '合同部分', url: 'api/sysContract', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysContract }}) |
| | | return CRUD({ title: '合同部分', url: 'api/sysUserContract', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysContract }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'sysContract:add'], |
| | | edit: ['admin', 'sysContract:edit'], |
| | | del: ['admin', 'sysContract:del'], |
| | | download: ['admin', 'sysContract:download'] |
| | | add: ['admin', 'sysUserContract:add'], |
| | | edit: ['admin', 'sysUserContract:edit'], |
| | | del: ['admin', 'sysUserContract:del'], |
| | | download: ['admin', 'sysUserContract:download'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getUsers() |
| | | // 查询配置参数 |
| | | crudSystemSetting.getAll().then(res => { |
| | | crudSysUserCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | |
| | | var form = JSON.stringify({ |
| | | 'userId': data |
| | | }) |
| | | crudSystemSetting.getCompName(form).then(res => { |
| | | crudSysUserCompany.getCompName(form).then(res => { |
| | | this.form.companyId = res.label |
| | | }) |
| | | } else { |