From 568e2a9337a77187d856962077ef28e3a907cfd3 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期四, 24 二月 2022 15:30:20 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev --- ruoyi-ui/src/permission.js | 3 + ruoyi-ui/src/utils/request.js | 15 ++--- ruoyi-ui/src/components/Pagination/index.vue | 7 -- ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java | 18 +++++ ruoyi-ui/src/utils/ruoyi.js | 13 ++++ ruoyi-ui/src/views/system/notice/index.vue | 2 ruoyi-generator/src/main/resources/vm/vue/index.vue.vm | 35 ++++++++++- ruoyi-ui/src/views/system/user/index.vue | 6 +- ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm | 40 ++++++++++++- ruoyi-ui/src/views/system/dept/index.vue | 2 ruoyi-ui/src/views/system/user/profile/userInfo.vue | 2 11 files changed, 111 insertions(+), 32 deletions(-) diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java index 9a07ec4..9cc1c34 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java @@ -244,14 +244,28 @@ public static String getDicts(GenTable genTable) { List<GenTableColumn> columns = genTable.getColumns(); Set<String> dicts = new HashSet<String>(); + addDicts(dicts, columns); + if (ObjectUtil.isNotNull(genTable.getSubTable())) { + List<GenTableColumn> subColumns = genTable.getSubTable().getColumns(); + addDicts(dicts, subColumns); + } + return StringUtils.join(dicts, ", "); + } + + /** + * 娣诲姞瀛楀吀鍒楄〃 + * + * @param dicts 瀛楀吀鍒楄〃 + * @param columns 鍒楅泦鍚� + */ + public static void addDicts(Set<String> dicts, List<GenTableColumn> columns) { for (GenTableColumn column : columns) { if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny( column.getHtmlType(), - new String[]{GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX})) { + new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX })) { dicts.add("'" + column.getDictType() + "'"); } } - return StringUtils.join(dicts, ", "); } /** 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 02fe3ed..760ba85 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -44,7 +44,7 @@ v-model="queryParams.${column.javaField}" type="date" value-format="yyyy-MM-dd" - placeholder="閫夋嫨${comment}"> + placeholder="璇烽�夋嫨${comment}"> </el-date-picker> </el-form-item> #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") @@ -268,7 +268,7 @@ v-model="form.${field}" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" - placeholder="閫夋嫨${comment}"> + placeholder="璇烽�夋嫨${comment}"> </el-date-picker> </el-form-item> #elseif($column.htmlType == "textarea") @@ -300,12 +300,39 @@ #set($comment=$column.columnComment) #end #if($column.pk || $javaField == ${subTableFkclassName}) -#elseif($column.list && "" != $javaField) - <el-table-column label="$comment" prop="${javaField}"> +#elseif($column.list && $column.htmlType == "input") + <el-table-column label="$comment" prop="${javaField}" width="150"> <template slot-scope="scope"> <el-input v-model="scope.row.$javaField" placeholder="璇疯緭鍏�$comment" /> </template> </el-table-column> +#elseif($column.list && $column.htmlType == "datetime") + <el-table-column label="$comment" prop="${javaField}" width="240"> + <template slot-scope="scope"> + <el-date-picker clearable v-model="scope.row.$javaField" type="date" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨$comment" /> + </template> + </el-table-column> +#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType) + <el-table-column label="$comment" prop="${javaField}" width="150"> + <template slot-scope="scope"> + <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment"> + <el-option + v-for="dict in dict.type.$column.dictType" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> + </el-select> + </template> + </el-table-column> +#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType) + <el-table-column label="$comment" prop="${javaField}" width="150"> + <template slot-scope="scope"> + <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment"> + <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> + </el-select> + </template> + </el-table-column> #end #end </el-table> diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm index 5749b73..6c9cdd6 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm @@ -43,7 +43,7 @@ v-model="queryParams.${column.javaField}" type="date" value-format="YYYY-MM-DD" - placeholder="閫夋嫨${comment}"> + placeholder="璇烽�夋嫨${comment}"> </el-date-picker> </el-form-item> #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") @@ -259,7 +259,7 @@ v-model="form.${field}" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" - placeholder="閫夋嫨${comment}"> + placeholder="璇烽�夋嫨${comment}"> </el-date-picker> </el-form-item> #elseif($column.htmlType == "textarea") @@ -291,12 +291,44 @@ #set($comment=$column.columnComment) #end #if($column.pk || $javaField == ${subTableFkclassName}) -#elseif($column.list && "" != $javaField) - <el-table-column label="$comment" prop="${javaField}"> +#elseif($column.list && $column.htmlType == "input") + <el-table-column label="$comment" prop="${javaField}" width="150"> <template #default="scope"> <el-input v-model="scope.row.$javaField" placeholder="璇疯緭鍏�$comment" /> </template> </el-table-column> +#elseif($column.list && $column.htmlType == "datetime") + <el-table-column label="$comment" prop="${javaField}" width="240"> + <template #default="scope"> + <el-date-picker clearable + v-model="scope.row.$javaField" + type="date" + value-format="YYYY-MM-DD" + placeholder="璇烽�夋嫨$comment"> + </el-date-picker> + </template> + </el-table-column> +#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType) + <el-table-column label="$comment" prop="${javaField}" width="150"> + <template #default="scope"> + <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment"> + <el-option + v-for="dict in $column.dictType" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> + </el-select> + </template> + </el-table-column> +#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType) + <el-table-column label="$comment" prop="${javaField}" width="150"> + <template #default="scope"> + <el-select v-model="scope.row.$javaField" placeholder="璇烽�夋嫨$comment"> + <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> + </el-select> + </template> + </el-table-column> #end #end </el-table> diff --git a/ruoyi-ui/src/components/Pagination/index.vue b/ruoyi-ui/src/components/Pagination/index.vue index b09f080..56f5a6b 100644 --- a/ruoyi-ui/src/components/Pagination/index.vue +++ b/ruoyi-ui/src/components/Pagination/index.vue @@ -1,7 +1,6 @@ <template> <div :class="{'hidden':hidden}" class="pagination-container"> <el-pagination - v-if="pageShow" :background="background" :current-page.sync="currentPage" :page-size.sync="pageSize" @@ -64,7 +63,6 @@ }, data() { return { - pageShow: true }; }, computed: { @@ -88,10 +86,7 @@ methods: { handleSizeChange(val) { if (this.currentPage * val > this.total) { - this.pageShow = false; - this.$nextTick(() => { - this.pageShow = true - }) + this.currentPage = 1 } this.$emit('pagination', { page: this.currentPage, limit: val }) if (this.autoScroll) { diff --git a/ruoyi-ui/src/permission.js b/ruoyi-ui/src/permission.js index 7e770d4..6bb0a1f 100644 --- a/ruoyi-ui/src/permission.js +++ b/ruoyi-ui/src/permission.js @@ -4,6 +4,7 @@ import NProgress from 'nprogress' import 'nprogress/nprogress.css' import { getToken } from '@/utils/auth' +import { isRelogin } from '@/utils/request' NProgress.configure({ showSpinner: false }) @@ -19,8 +20,10 @@ NProgress.done() } else { if (store.getters.roles.length === 0) { + isRelogin.show = true // 鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁宸叉媺鍙栧畬user_info淇℃伅 store.dispatch('GetInfo').then(() => { + isRelogin.show = false store.dispatch('GenerateRoutes').then(accessRoutes => { // 鏍规嵁roles鏉冮檺鐢熸垚鍙闂殑璺敱琛� router.addRoutes(accessRoutes) // 鍔ㄦ�佹坊鍔犲彲璁块棶璺敱琛� diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index f880199..3c3a65a 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -9,7 +9,7 @@ let downloadLoadingInstance; // 鏄惁鏄剧ず閲嶆柊鐧诲綍 -let isReloginShow; +export let isRelogin = { show: false }; axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' // 瀵瑰簲鍥介檯鍖栬祫婧愭枃浠跺悗缂� @@ -78,23 +78,20 @@ return res.data } if (code === 401) { - if (!isReloginShow) { - isReloginShow = true; + if (!isRelogin.show) { + isRelogin.show = true; MessageBox.confirm('鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�', '绯荤粺鎻愮ず', { confirmButtonText: '閲嶆柊鐧诲綍', cancelButtonText: '鍙栨秷', type: 'warning' } ).then(() => { - isReloginShow = false; + isRelogin.show = false; store.dispatch('LogOut').then(() => { - // 濡傛灉鏄櫥褰曢〉闈笉闇�瑕侀噸鏂板姞杞� - if (window.location.hash.indexOf("#/login") != 0) { - location.href = process.env.VUE_APP_CONTEXT_PATH + "index"; - } + location.href = process.env.VUE_APP_CONTEXT_PATH + "index"; }) }).catch(() => { - isReloginShow = false; + isRelogin.show = false; }); } return Promise.reject('鏃犳晥鐨勪細璇濓紝鎴栬�呬細璇濆凡杩囨湡锛岃閲嶆柊鐧诲綍銆�') diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 8e3cb0c..7e6eccd 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -70,6 +70,9 @@ // 鍥炴樉鏁版嵁瀛楀吀 export function selectDictLabel(datas, value) { + if (value === undefined) { + return ""; + } var actions = []; Object.keys(datas).some((key) => { if (datas[key].value == ('' + value)) { @@ -77,23 +80,31 @@ return true; } }) + if (actions.length === 0) { + actions.push(value); + } return actions.join(''); } // 鍥炴樉鏁版嵁瀛楀吀锛堝瓧绗︿覆鏁扮粍锛� export function selectDictLabels(datas, value, separator) { - if(value === undefined) { + if (value === undefined) { return ""; } var actions = []; var currentSeparator = undefined === separator ? "," : separator; var temp = value.split(currentSeparator); Object.keys(value.split(currentSeparator)).some((val) => { + var match = false; Object.keys(datas).some((key) => { if (datas[key].value == ('' + temp[val])) { actions.push(datas[key].label + currentSeparator); + match = true; } }) + if (!match) { + actions.push(temp[val] + currentSeparator); + } }) return actions.join('').substring(0, actions.join('').length - 1); } diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index b57f2b9..17bc72a 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -206,7 +206,7 @@ email: [ { type: "email", - message: "'璇疯緭鍏ユ纭殑閭鍦板潃", + message: "璇疯緭鍏ユ纭殑閭鍦板潃", trigger: ["blur", "change"] } ], diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue index 9c793f5..d57a708 100644 --- a/ruoyi-ui/src/views/system/notice/index.vue +++ b/ruoyi-ui/src/views/system/notice/index.vue @@ -135,7 +135,7 @@ </el-col> <el-col :span="12"> <el-form-item label="鍏憡绫诲瀷" prop="noticeType"> - <el-select v-model="form.noticeType" placeholder="璇烽�夋嫨"> + <el-select v-model="form.noticeType" placeholder="璇烽�夋嫨鍏憡绫诲瀷"> <el-option v-for="dict in dict.type.sys_notice_type" :key="dict.value" diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index a66aac2..5208b0a 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -248,7 +248,7 @@ <el-row> <el-col :span="12"> <el-form-item label="鐢ㄦ埛鎬у埆"> - <el-select v-model="form.sex" placeholder="璇烽�夋嫨"> + <el-select v-model="form.sex" placeholder="璇烽�夋嫨鎬у埆"> <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" @@ -273,7 +273,7 @@ <el-row> <el-col :span="12"> <el-form-item label="宀椾綅"> - <el-select v-model="form.postIds" multiple placeholder="璇烽�夋嫨"> + <el-select v-model="form.postIds" multiple placeholder="璇烽�夋嫨宀椾綅"> <el-option v-for="item in postOptions" :key="item.postId" @@ -286,7 +286,7 @@ </el-col> <el-col :span="12"> <el-form-item label="瑙掕壊"> - <el-select v-model="form.roleIds" multiple placeholder="璇烽�夋嫨"> + <el-select v-model="form.roleIds" multiple placeholder="璇烽�夋嫨瑙掕壊"> <el-option v-for="item in roleOptions" :key="item.roleId" diff --git a/ruoyi-ui/src/views/system/user/profile/userInfo.vue b/ruoyi-ui/src/views/system/user/profile/userInfo.vue index b422c51..068b714 100644 --- a/ruoyi-ui/src/views/system/user/profile/userInfo.vue +++ b/ruoyi-ui/src/views/system/user/profile/userInfo.vue @@ -42,7 +42,7 @@ { required: true, message: "閭鍦板潃涓嶈兘涓虹┖", trigger: "blur" }, { type: "email", - message: "'璇疯緭鍏ユ纭殑閭鍦板潃", + message: "璇疯緭鍏ユ纭殑閭鍦板潃", trigger: ["blur", "change"] } ], -- Gitblit v1.9.3