| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- // eslint-disable-next-line no-undef
- //__webpack_nonce__ = '*NONCE_TOKEN*';
- // eslint-disable-next-line no-undef
- __webpack_nonce__ = window.nonce_token;
- import { createApp, defineAsyncComponent } from 'vue';
- //import { createApp, defineAsyncComponent } from 'vue/dist/vue.runtime.esm-browser.prod.js';
- import Antd from 'ant-design-vue';
- import 'ant-design-vue/dist/antd.css';
- import { createI18n } from 'vue-i18n';
- import { createRouter, createWebHashHistory } from 'vue-router';
- import { createStore } from 'vuex';
- //import { createI18n } from 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js';
- //import { createI18n } from 'vue-i18n/dist/vue-i18n.runtime.esm-browser.js';
- import * as PcClientComponent from 'pc-component-v3';
- import 'pc-component-v3/dist/pc-component-v3.css';
- window.Uuid = PcClientComponent.Uuid;
- window.Notify = PcClientComponent.Notify;
- import ElementPlus from 'element-plus';
- import 'element-plus/dist/index.css';
- import App from '../client-base-v4/src/App.vue';
- import VTooltip from 'v-tooltip';
- import 'v-tooltip/dist/v-tooltip.css';
- import * as dd from 'dingtalk-jsapi';
- window.dd = dd;
- import 'jquery';
- import select2 from 'select2';
- import 'select2/dist/css/select2.css';
- import 'select2-bootstrap-theme/dist/select2-bootstrap.css';
- import downloadStore from '../client-base-v4/src/store/modules/downloadStore.js';
- import processConditionStore from '../client-workflow-v3/src/store/modules/processConditionStore.js';
- import merge from './merge.js';
- import langZhCn0 from '../client-base-v4/src/locales/zh-CN.json';
- import langEnUs0 from '../client-base-v4/src/locales/en-US.json';
- import langZhCn1 from '../client-eam-v3/src/locales/zh-CN.json';
- import langEnUs1 from '../client-eam-v3/src/locales/en-US.json';
- import langZhCn2 from '../client-role-v3/src/locales/zh-CN.json';
- import langEnUs2 from '../client-role-v3/src/locales/en-US.json';
- let langZhCn = merge.deepAssign(langZhCn0, langZhCn1, langZhCn2);
- let langEnUs = merge.deepAssign(langEnUs0, langEnUs1, langEnUs2);
- const i18n = createI18n({
- locale: 'zh-CN',
- messages: {
- 'zh-CN': langZhCn,
- 'en-US': langEnUs,
- },
- });
- window.CRUDId = -2147483640;
- import Common from '../client-base-v4/src/base/common/Common.js';
- window.Common = Common;
- import routes0 from '../client-base-v4/src/routes/main_routes.js';
- import routes1 from '../client-eam-v3/src/router/index.js';
- import routes2 from '../client-role-v3/src/router/routes.js';
- import routes3 from '../client-dictionary-v3/src/router/index.js';
- import routes4 from '../client-dic-v3/src/router/routes.js';
- import routes5 from '../client-workflow-v3/src/router/index.js';
- import routes6 from '../client-wms-v3/src/router/index.js';
- let routes = merge.mergeArray(routes0, routes1);
- routes = merge.mergeArray(routes, routes2);
- routes = merge.mergeArray(routes, routes3);
- routes = merge.mergeArray(routes, routes4);
- routes = merge.mergeArray(routes, routes5);
- routes = merge.mergeArray(routes, routes6);
- const router = createRouter({
- history: createWebHashHistory(),
- base: '/',
- mode: 'hash',
- routes: routes,
- });
- const store = createStore({
- modules: {
- downloadStore,
- processConditionStore,
- },
- });
- import '../client-workflow-v3/src/components/DynamicForm/styles/index.css';
- import '../client-workflow-v3/src/components/DynamicForm/icons';
- import FormControls from '../client-workflow-v3/src/components/FormControls/index.js';
- import * as ElementPlusIconsVue from '@element-plus/icons-vue';
- import '../client-workflow-v3/src/assets/style/global.css';
- import '../client-workflow-v3/src/assets/style/font_1388912_hzzxayghumf.css';
- import SvgIcon from '../client-workflow-v3/src/components/DynamicForm/components/SvgIcon/index.vue';// svg component
- const app = createApp(App);
- app.use(Antd);
- app.use(i18n);
- app.use(router);
- app.use(VTooltip);
- app.use(store);
- // PC Client 组件
- app.use(PcClientComponent);
- app.use(ElementPlus);
- app.use(router);
- app.use(FormControls);
- for (let [key, component] of Object.entries(ElementPlusIconsVue)) {
- app.component(key, component);
- }
- app.component( 'SvgIcon', SvgIcon );
- app.mount('#app');
- window.app = app;
- /**
- * 路由钩子
- * @param {[type]} (to, from, next [description]
- * @return {[type]} [description]
- */
- router.beforeEach((to, from, next) => {
- let funtionAccessDtos = [];
- if (to.matched.some(function (item) {
- // 判断是否需要登录才可以访问
- if (item.meta.loginRequired) {
- if (item.meta.functionAccessArray != undefined || item.meta.functionAccessArray != null) {
- funtionAccessDtos = item.meta.functionAccessArray;
- }
- if (funtionAccessDtos != null) {
- funtionAccessDtos.forEach(funtionAccessDto => {
- if(typeof (funtionAccessDto.itemNo) === 'string'){
- funtionAccessDto.itemNo = [funtionAccessDto.itemNo];
- }
- });
- }
- }
- return item.meta.loginRequired;
- })) {
- // 判断是否已登录
- var token = $.cookie('token');
- if (token == undefined || token.length == 0) {
- // 如果没有登录则直接返回
- next('/login');
- } else {
- // 判断该路由需要具备”xxx”功能-“x1”功能项,”xxx”功能-“x2“功能项,”yyy”功能-“y1”功能项访问权限的用户才可以访问
- $.ajax({
- url: Common.getApiURL(
- 'RoleResourceV2/canVisitFunctionAccess',
- ),
- type: 'post',
- dataType: 'json',
- contentType: 'application/json',
- data: JSON.stringify(funtionAccessDtos),
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (data) {
- if (data.errorCode === 0 && data.data === true) {
- next();
- return;
- } else {
- next('/desktop/no-role');
- return;
- }
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- }
- } else {
- next();
- return;
- }
- });
|