疗休养
This commit is contained in:
+297
-9
@@ -1,32 +1,52 @@
|
||||
package io.v.nutz.zhgh.therapyRecuperation.controller.theRapyConfig;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import cn.wizzer.framework.page.Pagination;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.constant.RedisConstant;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationBaseManagement;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationConfig;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLine;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.model.TheRapyRecuperationLot;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.web.commons.slog.annotation.SLog;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyRecuperationCanApplyOutUserMode;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.model.*;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.AdaptBy;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
import org.nutz.trans.Trans;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -36,14 +56,16 @@ import java.util.stream.Collectors;
|
||||
* @date 2022/06/01
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/theRapyRecuperation/TheRapyConfig")
|
||||
@Ok("json:full")
|
||||
@At("/platform/theRapyRecuperation/TheRapyConfig")
|
||||
public class TheRapyRecuperationConfigController {
|
||||
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
|
||||
|
||||
@@ -137,4 +159,270 @@ public class TheRapyRecuperationConfigController {
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@RequiresPermissions("theRapyRecuperation.TheRapyConfig")
|
||||
@SLog(tag = "疗休养基础配置", msg = "下载省外名额人员导入模版", param = true, result = true)
|
||||
public void downloadImportTemp(HttpServletResponse response) {
|
||||
try {
|
||||
ViTool.excelResponse(response, "省外名额人员导入模版.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook sheets = ExcelExportUtil.exportExcel(exportParams, TheRapyRecuperationCanApplyOutUserMode.class, new ArrayList<>());
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
sheets.write(outputStream);
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock(true);
|
||||
|
||||
|
||||
/**
|
||||
* 导入省外名额人员
|
||||
* @param file 文件数据
|
||||
* @param isFlag 是否清空更新
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("theRapyRecuperation.TheRapyConfig")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@SLog(tag = "疗休养基础配置", msg = "导入省外名额人员", param = true, result = true)
|
||||
public Result doImport(TempFile file, boolean isFlag){
|
||||
try {
|
||||
lock.lock();
|
||||
List<TheRapyRecuperationCanApplyOutUserMode> importList = ExcelImportUtil.importExcel(file.getFile(),
|
||||
TheRapyRecuperationCanApplyOutUserMode.class, new ImportParams());
|
||||
|
||||
if (Lang.isEmpty(importList)) {
|
||||
return Result.error("excel无数据");
|
||||
}
|
||||
// 获取数据库人员,看这些人在不在数据库里边
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname AS loginName,
|
||||
username AS userName,
|
||||
sex,
|
||||
mobile,
|
||||
userState,
|
||||
personType,
|
||||
preparedBy,
|
||||
unitid AS unitId,
|
||||
unitname AS unitName,
|
||||
unionid AS unionId,
|
||||
unionname AS unionName
|
||||
FROM
|
||||
`user`
|
||||
""");
|
||||
sql.setCallback(Sqls.callback.maps());
|
||||
dao.execute(sql);
|
||||
List<NutMap> userInfoList = (List<NutMap>) sql.getResult();
|
||||
Map<String, NutMap> userMap = userInfoList.stream().collect(Collectors.toMap(v -> v.getString("loginName"), v -> v));
|
||||
|
||||
// 查询表中原有的人员
|
||||
// 查个蛋,直接删了再加
|
||||
// List<TheRapyRecuperationCanApplyOutUserMode> query;
|
||||
// if (!isFlag) {
|
||||
// query = dao.query(TheRapyRecuperationCanApplyOutUserMode.class, Cnd.NEW());
|
||||
// }
|
||||
|
||||
// 错误信息存储集合
|
||||
List<TheRapyRecuperationCanApplyOutUserMode> errorInfos = new ArrayList<>();
|
||||
// 结果数据
|
||||
List<TheRapyRecuperationCanApplyOutUser> resultList = new ArrayList<>();
|
||||
// 遍历excel数据,比对数据并插入数据库
|
||||
for (TheRapyRecuperationCanApplyOutUserMode mode : importList) {
|
||||
NutMap map = userMap.get(mode.getLoginName());
|
||||
if (Lang.isEmpty(map)) {
|
||||
mode.setRemark("请检查此人员工号是否正确,系统查不到此人");
|
||||
errorInfos.add(mode);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 不是清空更新,就去检验这个人员是否在省外名额库里面,在的话去忽略
|
||||
// 艹,判断个毛,直接删了再加
|
||||
TheRapyRecuperationCanApplyOutUser apply = new TheRapyRecuperationCanApplyOutUser();
|
||||
apply.setId(R.UU32());
|
||||
apply.setUserId(map.getString("id"));
|
||||
apply.setLoginName(map.getString("loginName"));
|
||||
apply.setUserName(map.getString("userName"));
|
||||
apply.setSex(map.getString("sex"));
|
||||
apply.setMobile(map.getString("mobile"));
|
||||
apply.setUserState(map.getString("userState"));
|
||||
apply.setPersonType(map.getString("personType"));
|
||||
apply.setPreparedBy(map.getString("preparedBy"));
|
||||
apply.setUnitId(map.getString("unitId"));
|
||||
apply.setUnitName(map.getString("unitName"));
|
||||
apply.setUnionId(map.getString("unionId"));
|
||||
apply.setUnionName(map.getString("unionName"));
|
||||
resultList.add(apply);
|
||||
}
|
||||
|
||||
if (!isFlag) {
|
||||
List<String> clearUserLoginNameList = importList.stream().map(TheRapyRecuperationCanApplyOutUserMode::getLoginName).toList();
|
||||
dao.clear(TheRapyRecuperationCanApplyOutUser.class, Cnd.where("loginName", "in", clearUserLoginNameList));
|
||||
} else {
|
||||
dao.clear(TheRapyRecuperationCanApplyOutUser.class);
|
||||
}
|
||||
|
||||
dao.fastInsert(resultList);
|
||||
|
||||
NutMap nutMap = NutMap.NEW();
|
||||
nutMap.setv("totalCount", importList.size());
|
||||
nutMap.setv("successCount", resultList.size());
|
||||
nutMap.setv("errorCount", errorInfos.size());
|
||||
if (Lang.isNotEmpty(errorInfos)) {
|
||||
nutMap.setv("errorList", errorInfos.stream().map(v -> {
|
||||
return NutMap.NEW().addv("工号", v.getLoginName()).addv("姓名", v.getUserName()).addv("错误原因", v.getRemark());
|
||||
}).collect(Collectors.toList()));
|
||||
} else {
|
||||
nutMap.setv("errorList", new ArrayList<>());
|
||||
}
|
||||
return Result.success().addData(nutMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@SLog(tag = "疗休养基础配置", msg = "清空省外名额人员")
|
||||
@RequiresPermissions("theRapyRecuperation.TheRapyConfig")
|
||||
public Object clearUser(){
|
||||
dao.clear(TheRapyRecuperationCanApplyOutUser.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("theRapyRecuperation.TheRapyConfig")
|
||||
public Object getCanApplyOutUserPageData(PageForm pageForm,
|
||||
@Param(value = "unionId", required = false) String unionId,
|
||||
@Param(value = "unitId", required = false) String unitId,
|
||||
@Param(value = "sex", required = false) String sex,
|
||||
@Param(value = "userState", required = false) String userState,
|
||||
@Param(value = "personType", required = false) String personType,
|
||||
@Param(value = "preparedBy", required = false) String preparedBy){
|
||||
Sql sql = Sqls.create("SELECT * FROM the_rapy_recuperation_can_apply_out_user $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("unionId", "=", unionId);
|
||||
cnd.andEX("unitId", "=", unitId);
|
||||
cnd.andEX("sex", "=", sex);
|
||||
cnd.andEX("userState", "=", userState);
|
||||
cnd.andEX("personType", "=", personType);
|
||||
cnd.andEX("preparedBy", "=", preparedBy);
|
||||
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("loginName", "%" + pageForm.getSearchKeyword() + "%");
|
||||
seg.orLike("userName", "%" + pageForm.getSearchKeyword() + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("theRapyRecuperation.TheRapyConfig")
|
||||
public Object deleteCanApplyOutUser(String id) {
|
||||
return dao.delete(TheRapyRecuperationCanApplyOutUser.class, id);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("theRapyRecuperation.TheRapyConfig")
|
||||
public Object queryNotListUsers(@Param("query") String query){
|
||||
if (StrUtil.isBlank(query)) {
|
||||
return null;
|
||||
}
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname,
|
||||
username,
|
||||
unitid,
|
||||
unitname
|
||||
FROM
|
||||
`user`
|
||||
$condition
|
||||
AND id not in (select userId from the_rapy_recuperation_can_apply_out_user)
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("loginname", query);
|
||||
seg.orLike("username", query);
|
||||
cnd.and(seg);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(1, 10, sql);
|
||||
return pagination;
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@RequiresPermissions("theRapyRecuperation.TheRapyConfig")
|
||||
public Object addList(@Param("userIds") String[] userIds){
|
||||
List<String> userIdList = Arrays.stream(userIds).toList();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
loginname AS loginName,
|
||||
username AS userName,
|
||||
sex,
|
||||
mobile,
|
||||
userState,
|
||||
personType,
|
||||
preparedBy,
|
||||
unitid AS unitId,
|
||||
unitname AS unitName,
|
||||
unionid AS unionId,
|
||||
unionname AS unionName
|
||||
FROM
|
||||
`user`
|
||||
WHERE id in (@userIdList)
|
||||
""").setParam("userIdList", userIdList);
|
||||
sql.setCallback(Sqls.callback.maps());
|
||||
dao.execute(sql);
|
||||
List<NutMap> userInfoList = (List<NutMap>) sql.getResult();
|
||||
|
||||
List<TheRapyRecuperationCanApplyOutUser> list = userInfoList.stream().map(map -> {
|
||||
TheRapyRecuperationCanApplyOutUser apply = new TheRapyRecuperationCanApplyOutUser();
|
||||
apply.setId(R.UU32());
|
||||
apply.setUserId(map.getString("id"));
|
||||
apply.setLoginName(map.getString("loginName"));
|
||||
apply.setUserName(map.getString("userName"));
|
||||
apply.setSex(map.getString("sex"));
|
||||
apply.setMobile(map.getString("mobile"));
|
||||
apply.setUserState(map.getString("userState"));
|
||||
apply.setPersonType(map.getString("personType"));
|
||||
apply.setPreparedBy(map.getString("preparedBy"));
|
||||
apply.setUnitId(map.getString("unitId"));
|
||||
apply.setUnitName(map.getString("unitName"));
|
||||
apply.setUnionId(map.getString("unionId"));
|
||||
apply.setUnionName(map.getString("unionName"));
|
||||
return apply;
|
||||
}).toList();
|
||||
|
||||
dao.fastInsert(list);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package io.v.nutz.zhgh.therapyRecuperation.mode;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:TheRapyRecuperationCanApplyOutUserMode
|
||||
* @Date 2025/6/13 10:26
|
||||
* @注释 省外名额参加人员导入模板
|
||||
*/
|
||||
@Data
|
||||
public class TheRapyRecuperationCanApplyOutUserMode {
|
||||
|
||||
@Excel(name = "工号", width = 20)
|
||||
private String loginName;
|
||||
|
||||
@Excel(name = "姓名", width = 20)
|
||||
private String userName;
|
||||
|
||||
// 错误记录
|
||||
private String remark;
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package io.v.nutz.zhgh.therapyRecuperation.model;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:TheRapyRecuperationCanApplyOutUser
|
||||
* @Date 2025/6/13 9:54
|
||||
* @注释 省外的可报名人员
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TheRapyRecuperationCanApplyOutUser extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("用户Id")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("工号")
|
||||
private String loginName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("姓名")
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@Comment("性别")
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("联系方式")
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("在职状态")
|
||||
private String userState;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("人员类型")
|
||||
private String personType;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("人员性质")
|
||||
private String preparedBy;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("单位Id")
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("单位名称")
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("工会Id")
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("工会名称")
|
||||
private String unionName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
<template>
|
||||
<div style="padding: 20px 50px">
|
||||
<el-timeline>
|
||||
<el-timeline-item timestamp="下载模板" placement="top">
|
||||
<el-card>
|
||||
<el-button size="medium" style="width: 200px" @click="location.href = temp_url" icon="el-icon-download">下载模板</el-button>
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
<el-timeline-item timestamp="上传文件" placement="top">
|
||||
<el-card>
|
||||
<el-form>
|
||||
<el-form-item label="请选择更新模式" v-if="is_show_radio">
|
||||
<el-radio-group v-model="importData.isFlag">
|
||||
<el-radio-button label="true">清空更新</el-radio-button>
|
||||
<el-radio-button label="false">追加</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-upload
|
||||
name="file"
|
||||
ref="upload"
|
||||
:on-remove="
|
||||
(file, fileList) => {
|
||||
importData.fileList = fileHandleRemove(file, fileList)
|
||||
importResult = {
|
||||
errorCount: 0,
|
||||
successCount: 0,
|
||||
totalCount: 0,
|
||||
errorList: []
|
||||
}
|
||||
}
|
||||
"
|
||||
:on-change="
|
||||
(file, fileList) => {
|
||||
importData.fileList = fileHandleChange(file, fileList, { type: ['xls', 'xlsx'] })
|
||||
}
|
||||
"
|
||||
:auto-upload="false"
|
||||
:limit="1"
|
||||
:file-list="importData.fileList"
|
||||
>
|
||||
<el-button size="medium" type="" icon="el-icon-upload" style="width: 200px">选择文件</el-button>
|
||||
<div class="el-upload__tip" slot="tip" style="color: #f56c6c">只能上传 xls/xlsx 文件{{ "," + text }}</div>
|
||||
</el-upload>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
<el-timeline-item placement="top" timestamp="导入结果">
|
||||
<el-card shadow="never">
|
||||
<p>总记录数:{{ errorInfoData.totalCount }}</p>
|
||||
<p>
|
||||
成功数:
|
||||
<span class="text-success">{{ errorInfoData.successCount }}</span>
|
||||
</p>
|
||||
<p>
|
||||
错误数:
|
||||
<span class="text-danger">{{ errorInfoData.errorCount }}</span>
|
||||
</p>
|
||||
<el-link @click="exportErrors" type="primary" v-if="errorInfoData.errorCount > 0">下载错误记录</el-link>
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
<div style="text-align: right">
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="$emit('flush')">关 闭</el-button>
|
||||
<el-button type="primary" @click="doImport">导 入</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
props: {
|
||||
temp_url: { type: String },
|
||||
post_url: { type: String },
|
||||
project_id: { type: String, default: "" },
|
||||
text: { type: String, default: "" },
|
||||
is_show_radio: { type: Boolean, default: false }
|
||||
},
|
||||
mounted() {
|
||||
const s = document.createElement("script")
|
||||
s.type = "text/javascript"
|
||||
s.src = "/assets/platform/plugins/xlsx/xlsx.full.min.js"
|
||||
document.body.appendChild(s)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// importVisible: false,
|
||||
importLoading: false,
|
||||
importData: {
|
||||
fileList: [],
|
||||
isFlag: false
|
||||
},
|
||||
errorInfoData: {
|
||||
totalCount: 0,
|
||||
successCount: 0,
|
||||
errorCount: 0,
|
||||
errorList: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
resetImportData() {
|
||||
this.importData = {
|
||||
fileList: [],
|
||||
isFlag: false
|
||||
}
|
||||
this.errorInfoData = {
|
||||
totalCount: 0,
|
||||
successCount: 0,
|
||||
errorCount: 0,
|
||||
errorList: 0
|
||||
}
|
||||
this.importLoading = false
|
||||
},
|
||||
doImport() {
|
||||
if (!this.importData.fileList || this.importData.fileList.length === 0) {
|
||||
this.$message.warning("请选择文件")
|
||||
return
|
||||
}
|
||||
const data = new FormData()
|
||||
data.append("isFlag", this.importData.isFlag)
|
||||
data.append("projectId", this.project_id)
|
||||
this.importData.fileList.forEach((val) => {
|
||||
data.append("file", val.raw, val.raw.name)
|
||||
})
|
||||
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: "导入中,请稍后...",
|
||||
spinner: "el-icon-loading",
|
||||
background: "rgba(0, 0, 0, 0.7)"
|
||||
})
|
||||
|
||||
$.ajax({
|
||||
url: this.post_url,
|
||||
type: "post",
|
||||
data: data,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: (data) => {
|
||||
loading.close()
|
||||
if (data.code === 0) {
|
||||
if (data.data) {
|
||||
this.errorInfoData = data.data
|
||||
this.$message.success("导入成功条数:" + data.data.successCount + ",错误条数:" + data.data.errorCount)
|
||||
if (this.errorInfoData.errorCount <= 0) {
|
||||
this.$emit("flush")
|
||||
}
|
||||
} else {
|
||||
this.importVisible = false
|
||||
this.$emit("flush")
|
||||
this.$message.success("导入成功")
|
||||
}
|
||||
} else {
|
||||
loading.close()
|
||||
this.$message.warning(data.msg)
|
||||
}
|
||||
},
|
||||
error: (data) => {
|
||||
loading.close()
|
||||
this.$message.warning(data.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
exportErrors() {
|
||||
const data = this.errorInfoData.errorList
|
||||
|
||||
// 创建工作簿
|
||||
const workbook = XLSX.utils.book_new()
|
||||
|
||||
// 创建工作表
|
||||
const worksheet = XLSX.utils.json_to_sheet(data)
|
||||
|
||||
// 将工作表添加到工作簿
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1")
|
||||
|
||||
// 将工作簿转换为二进制对象
|
||||
const excelBuffer = XLSX.write(workbook, { bookType: "xlsx", type: "array" })
|
||||
|
||||
// 将二进制对象转换为Blob对象
|
||||
const blob = new Blob([excelBuffer], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" })
|
||||
|
||||
// 创建下载链接并设置相关属性
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement("a")
|
||||
link.href = url
|
||||
link.download = "错误记录.xlsx"
|
||||
|
||||
// 模拟点击下载链接
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
// 清理下载链接
|
||||
document.body.removeChild(link)
|
||||
window.URL.revokeObjectURL(url)
|
||||
},
|
||||
fileHandleRemove(file, fileList) {
|
||||
return fileList
|
||||
},
|
||||
fileHandleChange(file, fileList, { type, size }) {
|
||||
const removeFile = () => {
|
||||
fileList.splice(fileList.findIndex((v) => v === file))
|
||||
}
|
||||
|
||||
if (!file.size) {
|
||||
this.$notify.warning("您选择的是空文件!")
|
||||
removeFile()
|
||||
}
|
||||
|
||||
if (type && type.length && !type.includes(file.name.split(".").pop().toLowerCase())) {
|
||||
this.$notify.warning(`文件只能是 ${type.map((v) => v.toUpperCase()).join("/")} 格式!`)
|
||||
removeFile()
|
||||
}
|
||||
|
||||
if (size && !file.size < size) {
|
||||
this.$notify.warning(`文件大小不能超过 ${size / 1024 / 1024}MB!`)
|
||||
removeFile()
|
||||
}
|
||||
|
||||
return fileList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-card__body {
|
||||
padding: 25px;
|
||||
}
|
||||
</style>
|
||||
+69
-1
@@ -21,7 +21,7 @@ layout("/layouts/platform.html"){
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<guava ref="guava">
|
||||
<el-card shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<h3 style="color: rgb(24, 103, 176);font-family: Microsoft YaHei;">疗休养配置</h3>
|
||||
@@ -61,6 +61,7 @@ layout("/layouts/platform.html"){
|
||||
<el-form-item label="省外名额分配模式" prop="outsideQuotaMode">
|
||||
<el-radio-group v-model="formData.outsideQuotaMode" size="small">
|
||||
<el-radio label="fixedRatio" border>固定比例</el-radio>
|
||||
<el-radio label="fixedUser" border>固定人员</el-radio>
|
||||
<el-radio label="unionRatio" border>分工会名额</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
@@ -76,6 +77,16 @@ layout("/layouts/platform.html"){
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<template v-else-if="formData.outsideQuotaMode == 'fixedUser'">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="导入人员" prop="outsideQuotaUser">
|
||||
<el-button @click="openImport" type="primary" size="small">导入人员</el-button>
|
||||
<el-button @click="showUser" type="primary" size="small">查看人员</el-button>
|
||||
<el-button @click="clearUser" type="danger" size="small">清空人员</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<template v-else-if="formData.outsideQuotaMode == 'unionRatio'">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="分工会名额分配" prop="unionLimit">
|
||||
@@ -250,6 +261,11 @@ layout("/layouts/platform.html"){
|
||||
<el-button type="primary" @click="deleteLotById">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<template #view>
|
||||
<show-user ref="showUserRef"></show-user>
|
||||
</template>
|
||||
|
||||
</guava>
|
||||
|
||||
<drawer-user-scope
|
||||
@@ -324,9 +340,23 @@ layout("/layouts/platform.html"){
|
||||
<el-button @click="doConfirmSetUpUnionLimit" type="primary">确定</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="importDialog" title="导入省外名额人员" top="50px">
|
||||
<file-import
|
||||
ref="viewImport"
|
||||
temp_url="/platform/theRapyRecuperation/TheRapyConfig/downloadImportTemp"
|
||||
post_url="/platform/theRapyRecuperation/TheRapyConfig/doImport"
|
||||
is_show_radio
|
||||
@flush="successImport"
|
||||
></file-import>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--#include("showCanApplyOutUser.js"){}#-->
|
||||
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
@@ -415,12 +445,50 @@ layout("/layouts/platform.html"){
|
||||
unionUserNumCalc: [{}],
|
||||
unionUserNumOneKeyRatio: null,
|
||||
summaryCount: 0,
|
||||
|
||||
// 导入相关
|
||||
importDialog: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'drawer-user-scope': httpVueLoader('/components/plugins/DrawerUserScope.vue?v=1.0.1'),
|
||||
'file-import': httpVueLoader('/components/plugins/FileImport.vue'),
|
||||
'show-user': SHOW_CAN_APPLY_OUT_USER
|
||||
},
|
||||
methods: {
|
||||
// 省外名额,固定人员分配相关
|
||||
openImport() {
|
||||
this.importDialog = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.viewImport.resetImportData()
|
||||
})
|
||||
},
|
||||
successImport() {
|
||||
this.importDialog = false
|
||||
this.$nextTick(() => {
|
||||
this.$refs.viewImport.resetImportData()
|
||||
})
|
||||
},
|
||||
showUser(){
|
||||
this.$refs.guava.view()
|
||||
this.$nextTick(() => {
|
||||
this.$refs.showUserRef.pageData()
|
||||
})
|
||||
},
|
||||
clearUser(){
|
||||
this.$confirm('您确定要清空省外名额人员吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const resp = await this.$axios.post('/platform/theRapyRecuperation/TheRapyConfig/clearUser')
|
||||
if (resp.code === 0) {
|
||||
this.$message.success('操作成功')
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 设置分工会比例相关==============================================start
|
||||
async doAllocationUnionRatio(){
|
||||
this.setUpUnionLimitDialog = true
|
||||
|
||||
+246
@@ -0,0 +1,246 @@
|
||||
const SHOW_CAN_APPLY_OUT_USER = {
|
||||
template: /* language=HTML */ `
|
||||
<div>
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">姓名工号</div>
|
||||
<div class="search-item-option">
|
||||
<el-input clearable placeholder="请输入姓名或工号查询" @key.enter="doSearch"
|
||||
v-model="pageForm.searchKeyword"></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">所属工会:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select placeholder="所属工会" v-model="pageForm.unionId"
|
||||
style="width: 100%;"
|
||||
clearable="true"
|
||||
@change="flushUnits" @clear="flushUnits"
|
||||
filterable="true">
|
||||
<el-option v-for="item in unions" :label="item.unionname"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">组成单位:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.unitId" style="width: 100%" filterable
|
||||
clearable @change="doSearch"
|
||||
placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in units"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">性别:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.sex" style="width: 100%" clearable
|
||||
placeholder="请选择">
|
||||
<el-option v-for="sex in sexOptions" :label="sex"
|
||||
:value="sex"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">在职状态:</div>
|
||||
<div class="search-item-option">
|
||||
<dict-select v-model="pageForm.userState"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
placeholder="在职状态"
|
||||
code="USER_STATE"></dict-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">人员类型:</div>
|
||||
<div class="search-item-option">
|
||||
<dict-select v-model="pageForm.personType"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
placeholder="人员类型"
|
||||
code="PERSON_TYPE"></dict-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">人员性质:</div>
|
||||
<div class="search-item-option">
|
||||
<dict-select v-model="pageForm.preparedBy"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
placeholder="人员性质"
|
||||
code="PREPARED_BY"></dict-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-query">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt10">
|
||||
<table-tool label="数据列表" :app="this">
|
||||
<template #func>
|
||||
<el-button @click="openAddList" size="small" type="primary">添加人员</el-button>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table ref="table" :data="tableData" style="width: 100%" row-key="id"
|
||||
@sort-change="pageOrder" :size="tableSize" class="vi-table">
|
||||
<el-table-column align="center" header-align="center" type="index"
|
||||
:index="indexMethod" label="序号"
|
||||
width="80px"></el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
header-align="center"
|
||||
v-for="column in tableColumns"
|
||||
show-overflow-tooltip
|
||||
:sortable="column.sortable"
|
||||
:label="column.label"
|
||||
:prop="column.prop" :width="column.width" min-width="100px">
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="250px">
|
||||
<template scope="{row}">
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
|
||||
<el-dialog :visible.sync="addListDialog" title="添加省外名额人员" width="50%" append-to-body>
|
||||
<el-form label-width="120px" ref="addForm">
|
||||
<el-form-item label="添加人员">
|
||||
<el-select
|
||||
v-model="userIds"
|
||||
value-key="id"
|
||||
filterable
|
||||
remote
|
||||
style="width: 100%"
|
||||
multiple
|
||||
reserve-keyword
|
||||
@change="$refs.userSelect.$children[1].clear()"
|
||||
ref="userSelect"
|
||||
placeholder="请输入工号或者姓名查询"
|
||||
:remote-method="queryNotListUsers">
|
||||
<el-option
|
||||
v-for="item in notListUsers"
|
||||
:key="item.id"
|
||||
:label="item.username+'-'+item.loginname+'-'+item.unitname"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row justify="end" type="flex">
|
||||
<el-button @click="addListDialog=false">取消</el-button>
|
||||
<el-button @click="doAddList" type="primary">确定</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</div>
|
||||
`,
|
||||
mixins: [initTableMixins],
|
||||
data(){
|
||||
return {
|
||||
unions: [],
|
||||
units: [],
|
||||
sexOptions: ['男', '女'],
|
||||
tableColumns: [
|
||||
{prop: 'loginName', label: '工号', sortable: true},
|
||||
{prop: 'userName', label: '姓名', sortable: true},
|
||||
{prop: 'sex', label: '性别', sortable: true, width: '100px'},
|
||||
{prop: 'mobile', label: '联系方式', sortable: true},
|
||||
{prop: 'userState', label: '在职状态', sortable: true},
|
||||
{prop: 'personType', label: '人员类型', sortable: true},
|
||||
{prop: 'preparedBy', label: '人员性质', sortable: true},
|
||||
{prop: 'unionName', label: '所属工会', sortable: true},
|
||||
{prop: 'unitName', label: '所属单位', sortable: true},
|
||||
],
|
||||
|
||||
// 添加人员相关
|
||||
userIds: [],
|
||||
addListDialog: false,
|
||||
notListUsers: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async queryNotListUsers(key){
|
||||
const resp = await $.post('/platform/theRapyRecuperation/TheRapyConfig/queryNotListUsers', {
|
||||
query: key
|
||||
})
|
||||
|
||||
if (resp.code === 0) {
|
||||
this.notListUsers = resp.data.list
|
||||
}
|
||||
},
|
||||
openAddList(){
|
||||
this.userIds = []
|
||||
this.addListDialog = true
|
||||
},
|
||||
doAddList(){
|
||||
this.$confirm('确定要添加吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const resp = await $.post('/platform/theRapyRecuperation/TheRapyConfig/addList', {
|
||||
userIds: JSON.stringify(this.userIds)
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.$message.success('添加成功')
|
||||
this.addListDialog = false
|
||||
this.notListUsers = []
|
||||
this.doSearch()
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
doDelete(id){
|
||||
this.$confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$axios.post('/platform/theRapyRecuperation/TheRapyConfig/deleteCanApplyOutUser', {id: id}).then(async resp => {
|
||||
if (resp.code === 0) {
|
||||
await this.pageData()
|
||||
this.$message.success('删除成功')
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", null)
|
||||
this.units = []
|
||||
if (this.pageForm.unionId) {
|
||||
this.units = await getUnits(this.pageForm.unionId)
|
||||
}
|
||||
},
|
||||
async pageData() {
|
||||
const resp = await this.$axios.post('/platform/theRapyRecuperation/TheRapyConfig/getCanApplyOutUserPageData', this.pageForm)
|
||||
if (resp.code === 0) {
|
||||
this.tableData = resp.data.list
|
||||
this.pageForm.totalCount = resp.data.totalCount
|
||||
}
|
||||
},
|
||||
},
|
||||
async created(){
|
||||
this.unions = await getUnionList(null)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user