This commit is contained in:
=
2026-06-22 10:59:52 +08:00
parent 67bbe336e7
commit b694b69549
8 changed files with 40 additions and 25 deletions
@@ -148,6 +148,7 @@ public class SysHomeController {
List<Sys_menu> menus = sysUserService.getMenus(SecurityUtil.getUserId());
List<String> allMenuIds = menus.stream().map(Sys_menu::getId).toList();
List<Sys_menu> sysMenus = list.stream()
.filter(m -> allMenuIds.contains(m.getId()))
.sorted(Comparator.comparing(Sys_menu::getLocation, Comparator.nullsLast(Integer::compareTo))
.thenComparing(Sys_menu::getId))
.toList();
@@ -166,8 +167,11 @@ public class SysHomeController {
);
List<Sys_menu> menus = sysUserService.getMenus(SecurityUtil.getUserId());
List<String> allMenuIds = menus.stream().map(Sys_menu::getId).toList();
//List<Sys_menu> sysMenus = list.stream().filter(m -> allMenuIds.contains(m.getId())).sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
List<Sys_menu> sysMenus = list.stream().sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
List<Sys_menu> sysMenus = list.stream()
.filter(m -> allMenuIds.contains(m.getId()))
.sorted(Comparator.comparing(Sys_menu::getLocation, Comparator.nullsLast(Integer::compareTo))
.thenComparing(Sys_menu::getId))
.toList();
return Result.success(sysMenus);
}
@@ -125,7 +125,7 @@ public class CommonController {
@At
@SaCheckLogin
@ApiOperation("单位列表")
public Result unitOptions(String unionId) {
public Result unitOptions(String unionId, Integer unitLevel) {
Sql sql = Sqls.create("""
SELECT
unit.*,
@@ -138,6 +138,8 @@ public class CommonController {
Cnd cnd = Cnd.NEW();
cnd.andEX("unit.unionId", "=", unionId);
cnd.and("unit.unitTypeCode", "=", "1");
// unitLevel 为可选筛选条件,不传时保持原有单位列表查询逻辑。
cnd.andEX("unit.unitLevel", "=", unitLevel);
cnd.asc("unit.unitcode");
sql.setCondition(cnd);
List<NutMap> unitList = sysUserService.listMap(sql);
@@ -329,7 +329,7 @@ public class TrainSignUpManageController {
public Result selectUnitAndClub() {
List<NutMap> result = new ArrayList<>();
java.util.Set<String> optionKeys = new java.util.HashSet<>();
List<Sys_unit> unitList = dao.query(Sys_unit.class, Cnd.where(Sys_unit::getUnitLevel, "=", 2).asc(Sys_unit::getUnitcode));
List<Sys_unit> unitList = dao.query(Sys_unit.class, Cnd.where(Sys_unit::getUnitLevel, "=", 3).asc(Sys_unit::getUnitcode));
for (Sys_unit unit : unitList) {
addSelectOption(result, optionKeys, unit.getId(), unit.getName(), "unit");
}
@@ -241,10 +241,15 @@ public class ActivityWorksCollectionManageController {
@SaCheckPermission(value = {"activity.workscollection.manage", "activity.workscollection.new"}, mode = SaMode.OR)
public Result findOne(@Valid String id) {
Activity_works_collection worksCollection = dao.fetch(Activity_works_collection.class, id);
if (worksCollection == null) {
return Result.error("活动不存在");
}
dao.fetchLinks(worksCollection, "subjectTypes");
worksCollection.getSubjectTypes().forEach(item -> {
dao.fetchLinks(item, "worksTypes");
});
if (worksCollection.getSubjectTypes() != null) {
worksCollection.getSubjectTypes().forEach(item -> {
dao.fetchLinks(item, "worksTypes");
});
}
return Result.success(worksCollection);
}
@@ -24,10 +24,10 @@ const businessTool = {
}
})
},
listUnit(unionId = null) {
listUnit(unionId = null, unitLevel = null) {
return commonUtil
.axiosService()
.post("/open/common/unitOptions", {unionId})
.post("/open/common/unitOptions", {unionId, unitLevel})
.then((resp) => {
if (resp.code === 0) {
return resp.data
@@ -1034,7 +1034,7 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
this.clubOptions.map((v) => {
v.name = v.clubName
})
const units = await this.$businessTool.listUnit()
const units = await this.$businessTool.listUnit(null, 3)
this.unitOptions = this.clubOptions.concat(units)
} finally {
this.formLoading = false
@@ -1285,7 +1285,7 @@
this.clubOptions.map((v) => {
v.name = v.clubName
})
const units = await this.$businessTool.listUnit()
const units = await this.$businessTool.listUnit(null, 3)
this.unitOptions = this.clubOptions.concat(units)
}
}
@@ -5,7 +5,7 @@ layout("/layouts/platform.html"){
<style></style>
<div id="app" v-cloak>
<guava ref="guava">
<guava ref="guava" v-model="guavaIndex">
<template>
<el-card shadow="never">
<search @search="doSearch">
@@ -386,6 +386,7 @@ layout("/layouts/platform.html"){
formOptionsPromise: null,
unitOptions: [],
clubOptions: [],
guavaIndex: window.location.pathname.toLowerCase() === "/platform/activity/workscollection/new" ? "edit" : "index",
}
},
components: {
@@ -409,6 +410,7 @@ layout("/layouts/platform.html"){
},
afterSaveSuccess() {
this.formVisible = false
this.guavaIndex = "index"
if (this.isNewPage()) {
this.backToManage()
} else {
@@ -416,14 +418,14 @@ layout("/layouts/platform.html"){
this.$refs.guava.index()
}
},
initNewPage() {
async initNewPage() {
const params = new URLSearchParams(window.location.search)
const mode = params.get("mode")
const id = params.get("id")
if (mode === "edit" && id) {
this.openEdit(id, true)
await this.openEdit(id, true)
} else {
this.openAdd()
await this.openAdd()
}
},
async getActivityGroup() {
@@ -454,7 +456,7 @@ layout("/layouts/platform.html"){
this.formOptionsPromise = Promise.all([
this.getActivityGroup(),
this.getClubsByRole(),
this.$businessTool.listUnit()
this.$businessTool.listUnit(null, 3)
]).then(([activityGroupList, clubOptions, units]) => {
this.activityGroupList = activityGroupList
this.clubOptions = clubOptions
@@ -501,7 +503,7 @@ layout("/layouts/platform.html"){
this.copyTemplateName = ""
await this.loadFormOptions()
this.formVisible = true
this.$refs.guava.edit()
this.guavaIndex = "edit"
this.$nextTick(() => {
this.formData = {
nbCount: 0,
@@ -574,10 +576,14 @@ layout("/layouts/platform.html"){
},
async openEdit(id, copyTemplateMode = false) {
this.copyTemplateMode = !!copyTemplateMode
const [resp] = await Promise.all([
this.$axios.post("/platform/activity/worksCollection/manage/findOne", {id}),
this.loadFormOptions()
])
this.loadFormOptions().catch(() => {
this.$message.warning("下拉数据加载失败,请刷新后重试")
})
const resp = await this.$axios.post("/platform/activity/worksCollection/manage/findOne", {id})
if (!resp || resp.code !== 0 || !resp.data) {
this.$message.warning(resp && resp.msg ? resp.msg : "活动数据不存在")
return
}
this.formVisible = true
this.formData = resp.data
if (this.copyTemplateMode) {
@@ -592,12 +598,11 @@ layout("/layouts/platform.html"){
// this.formData.nbTime = [this.formData.nbStartDateTime, this.formData.nbEndDateTime]
this.$set(this.formData, "nbTime", [this.formData.nbStartDateTime, this.formData.nbEndDateTime])
}
this.$nextTick(() => {
this.$refs.guava.edit()
})
this.guavaIndex = "edit"
},
close() {
this.formVisible = false
this.guavaIndex = "index"
if (this.isNewPage()) {
this.backToManage()
} else {
@@ -734,7 +739,6 @@ layout("/layouts/platform.html"){
},
async created() {
if (this.isNewPage()) {
await this.loadFormOptions()
this.$nextTick(() => {
this.initNewPage()
})