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

lxm1993 发布系统代码 [TrainSys,网页端]

上级 98b3e238
......@@ -13,13 +13,13 @@
"dependencies": {
"@floating-ui/dom": "^1.0.11",
"@ibiz-template/command": "^0.0.1-beta.50",
"@ibiz-template/controller": "^0.0.1-beta.74",
"@ibiz-template/core": "^0.0.1-beta.74",
"@ibiz-template/model": "^0.0.1-beta.74",
"@ibiz-template/runtime": "^0.0.1-beta.74",
"@ibiz-template/service": "^0.0.1-beta.74",
"@ibiz-template/theme": "^0.0.1-beta.74",
"@ibiz-template/vue-util": "^0.0.1-beta.74",
"@ibiz-template/controller": "^0.0.1-beta.75",
"@ibiz-template/core": "^0.0.1-beta.75",
"@ibiz-template/model": "^0.0.1-beta.75",
"@ibiz-template/runtime": "^0.0.1-beta.75",
"@ibiz-template/service": "^0.0.1-beta.75",
"@ibiz-template/theme": "^0.0.1-beta.75",
"@ibiz-template/vue-util": "^0.0.1-beta.75",
"@ibiz/dynamic-model-api": "^2.1.17",
"@riophae/vue-treeselect": "^0.4.0",
"dayjs": "^1.11.7",
......
此差异已折叠。
......@@ -54,6 +54,34 @@ export default defineComponent({
level: props.level,
};
/** 计算视图是否有权限访问 */
const calcViewAccess = (
accUserMode?: number | 0 | 2 | 3 | 4,
accessKey?: string,
) => {
// 未指定直接返回true
if (accUserMode === 0) {
return true;
}
// 2:登录用户、 3:匿名用户及登录用户,看有没有用户登录
const hasLogin = !!ibiz.appData?.context.srfuserid;
if (accUserMode === 3 || accUserMode === 2) {
return hasLogin;
}
// 登录用户且拥有指定资源能力,配了资源标识要有资源标识,否则看是否登录
if (accUserMode === 4) {
if (accessKey) {
const unires: string[] = ibiz.appData?.unires;
return hasLogin && unires.includes(accessKey);
}
return hasLogin;
}
return true;
};
// 根据应用模型解析视图参数
const calcViewData = async () => {
const service = await ModelUtil.getModelService();
......@@ -62,7 +90,22 @@ export default defineComponent({
// 获取视图
try {
const route = useRoute(proxy) as Route;
const _viewData = parseRouteViewData(appModel, route, props.level);
const _viewData = await parseRouteViewData(
appModel,
route,
props.level,
);
const accessAble = calcViewAccess(
_viewData.accUserMode,
_viewData.accessKey,
);
if (!accessAble) {
// 没权限跳转403页面
router.push({ name: `403View${props.level}` });
return;
}
const _context = IBizContext.create(_viewData.context);
viewData.value = {
......
......@@ -88,13 +88,13 @@ export const TreeExpView = defineComponent({
if (!this.c.context.isRouter) {
// 非路由模式下绘制嵌入视图
return h('ViewShell', {
props: {
attrs: {
context: navViewParams[currentNavKey].context,
params: navViewParams[currentNavKey].params,
modal: { mode: ViewMode.EMBED },
modelPath: navViewParams[currentNavKey].modelPath,
key: currentNavKey,
},
key: currentNavKey,
});
}
......
......@@ -27,6 +27,11 @@ const router = new Router({
name: '404View1',
component: () => import('../views/404-view/404-view'),
},
{
path: '/403',
name: '403View1',
component: () => import('../views/403-view/403-view'),
},
{
path: '/appredirectview',
name: 'appRedirectView',
......@@ -73,6 +78,11 @@ const router = new Router({
name: '404View2',
component: () => import('../views/404-view/404-view'),
},
{
path: '403',
name: '403View2',
component: () => import('../views/403-view/403-view'),
},
{
path: `:view2(${viewReg})/:params2(${paramReg})`,
props: {
......@@ -85,6 +95,11 @@ const router = new Router({
name: '404View3',
component: () => import('../views/404-view/404-view'),
},
{
path: '403',
name: '403View3',
component: () => import('../views/403-view/403-view'),
},
{
path: `:view3(${viewReg})/:params3(${paramReg})`,
props: {
......@@ -97,6 +112,11 @@ const router = new Router({
name: '404View4',
component: () => import('../views/404-view/404-view'),
},
{
path: '403',
name: '403View4',
component: () => import('../views/403-view/403-view'),
},
{
path: `:view4(${viewReg})/:params4(${paramReg})`,
props: {
......
import { useNamespace, useRoute, useRouter } from '@ibiz-template/vue-util';
import { computed, defineComponent, getCurrentInstance, onMounted } from 'vue';
import '@ibiz-template/theme/style/components/views/403-view/403-view.scss';
import { Route } from 'vue-router';
export default defineComponent({
setup() {
const ns = useNamespace('403-view');
const { proxy } = getCurrentInstance()!;
const router = useRouter(proxy);
const route = useRoute(proxy) as Route;
const gotoIndexView = () => {
router.push('/');
};
onMounted(() => {
setTimeout(() => {
const el = document.querySelector('.app-loading-x') as HTMLDivElement;
if (el) {
el.style.display = 'none';
}
}, 300);
});
const isTop = computed(() => {
return !route.params.view1;
});
return { ns, isTop, gotoIndexView };
},
render() {
return (
<div class={[this.ns.b(), this.ns.is('top', this.isTop)]}>
<img class={this.ns.b('img')} src='./assets/img/404.png' />
<div class={this.ns.b('text')}>
<div class={this.ns.be('text', 'text1')}>
抱歉,您无权限访问该页面!
</div>
{this.isTop ? (
<div class={this.ns.be('text', 'text2')}>
您无权限访问该页面,请返回
<a on-click={this.gotoIndexView}>首页</a>
继续浏览
</div>
) : null}
</div>
</div>
);
},
});
......@@ -651,54 +651,54 @@
dependencies:
qx-util "^0.4.8"
"@ibiz-template/controller@^0.0.1-beta.74":
version "0.0.1-beta.74"
resolved "http://npm.zhr.icu/@ibiz-template/controller/-/controller-0.0.1-beta.74.tgz#5d2525f924570686fee2b833153772588c777d1e"
integrity sha512-qpaj8aS/dsrFvUs9Vq/427397Kbz05fZEMv9+EAXxe3zra/xXy3SYYMfepLvCRvysJnRoUaHwh9YHGJ5oeG/PA==
"@ibiz-template/controller@^0.0.1-beta.75":
version "0.0.1-beta.75"
resolved "http://npm.zhr.icu/@ibiz-template/controller/-/controller-0.0.1-beta.75.tgz#1249cdd1a3aa69cd90207616245c688d1e796efd"
integrity sha512-kylrN2xbNvuO7vubGfzKoYO+eXOVsHJJIfs1jyOERGYx73U/VWUU1PIZGlGpvuYKnpQ07yl8moeLqIHNS23wXQ==
dependencies:
async-validator "^4.2.5"
dayjs "^1.11.5"
"@ibiz-template/core@^0.0.1-beta.74":
version "0.0.1-beta.74"
resolved "http://npm.zhr.icu/@ibiz-template/core/-/core-0.0.1-beta.74.tgz#8f5f1883b15a73c65ed0d9d226de45938739e263"
integrity sha512-rqxGwmuceH8zuf4CCtoOEPoGxqO9xcJBO1pA1mPMA3EZsM/biLlERYM9YxVU5g+gFsRXci+cSUx+tc6hSu5xuA==
"@ibiz-template/core@^0.0.1-beta.75":
version "0.0.1-beta.75"
resolved "http://npm.zhr.icu/@ibiz-template/core/-/core-0.0.1-beta.75.tgz#38ea1110322ae29648d8446cff3658e2612c7fda"
integrity sha512-VgR6qaHBnCK3K+Spp2cihmUbB/hDa52pLq0h9bE+f2MrUF3bxV+kLH3NaSChab9s8HHRk+dpmcFRK26SC6WK9g==
dependencies:
axios "^1.2.1"
loglevel "^1.8.0"
pluralize "^8.0.0"
qs "^6.11.0"
"@ibiz-template/model@^0.0.1-beta.74":
version "0.0.1-beta.74"
resolved "http://npm.zhr.icu/@ibiz-template/model/-/model-0.0.1-beta.74.tgz#7dfcf83ea1ceaa60bdc30e3cabe6d630ce95c514"
integrity sha512-NZr2C1hTmU/PRrKwnHThIJ9pWA5So1QNBaH9JRtBEEiWcs2JPWyWiBJdBYHUJi3o4taTxRVZF5BmrkI1XtNy6Q==
"@ibiz-template/model@^0.0.1-beta.75":
version "0.0.1-beta.75"
resolved "http://npm.zhr.icu/@ibiz-template/model/-/model-0.0.1-beta.75.tgz#2bfd1e99548aff1e8d97658750a8c82eaa8daeb9"
integrity sha512-dKqP/gdOFMCF/Ud8xHjF+F2OwMpbvtW9wvzBMsSE3EsBXwd5JdvDZJLR3kmQxKOGr/UALaTIc7hbN1r2F98gbg==
dependencies:
"@ibiz/dynamic-model-api" "^2.1.17"
pluralize "^8.0.0"
"@ibiz-template/runtime@^0.0.1-beta.74":
version "0.0.1-beta.74"
resolved "http://npm.zhr.icu/@ibiz-template/runtime/-/runtime-0.0.1-beta.74.tgz#60418bb3fc001d6be9d4b54654219ee2132ab412"
integrity sha512-ORt4mTi5ENTqeOpL3JvKfzA41DeFhP7DqqpFW89OVSYgt+CbGcIvTkqBtC6CNuRqVRp9A5WcKpEmxvkwaJYwkg==
"@ibiz-template/runtime@^0.0.1-beta.75":
version "0.0.1-beta.75"
resolved "http://npm.zhr.icu/@ibiz-template/runtime/-/runtime-0.0.1-beta.75.tgz#21d88b98cf497fd2b90917bd91309172a68bde9e"
integrity sha512-xbM7TFbG+o20/yvRVqiLOgUeGPq4XVIFrUF9IqP/BC6yp0ttavmsUeWgMsJvcxnNEFKQbZEjUpBjnIMGTybzcQ==
dependencies:
"@ibiz-template/command" "^0.0.1-beta.50"
qs "^6.11.0"
"@ibiz-template/service@^0.0.1-beta.74":
version "0.0.1-beta.74"
resolved "http://npm.zhr.icu/@ibiz-template/service/-/service-0.0.1-beta.74.tgz#95cfc34670e5e8f658cbb8cd84265cd6e805eaef"
integrity sha512-RGwOxtRYnXp5Ay+3hEnF5+muOjmGjBDPbNBpiA8WkeDAftVxW/dRumjFCk6HRSzKVX5B5AXCbN+QUHoWJ2SvaA==
"@ibiz-template/service@^0.0.1-beta.75":
version "0.0.1-beta.75"
resolved "http://npm.zhr.icu/@ibiz-template/service/-/service-0.0.1-beta.75.tgz#cf202591c0149d67b9c97c383fe7ffd304d88df2"
integrity sha512-wsKiAmAAaSe88yQ2IqEUzOGJBdv9bRYDgVsWijWqWud40rLs0sQJOs5aVffeCcj1eF1GxeJZMhQcwLYhp1O1+g==
"@ibiz-template/theme@^0.0.1-beta.74":
version "0.0.1-beta.74"
resolved "http://npm.zhr.icu/@ibiz-template/theme/-/theme-0.0.1-beta.74.tgz#b397cbe0d0abcda912238b4b153aae3c28802b79"
integrity sha512-cCAnCazx/VZ9NEgmEH37rkixYRKcdR0dhJAB1o0a7/ikTSvdcxmXf7Tx0ikcTFVRQppPagvUG2kwUSL9iysfaw==
"@ibiz-template/theme@^0.0.1-beta.75":
version "0.0.1-beta.75"
resolved "http://npm.zhr.icu/@ibiz-template/theme/-/theme-0.0.1-beta.75.tgz#4aa5a07b8be082574b74b43739fb4fa3bf3ae98b"
integrity sha512-ErZqAhQ6GNMgprTFU5msgFqh6dSV7yP4ruL9YzegnNYAClVLQgk8UmviBI13rQt9xbSCpexwnAZ/hirTqEVuAg==
"@ibiz-template/vue-util@^0.0.1-beta.74":
version "0.0.1-beta.74"
resolved "http://npm.zhr.icu/@ibiz-template/vue-util/-/vue-util-0.0.1-beta.74.tgz#d3be2f0cfab1d3b25e03fe8adbfd95ba1ce4d87a"
integrity sha512-gyFVrhChd4kZVOTEvE3rg+5N93mv6sNTLcfkNwUJi6vCqQhl32u0Hv9qi8Bm4xJC7SehXFtbG64baFXuWIPBkQ==
"@ibiz-template/vue-util@^0.0.1-beta.75":
version "0.0.1-beta.75"
resolved "http://npm.zhr.icu/@ibiz-template/vue-util/-/vue-util-0.0.1-beta.75.tgz#5dc504da915724c0bb9049ade50d50ddc6e8b23b"
integrity sha512-HU+K40kPYtEDCsYSSL5V+cj243zgWKxUoo2ovFW/cb9jqSynCkuvA8WXJx51LRwXiHXbn4KjAXNfvQz7c84zEA==
"@ibiz/dynamic-model-api@^2.1.17":
version "2.1.17"
......
......@@ -1224,16 +1224,16 @@
"mOSFilePath" : "pssysapps/TemplatePublish/psappviewmsggroups/VMGroup2",
"name" : "视图消息组2",
"getPSAppViewMsgGroupDetails" : [ {
"name" : "视图消息",
"name" : "视图消息2",
"getPSAppViewMsg" : {
"modelref" : true,
"id" : "ViewMsg2"
"id" : "ViewMsg3"
}
}, {
"name" : "视图消息2",
"name" : "视图消息",
"getPSAppViewMsg" : {
"modelref" : true,
"id" : "ViewMsg3"
"id" : "ViewMsg2"
}
} ],
"rTMOSFilePath" : "pssysapps/TemplatePublish/psappviewmsggroups/VMGroup2"
......
......@@ -2477,16 +2477,16 @@
"mOSFilePath" : "pssysapps/Web/psappviewmsggroups/VMGroup2",
"name" : "视图消息组2",
"getPSAppViewMsgGroupDetails" : [ {
"name" : "视图消息",
"name" : "视图消息2",
"getPSAppViewMsg" : {
"modelref" : true,
"id" : "ViewMsg2"
"id" : "ViewMsg3"
}
}, {
"name" : "视图消息2",
"name" : "视图消息",
"getPSAppViewMsg" : {
"modelref" : true,
"id" : "ViewMsg3"
"id" : "ViewMsg2"
}
} ],
"rTMOSFilePath" : "pssysapps/Web/psappviewmsggroups/VMGroup2"
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册