Merge branch 'develop'
Former-commit-id: 81095a219824f8ddf2d52a30df0f6ee4a69d0456
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "d2-admin",
|
"name": "d2-admin",
|
||||||
"version": "1.6.14",
|
"version": "1.6.15",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve --open",
|
"serve": "vue-cli-service serve --open",
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<el-dropdown
|
<el-dropdown
|
||||||
size="default"
|
size="default"
|
||||||
split-button
|
split-button
|
||||||
@click="handleControlBtnClick"
|
@click="closeAll"
|
||||||
@command="command => handleControlItemClick(command)">
|
@command="command => handleControlItemClick(command)">
|
||||||
<d2-icon name="times-circle"/>
|
<d2-icon name="times-circle"/>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
@@ -131,8 +131,7 @@ export default {
|
|||||||
this.contextmenuFlag = false
|
this.contextmenuFlag = false
|
||||||
}
|
}
|
||||||
const params = {
|
const params = {
|
||||||
pageSelect: tagName,
|
pageSelect: tagName
|
||||||
vm: this
|
|
||||||
}
|
}
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case 'left':
|
case 'left':
|
||||||
@@ -145,19 +144,13 @@ export default {
|
|||||||
this.closeOther(params)
|
this.closeOther(params)
|
||||||
break
|
break
|
||||||
case 'all':
|
case 'all':
|
||||||
this.closeAll(this)
|
this.closeAll()
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
this.$message.error('无效的操作')
|
this.$message.error('无效的操作')
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* @description 接收点击关闭控制上按钮的事件
|
|
||||||
*/
|
|
||||||
handleControlBtnClick () {
|
|
||||||
this.closeAll(this)
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* @description 接收点击 tab 标签的事件
|
* @description 接收点击 tab 标签的事件
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { get } from 'lodash'
|
import { get } from 'lodash'
|
||||||
|
import router from '@/router'
|
||||||
// 设置文件
|
|
||||||
import setting from '@/setting.js'
|
import setting from '@/setting.js'
|
||||||
|
|
||||||
// 判定是否需要缓存
|
// 判定是否需要缓存
|
||||||
@@ -168,9 +167,9 @@ export default {
|
|||||||
* @class opened
|
* @class opened
|
||||||
* @description 关闭一个 tag (关闭一个页面)
|
* @description 关闭一个 tag (关闭一个页面)
|
||||||
* @param {Object} state vuex state
|
* @param {Object} state vuex state
|
||||||
* @param {Object} param { tagName: 要关闭的标签名字, vm: vue }
|
* @param {Object} param { tagName: 要关闭的标签名字 }
|
||||||
*/
|
*/
|
||||||
close ({ state, commit, dispatch }, { tagName, vm }) {
|
close ({ state, commit, dispatch }, { tagName }) {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
// 下个新的页面
|
// 下个新的页面
|
||||||
let newPage = state.opened[0]
|
let newPage = state.opened[0]
|
||||||
@@ -208,7 +207,7 @@ export default {
|
|||||||
params,
|
params,
|
||||||
query
|
query
|
||||||
}
|
}
|
||||||
vm.$router.push(routerObj)
|
router.push(routerObj)
|
||||||
}
|
}
|
||||||
// end
|
// end
|
||||||
resolve()
|
resolve()
|
||||||
@@ -218,9 +217,9 @@ export default {
|
|||||||
* @class opened
|
* @class opened
|
||||||
* @description 关闭当前标签左边的标签
|
* @description 关闭当前标签左边的标签
|
||||||
* @param {Object} state vuex state
|
* @param {Object} state vuex state
|
||||||
* @param {Object} param { pageSelect: 当前选中的tagName, vm: vue }
|
* @param {Object} param { pageSelect: 当前选中的tagName }
|
||||||
*/
|
*/
|
||||||
closeLeft ({ state, commit, dispatch }, { pageSelect, vm } = {}) {
|
closeLeft ({ state, commit, dispatch }, { pageSelect } = {}) {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
const pageAim = pageSelect || state.current
|
const pageAim = pageSelect || state.current
|
||||||
let currentIndex = 0
|
let currentIndex = 0
|
||||||
@@ -234,8 +233,8 @@ export default {
|
|||||||
state.opened.splice(1, currentIndex - 1).forEach(({ name }) => commit('keepAliveRemove', name))
|
state.opened.splice(1, currentIndex - 1).forEach(({ name }) => commit('keepAliveRemove', name))
|
||||||
}
|
}
|
||||||
state.current = pageAim
|
state.current = pageAim
|
||||||
if (vm && vm.$route.fullPath !== pageAim) {
|
if (router.app.$route.fullPath !== pageAim) {
|
||||||
vm.$router.push(pageAim)
|
router.push(pageAim)
|
||||||
}
|
}
|
||||||
// 持久化
|
// 持久化
|
||||||
await dispatch('opend2db')
|
await dispatch('opend2db')
|
||||||
@@ -247,9 +246,9 @@ export default {
|
|||||||
* @class opened
|
* @class opened
|
||||||
* @description 关闭当前标签右边的标签
|
* @description 关闭当前标签右边的标签
|
||||||
* @param {Object} state vuex state
|
* @param {Object} state vuex state
|
||||||
* @param {Object} param { pageSelect: 当前选中的tagName, vm: vue }
|
* @param {Object} param { pageSelect: 当前选中的tagName }
|
||||||
*/
|
*/
|
||||||
closeRight ({ state, commit, dispatch }, { pageSelect, vm } = {}) {
|
closeRight ({ state, commit, dispatch }, { pageSelect } = {}) {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
const pageAim = pageSelect || state.current
|
const pageAim = pageSelect || state.current
|
||||||
let currentIndex = 0
|
let currentIndex = 0
|
||||||
@@ -262,8 +261,8 @@ export default {
|
|||||||
state.opened.splice(currentIndex + 1).forEach(({ name }) => commit('keepAliveRemove', name))
|
state.opened.splice(currentIndex + 1).forEach(({ name }) => commit('keepAliveRemove', name))
|
||||||
// 设置当前的页面
|
// 设置当前的页面
|
||||||
state.current = pageAim
|
state.current = pageAim
|
||||||
if (vm && vm.$route.fullPath !== pageAim) {
|
if (router.app.$route.fullPath !== pageAim) {
|
||||||
vm.$router.push(pageAim)
|
router.push(pageAim)
|
||||||
}
|
}
|
||||||
// 持久化
|
// 持久化
|
||||||
await dispatch('opend2db')
|
await dispatch('opend2db')
|
||||||
@@ -275,9 +274,9 @@ export default {
|
|||||||
* @class opened
|
* @class opened
|
||||||
* @description 关闭当前激活之外的 tag
|
* @description 关闭当前激活之外的 tag
|
||||||
* @param {Object} state vuex state
|
* @param {Object} state vuex state
|
||||||
* @param {Object} param { pageSelect: 当前选中的tagName, vm: vue }
|
* @param {Object} param { pageSelect: 当前选中的tagName }
|
||||||
*/
|
*/
|
||||||
closeOther ({ state, commit, dispatch }, { pageSelect, vm } = {}) {
|
closeOther ({ state, commit, dispatch }, { pageSelect } = {}) {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
const pageAim = pageSelect || state.current
|
const pageAim = pageSelect || state.current
|
||||||
let currentIndex = 0
|
let currentIndex = 0
|
||||||
@@ -295,8 +294,8 @@ export default {
|
|||||||
}
|
}
|
||||||
// 设置新的页面
|
// 设置新的页面
|
||||||
state.current = pageAim
|
state.current = pageAim
|
||||||
if (vm && vm.$route.fullPath !== pageAim) {
|
if (router.app.$route.fullPath !== pageAim) {
|
||||||
vm.$router.push(pageAim)
|
router.push(pageAim)
|
||||||
}
|
}
|
||||||
// 持久化
|
// 持久化
|
||||||
await dispatch('opend2db')
|
await dispatch('opend2db')
|
||||||
@@ -308,17 +307,16 @@ export default {
|
|||||||
* @class opened
|
* @class opened
|
||||||
* @description 关闭所有 tag
|
* @description 关闭所有 tag
|
||||||
* @param {Object} state vuex state
|
* @param {Object} state vuex state
|
||||||
* @param {Object} vm vue
|
|
||||||
*/
|
*/
|
||||||
closeAll ({ state, commit, dispatch }, vm) {
|
closeAll ({ state, commit, dispatch }) {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
// 删除打开的页面 并在缓存设置中删除
|
// 删除打开的页面 并在缓存设置中删除
|
||||||
state.opened.splice(1).forEach(({ name }) => commit('keepAliveRemove', name))
|
state.opened.splice(1).forEach(({ name }) => commit('keepAliveRemove', name))
|
||||||
// 持久化
|
// 持久化
|
||||||
await dispatch('opend2db')
|
await dispatch('opend2db')
|
||||||
// 关闭所有的标签页后需要判断一次现在是不是在首页
|
// 关闭所有的标签页后需要判断一次现在是不是在首页
|
||||||
if (vm.$route.name !== 'index') {
|
if (router.app.$route.name !== 'index') {
|
||||||
vm.$router.push({
|
router.push({
|
||||||
name: 'index'
|
name: 'index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user