diff --git a/.env b/.env index 46c4d4e7c112058e66ad84003db5691ba2b72e50..ad25699586d68c0a4ffb4253cf843d52e6bc8cce 100644 --- a/.env +++ b/.env @@ -4,10 +4,7 @@ VUE_APP_TITLE=ZeroVue # 网络请求公用地址 -VUE_APP_API=/zero - -# 仓库地址 -VUE_APP_REPO=https://baidu.com +VUE_APP_API=http://127.0.0.1 # 国际化配置 VUE_APP_I18N_LOCALE=zh-chs diff --git a/package.json b/package.json index 318919a38549799b0091f242e78ff524583eb2e2..0921a5d37505ca9b6c445e7ded385ba5c6d31b72 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "better-scroll": "^1.15.2", "core-js": "^3.4.3", "dayjs": "^1.8.17", - "e-icon-picker": "^1.0.4", - "element-ui": "^2.13.1", + "e-icon-picker": "^1.0.13", + "element-ui": "2.13.2", "faker": "^4.1.0", "flex.css": "^1.1.7", "fuse.js": "^5.2.3", diff --git a/src/api/axios.js b/src/api/axios.js index d6eb5763b25abbfcf2f4e030f971b1378c65dc2d..0703dcb0f47f8710f7739633e5f674f072883af0 100644 --- a/src/api/axios.js +++ b/src/api/axios.js @@ -75,10 +75,27 @@ function createService () { default: break } if (!error.response.data.code) { - error.message = '服务器宕机' + /** + * 第一种情况,服务器宕机 + * 第二种情况,返回的是流json + */ + if (error.response.data.type === 'application/json') { + // 将blob文件流转换成json + const reader = new FileReader() + reader.onload = function (event) { + const message = JSON.parse(reader.result).msg + error.message = message + errorLog(error) + } + reader.readAsText(error.response.data) + } else { + error.message = '服务器宕机' + errorLog(error) + } + } else { + errorLog(error) } } - errorLog(error) return Promise.reject(error) } ) diff --git a/src/assets/images/login/login-code.png b/src/assets/images/login/login-code.png deleted file mode 100644 index 14bf592497077b670ce8f166477e0b32a4e47d81..0000000000000000000000000000000000000000 Binary files a/src/assets/images/login/login-code.png and /dev/null differ diff --git a/src/assets/style/theme/theme-base.scss b/src/assets/style/theme/theme-base.scss index 9cb2f6905558ee56a35856fec4225ce31c8e0b78..5a3c4d68e6b60977a9eb519a0bd92324715f35eb 100644 --- a/src/assets/style/theme/theme-base.scss +++ b/src/assets/style/theme/theme-base.scss @@ -1,3 +1,6 @@ +//--------------------------------------全局样式定义文件-------------------------------------------------- + + // 减小弹出菜单的项目高度 .el-menu--popup { .el-menu-item { @@ -296,14 +299,15 @@ height: auto !important; } .zero-container-full__aside { - padding-left: 10px; - // padding: 10px; + // padding-left: 100px; + padding: 10px; border-right:1px solid #cfd7e5; // overflow:hidden; } .zero-container-full__main { - padding: 0px !important; - height: 100%; + // padding: 0px !important; + // height: auto; + overflow:hidden !important } .zero-container-full__body { flex-grow: 1; @@ -313,7 +317,7 @@ } .zero-container-full__footer { padding: 10px; - border-top: 0px !important + // border-top: 0px !important } } // 填充式布局组件 - 滚动优化 @@ -463,3 +467,37 @@ } } } +// -----------------------------------自定义全局样式-------------------------------------- +// 对树形el-tree的处理 +.custom-tree-node { + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + /* font-size: 24px; */ + /* padding-right: 100px; */ + height: 100%; +} +.zero-tree .el-tree-node__content { + height: 40px; +} + +.el-tree>.el-tree-node{ + display:inline-block; + min-width: 100%; +} + + +.tree { + overflow-y: auto; + min-height: 180px; + max-height: 300px; + border: 1px solid #e4e7ed; + border-top: 0px; +} + +// 查询样式 +.zero-search-from { + margin-bottom: -10px; + padding-top: 15px; +} \ No newline at end of file diff --git a/src/components/page-footer/PageFooter.vue b/src/components/page-footer/PageFooter.vue deleted file mode 100644 index f5d8f0bd1c15e38b5d33912825009a7635032113..0000000000000000000000000000000000000000 --- a/src/components/page-footer/PageFooter.vue +++ /dev/null @@ -1,84 +0,0 @@ - - - - - diff --git a/src/components/zero-container/components/zero-container-full.vue b/src/components/zero-container/components/zero-container-full.vue index 8670f6116a91ea34fcabf0a66d04416b4ea0c1f4..5be766dc7c6efdee5b5e4eee6a60ad48df48e59d 100644 --- a/src/components/zero-container/components/zero-container-full.vue +++ b/src/components/zero-container/components/zero-container-full.vue @@ -24,14 +24,3 @@ export default { name: 'zero-container-full' } - diff --git a/src/layout/header-aside/components/header-user/index.vue b/src/layout/header-aside/components/header-user/index.vue index 531a13d547657fbdefeb93adc66e04cfc59cb6d8..04c86c89fd030936aeb930c4f4603a609625233c 100644 --- a/src/layout/header-aside/components/header-user/index.vue +++ b/src/layout/header-aside/components/header-user/index.vue @@ -31,7 +31,7 @@ export default { */ logOff () { const config = { - url: '/sysLogout', + url: '/sysUser/sysLogout', method: 'post', headers: { Authorization: util.storage.get('token') diff --git a/src/layout/header-aside/components/tabs/index.vue b/src/layout/header-aside/components/tabs/index.vue index e2f9f8ef1b9c89244d02dbeebb08865726f76bcf..6e6171cdf09d559daafda44d79d145538e8845d7 100644 --- a/src/layout/header-aside/components/tabs/index.vue +++ b/src/layout/header-aside/components/tabs/index.vue @@ -27,6 +27,9 @@
+ + +
- +
@@ -64,7 +64,8 @@
- + +
@@ -86,7 +87,7 @@ import zeroHeaderSize from './components/header-size' import zeroHeaderTheme from './components/header-theme' import zeroHeaderUser from './components/header-user' import zeroHeaderColor from './components/header-color' -import zeroHeaderClock from './components/header-clock' +// import zeroHeaderClock from './components/header-clock' import { mapState, mapGetters, mapActions } from 'vuex' import mixinSearch from './mixins/search' import util from '@/libs/util.js' @@ -104,8 +105,9 @@ export default { zeroHeaderSize, zeroHeaderTheme, zeroHeaderUser, - zeroHeaderColor, - zeroHeaderClock + zeroHeaderColor + // , + // zeroHeaderClock }, data () { return { @@ -127,6 +129,15 @@ export default { ...mapGetters('zerovue', { themeActiveSetting: 'theme/activeSetting' }), + /** + * @description 用来实现带参路由的缓存 + */ + routerViewKey () { + // 默认情况下 key 类似 __transition-n-/foo + // 这里的字符串操作是为了最终 key 的格式和原来相同 类似 __transition-n-__stamp-time-/foo + const stamp = this.$route.meta[`__stamp-${this.$route.path}`] || '' + return `${stamp ? `__stamp-${stamp}-` : ''}${this.$route.path}` + }, /** * @description 最外层容器的背景图片样式 */ diff --git a/src/main.js b/src/main.js index 9ae2256b83d3b61a641df4c0a2fbe8c5bc5f2637..a63a53512d100ba32d68ce9921508827f33407a4 100644 --- a/src/main.js +++ b/src/main.js @@ -1,3 +1,9 @@ + +import iconPicker from 'e-icon-picker' +import 'e-icon-picker/dist/symbol.js' // 基本彩色图标库 +import 'e-icon-picker/dist/index.css' // 基本样式,包含基本图标 +import 'font-awesome/css/font-awesome.min.css' // font-awesome 图标库 +import 'element-ui/lib/theme-chalk/icon.css' // element-ui 图标库 // Vue import Vue from 'vue' import i18n from './i18n' @@ -11,9 +17,6 @@ import store from '@/store/index' import router, { constantRoutes, createRoutesInLayout, routesOutLayout, resetRouter } from './router' import { request } from './api/axios' import { hasPermission, handleMenu, handleRouter } from './api/common' -import iconPicker from 'e-icon-picker' -import 'e-icon-picker/dist/index.css'// 基础样式 -import 'e-icon-picker/dist/main.css' // fontAwesome 图标库样式 import util from '@/libs/util.js' import JSEncrypt from 'jsencrypt' import JsonViewer from 'vue-json-viewer' @@ -23,7 +26,7 @@ import 'vxe-table/lib/index.css' Vue.use(VXETable) -Vue.use(iconPicker) +Vue.use(iconPicker, { eIcon: false }) Vue.use(JsonViewer) // 核心插件 @@ -47,6 +50,7 @@ request({ url: '/sysUser/initFrontEndInfo', method: 'get' }).then(res => { * 判断是否有res,当 */ if (res && res.data) { + console.log(222) // [菜单] 处理菜单 const menu = handleMenu(res.data.menuInfo) // [菜单] 设置侧边栏菜单 @@ -64,6 +68,8 @@ request({ url: '/sysUser/initFrontEndInfo', method: 'get' }).then(res => { // [ 路由 ] 重新设置多标签页池 store.commit('zerovue/page/init', routes) } else { + // 删除 + util.storage.removeAll() // [ 路由 ] 重新设置多标签页池 store.commit('zerovue/page/init', constantRoutes) } diff --git a/src/mixins/view-module.js b/src/mixins/view-module.js index 29e71d9a90776507264f2775a22d8f3c10c731af..f62d3351dd2b1d0e3675f000ff43a00152cc612e 100644 --- a/src/mixins/view-module.js +++ b/src/mixins/view-module.js @@ -5,7 +5,7 @@ import qs from 'qs' export default { data () { return { - // 设置属性 + // 设置属性 mixinViewModuleOptions: { activatedIsNeed: true, // 此页面是否在激活(进入)时,调用查询数据列表接口? getDataListUrl: '', // 数据列表接口,API地址 @@ -13,7 +13,8 @@ export default { deleteUrl: '', // 删除接口,API地址 batchDelKey: 'id', // 删除接口,批量状态下由那个key进行标记操作?比如:pid,uid... exportUrl: '', // 导出接口,API地址 - dictCodes: '' // 页面初始化需要加载的字典,多个字典用逗号隔开 + dictCodes: '', // 页面初始化需要加载的字典,多个字典用逗号隔开 + executeGetData: true // 执行获取数据接口,调用分页接口或者不分页接口 }, // 默认属性 searchForm: { @@ -23,6 +24,7 @@ export default { page: 1, // 当前页码 limit: 10, // 每页数 total: 0, // 总条数 + layouts: ['Total', 'Sizes', 'FullJump', 'PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump'], // 页脚分页布局 dataListLoading: false, // 数据列表,loading状态 dataListSelections: [], // 数据列表,多选项 batchBtnDisabled: true, // 批量按钮禁用 @@ -40,20 +42,24 @@ export default { // 获取数据列表 getDataList () { this.dataListLoading = true - this.searchForm.page = this.mixinViewModuleOptions.isPage ? this.page : null - this.searchForm.pageSize = this.mixinViewModuleOptions.isPage ? this.limit : null - const config = { - url: this.mixinViewModuleOptions.getDataListUrl, - method: 'post', - data: this.searchForm - } - this.$axios(config).then(res => { - this.dataListLoading = false - this.dataList = this.mixinViewModuleOptions.isPage ? res.data.data : res.data - this.total = this.mixinViewModuleOptions.isPage ? res.data.total : 0 - }).catch(() => { + if (this.mixinViewModuleOptions.executeGetData) { + this.searchForm.page = this.mixinViewModuleOptions.isPage ? this.page : null + this.searchForm.pageSize = this.mixinViewModuleOptions.isPage ? this.limit : null + const config = { + url: this.mixinViewModuleOptions.getDataListUrl, + method: 'post', + data: this.searchForm + } + this.$axios(config).then(res => { + this.dataListLoading = false + this.dataList = this.mixinViewModuleOptions.isPage ? res.data.data : res.data + this.total = this.mixinViewModuleOptions.isPage ? res.data.total : 0 + }).catch(() => { + this.handleDataCatch() + }) + } else { this.handleDataCatch() - }) + } }, // 处理获取数据接口异常 handleDataCatch () { @@ -62,8 +68,8 @@ export default { this.dataListLoading = false }, // 多选 - dataListSelectionChangeHandle (val) { - this.dataListSelections = val + dataListCheckboxChangeHandle ({ selection }) { + this.dataListSelections = selection this.batchBtnDisabled = this.dataListSelections.length <= 0 }, // 排序 @@ -78,30 +84,34 @@ export default { } this.getDataList() }, - // 分页, 每页条数 - pageSizeChangeHandle (val) { - this.page = 1 - this.limit = val + // [分页] 切换事件 + handlePageChange ({ currentPage, pageSize }) { + this.page = currentPage + this.limit = pageSize this.getDataList() }, - // 分页, 当前页 - pageCurrentChangeHandle (val) { - this.page = val - this.getDataList() - }, - // 分页, 首页 - firstPageHandle (val) { - this.page = 1 - this.getDataList() - }, - // 分页, 尾页 - lastPageHandle (val) { - this.page = Math.ceil(this.total / this.limit) // 总页数 - this.getDataList() - }, - // 批量删除和单个删除 - deleteHandle (row, name) { - let data = [] + /** + * + * 考虑的情况和逻辑实现 + * 1.可编辑表格 + * 1.1单个删除 + * 1.1.1当row中主键存在时执行数据库删除 + * 1.1.2当row中主键不存在时执行dom删除 + * 1.2批量删除 + * 1.2.1遍历dataListSelections对象,筛选出有主键或没主键的两个集合 + * 1.2.2 + * + * + * 2.不可编辑表格 + * 2.1批量删除和单个删除 + * @param {*} row + * @param {*} name + * @param {*} ref + */ + deleteHandle (row, name, ref) { + // 是否存在删除dom + var isExistDom = false + const data = [] // 判断是否有删除数据 if (this.dataListSelections.length <= 0 && !row) { return this.$message({ @@ -111,12 +121,58 @@ export default { duration: 500 }) } - // 不是单个删除 - if (!row) { - data = this.dataListSelections + if (row) { // 单个删除 + if (row[this.mixinViewModuleOptions.batchDelKey]) { + data.push({ id: row[this.mixinViewModuleOptions.batchDelKey] }) + } else { + this.$confirm('您确定要删除该数据?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + closeOnClickModal: false + }).then(() => { + this.$refs[ref].remove(row) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消删除' + }) + }) + return + } + } else { // 批量删除 + this.dataListSelections.map(e => { + if (e[this.mixinViewModuleOptions.batchDelKey]) { + data.push({ id: e[this.mixinViewModuleOptions.batchDelKey] }) + } else { + isExistDom = true + } + }) + } + if (isExistDom) { + if (data.length > 0) { + this.delete(data, name, ref) + } else { + this.$confirm('正在批量删除, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + closeOnClickModal: false + }).then(() => { + this.$refs[ref].removeCheckboxRow() + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消删除' + }) + }) + } } else { - data.push({ id: row.id }) + this.delete(data, name) } + }, + // 调用接口删除 + delete (data, name, ref) { const delMsg = name ? '正在删除 [' + name + '] 是否继续?' : '正在批量删除, 是否继续?' this.$confirm(delMsg, '提示', { confirmButtonText: '确定', @@ -131,6 +187,9 @@ export default { data: data } this.$axios(config).then(res => { + if (ref) { + this.$refs[ref].removeCheckboxRow() + } this.dataListLoading = false this.calculationPage(this.dataListSelections.length > 0 ? this.dataListSelections.length : 1) this.getDataList() @@ -164,8 +223,10 @@ export default { }) window.location.href = `${window.SITE_CONFIG.apiURL}${this.mixinViewModuleOptions.exportUrl}?${params}` }, - dateFormat (row, column, cellValue) { - return dayjs.unix(cellValue).format('YYYY-MM-DD HH:mm:ss') + dateFormat (row) { + if (row.cellValue) { + return dayjs.unix(row.cellValue).format('YYYY-MM-DD HH:mm:ss') + } }, searchResetForm (tableRef) { // 重置输入框 this.searchForm = { @@ -174,10 +235,6 @@ export default { // 清空页面选择的排序按钮 this.$refs[tableRef].clearSort() }, - refreshPage (tableRef) { // 刷新表格数据 - this.searchResetForm(tableRef) - this.getDataList() - }, async initDict () { // 页面加载时需要初始化的字典 if (this.mixinViewModuleOptions.dictCodes) { const config = { @@ -222,8 +279,8 @@ export default { searchOpen (data) { this.searchFormShow = data }, - initAddOrUpdate (ref, row, val) { // 初始化新增修改 - this.$refs[ref].initAddOrUpdate(row, val) + initDialog (ref, row, val) { // 初始化弹框,第三个参数配合业务使用 + this.$refs[ref].initDialog(row, val) } } } diff --git a/src/store/modules/zerovue/modules/size.js b/src/store/modules/zerovue/modules/size.js index 177981d125d4ad6278bc2a4b875de26a03675ae1..48bc2cc146548297f5971dafb94dae922c2e0c10 100644 --- a/src/store/modules/zerovue/modules/size.js +++ b/src/store/modules/zerovue/modules/size.js @@ -1,5 +1,8 @@ import Vue from 'vue' import router from '@/router' +import 'xe-utils' +import VXETable from 'vxe-table' +import 'vxe-table/lib/index.css' export default { namespaced: true, @@ -15,6 +18,7 @@ export default { */ apply ({ state, commit }, refresh) { Vue.prototype.$ELEMENT.size = state.value + VXETable.setup({ size: state.value }) if (refresh) { commit('zerovue/page/keepAliveClean', null, { root: true }) router.replace('/refresh') diff --git a/src/views/database/info/components/AddUpdateForm.vue b/src/views/database/info/components/AddUpdateForm.vue new file mode 100644 index 0000000000000000000000000000000000000000..5144fffbc9bf82c22f9aa98c3750fbff1ec52cf3 --- /dev/null +++ b/src/views/database/info/components/AddUpdateForm.vue @@ -0,0 +1,131 @@ + + + diff --git a/src/views/database/info/components/GeneratorCodeFrom.vue b/src/views/database/info/components/GeneratorCodeFrom.vue new file mode 100644 index 0000000000000000000000000000000000000000..553629c404c910beeee7f7f3c1b3332ce7e05929 --- /dev/null +++ b/src/views/database/info/components/GeneratorCodeFrom.vue @@ -0,0 +1,285 @@ + + + + diff --git a/src/views/database/info/index.vue b/src/views/database/info/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..2f6c02c3e11d339c12cd39ec5385b35022b06679 --- /dev/null +++ b/src/views/database/info/index.vue @@ -0,0 +1,119 @@ +/* 数据库管理页面 */ + + + diff --git a/src/views/druid/index.vue b/src/views/druid/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..af333b62ed33344ad0d421a9dc5c35f3d727eab2 --- /dev/null +++ b/src/views/druid/index.vue @@ -0,0 +1,18 @@ + + + diff --git a/src/views/index/index.vue b/src/views/index/index.vue index 930efed411833e8dabbe014fc654a815a817e10d..82ec7e68533f68447a547c0bba065e44a2cb589f 100644 --- a/src/views/index/index.vue +++ b/src/views/index/index.vue @@ -1,22 +1,21 @@ diff --git a/src/views/swagger/index.vue b/src/views/swagger/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..d4e35b487026a4668e4b2da34ee23fb16ab658b3 --- /dev/null +++ b/src/views/swagger/index.vue @@ -0,0 +1,18 @@ + + + diff --git a/src/views/sys/dict/components/TreeSide.vue b/src/views/sys/dict/components/TreeSide.vue new file mode 100644 index 0000000000000000000000000000000000000000..2b7377c709c1d0fd12190f5d70216ecf7449ae53 --- /dev/null +++ b/src/views/sys/dict/components/TreeSide.vue @@ -0,0 +1,132 @@ + + + diff --git a/src/views/sys/dict/components/TreeSideForm.vue b/src/views/sys/dict/components/TreeSideForm.vue new file mode 100644 index 0000000000000000000000000000000000000000..b9fc701f33daa7758df5304f5f1cabbb517f1a61 --- /dev/null +++ b/src/views/sys/dict/components/TreeSideForm.vue @@ -0,0 +1,122 @@ + + + diff --git a/src/views/sys/dict/index.vue b/src/views/sys/dict/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..952e7b233c0323f9688097f426eb990644f1043e --- /dev/null +++ b/src/views/sys/dict/index.vue @@ -0,0 +1,174 @@ +/* 系统字典页面 */ + + + diff --git a/src/views/sys/function/refresh/index.js b/src/views/sys/function/refresh/index.js index e8b35034fd3460b61b8d90e1c79828c054e89bda..4f0a0bd61448149b515087229c52081b882dad45 100644 --- a/src/views/sys/function/refresh/index.js +++ b/src/views/sys/function/refresh/index.js @@ -1,6 +1,8 @@ export default { beforeRouteEnter (to, from, next) { - next(instance => instance.$router.replace(from.fullPath)) + from.meta[from.path] = Date.now() + from.meta[`__stamp-${from.path}`] = Date.now() + next(instance => instance.$router.replace({ path: from.fullPath, meta: from.meta })) }, render: h => h() } diff --git a/src/views/sys/log/index.vue b/src/views/sys/log/index.vue index 42d602314c2d2e0eb5311eee21b7bf43bc7d16f5..5aa7a136bbd33b280ef750130971646cccb92fb6 100644 --- a/src/views/sys/log/index.vue +++ b/src/views/sys/log/index.vue @@ -1,130 +1,46 @@