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