lint errors auto-fixed

pull/3445/head
ruibaby 2019-03-22 10:14:41 +08:00
parent 7f6ae15853
commit e6aeb409b9
43 changed files with 182 additions and 182 deletions

View File

@ -1,3 +1,3 @@
module.exports = { module.exports = {
presets: ["@vue/app"] presets: ['@vue/app']
}; }

View File

@ -27,18 +27,18 @@ export default {
default: '' default: ''
} }
}, },
data () { data() {
return { return {
size: this.$parent.size size: this.$parent.size
} }
}, },
computed: { computed: {
avatarSize () { avatarSize() {
return this.size !== 'mini' && this.size || 20 return this.size !== 'mini' && this.size || 20
} }
}, },
watch: { watch: {
'$parent.size' (val) { '$parent.size'(val) {
this.size = val this.size = val
} }
} }

View File

@ -60,11 +60,11 @@ export default {
} }
} }
}, },
data () { data() {
return {} return {}
}, },
methods: { methods: {
getItems (items) { getItems(items) {
const classString = { const classString = {
[`${this.prefixCls}-item`]: true, [`${this.prefixCls}-item`]: true,
[`${this.size}`]: true [`${this.size}`]: true
@ -80,7 +80,7 @@ export default {
return itemList return itemList
} }
}, },
render () { render() {
const { prefixCls, size } = this.$props const { prefixCls, size } = this.$props
const classString = { const classString = {
[`${prefixCls}`]: true, [`${prefixCls}`]: true,

View File

@ -6,7 +6,7 @@
<script> <script>
function fixedZero (val) { function fixedZero(val) {
return val * 1 < 10 ? `0${val}` : val return val * 1 < 10 ? `0${val}` : val
} }
@ -26,7 +26,7 @@ export default {
default: () => ({}) default: () => ({})
} }
}, },
data () { data() {
return { return {
dateTime: '0', dateTime: '0',
originTargetTime: 0, originTargetTime: 0,
@ -36,7 +36,7 @@ export default {
} }
}, },
filters: { filters: {
format (time) { format(time) {
const hours = 60 * 60 * 1000 const hours = 60 * 60 * 1000
const minutes = 60 * 1000 const minutes = 60 * 1000
@ -46,12 +46,12 @@ export default {
return `${fixedZero(h)}:${fixedZero(m)}:${fixedZero(s)}` return `${fixedZero(h)}:${fixedZero(m)}:${fixedZero(s)}`
} }
}, },
created () { created() {
this.initTime() this.initTime()
this.tick() this.tick()
}, },
methods: { methods: {
initTime () { initTime() {
let lastTime = 0 let lastTime = 0
let targetTime = 0 let targetTime = 0
this.originTargetTime = this.target this.originTargetTime = this.target
@ -69,7 +69,7 @@ export default {
this.lastTime = lastTime < 0 ? 0 : lastTime this.lastTime = lastTime < 0 ? 0 : lastTime
}, },
tick () { tick() {
const { onEnd } = this const { onEnd } = this
this.timer = setTimeout(() => { this.timer = setTimeout(() => {
@ -86,12 +86,12 @@ export default {
}, this.interval) }, this.interval)
} }
}, },
beforeUpdate () { beforeUpdate() {
if (this.originTargetTime !== this.target) { if (this.originTargetTime !== this.target) {
this.initTime() this.initTime()
} }
}, },
beforeDestroy () { beforeDestroy() {
clearTimeout(this.timer) clearTimeout(this.timer)
} }
} }

View File

@ -37,12 +37,12 @@ export default {
} }
}, },
methods: { methods: {
getStrDom (str, fullLength) { getStrDom(str, fullLength) {
return ( return (
<span>{ cutStrByFullLength(str, this.length) + (fullLength > this.length ? '...' : '') }</span> <span>{ cutStrByFullLength(str, this.length) + (fullLength > this.length ? '...' : '') }</span>
) )
}, },
getTooltip (fullStr, fullLength) { getTooltip(fullStr, fullLength) {
return ( return (
<Tooltip> <Tooltip>
<template slot="title">{ fullStr }</template> <template slot="title">{ fullStr }</template>
@ -51,7 +51,7 @@ export default {
) )
} }
}, },
render () { render() {
const { tooltip, length } = this.$props const { tooltip, length } = this.$props
const str = this.$slots.default.map(vNode => vNode.text).join('') const str = this.$slots.default.map(vNode => vNode.text).join('')
const fullLength = getStrFullLength(str) const fullLength = getStrFullLength(str)

View File

@ -17,14 +17,14 @@ import icons from './icons'
export default { export default {
name: 'IconSelect', name: 'IconSelect',
data () { data() {
return { return {
selectedIcon: '', selectedIcon: '',
icons icons
} }
}, },
methods: { methods: {
handleSelectedIcon (icon) { handleSelectedIcon(icon) {
this.selectedIcon = icon this.selectedIcon = icon
this.$emit('change', icon) this.$emit('change', icon)
} }

View File

@ -28,7 +28,7 @@
<script> <script>
export default { export default {
name: 'MultiTab', name: 'MultiTab',
data () { data() {
return { return {
fullPathList: [], fullPathList: [],
pages: [], pages: [],
@ -36,16 +36,16 @@ export default {
newTabIndex: 0 newTabIndex: 0
} }
}, },
created () { created() {
this.pages.push(this.$route) this.pages.push(this.$route)
this.fullPathList.push(this.$route.fullPath) this.fullPathList.push(this.$route.fullPath)
this.selectedLastPath() this.selectedLastPath()
}, },
methods: { methods: {
onEdit (targetKey, action) { onEdit(targetKey, action) {
this[action](targetKey) this[action](targetKey)
}, },
remove (targetKey) { remove(targetKey) {
this.pages = this.pages.filter(page => page.fullPath !== targetKey) this.pages = this.pages.filter(page => page.fullPath !== targetKey)
this.fullPathList = this.fullPathList.filter(path => path !== targetKey) this.fullPathList = this.fullPathList.filter(path => path !== targetKey)
// //
@ -53,15 +53,15 @@ export default {
this.selectedLastPath() this.selectedLastPath()
} }
}, },
selectedLastPath () { selectedLastPath() {
this.activeKey = this.fullPathList[this.fullPathList.length - 1] this.activeKey = this.fullPathList[this.fullPathList.length - 1]
}, },
// content menu // content menu
closeThat (e) { closeThat(e) {
this.remove(e) this.remove(e)
}, },
closeLeft (e) { closeLeft(e) {
const currentIndex = this.fullPathList.indexOf(e) const currentIndex = this.fullPathList.indexOf(e)
if (currentIndex > 0) { if (currentIndex > 0) {
this.fullPathList.forEach((item, index) => { this.fullPathList.forEach((item, index) => {
@ -73,7 +73,7 @@ export default {
this.$message.info('左侧没有标签') this.$message.info('左侧没有标签')
} }
}, },
closeRight (e) { closeRight(e) {
const currentIndex = this.fullPathList.indexOf(e) const currentIndex = this.fullPathList.indexOf(e)
if (currentIndex < (this.fullPathList.length - 1)) { if (currentIndex < (this.fullPathList.length - 1)) {
this.fullPathList.forEach((item, index) => { this.fullPathList.forEach((item, index) => {
@ -85,7 +85,7 @@ export default {
this.$message.info('右侧没有标签') this.$message.info('右侧没有标签')
} }
}, },
closeAll (e) { closeAll(e) {
const currentIndex = this.fullPathList.indexOf(e) const currentIndex = this.fullPathList.indexOf(e)
this.fullPathList.forEach((item, index) => { this.fullPathList.forEach((item, index) => {
if (index !== currentIndex) { if (index !== currentIndex) {
@ -93,7 +93,7 @@ export default {
} }
}) })
}, },
closeMenuClick ({ key, item, domEvent }) { closeMenuClick({ key, item, domEvent }) {
const vkey = domEvent.target.getAttribute('data-vkey') const vkey = domEvent.target.getAttribute('data-vkey')
switch (key) { switch (key) {
case 'close-right': case 'close-right':
@ -111,7 +111,7 @@ export default {
break break
} }
}, },
renderTabPaneMenu (e) { renderTabPaneMenu(e) {
return ( return (
<a-menu {...{ on: { click: this.closeMenuClick } }}> <a-menu {...{ on: { click: this.closeMenuClick } }}>
<a-menu-item key="close-that" data-vkey={e}>关闭当前标签</a-menu-item> <a-menu-item key="close-that" data-vkey={e}>关闭当前标签</a-menu-item>
@ -122,7 +122,7 @@ export default {
) )
}, },
// render // render
renderTabPane (title, keyPath) { renderTabPane(title, keyPath) {
const menu = this.renderTabPaneMenu(keyPath) const menu = this.renderTabPaneMenu(keyPath)
return ( return (
@ -133,18 +133,18 @@ export default {
} }
}, },
watch: { watch: {
'$route': function (newVal) { '$route': function(newVal) {
this.activeKey = newVal.fullPath this.activeKey = newVal.fullPath
if (this.fullPathList.indexOf(newVal.fullPath) < 0) { if (this.fullPathList.indexOf(newVal.fullPath) < 0) {
this.fullPathList.push(newVal.fullPath) this.fullPathList.push(newVal.fullPath)
this.pages.push(newVal) this.pages.push(newVal)
} }
}, },
activeKey: function (newPathKey) { activeKey: function(newPathKey) {
this.$router.push({ path: newPathKey }) this.$router.push({ path: newPathKey })
} }
}, },
render () { render() {
const { onEdit, $data: { pages } } = this const { onEdit, $data: { pages } } = this
const panes = pages.map(page => { const panes = pages.map(page => {
return ( return (

View File

@ -43,7 +43,7 @@ export default {
components: { components: {
Icon Icon
}, },
data () { data() {
return {} return {}
} }
} }

View File

@ -19,23 +19,23 @@ export default {
default: false default: false
} }
}, },
created () { created() {
this.localOpenKeys = this.openKeys.slice(0) this.localOpenKeys = this.openKeys.slice(0)
}, },
data () { data() {
return { return {
localOpenKeys: [] localOpenKeys: []
} }
}, },
methods: { methods: {
handlePlus (item) { handlePlus(item) {
this.$emit('add', item) this.$emit('add', item)
}, },
handleTitleClick (...args) { handleTitleClick(...args) {
this.$emit('titleClick', { args }) this.$emit('titleClick', { args })
}, },
renderSearch () { renderSearch() {
return ( return (
<Search <Search
placeholder="input search text" placeholder="input search text"
@ -43,10 +43,10 @@ export default {
/> />
) )
}, },
renderIcon (icon) { renderIcon(icon) {
return icon && (<Icon type={icon} />) || null return icon && (<Icon type={icon} />) || null
}, },
renderMenuItem (item) { renderMenuItem(item) {
return ( return (
<Item key={item.key}> <Item key={item.key}>
{ this.renderIcon(item.icon) } { this.renderIcon(item.icon) }
@ -55,10 +55,10 @@ export default {
</Item> </Item>
) )
}, },
renderItem (item) { renderItem(item) {
return item.children ? this.renderSubItem(item, item.key) : this.renderMenuItem(item, item.key) return item.children ? this.renderSubItem(item, item.key) : this.renderMenuItem(item, item.key)
}, },
renderItemGroup (item) { renderItemGroup(item) {
const childrenItems = item.children.map(o => { const childrenItems = item.children.map(o => {
return this.renderItem(o, o.key) return this.renderItem(o, o.key)
}) })
@ -80,7 +80,7 @@ export default {
</ItemGroup> </ItemGroup>
) )
}, },
renderSubItem (item, key) { renderSubItem(item, key) {
const childrenItems = item.children && item.children.map(o => { const childrenItems = item.children && item.children.map(o => {
return this.renderItem(o, o.key) return this.renderItem(o, o.key)
}) })
@ -104,7 +104,7 @@ export default {
) )
} }
}, },
render () { render() {
const { dataSource, search } = this.$props const { dataSource, search } = this.$props
// this.localOpenKeys = openKeys.slice(0) // this.localOpenKeys = openKeys.slice(0)

View File

@ -7,7 +7,7 @@
* @param children * @param children
* @returns {*[]} * @returns {*[]}
*/ */
export function filterEmpty (children = []) { export function filterEmpty(children = []) {
return children.filter(c => c.tag || (c.text && c.text.trim() !== '')) return children.filter(c => c.tag || (c.text && c.text.trim() !== ''))
} }

View File

@ -46,7 +46,7 @@ export default {
default: '' default: ''
} }
}, },
data () { data() {
return { return {
data, data,
scale, scale,

View File

@ -40,7 +40,7 @@ const scale = [{
export default { export default {
name: 'MiniArea', name: 'MiniArea',
data () { data() {
return { return {
data, data,
tooltip, tooltip,

View File

@ -41,7 +41,7 @@ const scale = [{
export default { export default {
name: 'MiniBar', name: 'MiniBar',
data () { data() {
return { return {
data, data,
tooltip, tooltip,

View File

@ -53,7 +53,7 @@ export default {
default: null default: null
} }
}, },
data () { data() {
return { return {
axis1Opts, axis1Opts,
axis2Opts, axis2Opts,

View File

@ -42,18 +42,18 @@ export default {
default: '' default: ''
} }
}, },
data () { data() {
return { return {
data: [], data: [],
scale, scale,
tooltip tooltip
} }
}, },
created () { created() {
this.getMonthBar() this.getMonthBar()
}, },
methods: { methods: {
getMonthBar () { getMonthBar() {
this.$http.get('/analysis/month-bar') this.$http.get('/analysis/month-bar')
.then(res => { .then(res => {
this.data = res.result this.data = res.result

View File

@ -36,13 +36,13 @@ export default {
default: 2 default: 2
} }
}, },
data () { data() {
return { return {
trend: this.type && 'up' || 'down', trend: this.type && 'up' || 'down',
rate: this.percentage rate: this.percentage
} }
}, },
created () { created() {
const type = this.type === null ? this.value >= this.target : this.type const type = this.type === null ? this.value >= this.target : this.type
this.trend = type ? 'up' : 'down' this.trend = type ? 'up' : 'down'
this.rate = (this.percentage === null ? Math.abs(this.value - this.target) * 100 / this.target : this.percentage).toFixed(this.fixed) this.rate = (this.percentage === null ? Math.abs(this.value - this.target) * 100 / this.target : this.percentage).toFixed(this.fixed)

View File

@ -19,7 +19,7 @@ export default {
MultiTab, MultiTab,
GlobalLayout GlobalLayout
}, },
data () { data() {
return {} return {}
} }
} }

View File

@ -18,7 +18,7 @@ export default {
RouteView, RouteView,
PageLayout PageLayout
}, },
data () { data() {
return { return {
title: '', title: '',
description: '', description: '',
@ -28,21 +28,21 @@ export default {
tabs: {} tabs: {}
} }
}, },
mounted () { mounted() {
this.getPageHeaderInfo() this.getPageHeaderInfo()
}, },
updated () { updated() {
this.getPageHeaderInfo() this.getPageHeaderInfo()
}, },
computed: { computed: {
getTitle () { getTitle() {
return this.$route.meta.title return this.$route.meta.title
} }
}, },
methods: { methods: {
getPageHeaderInfo () { getPageHeaderInfo() {
// eslint-disable-next-line // eslint-disable-next-line
this.title = this.$route.meta.title this.title = this.$route.meta.title
// route-view ref // route-view ref

View File

@ -1,10 +1,10 @@
<script> <script>
export default { export default {
name: 'RouteView', name: 'RouteView',
data () { data() {
return {} return {}
}, },
render () { render() {
const { $route: { meta }, $store: { getters } } = this const { $route: { meta }, $store: { getters } } = this
const inKeep = ( const inKeep = (
<keep-alive> <keep-alive>

View File

@ -37,13 +37,13 @@ export default {
name: 'UserLayout', name: 'UserLayout',
components: { RouteView }, components: { RouteView },
mixins: [mixinDevice], mixins: [mixinDevice],
data () { data() {
return {} return {}
}, },
mounted () { mounted() {
document.body.classList.add('userLayout') document.body.classList.add('userLayout')
}, },
beforeDestroy () { beforeDestroy() {
document.body.classList.remove('userLayout') document.body.classList.remove('userLayout')
} }
} }

View File

@ -54,7 +54,7 @@ export default {
} }
}, },
methods: { methods: {
onSelect (obj) { onSelect(obj) {
this.$emit('menuSelect', obj) this.$emit('menuSelect', obj)
} }
} }

View File

@ -26,7 +26,7 @@ export default {
default: false default: false
} }
}, },
data () { data() {
return { return {
openKeys: [], openKeys: [],
selectedKeys: [], selectedKeys: [],
@ -40,11 +40,11 @@ export default {
return keys return keys
} }
}, },
created () { created() {
this.updateMenu() this.updateMenu()
}, },
watch: { watch: {
collapsed (val) { collapsed(val) {
if (val) { if (val) {
this.cachedOpenKeys = this.openKeys.concat() this.cachedOpenKeys = this.openKeys.concat()
this.openKeys = [] this.openKeys = []
@ -52,13 +52,13 @@ export default {
this.openKeys = this.cachedOpenKeys this.openKeys = this.cachedOpenKeys
} }
}, },
$route: function () { $route: function() {
this.updateMenu() this.updateMenu()
} }
}, },
methods: { methods: {
// select menu item // select menu item
onOpenChange (openKeys) { onOpenChange(openKeys) {
// 在水平模式下时执行,并且不再执行后续 // 在水平模式下时执行,并且不再执行后续
if (this.mode === 'horizontal') { if (this.mode === 'horizontal') {
this.openKeys = openKeys this.openKeys = openKeys
@ -72,7 +72,7 @@ export default {
this.openKeys = latestOpenKey ? [latestOpenKey] : [] this.openKeys = latestOpenKey ? [latestOpenKey] : []
} }
}, },
updateMenu () { updateMenu() {
const routes = this.$route.matched.concat() const routes = this.$route.matched.concat()
if (routes.length >= 4 && this.$route.meta.hidden) { if (routes.length >= 4 && this.$route.meta.hidden) {
@ -93,13 +93,13 @@ export default {
}, },
// render // render
renderItem (menu) { renderItem(menu) {
if (!menu.hidden) { if (!menu.hidden) {
return menu.children && !menu.hideChildrenInMenu ? this.renderSubMenu(menu) : this.renderMenuItem(menu) return menu.children && !menu.hideChildrenInMenu ? this.renderSubMenu(menu) : this.renderMenuItem(menu)
} }
return null return null
}, },
renderMenuItem (menu) { renderMenuItem(menu) {
const target = menu.meta.target || null const target = menu.meta.target || null
const props = { const props = {
to: { name: menu.name }, to: { name: menu.name },
@ -114,7 +114,7 @@ export default {
</Item> </Item>
) )
}, },
renderSubMenu (menu) { renderSubMenu(menu) {
const itemArr = [] const itemArr = []
if (!menu.hideChildrenInMenu) { if (!menu.hideChildrenInMenu) {
menu.children.forEach(item => itemArr.push(this.renderItem(item))) menu.children.forEach(item => itemArr.push(this.renderItem(item)))
@ -129,7 +129,7 @@ export default {
</SubMenu> </SubMenu>
) )
}, },
renderIcon (icon) { renderIcon(icon) {
if (icon === 'none' || icon === undefined) { if (icon === 'none' || icon === undefined) {
return null return null
} }
@ -140,7 +140,7 @@ export default {
) )
} }
}, },
render () { render() {
const { mode, theme, menu } = this const { mode, theme, menu } = this
const props = { const props = {
mode: mode, mode: mode,

View File

@ -26,7 +26,7 @@ export default {
default: false default: false
} }
}, },
data () { data() {
return { return {
openKeys: [], openKeys: [],
selectedKeys: [], selectedKeys: [],
@ -40,11 +40,11 @@ export default {
return keys return keys
} }
}, },
created () { created() {
this.updateMenu() this.updateMenu()
}, },
watch: { watch: {
collapsed (val) { collapsed(val) {
if (val) { if (val) {
this.cachedOpenKeys = this.openKeys.concat() this.cachedOpenKeys = this.openKeys.concat()
this.openKeys = [] this.openKeys = []
@ -52,12 +52,12 @@ export default {
this.openKeys = this.cachedOpenKeys this.openKeys = this.cachedOpenKeys
} }
}, },
$route: function () { $route: function() {
this.updateMenu() this.updateMenu()
} }
}, },
methods: { methods: {
renderIcon: function (h, icon) { renderIcon: function(h, icon) {
if (icon === 'none' || icon === undefined) { if (icon === 'none' || icon === undefined) {
return null return null
} }
@ -65,7 +65,7 @@ export default {
typeof (icon) === 'object' ? props.component = icon : props.type = icon typeof (icon) === 'object' ? props.component = icon : props.type = icon
return h(Icon, { props: { ...props } }) return h(Icon, { props: { ...props } })
}, },
renderMenuItem: function (h, menu, pIndex, index) { renderMenuItem: function(h, menu, pIndex, index) {
const target = menu.meta.target || null const target = menu.meta.target || null
return h(Item, { key: menu.path ? menu.path : 'item_' + pIndex + '_' + index }, [ return h(Item, { key: menu.path ? menu.path : 'item_' + pIndex + '_' + index }, [
h('router-link', { attrs: { to: { name: menu.name }, target: target } }, [ 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 this2_ = this
const subItem = [h('span', { slot: 'title' }, [this.renderIcon(h, menu.meta.icon), h('span', [menu.meta.title])])] const subItem = [h('span', { slot: 'title' }, [this.renderIcon(h, menu.meta.icon), h('span', [menu.meta.title])])]
const itemArr = [] const itemArr = []
const pIndex_ = pIndex + '_' + index const pIndex_ = pIndex + '_' + index
console.log('menu', menu) console.log('menu', menu)
if (!menu.hideChildrenInMenu) { if (!menu.hideChildrenInMenu) {
menu.children.forEach(function (item, i) { menu.children.forEach(function(item, i) {
itemArr.push(this2_.renderItem(h, item, pIndex_, i)) itemArr.push(this2_.renderItem(h, item, pIndex_, i))
}) })
} }
return h(SubMenu, { key: menu.path ? menu.path : 'submenu_' + pIndex + '_' + index }, subItem.concat(itemArr)) 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) { if (!menu.hidden) {
return menu.children && !menu.hideChildrenInMenu return menu.children && !menu.hideChildrenInMenu
? this.renderSubMenu(h, menu, pIndex, index) ? this.renderSubMenu(h, menu, pIndex, index)
: this.renderMenuItem(h, menu, pIndex, index) : this.renderMenuItem(h, menu, pIndex, index)
} }
}, },
renderMenu: function (h, menuTree) { renderMenu: function(h, menuTree) {
const this2_ = this const this2_ = this
const menuArr = [] const menuArr = []
menuTree.forEach(function (menu, i) { menuTree.forEach(function(menu, i) {
if (!menu.hidden) { if (!menu.hidden) {
menuArr.push(this2_.renderItem(h, menu, '0', i)) menuArr.push(this2_.renderItem(h, menu, '0', i))
} }
}) })
return menuArr return menuArr
}, },
onOpenChange (openKeys) { onOpenChange(openKeys) {
const latestOpenKey = openKeys.find(key => !this.openKeys.includes(key)) const latestOpenKey = openKeys.find(key => !this.openKeys.includes(key))
if (!this.rootSubmenuKeys.includes(latestOpenKey)) { if (!this.rootSubmenuKeys.includes(latestOpenKey)) {
this.openKeys = openKeys this.openKeys = openKeys
@ -112,7 +112,7 @@ export default {
this.openKeys = latestOpenKey ? [latestOpenKey] : [] this.openKeys = latestOpenKey ? [latestOpenKey] : []
} }
}, },
updateMenu () { updateMenu() {
const routes = this.$route.matched.concat() const routes = this.$route.matched.concat()
if (routes.length >= 4 && this.$route.meta.hidden) { if (routes.length >= 4 && this.$route.meta.hidden) {
@ -132,7 +132,7 @@ export default {
this.collapsed ? (this.cachedOpenKeys = openKeys) : (this.openKeys = openKeys) this.collapsed ? (this.cachedOpenKeys = openKeys) : (this.openKeys = openKeys)
} }
}, },
render (h) { render(h) {
return h( return h(
Menu, Menu,
{ {

View File

@ -9,7 +9,7 @@
<script> <script>
export default { export default {
name: 'LayoutFooter', name: 'LayoutFooter',
data () { data() {
return { return {
} }
} }

View File

@ -79,16 +79,16 @@ export default {
default: 'desktop' default: 'desktop'
} }
}, },
data () { data() {
return { return {
headerBarFixed: false headerBarFixed: false
} }
}, },
mounted () { mounted() {
window.addEventListener('scroll', this.handleScroll) window.addEventListener('scroll', this.handleScroll)
}, },
methods: { methods: {
handleScroll () { handleScroll() {
if (this.autoHideHeader) { if (this.autoHideHeader) {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
if (scrollTop > 100) { if (scrollTop > 100) {
@ -100,7 +100,7 @@ export default {
this.headerBarFixed = false this.headerBarFixed = false
} }
}, },
toggle () { toggle() {
this.$emit('toggle') this.$emit('toggle')
} }
} }

View File

@ -91,7 +91,7 @@ export default {
SettingDrawer SettingDrawer
}, },
mixins: [mixin, mixinDevice], mixins: [mixin, mixinDevice],
data () { data() {
return { return {
collapsed: false, collapsed: false,
menus: [] menus: []
@ -102,7 +102,7 @@ export default {
// //
mainMenu: state => state.permission.addRouters mainMenu: state => state.permission.addRouters
}), }),
contentPaddingLeft () { contentPaddingLeft() {
if (!this.fixSidebar || this.isMobile()) { if (!this.fixSidebar || this.isMobile()) {
return '0' return '0'
} }
@ -113,16 +113,16 @@ export default {
} }
}, },
watch: { watch: {
sidebarOpened (val) { sidebarOpened(val) {
this.collapsed = !val this.collapsed = !val
} }
}, },
created () { created() {
this.menus = asyncRouterMap.find((item) => item.path === '/').children this.menus = asyncRouterMap.find((item) => item.path === '/').children
// this.menus = this.mainMenu.find((item) => item.path === '/').children // this.menus = this.mainMenu.find((item) => item.path === '/').children
this.collapsed = !this.sidebarOpened this.collapsed = !this.sidebarOpened
}, },
mounted () { mounted() {
const userAgent = navigator.userAgent const userAgent = navigator.userAgent
if (userAgent.indexOf('Edge') > -1) { if (userAgent.indexOf('Edge') > -1) {
this.$nextTick(() => { this.$nextTick(() => {
@ -135,12 +135,12 @@ export default {
}, },
methods: { methods: {
...mapActions(['setSidebar']), ...mapActions(['setSidebar']),
toggle () { toggle() {
this.collapsed = !this.collapsed this.collapsed = !this.collapsed
this.setSidebar(!this.collapsed) this.setSidebar(!this.collapsed)
triggerWindowResizeEvent() triggerWindowResizeEvent()
}, },
paddingCalc () { paddingCalc() {
let left = '' let left = ''
if (this.sidebarOpened) { if (this.sidebarOpened) {
left = this.isDesktop() ? '256px' : '80px' left = this.isDesktop() ? '256px' : '80px'
@ -149,7 +149,7 @@ export default {
} }
return left return left
}, },
menuSelect () { menuSelect() {
if (!this.isDesktop()) { if (!this.isDesktop()) {
this.collapsed = false this.collapsed = false
} }

View File

@ -70,17 +70,17 @@ export default {
required: false required: false
} }
}, },
data () { data() {
return { return {
name: '', name: '',
breadList: [] breadList: []
} }
}, },
created () { created() {
this.getBreadcrumb() this.getBreadcrumb()
}, },
methods: { methods: {
getBreadcrumb () { getBreadcrumb() {
this.breadList = [] this.breadList = []
// this.breadList.push({name: 'index', path: '/dashboard/', meta: {title: ''}}) // this.breadList.push({name: 'index', path: '/dashboard/', meta: {title: ''}})
@ -92,7 +92,7 @@ export default {
} }
}, },
watch: { watch: {
$route () { $route() {
this.getBreadcrumb() this.getBreadcrumb()
} }
} }

View File

@ -27,13 +27,13 @@ export default {
required: true required: true
} }
}, },
data () { data() {
return { return {
loadding: false loadding: false
} }
}, },
methods: { methods: {
fetchNotice () { fetchNotice() {
if (this.loadding) { if (this.loadding) {
this.loadding = false this.loadding = false
return return

View File

@ -180,7 +180,7 @@ export default {
SettingItem SettingItem
}, },
mixins: [mixin, mixinDevice], mixins: [mixin, mixinDevice],
data () { data() {
return { return {
visible: true, visible: true,
colorList, colorList,
@ -190,7 +190,7 @@ export default {
watch: { watch: {
}, },
mounted () { mounted() {
const vm = this const vm = this
setTimeout(() => { setTimeout(() => {
vm.visible = false vm.visible = false
@ -204,29 +204,29 @@ export default {
} }
}, },
methods: { methods: {
showDrawer () { showDrawer() {
this.visible = true this.visible = true
}, },
onClose () { onClose() {
this.visible = false this.visible = false
}, },
toggle () { toggle() {
this.visible = !this.visible this.visible = !this.visible
}, },
onColorWeak (checked) { onColorWeak(checked) {
this.baseConfig.colorWeak = checked this.baseConfig.colorWeak = checked
this.$store.dispatch('ToggleWeak', checked) this.$store.dispatch('ToggleWeak', checked)
updateColorWeak(checked) updateColorWeak(checked)
}, },
onMultiTab (checked) { onMultiTab(checked) {
this.baseConfig.multiTab = checked this.baseConfig.multiTab = checked
this.$store.dispatch('ToggleMultiTab', checked) this.$store.dispatch('ToggleMultiTab', checked)
}, },
handleMenuTheme (theme) { handleMenuTheme(theme) {
this.baseConfig.navTheme = theme this.baseConfig.navTheme = theme
this.$store.dispatch('ToggleTheme', theme) this.$store.dispatch('ToggleTheme', theme)
}, },
doCopy () { doCopy() {
const text = `export default { const text = `export default {
primaryColor: '${this.baseConfig.primaryColor}', // primary color of ant design primaryColor: '${this.baseConfig.primaryColor}', // primary color of ant design
navTheme: '${this.baseConfig.navTheme}', // theme for nav menu navTheme: '${this.baseConfig.navTheme}', // theme for nav menu
@ -252,33 +252,33 @@ export default {
this.$message.error('复制失败') this.$message.error('复制失败')
}) })
}, },
handleLayout (mode) { handleLayout(mode) {
this.baseConfig.layout = mode this.baseConfig.layout = mode
this.$store.dispatch('ToggleLayoutMode', mode) this.$store.dispatch('ToggleLayoutMode', mode)
// //
// //
this.handleFixSiderbar(false) this.handleFixSiderbar(false)
}, },
handleContentWidthChange (type) { handleContentWidthChange(type) {
this.baseConfig.contentWidth = type this.baseConfig.contentWidth = type
this.$store.dispatch('ToggleContentWidth', type) this.$store.dispatch('ToggleContentWidth', type)
}, },
changeColor (color) { changeColor(color) {
this.baseConfig.primaryColor = color this.baseConfig.primaryColor = color
if (this.primaryColor !== color) { if (this.primaryColor !== color) {
this.$store.dispatch('ToggleColor', color) this.$store.dispatch('ToggleColor', color)
updateTheme(color) updateTheme(color)
} }
}, },
handleFixedHeader (fixed) { handleFixedHeader(fixed) {
this.baseConfig.fixedHeader = fixed this.baseConfig.fixedHeader = fixed
this.$store.dispatch('ToggleFixedHeader', fixed) this.$store.dispatch('ToggleFixedHeader', fixed)
}, },
handleFixedHeaderHidden (autoHidden) { handleFixedHeaderHidden(autoHidden) {
this.baseConfig.autoHideHeader = autoHidden this.baseConfig.autoHideHeader = autoHidden
this.$store.dispatch('ToggleFixedHeaderHidden', autoHidden) this.$store.dispatch('ToggleFixedHeaderHidden', autoHidden)
}, },
handleFixSiderbar (fixed) { handleFixSiderbar(fixed) {
if (this.layoutMode === 'topmenu') { if (this.layoutMode === 'topmenu') {
this.baseConfig.fixSiderbar = false this.baseConfig.fixSiderbar = false
this.$store.dispatch('ToggleFixSiderbar', false) this.$store.dispatch('ToggleFixSiderbar', false)

View File

@ -2,7 +2,7 @@ import T from 'ant-design-vue/es/table/Table'
import get from 'lodash.get' import get from 'lodash.get'
export default { export default {
data () { data() {
return { return {
needTotalList: [], needTotalList: [],
@ -64,7 +64,7 @@ export default {
} }
}), }),
watch: { watch: {
'localPagination.current' (val) { 'localPagination.current'(val) {
this.$router.push({ this.$router.push({
name: this.$route.name, name: this.$route.name,
params: Object.assign({}, this.$route.params, { params: Object.assign({}, this.$route.params, {
@ -72,23 +72,23 @@ export default {
}) })
}) })
}, },
pageNum (val) { pageNum(val) {
Object.assign(this.localPagination, { Object.assign(this.localPagination, {
current: val current: val
}) })
}, },
pageSize (val) { pageSize(val) {
Object.assign(this.localPagination, { Object.assign(this.localPagination, {
pageSize: val pageSize: val
}) })
}, },
showSizeChanger (val) { showSizeChanger(val) {
Object.assign(this.localPagination, { Object.assign(this.localPagination, {
showSizeChanger: val showSizeChanger: val
}) })
} }
}, },
created () { created() {
this.localPagination = ['auto', true].includes(this.showPagination) && Object.assign({}, this.localPagination, { this.localPagination = ['auto', true].includes(this.showPagination) && Object.assign({}, this.localPagination, {
current: this.pageNum, current: this.pageNum,
pageSize: this.pageSize, pageSize: this.pageSize,
@ -103,7 +103,7 @@ export default {
* 如果参数为 true, 则强制刷新到第一页 * 如果参数为 true, 则强制刷新到第一页
* @param Boolean bool * @param Boolean bool
*/ */
refresh (bool = false) { refresh(bool = false) {
bool && (this.localPagination = Object.assign({}, { bool && (this.localPagination = Object.assign({}, {
current: 1, pageSize: this.pageSize current: 1, pageSize: this.pageSize
})) }))
@ -115,7 +115,7 @@ export default {
* @param {Object} filters 过滤条件 * @param {Object} filters 过滤条件
* @param {Object} sorter 排序条件 * @param {Object} sorter 排序条件
*/ */
loadData (pagination, filters, sorter) { loadData(pagination, filters, sorter) {
this.localLoading = true this.localLoading = true
const parameter = Object.assign({ const parameter = Object.assign({
pageNo: (pagination && pagination.current) || pageNo: (pagination && pagination.current) ||
@ -159,7 +159,7 @@ export default {
}) })
} }
}, },
initTotalList (columns) { initTotalList(columns) {
const totalList = [] const totalList = []
columns && columns instanceof Array && columns.forEach(column => { columns && columns instanceof Array && columns.forEach(column => {
if (column.needTotal) { if (column.needTotal) {
@ -176,7 +176,7 @@ export default {
* @param selectedRowKeys * @param selectedRowKeys
* @param selectedRows * @param selectedRows
*/ */
updateSelect (selectedRowKeys, selectedRows) { updateSelect(selectedRowKeys, selectedRows) {
this.selectedRows = selectedRows this.selectedRows = selectedRows
this.selectedRowKeys = selectedRowKeys this.selectedRowKeys = selectedRowKeys
const list = this.needTotalList const list = this.needTotalList
@ -193,7 +193,7 @@ export default {
/** /**
* 清空 table 已选中项 * 清空 table 已选中项
*/ */
clearSelected () { clearSelected() {
if (this.rowSelection) { if (this.rowSelection) {
this.rowSelection.onChange([], []) this.rowSelection.onChange([], [])
this.updateSelect([], []) this.updateSelect([], [])
@ -204,7 +204,7 @@ export default {
* @param callback * @param callback
* @returns {*} * @returns {*}
*/ */
renderClear (callback) { renderClear(callback) {
if (this.selectedRowKeys.length <= 0) return null if (this.selectedRowKeys.length <= 0) return null
return ( return (
<a style="margin-left: 24px" onClick={() => { <a style="margin-left: 24px" onClick={() => {
@ -213,7 +213,7 @@ export default {
}}>清空</a> }}>清空</a>
) )
}, },
renderAlert () { renderAlert() {
// 绘制统计列数据 // 绘制统计列数据
const needTotalItems = this.needTotalList.map((item) => { const needTotalItems = this.needTotalList.map((item) => {
return (<span style="margin-right: 12px"> return (<span style="margin-right: 12px">
@ -241,7 +241,7 @@ export default {
} }
}, },
render () { render() {
const props = {} const props = {}
const localKeys = Object.keys(this.$data) 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 const showAlert = (typeof this.alert === 'object' && this.alert !== null && this.alert.show) && typeof this.rowSelection.selectedRowKeys !== 'undefined' || this.alert

View File

@ -11,17 +11,17 @@
<script> <script>
export default { export default {
data () { data() {
return { return {
name: '', name: '',
breadList: [] breadList: []
} }
}, },
created () { created() {
this.getBreadcrumb() this.getBreadcrumb()
}, },
methods: { methods: {
getBreadcrumb () { getBreadcrumb() {
console.log('this.$route.matched', this.$route.matched) console.log('this.$route.matched', this.$route.matched)
this.breadList = [] this.breadList = []
@ -35,7 +35,7 @@ export default {
} }
}, },
watch: { watch: {
$route () { $route() {
this.getBreadcrumb() this.getBreadcrumb()
} }
} }

View File

@ -24,7 +24,7 @@ const Item = {
type: Number type: Number
} }
}, },
render () { render() {
return ( return (
<Col {...{ props: responsive[this.col] }}> <Col {...{ props: responsive[this.col] }}>
<div class="term">{this.$props.term}</div> <div class="term">{this.$props.term}</div>
@ -69,7 +69,7 @@ export default {
default: 'horizontal' default: 'horizontal'
} }
}, },
provide () { provide() {
return { return {
col: this.col > 4 ? 4 : this.col col: this.col > 4 ? 4 : this.col
} }

View File

@ -49,14 +49,14 @@
<script> <script>
export default { export default {
name: 'HeaderNotice', name: 'HeaderNotice',
data () { data() {
return { return {
loadding: false, loadding: false,
visible: false visible: false
} }
}, },
methods: { methods: {
fetchNotice () { fetchNotice() {
if (!this.visible) { if (!this.visible) {
this.loadding = true this.loadding = true
setTimeout(() => { setTimeout(() => {

View File

@ -46,7 +46,7 @@ export default {
default: false default: false
} }
}, },
data () { data() {
return { return {
stepLoading: false, stepLoading: false,
@ -54,7 +54,7 @@ export default {
} }
}, },
methods: { methods: {
handleStepOk () { handleStepOk() {
const vm = this const vm = this
this.stepLoading = true this.stepLoading = true
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
@ -70,11 +70,11 @@ export default {
this.$emit('error', { err }) this.$emit('error', { err })
}) })
}, },
handleCancel () { handleCancel() {
this.visible = false this.visible = false
this.$emit('cancel') this.$emit('cancel')
}, },
onForgeStepCode () { onForgeStepCode() {
} }
} }

View File

@ -52,13 +52,13 @@ export default {
methods: { methods: {
...mapActions(['Logout']), ...mapActions(['Logout']),
...mapGetters(['nickname', 'avatar']), ...mapGetters(['nickname', 'avatar']),
handleLogout () { handleLogout() {
const that = this const that = this
this.$confirm({ this.$confirm({
title: '提示', title: '提示',
content: '真的要注销登录吗 ?', content: '真的要注销登录吗 ?',
onOk () { onOk() {
return that.Logout({}).then(() => { return that.Logout({}).then(() => {
window.location.reload() window.location.reload()
}).catch(err => { }).catch(err => {
@ -68,7 +68,7 @@ export default {
}) })
}) })
}, },
onCancel () { onCancel() {
} }
}) })
} }

View File

@ -81,7 +81,7 @@ router.afterEach(() => {
* @see https://github.com/sendya/ant-design-pro-vue/pull/53 * @see https://github.com/sendya/ant-design-pro-vue/pull/53
*/ */
const action = Vue.directive('action', { const action = Vue.directive('action', {
bind: function (el, binding, vnode) { bind: function(el, binding, vnode) {
const actionName = binding.arg const actionName = binding.arg
const roles = store.getters.roles const roles = store.getters.roles
const elVal = vnode.context.$route.meta.permission const elVal = vnode.context.$route.meta.permission

View File

@ -77,43 +77,43 @@ const app = {
} }
}, },
actions: { actions: {
setSidebar ({ commit }, type) { setSidebar({ commit }, type) {
commit('SET_SIDEBAR_TYPE', type) commit('SET_SIDEBAR_TYPE', type)
}, },
CloseSidebar ({ commit }) { CloseSidebar({ commit }) {
commit('CLOSE_SIDEBAR') commit('CLOSE_SIDEBAR')
}, },
ToggleDevice ({ commit }, device) { ToggleDevice({ commit }, device) {
commit('TOGGLE_DEVICE', device) commit('TOGGLE_DEVICE', device)
}, },
ToggleTheme ({ commit }, theme) { ToggleTheme({ commit }, theme) {
commit('TOGGLE_THEME', theme) commit('TOGGLE_THEME', theme)
}, },
ToggleLayoutMode ({ commit }, mode) { ToggleLayoutMode({ commit }, mode) {
commit('TOGGLE_LAYOUT_MODE', mode) commit('TOGGLE_LAYOUT_MODE', mode)
}, },
ToggleFixedHeader ({ commit }, fixedHeader) { ToggleFixedHeader({ commit }, fixedHeader) {
if (!fixedHeader) { if (!fixedHeader) {
commit('TOGGLE_FIXED_HEADER_HIDDEN', false) commit('TOGGLE_FIXED_HEADER_HIDDEN', false)
} }
commit('TOGGLE_FIXED_HEADER', fixedHeader) commit('TOGGLE_FIXED_HEADER', fixedHeader)
}, },
ToggleFixSiderbar ({ commit }, fixSiderbar) { ToggleFixSiderbar({ commit }, fixSiderbar) {
commit('TOGGLE_FIXED_SIDERBAR', fixSiderbar) commit('TOGGLE_FIXED_SIDERBAR', fixSiderbar)
}, },
ToggleFixedHeaderHidden ({ commit }, show) { ToggleFixedHeaderHidden({ commit }, show) {
commit('TOGGLE_FIXED_HEADER_HIDDEN', show) commit('TOGGLE_FIXED_HEADER_HIDDEN', show)
}, },
ToggleContentWidth ({ commit }, type) { ToggleContentWidth({ commit }, type) {
commit('TOGGLE_CONTENT_WIDTH', type) commit('TOGGLE_CONTENT_WIDTH', type)
}, },
ToggleColor ({ commit }, color) { ToggleColor({ commit }, color) {
commit('TOGGLE_COLOR', color) commit('TOGGLE_COLOR', color)
}, },
ToggleWeak ({ commit }, weakFlag) { ToggleWeak({ commit }, weakFlag) {
commit('TOGGLE_WEAK', weakFlag) commit('TOGGLE_WEAK', weakFlag)
}, },
ToggleMultiTab ({ commit }, bool) { ToggleMultiTab({ commit }, bool) {
commit('TOGGLE_MULTI_TAB', bool) commit('TOGGLE_MULTI_TAB', bool)
} }
} }

View File

@ -7,7 +7,7 @@ import { asyncRouterMap, constantRouterMap } from '@/config/router.config'
* @param route * @param route
* @returns {boolean} * @returns {boolean}
*/ */
function hasPermission (permission, route) { function hasPermission(permission, route) {
if (route.meta && route.meta.permission) { if (route.meta && route.meta.permission) {
let flag = false let flag = false
for (let i = 0, len = permission.length; i < len; i++) { 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 => { const accessedRouters = routerMap.filter(route => {
if (hasPermission(roles.permissionList, route)) { if (hasPermission(roles.permissionList, route)) {
if (route.children && route.children.length) { if (route.children && route.children.length) {
@ -62,7 +62,7 @@ const permission = {
} }
}, },
actions: { actions: {
GenerateRoutes ({ commit }, data) { GenerateRoutes({ commit }, data) {
return new Promise(resolve => { return new Promise(resolve => {
const { roles } = data const { roles } = data
const accessedRouters = filterAsyncRouter(asyncRouterMap, roles) const accessedRouters = filterAsyncRouter(asyncRouterMap, roles)

View File

@ -1,7 +1,7 @@
const VueAxios = { const VueAxios = {
vm: {}, vm: {},
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
install (Vue, instance) { install(Vue, instance) {
if (this.installed) { if (this.installed) {
return return
} }
@ -17,12 +17,12 @@ const VueAxios = {
Object.defineProperties(Vue.prototype, { Object.defineProperties(Vue.prototype, {
axios: { axios: {
get: function get () { get: function get() {
return instance return instance
} }
}, },
$http: { $http: {
get: function get () { get: function get() {
return instance return instance
} }
} }

View File

@ -1,4 +1,4 @@
export function actionToObject (json) { export function actionToObject(json) {
try { try {
return JSON.parse(json) return JSON.parse(json)
} catch (e) { } catch (e) {

View File

@ -58,7 +58,7 @@ service.interceptors.response.use((response) => {
const installer = { const installer = {
vm: {}, vm: {},
install (Vue) { install(Vue) {
Vue.use(VueAxios, service) Vue.use(VueAxios, service)
} }
} }

View File

@ -24,13 +24,13 @@ export default {
default: '404' default: '404'
} }
}, },
data () { data() {
return { return {
config: types config: types
} }
}, },
methods: { methods: {
handleToHome () { handleToHome() {
this.$router.push({ name: 'dashboard' }) this.$router.push({ name: 'dashboard' })
} }
} }

View File

@ -1,7 +1,7 @@
const path = require('path') const path = require('path')
const webpack = require('webpack') const webpack = require('webpack')
function resolve (dir) { function resolve(dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir)
} }