This commit is contained in:
zhengziru
2026-06-17 16:32:11 +08:00
16 changed files with 339 additions and 50 deletions
@@ -9,10 +9,12 @@ import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record; 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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/** /**
* @Author: 1V * @Author: 1V
@@ -76,8 +78,15 @@ public class LxyCommon {
@At @At
@ViReturn @ViReturn
public Object getHdList() { public Object getHdList(@Param(value = "year", required = false) Integer year) {
return lxyHdService.list(Sqls.create("SELECT id,`name` FROM `lxy_hd` ORDER BY hdcjsj desc ")); Sql sql = Sqls.create("SELECT id,`name` FROM `lxy_hd` $condition");
Cnd cnd = Cnd.NEW();
if (year != null) {
cnd.and(new org.nutz.dao.util.cri.Static("YEAR(hdcjsj) = " + year));
}
cnd.desc("hdcjsj");
sql.setCondition(cnd);
return lxyHdService.list(sql);
} }
@At @At
@@ -88,8 +97,16 @@ public class LxyCommon {
@At @At
@ViReturn @ViReturn
public Object getNowHdList() { public Object getNowHdList(@Param(value = "year", required = false) Integer year) {
return lxyHdService.list(Sqls.create("SELECT id,`name` FROM `lxy_hd` WHERE now() < bmjzsj ORDER BY hdcjsj desc ")); Sql sql = Sqls.create("SELECT id,`name` FROM `lxy_hd` $condition");
Cnd cnd = Cnd.NEW();
cnd.and(new org.nutz.dao.util.cri.Static("now() >= bmkssj AND now() < bmjzsj"));
if (year != null) {
cnd.and(new org.nutz.dao.util.cri.Static("YEAR(hdcjsj) = " + year));
}
cnd.desc("hdcjsj");
sql.setCondition(cnd);
return lxyHdService.list(sql);
} }
} }
@@ -101,6 +101,7 @@ public class LxyFghShController {
cnd.and(new Static("bm.bmzt = 1 ")); cnd.and(new Static("bm.bmzt = 1 "));
cnd.and(new Static("bm.bmlx = 2 ")); cnd.and(new Static("bm.bmlx = 2 "));
cnd.and(new Static("(hd.activityGroupId IS NULL OR u.id IN (SELECT userId FROM activity_user_scope WHERE groupId = hd.activityGroupId))"));
if (Strings.isNotBlank(hdid)) { if (Strings.isNotBlank(hdid)) {
cnd.and("bm.hdid", "=", hdid); cnd.and("bm.hdid", "=", hdid);
@@ -16,6 +16,7 @@ import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.lxy.model.Lxy_bm; import io.v.nutz.zhgh.lxy.model.Lxy_bm;
import io.v.nutz.zhgh.lxy.model.Lxy_grxx; import io.v.nutz.zhgh.lxy.model.Lxy_grxx;
import io.v.nutz.zhgh.lxy.model.Lxy_hd;
import io.v.nutz.zhgh.lxy.model.Lxy_mefp; import io.v.nutz.zhgh.lxy.model.Lxy_mefp;
import io.v.nutz.zhgh.lxy.service.LxyBmService; import io.v.nutz.zhgh.lxy.service.LxyBmService;
import io.v.nutz.zhgh.lxy.service.LxyGrxxService; import io.v.nutz.zhgh.lxy.service.LxyGrxxService;
@@ -119,7 +120,7 @@ public class LxyGhbmController {
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.and(new Static("now() < hd.bmjzsj")); cnd.and(new Static("now() >= hd.bmkssj AND now() < hd.bmjzsj"));
cnd.and("mefp.hdid", "=", hdid); cnd.and("mefp.hdid", "=", hdid);
cnd.andEX("un.id", "=", unionId); cnd.andEX("un.id", "=", unionId);
@@ -182,6 +183,7 @@ public class LxyGhbmController {
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.and("member", "=", 1); cnd.and("member", "=", 1);
cnd.and("unit.unionid", "=", unionid); cnd.and("unit.unionid", "=", unionid);
addActivityScopeCnd(cnd, "u", hdid);
cnd.and(new Static("u.id NOT IN ( SELECT bm.userid FROM lxy_bm bm WHERE bm.hdid = '" + hdid + "' OR hdid = '1' ) ")); cnd.and(new Static("u.id NOT IN ( SELECT bm.userid FROM lxy_bm bm WHERE bm.hdid = '" + hdid + "' OR hdid = '1' ) "));
if (checks != null && checks.length > 0) { if (checks != null && checks.length > 0) {
for (String check : checks) { for (String check : checks) {
@@ -241,6 +243,13 @@ public class LxyGhbmController {
return Result.error("未获取到报名数据,请选择人员报名"); return Result.error("未获取到报名数据,请选择人员报名");
} }
if (!checkActivitySignUpTime(bmList.get(0).getHdid())) {
return Result.error("当前不在报名时间范围内");
}
if (!checkActivityUserScope(bmList.get(0).getHdid(), bmList.stream().map(Lxy_bm::getUserid).collect(Collectors.toList()))) {
return Result.error("存在不在活动人员范围内的人员,请重新选择");
}
String unionId = Vi.getUnionId(); String unionId = Vi.getUnionId();
Lxy_mefp meNum = dao.fetch(Lxy_mefp.class, Cnd.where("hdid", "=", bmList.get(0).getHdid()).and("ghid", "=", unionId)); Lxy_mefp meNum = dao.fetch(Lxy_mefp.class, Cnd.where("hdid", "=", bmList.get(0).getHdid()).and("ghid", "=", unionId));
@@ -384,6 +393,9 @@ public class LxyGhbmController {
try { try {
lock.lock(); lock.lock();
String unionId = Vi.getUnionId(); String unionId = Vi.getUnionId();
if (!checkActivitySignUpTime(projectId)) {
return Result.error("当前不在报名时间范围内");
}
// 已经报名的,排除审核未通过 // 已经报名的,排除审核未通过
int count = dao.count(Lxy_bm.class, Cnd.where("hdid", "=", projectId).and("ghid", "=", unionId) int count = dao.count(Lxy_bm.class, Cnd.where("hdid", "=", projectId).and("ghid", "=", unionId)
.and(Cnd.exps("bmzt", "in", List.of("1", "3", "5", "6")).or("bmzt", "is", null))); .and(Cnd.exps("bmzt", "in", List.of("1", "3", "5", "6")).or("bmzt", "is", null)));
@@ -416,6 +428,7 @@ public class LxyGhbmController {
List<String> sourUserIdList = sourceList.stream().map(Lxy_bm::getUserid).collect(Collectors.toList()); List<String> sourUserIdList = sourceList.stream().map(Lxy_bm::getUserid).collect(Collectors.toList());
String today = cn.hutool.core.date.DateUtil.today(); String today = cn.hutool.core.date.DateUtil.today();
Integer activityGroupId = getActivityGroupId(projectId);
// 要插入的数据 // 要插入的数据
List<Lxy_bm> bmList = new ArrayList<>(); List<Lxy_bm> bmList = new ArrayList<>();
@@ -440,6 +453,12 @@ public class LxyGhbmController {
continue; continue;
} }
if (activityGroupId != null && dao.count("activity_user_scope", Cnd.where("groupId", "=", activityGroupId).and("userId", "=", user.getId())) == 0) {
temp.setRemark("此人员不在活动人员范围内");
errorInfos.add(temp);
continue;
}
if (lastJoinUserIds.contains(user.getId())) { if (lastJoinUserIds.contains(user.getId())) {
temp.setRemark("此教师参加过以往疗休养,请更换人员上报"); temp.setRemark("此教师参加过以往疗休养,请更换人员上报");
errorInfos.add(temp); errorInfos.add(temp);
@@ -506,4 +525,33 @@ public class LxyGhbmController {
} }
} }
private void addActivityScopeCnd(Cnd cnd, String userAlias, String hdid) {
Integer activityGroupId = getActivityGroupId(hdid);
if (activityGroupId != null) {
cnd.and(new Static(userAlias + ".id IN (SELECT userId FROM activity_user_scope WHERE groupId = " + activityGroupId + ")"));
}
}
private boolean checkActivityUserScope(String hdid, List<String> userIds) {
Integer activityGroupId = getActivityGroupId(hdid);
if (activityGroupId == null) {
return true;
}
List<String> ids = userIds.stream().filter(Strings::isNotBlank).distinct().collect(Collectors.toList());
if (ids.size() != userIds.size()) {
return false;
}
return dao.count("activity_user_scope", Cnd.where("groupId", "=", activityGroupId).and("userId", "in", ids)) == ids.size();
}
private boolean checkActivitySignUpTime(String hdid) {
return lxyHdService.count(Cnd.where("id", "=", hdid)
.and(new Static("now() >= bmkssj AND now() < bmjzsj"))) > 0;
}
private Integer getActivityGroupId(String hdid) {
Lxy_hd hd = lxyHdService.fetch(hdid);
return hd == null ? null : hd.getActivityGroupId();
}
} }
@@ -107,6 +107,7 @@ public class LxyGrBmController {
cnd.and(new Static("now() < hd.bmjzsj")); cnd.and(new Static("now() < hd.bmjzsj"));
cnd.and(new Static("bm.bmlx = 2 ")); cnd.and(new Static("bm.bmlx = 2 "));
cnd.and(new Static("(hd.activityGroupId IS NULL OR u.id IN (SELECT userId FROM activity_user_scope WHERE groupId = hd.activityGroupId))"));
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin"})) { if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin"})) {
cnd.and("u.id", "=", ShiroUtil.getPrincipalProperty("id")); cnd.and("u.id", "=", ShiroUtil.getPrincipalProperty("id"));
@@ -74,8 +74,12 @@ public class LxyHdCon {
CndPlus cnd = CndPlus.create(); CndPlus cnd = CndPlus.create();
cnd.andEx("YEAR(hdcjsj)", "=", year); cnd.andEx("YEAR(hdcjsj)", "=", year);
cnd.andEx("id", "=", hdcd); if (Strings.isNotBlank(hdcd)) {
cnd.andEx("id", "=", pastQuota); cnd.and("id", "=", hdcd);
}
if (Strings.isNotBlank(pastQuota)) {
cnd.and("id", "=", pastQuota);
}
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.where().andLike(searchName, searchKeyword); cnd.where().andLike(searchName, searchKeyword);
} }
@@ -94,9 +98,13 @@ public class LxyHdCon {
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@ViReturn @ViReturn
@RequiresPermissions("zgfw.lxy.hdmange") @RequiresPermissions("zgfw.lxy.hdmange")
public Object doAdd(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files, Lxy_mefp[] mefp) throws IOException { public Object doAdd(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files, Lxy_mefp[] mefp,
@Param(value = "activityGroupId", required = false) Integer activityGroupId,
@Param(value = "activityGroupName", required = false) String activityGroupName) throws IOException {
hd.setHdcjsj(new Date()); hd.setHdcjsj(new Date());
hd.setActivityGroupId(activityGroupId);
hd.setActivityGroupName(Strings.isBlank(activityGroupName) ? "全部教职工" : activityGroupName);
hd = lxyHdService.insert(hd); hd = lxyHdService.insert(hd);
for (Lxy_mefp lxyMefp : mefp) { for (Lxy_mefp lxyMefp : mefp) {
@@ -136,8 +144,16 @@ public class LxyHdCon {
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@ViReturn @ViReturn
@RequiresPermissions("zgfw.lxy.hdmange") @RequiresPermissions("zgfw.lxy.hdmange")
public Object doEdit(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files, String[] delFiles) throws IOException { public Object doEdit(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files, String[] delFiles,
@Param(value = "activityGroupId", required = false) Integer activityGroupId,
@Param(value = "activityGroupName", required = false) String activityGroupName) throws IOException {
hd.setActivityGroupId(activityGroupId);
hd.setActivityGroupName(Strings.isBlank(activityGroupName) ? "全部教职工" : activityGroupName);
lxyHdService.updateIgnoreNull(hd); lxyHdService.updateIgnoreNull(hd);
baseService.dao().update(Lxy_hd.class,
Chain.make("activityGroupId", activityGroupId)
.add("activityGroupName", hd.getActivityGroupName()),
Cnd.where("id", "=", hd.getId()));
for (TempFile file : files) { for (TempFile file : files) {
String rid = R.UU32(); String rid = R.UU32();
@@ -80,6 +80,7 @@ public class LxyMetjController {
if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "SchoolUnionAdmin"})) { if (!ShiroUtil.hasAnyRoles(new String[]{"sysadmin", "SchoolUnionAdmin"})) {
cnd.and(new Static("mefp.ghid in " + vi.getMangeUnionStr())); cnd.and(new Static("mefp.ghid in " + vi.getMangeUnionStr()));
cnd.and(new Static("(hd.activityGroupId IS NULL OR EXISTS (SELECT 1 FROM activity_user_scope aus LEFT JOIN sys_user u ON u.id = aus.userId WHERE aus.groupId = hd.activityGroupId AND u.unionid = mefp.ghid))"));
} }
if (year != null) { if (year != null) {
@@ -141,6 +142,7 @@ public class LxyMetjController {
"FROM\n" + "FROM\n" +
"\tsys_user u\n" + "\tsys_user u\n" +
"\tLEFT JOIN lxy_bm bm ON bm.userid = u.id AND bm.hdid = '" + hdid + "'\n" + "\tLEFT JOIN lxy_bm bm ON bm.userid = u.id AND bm.hdid = '" + hdid + "'\n" +
"\tLEFT JOIN lxy_hd hd ON hd.id = '" + hdid + "'\n" +
"\tLEFT JOIN sys_unit unit ON u.unitid = unit.id\n" + "\tLEFT JOIN sys_unit unit ON u.unitid = unit.id\n" +
"\tLEFT JOIN ry_rygl_gr ry ON ry.userid = u.id\n" + "\tLEFT JOIN ry_rygl_gr ry ON ry.userid = u.id\n" +
"\tLEFT JOIN sys_union un ON unit.unionid = un.id $condition"); "\tLEFT JOIN sys_union un ON unit.unionid = un.id $condition");
@@ -148,6 +150,7 @@ public class LxyMetjController {
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.and("unit.unionid", "=", unionid); cnd.and("unit.unionid", "=", unionid);
cnd.and(new Static("(hd.activityGroupId IS NULL OR u.id IN (SELECT userId FROM activity_user_scope WHERE groupId = hd.activityGroupId))"));
if (sign == 0) { if (sign == 0) {
cnd.and(new Static("u.id not in (SELECT bm.userid from lxy_bm bm WHERE bm.bmlx=2 AND bm.hdid = '" + hdid + "')")); cnd.and(new Static("u.id not in (SELECT bm.userid from lxy_bm bm WHERE bm.bmlx=2 AND bm.hdid = '" + hdid + "')"));
@@ -54,6 +54,16 @@ public class Lxy_hd {
@ColDefine(type = ColType.VARCHAR, width = 30) @ColDefine(type = ColType.VARCHAR, width = 30)
private String hdcd; private String hdcd;
@Column
@Comment("面向对象")
@ColDefine(type = ColType.INT)
private Integer activityGroupId;
@Column
@Comment("面向对象名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String activityGroupName;
@Column @Column
@Comment("活动注意事项") @Comment("活动注意事项")
@ColDefine(type = ColType.TEXT) @ColDefine(type = ColType.TEXT)
@@ -305,8 +305,8 @@ const getGzzllx = async () => {
* 获取疗休养活动 * 获取疗休养活动
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
const getLxyHd = async () => { const getLxyHd = async (year) => {
const { data } = await $.get("/platform/zgfw/lxy/common/getHdList") const { data } = await $.get("/platform/zgfw/lxy/common/getHdList", { year })
return data return data
} }
const getlxyHdCd = async () => { const getlxyHdCd = async () => {
@@ -314,8 +314,8 @@ const getlxyHdCd = async () => {
return data return data
} }
const getNowLxyHd = async () => { const getNowLxyHd = async (year) => {
const { data } = await $.get("/platform/zgfw/lxy/common/getNowHdList") const { data } = await $.get("/platform/zgfw/lxy/common/getNowHdList", { year })
return data return data
} }
@@ -44,6 +44,7 @@ layout("/mobile/platform.html"){
mixins: [mobileMixins, welfareMixins], mixins: [mobileMixins, welfareMixins],
data() { data() {
return { return {
projectId: GetQueryString("projectId"),
chosenAddressId: null chosenAddressId: null
} }
}, },
@@ -56,16 +57,27 @@ layout("/mobile/platform.html"){
} }
}, },
onAdd() { onAdd() {
pjaxReplace("/mobile/welfare/mine/addressEdit") if (this.projectId) {
pjaxReplace("/mobile/welfare/mine/addressEdit?projectId=" + this.projectId)
} else {
pjaxReplace("/mobile/welfare/mine/addressEdit")
}
}, },
onEdit(item, index) { onEdit(item, index) {
pjaxReplace("/mobile/welfare/mine/addressEdit?id=" + item.id) if (this.projectId) {
pjaxReplace("/mobile/welfare/mine/addressEdit?id=" + item.id + "&projectId=" + this.projectId)
} else {
pjaxReplace("/mobile/welfare/mine/addressEdit?id=" + item.id)
}
} }
}, },
async created() { async created() {
this.startLoading() this.startLoading()
await this.selectAddressList() try {
this.closeLoading() await this.selectAddressList()
} finally {
this.closeLoading()
}
} }
}) })
</script> </script>
@@ -101,8 +101,12 @@ layout("/mobile/platform.html"){
duration: 0 duration: 0
}) })
content.userName = content.name content.userName = content.name
const resp = await $.post("/mobile/welfare/mine/doSaveUserAddress", content) let resp = {}
loading.close() try {
resp = await $.post("/mobile/welfare/mine/doSaveUserAddress", content)
} finally {
this.closeToastLoading(loading)
}
if (resp.code === 0) { if (resp.code === 0) {
this.$toast.success(resp.msg) this.$toast.success(resp.msg)
this.$nextTick(() => { this.$nextTick(() => {
@@ -117,14 +121,28 @@ layout("/mobile/platform.html"){
overlay: true, overlay: true,
duration: 0 duration: 0
}) })
const resp = await $.post("/mobile/welfare/mine/deleteAddress", { id: content.id }) let resp = {}
loading.close() try {
resp = await $.post("/mobile/welfare/mine/deleteAddress", { id: content.id })
} finally {
this.closeToastLoading(loading)
}
if (resp.code === 0) { if (resp.code === 0) {
this.$toast.success(resp.msg) this.$toast.success(resp.msg)
this.$nextTick(() => { this.$nextTick(() => {
this.back() this.back()
}) })
} }
},
closeToastLoading(loading) {
if (loading && typeof loading.clear === "function") {
loading.clear()
} else if (loading && typeof loading.close === "function") {
loading.close()
}
if (this.$toast && typeof this.$toast.clear === "function") {
this.$toast.clear()
}
} }
}, },
async created() { async created() {
@@ -93,14 +93,20 @@
var now = new Date().getTime() var now = new Date().getTime()
var hdkssj = moment(row.hdkssj.valueOf()) var hdkssj = moment(row.hdkssj.valueOf())
var hdjssj = moment(row.hdjssj.valueOf()) var hdjssj = moment(row.hdjssj.valueOf())
var bmkssj = moment(row.bmkssj.valueOf())
var bmjzsj = moment(row.bmjzsj.valueOf()) var bmjzsj = moment(row.bmjzsj.valueOf())
if (now < bmjzsj) { if (now < bmkssj) {
return {
class: 'text-info',
name: '报名未开始'
}
} else if (bmkssj <= now && now < bmjzsj) {
return { return {
class: 'text-success', class: 'text-success',
name: '活动报名中' name: '活动报名中'
} }
} else if (bmjzsj < now && now < hdkssj) { } else if (bmjzsj <= now && now < hdkssj) {
return { return {
class: 'text-info', class: 'text-info',
name: '报名已截止' name: '报名已截止'
@@ -142,24 +142,26 @@ layout("/layouts/platform.html"){
function ensureAddressDzOption(options, row) { function ensureAddressDzOption(options, row) {
const provinceTemplate = chengShiList.find((c) => c.label === row.province) const provinceTemplate = chengShiList.find((c) => c.label === row.province)
const cityTemplate = provinceTemplate?.children?.find((c) => c.label === row.city) const cityTemplate = provinceTemplate?.children?.find((c) => c.label === row.city)
if (!provinceTemplate || !cityTemplate) { if (!row.province || !row.city) {
return options return options
} }
const nextOptions = JSON.parse(JSON.stringify(options)) const nextOptions = JSON.parse(JSON.stringify(options))
let province = nextOptions.find((c) => c.label === row.province) let province = nextOptions.find((c) => c.label === row.province)
if (!province) { if (!province) {
province = {...provinceTemplate, children: []} province = provinceTemplate ? {...provinceTemplate, children: []} : {label: row.province, value: row.province, children: []}
nextOptions.push(province) nextOptions.push(province)
} }
let city = province.children.find((c) => c.label === row.city) let city = province.children.find((c) => c.label === row.city)
if (!city) { if (!city) {
city = {...cityTemplate, children: []} city = cityTemplate ? {...cityTemplate, children: []} : {label: row.city, value: row.city, children: []}
province.children.push(city) province.children.push(city)
} }
if (row.county) { if (row.county) {
const countyTemplate = cityTemplate.children?.find((c) => c.label === row.county) const countyTemplate = cityTemplate?.children?.find((c) => c.label === row.county)
if (countyTemplate && !city.children.find((c) => c.label === row.county)) { if (countyTemplate && !city.children.find((c) => c.label === row.county)) {
city.children.push(countyTemplate) city.children.push(countyTemplate)
} else if (!countyTemplate && !city.children.find((c) => c.label === row.county)) {
city.children.push({label: row.county, value: row.areaCode || row.county})
} }
} }
return nextOptions return nextOptions
@@ -209,16 +211,19 @@ layout("/layouts/platform.html"){
) )
}, },
handleChange(val) { handleChange(val) {
if (val) { if (val && val.length > 0) {
let provinceName = "" let provinceName = ""
let cityName = "" let cityName = ""
let countyName = "" let countyName = ""
const province = this.dzOptions.find((c) => c.value === val[0]) const province = this.dzOptions.find((c) => c.value === val[0])
if (!province) return
provinceName = province.label provinceName = province.label
const city = province.children.find((p) => p.value === val[1]) const city = province.children.find((p) => p.value === val[1])
if (!city) return
cityName = city.label cityName = city.label
if (val.length === 3) { if (val.length === 3) {
const county = city.children.find((p) => p.value === val[2]) const county = city.children.find((p) => p.value === val[2])
if (!county) return
countyName = county.label countyName = county.label
this.$set(this.formData, "areaCode", county.value) this.$set(this.formData, "areaCode", county.value)
} else { } else {
@@ -275,17 +280,23 @@ layout("/layouts/platform.html"){
}, },
openEdit(row) { openEdit(row) {
this.dzOptions = ensureAddressDzOption(getWelfareReceiveDzOptions(), row) this.dzOptions = ensureAddressDzOption(getWelfareReceiveDzOptions(), row)
row.addressList = [] const addressList = []
const province = this.dzOptions.find((c) => c.label === row.province) const province = this.dzOptions.find((c) => c.label === row.province)
row.addressList.push(province.value) if (province) {
const city = province.children.find((p) => p.label === row.city) addressList.push(province.value)
row.addressList.push(city.value) }
if (row.county) { const city = province?.children?.find((p) => p.label === row.city)
if (city) {
addressList.push(city.value)
}
if (row.county && city) {
const county = city.children.find((p) => p.label === row.county) const county = city.children.find((p) => p.label === row.county)
row.addressList.push(county.value) if (county) {
addressList.push(county.value)
}
} }
this.formData = { ...row } this.formData = { ...row, addressList }
this.formData.isDefault = this.formData.isDefault ? "1" : "0" this.formData.isDefault = this.formData.isDefault ? "1" : "0"
this.dialogVisible = true this.dialogVisible = true
}, },
@@ -48,7 +48,13 @@ layout("/layouts/platform.html"){
<guava ref="guava"> <guava ref="guava">
<el-card shadow="never"> <el-card shadow="never">
<div class="btn-group tool-button mt5"> <div class="btn-group tool-button mt5">
<el-date-picker placeholder="选择年度" type="year" v-model="pageForm.year" value-format="yyyy"></el-date-picker> <el-date-picker
@change="hdSearch"
placeholder="选择年度"
type="year"
v-model="pageForm.year"
value-format="yyyy"
></el-date-picker>
</div> </div>
<div class="btn-group tool-button mt5"> <div class="btn-group tool-button mt5">
<el-select @change="doSearch" clearable filterable placeholder="请选择活动" v-model="pageForm.hdid"> <el-select @change="doSearch" clearable filterable placeholder="请选择活动" v-model="pageForm.hdid">
@@ -121,8 +127,8 @@ layout("/layouts/platform.html"){
<el-button @click="openView(scope.row)" size="mini" type="primary">查看报名</el-button> <el-button @click="openView(scope.row)" size="mini" type="primary">查看报名</el-button>
<!--# } #--> <!--# } #-->
<!--# if(@shiro.hasRole('H04') || @shiro.hasRole('gh12')){ #--> <!--# if(@shiro.hasRole('H04') || @shiro.hasRole('gh12')){ #-->
<el-button @click="openImport(scope.row)" size="mini" type="primary">导入</el-button> <el-button :disabled="!isSignUpTime(scope.row)" @click="openImport(scope.row)" size="mini" type="primary">导入</el-button>
<el-button @click="openBm2(scope.row)" size="mini" type="primary">报名</el-button> <el-button :disabled="!isSignUpTime(scope.row)" @click="openBm2(scope.row)" size="mini" type="primary">报名</el-button>
<!--# } #--> <!--# } #-->
</template> </template>
</el-table-column> </el-table-column>
@@ -583,6 +589,12 @@ display: -webkit-box;
"file-import": httpVueLoader("/components/plugins/FileImport.vue") "file-import": httpVueLoader("/components/plugins/FileImport.vue")
}, },
methods: { methods: {
isSignUpTime(row) {
const now = new Date().getTime()
const bmkssj = moment(row.bmkssj.valueOf())
const bmjzsj = moment(row.bmjzsj.valueOf())
return bmkssj <= now && now < bmjzsj
},
openImport() { openImport() {
this.importDialog = true this.importDialog = true
this.$nextTick(() => { this.$nextTick(() => {
@@ -750,6 +762,11 @@ display: -webkit-box;
const { data } = await $.get(base + "/platform/zgfw/lxy/fghsh/getBmInfo", { id }) const { data } = await $.get(base + "/platform/zgfw/lxy/fghsh/getBmInfo", { id })
return data return data
}, },
async hdSearch() {
this.lxyHd = await getNowLxyHd(this.pageForm.year)
this.pageForm.hdid = this.lxyHd.length > 0 ? this.lxyHd[0].id : ""
this.doSearch()
},
async openViewXx(row) { async openViewXx(row) {
this.viewData = await this.getLxyBmInfo(row.id) this.viewData = await this.getLxyBmInfo(row.id)
this.pageForm.hdid = row.hdid this.pageForm.hdid = row.hdid
@@ -831,8 +848,8 @@ display: -webkit-box;
}, },
async created() { async created() {
this.unions = await getUnions() this.unions = await getUnions()
this.lxyHd = await getNowLxyHd() this.lxyHd = await getNowLxyHd(this.pageForm.year)
this.pageForm.hdid = this.lxyHd[0].id this.pageForm.hdid = this.lxyHd.length > 0 ? this.lxyHd[0].id : ""
this.pageData() this.pageData()
this.unionList = await getUnions() this.unionList = await getUnions()
this.nationList = nation this.nationList = nation
@@ -43,12 +43,26 @@ layout("/layouts/platform.html"){
<div class="transition-item" v-show="v=='index'"> <div class="transition-item" v-show="v=='index'">
<el-card shadow="never"> <el-card shadow="never">
<div class="btn-group tool-button mt5"> <div class="btn-group tool-button mt5">
<el-date-picker placeholder="选择年度" type="year" v-model="pageForm.year" value-format="yyyy"></el-date-picker> <el-date-picker
@change="hdSearch"
placeholder="选择年度"
type="year"
v-model="pageForm.year"
value-format="yyyy"
></el-date-picker>
</div> </div>
<div class="btn-group tool-button mt5"> <!--<div class="btn-group tool-button mt5">
<el-select class="d-select" clearable filterable placeholder="请选择活动" v-model="pageForm.pastQuota" width="300px"> <el-select class="d-select" clearable filterable placeholder="请选择活动" v-model="pageForm.pastQuota" width="300px">
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in lxyHd"></el-option> <el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in lxyHd"></el-option>
</el-select> </el-select>
</div>-->
<div class="btn-group tool-button mt5">
<el-input
clearable
placeholder="请输入活动名称"
v-model="pageForm.searchKeyword"
@keyup.enter.native="doSearch"
></el-input>
</div> </div>
<!--<div class="btn-group tool-button mt5"> <!--<div class="btn-group tool-button mt5">
<el-select class="d-select" clearable filterable placeholder="请选择场地" <el-select class="d-select" clearable filterable placeholder="请选择场地"
@@ -182,6 +196,31 @@ layout("/layouts/platform.html"){
<el-input maxlength="100" placeholder="请填写活动场地" type="text" v-model="formData.hdcd"></el-input> <el-input maxlength="100" placeholder="请填写活动场地" type="text" v-model="formData.hdcd"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="面向对象" prop="activityGroupId">
<div style="display: flex; justify-content: space-between">
<div style="width: 99%">
<el-select
@change="changeActivity"
clearable
filterable
placeholder="请选择可报名人员范围"
style="width: 99%"
v-model="formData.activityGroupId"
>
<el-option
:key="item.groupId"
:label="item.groupName"
:value="item.groupId"
v-for="item in activityGroupList"
></el-option>
</el-select>
</div>
<div>
<el-button @click="$refs.drawerUserScope.userScopeDialog = true" type="primary">设置</el-button>
</div>
</div>
</el-form-item>
<el-form-item label="报名条件" prop="hdzysx"> <el-form-item label="报名条件" prop="hdzysx">
<el-input <el-input
maxlength="500" maxlength="500"
@@ -316,6 +355,31 @@ layout("/layouts/platform.html"){
<el-input maxlength="100" placeholder="请填写活动场地" type="text" v-model="formData.hdcd"></el-input> <el-input maxlength="100" placeholder="请填写活动场地" type="text" v-model="formData.hdcd"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="面向对象" prop="activityGroupId">
<div style="display: flex; justify-content: space-between">
<div style="width: 99%">
<el-select
@change="changeActivity"
clearable
filterable
placeholder="请选择可报名人员范围"
style="width: 99%"
v-model="formData.activityGroupId"
>
<el-option
:key="item.groupId"
:label="item.groupName"
:value="item.groupId"
v-for="item in activityGroupList"
></el-option>
</el-select>
</div>
<div>
<el-button @click="$refs.drawerUserScope.userScopeDialog = true" type="primary">设置</el-button>
</div>
</div>
</el-form-item>
<el-form-item label="报名条件" prop="hdzysx"> <el-form-item label="报名条件" prop="hdzysx">
<el-input <el-input
maxlength="500" maxlength="500"
@@ -400,6 +464,12 @@ layout("/layouts/platform.html"){
</transition> </transition>
</el-row> </el-row>
</guava> </guava>
<drawer-user-scope
@group_change="getActivityGroup"
ref="drawerUserScope"
:group_id.sync="formData.activityGroupId"
></drawer-user-scope>
</div> </div>
<script> <script>
let E = window.wangEditor let E = window.wangEditor
@@ -408,6 +478,9 @@ layout("/layouts/platform.html"){
const vue = new Vue({ const vue = new Vue({
el: "#app", el: "#app",
components: {
"drawer-user-scope": httpVueLoader("/components/plugins/DrawerUserScope.vue")
},
data() { data() {
let validHdnr = (rule, value, callback) => { let validHdnr = (rule, value, callback) => {
if (!this.formData.hdnr || !dd3s.html2txt(this.formData.hdnr)) { if (!this.formData.hdnr || !dd3s.html2txt(this.formData.hdnr)) {
@@ -432,16 +505,18 @@ layout("/layouts/platform.html"){
tabLoading: false, tabLoading: false,
userLoading: false, userLoading: false,
formData: {}, formData: {},
activityGroupList: [],
tableData: [], tableData: [],
pageForm: { pageForm: {
year: new Date().getFullYear() + "", year: new Date().getFullYear() + "",
searchName: "id", searchName: "name",
searchKeyword: "", searchKeyword: "",
pageNumber: 1, pageNumber: 1,
pageSize: 10, pageSize: 10,
totalCount: 0, totalCount: 0,
pageOrderName: "", pageOrderName: "",
pageOrderBy: "" pageOrderBy: "",
pastQuota: ""
}, },
formRules: { formRules: {
name: [{ required: true, message: "请填写活动名称", trigger: ["blur", "change"] }], name: [{ required: true, message: "请填写活动名称", trigger: ["blur", "change"] }],
@@ -456,7 +531,26 @@ layout("/layouts/platform.html"){
delFiles: [] delFiles: []
} }
}, },
watch: {
"formData.activityGroupId"(val) {
this.changeActivity(val)
}
},
methods: { methods: {
changeActivity(val) {
if (val) {
const group = this.activityGroupList.find((v) => v.groupId === val)
this.$set(this.formData, "activityGroupName", group ? group.groupName : "")
} else {
this.$set(this.formData, "activityGroupName", "全部教职工")
}
},
async getActivityGroup() {
this.activityGroupList = await getActivityGroup()
if (this.formData.activityGroupId) {
this.changeActivity(this.formData.activityGroupId)
}
},
mefpChange() { mefpChange() {
if (this.pastQuota === "") { if (this.pastQuota === "") {
this.unions_ = this.unions.map((v) => { this.unions_ = this.unions.map((v) => {
@@ -564,6 +658,9 @@ layout("/layouts/platform.html"){
doEdit() { doEdit() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (!this.formData.activityGroupId) {
this.formData.activityGroupName = "全部教职工"
}
this.formData.bmkssj = this.formData.bmsj[0] this.formData.bmkssj = this.formData.bmsj[0]
this.formData.bmjzsj = this.formData.bmsj[1] this.formData.bmjzsj = this.formData.bmsj[1]
@@ -646,6 +743,12 @@ layout("/layouts/platform.html"){
if (data.code == 0) { if (data.code == 0) {
data.data.hdsj = [data.data.hdkssj, data.data.hdjssj] data.data.hdsj = [data.data.hdkssj, data.data.hdjssj]
data.data.bmsj = [data.data.bmkssj, data.data.bmjzsj] data.data.bmsj = [data.data.bmkssj, data.data.bmjzsj]
const activityGroupId =
data.data.activityGroupId === undefined ? data.data.activitygroupid : data.data.activityGroupId
if (activityGroupId !== undefined && activityGroupId !== null && activityGroupId !== "") {
data.data.activityGroupId = Number(activityGroupId)
}
data.data.activityGroupName = data.data.activityGroupName || data.data.activitygroupname || "全部教职工"
data.data.mefp.map((m) => { data.data.mefp.map((m) => {
const union = this.unions.find((un) => un.id === m.ghid) const union = this.unions.find((un) => un.id === m.ghid)
m.membercount = union.membercount m.membercount = union.membercount
@@ -718,6 +821,9 @@ layout("/layouts/platform.html"){
doAdd() { doAdd() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (!this.formData.activityGroupId) {
this.formData.activityGroupName = "全部教职工"
}
this.formData.bmkssj = this.formData.bmsj[0] this.formData.bmkssj = this.formData.bmsj[0]
this.formData.bmjzsj = this.formData.bmsj[1] this.formData.bmjzsj = this.formData.bmsj[1]
@@ -813,6 +919,11 @@ layout("/layouts/platform.html"){
this.pageForm.pageNumber = 1 this.pageForm.pageNumber = 1
this.pageData() this.pageData()
}, },
async hdSearch() {
this.pageForm.pastQuota = ""
this.lxyHd = await getLxyHd(this.pageForm.year)
this.doSearch()
},
pageOrder(column) { pageOrder(column) {
//按字段排序 //按字段排序
this.pageForm.pageOrderName = column.prop this.pageForm.pageOrderName = column.prop
@@ -856,7 +967,8 @@ layout("/layouts/platform.html"){
async created() { async created() {
const unions_resp = await $.get(loc() + "/getUnions") const unions_resp = await $.get(loc() + "/getUnions")
this.unions = unions_resp.data this.unions = unions_resp.data
this.lxyHd = await getLxyHd() await this.getActivityGroup()
this.lxyHd = await getLxyHd(this.pageForm.year)
this.lxyHdCd = await getlxyHdCd() this.lxyHdCd = await getlxyHdCd()
this.pageData() this.pageData()
} }
@@ -10,7 +10,13 @@ layout("/layouts/platform.html"){
<guava ref="guava"> <guava ref="guava">
<el-card shadow="never"> <el-card shadow="never">
<div class="btn-group tool-button mt5"> <div class="btn-group tool-button mt5">
<el-date-picker placeholder="选择年度" type="year" v-model="pageForm.year" value-format="yyyy"></el-date-picker> <el-date-picker
@change="hdSearch"
placeholder="选择年度"
type="year"
v-model="pageForm.year"
value-format="yyyy"
></el-date-picker>
</div> </div>
<div class="btn-group tool-button mt5"> <div class="btn-group tool-button mt5">
<el-select @change="pageData" clearable filterable placeholder="请选择活动" v-model="pageForm.hdid"> <el-select @change="pageData" clearable filterable placeholder="请选择活动" v-model="pageForm.hdid">
@@ -547,6 +553,11 @@ layout("/layouts/platform.html"){
this.pageForm.pageNumber = 1 this.pageForm.pageNumber = 1
this.pageData() this.pageData()
}, },
async hdSearch() {
this.lxyHd = await getLxyHd(this.pageForm.year)
this.pageForm.hdid = this.lxyHd.length > 0 ? this.lxyHd[0].id : ""
this.doSearch()
},
doSearchGh() { doSearchGh() {
this.tabKey = new Date().getTime() this.tabKey = new Date().getTime()
this.pageForm.pageNumber = 1 this.pageForm.pageNumber = 1
@@ -593,8 +604,8 @@ layout("/layouts/platform.html"){
}, },
async created() { async created() {
this.unions = await getUnions() this.unions = await getUnions()
this.lxyHd = await getLxyHd() this.lxyHd = await getLxyHd(this.pageForm.year)
this.pageForm.hdid = this.lxyHd[0].id this.pageForm.hdid = this.lxyHd.length > 0 ? this.lxyHd[0].id : ""
this.pageData() this.pageData()
} }
}) })
@@ -99,14 +99,20 @@
var now = new Date().getTime() var now = new Date().getTime()
var hdkssj = moment(row.hdkssj.valueOf()) var hdkssj = moment(row.hdkssj.valueOf())
var hdjssj = moment(row.hdjssj.valueOf()) var hdjssj = moment(row.hdjssj.valueOf())
var bmkssj = moment(row.bmkssj.valueOf())
var bmjzsj = moment(row.bmjzsj.valueOf()) var bmjzsj = moment(row.bmjzsj.valueOf())
if (now < bmjzsj) { if (now < bmkssj) {
return {
class: 'text-info',
name: '报名未开始'
}
} else if (bmkssj <= now && now < bmjzsj) {
return { return {
class: 'text-success', class: 'text-success',
name: '活动报名中' name: '活动报名中'
} }
} else if (bmjzsj < now && now < hdkssj) { } else if (bmjzsj <= now && now < hdkssj) {
return { return {
class: 'text-info', class: 'text-info',
name: '报名已截止' name: '报名已截止'