This commit is contained in:
@jyuhsin
2025-09-22 17:32:19 +08:00
parent ad8b47358a
commit 78d82137e4
7 changed files with 56 additions and 34 deletions
@@ -146,10 +146,10 @@ public class SysHomeController {
@At
@SaCheckLogin
@ApiOperation("电脑端快速入口")
@ApiOperation("电脑端推荐应用")
@Ok("json")
public Result listQuickEntry(String platform) {
List<Sys_menu> list = sysMenuService.query(Cnd.where(Sys_menu::getIsQuickEntry, "=", 1)
public Result listRecommendApp(String platform) {
List<Sys_menu> list = sysMenuService.query(Cnd.where(Sys_menu::getIsRecommendApp, "=", 1)
.and(Sys_menu::getDisabled, "=", 0)
.and(Sys_menu::getShowit, "=", 1)
.and(Sys_menu::getPlatform, "=", platform)
@@ -38,6 +38,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@IocBean
@At("/platform/sys/menu")
@@ -422,11 +423,16 @@ public class SysMenuController {
@At
@Ok("json")
@SaCheckPermission("sys.manager.menu")
@ApiOperation("更新快捷入口")
public Result updateQuickEntry(@Param("menuIds") String[] menuIds, String platform) {
sysMenuService.update(Chain.make("isQuickEntry", 0), Cnd.where("id", "is not", null).and("platform", "=", platform));
@ApiOperation("更新首页推荐应用或服务")
public Result updateRecommendSetting(@Param("menuIds") String[] menuIds, String platform, String type) {
String column = "";
switch (type) {
case "app" -> column = "isRecommendApp";
case "service" -> column = "isRecommendService";
}
sysMenuService.update(Chain.make(column, 0), Cnd.where("id", "is not", null).and("platform", "=", platform));
if (ArrayUtil.isNotEmpty(menuIds)) {
sysMenuService.update(Chain.make("isQuickEntry", 1), Cnd.where("id", "in", menuIds).and("platform", "=", platform));
sysMenuService.update(Chain.make(column, 1), Cnd.where("id", "in", menuIds).and("platform", "=", platform));
}
return Result.success();
}
@@ -121,11 +121,17 @@ public class Sys_menu extends BaseModel implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 32)
private String moduleId;
@Column
@Comment("是否是推荐应用")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isRecommendApp;
@Column
@Comment("是否是快捷入口")
@Comment("是否是推荐服务")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isQuickEntry;
private Boolean isRecommendService;
//按钮权限
private List<Sys_menu> buttons;
@@ -280,8 +280,8 @@ layout("/layouts/platform.html"){
}
},
methods: {
listQuickEntry() {
this.$axios.post("/platform/home/listQuickEntry").then((res) => {
listRecommendApp() {
this.$axios.post("/platform/home/listRecommendApp").then((res) => {
if (res.code === 0) {
this.quickEntries = res.data
}
@@ -299,7 +299,7 @@ layout("/layouts/platform.html"){
}
},
created() {
this.listQuickEntry()
this.listRecommendApp()
this.listActivity()
this.listProcessInstance()
}
@@ -44,8 +44,11 @@ layout("/layouts/platform.html"){
<table-tool>
<el-button @click="$refs.basicFormRef.onOpen(null,pageForm.platform)" size="small" type="primary" icon="el-icon-plus">新建菜单</el-button>
<el-button @click="$refs.sortRef.onOpen(pageForm.platform)" size="small" type="primary" icon="el-icon-sort">排序</el-button>
<el-button @click="$refs.quickEntryRef.onOpen(pageForm.platform)" size="small" type="primary" icon="el-icon-monitor">
首页快速入口
<el-button @click="$refs.recommendSettingRef.onOpen(pageForm.platform, 'app')" size="small" type="primary" icon="el-icon-monitor">
首页推荐应用
</el-button>
<el-button @click="$refs.recommendSettingRef.onOpen(pageForm.platform, 'service')" size="small" type="primary" icon="el-icon-monitor">
首页推荐服务
</el-button>
</table-tool>
<el-table
@@ -120,7 +123,7 @@ layout("/layouts/platform.html"){
</template>
</el-table-column>
</el-table>
<!-- 右键菜单 -->
<ul v-show="menuVisible" class="context-menu" :style="{left: menuLeft + 'px', top: menuTop + 'px'}">
<li @click="handleAddMenu(currentRow)">新建菜单</li>
@@ -128,20 +131,20 @@ layout("/layouts/platform.html"){
<li @click="handleEdit(currentRow)">编辑</li>
<li @click="handleDelete(currentRow)">删除</li>
</ul>
</el-card>
<basic-form ref="basicFormRef" @refresh="loadChildByExpandedKeys"></basic-form>
<permission-form ref="permissionFormRef" @load-child="loadChildByExpandedKeys"></permission-form>
<sort ref="sortRef" @refresh="doSearch"></sort>
<quick-entry ref="quickEntryRef" @refresh="doSearch"></quick-entry>
<recommend-setting ref="recommendSettingRef" @refresh="doSearch"></recommend-setting>
</div>
<script>
<!--#include("permissionForm.js"){}#-->
<!--#include("basicForm.js"){}#-->
<!--#include("sort.js"){}#-->
<!--#include("quickEntry.js"){}#-->
<!--#include("recommendSetting.js"){}#-->
new Vue({
el: "#app",
dicts: ["SYS_MENU_PLATFORM"],
@@ -149,7 +152,7 @@ layout("/layouts/platform.html"){
"basic-form": SYS_MENU_BASIC_FORM_COMPONENT,
"permission-form": SYS_MENU_PERMISSION_FORM_COMPONENT,
sort: SYS_MENU_SORT_COMPONENT,
"quick-entry": SYS_MENU_QUICK_ENTRY_COMPONENT
"recommend-setting": SYS_MENU_RECOMMEND_SETTING_COMPONENT
},
data: function () {
@@ -161,7 +164,7 @@ layout("/layouts/platform.html"){
// 保存展开状态的数组
expandedRowKeysRenew: [],
tableTreeRefreshTool: [],
// 右键打开菜单相关
currentRow: null,
menuVisible: false,
@@ -177,7 +180,7 @@ layout("/layouts/platform.html"){
// 阻止浏览器默认菜单
event.preventDefault();
this.currentRow = row;
this.menuVisible = true;
this.$nextTick(() => {
const menu = this.$el.querySelector('.context-menu');
@@ -1,6 +1,6 @@
const SYS_MENU_QUICK_ENTRY_COMPONENT = {
const SYS_MENU_RECOMMEND_SETTING_COMPONENT = {
template: `
<el-dialog title="快速入口" :visible.sync="dialogVisible" width="50%">
<el-dialog title="推荐配置" :visible.sync="dialogVisible" width="50%">
<el-row :gutter="20">
<el-col :span="12">
<el-tree ref="menuTree"
@@ -46,12 +46,15 @@ const SYS_MENU_QUICK_ENTRY_COMPONENT = {
},
checkedNodes: [],
checkedKeys: []
checkedKeys: [],
type: '',
}
},
methods: {
onOpen(platform) {
onOpen(platform, type) {
this.platform = platform
this.type = type
this.dialogVisible = true
this.listTree()
},
@@ -74,12 +77,15 @@ const SYS_MENU_QUICK_ENTRY_COMPONENT = {
setTreeDisabled(data) {
data.forEach((item) => {
if (item.isQuickEntry) {
if ((this.type === 'service' && item.isRecommendService) || (this.type === 'app' && item.isRecommendApp)) {
this.checkedKeys.push(item.id)
}
if (!item.href && item.type === "menu") {
if (!item.href && item.type === "menu" && this.type === 'service') {
item.disabled = true
}
if (this.type === 'app') {
delete item.children
}
if (item.children && item.children.length) {
this.setTreeDisabled(item.children)
}
@@ -95,9 +101,10 @@ const SYS_MENU_QUICK_ENTRY_COMPONENT = {
type: "warning"
}).then(() => {
this.$axios
.post("/platform/sys/menu/updateQuickEntry", {
.post("/platform/sys/menu/updateRecommendSetting", {
menuIds: JSON.stringify(this.checkedNodes.map((item) => item.id)),
platform: this.platform
platform: this.platform,
type: this.type
})
.then((resp) => {
if (resp.code === 0) {
@@ -67,8 +67,8 @@ const home = {
}
},
methods: {
listQuickEntry() {
this.$axios.post("/platform/home/listQuickEntry", { platform: "H5" }).then((res) => {
listRecommendApp() {
this.$axios.post("/platform/home/listRecommendApp", { platform: "H5" }).then((res) => {
if (res.code === 0) {
this.quickEntries = res.data
}
@@ -91,7 +91,7 @@ const home = {
}
},
created() {
this.listQuickEntry()
this.listRecommendApp()
this.listActivity()
},
style: /*language=CSS*/ `