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 @@ diff --git a/magic-boot-ui/src/views/system/menu/menu-list.vue b/magic-boot-ui/src/views/system/menu/menu-list.vue index 6b0a698..5be8de3 100644 --- a/magic-boot-ui/src/views/system/menu/menu-list.vue +++ b/magic-boot-ui/src/views/system/menu/menu-list.vue @@ -188,8 +188,8 @@ const tableOptions = reactive({ } ] }) -let dialogTitle = ref('') -let searchTimeout = reactive() +const dialogTitle = ref('') +var searchTimeout = reactive() const menuFormDialog = ref() const menuFormRef = ref() @@ -197,7 +197,6 @@ function reloadTable(){ proxy.$get('menu/tree').then(res => { menuData.value = res.data.list tableOptions.data = menuData.value - searchMenu() }) } @@ -208,6 +207,9 @@ function expand(){ } function searchMenu() { + refreshTable.value = false + tableOptions.el["default-expand-all"] = true + nextTick(() => refreshTable.value = true) clearTimeout(searchTimeout) searchTimeout = setTimeout(() => { if(searchValue.value){ diff --git a/magic-boot-ui/src/views/system/office/office-list.vue b/magic-boot-ui/src/views/system/office/office-list.vue index 9fc1461..40468b3 100644 --- a/magic-boot-ui/src/views/system/office/office-list.vue +++ b/magic-boot-ui/src/views/system/office/office-list.vue @@ -218,7 +218,7 @@ const rules = reactive({ name: [{ required: true, message: '请输入机构名称', trigger: 'change' }], code: [{ required: true, message: '请输入机构编码', trigger: 'change' }] }) -const searchTimeout = null +var searchTimeout = null const officeFormDialog = ref() const dataForm = ref() @@ -237,9 +237,7 @@ watch(officeData, () => { function expand(){ refreshTable.value = false tableOptions.el["default-expand-all"] = !tableOptions.el["default-expand-all"] - nextTick(() => { - refreshTable.value = true - }) + nextTick(() => refreshTable.value = true) } function searchOffice() { diff --git a/magic-boot-ui/src/views/system/user/user-list.vue b/magic-boot-ui/src/views/system/user/user-list.vue index 6f02162..c534243 100644 --- a/magic-boot-ui/src/views/system/user/user-list.vue +++ b/magic-boot-ui/src/views/system/user/user-list.vue @@ -22,12 +22,11 @@ search-width="100%" :checked="false" @check-change="checkChange" - @mounted="treeMounted" />
- +