From 61aa570cf2aa4376fb48f71f80828379d60cb491 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=90=95=E9=87=91=E6=B3=BD?= <1098696801@qq.com>
Date: Sun, 20 Mar 2022 19:50:51 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtabs=20query=20bug=20?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../magic/basic/mb-editor-table.vue | 44 +++++++++++--------
.../src/components/magic/basic/mb-search.vue | 4 --
.../src/components/magic/form/mb-tree.vue | 4 --
magic-boot-ui/src/layout/tabs.vue | 19 +++++---
magic-boot-ui/src/main.js | 6 ++-
.../src/views/examples/editor-table.vue | 2 +-
.../src/views/system/menu/menu-list.vue | 8 ++--
.../src/views/system/office/office-list.vue | 6 +--
.../src/views/system/user/user-list.vue | 15 +++----
9 files changed, 56 insertions(+), 52 deletions(-)
diff --git a/magic-boot-ui/src/components/magic/basic/mb-editor-table.vue b/magic-boot-ui/src/components/magic/basic/mb-editor-table.vue
index 7ed256f..bf73ffe 100644
--- a/magic-boot-ui/src/components/magic/basic/mb-editor-table.vue
+++ b/magic-boot-ui/src/components/magic/basic/mb-editor-table.vue
@@ -28,7 +28,10 @@ const emit = defineEmits(['update:modelValue', 'change'])
const magicTable = ref()
const props = defineProps({
- modelValue: Array,
+ modelValue: {
+ type: Array,
+ default: () => []
+ },
cols: {
type: Array,
default: () => []
@@ -36,11 +39,15 @@ const props = defineProps({
showNo: {
type: Boolean,
default: true
+ },
+ operation: {
+ type: Boolean,
+ default: true
}
})
const tableOptions = reactive({
- data: [],
+ data: props.modelValue,
cols: [],
showNo: props.showNo
})
@@ -48,25 +55,26 @@ const tableOptions = reactive({
for (var i in props.cols) {
var col = props.cols[i]
tableOptions.cols.push({
- type: 'dynamic',
- field: col.field,
- label: col.label
+ ...col,
+ type: 'dynamic'
})
}
-tableOptions.cols.push({
- label: '操作',
- type: 'btns',
- width: 85,
- fixed: 'right',
- btns: [{
- label: '删除',
- type: 'danger',
- click: (row, index) => {
- tableOptions.data.splice(index, 1)
- }
- }]
-})
+if(props.operation){
+ tableOptions.cols.push({
+ label: '操作',
+ type: 'btns',
+ width: 85,
+ fixed: 'right',
+ btns: [{
+ label: '删除',
+ type: 'danger',
+ click: (row, index) => {
+ tableOptions.data.splice(index, 1)
+ }
+ }]
+ })
+}
watch(() => props.modelValue, (value) => {
console.log(value)
diff --git a/magic-boot-ui/src/components/magic/basic/mb-search.vue b/magic-boot-ui/src/components/magic/basic/mb-search.vue
index 7a084d3..d9e051f 100644
--- a/magic-boot-ui/src/components/magic/basic/mb-search.vue
+++ b/magic-boot-ui/src/components/magic/basic/mb-search.vue
@@ -56,10 +56,6 @@ for(var key in props.where){
}
}
-watch(() => props.where,() => {
- console.log(props.where)
-})
-
const emit = defineEmits(['search', 'mounted'])
function input(input){
diff --git a/magic-boot-ui/src/components/magic/form/mb-tree.vue b/magic-boot-ui/src/components/magic/form/mb-tree.vue
index af3a714..c601cfa 100644
--- a/magic-boot-ui/src/components/magic/form/mb-tree.vue
+++ b/magic-boot-ui/src/components/magic/form/mb-tree.vue
@@ -75,10 +75,6 @@ const props = defineProps({
}
})
-watch(() => props.checkedIds, (value) => {
- console.log(value)
-})
-
const tree = ref()
const treeData = ref([])
const searchData = ref([])
diff --git a/magic-boot-ui/src/layout/tabs.vue b/magic-boot-ui/src/layout/tabs.vue
index 83e770c..7b6deec 100644
--- a/magic-boot-ui/src/layout/tabs.vue
+++ b/magic-boot-ui/src/layout/tabs.vue
@@ -43,8 +43,10 @@
tabValue.value = global.tabValue.value
})
function openTab(item){
+ console.log(global.visitedViews.map(it => it.name))
proxy.$router.push({
- path: item.props.name
+ path: item.props.name,
+ query: global.visitedViews.filter(it => it.path == item.props.name)[0].query
})
}
function removeTab(path){
@@ -58,7 +60,8 @@
if(it.path == path){
global.visitedViews.splice(i, 1)
proxy.$router.push({
- path: global.visitedViews[global.visitedViews.length - 1].path
+ path: global.visitedViews[global.visitedViews.length - 1].path,
+ query: global.visitedViews[global.visitedViews.length - 1].query
})
}
})
@@ -66,7 +69,8 @@
}
function refresh(path){
proxy.$router.replace({
- path: `/redirect${path}`
+ path: `/redirect${path}`,
+ query: global.visitedViews.filter(it => it.path == path)[0].query
})
}
function close(type, path){
@@ -85,16 +89,17 @@
}
}
}else{
- for(var i = 0; i < global.visitedViews.length; i++){
- if(global.visitedViews[i].path != path){
- global.visitedViews.splice(i, 1)
+ for(var i = 0, len = global.visitedViews.length; i < len; i++){
+ if(global.visitedViews[0].path != path){
+ global.visitedViews.splice(0, 1)
}else{
break;
}
}
}
proxy.$router.push({
- path: path
+ path: path,
+ query: global.visitedViews.filter(it => it.path == path)[0].query
})
}
diff --git a/magic-boot-ui/src/main.js b/magic-boot-ui/src/main.js
index 7938870..725f958 100644
--- a/magic-boot-ui/src/main.js
+++ b/magic-boot-ui/src/main.js
@@ -24,9 +24,13 @@ document.title = global.title
router.beforeEach((to, from) => {
global.tabValue.value = to.path
if((to.name && global.visitedViews.length === 0 || global.visitedViews.every(it => it.path !== to.path)) && !to.path.startsWith('/redirect') && !to.path.startsWith('/login')){
- console.log(to)
global.visitedViews.push(to)
}
+ global.visitedViews.forEach((it, i) => {
+ if(it.path == to.path){
+ global.visitedViews[i] = to
+ }
+ })
return true
})
app.use(globalProperties)
diff --git a/magic-boot-ui/src/views/examples/editor-table.vue b/magic-boot-ui/src/views/examples/editor-table.vue
index 9db396d..adde219 100644
--- a/magic-boot-ui/src/views/examples/editor-table.vue
+++ b/magic-boot-ui/src/views/examples/editor-table.vue
@@ -1,7 +1,7 @@