From 5aeac1a8ae58d2ca55de64b13dd722f4d816f008 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期三, 19 八月 2020 17:01:43 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue --- ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue | 2 +- ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm | 9 ++++----- ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 16 ++++++++++++++-- ruoyi-ui/package.json | 2 +- ruoyi-ui/src/components/HeaderSearch/index.vue | 2 +- ruoyi-ui/src/utils/ruoyi.js | 2 +- ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java | 13 ++++++++++++- ruoyi-generator/src/main/resources/vm/vue/index.vue.vm | 7 +++---- ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java | 2 +- pom.xml | 2 +- 10 files changed, 39 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index 8547a01..117ac33 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ <swagger.version>2.9.2</swagger.version> <kaptcha.version>2.3.2</kaptcha.version> <pagehelper.boot.version>1.2.5</pagehelper.boot.version> - <fastjson.version>1.2.70</fastjson.version> + <fastjson.version>1.2.73</fastjson.version> <oshi.version>3.9.1</oshi.version> <commons.io.version>2.5</commons.io.version> <commons.fileupload.version>1.3.3</commons.fileupload.version> diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java index eed41a2..f781b1e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java @@ -4,6 +4,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import java.math.BigDecimal; /** * 鑷畾涔夊鍑篍xcel鏁版嵁娉ㄨВ @@ -30,7 +31,7 @@ public String dateFormat() default ""; /** - * 濡傛灉鏄瓧鍏哥被鍨嬶紝璇疯缃瓧鍏哥殑type鍊� + * 濡傛灉鏄瓧鍏哥被鍨嬶紝璇疯缃瓧鍏哥殑type鍊� (濡�: sys_user_sex) */ public String dictType() default ""; @@ -45,6 +46,16 @@ public String separator() default ","; /** + * BigDecimal 绮惧害 榛樿:-1(榛樿涓嶅紑鍚疊igDecimal鏍煎紡鍖�) + */ + public int scale() default -1; + + /** + * BigDecimal 鑸嶅叆瑙勫垯 榛樿:BigDecimal.ROUND_HALF_EVEN + */ + public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; + + /** * 瀵煎嚭绫诲瀷锛�0鏁板瓧 1瀛楃涓诧級 */ public ColumnType cellType() default ColumnType.STRING; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index d950b77..d5a23b1 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -8,6 +8,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.math.BigDecimal; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -546,9 +547,13 @@ { cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator)); } - else if (StringUtils.isNotEmpty(dictType)) + else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value)) { cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator)); + } + else if (value instanceof BigDecimal && -1 != attr.scale()) + { + cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString()); } else { @@ -896,7 +901,14 @@ } else { - val = new BigDecimal(val.toString()); // 娴偣鏍煎紡澶勭悊 + if ((Double) val % 1 > 0) + { + val = new BigDecimal(val.toString()); + } + else + { + val = new DecimalFormat("0").format(val); + } } } else if (cell.getCellTypeEnum() == CellType.STRING) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 3c62330..385439e 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -88,7 +88,7 @@ protected void configure(HttpSecurity httpSecurity) throws Exception { httpSecurity - // CRSF绂佺敤锛屽洜涓轰笉浣跨敤session + // CSRF绂佺敤锛屽洜涓轰笉浣跨敤session .csrf().disable() // 璁よ瘉澶辫触澶勭悊绫� .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() 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 495a94c..b52c6f2 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 @@ -66,7 +66,7 @@ v-hasPermi="['${moduleName}:${businessName}:add']" >鏂板</el-button> </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> <el-table @@ -140,7 +140,7 @@ <el-input v-model="form.${field}" placeholder="璇疯緭鍏�${comment}" /> </el-form-item> #elseif($column.htmlType == "select" && "" != $dictType) - <el-form-item label="${comment}"> + <el-form-item label="${comment}" prop="${field}"> <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> <el-option v-for="dict in ${field}Options" @@ -152,7 +152,7 @@ </el-select> </el-form-item> #elseif($column.htmlType == "select" && $dictType) - <el-form-item label="${comment}"> + <el-form-item label="${comment}" prop="${field}"> <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> </el-select> @@ -272,9 +272,8 @@ #else #set($comment=$column.columnComment) #end -#set($comment=$column.columnComment) $column.javaField: [ - { required: true, message: "$comment涓嶈兘涓虹┖", trigger: "blur" } + { required: true, message: "$comment涓嶈兘涓虹┖", trigger: "#if($column.htmlType == "select")"change"#else"blur"#end" } ]#if($velocityCount != $columns.size()),#end #end 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 534c15a..d688b7d 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -169,7 +169,7 @@ <el-input v-model="form.${field}" placeholder="璇疯緭鍏�${comment}" /> </el-form-item> #elseif($column.htmlType == "select" && "" != $dictType) - <el-form-item label="${comment}"> + <el-form-item label="${comment}" prop="${field}"> <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> <el-option v-for="dict in ${field}Options" @@ -181,7 +181,7 @@ </el-select> </el-form-item> #elseif($column.htmlType == "select" && $dictType) - <el-form-item label="${comment}"> + <el-form-item label="${comment}" prop="${field}"> <el-select v-model="form.${field}" placeholder="璇烽�夋嫨${comment}"> <el-option label="璇烽�夋嫨瀛楀吀鐢熸垚" value="" /> </el-select> @@ -306,9 +306,8 @@ #else #set($comment=$column.columnComment) #end -#set($comment=$column.columnComment) $column.javaField: [ - { required: true, message: "$comment涓嶈兘涓虹┖", trigger: "blur" } + { required: true, message: "$comment涓嶈兘涓虹┖", trigger: #if($column.htmlType == "select")"change"#else"blur"#end } ]#if($velocityCount != $columns.size()),#end #end diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index a8d623b..f0336da 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -86,7 +86,7 @@ "mockjs": "1.0.1-beta3", "plop": "2.3.0", "runjs": "4.3.2", - "sass": "1.26.10", + "node-sass": "4.14.1", "sass-loader": "8.0.2", "script-ext-html-webpack-plugin": "2.1.3", "script-loader": "0.7.2", diff --git a/ruoyi-ui/src/components/HeaderSearch/index.vue b/ruoyi-ui/src/components/HeaderSearch/index.vue index 9a11a51..3b4790d 100644 --- a/ruoyi-ui/src/components/HeaderSearch/index.vue +++ b/ruoyi-ui/src/components/HeaderSearch/index.vue @@ -167,7 +167,7 @@ display: inline-block; vertical-align: middle; - ::v-deep .el-input__inner { + /deep/ .el-input__inner { border-radius: 0; border: 0; padding-left: 0; diff --git a/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue b/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue index bb753a1..34a7e55 100644 --- a/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue +++ b/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue @@ -82,7 +82,7 @@ position: relative; overflow: hidden; width: 100%; - ::v-deep { + /deep/ { .el-scrollbar__bar { bottom: 0px; } diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index e77b155..e7f4180 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -131,7 +131,7 @@ id = id || 'id' parentId = parentId || 'parentId' children = children || 'children' - rootId = rootId || 0 + rootId = rootId || Math.min.apply(Math, data.map(item => { return item[parentId] })) || 0 //瀵规簮鏁版嵁娣卞害鍏嬮殕 const cloneData = JSON.parse(JSON.stringify(data)) //寰幆鎵�鏈夐」 -- Gitblit v1.9.3