commit
This commit is contained in:
@@ -327,11 +327,10 @@ function createLoading(text = '加载中...') {
|
||||
})
|
||||
}
|
||||
|
||||
function getBaseSubAppPath() {
|
||||
const pathname = window.location.pathname;
|
||||
function getBaseSubAppPath(pathname = window.location.pathname) {
|
||||
const startIndex = pathname.indexOf('/platform');
|
||||
if (startIndex === -1) {
|
||||
throw new Error('Target path not found in URL');
|
||||
return pathname
|
||||
}
|
||||
return pathname.substring(startIndex);
|
||||
}
|
||||
@@ -341,7 +340,7 @@ function getFullSubAppPath() {
|
||||
const search = window.location.search; // 包含 ?appId=...
|
||||
const startIndex = pathname.indexOf('/platform');
|
||||
if (startIndex === -1) {
|
||||
throw new Error('Target path not found in URL');
|
||||
return pathname
|
||||
}
|
||||
return pathname.substring(startIndex) + search;
|
||||
}
|
||||
|
||||
@@ -309,6 +309,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
},
|
||||
methods: {
|
||||
menuSelect(index, indexPath) {
|
||||
debugger
|
||||
try {
|
||||
const app = JSON.parse(window.sessionStorage.getItem("zhgh_sub_app"))
|
||||
window.sessionStorage.setItem("zhgh_sub_app_left_menu_active_index-" + app.id, index)
|
||||
@@ -318,6 +319,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
},
|
||||
// 获取菜单
|
||||
getMenus(appId) {
|
||||
debugger
|
||||
if (!appId) return
|
||||
this.$axios.post("/platform/sys/user/subAppMenus", {appId}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
@@ -332,6 +334,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
|
||||
// 设置应用信息
|
||||
setAppInfo(app) {
|
||||
debugger
|
||||
if (app) {
|
||||
// 储存到缓存
|
||||
window.sessionStorage.setItem("zhgh_sub_app", JSON.stringify(app))
|
||||
@@ -347,6 +350,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
},
|
||||
// 菜单回显
|
||||
echoMenus() {
|
||||
debugger
|
||||
try {
|
||||
const app = JSON.parse(window.sessionStorage.getItem("zhgh_sub_app"))
|
||||
this.activeMenuIndex = window.sessionStorage.getItem("zhgh_sub_app_left_menu_active_index-" + app.id)
|
||||
@@ -367,6 +371,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
|
||||
// 地址选中
|
||||
hrefSelect() {
|
||||
debugger
|
||||
function findMenuPath(menus, targetHref) {
|
||||
function search(items, path) {
|
||||
for (const item of items) {
|
||||
@@ -385,7 +390,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
return search(menus, []);
|
||||
}
|
||||
|
||||
const result = findMenuPath(this.menus, getBaseSubAppPath())
|
||||
const result = findMenuPath(this.menus, window.location.pathname)
|
||||
if(result){
|
||||
this.activeMenuIndex = result[result.length-1]['id']
|
||||
this.openedMenus = result.map(v=>v.id)
|
||||
@@ -399,6 +404,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
|
||||
// 默认选中
|
||||
defaultSelect() {
|
||||
debugger
|
||||
// 查找第一个有href的子菜单
|
||||
function findFirstChildWithHref(menus) {
|
||||
for (const menu of menus) {
|
||||
@@ -424,22 +430,33 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
}
|
||||
|
||||
const result = findFirstChildWithHref(this.menus)
|
||||
debugger
|
||||
if (result) {
|
||||
this.activeMenuIndex = result.menu.id
|
||||
this.openedMenus = result.parentIds
|
||||
this.$nextTick(() => {
|
||||
this.menuSelect(this.activeMenuIndex, this.openedMenus)
|
||||
// 使用pjax跳转
|
||||
commonUtil.pjaxPush(result.menu.href)
|
||||
commonUtil.pjaxPush(getBaseSubAppPath(result.menu.href))
|
||||
|
||||
/*const tempLink = document.createElement('a')
|
||||
tempLink.href = result.menu.href
|
||||
tempLink.setAttribute('data-pjax', '')
|
||||
tempLink.style.display = 'none'
|
||||
document.body.appendChild(tempLink)
|
||||
tempLink.click()
|
||||
document.body.removeChild(tempLink)*/
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
init() {
|
||||
debugger
|
||||
// 页面加载时获取到正确的菜单
|
||||
const pathname = getFullSubAppPath()
|
||||
const pathname = window.location.pathname
|
||||
if (!pathname.startsWith("/platform/v4/subApp")) {
|
||||
this.$axios.post("/platform/sys/user/rootMenuByPath", {pathname}).then((res) => {
|
||||
const path = getFullSubAppPath()
|
||||
this.$axios.post("/platform/sys/user/rootMenuByPath", {pathname: path}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.setAppInfo(res.data)
|
||||
this.getMenus(res.data?.id)
|
||||
|
||||
@@ -178,7 +178,8 @@ const todo = {
|
||||
// 处理任务
|
||||
onView(task) {
|
||||
const {taskId, taskKey, instanceId, businessNo, formKey} = task;
|
||||
|
||||
this.$toast("暂未开通从当前地址点击查看!");
|
||||
return;
|
||||
if (!formKey) {
|
||||
this.$toast("当前流程没有配置地址");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user