Jeecg Boot 2.2.1 版本发布,低代码平台

This commit is contained in:
zhangdaiscott
2020-07-11 12:54:57 +08:00
parent cb7ae9ca6f
commit 109a95a96b
191 changed files with 28087 additions and 26880 deletions

View File

@ -1,3 +1,5 @@
import { getVmParentByName } from '@/utils/util'
const FormTypes = {
normal: 'normal',
input: 'input',
@ -88,7 +90,7 @@ export function validateTables(cases, deleteTempId) {
return new Promise((resolve, reject) => {
let tables = []
let index = 0;
if(!cases || cases.length==0){
if(!cases || cases.length === 0){
resolve()
}
(function next() {
@ -104,7 +106,13 @@ export function validateTables(cases, deleteTempId) {
}, error => {
// 出现未验证通过的表单,不再进行下一步校验,直接返回失败并跳转到该表格
if (error === VALIDATE_NO_PASSED) {
reject({ error: VALIDATE_NO_PASSED, index })
// 尝试获取tabKey如果在ATab组件内即可获取
let paneKey;
let tabPane = getVmParentByName(vm, 'ATabPane')
if (tabPane) {
paneKey = tabPane.$vnode.key
}
reject({error: VALIDATE_NO_PASSED, index, paneKey})
}
reject(error)
})

View File

@ -0,0 +1,38 @@
//判断是否IE<11浏览器
export function isIE() {
return navigator.userAgent.indexOf('compatible') > -1 && navigator.userAgent.indexOf('MSIE') > -1
}
export function isIE11() {
return navigator.userAgent.indexOf('Trident') > -1 && navigator.userAgent.indexOf('rv:11.0') > -1
}
//判断是否IE的Edge浏览器
export function isEdge() {
return navigator.userAgent.indexOf('Edge') > -1 && !isIE()
}
export function getIEVersion() {
let userAgent = navigator.userAgent //取得浏览器的userAgent字符串
let isIE = isIE()
let isIE11 = isIE11()
let isEdge = isEdge()
if (isIE) {
let reIE = new RegExp('MSIE (\\d+\\.\\d+);')
reIE.test(userAgent)
let fIEVersion = parseFloat(RegExp['$1'])
if (fIEVersion === 7 || fIEVersion === 8 || fIEVersion === 9 || fIEVersion === 10) {
return fIEVersion
} else {
return 6//IE版本<7
}
} else if (isEdge) {
return 'edge'
} else if (isIE11) {
return 11
} else {
return -1
}
}

View File

@ -2,7 +2,7 @@ import { USER_AUTH,SYS_BUTTON_AUTH } from "@/store/mutation-types"
const hasPermission = {
install (Vue, options) {
console.log(options);
//console.log(options);
Vue.directive('has', {
inserted: (el, binding, vnode)=>{
console.log("页面权限控制----");

View File

@ -3,7 +3,7 @@ import axios from 'axios'
import store from '@/store'
import { VueAxios } from './axios'
import {Modal, notification} from 'ant-design-vue'
import { ACCESS_TOKEN } from "@/store/mutation-types"
import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types"
/**
* 【指定 axios的 baseURL】
@ -12,7 +12,7 @@ import { ACCESS_TOKEN } from "@/store/mutation-types"
* @type {*|string}
*/
let apiBaseUrl = window._CONFIG['domianURL'] || "/jeecg-boot";
console.log("apiBaseUrl= ",apiBaseUrl)
//console.log("apiBaseUrl= ",apiBaseUrl)
// 创建 axios 实例
const service = axios.create({
//baseURL: '/jeecg-boot',
@ -22,6 +22,7 @@ const service = axios.create({
const err = (error) => {
if (error.response) {
let that=this;
let data = error.response.data
const token = Vue.ls.get(ACCESS_TOKEN)
console.log("------异常响应------",token)
@ -45,7 +46,14 @@ const err = (error) => {
onOk: () => {
store.dispatch('Logout').then(() => {
Vue.ls.remove(ACCESS_TOKEN)
window.location.reload()
try {
let path=that.$route.path;
if(path.indexOf('/user/login')==-1){
window.location.reload()
}
}catch (e) {
window.location.reload()
}
})
}
})
@ -86,6 +94,13 @@ service.interceptors.request.use(config => {
if (token) {
config.headers[ 'X-Access-Token' ] = token // 让每个请求携带自定义 token 请根据实际情况自行修改
}
//update-begin-author:taoyan date:2020707 for:多租户
let tenantid = Vue.ls.get(TENANT_ID)
if (!tenantid) {
tenantid = 0;
}
config.headers[ 'tenant_id' ] = tenantid
//update-end-author:taoyan date:2020707 for:多租户
if(config.method=='get'){
if(config.url.indexOf("sys/dict/getDictItems")<0){
config.params = {

View File

@ -1,6 +1,6 @@
import * as api from '@/api/api'
import { isURL } from '@/utils/validate'
import onlineCommons from '@jeecg/antd-online-beta220'
import onlineCommons from '@jeecg/antd-online-mini'
export function timeFix() {
const time = new Date()
@ -115,7 +115,6 @@ function generateChildRouters (data) {
item.meta.url = URL;
}
//online菜单路由加载逻辑
let componentPath
if(item.component=="modules/online/cgform/OnlCgformHeadList"){
componentPath = onlineCommons.OnlCgformHeadList
@ -137,6 +136,7 @@ function generateChildRouters (data) {
componentPath = resolve => require(['@/' + component+'.vue'], resolve)
}
let menu = {
path: item.path,
name: item.name,
@ -478,3 +478,53 @@ export function replaceAll(text, checker, replacer) {
}
return text
}
/**
* 获取事件冒泡路径,兼容 IE11EdgeChromeFirefoxSafari
* 目前使用的地方JEditableTable Span模式
*/
export function getEventPath(event) {
let target = event.target
let path = (event.composedPath && event.composedPath()) || event.path
if (path != null) {
return (path.indexOf(window) < 0) ? path.concat(window) : path
}
if (target === window) {
return [window]
}
let getParents = (node, memo) => {
memo = memo || []
const parentNode = node.parentNode
if (!parentNode) {
return memo
} else {
return getParents(parentNode, memo.concat(parentNode))
}
}
return [target].concat(getParents(target), window)
}
/**
* 根据组件名获取父级
* @param vm
* @param name
* @returns {Vue | null|null|Vue}
*/
export function getVmParentByName(vm, name) {
let parent = vm.$parent
if (parent && parent.$options) {
if (parent.$options.name === name) {
return parent
} else {
let res = getVmParentByName(parent, name)
if (res) {
return res
}
}
}
return null
}