mirror of https://github.com/halo-dev/halo-admin
lint errors auto-fixed
parent
7f6ae15853
commit
e6aeb409b9
|
@ -1,3 +1,3 @@
|
|||
module.exports = {
|
||||
presets: ["@vue/app"]
|
||||
};
|
||||
presets: ['@vue/app']
|
||||
}
|
||||
|
|
|
@ -27,18 +27,18 @@ export default {
|
|||
default: ''
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
size: this.$parent.size
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
avatarSize () {
|
||||
avatarSize() {
|
||||
return this.size !== 'mini' && this.size || 20
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$parent.size' (val) {
|
||||
'$parent.size'(val) {
|
||||
this.size = val
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,11 +60,11 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
getItems (items) {
|
||||
getItems(items) {
|
||||
const classString = {
|
||||
[`${this.prefixCls}-item`]: true,
|
||||
[`${this.size}`]: true
|
||||
|
@ -80,7 +80,7 @@ export default {
|
|||
return itemList
|
||||
}
|
||||
},
|
||||
render () {
|
||||
render() {
|
||||
const { prefixCls, size } = this.$props
|
||||
const classString = {
|
||||
[`${prefixCls}`]: true,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<script>
|
||||
|
||||
function fixedZero (val) {
|
||||
function fixedZero(val) {
|
||||
return val * 1 < 10 ? `0${val}` : val
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ export default {
|
|||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
dateTime: '0',
|
||||
originTargetTime: 0,
|
||||
|
@ -36,7 +36,7 @@ export default {
|
|||
}
|
||||
},
|
||||
filters: {
|
||||
format (time) {
|
||||
format(time) {
|
||||
const hours = 60 * 60 * 1000
|
||||
const minutes = 60 * 1000
|
||||
|
||||
|
@ -46,12 +46,12 @@ export default {
|
|||
return `${fixedZero(h)}:${fixedZero(m)}:${fixedZero(s)}`
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
this.initTime()
|
||||
this.tick()
|
||||
},
|
||||
methods: {
|
||||
initTime () {
|
||||
initTime() {
|
||||
let lastTime = 0
|
||||
let targetTime = 0
|
||||
this.originTargetTime = this.target
|
||||
|
@ -69,7 +69,7 @@ export default {
|
|||
|
||||
this.lastTime = lastTime < 0 ? 0 : lastTime
|
||||
},
|
||||
tick () {
|
||||
tick() {
|
||||
const { onEnd } = this
|
||||
|
||||
this.timer = setTimeout(() => {
|
||||
|
@ -86,12 +86,12 @@ export default {
|
|||
}, this.interval)
|
||||
}
|
||||
},
|
||||
beforeUpdate () {
|
||||
beforeUpdate() {
|
||||
if (this.originTargetTime !== this.target) {
|
||||
this.initTime()
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.timer)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,12 +37,12 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
getStrDom (str, fullLength) {
|
||||
getStrDom(str, fullLength) {
|
||||
return (
|
||||
<span>{ cutStrByFullLength(str, this.length) + (fullLength > this.length ? '...' : '') }</span>
|
||||
)
|
||||
},
|
||||
getTooltip (fullStr, fullLength) {
|
||||
getTooltip(fullStr, fullLength) {
|
||||
return (
|
||||
<Tooltip>
|
||||
<template slot="title">{ fullStr }</template>
|
||||
|
@ -51,7 +51,7 @@ export default {
|
|||
)
|
||||
}
|
||||
},
|
||||
render () {
|
||||
render() {
|
||||
const { tooltip, length } = this.$props
|
||||
const str = this.$slots.default.map(vNode => vNode.text).join('')
|
||||
const fullLength = getStrFullLength(str)
|
||||
|
|
|
@ -17,14 +17,14 @@ import icons from './icons'
|
|||
|
||||
export default {
|
||||
name: 'IconSelect',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
selectedIcon: '',
|
||||
icons
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSelectedIcon (icon) {
|
||||
handleSelectedIcon(icon) {
|
||||
this.selectedIcon = icon
|
||||
this.$emit('change', icon)
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'MultiTab',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
fullPathList: [],
|
||||
pages: [],
|
||||
|
@ -36,16 +36,16 @@ export default {
|
|||
newTabIndex: 0
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
this.pages.push(this.$route)
|
||||
this.fullPathList.push(this.$route.fullPath)
|
||||
this.selectedLastPath()
|
||||
},
|
||||
methods: {
|
||||
onEdit (targetKey, action) {
|
||||
onEdit(targetKey, action) {
|
||||
this[action](targetKey)
|
||||
},
|
||||
remove (targetKey) {
|
||||
remove(targetKey) {
|
||||
this.pages = this.pages.filter(page => page.fullPath !== targetKey)
|
||||
this.fullPathList = this.fullPathList.filter(path => path !== targetKey)
|
||||
// 判断当前标签是否关闭,若关闭则跳转到最后一个还存在的标签页
|
||||
|
@ -53,15 +53,15 @@ export default {
|
|||
this.selectedLastPath()
|
||||
}
|
||||
},
|
||||
selectedLastPath () {
|
||||
selectedLastPath() {
|
||||
this.activeKey = this.fullPathList[this.fullPathList.length - 1]
|
||||
},
|
||||
|
||||
// content menu
|
||||
closeThat (e) {
|
||||
closeThat(e) {
|
||||
this.remove(e)
|
||||
},
|
||||
closeLeft (e) {
|
||||
closeLeft(e) {
|
||||
const currentIndex = this.fullPathList.indexOf(e)
|
||||
if (currentIndex > 0) {
|
||||
this.fullPathList.forEach((item, index) => {
|
||||
|
@ -73,7 +73,7 @@ export default {
|
|||
this.$message.info('左侧没有标签')
|
||||
}
|
||||
},
|
||||
closeRight (e) {
|
||||
closeRight(e) {
|
||||
const currentIndex = this.fullPathList.indexOf(e)
|
||||
if (currentIndex < (this.fullPathList.length - 1)) {
|
||||
this.fullPathList.forEach((item, index) => {
|
||||
|
@ -85,7 +85,7 @@ export default {
|
|||
this.$message.info('右侧没有标签')
|
||||
}
|
||||
},
|
||||
closeAll (e) {
|
||||
closeAll(e) {
|
||||
const currentIndex = this.fullPathList.indexOf(e)
|
||||
this.fullPathList.forEach((item, index) => {
|
||||
if (index !== currentIndex) {
|
||||
|
@ -93,7 +93,7 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
closeMenuClick ({ key, item, domEvent }) {
|
||||
closeMenuClick({ key, item, domEvent }) {
|
||||
const vkey = domEvent.target.getAttribute('data-vkey')
|
||||
switch (key) {
|
||||
case 'close-right':
|
||||
|
@ -111,7 +111,7 @@ export default {
|
|||
break
|
||||
}
|
||||
},
|
||||
renderTabPaneMenu (e) {
|
||||
renderTabPaneMenu(e) {
|
||||
return (
|
||||
<a-menu {...{ on: { click: this.closeMenuClick } }}>
|
||||
<a-menu-item key="close-that" data-vkey={e}>关闭当前标签</a-menu-item>
|
||||
|
@ -122,7 +122,7 @@ export default {
|
|||
)
|
||||
},
|
||||
// render
|
||||
renderTabPane (title, keyPath) {
|
||||
renderTabPane(title, keyPath) {
|
||||
const menu = this.renderTabPaneMenu(keyPath)
|
||||
|
||||
return (
|
||||
|
@ -133,18 +133,18 @@ export default {
|
|||
}
|
||||
},
|
||||
watch: {
|
||||
'$route': function (newVal) {
|
||||
'$route': function(newVal) {
|
||||
this.activeKey = newVal.fullPath
|
||||
if (this.fullPathList.indexOf(newVal.fullPath) < 0) {
|
||||
this.fullPathList.push(newVal.fullPath)
|
||||
this.pages.push(newVal)
|
||||
}
|
||||
},
|
||||
activeKey: function (newPathKey) {
|
||||
activeKey: function(newPathKey) {
|
||||
this.$router.push({ path: newPathKey })
|
||||
}
|
||||
},
|
||||
render () {
|
||||
render() {
|
||||
const { onEdit, $data: { pages } } = this
|
||||
const panes = pages.map(page => {
|
||||
return (
|
||||
|
|
|
@ -43,7 +43,7 @@ export default {
|
|||
components: {
|
||||
Icon
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,23 +19,23 @@ export default {
|
|||
default: false
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
this.localOpenKeys = this.openKeys.slice(0)
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
localOpenKeys: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handlePlus (item) {
|
||||
handlePlus(item) {
|
||||
this.$emit('add', item)
|
||||
},
|
||||
handleTitleClick (...args) {
|
||||
handleTitleClick(...args) {
|
||||
this.$emit('titleClick', { args })
|
||||
},
|
||||
|
||||
renderSearch () {
|
||||
renderSearch() {
|
||||
return (
|
||||
<Search
|
||||
placeholder="input search text"
|
||||
|
@ -43,10 +43,10 @@ export default {
|
|||
/>
|
||||
)
|
||||
},
|
||||
renderIcon (icon) {
|
||||
renderIcon(icon) {
|
||||
return icon && (<Icon type={icon} />) || null
|
||||
},
|
||||
renderMenuItem (item) {
|
||||
renderMenuItem(item) {
|
||||
return (
|
||||
<Item key={item.key}>
|
||||
{ this.renderIcon(item.icon) }
|
||||
|
@ -55,10 +55,10 @@ export default {
|
|||
</Item>
|
||||
)
|
||||
},
|
||||
renderItem (item) {
|
||||
renderItem(item) {
|
||||
return item.children ? this.renderSubItem(item, item.key) : this.renderMenuItem(item, item.key)
|
||||
},
|
||||
renderItemGroup (item) {
|
||||
renderItemGroup(item) {
|
||||
const childrenItems = item.children.map(o => {
|
||||
return this.renderItem(o, o.key)
|
||||
})
|
||||
|
@ -80,7 +80,7 @@ export default {
|
|||
</ItemGroup>
|
||||
)
|
||||
},
|
||||
renderSubItem (item, key) {
|
||||
renderSubItem(item, key) {
|
||||
const childrenItems = item.children && item.children.map(o => {
|
||||
return this.renderItem(o, o.key)
|
||||
})
|
||||
|
@ -104,7 +104,7 @@ export default {
|
|||
)
|
||||
}
|
||||
},
|
||||
render () {
|
||||
render() {
|
||||
const { dataSource, search } = this.$props
|
||||
|
||||
// this.localOpenKeys = openKeys.slice(0)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @param children
|
||||
* @returns {*[]}
|
||||
*/
|
||||
export function filterEmpty (children = []) {
|
||||
export function filterEmpty(children = []) {
|
||||
return children.filter(c => c.tag || (c.text && c.text.trim() !== ''))
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ export default {
|
|||
default: ''
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
data,
|
||||
scale,
|
||||
|
|
|
@ -40,7 +40,7 @@ const scale = [{
|
|||
|
||||
export default {
|
||||
name: 'MiniArea',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
data,
|
||||
tooltip,
|
||||
|
|
|
@ -41,7 +41,7 @@ const scale = [{
|
|||
|
||||
export default {
|
||||
name: 'MiniBar',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
data,
|
||||
tooltip,
|
||||
|
|
|
@ -53,7 +53,7 @@ export default {
|
|||
default: null
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
axis1Opts,
|
||||
axis2Opts,
|
||||
|
|
|
@ -42,18 +42,18 @@ export default {
|
|||
default: ''
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
scale,
|
||||
tooltip
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
this.getMonthBar()
|
||||
},
|
||||
methods: {
|
||||
getMonthBar () {
|
||||
getMonthBar() {
|
||||
this.$http.get('/analysis/month-bar')
|
||||
.then(res => {
|
||||
this.data = res.result
|
||||
|
|
|
@ -36,13 +36,13 @@ export default {
|
|||
default: 2
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
trend: this.type && 'up' || 'down',
|
||||
rate: this.percentage
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
const type = this.type === null ? this.value >= this.target : this.type
|
||||
this.trend = type ? 'up' : 'down'
|
||||
this.rate = (this.percentage === null ? Math.abs(this.value - this.target) * 100 / this.target : this.percentage).toFixed(this.fixed)
|
||||
|
|
|
@ -19,7 +19,7 @@ export default {
|
|||
MultiTab,
|
||||
GlobalLayout
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ export default {
|
|||
RouteView,
|
||||
PageLayout
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
description: '',
|
||||
|
@ -28,21 +28,21 @@ export default {
|
|||
tabs: {}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
this.getPageHeaderInfo()
|
||||
},
|
||||
updated () {
|
||||
updated() {
|
||||
this.getPageHeaderInfo()
|
||||
},
|
||||
computed: {
|
||||
|
||||
getTitle () {
|
||||
getTitle() {
|
||||
return this.$route.meta.title
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
getPageHeaderInfo () {
|
||||
getPageHeaderInfo() {
|
||||
// eslint-disable-next-line
|
||||
this.title = this.$route.meta.title
|
||||
// 因为套用了一层 route-view 所以要取 ref 对象下的子节点的第一个对象
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'RouteView',
|
||||
data () {
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
render () {
|
||||
render() {
|
||||
const { $route: { meta }, $store: { getters } } = this
|
||||
const inKeep = (
|
||||
<keep-alive>
|
||||
|
|
|
@ -37,13 +37,13 @@ export default {
|
|||
name: 'UserLayout',
|
||||
components: { RouteView },
|
||||
mixins: [mixinDevice],
|
||||
data () {
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
document.body.classList.add('userLayout')
|
||||
},
|
||||
beforeDestroy () {
|
||||
beforeDestroy() {
|
||||
document.body.classList.remove('userLayout')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
onSelect (obj) {
|
||||
onSelect(obj) {
|
||||
this.$emit('menuSelect', obj)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ export default {
|
|||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
openKeys: [],
|
||||
selectedKeys: [],
|
||||
|
@ -40,11 +40,11 @@ export default {
|
|||
return keys
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
this.updateMenu()
|
||||
},
|
||||
watch: {
|
||||
collapsed (val) {
|
||||
collapsed(val) {
|
||||
if (val) {
|
||||
this.cachedOpenKeys = this.openKeys.concat()
|
||||
this.openKeys = []
|
||||
|
@ -52,13 +52,13 @@ export default {
|
|||
this.openKeys = this.cachedOpenKeys
|
||||
}
|
||||
},
|
||||
$route: function () {
|
||||
$route: function() {
|
||||
this.updateMenu()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// select menu item
|
||||
onOpenChange (openKeys) {
|
||||
onOpenChange(openKeys) {
|
||||
// 在水平模式下时执行,并且不再执行后续
|
||||
if (this.mode === 'horizontal') {
|
||||
this.openKeys = openKeys
|
||||
|
@ -72,7 +72,7 @@ export default {
|
|||
this.openKeys = latestOpenKey ? [latestOpenKey] : []
|
||||
}
|
||||
},
|
||||
updateMenu () {
|
||||
updateMenu() {
|
||||
const routes = this.$route.matched.concat()
|
||||
|
||||
if (routes.length >= 4 && this.$route.meta.hidden) {
|
||||
|
@ -93,13 +93,13 @@ export default {
|
|||
},
|
||||
|
||||
// render
|
||||
renderItem (menu) {
|
||||
renderItem(menu) {
|
||||
if (!menu.hidden) {
|
||||
return menu.children && !menu.hideChildrenInMenu ? this.renderSubMenu(menu) : this.renderMenuItem(menu)
|
||||
}
|
||||
return null
|
||||
},
|
||||
renderMenuItem (menu) {
|
||||
renderMenuItem(menu) {
|
||||
const target = menu.meta.target || null
|
||||
const props = {
|
||||
to: { name: menu.name },
|
||||
|
@ -114,7 +114,7 @@ export default {
|
|||
</Item>
|
||||
)
|
||||
},
|
||||
renderSubMenu (menu) {
|
||||
renderSubMenu(menu) {
|
||||
const itemArr = []
|
||||
if (!menu.hideChildrenInMenu) {
|
||||
menu.children.forEach(item => itemArr.push(this.renderItem(item)))
|
||||
|
@ -129,7 +129,7 @@ export default {
|
|||
</SubMenu>
|
||||
)
|
||||
},
|
||||
renderIcon (icon) {
|
||||
renderIcon(icon) {
|
||||
if (icon === 'none' || icon === undefined) {
|
||||
return null
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ export default {
|
|||
)
|
||||
}
|
||||
},
|
||||
render () {
|
||||
render() {
|
||||
const { mode, theme, menu } = this
|
||||
const props = {
|
||||
mode: mode,
|
||||
|
|
|
@ -26,7 +26,7 @@ export default {
|
|||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
openKeys: [],
|
||||
selectedKeys: [],
|
||||
|
@ -40,11 +40,11 @@ export default {
|
|||
return keys
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
this.updateMenu()
|
||||
},
|
||||
watch: {
|
||||
collapsed (val) {
|
||||
collapsed(val) {
|
||||
if (val) {
|
||||
this.cachedOpenKeys = this.openKeys.concat()
|
||||
this.openKeys = []
|
||||
|
@ -52,12 +52,12 @@ export default {
|
|||
this.openKeys = this.cachedOpenKeys
|
||||
}
|
||||
},
|
||||
$route: function () {
|
||||
$route: function() {
|
||||
this.updateMenu()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
renderIcon: function (h, icon) {
|
||||
renderIcon: function(h, icon) {
|
||||
if (icon === 'none' || icon === undefined) {
|
||||
return null
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export default {
|
|||
typeof (icon) === 'object' ? props.component = icon : props.type = icon
|
||||
return h(Icon, { props: { ...props } })
|
||||
},
|
||||
renderMenuItem: function (h, menu, pIndex, index) {
|
||||
renderMenuItem: function(h, menu, pIndex, index) {
|
||||
const target = menu.meta.target || null
|
||||
return h(Item, { key: menu.path ? menu.path : 'item_' + pIndex + '_' + index }, [
|
||||
h('router-link', { attrs: { to: { name: menu.name }, target: target } }, [
|
||||
|
@ -74,37 +74,37 @@ export default {
|
|||
])
|
||||
])
|
||||
},
|
||||
renderSubMenu: function (h, menu, pIndex, index) {
|
||||
renderSubMenu: function(h, menu, pIndex, index) {
|
||||
const this2_ = this
|
||||
const subItem = [h('span', { slot: 'title' }, [this.renderIcon(h, menu.meta.icon), h('span', [menu.meta.title])])]
|
||||
const itemArr = []
|
||||
const pIndex_ = pIndex + '_' + index
|
||||
console.log('menu', menu)
|
||||
if (!menu.hideChildrenInMenu) {
|
||||
menu.children.forEach(function (item, i) {
|
||||
menu.children.forEach(function(item, i) {
|
||||
itemArr.push(this2_.renderItem(h, item, pIndex_, i))
|
||||
})
|
||||
}
|
||||
return h(SubMenu, { key: menu.path ? menu.path : 'submenu_' + pIndex + '_' + index }, subItem.concat(itemArr))
|
||||
},
|
||||
renderItem: function (h, menu, pIndex, index) {
|
||||
renderItem: function(h, menu, pIndex, index) {
|
||||
if (!menu.hidden) {
|
||||
return menu.children && !menu.hideChildrenInMenu
|
||||
? this.renderSubMenu(h, menu, pIndex, index)
|
||||
: this.renderMenuItem(h, menu, pIndex, index)
|
||||
}
|
||||
},
|
||||
renderMenu: function (h, menuTree) {
|
||||
renderMenu: function(h, menuTree) {
|
||||
const this2_ = this
|
||||
const menuArr = []
|
||||
menuTree.forEach(function (menu, i) {
|
||||
menuTree.forEach(function(menu, i) {
|
||||
if (!menu.hidden) {
|
||||
menuArr.push(this2_.renderItem(h, menu, '0', i))
|
||||
}
|
||||
})
|
||||
return menuArr
|
||||
},
|
||||
onOpenChange (openKeys) {
|
||||
onOpenChange(openKeys) {
|
||||
const latestOpenKey = openKeys.find(key => !this.openKeys.includes(key))
|
||||
if (!this.rootSubmenuKeys.includes(latestOpenKey)) {
|
||||
this.openKeys = openKeys
|
||||
|
@ -112,7 +112,7 @@ export default {
|
|||
this.openKeys = latestOpenKey ? [latestOpenKey] : []
|
||||
}
|
||||
},
|
||||
updateMenu () {
|
||||
updateMenu() {
|
||||
const routes = this.$route.matched.concat()
|
||||
|
||||
if (routes.length >= 4 && this.$route.meta.hidden) {
|
||||
|
@ -132,7 +132,7 @@ export default {
|
|||
this.collapsed ? (this.cachedOpenKeys = openKeys) : (this.openKeys = openKeys)
|
||||
}
|
||||
},
|
||||
render (h) {
|
||||
render(h) {
|
||||
return h(
|
||||
Menu,
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'LayoutFooter',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,16 +79,16 @@ export default {
|
|||
default: 'desktop'
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
headerBarFixed: false
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
window.addEventListener('scroll', this.handleScroll)
|
||||
},
|
||||
methods: {
|
||||
handleScroll () {
|
||||
handleScroll() {
|
||||
if (this.autoHideHeader) {
|
||||
const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
|
||||
if (scrollTop > 100) {
|
||||
|
@ -100,7 +100,7 @@ export default {
|
|||
this.headerBarFixed = false
|
||||
}
|
||||
},
|
||||
toggle () {
|
||||
toggle() {
|
||||
this.$emit('toggle')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ export default {
|
|||
SettingDrawer
|
||||
},
|
||||
mixins: [mixin, mixinDevice],
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
collapsed: false,
|
||||
menus: []
|
||||
|
@ -102,7 +102,7 @@ export default {
|
|||
// 主路由
|
||||
mainMenu: state => state.permission.addRouters
|
||||
}),
|
||||
contentPaddingLeft () {
|
||||
contentPaddingLeft() {
|
||||
if (!this.fixSidebar || this.isMobile()) {
|
||||
return '0'
|
||||
}
|
||||
|
@ -113,16 +113,16 @@ export default {
|
|||
}
|
||||
},
|
||||
watch: {
|
||||
sidebarOpened (val) {
|
||||
sidebarOpened(val) {
|
||||
this.collapsed = !val
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
this.menus = asyncRouterMap.find((item) => item.path === '/').children
|
||||
// this.menus = this.mainMenu.find((item) => item.path === '/').children
|
||||
this.collapsed = !this.sidebarOpened
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
const userAgent = navigator.userAgent
|
||||
if (userAgent.indexOf('Edge') > -1) {
|
||||
this.$nextTick(() => {
|
||||
|
@ -135,12 +135,12 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
...mapActions(['setSidebar']),
|
||||
toggle () {
|
||||
toggle() {
|
||||
this.collapsed = !this.collapsed
|
||||
this.setSidebar(!this.collapsed)
|
||||
triggerWindowResizeEvent()
|
||||
},
|
||||
paddingCalc () {
|
||||
paddingCalc() {
|
||||
let left = ''
|
||||
if (this.sidebarOpened) {
|
||||
left = this.isDesktop() ? '256px' : '80px'
|
||||
|
@ -149,7 +149,7 @@ export default {
|
|||
}
|
||||
return left
|
||||
},
|
||||
menuSelect () {
|
||||
menuSelect() {
|
||||
if (!this.isDesktop()) {
|
||||
this.collapsed = false
|
||||
}
|
||||
|
|
|
@ -70,17 +70,17 @@ export default {
|
|||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
name: '',
|
||||
breadList: []
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
this.getBreadcrumb()
|
||||
},
|
||||
methods: {
|
||||
getBreadcrumb () {
|
||||
getBreadcrumb() {
|
||||
this.breadList = []
|
||||
// this.breadList.push({name: 'index', path: '/dashboard/', meta: {title: '首页'}})
|
||||
|
||||
|
@ -92,7 +92,7 @@ export default {
|
|||
}
|
||||
},
|
||||
watch: {
|
||||
$route () {
|
||||
$route() {
|
||||
this.getBreadcrumb()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@ export default {
|
|||
required: true
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loadding: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchNotice () {
|
||||
fetchNotice() {
|
||||
if (this.loadding) {
|
||||
this.loadding = false
|
||||
return
|
||||
|
|
|
@ -180,7 +180,7 @@ export default {
|
|||
SettingItem
|
||||
},
|
||||
mixins: [mixin, mixinDevice],
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
visible: true,
|
||||
colorList,
|
||||
|
@ -190,7 +190,7 @@ export default {
|
|||
watch: {
|
||||
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
const vm = this
|
||||
setTimeout(() => {
|
||||
vm.visible = false
|
||||
|
@ -204,29 +204,29 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
showDrawer () {
|
||||
showDrawer() {
|
||||
this.visible = true
|
||||
},
|
||||
onClose () {
|
||||
onClose() {
|
||||
this.visible = false
|
||||
},
|
||||
toggle () {
|
||||
toggle() {
|
||||
this.visible = !this.visible
|
||||
},
|
||||
onColorWeak (checked) {
|
||||
onColorWeak(checked) {
|
||||
this.baseConfig.colorWeak = checked
|
||||
this.$store.dispatch('ToggleWeak', checked)
|
||||
updateColorWeak(checked)
|
||||
},
|
||||
onMultiTab (checked) {
|
||||
onMultiTab(checked) {
|
||||
this.baseConfig.multiTab = checked
|
||||
this.$store.dispatch('ToggleMultiTab', checked)
|
||||
},
|
||||
handleMenuTheme (theme) {
|
||||
handleMenuTheme(theme) {
|
||||
this.baseConfig.navTheme = theme
|
||||
this.$store.dispatch('ToggleTheme', theme)
|
||||
},
|
||||
doCopy () {
|
||||
doCopy() {
|
||||
const text = `export default {
|
||||
primaryColor: '${this.baseConfig.primaryColor}', // primary color of ant design
|
||||
navTheme: '${this.baseConfig.navTheme}', // theme for nav menu
|
||||
|
@ -252,33 +252,33 @@ export default {
|
|||
this.$message.error('复制失败')
|
||||
})
|
||||
},
|
||||
handleLayout (mode) {
|
||||
handleLayout(mode) {
|
||||
this.baseConfig.layout = mode
|
||||
this.$store.dispatch('ToggleLayoutMode', mode)
|
||||
// 因为顶部菜单不能固定左侧菜单栏,所以强制关闭
|
||||
//
|
||||
this.handleFixSiderbar(false)
|
||||
},
|
||||
handleContentWidthChange (type) {
|
||||
handleContentWidthChange(type) {
|
||||
this.baseConfig.contentWidth = type
|
||||
this.$store.dispatch('ToggleContentWidth', type)
|
||||
},
|
||||
changeColor (color) {
|
||||
changeColor(color) {
|
||||
this.baseConfig.primaryColor = color
|
||||
if (this.primaryColor !== color) {
|
||||
this.$store.dispatch('ToggleColor', color)
|
||||
updateTheme(color)
|
||||
}
|
||||
},
|
||||
handleFixedHeader (fixed) {
|
||||
handleFixedHeader(fixed) {
|
||||
this.baseConfig.fixedHeader = fixed
|
||||
this.$store.dispatch('ToggleFixedHeader', fixed)
|
||||
},
|
||||
handleFixedHeaderHidden (autoHidden) {
|
||||
handleFixedHeaderHidden(autoHidden) {
|
||||
this.baseConfig.autoHideHeader = autoHidden
|
||||
this.$store.dispatch('ToggleFixedHeaderHidden', autoHidden)
|
||||
},
|
||||
handleFixSiderbar (fixed) {
|
||||
handleFixSiderbar(fixed) {
|
||||
if (this.layoutMode === 'topmenu') {
|
||||
this.baseConfig.fixSiderbar = false
|
||||
this.$store.dispatch('ToggleFixSiderbar', false)
|
||||
|
|
|
@ -2,7 +2,7 @@ import T from 'ant-design-vue/es/table/Table'
|
|||
import get from 'lodash.get'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
needTotalList: [],
|
||||
|
||||
|
@ -64,7 +64,7 @@ export default {
|
|||
}
|
||||
}),
|
||||
watch: {
|
||||
'localPagination.current' (val) {
|
||||
'localPagination.current'(val) {
|
||||
this.$router.push({
|
||||
name: this.$route.name,
|
||||
params: Object.assign({}, this.$route.params, {
|
||||
|
@ -72,23 +72,23 @@ export default {
|
|||
})
|
||||
})
|
||||
},
|
||||
pageNum (val) {
|
||||
pageNum(val) {
|
||||
Object.assign(this.localPagination, {
|
||||
current: val
|
||||
})
|
||||
},
|
||||
pageSize (val) {
|
||||
pageSize(val) {
|
||||
Object.assign(this.localPagination, {
|
||||
pageSize: val
|
||||
})
|
||||
},
|
||||
showSizeChanger (val) {
|
||||
showSizeChanger(val) {
|
||||
Object.assign(this.localPagination, {
|
||||
showSizeChanger: val
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
this.localPagination = ['auto', true].includes(this.showPagination) && Object.assign({}, this.localPagination, {
|
||||
current: this.pageNum,
|
||||
pageSize: this.pageSize,
|
||||
|
@ -103,7 +103,7 @@ export default {
|
|||
* 如果参数为 true, 则强制刷新到第一页
|
||||
* @param Boolean bool
|
||||
*/
|
||||
refresh (bool = false) {
|
||||
refresh(bool = false) {
|
||||
bool && (this.localPagination = Object.assign({}, {
|
||||
current: 1, pageSize: this.pageSize
|
||||
}))
|
||||
|
@ -115,7 +115,7 @@ export default {
|
|||
* @param {Object} filters 过滤条件
|
||||
* @param {Object} sorter 排序条件
|
||||
*/
|
||||
loadData (pagination, filters, sorter) {
|
||||
loadData(pagination, filters, sorter) {
|
||||
this.localLoading = true
|
||||
const parameter = Object.assign({
|
||||
pageNo: (pagination && pagination.current) ||
|
||||
|
@ -159,7 +159,7 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
initTotalList (columns) {
|
||||
initTotalList(columns) {
|
||||
const totalList = []
|
||||
columns && columns instanceof Array && columns.forEach(column => {
|
||||
if (column.needTotal) {
|
||||
|
@ -176,7 +176,7 @@ export default {
|
|||
* @param selectedRowKeys
|
||||
* @param selectedRows
|
||||
*/
|
||||
updateSelect (selectedRowKeys, selectedRows) {
|
||||
updateSelect(selectedRowKeys, selectedRows) {
|
||||
this.selectedRows = selectedRows
|
||||
this.selectedRowKeys = selectedRowKeys
|
||||
const list = this.needTotalList
|
||||
|
@ -193,7 +193,7 @@ export default {
|
|||
/**
|
||||
* 清空 table 已选中项
|
||||
*/
|
||||
clearSelected () {
|
||||
clearSelected() {
|
||||
if (this.rowSelection) {
|
||||
this.rowSelection.onChange([], [])
|
||||
this.updateSelect([], [])
|
||||
|
@ -204,7 +204,7 @@ export default {
|
|||
* @param callback
|
||||
* @returns {*}
|
||||
*/
|
||||
renderClear (callback) {
|
||||
renderClear(callback) {
|
||||
if (this.selectedRowKeys.length <= 0) return null
|
||||
return (
|
||||
<a style="margin-left: 24px" onClick={() => {
|
||||
|
@ -213,7 +213,7 @@ export default {
|
|||
}}>清空</a>
|
||||
)
|
||||
},
|
||||
renderAlert () {
|
||||
renderAlert() {
|
||||
// 绘制统计列数据
|
||||
const needTotalItems = this.needTotalList.map((item) => {
|
||||
return (<span style="margin-right: 12px">
|
||||
|
@ -241,7 +241,7 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
render () {
|
||||
render() {
|
||||
const props = {}
|
||||
const localKeys = Object.keys(this.$data)
|
||||
const showAlert = (typeof this.alert === 'object' && this.alert !== null && this.alert.show) && typeof this.rowSelection.selectedRowKeys !== 'undefined' || this.alert
|
||||
|
|
|
@ -11,17 +11,17 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
name: '',
|
||||
breadList: []
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
this.getBreadcrumb()
|
||||
},
|
||||
methods: {
|
||||
getBreadcrumb () {
|
||||
getBreadcrumb() {
|
||||
console.log('this.$route.matched', this.$route.matched)
|
||||
|
||||
this.breadList = []
|
||||
|
@ -35,7 +35,7 @@ export default {
|
|||
}
|
||||
},
|
||||
watch: {
|
||||
$route () {
|
||||
$route() {
|
||||
this.getBreadcrumb()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ const Item = {
|
|||
type: Number
|
||||
}
|
||||
},
|
||||
render () {
|
||||
render() {
|
||||
return (
|
||||
<Col {...{ props: responsive[this.col] }}>
|
||||
<div class="term">{this.$props.term}</div>
|
||||
|
@ -69,7 +69,7 @@ export default {
|
|||
default: 'horizontal'
|
||||
}
|
||||
},
|
||||
provide () {
|
||||
provide() {
|
||||
return {
|
||||
col: this.col > 4 ? 4 : this.col
|
||||
}
|
||||
|
|
|
@ -49,14 +49,14 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'HeaderNotice',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loadding: false,
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchNotice () {
|
||||
fetchNotice() {
|
||||
if (!this.visible) {
|
||||
this.loadding = true
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -46,7 +46,7 @@ export default {
|
|||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
stepLoading: false,
|
||||
|
||||
|
@ -54,7 +54,7 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
handleStepOk () {
|
||||
handleStepOk() {
|
||||
const vm = this
|
||||
this.stepLoading = true
|
||||
this.form.validateFields((err, values) => {
|
||||
|
@ -70,11 +70,11 @@ export default {
|
|||
this.$emit('error', { err })
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
handleCancel() {
|
||||
this.visible = false
|
||||
this.$emit('cancel')
|
||||
},
|
||||
onForgeStepCode () {
|
||||
onForgeStepCode() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,13 +52,13 @@ export default {
|
|||
methods: {
|
||||
...mapActions(['Logout']),
|
||||
...mapGetters(['nickname', 'avatar']),
|
||||
handleLogout () {
|
||||
handleLogout() {
|
||||
const that = this
|
||||
|
||||
this.$confirm({
|
||||
title: '提示',
|
||||
content: '真的要注销登录吗 ?',
|
||||
onOk () {
|
||||
onOk() {
|
||||
return that.Logout({}).then(() => {
|
||||
window.location.reload()
|
||||
}).catch(err => {
|
||||
|
@ -68,7 +68,7 @@ export default {
|
|||
})
|
||||
})
|
||||
},
|
||||
onCancel () {
|
||||
onCancel() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ router.afterEach(() => {
|
|||
* @see https://github.com/sendya/ant-design-pro-vue/pull/53
|
||||
*/
|
||||
const action = Vue.directive('action', {
|
||||
bind: function (el, binding, vnode) {
|
||||
bind: function(el, binding, vnode) {
|
||||
const actionName = binding.arg
|
||||
const roles = store.getters.roles
|
||||
const elVal = vnode.context.$route.meta.permission
|
||||
|
|
|
@ -77,43 +77,43 @@ const app = {
|
|||
}
|
||||
},
|
||||
actions: {
|
||||
setSidebar ({ commit }, type) {
|
||||
setSidebar({ commit }, type) {
|
||||
commit('SET_SIDEBAR_TYPE', type)
|
||||
},
|
||||
CloseSidebar ({ commit }) {
|
||||
CloseSidebar({ commit }) {
|
||||
commit('CLOSE_SIDEBAR')
|
||||
},
|
||||
ToggleDevice ({ commit }, device) {
|
||||
ToggleDevice({ commit }, device) {
|
||||
commit('TOGGLE_DEVICE', device)
|
||||
},
|
||||
ToggleTheme ({ commit }, theme) {
|
||||
ToggleTheme({ commit }, theme) {
|
||||
commit('TOGGLE_THEME', theme)
|
||||
},
|
||||
ToggleLayoutMode ({ commit }, mode) {
|
||||
ToggleLayoutMode({ commit }, mode) {
|
||||
commit('TOGGLE_LAYOUT_MODE', mode)
|
||||
},
|
||||
ToggleFixedHeader ({ commit }, fixedHeader) {
|
||||
ToggleFixedHeader({ commit }, fixedHeader) {
|
||||
if (!fixedHeader) {
|
||||
commit('TOGGLE_FIXED_HEADER_HIDDEN', false)
|
||||
}
|
||||
commit('TOGGLE_FIXED_HEADER', fixedHeader)
|
||||
},
|
||||
ToggleFixSiderbar ({ commit }, fixSiderbar) {
|
||||
ToggleFixSiderbar({ commit }, fixSiderbar) {
|
||||
commit('TOGGLE_FIXED_SIDERBAR', fixSiderbar)
|
||||
},
|
||||
ToggleFixedHeaderHidden ({ commit }, show) {
|
||||
ToggleFixedHeaderHidden({ commit }, show) {
|
||||
commit('TOGGLE_FIXED_HEADER_HIDDEN', show)
|
||||
},
|
||||
ToggleContentWidth ({ commit }, type) {
|
||||
ToggleContentWidth({ commit }, type) {
|
||||
commit('TOGGLE_CONTENT_WIDTH', type)
|
||||
},
|
||||
ToggleColor ({ commit }, color) {
|
||||
ToggleColor({ commit }, color) {
|
||||
commit('TOGGLE_COLOR', color)
|
||||
},
|
||||
ToggleWeak ({ commit }, weakFlag) {
|
||||
ToggleWeak({ commit }, weakFlag) {
|
||||
commit('TOGGLE_WEAK', weakFlag)
|
||||
},
|
||||
ToggleMultiTab ({ commit }, bool) {
|
||||
ToggleMultiTab({ commit }, bool) {
|
||||
commit('TOGGLE_MULTI_TAB', bool)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import { asyncRouterMap, constantRouterMap } from '@/config/router.config'
|
|||
* @param route
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function hasPermission (permission, route) {
|
||||
function hasPermission(permission, route) {
|
||||
if (route.meta && route.meta.permission) {
|
||||
let flag = false
|
||||
for (let i = 0, len = permission.length; i < len; i++) {
|
||||
|
@ -37,7 +37,7 @@ function hasRole(roles, route) {
|
|||
}
|
||||
}
|
||||
|
||||
function filterAsyncRouter (routerMap, roles) {
|
||||
function filterAsyncRouter(routerMap, roles) {
|
||||
const accessedRouters = routerMap.filter(route => {
|
||||
if (hasPermission(roles.permissionList, route)) {
|
||||
if (route.children && route.children.length) {
|
||||
|
@ -62,7 +62,7 @@ const permission = {
|
|||
}
|
||||
},
|
||||
actions: {
|
||||
GenerateRoutes ({ commit }, data) {
|
||||
GenerateRoutes({ commit }, data) {
|
||||
return new Promise(resolve => {
|
||||
const { roles } = data
|
||||
const accessedRouters = filterAsyncRouter(asyncRouterMap, roles)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const VueAxios = {
|
||||
vm: {},
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
install (Vue, instance) {
|
||||
install(Vue, instance) {
|
||||
if (this.installed) {
|
||||
return
|
||||
}
|
||||
|
@ -17,12 +17,12 @@ const VueAxios = {
|
|||
|
||||
Object.defineProperties(Vue.prototype, {
|
||||
axios: {
|
||||
get: function get () {
|
||||
get: function get() {
|
||||
return instance
|
||||
}
|
||||
},
|
||||
$http: {
|
||||
get: function get () {
|
||||
get: function get() {
|
||||
return instance
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export function actionToObject (json) {
|
||||
export function actionToObject(json) {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
} catch (e) {
|
||||
|
|
|
@ -58,7 +58,7 @@ service.interceptors.response.use((response) => {
|
|||
|
||||
const installer = {
|
||||
vm: {},
|
||||
install (Vue) {
|
||||
install(Vue) {
|
||||
Vue.use(VueAxios, service)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,13 +24,13 @@ export default {
|
|||
default: '404'
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
config: types
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleToHome () {
|
||||
handleToHome() {
|
||||
this.$router.push({ name: 'dashboard' })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
|
||||
function resolve (dir) {
|
||||
function resolve(dir) {
|
||||
return path.join(__dirname, dir)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue