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