From b32d0724b7a912973f2afb14b5b783e9a0f1183f Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: Fri, 31 Jul 2020 22:35:30 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=8D=87=E7=BA=A7vue-cli=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=88=B04.4.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/system/SysDeptMapper.xml | 3 +- ruoyi-ui/babel.config.js | 12 +++++-- ruoyi-ui/package.json | 32 +++++++++---------- ruoyi-ui/vue.config.js | 12 +------ 4 files changed, 28 insertions(+), 31 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 191f1cc..9da14d8 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -77,8 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <select id="checkDeptNameUnique" resultMap="SysDeptResult"> <include refid="selectDeptVo"/> - where dept_name=#{deptName} and parent_id = #{parentId} - limit 1 + where dept_name=#{deptName} and parent_id = #{parentId} limit 1 </select> <insert id="insertDept" parameterType="SysDept"> diff --git a/ruoyi-ui/babel.config.js b/ruoyi-ui/babel.config.js index c8e69f5..b732c91 100644 --- a/ruoyi-ui/babel.config.js +++ b/ruoyi-ui/babel.config.js @@ -1,5 +1,13 @@ module.exports = { presets: [ - '@vue/app' - ] + // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app + '@vue/cli-plugin-babel/preset' + ], + 'env': { + 'development': { + // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). + // This plugin can significantly increase the speed of hot updates, when you have a large number of pages. + 'plugins': ['dynamic-import-node'] + } + } } diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index a78acad..f359fb6 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -5,7 +5,7 @@ "author": "若依", "license": "MIT", "scripts": { - "dev": "vue-cli-service serve --open", + "dev": "vue-cli-service serve", "build:prod": "vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", @@ -43,10 +43,11 @@ "@riophae/vue-treeselect": "0.4.0", "axios": "0.18.1", "clipboard": "2.0.4", + "core-js": "3.6.5", "echarts": "4.2.1", "element-ui": "2.13.2", "file-saver": "2.0.1", - "js-beautify": "^1.10.2", + "js-beautify": "1.10.2", "fuse.js": "3.4.4", "js-cookie": "2.2.0", "jsencrypt": "3.0.0-rc.1", @@ -65,32 +66,31 @@ "vuex": "3.1.0" }, "devDependencies": { - "@vue/cli-plugin-babel": "3.5.3", - "@vue/cli-plugin-eslint": "^3.9.1", - "@vue/cli-plugin-unit-jest": "3.5.3", - "@vue/cli-service": "3.5.3", + "@vue/cli-plugin-babel": "4.4.4", + "@vue/cli-plugin-eslint": "4.4.4", + "@vue/cli-plugin-unit-jest": "4.4.4", + "@vue/cli-service": "4.4.4", "@vue/test-utils": "1.0.0-beta.29", - "autoprefixer": "^9.5.1", - "babel-core": "7.0.0-bridge.0", - "babel-eslint": "10.0.1", + "autoprefixer": "9.5.1", + "babel-eslint": "10.1.0", "babel-jest": "23.6.0", + "babel-plugin-dynamic-import-node": "2.3.3", "chalk": "2.4.2", "chokidar": "2.1.5", "connect": "3.6.6", - "eslint": "5.15.3", - "eslint-plugin-vue": "5.2.2", + "eslint": "6.7.2", + "eslint-plugin-vue": "6.2.2", "html-webpack-plugin": "3.2.0", - "http-proxy-middleware": "^0.19.1", "husky": "1.3.1", "lint-staged": "8.1.5", "mockjs": "1.0.1-beta3", "plop": "2.3.0", - "runjs": "^4.3.2", - "sass": "^1.26.10", - "sass-loader": "^7.1.0", + "runjs": "4.3.2", + "sass": "1.26.10", + "sass-loader": "8.0.2", "script-ext-html-webpack-plugin": "2.1.3", "script-loader": "0.7.2", - "serve-static": "^1.13.2", + "serve-static": "1.13.2", "svg-sprite-loader": "4.1.3", "svgo": "1.2.0", "vue-template-compiler": "2.6.10" diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js index b7f16f3..fb70857 100644 --- a/ruoyi-ui/vue.config.js +++ b/ruoyi-ui/vue.config.js @@ -30,6 +30,7 @@ module.exports = { devServer: { host: '0.0.0.0', port: port, + open: true, proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { @@ -71,17 +72,6 @@ module.exports = { }) .end() - // set preserveWhitespace - config.module - .rule('vue') - .use('vue-loader') - .loader('vue-loader') - .tap(options => { - options.compilerOptions.preserveWhitespace = true - return options - }) - .end() - config .when(process.env.NODE_ENV !== 'development', config => { From 4dcf737db03720bff2216ea04aba082be1ebb413 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: Sat, 1 Aug 2020 15:45:38 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F=E5=8F=B3=E4=BE=A7=E6=B7=BB=E5=8A=A0=E5=88=B7=E6=96=B0?= =?UTF-8?q?&=E6=98=BE=E9=9A=90=E6=9F=A5=E8=AF=A2=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/vm/vue/index-tree.vue.vm | 31 +++++++++----- .../src/main/resources/vm/vue/index.vue.vm | 14 ++++++- ruoyi-ui/src/assets/styles/ruoyi.scss | 27 ++++++++++++- ruoyi-ui/src/views/monitor/job/index.vue | 14 ++++++- ruoyi-ui/src/views/monitor/job/log.vue | 14 ++++++- .../src/views/monitor/logininfor/index.vue | 14 ++++++- ruoyi-ui/src/views/monitor/online/index.vue | 2 +- ruoyi-ui/src/views/monitor/operlog/index.vue | 14 ++++++- ruoyi-ui/src/views/system/config/index.vue | 14 ++++++- ruoyi-ui/src/views/system/dept/index.vue | 40 +++++++++++++------ ruoyi-ui/src/views/system/dict/data.vue | 14 ++++++- ruoyi-ui/src/views/system/dict/index.vue | 14 ++++++- ruoyi-ui/src/views/system/menu/index.vue | 37 ++++++++++++++--- ruoyi-ui/src/views/system/notice/index.vue | 14 ++++++- ruoyi-ui/src/views/system/post/index.vue | 14 ++++++- ruoyi-ui/src/views/system/role/index.vue | 14 ++++++- ruoyi-ui/src/views/system/user/index.vue | 14 ++++++- ruoyi-ui/src/views/tool/gen/index.vue | 14 ++++++- 18 files changed, 262 insertions(+), 57 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm index 2b26f79..a6ae202 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> #foreach($column in $columns) #if($column.query) #set($dictType=$column.dictType) @@ -51,23 +51,30 @@ #end #end <el-form-item> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> <el-button - class="filter-item" - type="primary" - icon="el-icon-search" - size="mini" - @click="handleQuery" - >搜索</el-button> - <el-button - class="filter-item" type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['${moduleName}:${businessName}:add']" >新增</el-button> - </el-form-item> - </el-form> + </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> + </el-row> <el-table v-loading="loading" @@ -229,6 +236,8 @@ export default { return { // 遮罩层 loading: true, + // 显示搜索条件 + showSearch: true, // ${functionName}表格数据 ${businessName}List: [], // ${functionName}树选项 diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index c4d7407..f060f9c 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> #foreach($column in $columns) #if($column.query) #set($dictType=$column.dictType) @@ -51,7 +51,7 @@ #end #end <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -95,6 +95,14 @@ v-hasPermi="['${moduleName}:${businessName}:export']" >导出</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange"> @@ -260,6 +268,8 @@ export default { single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // ${functionName}表格数据 diff --git a/ruoyi-ui/src/assets/styles/ruoyi.scss b/ruoyi-ui/src/assets/styles/ruoyi.scss index 18dff3a..ffb04a3 100644 --- a/ruoyi-ui/src/assets/styles/ruoyi.scss +++ b/ruoyi-ui/src/assets/styles/ruoyi.scss @@ -142,7 +142,28 @@ padding-left: 15px; margin-bottom: 10px; } - + +/* button color */ +.el-button--cyan.is-active, +.el-button--cyan:active { + background: #20B2AA; + border-color: #20B2AA; + color: #FFFFFF; +} + +.el-button--cyan:focus, +.el-button--cyan:hover { + background: #48D1CC; + border-color: #48D1CC; + color: #FFFFFF; +} + +.el-button--cyan { + background-color: #20B2AA; + border-color: #20B2AA; + color: #FFFFFF; +} + /* text color */ .text-navy { color: #1ab394; @@ -198,4 +219,8 @@ opacity: .8; color: #fff!important; background: #42b983!important; +} + +.top-right-btn { + float: right; } \ No newline at end of file diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index 3a35e85..bd39c16 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="任务名称" prop="jobName"> <el-input v-model="queryParams.jobName" @@ -31,7 +31,7 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -84,6 +84,14 @@ v-hasPermi="['monitor:job:query']" >日志</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="jobList" @selection-change="handleSelectionChange"> @@ -274,6 +282,8 @@ export default { single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 定时任务表格数据 diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue index 254f486..0ddbba6 100644 --- a/ruoyi-ui/src/views/monitor/job/log.vue +++ b/ruoyi-ui/src/views/monitor/job/log.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="任务名称" prop="jobName"> <el-input v-model="queryParams.jobName" @@ -56,7 +56,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -90,6 +90,14 @@ v-hasPermi="['monitor:job:export']" >导出</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="jobLogList" @selection-change="handleSelectionChange"> @@ -175,6 +183,8 @@ export default { ids: [], // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 调度日志表格数据 diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue index 0a21005..7c83aab 100644 --- a/ruoyi-ui/src/views/monitor/logininfor/index.vue +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="登录地址" prop="ipaddr"> <el-input v-model="queryParams.ipaddr" @@ -50,7 +50,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -84,6 +84,14 @@ v-hasPermi="['system:logininfor:export']" >导出</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> @@ -126,6 +134,8 @@ export default { ids: [], // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 表格数据 diff --git a/ruoyi-ui/src/views/monitor/online/index.vue b/ruoyi-ui/src/views/monitor/online/index.vue index 1f5a50f..77d0410 100644 --- a/ruoyi-ui/src/views/monitor/online/index.vue +++ b/ruoyi-ui/src/views/monitor/online/index.vue @@ -20,7 +20,7 @@ /> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue index ba84d3c..d8b2ff4 100644 --- a/ruoyi-ui/src/views/monitor/operlog/index.vue +++ b/ruoyi-ui/src/views/monitor/operlog/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="系统模块" prop="title"> <el-input v-model="queryParams.title" @@ -66,7 +66,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -100,6 +100,14 @@ v-hasPermi="['system:config:export']" >导出</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> @@ -195,6 +203,8 @@ export default { ids: [], // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 表格数据 diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue index 83b77b9..b5b44e0 100644 --- a/ruoyi-ui/src/views/system/config/index.vue +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="参数名称" prop="configName"> <el-input v-model="queryParams.configName" @@ -44,7 +44,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -97,6 +97,14 @@ v-hasPermi="['system:config:remove']" >清理缓存</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange"> @@ -188,6 +196,8 @@ export default { single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 参数表格数据 diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index 4d4d978..d2b4418 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -1,7 +1,7 @@ <template> <div class="app-container"> - <el-form :inline="true"> - <el-form-item label="部门名称"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"> + <el-form-item label="部门名称" prop="deptName"> <el-input v-model="queryParams.deptName" placeholder="请输入部门名称" @@ -10,7 +10,7 @@ @keyup.enter.native="handleQuery" /> </el-form-item> - <el-form-item label="状态"> + <el-form-item label="状态" prop="status"> <el-select v-model="queryParams.status" placeholder="部门状态" clearable size="small"> <el-option v-for="dict in statusOptions" @@ -21,23 +21,30 @@ </el-select> </el-form-item> <el-form-item> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> <el-button - class="filter-item" - type="primary" - icon="el-icon-search" - size="mini" - @click="handleQuery" - >搜索</el-button> - <el-button - class="filter-item" type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:dept:add']" >新增</el-button> - </el-form-item> - </el-form> + </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> + </el-row> <el-table v-loading="loading" @@ -149,6 +156,8 @@ export default { return { // 遮罩层 loading: true, + // 显示搜索条件 + showSearch: true, // 表格树数据 deptList: [], // 部门树选项 @@ -247,6 +256,11 @@ export default { handleQuery() { this.getList(); }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, /** 新增按钮操作 */ handleAdd(row) { this.reset(); diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index f5eb63e..7a8c50b 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true"> + <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true"> <el-form-item label="字典名称" prop="dictType"> <el-select v-model="queryParams.dictType" size="small"> <el-option @@ -31,7 +31,7 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -75,6 +75,14 @@ v-hasPermi="['system:dict:export']" >导出</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange"> @@ -170,6 +178,8 @@ export default { single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 字典表格数据 diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue index 779c173..6da26ab 100644 --- a/ruoyi-ui/src/views/system/dict/index.vue +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="字典名称" prop="dictName"> <el-input v-model="queryParams.dictName" @@ -50,7 +50,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -103,6 +103,14 @@ v-hasPermi="['system:dict:remove']" >清理缓存</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange"> @@ -196,6 +204,8 @@ export default { single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 字典表格数据 diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue index 2303a52..6cf8d3b 100644 --- a/ruoyi-ui/src/views/system/menu/index.vue +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -1,7 +1,7 @@ <template> <div class="app-container"> - <el-form :inline="true"> - <el-form-item label="菜单名称"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"> + <el-form-item label="菜单名称" prop="menuName"> <el-input v-model="queryParams.menuName" placeholder="请输入菜单名称" @@ -10,7 +10,7 @@ @keyup.enter.native="handleQuery" /> </el-form-item> - <el-form-item label="状态"> + <el-form-item label="状态" prop="status"> <el-select v-model="queryParams.status" placeholder="菜单状态" clearable size="small"> <el-option v-for="dict in statusOptions" @@ -21,11 +21,31 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> - <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:menu:add']">新增</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:menu:add']" + >新增</el-button> + </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> + </el-row> + <el-table v-loading="loading" :data="menuList" @@ -197,6 +217,8 @@ export default { return { // 遮罩层 loading: true, + // 显示搜索条件 + showSearch: true, // 菜单表格树数据 menuList: [], // 菜单树选项 @@ -310,6 +332,11 @@ export default { handleQuery() { this.getList(); }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, /** 新增按钮操作 */ handleAdd(row) { this.reset(); diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue index 828dd3e..384ec2f 100644 --- a/ruoyi-ui/src/views/system/notice/index.vue +++ b/ruoyi-ui/src/views/system/notice/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="公告标题" prop="noticeTitle"> <el-input v-model="queryParams.noticeTitle" @@ -30,7 +30,7 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -65,6 +65,14 @@ v-hasPermi="['system:notice:remove']" >删除</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange"> @@ -190,6 +198,8 @@ export default { single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 公告表格数据 diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue index 046ef22..a3d9f4f 100644 --- a/ruoyi-ui/src/views/system/post/index.vue +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="岗位编码" prop="postCode"> <el-input v-model="queryParams.postCode" @@ -30,7 +30,7 @@ </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -74,6 +74,14 @@ v-hasPermi="['system:post:export']" >导出</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange"> @@ -164,6 +172,8 @@ export default { single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 岗位表格数据 diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index dddc906..ba74174 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true"> + <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true"> <el-form-item label="角色名称" prop="roleName"> <el-input v-model="queryParams.roleName" @@ -50,7 +50,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -94,6 +94,14 @@ v-hasPermi="['system:role:export']" >导出</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange"> @@ -249,6 +257,8 @@ export default { single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 角色表格数据 diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 51c2627..a1ae706 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -27,7 +27,7 @@ </el-col> <!--用户数据--> <el-col :span="20" :xs="24"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="用户名称" prop="userName"> <el-input v-model="queryParams.userName" @@ -77,7 +77,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -130,6 +130,14 @@ v-hasPermi="['system:user:export']" >导出</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> @@ -356,6 +364,8 @@ export default { single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 用户表格数据 diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue index 06306c2..fcbbfe5 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -1,6 +1,6 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="表名称" prop="tableName"> <el-input v-model="queryParams.tableName" @@ -32,7 +32,7 @@ ></el-date-picker> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> @@ -76,6 +76,14 @@ v-hasPermi="['tool:gen:remove']" >删除</el-button> </el-col> + <div class="top-right-btn"> + <el-tooltip class="item" effect="dark" content="刷新" placement="top"> + <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" /> + </el-tooltip> + <el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top"> + <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" /> + </el-tooltip> + </div> </el-row> <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange"> @@ -186,6 +194,8 @@ export default { single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 表数据 From a7eb0f98ac1b8b8b228e6fdfbf59abe9023be0fa Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: Mon, 3 Aug 2020 09:02:28 +0800 Subject: [PATCH 3/6] README --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b9eef10..6bbc3f7 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ * 支持加载动态权限菜单,多方式轻松权限控制。 * 高效率开发,使用代码生成器可以一键生成前后端代码。 * 提供了一个Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。 -* 感谢[Vue-Element-Admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://gitee.com/elunez/eladmin-web?_from=gitee_search)。 * 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) +* 感谢[Vue-Element-Admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://gitee.com/elunez/eladmin-web?_from=gitee_search)。 * 阿里云优惠券:[点我进入](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console) ## 内置功能 @@ -46,27 +46,27 @@ <td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td> </tr> <tr> - <td><img src="https://oscimg.oschina.net/oscnet/707825ad3f29de74a8d6d02fbd73ad631ea.jpg"/></td> - <td><img src="https://oscimg.oschina.net/oscnet/46be40cc6f01aa300eed53a19b5012bf484.jpg"/></td> + <td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td> + <td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td> </tr> <tr> - <td><img src="https://oscimg.oschina.net/oscnet/4284796d4cea240d181b8f2201813dda710.jpg"/></td> - <td><img src="https://oscimg.oschina.net/oscnet/3ecfac87a049f7fe36abbcaafb2c40d36cf.jpg"/></td> + <td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td> + <td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td> </tr> <tr> - <td><img src="https://oscimg.oschina.net/oscnet/71c2d48905221a09a728df4aff4160b8607.jpg"/></td> - <td><img src="https://oscimg.oschina.net/oscnet/c14c1ee9a64a6a9c2c22f67d43198767dbe.jpg"/></td> + <td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td> + <td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td> </tr> <tr> <td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td> <td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td> </tr> <tr> - <td><img src="https://oscimg.oschina.net/oscnet/fdea1d8bb8625c27bf964176a2c8ebc6945.jpg"/></td> - <td><img src="https://oscimg.oschina.net/oscnet/509d2708cfd762b6e6339364cac1cc1970c.jpg"/></td> + <td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td> + <td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td> </tr> <tr> - <td><img src="https://oscimg.oschina.net/oscnet/up-f1fd681cc9d295db74e85ad6d2fe4389454.png"/></td> + <td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td> </tr> <tr> From 8b5d254242a37a308e2973a0bc557576a1899654 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: Mon, 3 Aug 2020 09:11:49 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=B1=89=E5=8C=96=E6=8B=A6=E6=88=AA=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/utils/request.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index cac52c3..4263979 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -30,7 +30,7 @@ service.interceptors.response.use(res => { // 未设置状态码则默认成功状态 const code = res.data.code || 200; // 获取错误信息 - const message = errorCode[code] || res.data.msg || errorCode['default'] + const msg = errorCode[code] || res.data.msg || errorCode['default'] if (code === 401) { MessageBox.confirm( '登录状态已过期,您可以继续留在该页面,或者重新登录', @@ -47,13 +47,13 @@ service.interceptors.response.use(res => { }) } else if (code === 500) { Message({ - message: message, + message: msg, type: 'error' }) - return Promise.reject(new Error(message)) + return Promise.reject(new Error(msg)) } else if (code !== 200) { Notification.error({ - title: message + title: msg }) return Promise.reject('error') } else { @@ -62,8 +62,18 @@ service.interceptors.response.use(res => { }, error => { console.log('err' + error) + let { message } = error; + if (message == "Network Error") { + message = "后端接口连接异常"; + } + else if (message.includes("timeout")) { + message = "系统接口请求超时"; + } + else if (message.includes("Request failed with status code")) { + message = "系统接口" + message.substr(message.length - 3) + "异常"; + } Message({ - message: error.message, + message: message, type: 'error', duration: 5 * 1000 }) From 743fce78290f0b359d3d99b79a6c9c0a2a5a0dee Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: Tue, 4 Aug 2020 11:07:37 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=98=B2=E9=87=8D?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=94=AF=E4=B8=80=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/constant/Constants.java | 5 +++++ .../interceptor/impl/SameUrlDataInterceptor.java | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 9ee2707..188f0b7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -61,6 +61,11 @@ public class Constants * 登录用户 redis key */ public static final String LOGIN_TOKEN_KEY = "login_tokens:"; + + /** + * 防重提交 redis key + */ + public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; /** * 验证码有效期(分钟) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java index 5f78380..36e6c10 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java @@ -5,8 +5,10 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import com.alibaba.fastjson.JSONObject; +import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.filter.RepeatedlyRequestWrapper; import com.ruoyi.common.utils.StringUtils; @@ -26,7 +28,9 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor public final String REPEAT_TIME = "repeatTime"; - public final String CACHE_REPEAT_KEY = "repeatData"; + // 令牌自定义标识 + @Value("${token.header}") + private String header; @Autowired private RedisCache redisCache; @@ -62,7 +66,10 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor // 请求地址(作为存放cache的key值) String url = request.getRequestURI(); - Object sessionObj = redisCache.getCacheObject(CACHE_REPEAT_KEY); + // 唯一标识(指定key + 消息头) + String cache_repeat_key = Constants.REPEAT_SUBMIT_KEY + request.getHeader(header); + + Object sessionObj = redisCache.getCacheObject(cache_repeat_key); if (sessionObj != null) { Map<String, Object> sessionMap = (Map<String, Object>) sessionObj; @@ -77,7 +84,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor } Map<String, Object> cacheMap = new HashMap<String, Object>(); cacheMap.put(url, nowDataMap); - redisCache.setCacheObject(CACHE_REPEAT_KEY, cacheMap, intervalTime, TimeUnit.SECONDS); + redisCache.setCacheObject(cache_repeat_key, cacheMap, intervalTime, TimeUnit.SECONDS); return false; } From 21d07c1d711cec95b92ce90d3d3bd1757b125601 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: Tue, 4 Aug 2020 11:51:25 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=9A=84=E6=9D=83=E9=99=90=E5=88=86=E9=85=8D=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E6=9C=AA=E5=AE=9E=E6=97=B6=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysRoleController.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 927a6c2..a7cce44 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -17,11 +17,17 @@ import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.service.SysPermissionService; +import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.system.service.ISysUserService; /** * 角色信息 @@ -35,6 +41,15 @@ public class SysRoleController extends BaseController @Autowired private ISysRoleService roleService; + @Autowired + private TokenService tokenService; + + @Autowired + private SysPermissionService permissionService; + + @Autowired + private ISysUserService userService; + @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/list") public TableDataInfo list(SysRole role) @@ -103,7 +118,20 @@ public class SysRoleController extends BaseController return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); } role.setUpdateBy(SecurityUtils.getUsername()); - return toAjax(roleService.updateRole(role)); + + if (roleService.updateRole(role) > 0) + { + // 更新缓存用户权限 + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) + { + loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); + loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); + tokenService.setLoginUser(loginUser); + } + return AjaxResult.success(); + } + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); } /**