施工人员黑名单后端逻辑优化,增加前端页面
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package org.dromara.project.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
@ -61,7 +63,7 @@ public class BusConstructionUser extends BaseEntity {
|
||||
/**
|
||||
* 是否代打
|
||||
*/
|
||||
private Long isPinch;
|
||||
private String isPinch;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
@ -71,7 +73,7 @@ public class BusConstructionUser extends BaseEntity {
|
||||
/**
|
||||
* 0:保密 1:男 2女
|
||||
*/
|
||||
private Long sex;
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 民族
|
||||
@ -156,12 +158,12 @@ public class BusConstructionUser extends BaseEntity {
|
||||
/**
|
||||
* 入场时间
|
||||
*/
|
||||
private String entryDate;
|
||||
private Date entryDate;
|
||||
|
||||
/**
|
||||
* 离场时间
|
||||
*/
|
||||
private String leaveDate;
|
||||
private Date leaveDate;
|
||||
|
||||
/**
|
||||
* 薪水
|
||||
|
@ -1,45 +0,0 @@
|
||||
package org.dromara.project.domain.bo;
|
||||
|
||||
import org.dromara.project.domain.BusConstructionBlacklist;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 黑名单业务对象 bus_construction_blacklist
|
||||
*
|
||||
* @author lcj
|
||||
* @date 2025-03-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = BusConstructionBlacklist.class, reverseConvertGenerate = false)
|
||||
public class BusConstructionBlacklistBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@NotNull(message = "用户id不能为空", groups = { AddGroup.class })
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
private String sfzNumber;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -35,11 +35,6 @@ public class ConstructionUserCreateReq implements Serializable {
|
||||
*/
|
||||
private Long contractorId;
|
||||
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 状态(0在职 1离职)
|
||||
*/
|
||||
@ -48,7 +43,7 @@ public class ConstructionUserCreateReq implements Serializable {
|
||||
/**
|
||||
* 是否代打
|
||||
*/
|
||||
private Long isPinch;
|
||||
private String isPinch;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
@ -58,7 +53,7 @@ public class ConstructionUserCreateReq implements Serializable {
|
||||
/**
|
||||
* 0:保密 1:男 2女
|
||||
*/
|
||||
private Long sex;
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 民族
|
||||
@ -140,16 +135,6 @@ public class ConstructionUserCreateReq implements Serializable {
|
||||
*/
|
||||
private String clock;
|
||||
|
||||
/**
|
||||
* 入场时间
|
||||
*/
|
||||
private String entryDate;
|
||||
|
||||
/**
|
||||
* 离场时间
|
||||
*/
|
||||
private String leaveDate;
|
||||
|
||||
/**
|
||||
* 薪水
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@ public class ConstructionUserQueryReq implements Serializable {
|
||||
/**
|
||||
* 是否代打
|
||||
*/
|
||||
private Long isPinch;
|
||||
private String isPinch;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
@ -63,7 +63,7 @@ public class ConstructionUserQueryReq implements Serializable {
|
||||
/**
|
||||
* 0:保密 1:男 2女
|
||||
*/
|
||||
private Long sex;
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 民族
|
||||
@ -75,26 +75,6 @@ public class ConstructionUserQueryReq implements Serializable {
|
||||
*/
|
||||
private String sfzNumber;
|
||||
|
||||
/**
|
||||
* 身份证有效开始期
|
||||
*/
|
||||
private String sfzStart;
|
||||
|
||||
/**
|
||||
* 身份证有效结束期
|
||||
*/
|
||||
private String sfzEnd;
|
||||
|
||||
/**
|
||||
* 身份证地址
|
||||
*/
|
||||
private String sfzSite;
|
||||
|
||||
/**
|
||||
* 身份证出生日期
|
||||
*/
|
||||
private String sfzBirth;
|
||||
|
||||
/**
|
||||
* 籍贯
|
||||
*/
|
||||
|
@ -40,11 +40,6 @@ public class ConstructionUserUpdateReq implements Serializable {
|
||||
*/
|
||||
private Long contractorId;
|
||||
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 状态(0在职 1离职)
|
||||
*/
|
||||
@ -53,7 +48,7 @@ public class ConstructionUserUpdateReq implements Serializable {
|
||||
/**
|
||||
* 是否代打
|
||||
*/
|
||||
private Long isPinch;
|
||||
private String isPinch;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
@ -63,7 +58,7 @@ public class ConstructionUserUpdateReq implements Serializable {
|
||||
/**
|
||||
* 0:保密 1:男 2女
|
||||
*/
|
||||
private Long sex;
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 民族
|
||||
@ -145,16 +140,6 @@ public class ConstructionUserUpdateReq implements Serializable {
|
||||
*/
|
||||
private String clock;
|
||||
|
||||
/**
|
||||
* 入场时间
|
||||
*/
|
||||
private String entryDate;
|
||||
|
||||
/**
|
||||
* 离场时间
|
||||
*/
|
||||
private String leaveDate;
|
||||
|
||||
/**
|
||||
* 薪水
|
||||
*/
|
||||
|
@ -66,7 +66,6 @@ public class BusConstructionUserVo implements Serializable {
|
||||
/**
|
||||
* 分包公司
|
||||
*/
|
||||
@ExcelProperty(value = "分包公司")
|
||||
private BusContractorVo contractorVo;
|
||||
|
||||
/**
|
||||
@ -78,7 +77,6 @@ public class BusConstructionUserVo implements Serializable {
|
||||
/**
|
||||
* 班组
|
||||
*/
|
||||
@ExcelProperty(value = "班组")
|
||||
private BusProjectTeamVo teamVo;
|
||||
|
||||
/**
|
||||
@ -92,7 +90,7 @@ public class BusConstructionUserVo implements Serializable {
|
||||
* 是否代打
|
||||
*/
|
||||
@ExcelProperty(value = "是否代打")
|
||||
private Long isPinch;
|
||||
private String isPinch;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
@ -103,8 +101,9 @@ public class BusConstructionUserVo implements Serializable {
|
||||
/**
|
||||
* 0:保密 1:男 2女
|
||||
*/
|
||||
@ExcelProperty(value = "0:保密 1:男 2女")
|
||||
private Long sex;
|
||||
@ExcelProperty(value = "性别", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "user_sex_type")
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 民族
|
||||
@ -207,13 +206,13 @@ public class BusConstructionUserVo implements Serializable {
|
||||
* 入场时间
|
||||
*/
|
||||
@ExcelProperty(value = "入场时间")
|
||||
private String entryDate;
|
||||
private Date entryDate;
|
||||
|
||||
/**
|
||||
* 离场时间
|
||||
*/
|
||||
@ExcelProperty(value = "离场时间")
|
||||
private String leaveDate;
|
||||
private Date leaveDate;
|
||||
|
||||
/**
|
||||
* 薪水
|
||||
|
@ -62,6 +62,14 @@ public interface IBusConstructionBlacklistService extends IService<BusConstructi
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 校验用户是否在黑名单中
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param projectId 项目id
|
||||
*/
|
||||
void validUserInBlacklist(Long userId, Long projectId);
|
||||
|
||||
/**
|
||||
* 获取黑名单查询条件封装
|
||||
*
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.dromara.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -14,6 +15,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.project.domain.BusConstructionBlacklist;
|
||||
import org.dromara.project.domain.BusConstructionUser;
|
||||
import org.dromara.project.domain.BusProjectTeamMember;
|
||||
import org.dromara.project.domain.req.constructionblacklist.ConstructionBlacklistCreateReq;
|
||||
import org.dromara.project.domain.req.constructionblacklist.ConstructionBlacklistQueryReq;
|
||||
import org.dromara.project.domain.vo.BusConstructionBlacklistVo;
|
||||
@ -21,11 +23,14 @@ import org.dromara.project.mapper.BusConstructionBlacklistMapper;
|
||||
import org.dromara.project.service.IBusConstructionBlacklistService;
|
||||
import org.dromara.project.service.IBusConstructionUserService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.project.service.IBusProjectTeamMemberService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -44,6 +49,10 @@ public class BusConstructionBlacklistServiceImpl extends ServiceImpl<BusConstruc
|
||||
@Resource
|
||||
private IBusConstructionUserService constructionUserService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private IBusProjectTeamMemberService projectTeamMemberService;
|
||||
|
||||
/**
|
||||
* 查询黑名单
|
||||
*
|
||||
@ -88,6 +97,7 @@ public class BusConstructionBlacklistServiceImpl extends ServiceImpl<BusConstruc
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long insertByBo(ConstructionBlacklistCreateReq req) {
|
||||
// 将实体类和 DTO 进行转换
|
||||
BusConstructionBlacklist constructionBlacklist = new BusConstructionBlacklist();
|
||||
@ -110,6 +120,28 @@ public class BusConstructionBlacklistServiceImpl extends ServiceImpl<BusConstruc
|
||||
if (!result) {
|
||||
throw new ServiceException("新增黑名单失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
// 如果加入黑名单用户已在班组,则移除
|
||||
Long teamId = constructionUser.getTeamId();
|
||||
if (teamId != null) {
|
||||
// 修改用户team_id字段
|
||||
LambdaUpdateWrapper<BusConstructionUser> constructionUserLqw = Wrappers.lambdaUpdate(BusConstructionUser.class)
|
||||
.eq(BusConstructionUser::getId, userId)
|
||||
.set(BusConstructionUser::getTeamId, null)
|
||||
.set(BusConstructionUser::getLeaveDate, new Date());
|
||||
boolean update = constructionUserService.update(constructionUserLqw);
|
||||
if (!update) {
|
||||
throw new ServiceException("用户退场失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
// 移除用户与班组关联
|
||||
LambdaQueryWrapper<BusProjectTeamMember> projectTeamMemberLqw = Wrappers.lambdaQuery(BusProjectTeamMember.class)
|
||||
.eq(BusProjectTeamMember::getProjectId, req.getProjectId())
|
||||
.eq(BusProjectTeamMember::getTeamId, teamId)
|
||||
.eq(BusProjectTeamMember::getMemberId, userId);
|
||||
boolean remove = projectTeamMemberService.remove(projectTeamMemberLqw);
|
||||
if (!remove) {
|
||||
throw new ServiceException("用户退场失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
return constructionBlacklist.getId();
|
||||
}
|
||||
|
||||
@ -155,6 +187,22 @@ public class BusConstructionBlacklistServiceImpl extends ServiceImpl<BusConstruc
|
||||
return this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户是否在黑名单中
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param projectId 项目id
|
||||
*/
|
||||
@Override
|
||||
public void validUserInBlacklist(Long userId, Long projectId) {
|
||||
LambdaQueryWrapper<BusConstructionBlacklist> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(BusConstructionBlacklist::getUserId, userId)
|
||||
.eq(BusConstructionBlacklist::getProjectId, projectId);
|
||||
if (this.count(lqw) > 0) {
|
||||
throw new ServiceException("用户已存在黑名单中", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取黑名单查询条件封装
|
||||
*
|
||||
|
@ -14,14 +14,13 @@ import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.project.domain.BusConstructionUser;
|
||||
import org.dromara.project.domain.BusContractor;
|
||||
import org.dromara.project.domain.BusProjectTeamMember;
|
||||
import org.dromara.project.domain.*;
|
||||
import org.dromara.project.domain.req.constructionuser.ConstructionUserCreateReq;
|
||||
import org.dromara.project.domain.req.constructionuser.ConstructionUserQueryReq;
|
||||
import org.dromara.project.domain.req.constructionuser.ConstructionUserUpdateReq;
|
||||
import org.dromara.project.domain.vo.BusConstructionUserVo;
|
||||
import org.dromara.project.domain.vo.BusContractorVo;
|
||||
import org.dromara.project.domain.vo.BusProjectTeamVo;
|
||||
import org.dromara.project.mapper.BusConstructionUserMapper;
|
||||
import org.dromara.project.service.*;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
@ -63,6 +62,10 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
@Resource
|
||||
private ISysOssService ossService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private IBusConstructionBlacklistService constructionBlacklistService;
|
||||
|
||||
/**
|
||||
* 查询施工人员
|
||||
*
|
||||
@ -257,15 +260,11 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
Long teamId = req.getTeamId();
|
||||
Long notTeamId = req.getNotTeamId();
|
||||
String status = req.getStatus();
|
||||
Long isPinch = req.getIsPinch();
|
||||
String isPinch = req.getIsPinch();
|
||||
String phone = req.getPhone();
|
||||
Long sex = req.getSex();
|
||||
String sex = req.getSex();
|
||||
String nation = req.getNation();
|
||||
String sfzNumber = req.getSfzNumber();
|
||||
String sfzStart = req.getSfzStart();
|
||||
String sfzEnd = req.getSfzEnd();
|
||||
String sfzSite = req.getSfzSite();
|
||||
String sfzBirth = req.getSfzBirth();
|
||||
String nativePlace = req.getNativePlace();
|
||||
String yhkNumber = req.getYhkNumber();
|
||||
String yhkOpeningBank = req.getYhkOpeningBank();
|
||||
@ -280,22 +279,18 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
lqw.like(StringUtils.isNotBlank(phone), BusConstructionUser::getPhone, phone);
|
||||
lqw.like(StringUtils.isNotBlank(nation), BusConstructionUser::getNation, nation);
|
||||
lqw.like(StringUtils.isNotBlank(sfzNumber), BusConstructionUser::getSfzNumber, sfzNumber);
|
||||
lqw.like(StringUtils.isNotBlank(sfzStart), BusConstructionUser::getSfzStart, sfzStart);
|
||||
lqw.like(StringUtils.isNotBlank(sfzEnd), BusConstructionUser::getSfzEnd, sfzEnd);
|
||||
lqw.like(StringUtils.isNotBlank(sfzSite), BusConstructionUser::getSfzSite, sfzSite);
|
||||
lqw.like(StringUtils.isNotBlank(sfzBirth), BusConstructionUser::getSfzBirth, sfzBirth);
|
||||
lqw.like(StringUtils.isNotBlank(nativePlace), BusConstructionUser::getNativePlace, nativePlace);
|
||||
lqw.like(StringUtils.isNotBlank(yhkNumber), BusConstructionUser::getYhkNumber, yhkNumber);
|
||||
lqw.like(StringUtils.isNotBlank(yhkOpeningBank), BusConstructionUser::getYhkOpeningBank, yhkOpeningBank);
|
||||
lqw.like(StringUtils.isNotBlank(yhkCardholder), BusConstructionUser::getYhkCardholder, yhkCardholder);
|
||||
// 精确查询
|
||||
lqw.eq(ObjectUtils.isNotEmpty(status), BusConstructionUser::getStatus, status);
|
||||
lqw.eq(StringUtils.isNotBlank(status), BusConstructionUser::getStatus, status);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(id), BusConstructionUser::getId, id);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), BusConstructionUser::getProjectId, projectId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(contractorId), BusConstructionUser::getContractorId, contractorId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(teamId), BusConstructionUser::getTeamId, teamId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(isPinch), BusConstructionUser::getIsPinch, isPinch);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(sex), BusConstructionUser::getSex, sex);
|
||||
lqw.eq(StringUtils.isNotBlank(isPinch), BusConstructionUser::getIsPinch, isPinch);
|
||||
lqw.eq(StringUtils.isNotBlank(sex), BusConstructionUser::getSex, sex);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(typeOfWork), BusConstructionUser::getTypeOfWork, typeOfWork);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(clock), BusConstructionUser::getClock, clock);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(salary), BusConstructionUser::getSalary, salary);
|
||||
@ -305,6 +300,17 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
.ne(BusConstructionUser::getTeamId, notTeamId)
|
||||
.or().isNull(BusConstructionUser::getTeamId));
|
||||
}
|
||||
// 查询当前项目下的黑名单人员
|
||||
LambdaQueryWrapper<BusConstructionBlacklist> blacklistLqw = Wrappers.lambdaQuery(BusConstructionBlacklist.class)
|
||||
.select(BusConstructionBlacklist::getUserId);
|
||||
if (projectId != null) {
|
||||
blacklistLqw.eq(BusConstructionBlacklist::getProjectId, projectId);
|
||||
}
|
||||
List<Long> blackUserIdList = constructionBlacklistService.listObjs(blacklistLqw, obj -> (Long) obj);
|
||||
// 查询结果移除黑名单人员
|
||||
if (CollUtil.isNotEmpty(blackUserIdList)) {
|
||||
lqw.notIn(BusConstructionUser::getId, blackUserIdList);
|
||||
}
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@ -327,18 +333,31 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU
|
||||
// 关联查询分包公司信息
|
||||
Set<Long> contractorIdSet = constructionUserList.stream().map(BusConstructionUser::getContractorId)
|
||||
.collect(Collectors.toSet());
|
||||
Map<Long, List<BusContractor>> contractorIdContractorList = contractorService.listByIds(contractorIdSet).stream()
|
||||
Map<Long, List<BusContractor>> contractorIdContractorMap = contractorService.listByIds(contractorIdSet).stream()
|
||||
.collect(Collectors.groupingBy(BusContractor::getId));
|
||||
// 关联查询班组信息
|
||||
Set<Long> teamIdSet = constructionUserList.stream().map(BusConstructionUser::getTeamId)
|
||||
.collect(Collectors.toSet());
|
||||
Map<Long, List<BusProjectTeam>> teamIdTeamMap = projectTeamService.listByIds(teamIdSet).stream()
|
||||
.collect(Collectors.groupingBy(BusProjectTeam::getId));
|
||||
// 填充信息
|
||||
List<BusConstructionUserVo> constructionUserVoList = constructionUserList.stream().map(constructionUser -> {
|
||||
BusConstructionUserVo constructionUserVo = new BusConstructionUserVo();
|
||||
BeanUtils.copyProperties(constructionUser, constructionUserVo);
|
||||
// 关联分包公司信息
|
||||
Long contractorId = constructionUser.getContractorId();
|
||||
BusContractorVo contractor = null;
|
||||
if (contractorIdContractorList.containsKey(contractorId)) {
|
||||
contractor = contractorService.getVo(contractorIdContractorList.get(contractorId).get(0));
|
||||
if (contractorIdContractorMap.containsKey(contractorId)) {
|
||||
contractor = contractorService.getVo(contractorIdContractorMap.get(contractorId).get(0));
|
||||
}
|
||||
constructionUserVo.setContractorVo(contractor);
|
||||
// 关联班组信息
|
||||
Long teamId = constructionUser.getTeamId();
|
||||
BusProjectTeamVo team = null;
|
||||
if (teamIdTeamMap.containsKey(teamId)) {
|
||||
team = projectTeamService.getVo(teamIdTeamMap.get(teamId).get(0));
|
||||
}
|
||||
constructionUserVo.setTeamVo(team);
|
||||
return constructionUserVo;
|
||||
}).toList();
|
||||
constructionUserVoPage.setRecords(constructionUserVoList);
|
||||
|
@ -22,18 +22,12 @@ import org.dromara.project.domain.req.projectteammember.ProjectTeamMemberQueryRe
|
||||
import org.dromara.project.domain.req.projectteammember.ProjectTeamMemberUpdateReq;
|
||||
import org.dromara.project.domain.vo.BusProjectTeamMemberVo;
|
||||
import org.dromara.project.mapper.BusProjectTeamMemberMapper;
|
||||
import org.dromara.project.service.IBusConstructionUserService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.project.service.IBusProjectTeamMemberService;
|
||||
import org.dromara.project.service.IBusProjectTeamService;
|
||||
import org.dromara.project.service.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -55,6 +49,9 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
@Resource
|
||||
private IBusConstructionBlacklistService constructionBlacklistService;
|
||||
|
||||
/**
|
||||
* 查询项目班组下的成员
|
||||
*
|
||||
@ -111,21 +108,25 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
||||
BeanUtils.copyProperties(req, projectTeamMember);
|
||||
// 数据校验
|
||||
validEntityBeforeSave(projectTeamMember, true);
|
||||
// 判断用户是否已经被拉黑
|
||||
constructionBlacklistService.validUserInBlacklist(projectTeamMember.getMemberId(), projectTeamMember.getProjectId());
|
||||
// 判断对应的用户与项目关联是否存在
|
||||
BusProjectTeamMember teamMember = this.getOne(new LambdaQueryWrapper<BusProjectTeamMember>()
|
||||
.eq(BusProjectTeamMember::getMemberId, projectTeamMember.getMemberId()));
|
||||
.eq(BusProjectTeamMember::getMemberId, projectTeamMember.getMemberId())
|
||||
.eq(BusProjectTeamMember::getProjectId, projectTeamMember.getProjectId()));
|
||||
if (teamMember != null) {
|
||||
throw new ServiceException("当前用户已关联编号为:" + teamMember.getTeamId() + "的班组", HttpStatus.CONFLICT);
|
||||
throw new ServiceException("当前用户已入场", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 操作数据库
|
||||
boolean save = this.save(projectTeamMember);
|
||||
if (!save) {
|
||||
throw new ServiceException("新增项目班组下的成员失败,数据库异常", HttpStatus.ERROR);
|
||||
}
|
||||
// 同步修改用户表的team_id字段
|
||||
// 同步修改用户表的team_id字段并添加入场时间
|
||||
BusConstructionUser constructionUser = new BusConstructionUser();
|
||||
constructionUser.setId(projectTeamMember.getMemberId());
|
||||
constructionUser.setTeamId(projectTeamMember.getTeamId());
|
||||
constructionUser.setEntryDate(new Date());
|
||||
constructionUserService.updateById(constructionUser);
|
||||
return projectTeamMember.getId();
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.dromara.safety.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 题库对象 bus_question_bank
|
||||
@ -29,6 +29,11 @@ public class BusQuestionBank extends BaseEntity {
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题目类别
|
||||
*/
|
||||
|
@ -26,6 +26,11 @@ public class BusQuestionsConfig implements Serializable {
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
|
@ -16,6 +16,11 @@ public class QuestionBankCreateReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 9014952417764490638L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题目类别
|
||||
*/
|
||||
|
@ -21,6 +21,11 @@ public class QuestionBankQueryReq implements Serializable {
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题目类别
|
||||
*/
|
||||
|
@ -15,6 +15,11 @@ public class QuestionsConfigCreateReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -6430325731025840429L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
|
@ -20,6 +20,11 @@ public class QuestionsConfigQueryReq implements Serializable {
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
|
@ -33,6 +33,12 @@ public class BusQuestionBankVo implements Serializable {
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@ExcelProperty(value = "项目id")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 题目类别
|
||||
*/
|
||||
@ -56,8 +62,7 @@ public class BusQuestionBankVo implements Serializable {
|
||||
/**
|
||||
* 选项(以JSON数组形式存储)
|
||||
*/
|
||||
@ExcelProperty(value = "选项", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "以=JSON数组形式存储")
|
||||
@ExcelProperty(value = "选项")
|
||||
private List<String> optionList;
|
||||
|
||||
/**
|
||||
|
@ -4,8 +4,6 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.safety.domain.BusQuestionsConfig;
|
||||
|
||||
import java.io.Serial;
|
||||
@ -32,11 +30,16 @@ public class BusQuestionsConfigVo implements Serializable {
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@ExcelProperty(value = "项目id")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
@ExcelProperty(value = "单选题", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "单=位/道")
|
||||
@ExcelProperty(value = "单选题")
|
||||
private Long singleChoice;
|
||||
|
||||
/**
|
||||
@ -48,8 +51,7 @@ public class BusQuestionsConfigVo implements Serializable {
|
||||
/**
|
||||
* 多选题(单位/道)
|
||||
*/
|
||||
@ExcelProperty(value = "多选题", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "单=位/道")
|
||||
@ExcelProperty(value = "多选题")
|
||||
private Long multipleChoice;
|
||||
|
||||
/**
|
||||
@ -61,8 +63,7 @@ public class BusQuestionsConfigVo implements Serializable {
|
||||
/**
|
||||
* 判断题(单位/道)
|
||||
*/
|
||||
@ExcelProperty(value = "判断题", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "单=位/道")
|
||||
@ExcelProperty(value = "判断题")
|
||||
private Long estimate;
|
||||
|
||||
/**
|
||||
@ -86,8 +87,7 @@ public class BusQuestionsConfigVo implements Serializable {
|
||||
/**
|
||||
* 答题最大时间(单位/分钟)
|
||||
*/
|
||||
@ExcelProperty(value = "答题最大时间", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "单=位/分钟")
|
||||
@ExcelProperty(value = "答题最大时间")
|
||||
private Long answerTime;
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.dromara.common.core.constant.CacheConstants;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
@ -14,6 +15,8 @@ import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.safety.domain.BusQuestionBank;
|
||||
import org.dromara.safety.domain.req.questionbank.QuestionBankCreateReq;
|
||||
import org.dromara.safety.domain.req.questionbank.QuestionBankQueryReq;
|
||||
@ -38,6 +41,9 @@ import java.util.List;
|
||||
public class BusQuestionBankServiceImpl extends ServiceImpl<BusQuestionBankMapper, BusQuestionBank>
|
||||
implements IBusQuestionBankService {
|
||||
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
/**
|
||||
* 查询题库
|
||||
*
|
||||
@ -134,6 +140,7 @@ public class BusQuestionBankServiceImpl extends ServiceImpl<BusQuestionBankMappe
|
||||
String categoryType = entity.getCategoryType();
|
||||
String questionType = entity.getQuestionType();
|
||||
String questionContent = entity.getQuestionContent();
|
||||
Long projectId = entity.getProjectId();
|
||||
if (create) {
|
||||
if (StringUtils.isEmpty(categoryType)) {
|
||||
throw new ServiceException("分类类型不能为空", HttpStatus.BAD_REQUEST);
|
||||
@ -144,6 +151,12 @@ public class BusQuestionBankServiceImpl extends ServiceImpl<BusQuestionBankMappe
|
||||
if (StringUtils.isEmpty(questionContent)) {
|
||||
throw new ServiceException("题目内容不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
if (projectId == null) {
|
||||
throw new ServiceException("项目id不能为空", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
if (projectId != null && projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,8 +170,12 @@ public class BusQuestionBankServiceImpl extends ServiceImpl<BusQuestionBankMappe
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
List<BusQuestionBank> questionBankList = this.listByIds(ids);
|
||||
if (isValid) {
|
||||
// TODO 做一些业务上的校验,判断是否需要校验
|
||||
List<Long> projectId = questionBankList.stream().map(BusQuestionBank::getProjectId).toList();
|
||||
projectService.validAuth(projectId, userId);
|
||||
}
|
||||
return this.removeBatchByIds(ids);
|
||||
}
|
||||
@ -193,6 +210,7 @@ public class BusQuestionBankServiceImpl extends ServiceImpl<BusQuestionBankMappe
|
||||
return lqw;
|
||||
}
|
||||
Long id = req.getId();
|
||||
Long projectId = req.getProjectId();
|
||||
String categoryType = req.getCategoryType();
|
||||
String questionType = req.getQuestionType();
|
||||
String questionContent = req.getQuestionContent();
|
||||
@ -209,6 +227,7 @@ public class BusQuestionBankServiceImpl extends ServiceImpl<BusQuestionBankMappe
|
||||
lqw.like(StringUtils.isNotBlank(correctAnswer), BusQuestionBank::getCorrectAnswer, correctAnswer);
|
||||
// 精准查询
|
||||
lqw.eq(ObjectUtils.isNotEmpty(id), BusQuestionBank::getId, id);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), BusQuestionBank::getProjectId, projectId);
|
||||
lqw.eq(StringUtils.isNotBlank(categoryType), BusQuestionBank::getCategoryType, categoryType);
|
||||
lqw.eq(StringUtils.isNotBlank(questionType), BusQuestionBank::getQuestionType, questionType);
|
||||
return lqw;
|
||||
|
@ -4,11 +4,14 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.safety.domain.BusQuestionsConfig;
|
||||
import org.dromara.safety.domain.req.questionsconfig.QuestionsConfigCreateReq;
|
||||
import org.dromara.safety.domain.req.questionsconfig.QuestionsConfigQueryReq;
|
||||
@ -33,6 +36,9 @@ import java.util.List;
|
||||
public class BusQuestionsConfigServiceImpl extends ServiceImpl<BusQuestionsConfigMapper, BusQuestionsConfig>
|
||||
implements IBusQuestionsConfigService {
|
||||
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
/**
|
||||
* 查询题库配置
|
||||
*
|
||||
@ -122,8 +128,14 @@ public class BusQuestionsConfigServiceImpl extends ServiceImpl<BusQuestionsConfi
|
||||
*/
|
||||
private void validEntityBeforeSave(BusQuestionsConfig entity, Boolean create) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
Long projectId = entity.getProjectId();
|
||||
if (create) {
|
||||
|
||||
if (projectId == null) {
|
||||
throw new ServiceException("项目id不能为空", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
if (projectId != null && projectService.getById(projectId) == null) {
|
||||
throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,8 +149,12 @@ public class BusQuestionsConfigServiceImpl extends ServiceImpl<BusQuestionsConfi
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
List<BusQuestionsConfig> questionsConfigList = this.listByIds(ids);
|
||||
if (isValid) {
|
||||
// TODO 做一些业务上的校验,判断是否需要校验
|
||||
List<Long> projectId = questionsConfigList.stream().map(BusQuestionsConfig::getProjectId).toList();
|
||||
projectService.validAuth(projectId, userId);
|
||||
}
|
||||
return this.removeBatchByIds(ids);
|
||||
}
|
||||
@ -173,6 +189,7 @@ public class BusQuestionsConfigServiceImpl extends ServiceImpl<BusQuestionsConfi
|
||||
return lqw;
|
||||
}
|
||||
Long id = req.getId();
|
||||
Long projectId = req.getProjectId();
|
||||
Long singleChoice = req.getSingleChoice();
|
||||
Long singleScore = req.getSingleScore();
|
||||
Long multipleChoice = req.getMultipleChoice();
|
||||
@ -184,6 +201,7 @@ public class BusQuestionsConfigServiceImpl extends ServiceImpl<BusQuestionsConfi
|
||||
Long answerTime = req.getAnswerTime();
|
||||
// 精准查询
|
||||
lqw.eq(ObjectUtils.isNotEmpty(id), BusQuestionsConfig::getId, id);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), BusQuestionsConfig::getProjectId, projectId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(singleChoice), BusQuestionsConfig::getSingleChoice, singleChoice);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(singleScore), BusQuestionsConfig::getSingleScore, singleScore);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(multipleChoice), BusQuestionsConfig::getMultipleChoice, multipleChoice);
|
||||
|
63
plus-ui/src/api/project/constructionBlacklist/index.ts
Normal file
63
plus-ui/src/api/project/constructionBlacklist/index.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { ConstructionBlacklistVO, ConstructionBlacklistForm, ConstructionBlacklistQuery } from '@/api/project/constructionBlacklist/types';
|
||||
|
||||
/**
|
||||
* 查询黑名单列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listConstructionBlacklist = (query?: ConstructionBlacklistQuery): AxiosPromise<ConstructionBlacklistVO[]> => {
|
||||
return request({
|
||||
url: '/project/constructionBlacklist/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询黑名单详细
|
||||
* @param id
|
||||
*/
|
||||
export const getConstructionBlacklist = (id: string | number): AxiosPromise<ConstructionBlacklistVO> => {
|
||||
return request({
|
||||
url: '/project/constructionBlacklist/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增黑名单
|
||||
* @param data
|
||||
*/
|
||||
export const addConstructionBlacklist = (data: ConstructionBlacklistForm) => {
|
||||
return request({
|
||||
url: '/project/constructionBlacklist',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改黑名单
|
||||
* @param data
|
||||
*/
|
||||
export const updateConstructionBlacklist = (data: ConstructionBlacklistForm) => {
|
||||
return request({
|
||||
url: '/project/constructionBlacklist',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除黑名单
|
||||
* @param id
|
||||
*/
|
||||
export const delConstructionBlacklist = (id: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/project/constructionBlacklist/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
69
plus-ui/src/api/project/constructionBlacklist/types.ts
Normal file
69
plus-ui/src/api/project/constructionBlacklist/types.ts
Normal file
@ -0,0 +1,69 @@
|
||||
export interface ConstructionBlacklistVO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
id: string | number;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
userName: string;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
sfzNumber: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark: string;
|
||||
}
|
||||
|
||||
export interface ConstructionBlacklistForm extends BaseEntity {
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId?: string | number;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
userId?: string | number;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
export interface ConstructionBlacklistQuery extends PageQuery {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId?: string | number;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
userId?: string | number;
|
||||
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
userName?: string;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
sfzNumber?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
@ -43,7 +43,6 @@ export interface QuestionUserAnswerVO {
|
||||
* 文件地址
|
||||
*/
|
||||
file: string;
|
||||
|
||||
}
|
||||
|
||||
export interface QuestionUserAnswerForm extends BaseEntity {
|
||||
@ -91,11 +90,9 @@ export interface QuestionUserAnswerForm extends BaseEntity {
|
||||
* 文件地址
|
||||
*/
|
||||
file?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface QuestionUserAnswerQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@ -136,11 +133,8 @@ export interface QuestionUserAnswerQuery extends PageQuery {
|
||||
*/
|
||||
file?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -4,6 +4,11 @@ export interface QuestionsConfigVO {
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId: string | number;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
@ -48,7 +53,6 @@ export interface QuestionsConfigVO {
|
||||
* 答题最大时间(单位/分钟)
|
||||
*/
|
||||
answerTime: number;
|
||||
|
||||
}
|
||||
|
||||
export interface QuestionsConfigForm extends BaseEntity {
|
||||
@ -57,6 +61,11 @@ export interface QuestionsConfigForm extends BaseEntity {
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId: string | number;
|
||||
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
@ -101,11 +110,13 @@ export interface QuestionsConfigForm extends BaseEntity {
|
||||
* 答题最大时间(单位/分钟)
|
||||
*/
|
||||
answerTime?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface QuestionsConfigQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId: string | number;
|
||||
/**
|
||||
* 单选题(单位/道)
|
||||
*/
|
||||
@ -151,11 +162,8 @@ export interface QuestionsConfigQuery extends PageQuery {
|
||||
*/
|
||||
answerTime?: number;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
163
plus-ui/src/views/project/constructionBlacklist/index.vue
Normal file
163
plus-ui/src/views/project/constructionBlacklist/index.vue
Normal file
@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="名字" prop="userName">
|
||||
<el-input v-model="queryParams.userName" placeholder="请输入名字" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号码" prop="sfzNumber" label-width="120">
|
||||
<el-input v-model="queryParams.sfzNumber" placeholder="请输入身份证号码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['project:constructionBlacklist:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="constructionBlacklistList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||
<el-table-column label="名字" align="center" prop="userName" />
|
||||
<el-table-column label="身份证号码" align="center" prop="sfzNumber" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:constructionBlacklist:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="ConstructionBlacklist" lang="ts">
|
||||
import { delConstructionBlacklist, listConstructionBlacklist } from '@/api/project/constructionBlacklist';
|
||||
import { ConstructionBlacklistForm, ConstructionBlacklistQuery, ConstructionBlacklistVO } from '@/api/project/constructionBlacklist/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const constructionBlacklistList = ref<ConstructionBlacklistVO[]>([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const constructionBlacklistFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: ConstructionBlacklistForm = {
|
||||
projectId: currentProject.value.id,
|
||||
userId: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<ConstructionBlacklistForm, ConstructionBlacklistQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
userId: undefined,
|
||||
userName: undefined,
|
||||
sfzNumber: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
|
||||
userId: [{ required: true, message: '用户id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询黑名单列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listConstructionBlacklist(queryParams.value);
|
||||
constructionBlacklistList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
constructionBlacklistFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ConstructionBlacklistVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ConstructionBlacklistVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除黑名单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delConstructionBlacklist(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
@ -12,6 +12,11 @@
|
||||
<el-option v-for="item in contractorOpt" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="班组" prop="contractorId">
|
||||
<el-select v-model="queryParams.teamId" clearable placeholder="请选择班组">
|
||||
<el-option v-for="item in projectTeamOpt" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工种" prop="typeOfWork">
|
||||
<el-select v-model="queryParams.typeOfWork" clearable placeholder="请选择工种">
|
||||
<el-option v-for="item in type_of_work" :key="item.value" :label="item.label" :value="item.value" />
|
||||
@ -71,16 +76,15 @@
|
||||
{{ getTeamName(scope.row.teamId) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
<el-table-column label="联系电话" align="center" prop="phone" />
|
||||
<el-table-column label="联系电话" align="center" prop="phone" min-width="120" />
|
||||
<el-table-column label="性别" align="center" prop="sex">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="user_sex_type" :value="scope.row.sex" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="民族" align="center" prop="nation" />
|
||||
<el-table-column label="身份证号码" align="center" prop="sfzNumber" />
|
||||
<el-table-column label="工种" align="center" prop="typeOfWork">
|
||||
<el-table-column label="身份证号码" align="center" prop="sfzNumber" min-width="180" />
|
||||
<el-table-column label="工种" align="center" prop="typeOfWork" min-width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="type_of_work" :value="scope.row.typeOfWork" />
|
||||
</template>
|
||||
@ -90,11 +94,16 @@
|
||||
<dict-tag :options="user_clock_type" :value="scope.row.clock" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="入场时间" align="center" prop="entryDate" />
|
||||
<el-table-column label="离场时间" align="center" prop="leaveDate" />
|
||||
<el-table-column label="入场时间" align="center" prop="entryDate" min-width="180" />
|
||||
<el-table-column label="离场时间" align="center" prop="leaveDate" min-width="180" />
|
||||
<el-table-column label="薪水" align="center" prop="salary" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
{{ scope.row.status == 0 ? '在职' : '离职' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" min-width="300">
|
||||
<template #default="scope">
|
||||
<el-space wrap>
|
||||
<el-button link type="primary" icon="View" @click="handleShowDrawer(scope.row)" v-hasPermi="['project:constructionUser:query']">
|
||||
@ -103,6 +112,9 @@
|
||||
<el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:constructionUser:edit']">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button link type="danger" icon="Avatar" @click="handleJoinBlacklist(scope.row)" v-hasPermi="['project:constructionBlacklist:add']">
|
||||
黑名单
|
||||
</el-button>
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:constructionUser:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
@ -271,7 +283,7 @@ import { listProjectTeam } from '@/api/project/projectTeam';
|
||||
import { ContractorVO } from '@/api/project/contractor/types';
|
||||
import { ProjectTeamVO } from '@/api/project/projectTeam/types';
|
||||
import ConstructionUserDetail from '@/views/project/constructionUser/component/ConstructionUserDetail.vue';
|
||||
import ProjectTypes from '@/utils/propTypes';
|
||||
import { addConstructionBlacklist } from '@/api/project/constructionBlacklist';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { type_of_work, user_sex_type, user_clock_type } = toRefs<any>(proxy?.useDict('type_of_work', 'user_sex_type', 'user_clock_type'));
|
||||
@ -494,6 +506,17 @@ const submitForm = () => {
|
||||
});
|
||||
};
|
||||
|
||||
/** 加入黑名单按钮操作 */
|
||||
const handleJoinBlacklist = async (row?: ConstructionUserVO) => {
|
||||
await proxy?.$modal.confirm('确认要将该员工加入黑名单吗?').finally(() => (loading.value = false));
|
||||
await addConstructionBlacklist({
|
||||
userId: row.id,
|
||||
projectId: currentProject.value.id
|
||||
});
|
||||
proxy?.$modal.msgSuccess('加入成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ConstructionUserVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
|
@ -86,7 +86,7 @@
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="projectTeamMemberFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="施工人员" prop="memberId">
|
||||
<el-select v-model="form.memberId" clearable placeholder="请选择人员">
|
||||
<el-select v-model="form.memberId" clearable placeholder="请选择人员" filterable>
|
||||
<el-option v-for="item in userNotInTeamOpt" :key="item.value" :label="item.label" :value="item.value" />
|
||||
<pagination
|
||||
size="small"
|
||||
@ -231,7 +231,8 @@ const userQueryParams = ref<ConstructionUserQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
orderByColumn: 'createTime',
|
||||
isAsc: 'desc'
|
||||
isAsc: 'desc',
|
||||
projectId: currentProject.value.id
|
||||
});
|
||||
|
||||
// 获取不在当前班组的成员
|
||||
|
@ -5,18 +5,18 @@
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="工种" prop="workType">
|
||||
<el-select v-model="queryParams.workType" placeholder="请选择工种" clearable >
|
||||
<el-option v-for="dict in type_of_work" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
<el-select v-model="queryParams.workType" placeholder="请选择工种" clearable>
|
||||
<el-option v-for="dict in type_of_work" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工资计算方式" prop="wageCalculationType" label-width="100px">
|
||||
<el-select v-model="queryParams.wageCalculationType" placeholder="请选择工资计算方式" clearable >
|
||||
<el-option v-for="dict in wageCalculationTypeList" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
<el-select v-model="queryParams.wageCalculationType" placeholder="请选择工资计算方式" clearable>
|
||||
<el-option v-for="dict in wageCalculationTypeList" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工资计量单位" prop="wageMeasureUnit" label-width="100px">
|
||||
<el-select v-model="queryParams.wageMeasureUnit" placeholder="请选择工资计量单位" clearable >
|
||||
<el-option v-for="dict in wage_measure_unit_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
<el-select v-model="queryParams.wageMeasureUnit" placeholder="请选择工资计量单位" clearable>
|
||||
<el-option v-for="dict in wage_measure_unit_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@ -32,16 +32,20 @@
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:workWage:add']">新增</el-button>
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:workWage:add']">新增 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['project:workWage:edit']">修改</el-button>
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['project:workWage:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['project:workWage:remove']">删除</el-button>
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['project:workWage:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['project:workWage:export']">导出</el-button>
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['project:workWage:export']">导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -49,28 +53,28 @@
|
||||
|
||||
<el-table v-loading="loading" :data="workWageList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" type="index" width="60px"/>
|
||||
<el-table-column label="序号" align="center" type="index" width="60px" />
|
||||
<!-- <el-table-column label="主键id" align="center" prop="id" v-if="true" /> -->
|
||||
<!-- <el-table-column label="项目id" align="center" prop="projectId" /> -->
|
||||
<el-table-column label="工种" align="center" prop="workType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="type_of_work" :value="scope.row.workType"/>
|
||||
<dict-tag :options="type_of_work" :value="scope.row.workType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否是特种兵" align="center" prop="isSpecialType" >
|
||||
<el-table-column label="是否是特种兵" align="center" prop="isSpecialType">
|
||||
<template #default="scope">
|
||||
{{ scope.row.isSpecialType==1?'是':"否" }}
|
||||
{{ scope.row.isSpecialType == 1 ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工资计算方式" align="center" prop="wageCalculationType" >
|
||||
<el-table-column label="工资计算方式" align="center" prop="wageCalculationType">
|
||||
<template #default="scope">
|
||||
{{ scope.row.wageCalculationType==1?'计时':"计件" }}
|
||||
{{ scope.row.wageCalculationType == 1 ? '计时' : '计件' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工资标准" align="center" prop="wage" />
|
||||
<el-table-column label="工资计量单位" align="center" prop="wageMeasureUnit">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="wage_measure_unit_type" :value="scope.row.wageMeasureUnit"/>
|
||||
<dict-tag :options="wage_measure_unit_type" :value="scope.row.wageMeasureUnit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" />
|
||||
@ -97,32 +101,17 @@
|
||||
</el-form-item> -->
|
||||
<el-form-item label="工种" prop="workType">
|
||||
<el-select v-model="form.workType" placeholder="请选择工种">
|
||||
<el-option
|
||||
v-for="dict in type_of_work"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in type_of_work" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否是特种兵 " prop="isSpecialType">
|
||||
<el-select v-model="form.isSpecialType" placeholder="请选择是否是特种兵">
|
||||
<el-option
|
||||
v-for="dict in isSpecialTypeList"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in isSpecialTypeList" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工资计算方式" prop="wageCalculationType">
|
||||
<el-select v-model="form.wageCalculationType" placeholder="请选择工资计算方式">
|
||||
<el-option
|
||||
v-for="dict in wageCalculationTypeList"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in wageCalculationTypeList" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工资标准" prop="wage">
|
||||
@ -130,16 +119,11 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="工资计量单位" prop="wageMeasureUnit">
|
||||
<el-select v-model="form.wageMeasureUnit" placeholder="请选择工资计量单位">
|
||||
<el-option
|
||||
v-for="dict in wage_measure_unit_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in wage_measure_unit_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@ -154,8 +138,9 @@
|
||||
|
||||
<script setup name="WorkWage" lang="ts">
|
||||
import { listWorkWage, getWorkWage, delWorkWage, addWorkWage, updateWorkWage } from '@/api/project/workWage';
|
||||
import { WorkWageVO, WorkWageQuery, WorkWageForm,SpecialType } from '@/api/project/workWage/types';
|
||||
import { WorkWageVO, WorkWageQuery, WorkWageForm, SpecialType } from '@/api/project/workWage/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { type_of_work, wage_measure_unit_type } = toRefs<any>(proxy?.useDict('type_of_work', 'wage_measure_unit_type'));
|
||||
console.log(type_of_work);
|
||||
@ -175,15 +160,15 @@ const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const workWageFormRef = ref<ElFormInstance>();
|
||||
const isSpecialTypeList=ref<Array<SpecialType>>([
|
||||
{label:"是",value:"1"},
|
||||
{label:"否",value:"2"}
|
||||
])
|
||||
const isSpecialTypeList = ref<Array<SpecialType>>([
|
||||
{ label: '是', value: '1' },
|
||||
{ label: '否', value: '2' }
|
||||
]);
|
||||
|
||||
const wageCalculationTypeList=ref<Array<SpecialType>>([
|
||||
{label:"计时",value:"1"},
|
||||
{label:"计件",value:"2"}
|
||||
])
|
||||
const wageCalculationTypeList = ref<Array<SpecialType>>([
|
||||
{ label: '计时', value: '1' },
|
||||
{ label: '计件', value: '2' }
|
||||
]);
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
@ -197,10 +182,10 @@ const initFormData: WorkWageForm = {
|
||||
wageCalculationType: undefined,
|
||||
wage: undefined,
|
||||
wageMeasureUnit: undefined,
|
||||
remark: undefined,
|
||||
}
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<WorkWageForm, WorkWageQuery>>({
|
||||
form: {...initFormData},
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@ -210,13 +195,10 @@ const data = reactive<PageData<WorkWageForm, WorkWageQuery>>({
|
||||
wageCalculationType: undefined,
|
||||
wage: undefined,
|
||||
wageMeasureUnit: undefined,
|
||||
params: {
|
||||
}
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
||||
],
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
@ -229,55 +211,55 @@ const getList = async () => {
|
||||
workWageList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {...initFormData};
|
||||
form.value = { ...initFormData };
|
||||
workWageFormRef.value?.resetFields();
|
||||
}
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: WorkWageVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = "添加工种薪水";
|
||||
}
|
||||
dialog.title = '添加工种薪水';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: WorkWageVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getWorkWage(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改工种薪水";
|
||||
}
|
||||
dialog.title = '修改工种薪水';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
@ -285,32 +267,36 @@ const submitForm = () => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateWorkWage(form.value).finally(() => buttonLoading.value = false);
|
||||
await updateWorkWage(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addWorkWage(form.value).finally(() => buttonLoading.value = false);
|
||||
await addWorkWage(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: WorkWageVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除工种薪水编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await proxy?.$modal.confirm('是否确认删除工种薪水编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delWorkWage(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('project/workWage/export', {
|
||||
...queryParams.value
|
||||
}, `workWage_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
proxy?.download(
|
||||
'project/workWage/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`workWage_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
|
@ -5,13 +5,13 @@
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="题目类别" prop="categoryType">
|
||||
<el-select v-model="queryParams.categoryType" placeholder="请选择题目类别" clearable >
|
||||
<el-option v-for="dict in safety_question_category_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
<el-select v-model="queryParams.categoryType" placeholder="请选择题目类别" clearable>
|
||||
<el-option v-for="dict in safety_question_category_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题目类型" prop="questionType">
|
||||
<el-select v-model="queryParams.questionType" placeholder="请选择题目类型" clearable >
|
||||
<el-option v-for="dict in safety_question_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
<el-select v-model="queryParams.questionType" placeholder="请选择题目类型" clearable>
|
||||
<el-option v-for="dict in safety_question_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题目内容" prop="questionContent">
|
||||
@ -36,16 +36,20 @@
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:questionBank:add']">新增</el-button>
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:questionBank:add']"> 新增 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['safety:questionBank:edit']">修改</el-button>
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['safety:questionBank:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:questionBank:remove']">删除</el-button>
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:questionBank:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:questionBank:export']">导出</el-button>
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:questionBank:export']">导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -56,12 +60,12 @@
|
||||
<el-table-column label="主键id" align="center" prop="id" v-if="true" />
|
||||
<el-table-column label="题目类别" align="center" prop="categoryType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="safety_question_category_type" :value="scope.row.categoryType"/>
|
||||
<dict-tag :options="safety_question_category_type" :value="scope.row.categoryType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="题目类型" align="center" prop="questionType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="safety_question_type" :value="scope.row.questionType"/>
|
||||
<dict-tag :options="safety_question_type" :value="scope.row.questionType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="题目内容" align="center" prop="questionContent" />
|
||||
@ -86,29 +90,19 @@
|
||||
<el-form ref="questionBankFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="题目类别" prop="categoryType">
|
||||
<el-select v-model="form.categoryType" placeholder="请选择题目类别">
|
||||
<el-option
|
||||
v-for="dict in safety_question_category_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in safety_question_category_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题目类型" prop="questionType">
|
||||
<el-select v-model="form.questionType" placeholder="请选择题目类型">
|
||||
<el-option
|
||||
v-for="dict in safety_question_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in safety_question_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题目内容" prop="questionContent">
|
||||
<el-input v-model="form.questionContent" placeholder="请输入题目内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="选项" prop="options">
|
||||
<el-input v-model="form.options" type="textarea" placeholder="请输入内容" />
|
||||
<el-input v-model="form.options" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="正确答案" prop="correctAnswer">
|
||||
<el-input v-model="form.correctAnswer" placeholder="请输入正确答案" />
|
||||
@ -125,12 +119,16 @@
|
||||
</template>
|
||||
|
||||
<script setup name="QuestionBank" lang="ts">
|
||||
import { listQuestionBank, getQuestionBank, delQuestionBank, addQuestionBank, updateQuestionBank } from '@/api/safety/questionBank';
|
||||
import { QuestionBankVO, QuestionBankQuery, QuestionBankForm } from '@/api/safety/questionBank/types';
|
||||
import { addQuestionBank, delQuestionBank, getQuestionBank, listQuestionBank, updateQuestionBank } from '@/api/safety/questionBank';
|
||||
import { QuestionBankForm, QuestionBankQuery, QuestionBankVO } from '@/api/safety/questionBank/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { safety_question_type, safety_question_category_type } = toRefs<any>(proxy?.useDict('safety_question_type', 'safety_question_category_type'));
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const questionBankList = ref<QuestionBankVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
@ -154,10 +152,10 @@ const initFormData: QuestionBankForm = {
|
||||
questionType: undefined,
|
||||
questionContent: undefined,
|
||||
options: undefined,
|
||||
correctAnswer: undefined,
|
||||
}
|
||||
correctAnswer: undefined
|
||||
};
|
||||
const data = reactive<PageData<QuestionBankForm, QuestionBankQuery>>({
|
||||
form: {...initFormData},
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@ -166,28 +164,15 @@ const data = reactive<PageData<QuestionBankForm, QuestionBankQuery>>({
|
||||
questionContent: undefined,
|
||||
options: undefined,
|
||||
correctAnswer: undefined,
|
||||
params: {
|
||||
}
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
||||
],
|
||||
categoryType: [
|
||||
{ required: true, message: "题目类别不能为空", trigger: "change" }
|
||||
],
|
||||
questionType: [
|
||||
{ required: true, message: "题目类型不能为空", trigger: "change" }
|
||||
],
|
||||
questionContent: [
|
||||
{ required: true, message: "题目内容不能为空", trigger: "blur" }
|
||||
],
|
||||
options: [
|
||||
{ required: true, message: "选项不能为空", trigger: "blur" }
|
||||
],
|
||||
correctAnswer: [
|
||||
{ required: true, message: "正确答案不能为空", trigger: "blur" }
|
||||
],
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
|
||||
categoryType: [{ required: true, message: '题目类别不能为空', trigger: 'change' }],
|
||||
questionType: [{ required: true, message: '题目类型不能为空', trigger: 'change' }],
|
||||
questionContent: [{ required: true, message: '题目内容不能为空', trigger: 'blur' }],
|
||||
options: [{ required: true, message: '选项不能为空', trigger: 'blur' }],
|
||||
correctAnswer: [{ required: true, message: '正确答案不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
@ -200,55 +185,55 @@ const getList = async () => {
|
||||
questionBankList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {...initFormData};
|
||||
form.value = { ...initFormData };
|
||||
questionBankFormRef.value?.resetFields();
|
||||
}
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: QuestionBankVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = "添加题库";
|
||||
}
|
||||
dialog.title = '添加题库';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: QuestionBankVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getQuestionBank(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改题库";
|
||||
}
|
||||
dialog.title = '修改题库';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
@ -256,32 +241,36 @@ const submitForm = () => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateQuestionBank(form.value).finally(() => buttonLoading.value = false);
|
||||
await updateQuestionBank(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addQuestionBank(form.value).finally(() => buttonLoading.value = false);
|
||||
await addQuestionBank(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: QuestionBankVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除题库编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await proxy?.$modal.confirm('是否确认删除题库编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delQuestionBank(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('safety/questionBank/export', {
|
||||
...queryParams.value
|
||||
}, `questionBank_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
proxy?.download(
|
||||
'safety/questionBank/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`questionBank_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
|
@ -38,16 +38,26 @@
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:questionUserAnswer:add']">新增</el-button>
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:questionUserAnswer:add']">新增 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['safety:questionUserAnswer:edit']">修改</el-button>
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['safety:questionUserAnswer:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:questionUserAnswer:remove']">删除</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['safety:questionUserAnswer:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:questionUserAnswer:export']">导出</el-button>
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:questionUserAnswer:export']">导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -70,7 +80,13 @@
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['safety:questionUserAnswer:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['safety:questionUserAnswer:remove']"></el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['safety:questionUserAnswer:remove']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -103,7 +119,7 @@
|
||||
<el-input v-model="form.pass" placeholder="请输入及格线/总分" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文件地址" prop="file">
|
||||
<file-upload v-model="form.file"/>
|
||||
<file-upload v-model="form.file" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@ -117,11 +133,21 @@
|
||||
</template>
|
||||
|
||||
<script setup name="QuestionUserAnswer" lang="ts">
|
||||
import { listQuestionUserAnswer, getQuestionUserAnswer, delQuestionUserAnswer, addQuestionUserAnswer, updateQuestionUserAnswer } from '@/api/safety/questionUserAnswer';
|
||||
import { QuestionUserAnswerVO, QuestionUserAnswerQuery, QuestionUserAnswerForm } from '@/api/safety/questionUserAnswer/types';
|
||||
import {
|
||||
addQuestionUserAnswer,
|
||||
delQuestionUserAnswer,
|
||||
getQuestionUserAnswer,
|
||||
listQuestionUserAnswer,
|
||||
updateQuestionUserAnswer
|
||||
} from '@/api/safety/questionUserAnswer';
|
||||
import { QuestionUserAnswerForm, QuestionUserAnswerQuery, QuestionUserAnswerVO } from '@/api/safety/questionUserAnswer/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const questionUserAnswerList = ref<QuestionUserAnswerVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
@ -141,35 +167,32 @@ const dialog = reactive<DialogOption>({
|
||||
|
||||
const initFormData: QuestionUserAnswerForm = {
|
||||
id: undefined,
|
||||
projectId: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
userId: undefined,
|
||||
bankId: undefined,
|
||||
bankIdList: undefined,
|
||||
answer: undefined,
|
||||
score: undefined,
|
||||
takeTime: undefined,
|
||||
pass: undefined,
|
||||
file: undefined,
|
||||
}
|
||||
file: undefined
|
||||
};
|
||||
const data = reactive<PageData<QuestionUserAnswerForm, QuestionUserAnswerQuery>>({
|
||||
form: {...initFormData},
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
userId: undefined,
|
||||
bankId: undefined,
|
||||
bankIdList: undefined,
|
||||
answer: undefined,
|
||||
score: undefined,
|
||||
takeTime: undefined,
|
||||
pass: undefined,
|
||||
file: undefined,
|
||||
params: {
|
||||
}
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
||||
],
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
@ -182,55 +205,55 @@ const getList = async () => {
|
||||
questionUserAnswerList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {...initFormData};
|
||||
form.value = { ...initFormData };
|
||||
questionUserAnswerFormRef.value?.resetFields();
|
||||
}
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: QuestionUserAnswerVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = "添加用户试卷存储";
|
||||
}
|
||||
dialog.title = '添加用户试卷存储';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: QuestionUserAnswerVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getQuestionUserAnswer(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改用户试卷存储";
|
||||
}
|
||||
dialog.title = '修改用户试卷存储';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
@ -238,32 +261,36 @@ const submitForm = () => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateQuestionUserAnswer(form.value).finally(() => buttonLoading.value = false);
|
||||
await updateQuestionUserAnswer(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addQuestionUserAnswer(form.value).finally(() => buttonLoading.value = false);
|
||||
await addQuestionUserAnswer(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: QuestionUserAnswerVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除用户试卷存储编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await proxy?.$modal.confirm('是否确认删除用户试卷存储编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delQuestionUserAnswer(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('safety/questionUserAnswer/export', {
|
||||
...queryParams.value
|
||||
}, `questionUserAnswer_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
proxy?.download(
|
||||
'safety/questionUserAnswer/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`questionUserAnswer_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
|
@ -44,16 +44,20 @@
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:questionsConfig:add']">新增</el-button>
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:questionsConfig:add']"> 新增 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['safety:questionsConfig:edit']">修改</el-button>
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['safety:questionsConfig:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:questionsConfig:remove']">删除</el-button>
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:questionsConfig:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:questionsConfig:export']">导出</el-button>
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:questionsConfig:export']">导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -77,7 +81,13 @@
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['safety:questionsConfig:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['safety:questionsConfig:remove']"></el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['safety:questionsConfig:remove']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -127,11 +137,15 @@
|
||||
</template>
|
||||
|
||||
<script setup name="QuestionsConfig" lang="ts">
|
||||
import { listQuestionsConfig, getQuestionsConfig, delQuestionsConfig, addQuestionsConfig, updateQuestionsConfig } from '@/api/safety/questionsConfig';
|
||||
import { QuestionsConfigVO, QuestionsConfigQuery, QuestionsConfigForm } from '@/api/safety/questionsConfig/types';
|
||||
import { addQuestionsConfig, delQuestionsConfig, getQuestionsConfig, listQuestionsConfig, updateQuestionsConfig } from '@/api/safety/questionsConfig';
|
||||
import { QuestionsConfigForm, QuestionsConfigQuery, QuestionsConfigVO } from '@/api/safety/questionsConfig/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const questionsConfigList = ref<QuestionsConfigVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
@ -151,6 +165,7 @@ const dialog = reactive<DialogOption>({
|
||||
|
||||
const initFormData: QuestionsConfigForm = {
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
singleChoice: undefined,
|
||||
singleScore: undefined,
|
||||
multipleChoice: undefined,
|
||||
@ -160,12 +175,13 @@ const initFormData: QuestionsConfigForm = {
|
||||
fullMark: undefined,
|
||||
passScore: undefined,
|
||||
answerTime: undefined
|
||||
}
|
||||
};
|
||||
const data = reactive<PageData<QuestionsConfigForm, QuestionsConfigQuery>>({
|
||||
form: {...initFormData},
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: currentProject.value.id,
|
||||
singleChoice: undefined,
|
||||
singleScore: undefined,
|
||||
multipleChoice: undefined,
|
||||
@ -175,40 +191,19 @@ const data = reactive<PageData<QuestionsConfigForm, QuestionsConfigQuery>>({
|
||||
fullMark: undefined,
|
||||
passScore: undefined,
|
||||
answerTime: undefined,
|
||||
params: {
|
||||
}
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
||||
],
|
||||
singleChoice: [
|
||||
{ required: true, message: "单选题不能为空", trigger: "blur" }
|
||||
],
|
||||
singleScore: [
|
||||
{ required: true, message: "单选分数不能为空", trigger: "blur" }
|
||||
],
|
||||
multipleChoice: [
|
||||
{ required: true, message: "多选题不能为空", trigger: "blur" }
|
||||
],
|
||||
multipleScore: [
|
||||
{ required: true, message: "多选分数不能为空", trigger: "blur" }
|
||||
],
|
||||
estimate: [
|
||||
{ required: true, message: "判断题不能为空", trigger: "blur" }
|
||||
],
|
||||
estimateScore: [
|
||||
{ required: true, message: "判断分数不能为空", trigger: "blur" }
|
||||
],
|
||||
fullMark: [
|
||||
{ required: true, message: "满分不能为空", trigger: "blur" }
|
||||
],
|
||||
passScore: [
|
||||
{ required: true, message: "及格线不能为空", trigger: "blur" }
|
||||
],
|
||||
answerTime: [
|
||||
{ required: true, message: "答题最大时间不能为空", trigger: "blur" }
|
||||
]
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
|
||||
singleChoice: [{ required: true, message: '单选题不能为空', trigger: 'blur' }],
|
||||
singleScore: [{ required: true, message: '单选分数不能为空', trigger: 'blur' }],
|
||||
multipleChoice: [{ required: true, message: '多选题不能为空', trigger: 'blur' }],
|
||||
multipleScore: [{ required: true, message: '多选分数不能为空', trigger: 'blur' }],
|
||||
estimate: [{ required: true, message: '判断题不能为空', trigger: 'blur' }],
|
||||
estimateScore: [{ required: true, message: '判断分数不能为空', trigger: 'blur' }],
|
||||
fullMark: [{ required: true, message: '满分不能为空', trigger: 'blur' }],
|
||||
passScore: [{ required: true, message: '及格线不能为空', trigger: 'blur' }],
|
||||
answerTime: [{ required: true, message: '答题最大时间不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
@ -221,55 +216,55 @@ const getList = async () => {
|
||||
questionsConfigList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {...initFormData};
|
||||
form.value = { ...initFormData };
|
||||
questionsConfigFormRef.value?.resetFields();
|
||||
}
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: QuestionsConfigVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = "添加题库配置";
|
||||
}
|
||||
dialog.title = '添加题库配置';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: QuestionsConfigVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getQuestionsConfig(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改题库配置";
|
||||
}
|
||||
dialog.title = '修改题库配置';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
@ -277,32 +272,36 @@ const submitForm = () => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateQuestionsConfig(form.value).finally(() => buttonLoading.value = false);
|
||||
await updateQuestionsConfig(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addQuestionsConfig(form.value).finally(() => buttonLoading.value = false);
|
||||
await addQuestionsConfig(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: QuestionsConfigVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除题库配置编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await proxy?.$modal.confirm('是否确认删除题库配置编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delQuestionsConfig(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('safety/questionsConfig/export', {
|
||||
...queryParams.value
|
||||
}, `questionsConfig_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
proxy?.download(
|
||||
'safety/questionsConfig/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`questionsConfig_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
|
Reference in New Issue
Block a user