提交 4d1d99af 编写于 作者: ibizdev's avatar ibizdev

chitanda 发布系统代码

上级 00bd469b
......@@ -39,7 +39,6 @@ export default class AppActionBar extends Vue {
* @memberof AppActionBar
*/
public handleClick($event: any) {
console.log(this.items);
this.$emit("itemClick", $event);
}
}
......
......@@ -116,7 +116,7 @@ export default {
},
matches(pattern, name) {
if (Array.isArray(pattern)) {
return pattern.indexOf(name) > -1;
return pattern.findIndex(item => item.fullPath === name) !== -1;
} else if (typeof pattern === 'string') {
return pattern.split(',').indexOf(name) > -1;
} else if (this.isRegExp(pattern)) {
......
<template>
<div class="ibiz-page-tag" v-if="$appService.navHistory.historyPathList > 0">
<div class="ibiz-page-tag" v-if="appService.navHistory.metaList.length > 0">
<div class="move-btn move-left" @click="leftMove">
<icon type="ios-arrow-back" />
</div>
<div ref="scrollBody" class="tags-body">
<div ref="scrollChild" class="tags-container" :style="{left: styleLeft + 'px'}">
<transition-group name="tags-transition">
<template v-for="(page, index) of $appService.navHistory.historyPathList">
<Tag ref="tagElement" :key="index" :class="isActive(page) ? 'tag-is-active' : ''" :name="index" closable @click.native="changePage(page)" @on-close="onClose(page)">
<template v-for="(meta, index) of appService.navHistory.metaList">
<Tag ref="tagElement" :key="index" :class="isActive(appService.navHistory.historyList[index]) ? 'tag-is-active' : ''" :name="index" closable @click.native="changePage(appService.navHistory.historyList[index])" @on-close="onClose(appService.navHistory.historyList[index])">
<div class="tag-text">
<div :title="getCaption(page.meta.caption, page.meta.info)" style="max-width: 300px;">
<i v-if="page.meta.iconCls && !Object.is(page.meta.iconCls, '')" :class="page.meta.iconCls"></i>
<img v-else :src="page.meta.imgPath" class="text-icon" />
&nbsp;{{getCaption(page.meta.caption, page.meta.info)}}
<div :title="getCaption(meta.caption, meta.info)" style="max-width: 300px;">
<i v-if="meta.iconCls && !Object.is(meta.iconCls, '')" :class="meta.iconCls"></i>
<img v-else :src="meta.imgPath" class="text-icon" />
&nbsp;{{getCaption(meta.caption, meta.info)}}
</div>
</div>
</Tag>
......@@ -39,10 +39,13 @@
<script lang="ts">
import { Vue, Component, Provide, Prop, Watch } from 'vue-property-decorator';
import { Environment } from '../../environments/environment';
import { AppService } from '../../studio-core/service/app-service/AppService';
@Component({})
export default class TabPageExp extends Vue {
protected appService: AppService = new AppService();
@Provide()
public styleLeft: number = 0;
......@@ -116,11 +119,7 @@ export default class TabPageExp extends Vue {
* @memberof TabPageExp
*/
public onClose(page: any) {
if (!page) {
this.$appService.navHistory.remove(page);
this.gotoPage();
}
const appview = this.$store.getters['viewaction/getAppView'](page.viewtag);
const appview = this.$store.getters['viewaction/getAppView'](this.appService.navHistory.viewTagMap.get(page.fullPath));
if (appview && appview.viewdatachange) {
const title: any = this.$t('app.tabpage.sureclosetip.title');
const content: any = this.$t('app.tabpage.sureclosetip.content');
......@@ -128,15 +127,15 @@ export default class TabPageExp extends Vue {
title: title,
content: content,
onOk: () => {
this.$appService.navHistory.remove(page);
this.gotoPage();
this.appService.navHistory.remove(page);
this.gotoPage(page);
},
onCancel: () => {
}
});
} else {
this.$appService.navHistory.remove(page);
this.gotoPage();
this.appService.navHistory.remove(page);
this.gotoPage(page);
}
}
......@@ -147,7 +146,7 @@ export default class TabPageExp extends Vue {
* @memberof TabPageExp
*/
public isClose() {
if (this.$appService.navHistory.historyList.length > 1) {
if (this.appService.navHistory.historyList.length > 1) {
return true;
}
return false;
......@@ -195,7 +194,7 @@ export default class TabPageExp extends Vue {
if(this.$route.meta && (!Object.is(this.$route.meta.caption, caption))) {
return;
}
this.$store.commit("setCurPageCaption", { route: this.$route, caption: title, info: info });
this.appService.navHistory.setCaption({ route: this.$route, caption: title, info: info });
setTimeout(() => {
this.moveToView(this.$route);
}, 1);
......@@ -208,7 +207,7 @@ export default class TabPageExp extends Vue {
* @memberof TabPageExp
*/
public moveToView(page: any) {
const pages: any[] = this.$appService.navHistory.historyList;
const pages: any[] = this.appService.navHistory.historyList;
let leftWidth: number = 0;
this.$nextTick(() => {
pages.forEach((page, index) => {
......@@ -252,10 +251,10 @@ export default class TabPageExp extends Vue {
*/
public doTagAction(name: string) {
if (Object.is(name, 'closeAll')) {
this.$appService.navHistory.reset();
this.appService.navHistory.reset();
this.gotoPage();
} else if (Object.is(name, 'closeOther')) {
this.$appService.navHistory.removeOther(this.$route);
this.appService.navHistory.removeOther(this.$route);
this.moveToView(this.$route);
}
}
......
......@@ -9,7 +9,6 @@ Vue.use(Router);
const appService = new AppService();
const router = new Router({
routes: [
{
......
import { SingletonMode } from '../../decorators/SingletonMode';
import { AppContextStoreBase } from './AppContextStoreBase';
/**
......@@ -7,6 +8,7 @@ import { AppContextStoreBase } from './AppContextStoreBase';
* @class AppContextStore
* @extends {AppContextStoreBase}
*/
@SingletonMode()
export class AppContextStore extends AppContextStoreBase {
}
\ No newline at end of file
import { SingletonMode } from '../../decorators/SingletonMode';
import { AppNavHistoryBase } from './AppNavHistoryBase';
/**
......@@ -7,6 +8,7 @@ import { AppNavHistoryBase } from './AppNavHistoryBase';
* @class AppNavHistory
* @extends {AppNavHistoryBase}
*/
@SingletonMode()
export class AppNavHistory extends AppNavHistoryBase {
}
\ No newline at end of file
import { Util } from '@/utils';
import { AppContextStore } from '../app-context-store/AppContextStore';
import { UIStateService } from '../UIStateService';
......@@ -33,6 +34,14 @@ export class AppNavHistoryBase {
*/
public readonly historyList: any[] = [];
/**
* 参数列表
*
* @type {string[]}
* @memberof AppNavHistoryBase
*/
public readonly metaList: string[] = [];
/**
* 视图标识
*
......@@ -43,6 +52,9 @@ export class AppNavHistoryBase {
/**
* 导航缓存,忽略判断的导航参数正则
*
* @type {RegExp}
* @memberof AppNavHistoryBase
*/
public readonly navIgnoreParameters: RegExp = new RegExp(/(srftabactivate|srftreeexpactivate)/);
......@@ -95,7 +107,11 @@ export class AppNavHistoryBase {
*/
public add(page: any): void {
if (this.findHistoryIndex(page) === -1) {
if (this.uiStateService.layoutState.styleMode === 'DEFAULT' && page?.matched?.length === 1) {
return;
}
this.historyList.push(page);
this.metaList.push(Util.deepCopy(page.meta));
}
}
......@@ -109,6 +125,7 @@ export class AppNavHistoryBase {
const i = this.findHistoryIndex(page);
if (i !== -1) {
this.historyList.splice(i, 1);
this.metaList.splice(i, 1);
}
}
......@@ -119,6 +136,7 @@ export class AppNavHistoryBase {
*/
public reset(): void {
this.historyList.splice(0, this.historyList.length);
this.metaList.splice(0, this.metaList.length);
}
/**
......@@ -133,8 +151,8 @@ export class AppNavHistoryBase {
if (i === -1) {
return false;
}
const page = this.historyList[i];
Object.assign(page.meta, { caption, info });
const meta = this.metaList[i];
Object.assign(meta, { caption, info });
return true;
}
......@@ -153,7 +171,6 @@ export class AppNavHistoryBase {
}
const page = this.historyList[i];
this.viewTagMap.set(page.fullPath, tag);
console.log(this.viewTagMap);
return true;
}
......@@ -167,8 +184,12 @@ export class AppNavHistoryBase {
const i = this.findHistoryIndex(page);
if (i !== -1) {
const page = this.historyList[i];
const meta = this.metaList[i];
this.historyList.splice(0, this.historyList.length);
this.metaList.splice(0, this.metaList.length);
this.historyList.push(page);
this.metaList.push(meta);
}
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册