This commit is contained in:
=
2026-06-03 11:07:12 +08:00
parent 6e4771282d
commit c305bc5dfe
9 changed files with 229 additions and 71 deletions
@@ -76,6 +76,7 @@ public class CondolenceApplyController {
@SaCheckPermission(value = {"condolence.apply", "h5.condolence.apply"}, mode = SaMode.OR) @SaCheckPermission(value = {"condolence.apply", "h5.condolence.apply"}, mode = SaMode.OR)
@SLog(tag = "职工慰问系统-慰问申请", msg = "保存申请") @SLog(tag = "职工慰问系统-慰问申请", msg = "保存申请")
public Result save(@Param("data") Condolence condolence) { public Result save(@Param("data") Condolence condolence) {
validateHelpUserScope(condolence);
if(StrUtil.isBlank(condolence.getId())) condolence.setCreateTime(DateUtil.now()); if(StrUtil.isBlank(condolence.getId())) condolence.setCreateTime(DateUtil.now());
dao.insertOrUpdate(condolence); dao.insertOrUpdate(condolence);
return Result.success(); return Result.success();
@@ -87,6 +88,7 @@ public class CondolenceApplyController {
@SLog(tag = "职工慰问系统-慰问申请", msg = "提交申请") @SLog(tag = "职工慰问系统-慰问申请", msg = "提交申请")
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
public Result submit(@Param("data") Condolence condolence) { public Result submit(@Param("data") Condolence condolence) {
validateHelpUserScope(condolence);
if(StrUtil.isBlank(condolence.getId())) condolence.setCreateTime(DateUtil.now()); if(StrUtil.isBlank(condolence.getId())) condolence.setCreateTime(DateUtil.now());
dao.insertOrUpdate(condolence); dao.insertOrUpdate(condolence);
// 开启流程实例 // 开启流程实例
@@ -108,6 +110,7 @@ public class CondolenceApplyController {
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
@SaCheckPermission(value = {"condolence.apply", "h5.condolence.apply"}, mode = SaMode.OR) @SaCheckPermission(value = {"condolence.apply", "h5.condolence.apply"}, mode = SaMode.OR)
public Result submitAgain(@Param("data") Condolence condolence, @Param("taskId") Long taskId) { public Result submitAgain(@Param("data") Condolence condolence, @Param("taskId") Long taskId) {
validateHelpUserScope(condolence);
dao.insertOrUpdate(condolence); dao.insertOrUpdate(condolence);
Dict dict = Dict.create(); Dict dict = Dict.create();
@@ -144,16 +147,37 @@ public class CondolenceApplyController {
seg.or(View_user::getUsername, "like", "%" + keyword + "%"); seg.or(View_user::getUsername, "like", "%" + keyword + "%");
cnd.and(seg); cnd.and(seg);
} }
cnd.and(View_user::getMember, "=", 1);
if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) { if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
if(AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_CHAIRMAN.name())) { if (StrUtil.isNotBlank(SecurityUtil.getUnionId())) {
cnd.and(View_user::getUnionId, "=", SecurityUtil.getUnionId()); cnd.and(View_user::getUnionId, "=", SecurityUtil.getUnionId());
} else { } else {
cnd.and(View_user::getId, "=", SecurityUtil.getUserId()); cnd.and(View_user::getId, "=", SecurityUtil.getUserId());
} }
} }
sql.setCondition(cnd); sql.setCondition(cnd);
Pagination pagination = condolenceService.listPageMap(1, 50, sql); Pagination pagination = condolenceService.listPageMap(1, 50, sql);
return Result.success(pagination.getList()); return Result.success(pagination.getList());
} }
/**
* 校验慰问对象范围:只能选择会员,非校级角色只能选择本工会会员。
*/
private void validateHelpUserScope(Condolence condolence) {
if (condolence == null || StrUtil.isBlank(condolence.getHelpUserId())) {
return;
}
View_user helpUser = dao.fetch(View_user.class, Cnd.where(View_user::getId, "=", condolence.getHelpUserId()));
if (helpUser == null) {
throw new RuntimeException("慰问对象不存在");
}
if (!Integer.valueOf(1).equals(helpUser.getMember())) {
throw new RuntimeException("慰问对象必须是会员");
}
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
if (StrUtil.isBlank(SecurityUtil.getUnionId()) || !SecurityUtil.getUnionId().equals(helpUser.getUnionId())) {
throw new RuntimeException("只能为本工会会员填写慰问申请");
}
}
}
} }
@@ -53,14 +53,12 @@ public class MemberInfoBoardController {
} }
/** /**
* @return 今年和去年的会员数 * @return 今年会员数、未缴费会员数和去年的会员数
*/ */
@At @At
@SaCheckPermission(value = {"member.info.board", "h5.member.info.board"}, mode = SaMode.OR) @SaCheckPermission(value = {"member.info.board", "h5.member.info.board"}, mode = SaMode.OR)
public Result memberNumber() { public Result memberNumber() {
int memberNum = memberInfoService.count(Sqls.create("select count(1) from sys_user where member = 1")); return Result.success(memberInfoService.getBoardMemberNumber());
int lastYearMemberNum = memberInfoService.count(Sqls.create("select count(1) from member_history where year = year(now()) -1 "));
return Result.success(Map.of("memberNum", memberNum, "lastYearMemberNum", lastYearMemberNum));
} }
/** /**
@@ -124,7 +122,8 @@ public class MemberInfoBoardController {
SELECT SELECT
un.name as unionname, un.name as unionname,
un.unionCode, un.unionCode,
( SELECT count( 1 ) FROM vw_user WHERE member = 1 and unionId = un.id ) `value` ( SELECT count( 1 ) FROM vw_user WHERE member = 1 and unionId = un.id ) `value`,
( SELECT count( 1 ) FROM vw_user u LEFT JOIN sys_user su ON su.id = u.id WHERE u.member = 1 and u.unionId = un.id and (su.memberFeePaid = 0 or su.memberFeePaid is null) ) unpaidValue
FROM FROM
sys_union un sys_union un
ORDER BY ORDER BY
@@ -61,6 +61,13 @@ public interface MemberInfoService extends BaseService<Sys_user> {
*/ */
void exportMember(MemberInfoPageForm pageForm, HttpServletResponse response); void exportMember(MemberInfoPageForm pageForm, HttpServletResponse response);
/**
* 获取会员看板会员数统计数据
*
* @return memberNum 会员总数、unpaidMemberNum 未缴费会员数、lastYearMemberNum 去年会员数
*/
NutMap getBoardMemberNumber();
/** /**
* 切换指定会员的缴费状态 * 切换指定会员的缴费状态
* *
@@ -270,6 +270,18 @@ public class MemberInfoServiceImpl extends BaseServiceImpl<Sys_user> implements
CommonDownloadUtil.download("会员档案表.xlsx", workbook, response); CommonDownloadUtil.download("会员档案表.xlsx", workbook, response);
} }
@Override
public NutMap getBoardMemberNumber() {
int memberNum = count(Sqls.create("select count(1) from sys_user where member = 1"));
// 空值按未缴费处理,保持会员列表中“是否缴费”的展示口径一致。
int unpaidMemberNum = count(Sqls.create("select count(1) from sys_user where member = 1 and (memberFeePaid = 0 or memberFeePaid is null)"));
int lastYearMemberNum = count(Sqls.create("select count(1) from member_history where year = year(now()) -1 "));
return NutMap.NEW()
.addv("memberNum", memberNum)
.addv("unpaidMemberNum", unpaidMemberNum)
.addv("lastYearMemberNum", lastYearMemberNum);
}
@Override @Override
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
public Boolean toggleMemberFeePaid(String userId) { public Boolean toggleMemberFeePaid(String userId) {
@@ -55,4 +55,7 @@ public class WelfareFilterUserPageForm extends PageForm {
@ApiModelProperty("是否会员") @ApiModelProperty("是否会员")
private Boolean isMember; private Boolean isMember;
@ApiModelProperty("是否缴费会员")
private Boolean memberFeePaid;
} }
@@ -33,6 +33,7 @@ import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json; import org.nutz.json.Json;
import org.nutz.lang.Lang; import org.nutz.lang.Lang;
@@ -444,10 +445,12 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
u.unitName, u.unitName,
u.unionId, u.unionId,
u.unionName, u.unionName,
u.member u.member,
IFNULL(su.memberFeePaid, 0) AS memberFeePaid
FROM FROM
vw_user u vw_user u
LEFT JOIN welfare_list w ON u.id = w.userId AND w.projectId = @projectId LEFT JOIN welfare_list w ON u.id = w.userId AND w.projectId = @projectId
LEFT JOIN sys_user su ON su.id = u.id
$condition $condition
"""); """);
sql.setParam("projectId", pageForm.getProjectId()); sql.setParam("projectId", pageForm.getProjectId());
@@ -455,6 +458,13 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.and("w.userId", "is", null); cnd.and("w.userId", "is", null);
// 姓名/工号合并为一个输入框,输入值同时匹配姓名和工号。
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup userSearchGroup = new SqlExpressionGroup();
userSearchGroup.or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%");
userSearchGroup.or("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%");
cnd.and(userSearchGroup);
}
if (StrUtil.isNotBlank(pageForm.getUserName())) { if (StrUtil.isNotBlank(pageForm.getUserName())) {
cnd.where().andLike("u.username", pageForm.getUserName()); cnd.where().andLike("u.username", pageForm.getUserName());
} }
@@ -466,19 +476,21 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) { if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) {
cnd.andEX("MONTH(u.birthday)", "in", pageForm.getBirthMonths()); cnd.andEX("MONTH(u.birthday)", "in", pageForm.getBirthMonths());
} }
cnd.andEX("u.unionId", "=", pageForm.getUnionId()); applyWelfareUserUnionScope(cnd, "u.unionId", pageForm.getUnionId());
cnd.andEX("u.unitId", "in", pageForm.getUnitIds()); cnd.andEX("u.unitId", "in", pageForm.getUnitIds());
cnd.andEX("u.personType", "in", pageForm.getPersonTypes()); cnd.andEX("u.personType", "in", pageForm.getPersonTypes());
cnd.andEX("u.preparedBy", "in", pageForm.getPreparedBys()); cnd.andEX("u.preparedBy", "in", pageForm.getPreparedBys());
cnd.andEX("u.userState", "in", pageForm.getUserStates()); cnd.andEX("u.userState", "in", pageForm.getUserStates());
cnd.andEX("u.member","=",pageForm.getIsMember()); cnd.andEX("u.member","=",pageForm.getIsMember());
// 是否缴费会员来源于会员分组管理设置,空值按未缴费处理。
cnd.andEX("IFNULL(su.memberFeePaid, 0)", "=", pageForm.getMemberFeePaid());
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.asc("u.unionCode"); cnd.asc("u.unionCode");
cnd.asc("u.unitCode"); cnd.asc("u.unitCode");
cnd.asc("u.sex"); cnd.asc("u.sex");
} else { } else {
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); cnd.orderBy(getWelfareUserOrderName(pageForm.getPageOrderName()), PageUtil.getOrder(pageForm.getPageOrderBy()));
} }
sql.setCondition(cnd); sql.setCondition(cnd);
@@ -489,51 +501,62 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
public void addWelfareUser(WelfareFilterUserPageForm pageForm) { public void addWelfareUser(WelfareFilterUserPageForm pageForm) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
id, u.id,
loginname, u.loginname,
username, u.username,
sex, u.sex,
birthday, u.birthday,
personType, u.personType,
preparedBy, u.preparedBy,
userState, u.userState,
unitId, u.unitId,
unitName, u.unitName,
unionId, u.unionId,
unionName, u.unionName,
member u.member,
IFNULL(su.memberFeePaid, 0) AS memberFeePaid
FROM FROM
vw_user vw_user u
LEFT JOIN sys_user su ON su.id = u.id
$condition $condition
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
// 添加福利名单时复用弹窗的姓名/工号合并搜索条件,避免展示数量和实际添加数量不一致。
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup userSearchGroup = new SqlExpressionGroup();
userSearchGroup.or("u.username", "like", "%" + pageForm.getSearchKeyword() + "%");
userSearchGroup.or("u.loginname", "like", "%" + pageForm.getSearchKeyword() + "%");
cnd.and(userSearchGroup);
}
if (StrUtil.isNotBlank(pageForm.getUserName())) { if (StrUtil.isNotBlank(pageForm.getUserName())) {
cnd.where().andLike("username", pageForm.getUserName()); cnd.where().andLike("u.username", pageForm.getUserName());
} }
if (StrUtil.isNotBlank(pageForm.getLoginName())) { if (StrUtil.isNotBlank(pageForm.getLoginName())) {
cnd.where().andLike("loginname", pageForm.getLoginName()); cnd.where().andLike("u.loginname", pageForm.getLoginName());
} }
cnd.andEX("sex", "=", pageForm.getSex()); cnd.andEX("u.sex", "=", pageForm.getSex());
cnd.andEX("birthday", "=", pageForm.getBirthday()); cnd.andEX("u.birthday", "=", pageForm.getBirthday());
if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) { if (pageForm.getBirthMonths() != null && pageForm.getBirthMonths().length > 0) {
cnd.andEX("MONTH(birthday)", "in", pageForm.getBirthMonths()); cnd.andEX("MONTH(u.birthday)", "in", pageForm.getBirthMonths());
} }
cnd.andEX("unionId", "=", pageForm.getUnionId()); applyWelfareUserUnionScope(cnd, "u.unionId", pageForm.getUnionId());
cnd.andEX("unitId", "in", pageForm.getUnitIds()); cnd.andEX("u.unitId", "in", pageForm.getUnitIds());
cnd.andEX("personType", "in", pageForm.getPersonTypes()); cnd.andEX("u.personType", "in", pageForm.getPersonTypes());
cnd.andEX("preparedBy", "in", pageForm.getPreparedBys()); cnd.andEX("u.preparedBy", "in", pageForm.getPreparedBys());
cnd.andEX("userState", "in", pageForm.getUserStates()); cnd.andEX("u.userState", "in", pageForm.getUserStates());
cnd.andEX("member","=",pageForm.getIsMember()); cnd.andEX("u.member","=",pageForm.getIsMember());
// 是否缴费会员来源于会员分组管理设置,空值按未缴费处理。
cnd.andEX("IFNULL(su.memberFeePaid, 0)", "=", pageForm.getMemberFeePaid());
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) { if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.asc("unionCode"); cnd.asc("u.unionCode");
cnd.asc("unitCode"); cnd.asc("u.unitCode");
cnd.asc("sex"); cnd.asc("u.sex");
} else { } else {
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); cnd.orderBy(getWelfareUserOrderName(pageForm.getPageOrderName()), PageUtil.getOrder(pageForm.getPageOrderBy()));
} }
cnd.and("id", "not in", Sqls.create("select userId from `welfare_list` where projectId = @projectId").setParam("projectId", pageForm.getProjectId())); cnd.and("u.id", "not in", Sqls.create("select userId from `welfare_list` where projectId = @projectId").setParam("projectId", pageForm.getProjectId()));
sql.setCondition(cnd); sql.setCondition(cnd);
List<NutMap> list = listMap(sql); List<NutMap> list = listMap(sql);
@@ -556,6 +579,32 @@ public class WelfareListServiceImpl extends BaseServiceImpl<WelfareList> impleme
dao().insert(welfareList); dao().insert(welfareList);
} }
/**
* 福利添加人员查询已关联 sys_user,排序字段统一加 vw_user 别名,避免同名字段歧义。
*/
private String getWelfareUserOrderName(String pageOrderName) {
if (StrUtil.isBlank(pageOrderName) || pageOrderName.contains(".")) {
return pageOrderName;
}
if ("memberFeePaid".equals(pageOrderName)) {
return "IFNULL(su.memberFeePaid, 0)";
}
return "u." + pageOrderName;
}
/**
* 分工会角色只能查询和添加本工会人员,其他角色按页面选择的工会筛选。
*/
private void applyWelfareUserUnionScope(Cnd cnd, String unionColumn, String unionId) {
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())
|| AuthUtil.hasRole(RoleConstant.BRANCH_UNION_ADMIN.name())
|| AuthUtil.hasRole(RoleConstant.BRANCH_UNION_WENTI_SPORTS.name())) {
cnd.and(unionColumn, "=", SecurityUtil.getUnionId());
} else {
cnd.andEX(unionColumn, "=", unionId);
}
}
@Override @Override
public void exportXlsx(WelfareListPageForm pageForm, HttpServletResponse response) { public void exportXlsx(WelfareListPageForm pageForm, HttpServletResponse response) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
@@ -292,9 +292,9 @@ layout("/layouts/platform.html"){
<div class="dashboard"> <div class="dashboard">
<!-- 顶部四个统计卡片 - 高度固定200px --> <!-- 顶部四个统计卡片 - 高度固定200px -->
<div class="card stats-card"> <div class="card stats-card">
<div class="card-title">会员数</div> <div class="card-title">会员数/未缴费人数</div>
<div class="stat-value" v-loading="loading.memberNumber"> <div class="stat-value" v-loading="loading.memberNumber">
{{memberNumberData.memberNum}} {{memberNumberData.memberNum}} / {{memberNumberData.unpaidMemberNum}}
<span style="font-size: 14px">&ensp;人</span> <span style="font-size: 14px">&ensp;人</span>
</div> </div>
<!-- <div class="stat-meta" v-loading="loading.memberNumber">--> <!-- <div class="stat-meta" v-loading="loading.memberNumber">-->
@@ -322,7 +322,7 @@ layout("/layouts/platform.html"){
<div class="content-left"> <div class="content-left">
<!-- 工会会员数图表 --> <!-- 工会会员数图表 -->
<div class="card"> <div class="card">
<div class="card-title">工会会员数</div> <div class="card-title">工会会员数/未缴费数</div>
<div class="chart-container" id="unionMemberChart" v-loading="loading.unionMember"></div> <div class="chart-container" id="unionMemberChart" v-loading="loading.unionMember"></div>
</div> </div>
@@ -392,6 +392,7 @@ layout("/layouts/platform.html"){
}, },
memberNumberData: { memberNumberData: {
memberNum: "--", memberNum: "--",
unpaidMemberNum: "--",
lastYearMemberNum: "--", lastYearMemberNum: "--",
ratio: "0.0%", ratio: "0.0%",
diff: 0 diff: 0
@@ -411,11 +412,11 @@ layout("/layouts/platform.html"){
this.$axios.post("/platform/member/info/board/memberNumber").then((resp) => { this.$axios.post("/platform/member/info/board/memberNumber").then((resp) => {
if (resp.code === 0) { if (resp.code === 0) {
const { const {
data: { memberNum, lastYearMemberNum } data: { memberNum, unpaidMemberNum, lastYearMemberNum }
} = resp } = resp
const diff = memberNum - lastYearMemberNum const diff = memberNum - lastYearMemberNum
const ratio = (lastYearMemberNum ? (Math.abs(diff) / lastYearMemberNum) * 100 : (diff / 1) * 10).toFixed(2) + " %" const ratio = (lastYearMemberNum ? (Math.abs(diff) / lastYearMemberNum) * 100 : (diff / 1) * 10).toFixed(2) + " %"
this.memberNumberData = { memberNum, lastYearMemberNum, diff, ratio } this.$set(this, "memberNumberData", { memberNum, unpaidMemberNum, lastYearMemberNum, diff, ratio })
this.loading.memberNumber = false this.loading.memberNumber = false
} else { } else {
this.$message.warning(resp.msg) this.$message.warning(resp.msg)
@@ -571,6 +572,30 @@ layout("/layouts/platform.html"){
* 各工会会员数 * 各工会会员数
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
getUnionUnpaidValue(item) {
// 兼容后端 Record 字段大小写,空值统一按 0 处理。
const unpaidValue = item.unpaidValue || item.unpaidvalue || 0
return Number(unpaidValue) || 0
},
formatUnionMemberValue(item) {
const unpaidValue = this.getUnionUnpaidValue(item)
if (unpaidValue > 0) {
return item.value + "/" + unpaidValue
}
return item.value
},
buildUnionMemberTooltip(title, items) {
if (!items || !items.length) {
return ""
}
const data = items[0].data || {}
const unpaidValue = this.getUnionUnpaidValue(data)
return '<div style="padding:8px 4px">' +
'<div style="font-weight:600;margin-bottom:4px">' + title + '</div>' +
'<div><span style="display:inline-block;width:8px;height:8px;border-radius:50%;background:#217050;margin-right:6px"></span>会员数:' + data.value + '</div>' +
'<div><span style="display:inline-block;width:8px;height:8px;border-radius:50%;background:#217050;margin-right:6px"></span>未缴费数:' + unpaidValue + '</div>' +
'</div>'
},
async getUnionMember() { async getUnionMember() {
this.loading.unionMember = true this.loading.unionMember = true
this.$axios.post("/platform/member/info/board/unionMember").then((resp) => { this.$axios.post("/platform/member/info/board/unionMember").then((resp) => {
@@ -580,11 +605,8 @@ layout("/layouts/platform.html"){
this.unionMember = tableData this.unionMember = tableData
const labels = chartData.map((v) => v.unionname)
const values = chartData.map((v) => v.value)
if (chart.unionMemberChart) { if (chart.unionMemberChart) {
chart.unionMemberChart.changeData(values) chart.unionMemberChart.changeData(chartData)
return return
} }
@@ -612,7 +634,10 @@ layout("/layouts/platform.html"){
textShadow: '0 1px 2px rgba(0,0,0,0.5)', textShadow: '0 1px 2px rgba(0,0,0,0.5)',
opacity: 0.9 opacity: 0.9
}, },
formatter: (datum) => datum.value // 显示原始值 formatter: (datum) => this.formatUnionMemberValue(datum)
},
tooltip: {
customContent: (title, items) => this.buildUnionMemberTooltip(title, items)
}, },
// X轴配置 // X轴配置
xAxis: { xAxis: {
@@ -3,15 +3,9 @@ const addUser = {
<el-dialog title="添加用户" :visible.sync="visible" width="80%"> <el-dialog title="添加用户" :visible.sync="visible" width="80%">
<el-card shadow="never"> <el-card shadow="never">
<search @search="doSearch"> <search @search="doSearch">
<search-item label="姓名"> <search-item label="姓名/工号">
<el-input @keyup.enter.native="doSearch" clearable placeholder="请输入姓名" <el-input @keyup.enter.native="doSearch" clearable placeholder="请输入姓名/工号"
style="width: 100%" v-model="pageForm.userName"> style="width: 100%" v-model="pageForm.searchKeyword">
</el-input>
</search-item>
<search-item label="工号">
<el-input @keyup.enter.native="doSearch" clearable placeholder="请输入工号"
style="width: 100%" v-model="pageForm.loginName">
</el-input> </el-input>
</search-item> </search-item>
@@ -109,6 +103,13 @@ const addUser = {
<el-option label="否" :value="false"></el-option> <el-option label="否" :value="false"></el-option>
</el-select> </el-select>
</search-item> </search-item>
<search-item label="是否缴费会员">
<el-select clearable placeholder="请选择是否缴费会员" style="width: 100%"
v-model="pageForm.memberFeePaid">
<el-option label="是" :value="true"></el-option>
<el-option label="否" :value="false"></el-option>
</el-select>
</search-item>
</search> </search>
</el-card> </el-card>
@@ -154,8 +155,7 @@ const addUser = {
visible: false, visible: false,
projectId: null, projectId: null,
pageForm: { pageForm: {
userName: null, searchKeyword: null,
loginName: null,
sex: null, sex: null,
birthday: null, birthday: null,
birthMonths: [], birthMonths: [],
@@ -164,7 +164,8 @@ const addUser = {
personTypes: [], personTypes: [],
preparedBys: [], preparedBys: [],
userStates: [], userStates: [],
isMember: null isMember: null,
memberFeePaid: null
}, },
sexOptions: ["男", "女"], sexOptions: ["男", "女"],
unionOptions: [], unionOptions: [],
@@ -187,30 +188,47 @@ const addUser = {
this.visible = true this.visible = true
this.resetPageForm() this.resetPageForm()
this.pageForm.projectId = id this.pageForm.projectId = id
this.unionOptions = await this.$businessTool.listUnion() await this.initUnionAndUnitOptions()
this.unitOptions = await this.$businessTool.listUnit()
this.pageData() this.pageData()
}, },
resetPageForm() { resetPageForm() {
this.$set(this.pageForm, "userName", null) this.$set(this.pageForm, "searchKeyword", null)
this.$set(this.pageForm, "loginName", null)
this.$set(this.pageForm, "sex", null) this.$set(this.pageForm, "sex", null)
this.$set(this.pageForm, "birthday", null) this.$set(this.pageForm, "birthday", null)
this.$set(this.pageForm, "birthMonths", []) this.$set(this.pageForm, "birthMonths", [])
this.$set(this.pageForm, "unionId", null) this.$set(this.pageForm, "unionId", null)
this.$set(this.pageForm, "unitId", null) this.$set(this.pageForm, "unitIds", [])
this.$set(this.pageForm, "personTypes", []) this.$set(this.pageForm, "personTypes", [])
this.$set(this.pageForm, "preparedBys", []) this.$set(this.pageForm, "preparedBys", [])
this.$set(this.pageForm, "userStates", []) this.$set(this.pageForm, "userStates", [])
this.$set(this.pageForm, "isMember", null) this.$set(this.pageForm, "isMember", null)
this.$set(this.pageForm, "memberFeePaid", null)
},
async initUnionAndUnitOptions() {
const hasSchoolUnionRole = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN", "SCHOOL_UNION_WELFARE_ADMIN"])
if (hasSchoolUnionRole) {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
} else {
this.$set(this.pageForm, "unionId", this.$store.state.user.union.id)
this.unionOptions = await this.$businessTool.listUnion(this.$store.state.user.union.id)
this.unitOptions = await this.$businessTool.listUnit(this.$store.state.user.union.id)
}
}, },
async unionIdChange(val) { async unionIdChange(val) {
if (val) { if (val) {
this.unitOptions = await this.$businessTool.listUnit(val) this.unitOptions = await this.$businessTool.listUnit(val)
} else { } else {
this.pageForm.unitIds = [] this.$set(this.pageForm, "unitIds", [])
if (!this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN", "SCHOOL_UNION_WELFARE_ADMIN"])) {
this.$set(this.pageForm, "unionId", this.$store.state.user.union.id)
this.unitOptions = await this.$businessTool.listUnit(this.$store.state.user.union.id)
} else {
this.unitOptions = await this.$businessTool.listUnit()
}
} }
}, },
@@ -68,7 +68,7 @@ layout("/layouts/platform.html"){
</search-item> </search-item>
<search-item label="所属工会"> <search-item label="所属工会">
<el-select clearable filterable placeholder="请选择所属工会" style="width: 100%" v-model="pageForm.unionId"> <el-select clearable filterable placeholder="请选择所属工会" style="width: 100%" v-model="pageForm.unionId" @change="unionIdChange">
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in unionOptions"></el-option> <el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in unionOptions"></el-option>
</el-select> </el-select>
</search-item> </search-item>
@@ -341,12 +341,33 @@ layout("/layouts/platform.html"){
.finally(() => { .finally(() => {
this.tableLoading = false this.tableLoading = false
}) })
},
async initUnionAndUnitOptions() {
const hasSchoolUnionRole = this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN", "SCHOOL_UNION_WELFARE_ADMIN"])
if (hasSchoolUnionRole) {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
} else {
this.$set(this.pageForm, "unionId", this.$store.state.user.union.id)
this.unionOptions = await this.$businessTool.listUnion(this.$store.state.user.union.id)
this.unitOptions = await this.$businessTool.listUnit(this.$store.state.user.union.id)
}
},
async unionIdChange(val) {
this.$set(this.pageForm, "unitIds", [])
if (val) {
this.unitOptions = await this.$businessTool.listUnit(val)
} else if (!this.$auth.hasRoleOr(["SYSADMIN", "SCHOOL_UNION_ADMIN", "SCHOOL_UNION_WELFARE_ADMIN"])) {
this.$set(this.pageForm, "unionId", this.$store.state.user.union.id)
this.unitOptions = await this.$businessTool.listUnit(this.$store.state.user.union.id)
} else {
this.unitOptions = await this.$businessTool.listUnit()
}
} }
}, },
async created() { async created() {
this.getWelfareList() this.getWelfareList()
this.unionOptions = await this.$businessTool.listUnion() await this.initUnionAndUnitOptions()
this.unitOptions = await this.$businessTool.listUnit()
this.pageData() this.pageData()
} }
}) })