This commit is contained in:
tanyp 2023-04-17 11:51:50 +08:00
parent 9d95091cc5
commit 7700c383d6
21 changed files with 364 additions and 44 deletions

File diff suppressed because one or more lines are too long

View File

@ -102,9 +102,10 @@
</el-aside>
<el-main>
<TabsMenu></TabsMenu>
<router-view />
<router-view style="margin: 0 0.3rem 0 0.1rem"/>
</el-main>
</el-container>
<el-backtop target=".el-main"></el-backtop>
</el-container>
</div>
</template>

View File

@ -7,8 +7,10 @@ import './styles/index.scss'
import * as ElIcons from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'uno.css'
import globalProperties from './utils/globalProperties'
const app = createApp(App)
app.use(globalProperties)
app.use(router)
app.use(ElementPlus,{
locale: zhCn,

View File

@ -0,0 +1,5 @@
// 全局变量配置
export default {
baseApi: import.meta.env.VITE_BASE_API,
cardShadow: 'always',
}

View File

@ -0,0 +1,8 @@
// 全局变量
import global from './global'
const install = (app) => {
app.config.globalProperties.$global = global
}
export default install

View File

@ -1,17 +1,18 @@
<script setup lang="ts">
import { reactive, onMounted } from "vue"
import { reactive, onMounted, getCurrentInstance } from "vue"
const state = reactive({
shadow: 'always',
})
const { proxy } = getCurrentInstance()
const state = reactive({
})
onMounted(()=>{
})
onMounted(()=>{
})
</script>
<template>
<el-card class="home-container" :shadow="state.shadow">
<el-card class="home-container" :shadow="proxy.$global.cardShadow">
首页
</el-card>
</template>

View File

@ -1,5 +1,7 @@
<script setup lang="ts">
import { reactive, onMounted } from "vue"
import { reactive, onMounted, getCurrentInstance } from "vue"
const { proxy } = getCurrentInstance()
const state = reactive({
shadow: 'always',
@ -11,7 +13,7 @@
</script>
<template>
<el-card class="codegen-container" :shadow="state.shadow">
<el-card class="codegen-container" :shadow="proxy.$global.cardShadow">
开发中
</el-card>
</template>

View File

@ -1,22 +1,18 @@
<script setup lang="ts">
import { reactive, onMounted } from "vue"
import { reactive, getCurrentInstance } from "vue"
const state = reactive({
shadow: 'always',
})
const { proxy } = getCurrentInstance()
onMounted(()=>{
})
const state = reactive({
url: proxy.$global.baseApi + '/tansci/magic/web/index.html'
})
</script>
<template>
<el-card class="interface-container" :shadow="state.shadow">
开发中
</el-card>
<e-card :shadow="proxy.$global.cardShadow">
<iframe :src="state.url" width="100%" height="90%" frameborder="0"></iframe>
</e-card>
</template>
<style lang="scss" scoped>
.interface-container{
}
<style scoped>
</style>

View File

@ -1,8 +1,9 @@
<script setup lang="ts">
import { reactive, onMounted } from "vue"
import { reactive, onMounted, getCurrentInstance } from "vue"
import Table from '@/components/Table.vue'
import { page } from "@/api/monitor/loginLog"
const { proxy } = getCurrentInstance()
const state = reactive({
loading: false,
page: {
@ -73,7 +74,7 @@
</script>
<template>
<el-card class="loginlog-container" shadow="always">
<el-card class="loginlog-container" :shadow="proxy.$global.cardShadow">
<Table :data="state.tableData" :column="state.tableTitle" :operation="state.operation" :page="state.page" :loading="state.loading"
@onSizeChange="onSizeChange" @onCurrentChange="onCurrentChange" @setCellColor="setCellColor">
</Table>

View File

@ -1,10 +1,11 @@
<script setup lang="ts">
import {onMounted, reactive, ref, unref} from 'vue'
import {onMounted, reactive, ref, unref, getCurrentInstance} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import type {FormInstance} from 'element-plus'
import Table from '@/components/Table.vue'
import {page,kick} from '@/api/monitor/onlineUser'
const { proxy } = getCurrentInstance()
const searchForm = reactive({
username: null
})
@ -84,7 +85,7 @@
</script>
<template>
<el-card class="onlineuser-container" shadow="always">
<el-card class="onlineuser-container" :shadow="proxy.$global.cardShadow">
<Table :data="table.tableData" :column="table.tableTitle" :operation="table.operation" :page="table.page" :loading="table.loading"
@onSizeChange="onSizeChange" @onCurrentChange="onCurrentChange">
<template #search>

View File

@ -1,8 +1,9 @@
<script setup lang="ts">
import { reactive, onMounted } from "vue"
import { reactive, onMounted, getCurrentInstance } from "vue"
import Table from '@/components/Table.vue'
import { page } from "@/api/monitor/operLog"
const { proxy } = getCurrentInstance()
const state = reactive({
loading: false,
page: {
@ -84,7 +85,7 @@
</script>
<template>
<el-card class="operlog-container" shadow="always">
<el-card class="operlog-container" :shadow="proxy.$global.cardShadow">
<Table :data="state.tableData" :column="state.tableTitle" :operation="state.operation" :page="state.page" :loading="state.loading"
@onSizeChange="onSizeChange" @onCurrentChange="onCurrentChange" @setCellColor="setCellColor">
<template #column="scope">

View File

@ -1,11 +1,12 @@
<script setup lang="ts">
import {onMounted, reactive, ref} from 'vue'
import {onMounted, reactive, ref, getCurrentInstance} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import type {FormInstance} from 'element-plus'
import common from '@/utils/common'
import Table from '@/components/Table.vue'
import {tree,save,update,del} from '@/api/system/dict'
const { proxy } = getCurrentInstance()
const table = reactive({
loading: false,
operation:{
@ -143,7 +144,7 @@
</script>
<template>
<el-card class="dict-container" shadow="always">
<el-card class="dict-container" :shadow="proxy.$global.cardShadow">
<Table :data="table.tableData" :column="table.tableTitle" :operation="table.operation" :page="false" :loading="table.loading">
<template #search>
<div><el-button @click="onAdd(null)" type="primary">添加</el-button></div>

View File

@ -1,10 +1,11 @@
<script setup lang="ts">
import {onMounted, reactive, ref} from 'vue'
import {onMounted, reactive, ref, getCurrentInstance} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import type {FormInstance} from 'element-plus'
import {list,save,update,del} from '@/api/system/menu'
import ElIcon from '@/components/ElIcon.vue'
const { proxy } = getCurrentInstance()
const menuFormRef = ref<FormInstance>();
const state = reactive({
treeData: [],
@ -187,7 +188,7 @@
}
</script>
<template>
<el-card class="menu-container" shadow="always">
<el-card class="menu-container" :shadow="proxy.$global.cardShadow">
<el-card class="menu-tree" shadow="never">
<el-tree :data="state.treeData" :props="{children: 'children', label: 'chineseName'}" highlight-current @node-click="onNodeClick" empty-text="暂无菜单">
<template #default="{ node, data }">

View File

@ -1,10 +1,11 @@
<script setup lang="ts">
import {onMounted, reactive, ref} from 'vue'
import {onMounted, reactive, ref, getCurrentInstance} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import type {FormInstance} from 'element-plus'
import Table from '@/components/Table.vue'
import {list,save,update,del} from '@/api/system/org'
const { proxy } = getCurrentInstance()
const table = reactive({
loading: false,
operation:{
@ -126,7 +127,7 @@
</script>
<template>
<el-card class="org-container" shadow="always">
<el-card class="org-container" :shadow="proxy.$global.cardShadow">
<Table :data="table.tableData" :column="table.tableTitle" :operation="table.operation" :page="false" :loading="table.loading">
<template #search>
<div><el-button @click="onAdd(null)" type="primary">添加</el-button></div>

View File

@ -1,10 +1,11 @@
<script setup lang="ts">
import {onMounted, reactive, ref, unref} from 'vue'
import {onMounted, reactive, ref, unref, getCurrentInstance} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import type {FormInstance} from 'element-plus'
import {page,save,update,del,dataPermissions,orgList,menuPermissions,menuList} from '@/api/system/role'
import Table from '@/components/Table.vue'
const { proxy } = getCurrentInstance()
const searchForm = reactive({
name: null,
})
@ -208,7 +209,7 @@
</script>
<template>
<el-card class="role-container" shadow="always">
<el-card class="role-container" :shadow="proxy.$global.cardShadow">
<Table :data="table.tableData" :column="table.tableTitle" :operation="table.operation" :page="table.page" :loading="table.loading"
@onSizeChange="onSizeChange" @onCurrentChange="onCurrentChange">
<template #search>

View File

@ -1,10 +1,11 @@
<script setup lang="ts">
import {onMounted, reactive, ref, unref} from 'vue'
import {onMounted, reactive, ref, unref, getCurrentInstance} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import type {FormInstance} from 'element-plus'
import Table from '@/components/Table.vue'
import {page,save,update,del,roleList} from '@/api/system/user'
const { proxy } = getCurrentInstance()
const searchForm = reactive({
username: null
})
@ -217,7 +218,7 @@
</script>
<template>
<el-card class="user-container" shadow="always">
<el-card class="user-container" :shadow="proxy.$global.cardShadow">
<Table :data="table.tableData" :column="table.tableTitle" :operation="table.operation" :page="table.page" :loading="table.loading"
@onSizeChange="onSizeChange" @onCurrentChange="onCurrentChange" @onSwitchChange="onSwitchChange">
<template #search>

View File

@ -23,6 +23,7 @@
<knife4j-spring-boot.version>3.0.3</knife4j-spring-boot.version>
<hutool-all.version>5.7.22</hutool-all.version>
<fastjson2.version>2.0.26</fastjson2.version>
<magic-api.version>2.1.0</magic-api.version>
</properties>
<dependencies>
@ -83,6 +84,12 @@
<version>${fastjson2.version}</version>
</dependency>
<dependency>
<groupId>org.ssssssss</groupId>
<artifactId>magic-api-spring-boot-starter</artifactId>
<version>${magic-api.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@ -0,0 +1,57 @@
package com.tansci.config;
import com.tansci.common.WrapMapper;
import org.springframework.stereotype.Component;
import org.ssssssss.magicapi.core.context.RequestEntity;
import org.ssssssss.magicapi.core.interceptor.ResultProvider;
import org.ssssssss.magicapi.modules.db.model.Page;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName MagicAPIJsonConfig.java
* @ClassPath com.tansci.config.MagicAPIJsonConfig.java
* @Description 统一请求响应配置
* @Author tanyp
* @Date 2023/4/17 9:43
**/
@Component
public class MagicAPIJsonConfig implements ResultProvider {
/**
* @MonthName buildResult
* @Description 定义返回结果默认返回JsonBean
* @Author tanyp
* @Date 2023/4/17 9:45
* @Param [requestEntity, i, s, o]
* @return java.lang.Object
**/
@Override
public Object buildResult(RequestEntity requestEntity, int code, String message, Object data) {
return WrapMapper.wrap(code, message, data);
}
/**
* @MonthName buildPageResult
* @Description 定义分页返回结果
* @Author tanyp
* @Date 2023/4/17 9:47
* @Param [requestEntity, page, total, data]
* @return java.lang.Object
**/
@Override
public Object buildPageResult(RequestEntity requestEntity, Page page, long total, List<Map<String, Object>> data) {
return new HashMap<String,Object>(){
{
put("total", total);
put("pages", page.getOffset());
put("size", page.getLimit());
put("records", data);
}
};
}
}

View File

@ -23,7 +23,7 @@ public class SaTokenConfig implements WebMvcConfigurer {
// 验证所有接口
.addPathPatterns("/**")
// 忽略校验
.excludePathPatterns("/auth/**");
.excludePathPatterns("/auth/**", "//magic/web/**");
}
}

View File

@ -0,0 +1 @@

View File

@ -54,4 +54,32 @@ sa-token:
# token风格
token-style: uuid
# 是否输出操作日志
is-log: false
is-log: false
# magic-api
magic-api:
# 配置web页面入口
web: /magic/web
# 配置文件存储位置
resource:
type: database # 配置存储在数据库中
tableName: magic_api_file # 数据库中的表名
# datasource: tansci_boot # 指定数据源(单数据源时无需配置,多数据源时默认使用主数据源,如果存在其他数据源中需要指定。)
prefix: /magic-api # key前缀
readonly: false # 是否是只读模式
# location: data/magic-api #存储路径
prefix: / # 接口前缀,可以不配置
show-sql: true # 配置打印SQL
sql-column-case: camel # 启用驼峰命名转换
cache:
enable: true #开启缓存,默认是不开启的
ttl: 3600000 #有效期1小时默认-1 即永不过期
response-code:
success: 200 #执行成功的code值
invalid: 400 #参数验证未通过的code值
exception: 500 #执行出现异常的code值
date-pattern: # 配置请求参数支持的日期格式
- yyyy-MM-dd
- yyyy-MM-dd HH:mm:ss
- yyyyMMddHHmmss
- yyyyMMdd