新增-妇代会

This commit is contained in:
=
2026-02-26 09:37:51 +08:00
parent 3d07a36d6d
commit 4408f423df
23 changed files with 3480 additions and 4 deletions
@@ -211,6 +211,18 @@ public interface Roles {
* 工代会特邀
*/
String GDHTY = "15b2c2beb9e34c96bd30730ad383cde3";
/**
* 妇代会代表
*/
String FDHDB = "997cd4107448415aba51f5f8fecaa46e";
/**
* 妇代会列席
*/
String FDHLX = "1440f73be5ab4373b5fa06e1f6407cab";
/**
* 妇代会特邀
*/
String FDHTY = "7d11fab8f1c04a069ba5358076eba39c";
/**
* 校活动管理员
*/
@@ -35,6 +35,11 @@ public class Sys_user_role implements Serializable {
@Comment("工代会id")
private String gdhid;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("妇代会id")
private String fdhid;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("单位id")
@@ -17,6 +17,7 @@ import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.activity.models.ActivityBasicUnit;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt;
import io.v.nutz.zhgh.jdh.model.zzjg.Jdh_dbt_zcdw;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressSession;
import io.v.nutz.zhgh.workersCongress.model.workersCongressSession;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
@@ -747,6 +748,22 @@ public class ViCommonCon {
return Result.success(query);
}
/*
* 获取妇代会
*
* @param open
* @return
*/
@At
@ViReturn
@RequiresAuthentication
public Object getFdh(Boolean open) {
Cnd cnd = Cnd.NEW();
cnd.and("startState", "=", open).desc("year");
List<WomanCongressSession> query = dao.query(WomanCongressSession.class, cnd);
return Result.success(query);
}
/**
* 根据code查看字典选项信息
*
@@ -1,12 +1,14 @@
package io.v.nutz.zhgh.qsv.controller;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.page.Pagination;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.qsv.models.QsvActivity;
import io.v.nutz.zhgh.qsv.models.QsvOption;
import io.v.nutz.zhgh.qsv.models.QsvSubject;
import io.v.nutz.zhgh.qsv.service.QsvActivityService;
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
@@ -14,6 +16,7 @@ import org.nutz.dao.Dao;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@@ -56,14 +59,51 @@ public class QsvActivityController {
@At
@RequiresPermissions("qsv.activity")
public Result save(QsvActivity qsvActivity) {
if (qsvActivity.getCategory().equals("QUIZ")) {
if (qsvActivity.getMode().equals("SCHEDULED")) {
// 保存问卷基础信息
if ("QUIZ".equals(qsvActivity.getCategory())) {
if ("SCHEDULED".equals(qsvActivity.getMode())) {
qsvActivity.setRepeatMode("DAILY");
} else if (qsvActivity.getMode().equals("REGULAR")) {
} else if ("REGULAR".equals(qsvActivity.getMode())) {
qsvActivity.setRepeatMode("TOTAL");
}
}
dao.insertOrUpdate(qsvActivity);
if (Strings.isNotBlank(qsvActivity.getActivityId())) {
List<QsvSubject> oldSubjects = dao.query(QsvSubject.class, Cnd.where("activityId", "=", qsvActivity.getActivityId()));
// 遍历旧题目,复制并关联到新活动
for (QsvSubject oldSubject : oldSubjects) {
QsvSubject newSubject = new QsvSubject();
newSubject.setTitle(oldSubject.getTitle());
newSubject.setType(oldSubject.getType());
newSubject.setSortNum(oldSubject.getSortNum());
newSubject.setScore(oldSubject.getScore());
newSubject.setMaxMulti(oldSubject.getMaxMulti());
newSubject.setDisplayDate(oldSubject.getDisplayDate());
newSubject.setActivityId(qsvActivity.getId());
dao.insertOrUpdate(newSubject);
List<QsvOption> oldOptions = dao.query(QsvOption.class, Cnd.where("subjectId", "=", oldSubject.getId()));
// 复制选项并关联到新题目
for (QsvOption oldOption : oldOptions) {
QsvOption newOption = new QsvOption();
newOption.setText(oldOption.getText());
newOption.setIsCorrect(oldOption.getIsCorrect());
newOption.setImgUrl(oldOption.getImgUrl());
newOption.setLink(oldOption.getLink());
newOption.setDescription(oldOption.getDescription());
newOption.setSortNum(oldOption.getSortNum());
newOption.setSubjectId(newSubject.getId());
dao.insertOrUpdate(newOption);
}
}
}
return Result.success();
}
@@ -143,4 +183,13 @@ public class QsvActivityController {
return Result.success(subjects);
}
@At
@ViReturn
@Ok("json:full")
@RequiresPermissions("qsv.activity")
public Result getHistoricalQsvList() {
List<QsvActivity> query = dao.query(QsvActivity.class, Cnd.NEW().desc("startTime"));
return Result.success(query);
}
}
@@ -25,6 +25,11 @@ public class QsvActivity extends BaseModel {
@ColDefine(type = ColType.VARCHAR, width = 50)
private String title;
@Column
@Comment("往期活动id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String activityId;
@Column
@Comment("活动描述")
@ColDefine(type = ColType.TEXT)
@@ -0,0 +1,249 @@
package io.v.nutz.zhgh.womanCongress.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.ViService;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.services.SysUserRoleService;
import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.zhgh.jdh.model.db.Jdh_db;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressDelegation;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressRepresentative;
import io.v.nutz.zhgh.womanCongress.services.WomanCongressRepresentativeService;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @author zhf
* @date 2021/7/30 11:20
* @description 妇代会代表
*/
@IocBean
@Ok("json:full")
@At("/platform/womanCongress/delegate")
public class WomanCongressDelegateController {
@At("")
@Ok("beetl:platform/womanCongress/Delegate.html")
@RequiresPermissions("sys.womanCongress.delegate")
public void index() {
}
@Inject
private WomanCongressRepresentativeService womanCongressRepresentativeService;
@Inject("WomanCongressDelegation")
private ViService<WomanCongressDelegation> delegationViService;
@Inject("Jdh_db")
private ViService<Jdh_db> jdhDbViService;
@Inject
private SysUserService sysUserService;
@Inject
private SysUserRoleService sysUserRoleService;
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegate")
public Object pageData(PageForm page,@Param(value = "fdh_id",required = false) String fdh_id,
@Param(value = "dbt_id",required = false) String dbt_id,
@Param(value = "unionId",required = false) String unionId,
@Param(value = "unitId",required = false) String unitId) {
CndPlus cnd = CndPlus.create();
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
cnd.and(page.getSearchName(), "like", "%" + page.getSearchKeyword() + "%");
}
cnd.andEx("wo.fdh_id", "=", fdh_id);
cnd.andEx("wo.dbt_id", "=", dbt_id);
cnd.andEx("u.unionid", "=", unionId);
cnd.andEx("u.unitId", "=", unitId);
cnd.asc("u.unionid");
return womanCongressRepresentativeService.queryData(cnd, page, true);
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegate")
public Object doAdd(@Param("userData") String[] userData, String fdh_id, String dbt_id, int identity) {
for (String userId : userData) {
WomanCongressRepresentative woman = new WomanCongressRepresentative();
woman.setUserId(userId);
woman.setDbt_id(dbt_id);
woman.setFdh_id(fdh_id);
woman.setRoleId(identity == 1 ? Roles.FDHDB : identity == 2 ? Roles.FDHLX : Roles.FDHTY);
womanCongressRepresentativeService.insert(woman);
Sys_user_role sys_user_role = new Sys_user_role();
sys_user_role.setUserId(userId);
sys_user_role.setRoleId(identity == 1 ? Roles.FDHDB : identity == 2 ? Roles.FDHLX : Roles.FDHTY);
sys_user_role.setDbtid(dbt_id);
sys_user_role.setJdhid(fdh_id);
sysUserRoleService.insert(sys_user_role);
sysUserService.clearCache();
}
return null;
}
@At
@RequiresPermissions("sys.womanCongress.delegate")
public void doExcel(String fdhId, String fdhAllName, String dbtId, HttpServletResponse response) throws IOException {
CndPlus cnd = CndPlus.create();
cnd.andEx("wo.fdh_id", "=", fdhId);
cnd.andEx("wo.dbt_id", "=", dbtId);
cnd.asc("u.unionid");
List<WomanCongressRepresentativeService.db_excel_data> dbList = (List<WomanCongressRepresentativeService.db_excel_data>) womanCongressRepresentativeService.queryData(cnd, null, true);
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((fdhAllName + "代表名单.xls").getBytes("utf-8"), "ISO8859-1"));
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), WomanCongressRepresentativeService.db_excel_data.class, dbList);
workbook.write(response.getOutputStream());
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegate")
public Object userDoDelete(String userId, String dbt_id, String fdh_id) {
sysUserRoleService.clear(Cnd.where("userid", "=", userId)
.and("dbtid", "=", dbt_id)
.and("jdhid", "=", fdh_id)
.and("roleid", "=", Roles.FDHDB));
womanCongressRepresentativeService.clear(Cnd.where("userId", "=", userId).and("dbt_id", "=", dbt_id).and("fdh_id", "=", fdh_id));
sysUserService.clearCache();
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegate")
public Object doDeleteUserList(String[] userData, String dbt_id, String fdh_id) {
for (String userId : userData) {
CndPlus cnd = CndPlus.create();
CndPlus cnd2 = CndPlus.create();
cnd.andEx("dbt_id", "=", dbt_id);
cnd.andEx("userid", "=", userId);
cnd.andEx("fdh_id", "=", fdh_id);
cnd.andEx("roleid", "=", Roles.FDHDB);
cnd2.andEx("dbtid", "=", dbt_id);
cnd2.andEx("userid", "=", userId);
cnd2.andEx("jdhid", "=", fdh_id);
cnd2.andEx("roleid", "=", Roles.FDHDB);
sysUserRoleService.clear(cnd2);
womanCongressRepresentativeService.clear(cnd);
sysUserService.clearCache();
}
return null;
}
/**
* 可选代表
*
* @param dbt_id
* @param fdh_id
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegate")
public Object getUserDbChange(String dbt_id, String fdh_id) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.unionname,
u.unitname
FROM
`user` u
WHERE
u.unionid IN ( SELECT union_id FROM woman_congress_delegation_make_up_union upunion WHERE fdh_id = @fdh_id AND dbt_id = @dbt_id )
AND u.id NOT IN ( SELECT userId FROM woman_congress_representative )
""").setParam("dbt_id", dbt_id).setParam("fdh_id", fdh_id);
return delegationViService.list(sql);
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegate")
public Object queryXldUser(String query, String fdhid) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.unionname,
u.unitname,
u.sex
FROM
`user` u
WHERE
id NOT IN
(
SELECT
wcr.userId
FROM
`woman_congress_representative` wcr
LEFT JOIN `user` u ON u.id = wcr.userId WHERE wcr.fdh_id=@fdhid AND (u.username LIKE @query OR u.loginname LIKE @query
))
AND (u.username LIKE @query OR u.loginname LIKE @query)
""").setParam("fdhid", fdhid).setParam("query", "%" + query + "%");
return sysUserService.listMap(sql);
}
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("sys.womanCongress.delegate")
public Object fpXldToDbt(@Param("::user") List<NutMap> userMapList, String fdhid) {
userMapList.forEach(v -> {
WomanCongressRepresentative woman = new WomanCongressRepresentative();
woman.setUserId(v.getString("id"));
woman.setDbt_id(v.getString("dbtid"));
woman.setFdh_id(fdhid);
woman.setRoleId(Roles.FDHDB);
womanCongressRepresentativeService.insert(woman);
Sys_user_role sys_user_role = new Sys_user_role();
sys_user_role.setUserId(v.getString("id"));
sys_user_role.setRoleId(Roles.FDHDB);
sys_user_role.setDbtid(v.getString("dbtid"));
sys_user_role.setJdhid(fdhid);
sysUserRoleService.insert(sys_user_role);
sysUserService.clearCache();
});
return null;
}
}
@@ -0,0 +1,66 @@
package io.v.nutz.zhgh.womanCongress.controller;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.ViService;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressDelegation;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressSession;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import java.util.List;
/**
* @author zhf
* @date 2021/8/2 11:47
* @description
*/
@IocBean
@At("/platform/fdh/Common")
@Ok("json:full")
public class WomanCongressFdhCommonController {
@Inject("WomanCongressSession")
private ViService<WomanCongressSession> sessionViService;
@Inject("WomanCongressDelegation")
private ViService<WomanCongressDelegation> delegationViService;
@At
public Object getOpenFdh() {
Cnd cnd = Cnd.NEW();
cnd.and("startState", "=", true).desc("year");
List<WomanCongressSession> query = sessionViService.query(cnd);
return Result.success(query);
}
/**
* 获取妇代会代表团
*
* @param jdhId
* @return
*/
@At
@ViReturn
public Object getDbt(String jdhId) {
Sql sql = Sqls.create("""
SELECT
dbt.*
FROM
woman_congress_delegation dbt
LEFT JOIN sys_dict dict ON dict.`name` = dbt.dbt_name
WHERE
dbt.fdh_id = @fdh_id
ORDER BY
dict.`code`
""").setParam("fdh_id", jdhId);
return delegationViService.list(sql);
}
}
@@ -0,0 +1,358 @@
package io.v.nutz.zhgh.womanCongress.controller;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.ViService;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.sys.models.Sys_dict;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.sys.services.SysRoleService;
import io.v.nutz.sys.services.SysUserRoleService;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressDelegation;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressDelegationMakeUpUnion;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressRepresentative;
import io.v.nutz.zhgh.womanCongress.services.WomanCongressRepresentativeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @author zhf
* @date 2021/8/2 11:14
* @description 代表团管理
*/
@IocBean
@Ok("json:full")
@At("/platform/womanCongress/delegation")
public class WomanCongressFdhDelegationController {
private static final String SYS_DICT_DBT_ID = "9373a8db35ca428f9b24d7ceac96a550";
private static final String JDH_DBT_TZ_ROLE_ID = "c1765c03459840c2b621d140f575c869";
private static final String JDH_DBT_FTZ_ROLE_ID = "6445f21685c5489aa212a986cfbeecce";
@Inject("WomanCongressDelegation")
private ViService<WomanCongressDelegation> delegationViService;
@Inject("WomanCongressRepresentative")
private ViService<WomanCongressRepresentative> representativeViService;
@Inject("WomanCongressDelegationMakeUpUnion")
private ViService<WomanCongressDelegationMakeUpUnion> makeUpUnionViService;
@Inject
private WomanCongressRepresentativeService womanCongressRepresentativeService;
@Inject
private SysDictService sysDictService;
@Inject
private SysRoleService sysRoleService;
@Inject
private SysUserRoleService sysUserRoleService;
@At("")
@Ok("beetl:platform/womanCongress/Delegation.html")
@RequiresPermissions("sys.womanCongress.delegation")
public void index() {
}
@At
@RequiresPermissions("sys.womanCongress.delegation")
public Object getDbtFind(String fdh_id) {
Sql sql = Sqls.create("""
SELECT
dict.id,
dict.`name`,
dict.code
FROM
sys_dict dict
WHERE
dict.`parentId` = @dbt_id
AND dict.`name` NOT IN ( SELECT dbt.dbt_name FROM woman_congress_delegation dbt WHERE dbt.`fdh_id` = @fdh_id )
ORDER BY
`code`
""");
sql.setParam("dbt_id", SYS_DICT_DBT_ID);
sql.setParam("fdh_id", fdh_id);
return delegationViService.list(sql);
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegation")
public Object doAddDbt(String fdh_id, String[] dbtList) {
Cnd cnd = Cnd.NEW();
List<Sys_dict> dictList = sysDictService.query(cnd.and("id", "in", dbtList));
dictList.forEach(v -> {
WomanCongressDelegation dbt = new WomanCongressDelegation();
dbt.setFdh_id(fdh_id);
dbt.setDbt_name(v.getName());
dbt.setCode(v.getCode());
dbt.setFound_time(DateUtil.getDate());
delegationViService.insert(dbt);
});
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegation")
public Object pageData(PageForm page, @Param(value = "fdh_id",required = false) String fdh_id,
@Param(value = "dbt_id",required = false) String dbt_id) {
Sql sql = Sqls.create("""
SELECT
dbt.*,fdh.fdhAllName
FROM
`woman_congress_delegation` dbt
LEFT JOIN woman_congress_session fdh ON fdh.id = dbt.fdh_id $condition
""");
CndPlus cnd = CndPlus.create();
cnd.andEx("dbt.fdh_id", "=", fdh_id);
cnd.andEx("dbt.id", "=", dbt_id);
cnd.asc("dbt.code");
sql.setCondition(cnd);
Pagination pagination = delegationViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
return Result.success().addData(pagination);
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegation")
public Object undertakeUnionTree(String fdh_id) {
Record record = new Record();
record.set("dbt_name", "妇代会代表团");
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
dbt.*,fdh.fdhAllName
FROM
`woman_congress_delegation` dbt
LEFT JOIN woman_congress_session fdh ON fdh.id = dbt.fdh_id $condition
""");
cnd.and("dbt.fdh_id", "=", fdh_id);
cnd.asc("dbt.`code`");
sql.setCondition(cnd);
record.set("childrens", delegationViService.list(sql));
return record;
}
@At
@RequiresPermissions("sys.womanCongress.delegation")
public Object delDbt(String dbt_id, String fdh_id) {
try {
Cnd cnd = Cnd.NEW();
cnd.and("id", "=", dbt_id).and("fdh_id", "=", fdh_id);
delegationViService.clear(cnd);
//删除组成基层工会
makeUpUnionViService.clear(cnd);
//删除团长 副团长 操作员的权限
sysUserRoleService.clear(Cnd.where("dbtid", "=", dbt_id).and("jdhid", "=", fdh_id).and("roleid", "in", "'" + Roles.DBT_TZ + "','" + Roles.DBT_FTZ + "'"));
//删除正式代表权限
sysUserRoleService.clear(Cnd.where("dbtid", "=", dbt_id).and("jdhid", "=", fdh_id).and("roleid", "=", Roles.ZSDB));
//删除代表 表用户
representativeViService.clear(cnd);
return Result.success();
} catch (Exception e) {
e.printStackTrace();
return Result.error();
}
}
@At
@RequiresPermissions("sys.womanCongress.delegation")
public Object getDbTableData(String fdh_id, String dbt_id) {
CndPlus cnd = CndPlus.create();
cnd.andEx("wo.fdh_id", "=", fdh_id);
cnd.andEx("wo.dbt_id", "=", dbt_id);
return womanCongressRepresentativeService.queryData(cnd, null, false);
}
/**
* 查询未组成的分工会
*
* @param fdh_id
* @param dbt_id
* @return
*/
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegation")
public Object unionOpenAddList(String fdh_id, String dbt_id) {
Sql sql = Sqls.create("""
SELECT
un.id,
un.unionname
FROM
sys_union un
WHERE
un.id NOT IN (
SELECT
union_id
FROM
woman_congress_delegation_make_up_union upunion
WHERE
upunion.fdh_id = @fdh_id
AND upunion.dbt_id != @dbt_id)
""").setParam("fdh_id", fdh_id).setParam("dbt_id", dbt_id);
return Record.create().set("data", delegationViService.list(sql)).set("value", findUnionList(dbt_id, fdh_id));
}
private List<Record> findUnionList(String dbt_id, String fdh_id) {
Sql sql = Sqls.create("""
SELECT
upunion.*,
un.unionname
FROM
woman_congress_delegation_make_up_union upunion
LEFT JOIN sys_union un ON un.id = upunion.union_id
WHERE
upunion.dbt_id =@dbt_id and
upunion.fdh_id =@fdh_id
""").setParam("dbt_id", dbt_id).setParam("fdh_id", fdh_id);
return delegationViService.list(sql);
}
@At
public Object doUnion(String[] unionValue, String fdh_id, String dbt_id) {
makeUpUnionViService.clear(Cnd.where("fdh_id", "=", fdh_id).and("dbt_id", "=", dbt_id));
for (String unionId : unionValue) {
WomanCongressDelegationMakeUpUnion makeUpUnion = new WomanCongressDelegationMakeUpUnion();
makeUpUnion.setUnion_id(unionId);
makeUpUnion.setDbt_id(dbt_id);
makeUpUnion.setFdh_id(fdh_id);
makeUpUnionViService.insert(makeUpUnion);
}
return Result.success();
}
/**
* 查询代表团组成工会
*
* @param dbt_id
* @param fdh_id
* @return
*/
@At
@RequiresPermissions("sys.womanCongress.delegation")
public Object unionPageData(String dbt_id, String fdh_id) {
return findUnionList(dbt_id, fdh_id);
}
@At
@RequiresPermissions("sys.womanCongress.delegation")
public Object queryUser(String dbt_id, String fdh_id) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.mobile,
u.sex,
dw.NAME AS unitname
FROM
sys_user_role ur
LEFT JOIN sys_user u ON u.id = ur.userid
LEFT JOIN sys_unit dw ON dw.id = u.unitid
WHERE
ur.roleid = @roleid
AND ur.dbtid = @dbt_id
and jdhid=@fdh_id
AND ur.userid NOT IN
(SELECT
userid
FROM
sys_user_role
WHERE
roleid IN ( '6445f21685c5489aa212a986cfbeecce', 'c1765c03459840c2b621d140f575c869' )
AND jdhid=@fdh_id
)
""").setParam("roleid", Roles.FDHDB).setParam("dbt_id", dbt_id).setParam("fdh_id", fdh_id);
return sysUserRoleService.list(sql);
}
@At
@RequiresPermissions("sys.womanCongress.delegation")
public Object doAddTz(String dbt_id, String fdh_id, String userid, Integer sf) {
if (sf == 2) {
int count = sysUserRoleService.count(Cnd.where("jdhid", "=", fdh_id)
.and("dbtid", "=", dbt_id).and("roleid", "=", JDH_DBT_TZ_ROLE_ID));
if (count > 0) {
return Result.error().addMsg("团长只能设置一位!");
}
}
Sys_user_role userRole = new Sys_user_role();
userRole.setUserId(userid);
userRole.setJdhid(fdh_id);
userRole.setDbtid(dbt_id);
userRole.setRoleId(sf == 1 ? JDH_DBT_FTZ_ROLE_ID : JDH_DBT_TZ_ROLE_ID);
sysUserRoleService.insert(userRole);
sysRoleService.clearCache();
return Result.success();
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.delegation")
public Object getTzList(String dbt_id, String fdh_id) {
Sql sql = Sqls.create("""
SELECT
u.id,
u.username,
u.loginname,
u.mobile,
u.sex,
r.id AS roleid,
r.NAME AS rolename,
dw.NAME AS unitname
FROM
sys_user_role ur
LEFT JOIN sys_role r ON r.id = ur.roleid
LEFT JOIN sys_user u ON u.id = ur.userid
LEFT JOIN sys_unit dw ON dw.id = u.unitid
WHERE
ur.dbtid = @dbtid
and ur.jdhid = @fdh_id
AND ur.roleid IN (@TZROLEID, @FTZROLEID)
ORDER BY roleId DESC
""").setParam("dbtid", dbt_id).setParam("fdh_id", fdh_id).setParam("TZROLEID", JDH_DBT_TZ_ROLE_ID).setParam("FTZROLEID", JDH_DBT_FTZ_ROLE_ID);
return sysUserRoleService.list(sql);
}
@At
@RequiresPermissions("sys.womanCongress.delegation")
public Object delUser(String fdh_id, String userId, String roleId) {
sysUserRoleService.clear(Cnd.where("userid", "=", userId).and("roleid", "=", roleId).and("jdhid", "=", fdh_id));
return Result.success();
}
}
@@ -0,0 +1,190 @@
package io.v.nutz.zhgh.womanCongress.controller;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.ViService;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressOrganizationUser;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @author zhf
* @date 2021/7/31 14:30
* @description 妇代会组织机构
*/
@IocBean
@Ok("json:full")
@At("/platform/womanCongress/Organization")
public class WomanCongressOrganizationController {
private static String FDH_WYH_PARENT_ID = "d2f16a3cbb154866adaa99bfab8d79a1";
@At("")
@Ok("beetl:platform/womanCongress/Organization.html")
@RequiresPermissions("sys.womanCongress.organization")
public void index() {
}
@Inject("WomanCongressOrganizationUser")
private ViService<WomanCongressOrganizationUser> organizationViService;
@Inject
private SysDictService sysDictService;
@At
@RequiresPermissions("sys.womanCongress.organization")
public Object getTreeData() {
List<NutMap> dictList = sysDictService.listMap(Sqls.create("select * from sys_dict where parentid='%s'".formatted(FDH_WYH_PARENT_ID)));
Record record = new Record();
record.set("name", "妇代会机构设置");
dictList.forEach(v -> {
v.setv("childrens", child(v.getString("id")));
});
record.set("childrens", dictList);
return record;
}
private List<NutMap> child(String parentid) {
List<NutMap> dictList = sysDictService.listMap(Sqls.create("select * from sys_dict where parentid='%s'".formatted(parentid)));
dictList.forEach(v -> {
v.setv("childrens", child(v.getString("id")));
});
return dictList;
}
@At
@RequiresPermissions("sys.womanCongress.organization")
public Object getUserList(String fdh_id, String organization_id, String key) {
Sql sql = Sqls.create("""
SELECT
id,username,loginname,unionname,mobile,unitname
FROM
`user`
WHERE
member IS TRUE
AND (username like @key or loginname like @key)
AND id NOT IN (
SELECT
user_id
FROM
woman_congress_organization_user
WHERE
fdh_id= @fdh_id
AND organization_id= @organization_id)
""").setParam("organization_id", organization_id).setParam("fdh_id", fdh_id).setParam("key", "%" + key + "%");
return organizationViService.listPage(1, 20, sql);
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.organization")
public Object doAdd(WomanCongressOrganizationUser organizationUser) {
int count = organizationViService.count(Cnd.where("user_id", "=", organizationUser.getUser_id())
.and("organization_id", "=", organizationUser.getOrganization_id()).and("fdh_id", "=", organizationUser.getFdh_id()));
if (count > 0) {
return Result.error("人员已存在,请勿重复录入");
}
Sys_user_role sysRole = new Sys_user_role();
sysRole.setUserId(organizationUser.getUser_id());
sysRole.setFdhid(organizationUser.getFdh_id());
if (organizationUser.getOrganization_code().equals("fdhwyh1")) {
switch (organizationUser.getStatus()) {
case 1:
organizationUser.setRole_id(Roles.GH_WYH_CY);
sysRole.setRoleId(Roles.GH_WYH_CY);
break;
case 2:
organizationUser.setRole_id(Roles.GH_WYH_FZX);
sysRole.setRoleId(Roles.GH_WYH_FZX);
break;
case 3:
organizationUser.setRole_id(Roles.GH_WYH_CWFZX);
sysRole.setRoleId(Roles.GH_WYH_CWFZX);
break;
case 4:
organizationUser.setRole_id(Roles.GH_WYH_ZX);
sysRole.setRoleId(Roles.GH_WYH_ZX);
break;
default:
break;
}
}
organizationViService.insert(sysRole);
organizationViService.insert(organizationUser);
return null;
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.organization")
public Object pageData(PageForm page, @Param(value = "fdh_id",required = false) String fdh_id,
@Param(value = "organization_id",required = false) String organization_id) {
CndPlus cnd = CndPlus.create();
Sql sql = Sqls.create("""
SELECT
wo.*,
u.username,
u.loginname,
u.sex,
u.mobile,
u.unionname,
u.unitname,
se.fdhAllName fdh_name,
role.`name` role_name
FROM
woman_congress_organization_user wo
LEFT JOIN woman_congress_session se ON se.id = wo.fdh_id
LEFT JOIN `user` u ON u.id = wo.user_id
LEFT JOIN sys_role role ON wo.role_id = role.id
$condition
""");
if (Strings.isNotBlank(page.getSearchName()) && Strings.isNotBlank(page.getSearchKeyword())) {
cnd.and(page.getSearchName(), "like", "%" + page.getSearchKeyword() + "%");
}
cnd.andEx("wo.fdh_id", "=", fdh_id);
cnd.andEx("wo.organization_id", "=", organization_id);
cnd.desc("wo.status");
sql.setCondition(cnd);
return organizationViService.list(page, sql);
}
@At
@RequiresPermissions("sys.womanCongress.organization")
public Object delUser(String id) {
return organizationViService.clear(Cnd.where("id", "=", id));
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.organization")
public Object updateStatus(String fdh_id, String user_id, String status, String organization_id) {
organizationViService.update(Chain.make("status", status), Cnd.where("fdh_id", "=", fdh_id).and("organization_id", "=", organization_id).and("user_id", "=", user_id));
return null;
}
}
@@ -0,0 +1,238 @@
package io.v.nutz.zhgh.womanCongress.controller;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.service.ViService;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.base.utils.Roles;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.services.SysUserRoleService;
import io.v.nutz.zhgh.jdh.model.cb.Jdh_jdhxx;
import io.v.nutz.zhgh.womanCongress.model.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
import java.util.List;
/**
* @author zhf
* @date 2021/7/30 10:02
* @description 妇代会届次管理
*/
@IocBean
@Ok("json:full")
@At("/platform/womanCongress/Session")
public class WomanCongressSessionController {
@Inject("Jdh_jdhxx")
private ViService<Jdh_jdhxx> jdhJdhxxViService;
@Inject("WomanCongressSession")
private ViService<WomanCongressSession> fdhsessionViService;
@Inject("WomanCongressDelegation")
private ViService<WomanCongressDelegation> delegationViService;
@Inject("WomanCongressDelegationMakeUpUnion")
private ViService<WomanCongressDelegationMakeUpUnion> makeUpUnionViService;
@Inject("WomanCongressRepresentative")
private ViService<WomanCongressRepresentative> representativeViService;
@Inject("WomanCongressOrganizationUser")
private ViService<WomanCongressOrganizationUser> organizationUserViService;
@Inject
private SysUserRoleService sysUserRoleService;
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:platform/womanCongress/SessionCon.html")
@RequiresPermissions("sys.womanCongress.Session")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.Session")
public Object pageData(PageForm page, @Param(value = "year",required = false) Integer year,
@Param(value = "fdhJs",required = false) String fdhJs,
@Param(value = "fdhCs",required = false) String fdhCs) {
Cnd cnd = CndPlus.create();
Sql sql = Sqls.create("select * from woman_congress_session $condition");
Vi.cndPlus(cnd, "year", "=", year);
Vi.cndPlus(cnd, "fdhJs", "=", fdhJs);
Vi.cndPlus(cnd, "fdhCs", "=", fdhCs);
if (StrUtil.isAllNotBlank(page.getPageOrderName(), page.getPageOrderBy())) {
if ("fdhJs".equals(page.getPageOrderName())) {
page.setPageOrderName("year");
} else if ("fdhCs".equals(page.getPageOrderName())) {
page.setPageOrderName("startTime");
}
cnd.orderBy(page.getPageOrderName(), PageUtil.getOrder(page.getPageOrderBy()));
} else {
cnd.desc("startTime");
}
sql.setCondition(cnd);
return fdhsessionViService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.Session")
public Object doAdd(WomanCongressSession womanCongressSession, boolean isExtend) {
//判断新建的教代会届次是否存在
int count = fdhsessionViService.count(Cnd.where("fdhJs", "=", womanCongressSession.getFdhJs()).and("fdhCs", "=", womanCongressSession.getFdhCs()));
if (count > 0) {
return Result.error().addMsg("当前届次的妇代会已存在,无法重复创建!");
}
womanCongressSession.setStartState(true);
womanCongressSession.setStartTime(DateUtil.getDate());
WomanCongressSession insert = fdhsessionViService.insert(womanCongressSession);
if (isExtend) {
Cnd preJdh = Cnd.NEW();
preJdh.and("fdhJs", "=", womanCongressSession.getFdhJs()).and("fdhCs", "=", getCs(womanCongressSession.getFdhCs()));
List<Record> preFdhxxList = baseService.dao().query("woman_congress_session", preJdh);
//存在上一次教代会信息才能延用
Trans.exec(() -> {
if (preFdhxxList.size() > 0) {
String fdhId = preFdhxxList.get(0).getString("id");
//代表团
List<WomanCongressDelegation> dbtList = delegationViService.query(Cnd.where("fdh_id", "=", fdhId));
dbtList.forEach(z -> {
WomanCongressDelegation delegation = new WomanCongressDelegation();
delegation.setFdh_id(insert.getId());
delegation.setDbt_name(z.getDbt_name());
delegation.setCode(z.getCode());
delegation.setFound_time(DateUtil.getDate());
WomanCongressDelegation dbtListNew = delegationViService.insert(delegation);
//组成基层工会
List<WomanCongressDelegationMakeUpUnion> zcfghList = makeUpUnionViService.query(Cnd.where("dbt_id", "=", z.getId()));
zcfghList.forEach(zz -> {
WomanCongressDelegationMakeUpUnion upUnion = new WomanCongressDelegationMakeUpUnion();
upUnion.setDbt_id(dbtListNew.getId());
upUnion.setFdh_id(insert.getId());
upUnion.setUnion_id(zz.getUnion_id());
makeUpUnionViService.insert(upUnion);
});
//团长 副团长
List<Sys_user_role> ftzList = sysUserRoleService.query(Cnd.where("dbtid", "=", z.getId()).and("jdhid", "=", fdhId).and("roleid", "in", Lang.array(Roles.DBT_TZ, Roles.DBT_FTZ)));
ftzList.forEach(tzftz -> {
Sys_user_role user_role = new Sys_user_role();
user_role.setUserId(tzftz.getUserId());
user_role.setJdhid(insert.getId());
user_role.setDbtid(dbtListNew.getId());
user_role.setRoleId(tzftz.getRoleId());
sysUserRoleService.insert(user_role);
});
//正式代表
List<WomanCongressRepresentative> dbList = representativeViService.query(Cnd.where("fdh_id", "=", fdhId).and("dbt_id", "=", z.getId()));
dbList.forEach(zzz -> {
Sys_user_role userRole = new Sys_user_role();
userRole.setRoleId(Roles.FDHDB);
userRole.setJdhid(zzz.getFdh_id());
userRole.setUserId(zzz.getUserId());
userRole.setDbtid(dbtListNew.getId());
sysUserRoleService.insert(userRole);
WomanCongressRepresentative womanCongressRepresentative = new WomanCongressRepresentative();
womanCongressRepresentative.setFdh_id(insert.getId());
womanCongressRepresentative.setUserId(zzz.getUserId());
womanCongressRepresentative.setRoleId(Roles.FDHDB);
womanCongressRepresentative.setDbt_id(dbtListNew.getId());
representativeViService.insert(womanCongressRepresentative);
});
});
//组织机构
List<WomanCongressOrganizationUser> zzjgList = organizationUserViService.query(Cnd.where("fdh_id", "=", fdhId));
zzjgList.forEach(jg -> {
WomanCongressOrganizationUser organizationUser = new WomanCongressOrganizationUser();
organizationUser.setUser_id(jg.getUser_id());
organizationUser.setStatus(jg.getStatus());
organizationUser.setOrganization_id(jg.getOrganization_id());
organizationUser.setOrganization_name(jg.getOrganization_name());
organizationUser.setOrganization_code(jg.getOrganization_code());
organizationUser.setFdh_id(insert.getId());
organizationUserViService.insert(organizationUser);
});
}
});
}
return Result.success();
}
public static String getCs(String cs) {
if (cs.equals("六次")) {
return "五次";
} else if (cs.equals("五次")) {
return "四次";
} else if (cs.equals("四次")) {
return "三次";
} else if (cs.equals("三次")) {
return "二次";
} else if (cs.equals("二次")) {
return "一次";
}
return "";
}
@At
@ViReturn
@RequiresPermissions("sys.womanCongress.Session")
public Object startStateChange(boolean startState, String id) {
boolean aa = startState ? false : true;
return fdhsessionViService.update(Chain.make("startState", aa), CndPlus.where("id", "=", id));
}
@At
@RequiresPermissions("sys.womanCongress.Session")
public Object doDelete(String id) {
Trans.exec(() -> {
fdhsessionViService.clear(CndPlus.where("id", "=", id));
delegationViService.clear(CndPlus.where("fdh_id", "=", id));
organizationUserViService.clear(CndPlus.where("fdh_id", "=", id));
makeUpUnionViService.clear(CndPlus.where("fdh_id", "=", id));
representativeViService.clear(CndPlus.where("fdh_id", "=", id));
sysUserRoleService.clear(CndPlus.where("jdhid", "=", id));
});
return null;
}
@At
@RequiresPermissions("sys.womanCongress.Session")
public Object doEdit(WomanCongressSession womanCongressSession, boolean isExtend) {
if (!isExtend) {
womanCongressSession.setStartTime(DateUtil.getDate());
fdhsessionViService.updateIgnoreNull(womanCongressSession);
}
return null;
}
}
@@ -0,0 +1,47 @@
package io.v.nutz.zhgh.womanCongress.model;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* @author zhf
* @date 2021/8/2 11:38
* @description
*/
@Data
@Table("woman_congress_delegation")
public class WomanCongressDelegation implements Serializable {
@Column
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("代表团名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String dbt_name;
@Column
@Comment("所属妇代会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String fdh_id;
@Column
@Comment("创建时间")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String found_time;
@Column
@Comment("代表团编码")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String code;
}
@@ -0,0 +1,38 @@
package io.v.nutz.zhgh.womanCongress.model;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
/**
* @author zhf
* @date 2021/8/3 9:15
* @description 组成分工会
*/
@Data
@Table("woman_congress_delegation_make_up_union")
public class WomanCongressDelegationMakeUpUnion {
@Name
@Comment("id")
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("代表团id")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String dbt_id;
@Column
@Comment("基层工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String union_id;
@Column
@Comment("所属妇代会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String fdh_id;
}
@@ -0,0 +1,62 @@
package io.v.nutz.zhgh.womanCongress.model;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* @author zhf
* @date 2021/7/31 15:32
* @description
*/
@Data
@Table("woman_congress_organization_user")
public class WomanCongressOrganizationUser implements Serializable {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("用户id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String user_id;
@Column
@Comment("用户身份1。组员2.副主任3,主任")
@ColDefine(type = ColType.INT)
private Integer status;
@Column
@Comment("所属妇代会")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String fdh_id;
@Column
@Comment("角色id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String role_id;
@Column
@Comment("机构id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String organization_id;
@Column
@Comment("机构名称")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String organization_name;
@Column
@Comment("机构编码")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String organization_code;
}
@@ -0,0 +1,46 @@
package io.v.nutz.zhgh.womanCongress.model;
import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* @author zhf
* @date 2021/7/30 9:52
* @description 职工代表大会代表
*/
@Data
@Table("woman_congress_representative")
public class WomanCongressRepresentative extends BaseModel implements Serializable {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("代表用户ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userId;
@Column
@Comment("所属妇代会ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String fdh_id;
@Column
@Comment("所属角色ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String roleId;
@Column
@Comment("所属代表团")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String dbt_id;
}
@@ -0,0 +1,55 @@
package io.v.nutz.zhgh.womanCongress.model;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* @author zhf
* @date 2021/8/2 9:04
* @description 妇代会届次
*/
@Data
@Table("woman_congress_session")
public class WomanCongressSession implements Serializable {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("年度")
@ColDefine(type = ColType.INT)
private Integer year;
@Column
@Comment("")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String fdhJs;
@Column
@Comment("")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String fdhCs;
@Column
@Comment("全称")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String fdhAllName;
@Column
@Comment("开启时间")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String startTime;
@Column
@Comment("开启状态")
@ColDefine(type = ColType.BOOLEAN)
private boolean startState;
}
@@ -0,0 +1,50 @@
package io.v.nutz.zhgh.womanCongress.services;
import cn.afterturn.easypoi.excel.annotation.Excel;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.ViService;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressRepresentative;
import lombok.Data;
import org.nutz.dao.Cnd;
import java.io.Serializable;
/**
* @author zhf
* @date 2021/7/30 13:59
* @description
*/
public interface WomanCongressRepresentativeService extends ViService<WomanCongressRepresentative> {
/**
* 返回自定义sql
* @param cnd
* @return
*/
Object queryData(Cnd cnd, PageForm pageForm,boolean isPage);
/**
* 导出代表实体类
*/
@Data
public static class db_excel_data implements Serializable {
@Excel(name = "工号", width = 20)
private String loginname;
@Excel(name = "姓名", width = 20)
private String username;
@Excel(name = "性别", width = 10)
private String sex;
@Excel(name = "联系方式", width = 20)
private String mobile;
@Excel(name = "所属代表团", width = 30)
private String dbt_name;
@Excel(name = "所属工会", width = 30)
private String unionname;
@Excel(name = "所属单位", width = 30)
private String unitname;
}
}
@@ -0,0 +1,53 @@
package io.v.nutz.zhgh.womanCongress.services.impl;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.zhgh.womanCongress.model.WomanCongressRepresentative;
import io.v.nutz.zhgh.womanCongress.services.WomanCongressRepresentativeService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @author zhf
* @date 2021/7/30 14:00
* @description
*/
@IocBean(args = {"refer:dao"})
public class WomanCongressRepresentativeServiceImpl extends ViServiceImpl<WomanCongressRepresentative> implements WomanCongressRepresentativeService {
public WomanCongressRepresentativeServiceImpl(Dao dao) {
super(dao);
}
@Override
public Object queryData(Cnd cnd, PageForm pageForm, boolean isPage) {
Sql sql = Sqls.create("""
SELECT
wo.*,
u.username,
u.loginname,
u.sex,
u.mobile,
u.unionname,
u.unitname,
dbt.dbt_name,
role.`name` roleName
FROM
`woman_congress_representative` wo
LEFT JOIN `user` u ON wo.userId = u.id
LEFT JOIN woman_congress_delegation dbt ON dbt.id = wo.dbt_id
LEFT JOIN sys_role role ON role.id = wo.roleId
$condition
""");
sql.setCondition(cnd);
if (pageForm == null && isPage) {
return listEntity(sql, db_excel_data.class);
}
if (!isPage) {
return list(sql);
}
return list(pageForm, sql);
}
}
@@ -238,6 +238,24 @@ const getGdhDbt = async (jdhId) => {
return data
}
/**
* 获取妇代会
* @returns {Promise<*>}
*/
const getFdh = async (open = true) => {
const {data} = await $.get("/platform/vi/common/getFdh", {open})
return data
}
/**
* 获取妇代会代表团
* @returns {Promise<*>}
*/
const getFdhDbt = async (jdhId) => {
const {data} = await $.get("/platform/fdh/common/getDbt", {jdhId})
return data
}
/**
* 根据id查用户
* @returns {Promise<*>}
@@ -3,6 +3,30 @@ const basicForm = {
<el-dialog :visible.sync="dialogVisible" title="基础设置">
<div style="overflow-y: auto">
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="150px">
<el-row>
<el-col :span="12">
<el-form-item label="是否沿用之前活动" prop="use">
<el-radio-group v-model="use" size="medium">
<el-radio-button :label="true" border>沿用</el-radio-button>
<el-radio-button :label="false" border>不沿用</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="往期活动" prop="historicalQsv">
<el-select v-model="historicalQsv" placeholder="请选择往期活动"
:disabled="!use"
style="width: 100%" @change="historicalQsvChange">
<el-option
v-for="item in historicalQsvList"
:key="item.id"
:label="item.title"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="类型" prop="category">
<el-radio-group v-model="formData.category" size="small">
<el-radio v-for="item in dict.type.ACTIVITY_QSV_CATEGORY" :label="item.value"
@@ -201,6 +225,9 @@ const basicForm = {
},
data() {
return {
use: false,
historicalQsvList: [],
historicalQsv: '',
dialogVisible: false,
formData: {
category: ''
@@ -217,6 +244,19 @@ const basicForm = {
}
},
methods: {
async getHistoricalQsvList() {
const resp = await $.post('/platform/qsv/activity/getHistoricalQsvList', {})
return resp.data
},
async historicalQsvChange(val) {
const resp = await $.get('/platform/qsv/activity/findOne', {id: val})
if (resp.code === 0) {
this.formData = resp.data
this.formData.activityId = resp.data.id
this.formData.id = ''
console.log(this.formData.activityId)
}
},
onOpen(id) {
this.dialogVisible = true
this.getActivityGroup()
@@ -250,5 +290,8 @@ const basicForm = {
}
})
}
}
},
async created() {
this.historicalQsvList = await this.getHistoricalQsvList()
},
}
@@ -0,0 +1,564 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-transfer {
text-align: center;
}
.el-transfer-panel {
text-align: left;
width: 35%;
height: 400px;
}
.el-transfer-panel__list.is-filterable {
height: 300px;
}
.v-tree-layout-left {
overflow: unset !important;
}
.v-tree-layout-left .v-tree {
width: 100%;
height: calc(100vh - 170px);
overflow-y: auto;
}
.v-tree:hover::-webkit-scrollbar {
width: 3px;
background-color: transparent;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
display: flex;
align-items: center;
}
.v-tree-layout-left .v-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
::-webkit-scrollbar {
/*width: 3px;*/
/*background-color: transparent;*/
display: none;
}
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 10px;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never" style="height: calc(100vh - 70px)">
<tree-layout>
<template #tree>
<div style="padding:0 20px 20px;">
<el-select v-model="pageForm.fdh_id" filterable placeholder="请选择教代会" @change="jdhChange">
<el-option
v-for="item in fdhList"
:key="item.id"
:label="item.fdhAllName"
:value="item.id">
</el-option>
</el-select>
</div>
<el-tree class="filter-tree" :data="treeData" :props="defaultProps"
default-expand-all ref="tree"
highlight-current accordion @node-click="handleNodeClick">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="node.level==1" style="font-size: 16px;" class="v-node">
<i class="el-icon-office-building"></i>&nbsp;{{ data.dbt_name }}
</div>
<div v-if="node.level==2" style="font-size: 14px" class="v-node">
<i class="el-icon-s-help" v-if="checkData.dbt_name==data.dbt_name"></i>
<i class="el-icon-help" v-else></i>
&emsp;{{ data.dbt_name }}
</div>
</div>
</el-tree>
</template>
<template>
<div style="padding: 0 10px">
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" clearable
v-model="pageForm.searchKeyword">
<el-select v-model="pageForm.searchName" slot="prepend"
placeholder="查询类型"
style="width: 80px;">
<el-option label="姓名" value="u.username"></el-option>
<el-option label="工号" value="u.loginname"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button mt5" v-if="node.level!=2">
<el-select style="width: 200px" v-model="pageForm.dbt_id" filterable clearable placeholder="请选择代表团">
<el-option
v-for="item in delegations"
:key="item.id"
:label="item.dbt_name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5" v-if="node.level!=2">
<el-select style="width: 200px" v-model="pageForm.unionId" filterable clearable @change="getUnitList"
placeholder="请选择工会">
<el-option
v-for="item in unionList"
:label="item.unionname"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5" v-if="node.level!=2">
<el-select v-model="pageForm.unitId" filterable clearable
style="width: 200px" placeholder="请选择单位">
<el-option
v-for="item in unitList"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
</div>
<div class="pull-right offscreen-right mt5">
<el-button @click="openAdd"><i class="ti-plus"></i> 添加代表</el-button>
</div>
<div class="pull-right offscreen-right mt5 mr10">
<el-button @click="openSetXld"><i class="el-icon-sort" style="transform: rotate(90deg);"></i>代表调整
</el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool :label="label" :app="this">
<template #func>
<el-button @click="doDeleteUserList" plain size="small" type="primary"
v-if="selection.length>0"><i class="el-icon-delete"></i>批量删除
</el-button>
<el-button size="small" type="primary" plain @click="doExcel"><i
class="el-icon-s-promotion"></i> 导出Excel
</el-button>
</template>
</table-tool>
<el-table :data="tableData" row-key="id" @selection-change="handleSelectionChange"
ref="multipleTable" height="584">
<el-table-column type="selection" width="55" reserve-selection></el-table-column>
<el-table-column
type="index" label="序号" header-align="center" align="center" width="100">
</el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable">
</el-table-column>
<el-table-column label="操作" width="100">
<template scope="{row}">
<el-button plain type="danger" size="mini" icon="el-icon-delete" circle
@click="delUser(row)">
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</div>
</template>
</tree-layout>
</el-card>
</guava>
<el-dialog title="添加代表" :visible.sync="addDialogVisible" width="40%" :close-on-click-modal="false">
<el-form :model="formData" ref="addForm" :rules="rules" label-width="100px">
<el-form-item prop="dbt_id" label="代表团名称">
<el-select v-model="formData.dbt_id" filterable clearable placeholder="请选择代表团" @change="getUserDbChange"
style="width: 100%;">
<el-option
v-for="item in delegations"
:key="item.id"
:label="item.dbt_name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="userId" label="妇代会代表">
<el-select v-model="formData.userId" filterable clearable multiple placeholder="请选择妇代会代表"
style="width: 100%;">
<el-option
v-for="item in dbList"
:key="item.id"
:label="item.username+''+item.loginname+''+item.unionname+''+item.unitname+''"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item prop="identity" label="代表类型">
<el-radio v-model="formData.identity" label="1" border>正式代表</el-radio>
<el-radio v-model="formData.identity" label="2" border>列席代表</el-radio>
<el-radio v-model="formData.identity" label="3" border>特邀代表</el-radio>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="addDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doAdd">确 定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="xldDialogVisible" title="代表名单调整">
<el-select @change="xldJdhChange" v-model="xldFormData.fdhid">
<el-option :label="item.fdhAllName" :value="item.id" v-for="item in fdhList"></el-option>
</el-select>
<div class="pull-right offscreen-right">
<el-select :loading="loading" :remote-method="remotexldMethod"
filterable placeholder="请输入工号和姓名"
remote reserve-keyword v-model="xldFormData.userid">
<el-option :key="u.id" :label="u.username+'-'+u.loginname"
:value="u.id" v-for="u in xldUserList"></el-option>
</el-select>
<el-button @click="addXldUser">
添加人员
</el-button>
</div>
<el-table :data="xldTableData" height="350">
<el-table-column label="工号" prop="loginname"></el-table-column>
<el-table-column label="姓名" prop="username"></el-table-column>
<el-table-column label="性别" prop="sex"></el-table-column>
<el-table-column label="所属工会" prop="unionname"></el-table-column>
<el-table-column label="所属单位" prop="unitname"></el-table-column>
<el-table-column label="代表团">
<template slot-scope="scope">
<el-select clearable filterable v-model="scope.row.dbtid">
<el-option :label="d.dbt_name" :value="d.id" v-for="d in delegations"></el-option>
</el-select>
</template>
</el-table-column>
</el-table>
<span class="dialog-footer" slot="footer">
<el-button @click="xldDialogVisible = false">取 消</el-button>
<el-button @click="doSetxlddbt" type="primary">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue')
},
data() {
return {
loading: false,
xldTableData: [],
xldFormData: {
userid: ""
},
xldUserList: [],
node: {
level: 1
},
label: "代表列表",
selection: [],
unionList: [],
unitList: {},
dbList: [],
delegations: [],
checkData: {
id: ""
},
treeData: [],
fdhList: [],
singleTableData: [],
pageForm: {
jdh_id: "",
unitId: "",
unionId: "",
searchName: "u.username",
},
defaultProps: {
children: 'childrens',
label: 'dbtname',
disabled: 'disabled'
},
tableColumns: [
{prop: 'loginname', label: '工号', sortable: true},
{prop: 'username', label: '姓名'},
{prop: 'sex', label: '性别', sortable: true},
{prop: 'mobile', label: '联系方式'},
{prop: 'dbt_name', label: '代表团', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'roleName', label: '代表身份', sortable: true},
],
addDialogVisible: false,
xldDialogVisible: false,
rules: {
dbt_id: [{required: true, message: '请选择代表团', trigger: ['change', 'blur']}],
userId: [{required: true, message: '请选择代表', trigger: ['change', 'blur']}],
identity: [{required: true, message: '请选择代表类型', trigger: ['change', 'blur']}]
},
}
},
methods: {
async doSetxlddbt() {
let flag = true
for (let o of this.xldTableData) {
if (!('dbtid' in o)) {
flag = false
break
}
}
if (!flag) {
this.$message.info('请先选择要分配的代表团!')
return
}
const data = await $.post(loc() + '/fpXldToDbt', {
user: this.xldTableData,
fdhid: this.xldFormData.fdhid
})
if (data.code === 0) {
this.$message.success(data.msg)
this.xldTableData = []
this.pageData()
}
},
addXldUser() {
if (this.xldFormData.userid === '') {
this.$message.info('请先选择用户!')
return
}
let u = this.xldTableData.find(u => {
return u.id === this.xldFormData.userid
})
if (u) {
this.$message.info('不要重复添加')
return
}
let user = this.xldUserList.find(u => {
return u.id === this.xldFormData.userid
})
this.xldTableData.push(user)
this.xldFormData.userid = ''
this.xldUserList = []
},
async remotexldMethod(key) {
if (this.xldFormData.fdhid === '') {
this.$message.info('请先选择妇代会!')
return
}
if (key !== '') {
this.loading = true;
const {data} = await $.get(loc() + '/queryXldUser', {
query: key,
fdhid: this.xldFormData.fdhid
})
this.xldUserList = data
this.loading = false;
}
},
async xldJdhChange(jdhid) {
this.delegations = await getDbt(jdhid)
},
async openSetXld() {
if (this.fdhList && this.fdhList.length > 0) {
this.xldFormData.fdhid = this.fdhList[0].id
}
this.$set(this.xldFormData, "userid", "")
this.xldUserList = []
this.xldTableData = []
this.xldDialogVisible = true
},
doExcel() {
if (this.pageForm.fdh_id) {
const current_fdh = this.fdhList.find(v => v.id === this.pageForm.fdh_id)
location.href = '/platform/womanCongress/delegate/doExcel?fdhId=' + this.pageForm.fdh_id + '&dbtId=' + this.checkData.id + '&fdhAllName=' + current_fdh.fdhAllName
}
},
/*点击多选框*/
handleSelectionChange(val) {
this.selection = val
},
/*删除多个*/
doDeleteUserList() {
this.$confirm('确定要移除勾选的代表吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDeleteUserList", {
userData: JSON.stringify(this.selection),
fdh_id: this.pageForm.fdh_id
})
if(resp.code===0){
this.$message.success(resp.msg)
this.$refs.multipleTable.clearSelection();
this.pageData()
}else{
this.$message.warning(resp.msg)
}
}
}
});
},
/*删除一个*/
delUser(row) {
const data = {
userId: row.userId,
dbt_id: row.dbt_id,
fdh_id: row.fdh_id,
identity: row.identity
}
this.$confirm('确定要移除该代表吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/userDoDelete", data)
if(resp.code===0){
this.$message.success(resp.msg)
this.pageData()
}else{
this.$message.warning(resp.msg)
}
}
}
});
},
doAdd() {
this.$refs['addForm'].validate(async (valid) => {
if (valid) {
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
const resp = await $.post(loc() + '/doAdd', {
userData: JSON.stringify(this.formData.userId),
fdh_id: this.pageForm.fdh_id,
dbt_id: this.formData.dbt_id,
identity: this.formData.identity
})
loading.close()
if(resp.code===0){
this.pageData()
this.addDialogVisible = false
}else{
this.$message.warning(resp.msg)
}
}
})
},
openAdd() {
if (this.node.level == 2) {
this.delegations = this.delegations.filter(v => v.id == this.checkData.id)
this.formData.dbt_id = this.delegations[0].id
this.getUserDbChange()
}
this.addDialogVisible = true
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
async getUserDbChange() {
const {data} = await $.get(loc() + "/getUserDbChange", {
fdh_id: this.pageForm.fdh_id,
dbt_id: this.formData.dbt_id
})
this.dbList = data
},
/*查询代表团*/
async undertakeUnitTree() {
const {data} = await $.get("/platform/womanCongress/delegation/undertakeUnionTree", {fdh_id: this.pageForm.fdh_id})
this.treeData = [data]
},
/*点击左侧代表团触发*/
async handleNodeClick(data, node) {
this.$set(this.pageForm, "dbt_id", "")
this.node = node
this.checkData = data
this.label = "代表列表"
if (node.level == 2) {
this.label = data.dbt_name + "代表"
this.$set(this.pageForm, "dbt_id", data.id)
await this.getUnitList()
}
this.pageData();
this.delegations = await getFdhDbt(this.pageForm.fdh_id)
},
/*点击届次*/
async jdhChange(id) {
this.pageForm.dbt_id = ''
this.delegations = await getFdhDbt(id)
await this.undertakeUnitTree()
this.pageData();
},
async getUnitList() {
this.unitList = await getUnits(this.pageForm.unionId)
},
},
async created() {
this.fdhList = await getFdh()
if (this.fdhList.length > 0) {
this.pageForm.fdh_id = this.fdhList[0].id
this.delegations = await getFdhDbt(this.fdhList[0].id)
}
this.pageData();
this.unionList = await getUnions()
this.getUnitList()
await this.undertakeUnitTree()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,579 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-transfer {
text-align: center;
}
.el-transfer-panel {
text-align: left;
width: 35%;
height: 400px;
}
.el-transfer-panel__list.is-filterable {
height: 300px;
}
.v-tree-layout-left {
overflow: unset !important;
}
.v-tree-layout-left .v-tree {
width: 100%;
height: calc(100vh - 170px);
overflow-y: auto;
}
.v-tree:hover::-webkit-scrollbar {
width: 3px;
background-color: transparent;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
display: flex;
align-items: center;
}
.v-tree-layout-left .v-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
::-webkit-scrollbar {
/*width: 3px;*/
/*background-color: transparent;*/
display: none;
}
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 10px;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never" style="height: calc(100vh - 70px)">
<tree-layout>
<template #tree>
<div style="padding:0 20px 20px;">
<el-select v-model="pageForm.fdh_id" filterable placeholder="请选择妇代会代会" @change="fdhChange">
<el-option
v-for="item in fdhList"
:key="item.id"
:label="item.fdhAllName"
:value="item.id">
</el-option>
</el-select>
</div>
<el-tree class="v-tree" :data="treeData" :props="defaultProps"
default-expand-all :filter-node-method="filterNode" ref="tree"
highlight-current accordion @node-click="handleNodeClick">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="node.level==1" style="font-size: 16px;" class="v-node">
<i class="el-icon-office-building"></i>&nbsp;{{ data.dbt_name }}
</div>
<div v-if="node.level==2" style="font-size: 14px" class="v-node">
<i class="el-icon-s-help" v-if="checkData.dbt_name==data.dbt_name"></i>
<i class="el-icon-help" v-else></i>
&emsp;{{ data.dbt_name }}
</div>
</div>
</el-tree>
</template>
<template>
<div v-if="node.level==1" style="padding:0 10px">
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-select v-model="pageForm.dbt_id" filterable clearable placeholder="请选择代表团"
@change="doSearch">
<el-option
v-for="item in delegations"
:key="item.id"
:label="item.dbt_name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="pull-right offscreen-right mt5">
<el-button @click="openAddDbt"><i class="ti-plus"></i> 新建代表团</el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<el-table :data="tableData" row-key="id" height="638"
ref="multipleTable">
<el-table-column
type="index" label="序号" header-align="center" align="center" width="100">
</el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable">
</el-table-column>
<el-table-column label="操作" width="100">
<template scope="{row}">
<el-button plain type="danger" size="mini" icon="el-icon-delete" circle
@click="delDbt(row.id)">
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</div>
<div v-if="node.level==2" style="padding:0 10px">
<el-card shadow="never" v-if="['two','three'].includes(activeName)">
<el-row type="flex" justify="end">
<el-button type="primary" v-if="activeName==='two'" @click="unionOpenAdd()">设置组成基层工会</el-button>
<el-button type="primary" v-if="activeName==='three'" @click="openUserTz()">设置团长/副团长</el-button>
</el-row>
</el-card>
<el-card shadow="never" class="mt10">
<el-tabs v-model="activeName" type="card" @tab-click="handleTabClick">
<el-tab-pane label="代表" name="one">
<el-table highlight-current-row :data="dbTableData" size="small"
style="width: 100%;"
height="719">
<el-table-column label="序号" width="60px">
<template scope="scope"><span>{{scope.$index+1}}</span></template>
</el-table-column>
<el-table-column align="center" header-align="center" label="姓名" prop="username"
align="center"></el-table-column>
<el-table-column align="center" header-align="center" label="工号"
prop="loginname"
align="center"></el-table-column>
<el-table-column align="center" header-align="center" sortable prop="unionname"
label="工会"></el-table-column>
<el-table-column align="center" header-align="center" sortable prop="unitname"
label="单位"></el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="设置组成基层工会" name="two">
<el-table highlight-current-row :data="unionTableData" size="small"
height="629"
style="width: 100%;">
<el-table-column label="序号" width="60px" type="index"></el-table-column>
<el-table-column label="基层工会名称" prop="unionname"
align="center"></el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="设置团长/副团长" name="three">
<el-table :data="tzTableData" size="mini" height="629">
<el-table-column sortable prop="loginname" label="工号"></el-table-column>
<el-table-column sortable prop="username" label="姓名"></el-table-column>
<el-table-column sortable prop="unitname" label="单位"></el-table-column>
<el-table-column prop="mobile" label="电话"></el-table-column>
<el-table-column prop="sex" label="性别"></el-table-column>
<el-table-column prop="rolename" label="身份">
<template slot-scope="scope">
<span v-if="scope.row.rolename==='代表团团长'" class="text-primary">团长</span>
<span v-if="scope.row.rolename==='代表团副团长'" class="text-info">副团长</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template scope="{row}">
<el-button plain type="danger" size="mini" icon="el-icon-delete" circle
@click="delUser(row)">
</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
</tree-layout>
</el-card>
</guava>
<el-dialog title="新建代表团" :visible.sync="addDialogVisible" width="40%" :close-on-click-modal="false">
<el-form :model="formData" ref="addForm" :rules="rules" label-width="100px">
<el-form-item prop="fdhAllName" label="所属教代会">
<el-input v-model="formData.fdhAllName" disabled placeholder="请输入内容"></el-input>
</el-form-item>
<el-form-item prop="dbt_id" label="代表团名称">
<el-select multiple v-model="formData.dbt_id" filterable placeholder="请选中代表团名称"
style="width: 100%">
<el-option
v-for="item in dbtList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="addDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doAddDbt">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="设置组成基层工会" :visible.sync="unionDialogVisible" width="55%">
<div style="width: 100%;">
<el-transfer :titles="['剩余分工会', '代表团分工会']" filterable
:props="{key: 'id',label: 'unionname'}"
:filter-method="unionFilterMethod"
v-model="unionFormData.unionValue"
:data="unionData">
</el-transfer>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="unionDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doUnion" :loading="unionSubLoading">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="设置团长副团长" :visible.sync="userDialogVisible" width="40%">
<el-form label-width="100px">
<el-form-item prop="fdhAllName" label="届次">
<el-input v-model="userFormData.fdhAllName" disabled></el-input>
</el-form-item>
<el-form-item prop="userid" label="工号或姓名">
<el-select v-model="userFormData.userid" filterable placeholder="请输入工号或姓名关键字"
style="width: 100%" @change="userChange">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.username+'('+item.loginname+')'+item.unitname"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="联系方式">
<el-input v-model="leaderInfo.mobile" readonly></el-input>
</el-form-item>
<el-form-item prop="dwname" label="所属单位">
<el-input v-model="leaderInfo.unitname" readonly></el-input>
</el-form-item>
<el-form-item prop="sf" label="身份">
<el-radio-group v-model="leaderInfo.sf">
<el-radio-button label="2">&emsp;</el-radio-button>
<el-radio-button label="1">副团长</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="userDialogVisible=false">取 消</el-button>
<el-button type="primary" @click="doAddTz">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue')
},
data() {
return {
pageForm: {
fdh_id: ""
},
leaderInfo: {},
userList: [],
userFormData: {},
unionData: [],
unionFormData: {
unionValue: []
},
unionTableData: [],
unionDialogVisible: false,
userDialogVisible: false,
addDialogVisible: false,
unionSubLoading: false,
treeData: [],
dbTableData: [],
tzTableData: [],
checkData: {},
activeName: 'one',
label: "",
fdhList: [],
delegations: [],
dbtList: [],
node: {
level: 1
},
defaultProps: {
children: 'childrens',
label: 'dbtname',
disabled: 'disabled'
},
tableColumns: [
{prop: 'dbt_name', label: '代表团名称', sortable: true},
{prop: 'code', label: '代表团编号', sortable: true},
{prop: 'found_time', label: '创建时间', 所属教代会: true}
],
rules: {
dbt_id: [{required: true, message: '请选择代表团', trigger: ['change', 'blur']}]
},
}
},
methods: {
filterNode(value, data) {
if (!value) return true;
return data.dbt_name.indexOf(value) !== -1
return false
},
handleTabClick(tab) {
if (tab.name === 'one') {
this.butTitle = '设置组成基层工会'
this.getDbTableData()
} else if (tab.name === 'two') {
this.butTitle = '设置组成基层工会'
this.unionPageData()
} else {
this.butTitle = '设置团长/副团长'
this.getTzList()
}
},
handleNodeClick(data, node) {
this.node = node
this.checkData = data
if (node.level == 2) {
this.getDbTableData()
this.unionPageData()
this.getTzList()
}
},
fdhChange() {
this.undertakeUnitTree()
this.getDbTableData()
this.unionPageData()
this.getTzList()
},
async delUser(row) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.get(loc() + "/delUser", {
userId: row.id,
roleId: row.roleid,
fdh_id: this.pageForm.fdh_id
})
if (resp.code === 0) {
this.getTzList()
} else {
this.$message.warning(resp.msg)
}
}
}
});
},
async undertakeUnitTree() {
const {data} = await $.get(loc() + "/undertakeUnionTree", {fdh_id: this.pageForm.fdh_id})
this.treeData = [data]
this.pageData()
},
openAddDbt() {
const fdhFind = this.fdhList.find(v => v.id = this.pageForm.fdh_id)
this.$set(this.formData, "fdhAllName", fdhFind.fdhAllName)
this.getDbtList()
this.addDialogVisible = true
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
async getDbtList() {
const resp = await $.post(loc() + "/getDbtFind", {fdh_id: this.pageForm.fdh_id})
this.dbtList = resp
},
doAddDbt() {
this.$refs['addForm'].validate(async (valid) => {
if (valid) {
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
const resp = await $.post(loc() + '/doAddDbt', {
dbtList: JSON.stringify(this.formData.dbt_id),
fdh_id: this.pageForm.fdh_id
})
loading.close()
if (resp.code === 0) {
await this.undertakeUnitTree()
this.pageData()
this.addDialogVisible = false
this.delegations = await getFdhDbt(this.pageForm.fdh_id)
} else {
this.$message.warning(resp.msg)
}
}
})
},
delDbt(id) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/delDbt", {dbt_id: id, fdh_id: this.pageForm.fdh_id})
if (resp.code === 0) {
this.undertakeUnitTree()
this.pageData()
this.delegations = await getFdhDbt(this.pageForm.fdh_id)
} else {
this.$message.warning(resp.msg)
}
}
}
});
},
async unionOpenAdd() {
const {data} = await $.get(loc() + "/unionOpenAddList", {
fdh_id: this.pageForm.fdh_id,
dbt_id: this.checkData.id
})
this.unionData = data.data
this.unionFormData.unionValue = data.value.map(v => {
return v.union_id
})
this.unionDialogVisible = true
},
async doUnion() {
const resp = await $.post(loc() + "/doUnion", {
unionValue: JSON.stringify(this.unionFormData.unionValue),
fdh_id: this.pageForm.fdh_id,
dbt_id: this.checkData.id
})
await this.unionPageData()
this.unionDialogVisible = false
this.$notify.success({title: '成功', message: resp.msg});
},
async unionPageData() {
const resp = await $.post(loc() + "/unionPageData", {
fdh_id: this.pageForm.fdh_id,
dbt_id: this.checkData.id
})
this.unionTableData = resp
},
unionFilterMethod(query, item) {
return item.unionname.indexOf(query) > -1;
},
async getDbTableData() {
const resp = await $.post(loc() + "/getDbTableData", {
fdh_id: this.pageForm.fdh_id,
dbt_id: this.checkData.id
})
this.dbTableData = resp
},
async openUserTz() {
this.userFormData = {}
this.leaderInfo = {
mobile: '',
unitname: '',
sf: '2'
}
const aa = this.fdhList.find(v => v.id == this.pageForm.fdh_id)
this.$set(this.userFormData, 'fdhAllName', aa.fdhAllName)
const data = await $.get(loc() + "/queryUser", {
dbt_id: this.checkData.id,
fdh_id: this.pageForm.fdh_id
})
this.userList = data
this.userDialogVisible = true
},
userChange(val) {
this.leaderInfo = this.userList.find(v => {
if (v.id === val) {
return v
}
})
this.$set(this.leaderInfo, 'sf', 2)
},
async doAddTz() {
if (!this.userFormData.userid) {
this.$notify.warning({title: '警告', message: "请先选择需要添加的教职工"});
return
}
this.userFormData.sf = this.leaderInfo.sf
this.userFormData.dbt_id = this.checkData.id
this.userFormData.fdh_id = this.pageForm.fdh_id
const resp = await $.post(loc() + "/doAddTz", this.userFormData)
if (resp.code === 0) {
this.$message.success(resp.msg)
this.getTzList()
} else {
this.$message.warning(resp.msg)
}
this.userList = []
this.userFormData.userid = ''
this.userDialogVisible = false
},
async getTzList() {
const resp = await $.get(loc() + '/getTzList', {
dbt_id: this.checkData.id,
fdh_id: this.pageForm.fdh_id
})
if (resp.code === 0) {
this.tzTableData = resp.data
} else {
this.$message.warning(resp.msg)
}
},
},
async created() {
this.fdhList = await getFdh()
if (this.fdhList.length > 0) {
this.pageForm.fdh_id = this.fdhList[0].id
this.delegations = await getFdhDbt(this.fdhList[0].id)
}
this.pageData()
this.undertakeUnitTree()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,428 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-transfer {
text-align: center;
}
.el-transfer-panel {
text-align: left;
width: 35%;
height: 400px;
}
.el-transfer-panel__list.is-filterable {
height: 300px;
}
.v-tree-layout-left {
overflow: unset !important;
}
.v-tree-layout-left .v-tree {
width: 100%;
height: calc(100vh - 170px);
overflow-y: auto;
}
.v-tree:hover::-webkit-scrollbar {
width: 3px;
background-color: transparent;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
display: flex;
align-items: center;
}
.v-tree-layout-left .v-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
::-webkit-scrollbar {
/*width: 3px;*/
/*background-color: transparent;*/
display: none;
}
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 10px;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never" style="height: calc(100vh - 70px)">
<tree-layout>
<template #tree>
<div style="padding:0 20px 20px;">
<el-input
placeholder="输入关键字进行查找"
v-model="filterText">
</el-input>
</div>
<el-tree class="filter-tree" :data="treeData" :props="defaultProps"
default-expand-all ref="tree"
highlight-current accordion @node-click="handleNodeClick" :filter-node-method="filterNode">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="node.level==1" style="font-size: 16px;" class="v-node">
<i class="el-icon-office-building"></i>&nbsp;{{ data.name }}
</div>
<div v-if="node.level==2" style="font-size: 14px" class="v-node">
<i class="el-icon-s-help" v-if="checkData.name==data.name"></i>
<i class="el-icon-help" v-else></i>
&emsp;{{ data.name }}
</div>
<div v-if="node.level==3"
style="font-size: 14px" :title="data.name" class="v-node">
<i class="fa fa-dot-circle-o" v-if="checkData.name==data.name"></i>
<i class="fa fa-circle-o" v-else></i>
&nbsp; {{ data.name }}
</div>
</div>
</el-tree>
</template>
<template>
<div style="padding: 0 10px">
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-select v-model="pageForm.fdh_id" filterable clearable
placeholder="届次">
<el-option
v-for="item in fdhList"
:label="item.fdhAllName"
:key="item.id"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" clearable
v-model="pageForm.searchKeyword">
<el-select v-model="pageForm.searchName" slot="prepend"
placeholder="查询类型"
style="width: 80px;">
<el-option label="姓名" value="u.username"></el-option>
<el-option label="工号" value="u.loginname"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button mt5">
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<template v-if="checkData.childrens&&checkData.childrens.length>0">
</template>
<template v-else="">
<table-tool :label="label" :app="this">
<template #func>
<el-button type="primary" size="medium" @click="openAdd"
v-if="node.level==2">
添加人员
</el-button>
</template>
</table-tool>
<el-table :data="tableData" row-key="id" height="584">
<el-table-column
type="index" label="序号" header-align="center" align="center" width="100">
</el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
show-overflow-tooltip>
<template scope="{row}" v-if="column.prop=='status'">
<span class="text-primary" v-if="row.role_name">{{row.role_name}}</span>
<template v-else>
<span class="text-primary" v-if="row.status==1">委员</span>
<span class="text-primary" v-if="row.status==2">副主任</span>
<span class="text-primary" v-if="row.status==3">主任</span>
</template>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template scope="{row}">
<el-dropdown>
<el-button size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
@click.native="delUser(row.id)">删除
</el-dropdown-item>
<el-dropdown-item v-if="row.status!==3"
@click.native="updateStatus(row,3)"
class="text-primary">设置主任
</el-dropdown-item>
<el-dropdown-item v-if="row.status!==2"
@click.native="updateStatus(row,2)"
class="text-primary">设置副主任
</el-dropdown-item>
<el-dropdown-item v-if="row.status!==1"
@click.native="updateStatus(row,1)"
class="text-primary">设置委员
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</template>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</div>
</template>
</tree-layout>
</el-card>
</template>
</guava>
<el-dialog title="添加人员" :visible.sync="addDialogVisible" width="40%" :close-on-click-modal="false">
<el-form label-width="100px" :model="formData" ref="addUserForm">
<el-form-item prop="fdhAllName" label="届次">
<el-input v-model="formData.fdhAllName" disabled></el-input>
</el-form-item>
<el-form-item prop="organization_name" label="机构名称">
<el-input v-model="formData.organization_name" disabled></el-input>
</el-form-item>
<el-form-item prop="user_id" label="工号或姓名"
:rules="[{required:true,message:'请输入工号和姓名',trigger: ['blur', 'change']}]">
<el-select
@change="userChange"
style="width: 100%"
v-model="formData.user_id"
value-key="id"
filterable
remote
reserve-keyword
placeholder="请输入工号或者姓名"
:remote-method="queryNotWyhUser">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.username+'-'+item.loginname+'-'+item.unionname"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="联系方式">
<el-input v-model="formData.mobile" readonly></el-input>
</el-form-item>
<el-form-item prop="unitname" label="所属单位">
<el-input v-model="formData.unitname" readonly></el-input>
</el-form-item>
<el-form-item label="身份" prop="status" v-if="checkData.code==='fdhwyh1'">
<el-radio-group v-model="formData.status">
<el-radio-button label="1">&emsp;</el-radio-button>
<el-radio-button label="2">副主席</el-radio-button>
<el-radio-button label="3">常务副主席</el-radio-button>
<el-radio-button label="4">&emsp;</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="身份" prop="status" v-else>
<el-radio-group v-model="formData.status">
<el-radio-button label="1">&emsp;</el-radio-button>
<el-radio-button label="2">副主任</el-radio-button>
<el-radio-button label="3">&emsp;</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doAdd" v-loading="addLoading">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
addLoading: false,
label: "妇代会机构设置",
fdhList: [],
userList: [],
node: {
level: 1
},
checkData: {
id: ""
},
addDialogVisible: false,
checkData: {},
treeData: [],
filterText: '',
treeLoading: false,
defaultProps: {
children: 'childrens',
label: 'name',
},
pageForm: {
searchName: "u.username"
},
tableColumns: [
{prop: 'loginname', label: '工号', sortable: true},
{prop: 'username', label: '姓名', sortable: true},
{prop: 'sex', label: '性别', sortable: true},
{prop: 'mobile', label: '手机', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'fdh_name', label: '届次', sortable: true},
{prop: 'organization_name', label: '所属机构', sortable: true},
{prop: 'status', label: '身份', sortable: true},
],
}
},
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue'),
'guava': httpVueLoader('/components/plugins/Guava.vue'),
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
},
methods: {
async updateStatus(row, status) {
const resp = await $.get(loc() + "/updateStatus", {
status: status,
fdh_id: row.fdh_id,
organization_id: row.organization_id,
user_id: row.user_id
})
if(resp.code===0){
this.$message.success(resp.msg)
this.pageData()
}else{
this.$message.warning(resp.msg)
}
},
async loadTree() {
this.treeLoading = true
const data = await $.get("/platform/womanCongress/Organization/getTreeData")
this.treeData = [data]
this.treeLoading = false
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
async handleNodeClick(data, node) {
this.node = node
this.checkData = data
this.pageForm.organization_id = data.id
this.pageData()
this.label = data.name
},
userChange() {
const aa = this.userList.find(v => v.id == this.formData.user_id)
this.$set(this.formData, "mobile", aa.mobile)
this.$set(this.formData, "unitname", aa.unitname)
},
async doAdd() {
const valid = await this.$refs.addUserForm.validate()
if (!valid) return
this.addLoading = true
const resp = await $.get(loc() + "/doAdd", this.formData)
this.addLoading = false
if (resp.code === 0) {
this.pageData()
this.addDialogVisible = false
this.formData = {}
} else {
this.$message.warning(resp.msg)
}
},
async openAdd() {
const aa = this.fdhList.find(v => v.id = this.pageForm.fdh_id)
this.$set(this.formData, 'fdhAllName', aa.fdhAllName)
this.$set(this.formData, 'status', 1)
this.$set(this.formData, 'fdh_id', this.pageForm.fdh_id)
this.$set(this.formData, 'organization_id', this.checkData.id)
this.$set(this.formData, 'organization_name', this.checkData.name)
this.$set(this.formData, 'organization_code', this.checkData.code)
this.addDialogVisible = true
},
async delUser(id) {
this.$confirm('您确定要删除此用户吗!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/delUser", {id: id})
this.pageData()
}
}
})
},
async queryNotWyhUser(key) {
const data = await $.get(loc() + "/getUserList", {
fdh_id: this.pageForm.fdh_id,
organization_id: this.checkData.id,
key: key
})
this.userList = data.list
}
},
async created() {
this.fdhList = await getFdh()
if (this.fdhList.length > 0) {
this.$set(this.pageForm, "fdh_id", this.fdhList[0].id)
}
this.loadTree()
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,304 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">年份:</div>
<el-date-picker
clearable
style="width: 100%"
v-model="pageForm.year"
value-format="yyyy"
formData="yyyy"
type="year"
placeholder="选择年份">
</el-date-picker>
</div>
<div class="search-item">
<div class="search-item-label">届数:</div>
<el-select v-model="pageForm.fdhJs" placeholder="请选择届数" clearable style="width: 100%">
<el-option
v-for="item in jsList"
:key="item.id"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</div>
<div class="search-item">
<div class="search-item-label">次数:</div>
<el-select v-model="pageForm.fdhCs" placeholder="请选择次数" clearable style="width: 100%">
<el-option
v-for="item in csOptions"
:key="item.id"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</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 size="small" type="primary" @click="openAdd">新建届次
</el-button>
</template>
</table-tool>
<el-table :data="tableData" style="width: 100%;margin-bottom: 20px" row-key="id"
@sort-change="pageOrder" v-loading="tableLoading" :size="tableSize" class="vi-table">
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
show-overflow-tooltip>
<template scope="{row}" v-if="column.prop=='startState'">
<el-switch active-color="#13ce66"
inactive-color="#ff4949"
:value="row.startState"
@change="startStateChange(row.startState,row.id)">
</el-switch>
</template>
<template scope="{row}" v-else-if="column.prop=='fdhJs'">
{{row.fdhJs}}
</template>
<template scope="{row}" v-else-if="column.prop=='fdhCs'">
{{row.fdhCs}}
</template>
<template scope="{row}" v-else-if="column.prop=='fdhAllName'">
{{row.fdhAllName}}妇代会
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template scope="{row}">
<el-button size="mini" type="primary" @click="openEdit(row)">
编辑
</el-button>
<el-button size="mini" type="danger"
@click="doDelete(row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</template>
</guava>
<el-dialog
title="新建届次"
:visible.sync="addDialogVisible"
width="45%">
<el-form :model="formData" ref="addForm" :rules="rules" label-width="120px">
<el-form-item prop="year" label="妇代会年份">
<el-date-picker style="width:100%;" :clearable="false"
v-model="formData.year"
value-format="yyyy"
formData="yyyy"
type="year"
placeholder="选择年">
</el-date-picker>
</el-form-item>
<el-form-item prop="fdhJs" label="妇代会届数">
<el-select v-model="formData.fdhJs" filterable placeholder="请选择届数" style="width:100%;">
<el-option v-for="i in jsList" :label="i.name" :key="i.id" :value="i.name"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="fdhCs" label="妇代会次数">
<el-select v-model="formData.fdhCs" @change="csChange" filterable placeholder="请选择次数"
style="width:100%;">
<el-option v-for="item in csOptions" :key="item.id" :label="item.name"
:value="item.name"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="isExtend" class="is-required" label="" label-width="30px" style="margin-top: 20px;">
<el-checkbox v-model="isExtend"
:disabled="formData.fdhCs=='一' || formData.fdhCs==''"
style="font-size: 14px;color: #ff6a00;width: 100%">
<span style="text-overflow: clip;white-space: normal;">
延用上一次妇代会的组织机构及代表信息,包含【女教职工委员会;经费审查委员会;工会委员会;人事(劳动)争议调解委员会;代表团;妇代会代表】。
</span>
</el-checkbox>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="addDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="!formData.id?doAdd():doEdit()">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
addDialogVisible: false,
isExtend: false,
pageForm: {
fdhJs: ""
},
jsList: [],
tableColumns: [
{prop: 'year', label: '年份', sortable: true},
{prop: 'fdhJs', label: '妇代会届数', sortable: true},
{prop: 'fdhCs', label: '次数', sortable: true},
{prop: 'fdhAllName', label: '全称'},
{prop: 'startState', label: '开启状态'},
{prop: 'startTime', label: '创建时间'}
],
csOptions: [
{id: "六", name: "六次"},
{id: "五", name: "五次"},
{id: "四", name: "四次"},
{id: "三", name: "三次"},
{id: "二", name: "二次"},
{id: "一", name: "一次"}].reverse(),
rules: {
year: [{required: true, message: '请选择教代会年份', trigger: ['blur', 'change']}],
fdhJs: [{required: true, message: '请输入教代会届数', trigger: ['blur', 'change']}],
fdhCs: [{required: true, message: '请输入教代会次数', trigger: ['blur', 'change']}]
}
}
},
components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
},
methods: {
openEdit(row) {
this.$set(this.formData, "id", row.id)
this.$set(this.formData, "year", row.year + "")
this.$set(this.formData, "fdhJs", row.fdhJs)
this.$set(this.formData, "fdhCs", row.fdhCs)
this.$set(this.formData, "startState", row.startState)
this.addDialogVisible = true
},
async doEdit() {
const fdhAllName = this.formData.fdhJs + this.formData.fdhCs
this.$set(this.formData, "fdhAllName", fdhAllName)
this.$set(this.formData, "isExtend", this.isExtend)
const resp = await $.post(loc() + "/doEdit", this.formData)
this.pageData()
this.addDialogVisible = false
},
async doDelete(id) {
this.$confirm('您确定要删除此届妇代会吗!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDelete", {id: id})
this.pageData()
}
}
})
},
startStateChange(startState, id) {
const state = startState ? "关闭" : "开启";
this.$confirm('您确定要' + state + '妇代会吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/startStateChange", {startState: startState, id: id})
this.pageData()
}
}
})
},
csChange(val) {
if (val === '一') {
this.$set(this, 'isExtend', false)
}
},
doAdd() {
this.$refs["addForm"].validate(async (valid) => {
if (valid) {
if (!this.isExtend && this.formData.fdhCs !== '一') {
this.$confirm('确定不延用上一次教代会的组织及人员数据吗?这将导致此次教代会的组织及人员都将为空必须重新组建!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
await this.getAdd()
}
}
})
} else {
await this.getAdd()
}
}
})
},
async getAdd() {
const fdhAllName = this.formData.fdhJs + this.formData.fdhCs
this.$set(this.formData, "fdhAllName", fdhAllName)
this.formData.isExtend = this.isExtend
console.log(this.formData)
const resp = await $.post(loc() + "/doAdd", this.formData)
if(resp.code===0){
this.pageData()
this.addDialogVisible = false
}else{
this.$message.warning(resp.msg)
}
},
openAdd() {
this.$set(this.formData, 'fdhCs', "")
this.$set(this.formData, 'year', new Date().getFullYear() + "")
this.addDialogVisible = true
if (this.$refs["addForm"])
this.$refs["addForm"].resetFields()
}
},
async created() {
this.jsList = await getJc()
this.pageData()
}
})
</script>
<!--#
}
#-->