| | |
| | | } |
| | | |
| | | export const getTopMenu = () => request({ |
| | | url: '/api/blade-system/menu/top-menu', |
| | | url: '/api/smFunctionController/top-menu', |
| | | method: 'get' |
| | | }); |
| | | |
| | | export const getRoutes = (parentOid) => request({ |
| | | url: 'api/smFunctionController/treeMyMenu', |
| | | url: '/api/smFunctionController/treeMyMenu', |
| | | method: 'get', |
| | | params: { |
| | | parentOid, |
| | |
| | | import website from "@/config/website"; |
| | | |
| | | export const loginByUsername = (tenantId, deptId, roleId, username, password, type, key) => request({ |
| | | url: '/api/blade-auth/oauth/token', |
| | | url: '/api/framework/loginController/login', |
| | | method: 'post', |
| | | headers: { |
| | | 'Tenant-Id': tenantId, |
| | |
| | | <div class="UI-dynamic" :id="'UI-dynamic-'+areasName+componentVO.oid"> |
| | | <div v-if="isError" style="color: #F56C6C">è¿ä¸ªèªå®ä¹é¡µé¢çå°åæ ¼å¼ä¸æ£ç¡®ãæ¨è使ç¨bs=?type=xxx&context=yyy&pparam=zzzè¿ç§å½¢å¼</div> |
| | | <component v-else :is="currentComponent" |
| | | :btmType="customOptions.btmType" |
| | | :content="customOptions.content" |
| | | :btmType="btmType" |
| | | :content="content" |
| | | :inDialog="true" |
| | | :key="areasName+'customCom-'+componentVO.oid" |
| | | :componentVO="componentVO" |
| | | :sourceData="sourceData" |
| | | :dataStore="dataStore" |
| | | :areasName="areasName" |
| | | :paramVOS="customOptions.paramVOS"></component> |
| | | :paramVOS="urlParams"></component> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | btmType:'', |
| | | content:'', |
| | | urlParams:{}, |
| | | height:'300px', |
| | | customClass:this.componentVO.customClass, //bs=?type=xxx&context=yyy¶m=zzz æè
bs=ç»ä»¶name?type=xxx&context=yyy¶m=zzz |
| | | isError:false, //è·¯å¾è§£æå¤±è´¥ |
| | |
| | | } |
| | | }, |
| | | computed:{ |
| | | customOptions() { |
| | | if(this.customClass.indexOf("bs=") <0){ |
| | | this.isError=true; |
| | | return ; |
| | | } |
| | | this.customClass=this.componentVO.customClass.split("bs=")[1]; |
| | | if(this.customClass.indexOf("?") <0 || this.customClass.indexOf("type=") <0 || this.customClass.indexOf("context=") <0){ |
| | | this.isError=true; |
| | | return ; |
| | | } |
| | | if(this.customClass.split('?')[0]!='' && this.customClass.split('?')[0]!='UI' && this.customClass.split('?')[0]!='ui'){ |
| | | this.currentComponent=this.customClass.split('?')[0]; |
| | | } |
| | | this.customClass=this.componentVO.customClass.split("?")[1].split('&'); |
| | | let urlParams={}; |
| | | let btmType='' |
| | | let content='' |
| | | this.customClass.forEach(item=>{ |
| | | var preParam =item.split("="); |
| | | if(preParam[0]=='type'){ |
| | | btmType=preParam[1]; |
| | | }else if(preParam[0]=='context'){ |
| | | content=preParam[1]; |
| | | }else{ |
| | | urlParams[preParam[0]] = preParam[1]; |
| | | } |
| | | }) |
| | | return { |
| | | btmType:btmType, |
| | | content:content, |
| | | paramVOS:Object.assign(this.paramVOS,urlParams) |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | |
| | | }, |
| | | mounted() { |
| | | if(this.customClass.indexOf("bs=") <0){ |
| | | this.isError=true; |
| | | return ; |
| | | } |
| | | this.customClass=this.componentVO.customClass.split("bs=")[1]; |
| | | if(this.customClass.indexOf("?") <0 || this.customClass.indexOf("type=") <0 || this.customClass.indexOf("context=") <0){ |
| | | this.isError=true; |
| | | return ; |
| | | } |
| | | if(this.customClass.split('?')[0]!='' && this.customClass.split('?')[0]!='UI' && this.customClass.split('?')[0]!='ui'){ |
| | | this.currentComponent=this.customClass.split('?')[0]; |
| | | } |
| | | this.customClass=this.componentVO.customClass.split("?")[1].split('&'); |
| | | let urlParams={}; |
| | | let btmType='' |
| | | let content='' |
| | | this.customClass.forEach(item=>{ |
| | | var preParam =item.split("="); |
| | | if(preParam[0]=='type'){ |
| | | btmType=preParam[1]; |
| | | }else if(preParam[0]=='context'){ |
| | | content=preParam[1]; |
| | | }else{ |
| | | urlParams[preParam[0]] = preParam[1]; |
| | | } |
| | | }) |
| | | |
| | | |
| | | this.btmType=btmType, |
| | | this.content=content, |
| | | this.urlParams=Object.assign(this.paramVOS,urlParams) |
| | | |
| | | //this.getHeight(this.$parent); |
| | | }, |
| | | }, |
| | | methods:{ |
| | | getHeight(el){ |
| | | if(el.$el.clientHeight>50){ |
| | |
| | | selectChange(row) { |
| | | this.selectList = row; |
| | | }, |
| | | TreeSelectChange(row) { |
| | | this.TreeSelectList = row; |
| | | }, |
| | | searchChange(form,done){ |
| | | console.log(form) |
| | | done() |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <!--æä»¶å表--> |
| | | <div style="height: 100%"> |
| | | <avue-crud ref="dataTable" |
| | | v-model="form" |
| | | :data="tableList" |
| | | :option="option" |
| | | :page.sync="pageType" |
| | | :table-loading="loading" |
| | | @row-click="rowClickChange" |
| | | @selection-change="selectChange"> |
| | | <!--topåºåæé®--> |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <dynamic-button :butttonList="componentVO.buttons" :selectList="selectList" LocationType="top" |
| | | type="table"></dynamic-button> |
| | | </template> |
| | | |
| | | <!--menuåºåæé®--> |
| | | <template slot="menu" slot-scope="scope"> |
| | | <dynamic-button :butttonList="componentVO.buttons" :scope="scope" :selectList="selectList" LocationType="menu" |
| | | type="table"></dynamic-button> |
| | | </template> |
| | | </avue-crud> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import {validatenull} from "@/util/validate"; |
| | | |
| | | export default { |
| | | name: "list", |
| | | props: { |
| | | componentVO: { |
| | | type: Object, |
| | | default: {} |
| | | }, |
| | | inDialog: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | areasName: { |
| | | type: String, |
| | | default: ''//westArea导èªåº |
| | | }, |
| | | sourceData: { |
| | | //èåæºæ°æ®æè
å¼¹çªæ¶æé®æå±åºåçä¸ä¸åºåé䏿°æ® |
| | | type: Object, |
| | | default: {} |
| | | }, |
| | | paramVOS: { |
| | | type: Object, |
| | | default: {} |
| | | }, |
| | | isShow: { |
| | | //æå¨åºåæ¯å¦å·²æ¾ç¤ºï¼é对tabåcollapse |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | dataStore: { |
| | | //å¼¹çªæ¶æé®æå±åºåé䏿°æ® |
| | | type: Array, |
| | | default: [] |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | parentHeight: '100%',//å½åç»ä»¶æ ¹èç¹å
ç´ é«åº¦ |
| | | form: {}, |
| | | loading: false, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 50, |
| | | }, |
| | | simplePage: { |
| | | currentPage: 1, |
| | | total: 100, |
| | | pagerCount: 4, |
| | | layout: "prev, pager, next" |
| | | }, |
| | | //è¡¨æ ¼æ°æ® |
| | | tableList: [], |
| | | option: { |
| | | index: true, |
| | | addBtn: false, |
| | | editBtn: false, |
| | | delBtn: true, |
| | | selection: true, |
| | | tip: false, |
| | | height: '100%', |
| | | calcHeight: 15, |
| | | indexFixed: false, |
| | | menuFixed: false, |
| | | searchMenuSpan: 12, |
| | | searchShow: false, |
| | | column: [{ |
| | | field:'name', |
| | | title:'æä»¶åç§°', |
| | | width:250 |
| | | },{ |
| | | field:'fileSize', |
| | | title:'大å°', |
| | | width:80, |
| | | templet:function(d){ |
| | | if(!d.fileSize || d.fileSize == null || d.fileSize*1 == 0 || isNaN(d.fileSize*1) ){ |
| | | return "æªç¥å¤§å°"; |
| | | }else{ |
| | | //åå§å¤§å°æ¯B |
| | | var filesize = d.fileSize*1; |
| | | if(filesize>1024*1024*1024*1024){ |
| | | return parseInt(filesize/(1024*1024*1024*1024)) + "TB"; |
| | | }else if(filesize> 1024*1024*1024){ |
| | | return parseInt(filesize/(1024*1024*1024)) + "GB"; |
| | | }else if(filesize> 1024*1024){ |
| | | return parseInt(filesize/(1024*1024)) + "MB"; |
| | | }else if(filesize> 1024){ |
| | | return parseInt(filesize/1024) + "KB"; |
| | | }else { |
| | | return filesize + "B"; |
| | | } |
| | | } |
| | | } |
| | | },{ |
| | | field:'secretGradeText', |
| | | title:'å¯çº§', |
| | | hidden:(!configData.controlSecret), |
| | | width:60 |
| | | },{ |
| | | field:'fileDocClassifyName', |
| | | title:'ææ¡£ç±»å', |
| | | width:160 |
| | | },{ |
| | | field:'creator', |
| | | title:'ä¸ä¼ 人/æ¶é´', |
| | | width:210, |
| | | templet:function(d){ |
| | | return d.creator + "(" + $webUtil.formateDateTimeNoSecond(d.createTime) + ")"; |
| | | } |
| | | }], |
| | | }, |
| | | selectList: [], |
| | | } |
| | | }, |
| | | computed: { |
| | | pageType() { |
| | | return this.areasName === 'westArea' ? this.simplePage : this.page; |
| | | } |
| | | }, |
| | | methods: { |
| | | rowClickChange(row) { |
| | | this.$refs.dataTable.toggleRowSelection(row); |
| | | }, |
| | | selectChange(row) { |
| | | this.selectList = row; |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | this.index.openMenu(item) |
| | | }, |
| | | getMenu() { |
| | | this.$store.dispatch("GetTopMenu").then(res => { |
| | | /*this.$store.dispatch("GetTopMenu").then(res => { |
| | | this.items = res; |
| | | }); |
| | | });*/ |
| | | }, |
| | | generateTitle(item) { |
| | | return this.$router.$avueRouter.generateTitle( |
| | |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getTenant(); |
| | | // this.getTenant(); |
| | | }, |
| | | mounted() { |
| | | //å¨mountedè·åé¦é¡µä¸æèåæ°æ® |
| | | this.$axios.get('/api/blade-system/tenant/tenant-map').then(res=>{ |
| | | /*this.$axios.get('/api/blade-system/tenant/tenant-map').then(res=>{ |
| | | if(res.data.code == 200){ |
| | | this.loginForm.region=res.data.data |
| | | } |
| | | }) |
| | | })*/ |
| | | }, |
| | | watch: { |
| | | 'loginForm.deptId'() { |
| | |
| | | }); |
| | | this.$store.dispatch("LoginByUsername", this.loginForm).then(() => { |
| | | if (this.website.switchMode) { |
| | | const deptId = this.userInfo.dept_id; |
| | | const roleId = this.userInfo.role_id; |
| | | const deptId = this.userInfo.deptOid; |
| | | const roleId = this.userInfo.userOid; |
| | | if (deptId.includes(",") || roleId.includes(",")) { |
| | | this.loginForm.deptId = deptId; |
| | | this.loginForm.roleId = roleId; |
| | |
| | | // /** |
| | | // * å
¨ç«æéé
ç½® |
| | | // * |
| | | // */ |
| | | // import router from './router/router' |
| | | // import store from './store' |
| | | // import {validatenull} from '@/util/validate' |
| | | // import {getToken} from '@/util/auth' |
| | | // import NProgress from 'nprogress' // progress bar |
| | | // import 'nprogress/nprogress.css' // progress bar style |
| | | // NProgress.configure({showSpinner: false}); |
| | | // const lockPage = store.getters.website.lockPage; //éå±é¡µ |
| | | // router.beforeEach((to, from, next) => { |
| | | // const meta = to.meta || {}; |
| | | // const isMenu = meta.menu === undefined ? to.query.menu : meta.menu; |
| | | // store.commit('SET_IS_MENU', isMenu === undefined); |
| | | // if (getToken()) { |
| | | // if (store.getters.isLock && to.path !== lockPage) { //å¦æç³»ç»æ¿æ´»éå±ï¼å
¨é¨è·³è½¬å°éå±é¡µ |
| | | // next({path: lockPage}) |
| | | // } else if (to.path === '/login') { //妿ç»å½æå访é®ç»å½é¡µè·³è½¬å°ä¸»é¡µ |
| | | // next({path: '/'}) |
| | | // } else { |
| | | // //å¦æç¨æ·ä¿¡æ¯ä¸ºç©ºåè·åç¨æ·ä¿¡æ¯ï¼è·åç¨æ·ä¿¡æ¯å¤±è´¥ï¼è·³è½¬å°ç»å½é¡µ |
| | | // if (store.getters.token.length === 0) { |
| | | // store.dispatch('FedLogOut').then(() => { |
| | | // next({path: '/login'}) |
| | | // }) |
| | | // } else { |
| | | // const value = to.query.src || to.fullPath; |
| | | // const label = to.query.name || to.name; |
| | | // const meta = to.meta || router.$avueRouter.meta || {}; |
| | | // const i18n = to.query.i18n; |
| | | // if (to.query.target) { |
| | | // window.open(value) |
| | | // } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) { |
| | | // store.commit('ADD_TAG', { |
| | | // label: label, |
| | | // value: value, |
| | | // params: to.params, |
| | | // query: to.query, |
| | | // meta: (() => { |
| | | // if (!i18n) { |
| | | // return meta |
| | | // } |
| | | // return { |
| | | // i18n: i18n |
| | | // } |
| | | // })(), |
| | | // group: router.$avueRouter.group || [] |
| | | // }); |
| | | // } |
| | | // next() |
| | | // } |
| | | // } |
| | | // } else { |
| | | // //夿æ¯å¦éè¦è®¤è¯ï¼æ²¡æç»å½è®¿é®å»ç»å½é¡µ |
| | | // if (meta.isAuth === false) { |
| | | // next() |
| | | // } else { |
| | | // next('/login') |
| | | // } |
| | | // } |
| | | // }) |
| | | // |
| | | // router.afterEach(() => { |
| | | // NProgress.done(); |
| | | // let title = store.getters.tag.label; |
| | | // let i18n = store.getters.tag.meta.i18n; |
| | | // title = router.$avueRouter.generateTitle(title, i18n); |
| | | // //夿ç»å½é¡µçæ
åµ |
| | | // if (router.history.current.fullPath === "/login") { |
| | | // title = "ç»å½"; |
| | | // } |
| | | // //æ ¹æ®å½åçæ ç¾ä¹è·ålabelçå¼å¨æè®¾ç½®æµè§å¨æ é¢ |
| | | // router.$avueRouter.setTitle(title); |
| | | // }); |
| | | /** |
| | | * å
¨ç«æéé
ç½® |
| | | * |
| | | */ |
| | | import router from './router/router' |
| | | import store from './store' |
| | | import {validatenull} from '@/util/validate' |
| | | import {getToken} from '@/util/auth' |
| | | import NProgress from 'nprogress' // progress bar |
| | | import 'nprogress/nprogress.css' // progress bar style |
| | | NProgress.configure({showSpinner: false}); |
| | | const lockPage = store.getters.website.lockPage; //éå±é¡µ |
| | | router.beforeEach((to, from, next) => { |
| | | debugger; |
| | | const meta = to.meta || {}; |
| | | const isMenu = meta.menu === undefined ? to.query.menu : meta.menu; |
| | | store.commit('SET_IS_MENU', isMenu === undefined); |
| | | if (getToken()) { |
| | | if (store.getters.isLock && to.path !== lockPage) { //å¦æç³»ç»æ¿æ´»éå±ï¼å
¨é¨è·³è½¬å°éå±é¡µ |
| | | next({path: lockPage}) |
| | | } else if (to.path === '/login') { //妿ç»å½æå访é®ç»å½é¡µè·³è½¬å°ä¸»é¡µ |
| | | next({path: '/'}) |
| | | } else { |
| | | //å¦æç¨æ·ä¿¡æ¯ä¸ºç©ºåè·åç¨æ·ä¿¡æ¯ï¼è·åç¨æ·ä¿¡æ¯å¤±è´¥ï¼è·³è½¬å°ç»å½é¡µ |
| | | if (store.getters.token.length === 0) { |
| | | store.dispatch('FedLogOut').then(() => { |
| | | next({path: '/login'}) |
| | | }) |
| | | } else { |
| | | const value = to.query.src || to.fullPath; |
| | | const label = to.query.name || to.name; |
| | | const meta = to.meta || router.$avueRouter.meta || {}; |
| | | const i18n = to.query.i18n; |
| | | if (to.query.target) { |
| | | window.open(value) |
| | | } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) { |
| | | store.commit('ADD_TAG', { |
| | | label: label, |
| | | value: value, |
| | | params: to.params, |
| | | query: to.query, |
| | | meta: (() => { |
| | | if (!i18n) { |
| | | return meta |
| | | } |
| | | return { |
| | | i18n: i18n |
| | | } |
| | | })(), |
| | | group: router.$avueRouter.group || [] |
| | | }); |
| | | } |
| | | next() |
| | | } |
| | | } |
| | | } else { |
| | | //夿æ¯å¦éè¦è®¤è¯ï¼æ²¡æç»å½è®¿é®å»ç»å½é¡µ |
| | | if (meta.isAuth === false) { |
| | | next() |
| | | } else { |
| | | next('/login') |
| | | } |
| | | } |
| | | }) |
| | | |
| | | router.afterEach(() => { |
| | | NProgress.done(); |
| | | let title = store.getters.tag.label; |
| | | let i18n = store.getters.tag.meta.i18n; |
| | | title = router.$avueRouter.generateTitle(title, i18n); |
| | | //夿ç»å½é¡µçæ
åµ |
| | | if (router.history.current.fullPath === "/login") { |
| | | title = "ç»å½"; |
| | | } |
| | | //æ ¹æ®å½åçæ ç¾ä¹è·ålabelçå¼å¨æè®¾ç½®æµè§å¨æ é¢ |
| | | router.$avueRouter.setTitle(title); |
| | | }); |
| | |
| | | * first: 为äºåºåå¤ç è°ç¨formatRoutes å å½åæä»¶è°ç¨ formatRoutes |
| | | */ |
| | | formatRoutes: function (aMenu = [], first) { |
| | | // window.console.log('aMenu') |
| | | // window.console.log(aMenu) |
| | | debugger; |
| | | const aRouter = [] |
| | | // è·åå°å
¨å±é
ç½®ä¸ç props |
| | | const propsConfig = this.$website.menu.props; |
| | |
| | | } |
| | | })(), |
| | | //ç¹æ®å¤çç»ä»¶ æ§è¡å®è¿ä¸ª component ä¹å°±æ¯ç²¾ç¡®å°å
·ä½çæä»¶äº viewsæä»¶å¤¹ä¸é¢å°±æ¯å
·ä½ç页é¢ä»£ç |
| | | component = 'views' + oMenu.path, |
| | | //component = 'views' + oMenu.path, |
| | | component = oMenu.path, |
| | | name = oMenu[propsDefault.label], |
| | | icon = oMenu[propsDefault.icon], |
| | | children = oMenu[propsDefault.children], |
| | |
| | | actions: { |
| | | FlowRoutes({commit}) { |
| | | return new Promise((resolve, reject) => { |
| | | getDictionary({code: 'flow'}).then(res => { |
| | | /*getDictionary({code: 'flow'}).then(res => { |
| | | commit('SET_FLOW_ROUTES', res.data.data); |
| | | resolve(); |
| | | }).catch(error => { |
| | | reject(error) |
| | | }) |
| | | })*/ |
| | | }) |
| | | }, |
| | | }, |
| | |
| | | return new Promise((resolve, reject) => { |
| | | loginByUsername(userInfo.tenantId, userInfo.deptId, userInfo.roleId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key, ).then(res => { |
| | | const data = res.data; |
| | | if (data.error_description) { |
| | | Message({ |
| | | message: data.error_description, |
| | | type: 'error' |
| | | }) |
| | | } else { |
| | | commit('SET_TOKEN', data.access_token); |
| | | commit('SET_REFRESH_TOKEN', data.refresh_token); |
| | | if(data.success){ |
| | | debugger; |
| | | commit('SET_TOKEN', data.obj.sessionInfo.token); |
| | | commit('SET_REFRESH_TOKEN', data.obj.sessionInfo.token); |
| | | commit('SET_TENANT_ID', data.tenant_id); |
| | | commit('SET_USER_INFO', data); |
| | | commit('SET_USER_INFO', data.obj.sessionInfo); |
| | | commit('DEL_ALL_TAG'); |
| | | commit('CLEAR_LOCK'); |
| | | }else { |
| | | Message({ |
| | | message: data.msg, |
| | | type: 'error' |
| | | }) |
| | | } |
| | | resolve(); |
| | | }).catch(error => { |
| | |
| | | }); |
| | | commit('SET_MENU_ALL', menu) |
| | | commit('SET_MENU', menu) |
| | | dispatch('GetButtons'); |
| | | //dispatch('GetButtons'); |
| | | resolve(menu) |
| | | }) |
| | | }) |
| | |
| | | }, |
| | | mutations: { |
| | | SET_TOKEN: (state, token) => { |
| | | debugger; |
| | | setToken(token); |
| | | state.token = token; |
| | | setStore({name: 'token', content: state.token}) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <!--æä»ç®¡ç页é¢--> |
| | | <basic-container> |
| | | |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: "index" |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |