sr 4 年 前
コミット
f5033ce1b8
25 ファイル変更709 行追加197 行削除
  1. 14 17
      boman-api/boman-domain/src/main/java/com.boman.domain/GenTable.java
  2. 12 0
      boman-api/boman-domain/src/main/java/com.boman.domain/GenTableColumn.java
  3. 5 0
      boman-api/boman-domain/src/main/java/com.boman.domain/constant/FormDataConstant.java
  4. 12 1
      boman-api/boman-domain/src/main/java/com.boman.domain/constant/GlobalBtn.java
  5. 14 0
      boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/collection/CollectionUtils.java
  6. 5 4
      boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/obj/ObjectUtils.java
  7. 8 0
      boman-modules/boman-gen/src/main/java/com/boman/gen/service/GenTableServiceImpl.java
  8. 9 5
      boman-modules/boman-gen/src/main/resources/mapper/generator/GenTableMapper.xml
  9. 0 1
      boman-modules/boman-system/src/main/java/com/boman/system/service/impl/SysScheduleServiceImpl.java
  10. 5 4
      boman-web-core/src/main/java/com/boman/web/core/domain/TableContext.java
  11. 26 51
      boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java
  12. 13 12
      boman-web-core/src/main/java/com/boman/web/core/utils/AuthUtils.java
  13. 44 0
      boman-web-core/src/main/java/com/boman/web/core/utils/ColumnUtils.java
  14. 29 0
      boman-web-core/src/main/java/com/boman/web/core/utils/HandlerFormDataUtils.java
  15. 4 3
      ruoyi-ui/src/components/DynamicForms/index.vue
  16. 225 0
      ruoyi-ui/src/components/DynamicFormsteo/index.vue
  17. 1 1
      ruoyi-ui/src/layout/components/Sidebar/Item.vue
  18. 2 0
      ruoyi-ui/src/main.js
  19. 44 16
      ruoyi-ui/src/utils/currencyFn.js
  20. 40 26
      ruoyi-ui/src/views/system/editing/index.vue
  21. 113 36
      ruoyi-ui/src/views/system/form/index.vue
  22. 45 19
      ruoyi-ui/src/views/system/table/index.vue
  23. 9 1
      ruoyi-ui/src/views/tool/gen/basicInfoForm.vue
  24. 11 0
      ruoyi-ui/src/views/tool/gen/editTable.vue
  25. 19 0
      ruoyi-ui/src/views/tool/gen/index.vue

+ 14 - 17
boman-api/boman-domain/src/main/java/com.boman.domain/GenTable.java

@@ -10,23 +10,6 @@ import java.util.List;
 public class GenTable extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
-    /** {@link com.boman.web.core.utils.AuthUtils#funcType(java.lang.String)}*/
-    /** add */
-    public static final String A = "A";
-    /** modify */
-    public static final String M = "M";
-    /** delete */
-    public static final String D = "D";
-    /** query */
-    public static final String Q = "Q";
-    /** submit */
-    public static final String S = "S";
-    /** unsubmit */
-    public static final String U = "U";
-    /** export */
-    public static final String E = "E";
-    /** import */
-    public static final String I = "I";
 
     /** 编号 */
     private Long id;
@@ -194,6 +177,20 @@ public class GenTable extends BaseEntity
      */
     private Boolean isContainsBlob;
 
+    /**
+     * 列宽
+     */
+    private Integer tableColumn;
+
+
+    public Integer getTableColumn() {
+        return tableColumn;
+    }
+
+    public void setTableColumn(Integer tableColumn) {
+        this.tableColumn = tableColumn;
+    }
+
     public String getUpdateType() {
         return updateType;
     }

+ 12 - 0
boman-api/boman-domain/src/main/java/com.boman.domain/GenTableColumn.java

@@ -171,6 +171,18 @@ public class GenTableColumn extends BaseEntity
      * 表.字段全称
      */
     private String tableColumnName;
+    /**
+     * 前端再计算的时候,是否用到该列的扩展属性 extendedAttributes
+     */
+    private Boolean isUseExtend;
+
+    public Boolean getIsUseExtend() {
+        return isUseExtend;
+    }
+
+    public void setIsUseExtend(Boolean isUseExtend) {
+        this.isUseExtend = isUseExtend;
+    }
 
     public String getTableColumnName() {
         return tableColumnName;

+ 5 - 0
boman-api/boman-domain/src/main/java/com.boman.domain/constant/FormDataConstant.java

@@ -185,8 +185,13 @@ public class FormDataConstant {
     public static final String PATTERN = "pattern";
     public static final String BLUR = "blur";
     public static final String REQUIRED = "required";
+    public static final String TABLE_COLUMN = "table_column";
 
     /** 冒号 */
     public static final String COLON = ":";
+    /** 前台有时候需要计算时长等的标识 */
+    public static final String COL = "col";
+    /** 前台有时候需要计算时长等的标识,用到的列 */
+    public static final String IS_USE_EXTEND = "isUseExtend";
 
 }

+ 12 - 1
boman-api/boman-domain/src/main/java/com.boman.domain/constant/GlobalBtn.java

@@ -6,13 +6,24 @@ package com.boman.domain.constant;
  **/
 public class GlobalBtn {
 
+
+    /** {@link com.boman.web.core.utils.AuthUtils#funcType(java.lang.String)}*/
+
+    /** add */
     public static final String A = "A";
+    /** modify */
     public static final String M = "M";
+    /** delete */
     public static final String D = "D";
+    /** query */
     public static final String Q = "Q";
+    /** submit */
     public static final String S = "S";
+    /** unsubmit */
     public static final String U = "U";
-    public static final String I = "I";
+    /** export */
     public static final String E = "E";
+    /** import */
+    public static final String I = "I";
 
 }

+ 14 - 0
boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/collection/CollectionUtils.java

@@ -1,9 +1,11 @@
 package com.boman.common.core.utils.collection;
 
+import com.alibaba.fastjson.JSONArray;
 import com.boman.common.core.utils.obj.ObjectUtils;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
@@ -34,4 +36,16 @@ public class CollectionUtils {
         one.addAll(another);
         return one.stream().distinct().collect(Collectors.toList());
     }
+
+    @SuppressWarnings("unchecked")
+    public static <T> void addJSONArray(Set<T> set, JSONArray jsonArray) {
+        if (null == jsonArray || jsonArray.size() <= 0) {
+            return;
+        }
+
+        for (Object object : jsonArray) {
+            T input = (T) object;
+            set.add(input);
+        }
+    }
 }

+ 5 - 4
boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/obj/ObjectUtils.java

@@ -265,11 +265,12 @@ public class ObjectUtils {
     /**
      * 功能描述: 根据规则获取
      *
-     * @param input    原数据
-     * @param function FunctionalInterface
-     * @return java.util.List<T>
+     * @param input     原数据
+     * @param predicate predicate
+     * @param function  FunctionalInterface
+     * @return java.util.List<R>
      */
-    public static <T, R> List<R> mapFilter(List<T> input, Function<T, R> function, Predicate<T> predicate) {
+    public static <T, R> List<R> mapFilter(List<T> input, Predicate<T> predicate, Function<T, R> function) {
         return requireNonNull(input, "list is null")
                 .stream()
                 .filter(predicate)

+ 8 - 0
boman-modules/boman-gen/src/main/java/com/boman/gen/service/GenTableServiceImpl.java

@@ -452,6 +452,14 @@ public class GenTableServiceImpl implements IGenTableService {
     public AjaxResult insertGenTable(GenTable genTable) {
         String menuRole = genTable.getMenuRole();
         genTable.setMenuRole(menuRole.toUpperCase());
+
+        Integer tableColumn = genTable.getTableColumn();
+        if (tableColumn != null && tableColumn > 0){
+            //判断表单有几列 用24进行除法
+            int num = 24 / tableColumn;
+            genTable.setTableColumn(num);
+
+        }
         //新增表成功的时候,新增字段公共字段
         int i = genTableMapper.insertGenTable(genTable);
         if (i > 0) {

+ 9 - 5
boman-modules/boman-gen/src/main/resources/mapper/generator/GenTableMapper.xml

@@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="filterConditions"         column="filter_conditions"            />
 		<result property="extendedAttributes"         column="extended_attributes"            />
 		<result property="tablePrimaryKey"         column="table_primary_key"            />
+		<result property="tableColumn"         column="table_column"            />
 		<collection  property="columns"  javaType="java.util.List"  resultMap="GenTableColumnResult" />
 	</resultMap>
 	
@@ -68,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<sql id="selectGenTableVo">
         select id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options,
-         create_by, create_time, update_by, update_time, remark, is_menu, menu_role, ak_column, dk_column, trigger_create, trigger_retrieve, trigger_update, trigger_delete, trigger_submit, real_table_name, filter_conditions, extended_attributes, table_primary_key from gen_table
+         create_by, create_time, update_by, update_time, remark, is_menu, menu_role, ak_column, dk_column, trigger_create, trigger_retrieve, trigger_update, trigger_delete, trigger_submit, real_table_name, filter_conditions, extended_attributes, table_primary_key, table_column from gen_table
     </sql>
     
     <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
@@ -122,7 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
-	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key,
+	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key, t.table_column,
 			   c.id as c_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
 		FROM gen_table t
 			 LEFT JOIN gen_table_column c ON t.id = c.table_id
@@ -130,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
-	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key,
+	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key, t.table_column,
 			   c.id as c_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
 		FROM gen_table t
 			 LEFT JOIN gen_table_column c ON t.id = c.table_id
@@ -138,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
-	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key,
+	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key, t.table_column,
 			   c.id as c_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
 		FROM gen_table t
 			 LEFT JOIN gen_table_column c ON t.id = c.table_id
@@ -171,7 +172,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="realTableName != null and realTableName != ''">real_table_name,</if>
  			<if test="filterConditions != null and filterConditions != ''">filter_conditions,</if>
  			<if test="extendedAttributes != null and extendedAttributes != ''">extended_attributes,</if>
- 			<if test="tablePrimaryKey != null and tablePrimaryKey != ''">table_primary_key,,</if>
+ 			<if test="tablePrimaryKey != null and tablePrimaryKey != ''">table_primary_key,</if>
+ 			<if test="tableColumn != null"> table_column,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
 			create_time
          )values(
@@ -200,6 +202,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="filterConditions != null and filterConditions != ''">#{filterConditions},</if>
  			<if test="extendedAttributes != null and extendedAttributes != ''">#{extendedAttributes},</if>
  			<if test="tablePrimaryKey != null and tablePrimaryKey != ''">#{tablePrimaryKey},</if>
+ 			<if test="tableColumn != null">#{tableColumn},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
 			sysdate()
          )
@@ -237,6 +240,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="filterConditions != null and filterConditions !=''">filter_conditions = #{filterConditions},</if>
 			<if test="extendedAttributes != null and extendedAttributes !=''">extended_attributes = #{extendedAttributes},</if>
 			<if test="tablePrimaryKey != null and tablePrimaryKey !=''">table_primary_key = #{tablePrimaryKey},</if>
+			<if test="tableColumn != null">table_column = #{tableColumn},</if>
             update_time = sysdate()
         </set>
         where id = #{id}

+ 0 - 1
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/SysScheduleServiceImpl.java

@@ -31,7 +31,6 @@ public class SysScheduleServiceImpl implements ISysScheduleService {
     @Override
     public List<JSONObject> setDay(List<JSONObject> result) {
         int num = 0;
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         for (JSONObject jsonObject : result) {
             num = 0;
             Set<Map.Entry<String, Object>> entries = jsonObject.entrySet();

+ 5 - 4
boman-web-core/src/main/java/com/boman/web/core/domain/TableContext.java

@@ -6,6 +6,7 @@ import com.boman.common.redis.RedisKey;
 import com.boman.common.redis.service.RedisService;
 import com.boman.domain.GenTable;
 import com.boman.domain.GenTableColumn;
+import com.boman.domain.constant.GlobalBtn;
 import com.boman.system.api.RemoteMenuService;
 import com.boman.system.api.RemoteRoleDataService;
 import com.boman.system.api.domain.SysUser;
@@ -92,11 +93,11 @@ public class TableContext {
         }
 
         if (ActionType.INSERT.equals(context.getActionType())) {
-            containsFunction(genTable.getMenuRole(), GenTable.A, "模块:[" + functionName + "], 没有新增功能");
-            checkPermsAuth(tableName, GenTable.A);
+            containsFunction(genTable.getMenuRole(), GlobalBtn.A, "模块:[" + functionName + "], 没有新增功能");
+            checkPermsAuth(tableName, GlobalBtn.A);
         } else {
-            containsFunction(genTable.getMenuRole(), GenTable.M, "模块:[" + functionName + "], 没有修改功能");
-            checkPermsAuth(tableName, GenTable.M);
+            containsFunction(genTable.getMenuRole(), GlobalBtn.M, "模块:[" + functionName + "], 没有修改功能");
+            checkPermsAuth(tableName, GlobalBtn.M);
             checkRoleDataAuth(tableName, context.getPkName(), context.getId());
         }
     }

+ 26 - 51
boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java

@@ -3,10 +3,8 @@ package com.boman.web.core.service;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.boman.common.core.constant.GenConstants;
 import com.boman.common.core.utils.SecurityUtils;
 import com.boman.common.core.utils.StringUtils;
-import com.boman.common.core.utils.array.ArrayUtils;
 import com.boman.common.core.utils.collection.CollectionUtils;
 import com.boman.common.core.utils.obj.ObjectUtils;
 import com.boman.common.core.web.domain.AjaxResult;
@@ -17,7 +15,6 @@ import com.boman.domain.GenTableColumn;
 import com.boman.domain.SysDictData;
 import com.boman.domain.constant.*;
 import com.boman.domain.dto.RoleMenuDto;
-import com.boman.domain.exception.NoSuchFunctionException;
 import com.boman.gen.api.RemoteGenTableColumnService;
 import com.boman.gen.api.RemoteGenTableService;
 import com.boman.system.api.RemoteMenuService;
@@ -35,7 +32,6 @@ import com.boman.web.core.utils.IdUtils;
 import com.google.common.base.Strings;
 import com.google.common.collect.Lists;
 import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.math.NumberUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -46,7 +42,6 @@ import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Predicate;
 
@@ -93,8 +88,6 @@ public class TableServiceCmdService {
     private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
 
     public final AjaxResult objectSave(FormDataDto dto) {
-        AjaxResult result = AjaxResult.success();
-
         // 权限校验在此方法中
         TableContext context = tableContext.createContext(dto);
         // 拿到pkName和maxId
@@ -103,16 +96,18 @@ public class TableServiceCmdService {
 
         checkColumn(commitData, context.getColumns());
         // 必填项
-        handlerRequired(commitData, context.getColumns());
+        handleRequired(commitData, context.getColumns());
         // 处理输入类型
-        handlerInputType(commitData, context.getColumns());
+        handleInputType(commitData, context.getColumns());
 
+        AjaxResult result;
         // 新增
         if (ActionType.INSERT.equals(context.getActionType())) {
             Integer maxId = IdUtils.getMaxId(dto.getTable(), pkName);
             RowResult rowResult = saveService.insertRow(context, maxId);
             if (RowResult.checkSuccess(rowResult)) {
                 LOGGER.info("保存成功,封装到数据库的数据为: {}", JSON.toJSONString(rowResult.getData()));
+                 result = AjaxResult.success(maxId);
             } else {
                 LOGGER.error("保存失败,保持的原始数据为: {}", JSON.toJSONString(dto));
                 result = AjaxResult.error();
@@ -122,6 +117,7 @@ public class TableServiceCmdService {
             int effective = updateService.updateByIdList(context, Collections.singletonList(context.getId()));
             if (effective > 0) {
                 LOGGER.info("修改成功,封装到数据库的数据为: {}", JSON.toJSONString(commitData));
+                result = AjaxResult.success(context.getId());
             } else {
                 LOGGER.error("修改失败,前台传来的原始数据为: {}", JSON.toJSONString(commitData));
                 result = AjaxResult.error();
@@ -132,35 +128,6 @@ public class TableServiceCmdService {
 
     }
 
-    private void handlerInputType(JSONObject commitData, List<GenTableColumn> columns) {
-        for (Map.Entry<String, Object> entry : commitData.entrySet()) {
-            Object value =entry.getValue();
-            for (GenTableColumn column : columns) {
-                if (entry.getKey().equals(column.getColumnName())
-                        && ArrayUtils.arraysContains(GenConstants.COLUMNTYPE_NUMBER, getDbType(column.getColumnType()))) {
-                    if ((value instanceof Number)) {
-                        // ignore 这里的if不能删掉,因为else if有一个强转
-                    } else if (!NumberUtils.isCreatable(((String) value))) {
-                        throw new IllegalArgumentException(column.getColumnComment() + "只能输入数字");
-                    }
-                }
-            }
-        }
-    }
-
-    private void handlerRequired(JSONObject commitData, List<GenTableColumn> columns) {
-        for (GenTableColumn column : columns) {
-            if (GenTableColumn.IS_REQUIRED.equalsIgnoreCase(column.getIsRequired())) {
-                Object value = commitData.get(column.getColumnName());
-                if ((value instanceof String)) {
-                    requireNonNull((String) value, column.getColumnComment() + " 为必填项");
-                } else {
-                    requireNonNull(value, column.getColumnComment() + " 为必填项");
-                }
-            }
-        }
-    }
-
     /**
      * 功能描述: 通用删除接口 (真的删除)
      *
@@ -309,7 +276,7 @@ public class TableServiceCmdService {
         List<GenTableColumn> columns = genTable.getColumns();
         // id = -1时,查询该表单对应的字段名称
         if (ltZero(id)) {
-            return getByTableName(tableName, columns, isUi);
+            return getByTableName(genTable, isUi);
         }
 
         List<GenTableColumn> updateVisibleColumns = filterData(columns, 2, MaskConstant.UPDATE_VISIBLE::equals);
@@ -385,6 +352,10 @@ public class TableServiceCmdService {
         JSONObject result = new JSONObject();
         result.put(SHOW_DATA, parentColumns);
         result.put(BUTTON_LIST, getButton(tableName));
+        Integer tableColumn = genTable.getTableColumn();
+        if (tableColumn != null){
+            result.put(TABLE_COLUMN, tableColumn);
+        }
         return AjaxResult.success(result);
     }
 
@@ -456,7 +427,7 @@ public class TableServiceCmdService {
             }
         }
         // 删除Q
-        btns.remove(GenTable.Q);
+        btns.remove(GlobalBtn.Q);
         return btns;
     }
 
@@ -490,7 +461,8 @@ public class TableServiceCmdService {
      */
     public String getButton(String tableName) {
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
-        return Strings.nullToEmpty(genTable.getMenuRole());
+        List<String> btns = buildBtnList(genTable.getTableName());
+        return Strings.nullToEmpty(CollectionUtils.listToString(btns));
     }
 
 
@@ -624,7 +596,7 @@ public class TableServiceCmdService {
     /**
      * 判断是什么action
      *
-     * @param tableName 表
+     * @param tableName 表
      * @param action    动作
      * @return
      */
@@ -669,14 +641,17 @@ public class TableServiceCmdService {
     /**
      * 功能描述: 根据表名封装列的对应关系, 同时封装好字典值
      *
-     * @param tableName  tableName
-     * @param allColumns allColumns
+     * @param genTable genTable
      * @param isUi       带折叠true, 不带折叠false
      * @return com.boman.common.core.web.domain.AjaxResult
      */
-    public AjaxResult getByTableName(String tableName, List<GenTableColumn> allColumns, Boolean isUi) {
-        List<GenTableColumn> resultCols;
+    public AjaxResult getByTableName(GenTable genTable, Boolean isUi) {
+        String tableName = genTable.getTableName();
+        List<GenTableColumn> allColumns = genTable.getColumns();
         List<GenTableColumn> parentColumns = filterHrAndSort(allColumns);
+        List<GenTableColumn> resultCols;
+        // extend的字段标记为true
+        markTrueByExtend(allColumns);
         // 所有新增可见的列
         allColumns = filterData(allColumns, 0, MaskConstant.INSERT_VISIBLE::equals);
         // 带折叠
@@ -692,14 +667,10 @@ public class TableServiceCmdService {
                 hrColumn.setHrChildren(children);
             }
 
-            // 把孩子对应的字典值放进去
-            for (GenTableColumn hrColumn : parentColumns) {
-                packDictDataToColumns(hrColumn.getHrChildren(), ObjectUtils::isNotEmpty);
-            }
             resultCols = parentColumns;
         } else {
             // 不带折叠
-            packDictDataToColumns(allColumns, ObjectUtils::isNotEmpty);
+            // packDictDataToColumns(allColumns, ObjectUtils::isNotEmpty);
             resultCols = allColumns;
         }
 
@@ -707,6 +678,10 @@ public class TableServiceCmdService {
         result.put(BUTTON_LIST, getButton(tableName));
         result.put(SHOW_DATA, resultCols);
         result.put(RULES, packRequireColumn(allColumns));
+        Integer tableColumn = genTable.getTableColumn();
+        if (tableColumn != null){
+            result.put(TABLE_COLUMN,tableColumn);
+        }
         return AjaxResult.success(result);
     }
 

+ 13 - 12
boman-web-core/src/main/java/com/boman/web/core/utils/AuthUtils.java

@@ -8,6 +8,7 @@ import com.boman.common.redis.service.RedisService;
 import com.boman.domain.GenTable;
 import com.boman.domain.SysRoleData;
 import com.boman.domain.constant.FormDataConstant;
+import com.boman.domain.constant.GlobalBtn;
 import com.boman.domain.exception.NoSuchFunctionException;
 import com.boman.system.api.RemoteMenuService;
 import com.boman.system.api.RemoteRoleDataService;
@@ -35,7 +36,7 @@ public class AuthUtils {
 
     public static boolean checkAuthObjectDelete(GenTable genTable, Long id, String pkName) {
         String functionName = genTable.getFunctionName();
-        if (!containsFunctionBool(genTable.getMenuRole(), GenTable.D, functionName)) {
+        if (!containsFunctionBool(genTable.getMenuRole(), GlobalBtn.D, functionName)) {
             return false;
         }
 
@@ -45,7 +46,7 @@ public class AuthUtils {
             return true;
         }
 
-        if (!checkPermsAuthBool(tableName, GenTable.D)) {
+        if (!checkPermsAuthBool(tableName, GlobalBtn.D)) {
             return false;
         }
 
@@ -53,7 +54,7 @@ public class AuthUtils {
     }
 
     public static void checkAuthQueryList(GenTable genTable, JSONObject condition) {
-        containsFunction(genTable.getMenuRole(), GenTable.Q, "此模块:[" + genTable.getFunctionName() + "], 没有查询功能");
+        containsFunction(genTable.getMenuRole(), GlobalBtn.Q, "此模块:[" + genTable.getFunctionName() + "], 没有查询功能");
 
         LoginUser loginUser = getLoginUser();
         if (SysUser.isAdmin(loginUser.getUserid())) {
@@ -172,7 +173,7 @@ public class AuthUtils {
         List<String> permsList = getLoginUserPermsList();
         String perms = packPermsKey(tableName, funcType);
         if (!permsList.contains(perms)) {
-            LOGGER.error("非法操作,操作人: {},tableName: {}, 操作类型: 此人未配置 {} 权限", getLoginUser().getUsername(), tableName, funcType(GenTable.D));
+            LOGGER.error("非法操作,操作人: {},tableName: {}, 操作类型: 此人未配置 {} 权限", getLoginUser().getUsername(), tableName, funcType(GlobalBtn.D));
            return false;
         }
 
@@ -284,21 +285,21 @@ public class AuthUtils {
 
     public static String funcType(String funcType) {
         switch (funcType) {
-            case GenTable.A:
+            case GlobalBtn.A:
                 return "新增";
-            case GenTable.M:
+            case GlobalBtn.M:
                 return "修改";
-            case GenTable.D:
+            case GlobalBtn.D:
                 return "删除";
-            case GenTable.Q:
+            case GlobalBtn.Q:
                 return "查询";
-            case GenTable.S:
+            case GlobalBtn.S:
                 return "提交";
-            case GenTable.U:
+            case GlobalBtn.U:
                 return "反提交";
-            case GenTable.E:
+            case GlobalBtn.E:
                 return "导出";
-            case GenTable.I:
+            case GlobalBtn.I:
                 return "导入";
             default:
                 return "未知";

+ 44 - 0
boman-web-core/src/main/java/com/boman/web/core/utils/ColumnUtils.java

@@ -3,8 +3,10 @@ package com.boman.web.core.utils;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.util.TypeUtils;
+import com.boman.common.core.constant.GenConstants;
 import com.boman.common.core.utils.SecurityUtils;
 import com.boman.common.core.utils.StringUtils;
+import com.boman.common.core.utils.array.ArrayUtils;
 import com.boman.common.core.utils.collection.CollectionUtils;
 import com.boman.common.core.utils.obj.ObjectUtils;
 import com.boman.domain.GenTableColumn;
@@ -13,6 +15,7 @@ import com.boman.domain.exception.UnknownColumnException;
 import com.google.common.base.Joiner;
 import com.google.common.collect.Lists;
 import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.math.NumberUtils;
 
 import java.sql.Timestamp;
 import java.util.Comparator;
@@ -239,6 +242,47 @@ public class ColumnUtils {
         }
     }
 
+    /**
+     * 功能描述: 处理必填项
+     *
+     * @param commitData 需要提交的数据
+     * @param columns 所有的列
+     */
+    public static void handleRequired(JSONObject commitData, List<GenTableColumn> columns) {
+        for (GenTableColumn column : columns) {
+            if (GenTableColumn.IS_REQUIRED.equalsIgnoreCase(column.getIsRequired())) {
+                Object value = commitData.get(column.getColumnName());
+                if ((value instanceof String)) {
+                    requireNonNull((String) value, column.getColumnComment() + " 为必填项");
+                } else {
+                    requireNonNull(value, column.getColumnComment() + " 为必填项");
+                }
+            }
+        }
+    }
+
+    /**
+     * 功能描述: 处理输入类型的不合法
+     *
+     * @param commitData 需要提交的数据
+     * @param columns 所有的列
+     */
+    public static void handleInputType(JSONObject commitData, List<GenTableColumn> columns) {
+        for (Map.Entry<String, Object> entry : commitData.entrySet()) {
+            Object value =entry.getValue();
+            for (GenTableColumn column : columns) {
+                if (entry.getKey().equals(column.getColumnName())
+                        && ArrayUtils.arraysContains(GenConstants.COLUMNTYPE_NUMBER, getDbType(column.getColumnType()))) {
+                    if ((value instanceof Number)) {
+                        // ignore 这里的if不能删掉,因为else if有一个强转
+                    } else if (!NumberUtils.isCreatable(((String) value))) {
+                        throw new IllegalArgumentException(column.getColumnComment() + "只能输入数字");
+                    }
+                }
+            }
+        }
+    }
+
     /**
      * 功能描述: 封装成查询条件 key: 列名,  value:查询条件_查询类别
      * eg: [{"config_name": ["系统配置", "EQ", "varchar(100)"]}]

+ 29 - 0
boman-web-core/src/main/java/com/boman/web/core/utils/HandlerFormDataUtils.java

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.TypeReference;
 import com.boman.common.core.utils.DateUtils;
 import com.boman.common.core.utils.SpringUtils;
 import com.boman.common.core.utils.array.ArrayUtils;
+import com.boman.common.core.utils.collection.CollectionUtils;
 import com.boman.common.core.utils.obj.ObjectUtils;
 import com.boman.domain.GenTableColumn;
 import com.boman.domain.SysDictData;
@@ -265,4 +266,32 @@ public class HandlerFormDataUtils {
         }
     }
 
+    /**
+     * 功能描述: 列中extend的json使用到的列标记为true
+     *
+     * @param allColumns allColumns
+     */
+    public static void markTrueByExtend(List<GenTableColumn> allColumns) {
+        Set<String> extendColumnNames = new HashSet<>(16);
+        for (GenTableColumn col : allColumns) {
+            String extendedAttributes = col.getExtendedAttributes();
+            if (isNotEmpty(extendedAttributes)) {
+                JSONObject jsonObject = JSON.parseObject(extendedAttributes);
+                JSONArray jsonArray = jsonObject.getJSONArray(COL);
+                CollectionUtils.addJSONArray(extendColumnNames, jsonArray);
+            }
+        }
+
+        if (isEmpty(extendColumnNames)) {
+            return;
+        }
+
+
+        for (GenTableColumn column : allColumns) {
+            if (extendColumnNames.contains(column.getColumnName())) {
+                column.setIsUseExtend(true);
+            }
+        }
+    }
+
 }

+ 4 - 3
ruoyi-ui/src/components/DynamicForms/index.vue

@@ -145,6 +145,7 @@
       'queryData': {
         handler: function() {
           if (this.formConfig.extendedAttributes) {
+            console.log(this.formConfig,222)
             let extend = JSON.parse(this.formConfig.extendedAttributes)
             this.extFn(extend.col, extend.comp)
           }
@@ -155,14 +156,14 @@
     mounted() {},
     methods: {
       iChange(val){
-        console.log(val,this.formConfig.columnName)
         if(this.formConfig.isUseExtend){
+          console.log(this.formConfig.columnName)
           this.$emit('iChange',this.formConfig.columnName,val)
         }
       },
-      extFn(col, comp) {
+      extFn(col, comp) {
         let str = this.getDyn(col, this.queryData.showData,comp)
-        this.config[this.formConfig.columnName] = this.eval(str)
+        this.config[this.formConfig.columnName] = str
       },
       eval(code){
         let fun = new Function(`return ${code}`)();

+ 225 - 0
ruoyi-ui/src/components/DynamicFormsteo/index.vue

@@ -0,0 +1,225 @@
+<template>
+  <!-- <el-row  class="row-bg"> -->
+  <el-col :span="this.formConfig.tableColumnuy !== null? this.formConfig.tableColumnuy : 8 "  >
+  <el-form-item   :label="formConfig.columnComment"  :prop="formConfig.columnName">
+    <!-- 输入框 -->
+    <el-input v-if="formConfig.htmlType == 'input'" v-model="config[formConfig.columnName]" :placeholder="'请输入'+formConfig.columnComment"
+      clearable @keyup.enter.native="handleQuery"  :disabled="formConfig.disabshow" />
+    <!-- 多行输入框 -->
+    <el-input v-if="formConfig.htmlType == 'textarea'" type="textarea" v-model="config[formConfig.columnName]"
+      :placeholder="'请输入'+formConfig.columnComment" clearable @keyup.enter.native="handleQuery" :disabled="formConfig.disabshow"/>
+    <!-- 下拉框 -->
+    <el-select v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'select'&&(!formConfig.fkInfo)"
+      filterable :placeholder="'请输入'+formConfig.columnComment" :disabled="formConfig.disabshow">
+      <el-option v-for="itemChild in formConfig.sysDictData" :key="itemChild.dictValue" :label="itemChild.dictLabel"
+        :value="itemChild.dictValue">
+      </el-option>
+    </el-select>
+    <!-- 下拉框搜索 -->
+    <el-select :disabled="formConfig.disabshow" v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'select'&&(formConfig.fkInfo)"
+      filterable remote :remote-method="remoteMethod" :loading="loading" :placeholder="'请输入'+formConfig.columnComment">
+      <el-option v-for="itemChild in filterList" :key="itemChild[formConfig.fkInfo.fkColumnName]" :label="itemChild[formConfig.fkInfo.dkColumnName]" :value="itemChild[formConfig.fkInfo.fkColumnName]">
+      </el-option>
+    </el-select>
+    <!-- 复选框 -->
+    <el-checkbox-group :disabled="formConfig.disabshow" v-model="config" v-if="formConfig.htmlType == 'checkbox'">
+      <el-checkbox @change="handleCheckedCitiesChange" v-for="itemChild in formConfig.sysDictData" :label="itemChild.dictValue"
+        :key="itemChild.dictLabel">
+        {{itemChild.dictLabel}}
+      </el-checkbox>
+    </el-checkbox-group>
+    <!-- 单选框 -->
+    <el-radio-group :disabled="formConfig.disabshow" v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'radio'">
+      <el-radio v-for="itemChild in formConfig.sysDictData" :key="itemChild.dictValue" :label="itemChild.dictValue">{{itemChild.dictLabel}}</el-radio>
+    </el-radio-group>
+    <!-- 时间控件 -->
+    <el-date-picker :disabled="formConfig.disabshow" v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'datetime'" type="date"
+      :placeholder="'请输入'+formConfig.columnComment">
+    </el-date-picker>
+    <!-- 上传图片 -->
+    <el-upload :disabled="formConfig.disabshow" v-if="formConfig.htmlType == 'imageUpload'" :headers="{Authorization: 'Bearer ' + getToken()}" :action="process + '/boman-file/upload'"
+      :file-list="config" list-type="picture-card" :on-preview="handlePictureCardPreview" :on-success="upImageFn"
+      :on-remove="reseImage">
+      <i class="el-icon-plus"></i>
+    </el-upload>
+    <el-dialog :disabled="formConfig.disabshow" :visible.sync="dialogVisible" v-if="formConfig.htmlType == 'imageUpload'">
+      <img :src="dialogImageUrl" alt="">
+    </el-dialog>
+    <!-- 上传文件 -->
+    <el-upload :disabled="formConfig.disabshow" class="upload-demo" :headers="{Authorization: 'Bearer ' + getToken()}" v-if="formConfig.htmlType == 'fileUpload'"
+      :action="process + '/boman-file/upload'" :on-change="handleChange" :on-success="upImageFn" :on-remove="reseImage"
+      :file-list="config">
+      <el-button size="small" type="primary">点击上传</el-button>
+      <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+    </el-upload>
+    <!-- 富文本 -->
+    <editor :disabled="formConfig.disabshow" v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'editor'" :min-height="192" />
+  </el-form-item>
+  </el-col>
+  <!-- </el-row> -->
+</template>
+
+<script>
+  const defaultSettings = require('@/settings.js')
+  import Editor from '@/components/Editor';
+  import {
+    listIndexfou
+  } from "@/api/tool/gen";
+  import {
+    getToken
+  } from "@/utils/auth";
+  export default {
+    data() {
+      return {
+        fileList: [],
+        defaultSettings,
+        dialogImageUrl: '',
+        process: process.env.VUE_APP_BASE_API,
+        dialogVisible: false,
+        disabled: false,
+        loading: false,
+        filterList: [],
+        config: {},
+        aliemg: {
+          table: '',
+          orderBy: 'create_time desc',
+          pageNo: 1,
+          pageSize: 10,
+          fixedData: {
+            condition: {}
+          }
+        },
+      }
+    },
+    components: {
+      Editor
+    },
+    props: {
+      formConfig: {
+        type: Object,
+        required: true,
+        'default': {
+          sysDictData: []
+        }
+      },
+      type: {
+        type: Number,
+        default: 1
+      },
+    },
+    created() {
+      this.config = {}
+      if(this.type){
+        if(this.formConfig.readonly == true){
+          this.formConfig.disabshow = true
+        }else if(this.formConfig.mask.slice(3,4) == '0' || this.formConfig.isonliy == true){
+          this.formConfig.disabshow = true
+        }else{
+          this.formConfig.disabshow = false
+        }
+        if(this.formConfig.fkInfo == null){
+          this.formConfig.fkInfo=false
+        }
+      }
+      this.init()
+    },
+    watch: {
+      'config': {
+         handler: function() {
+             this.$emit('modelFn',this.formConfig.columnName,this.config[this.formConfig.columnName])
+         },
+         deep: true
+     }
+    },
+    mounted() {
+      console.log(this.formConfig)
+    },
+    methods: {
+      listIndexfouFn() {
+        listIndexfou(this.aliemg).then(response => {
+          if (response.data) {
+            this.filterList = response.data.rows
+          }
+          this.loading = false;
+        })
+      },
+      remoteMethod(query) {
+        if (query !== '') {
+          this.loading = true;
+          this.aliemg.fixedData.condition[this.formConfig.fkInfo.dkColumnName] = query
+          this.listIndexfouFn()
+        } else {
+          this.filterList = [];
+        }
+      },
+      upImageFn(res, file) {
+        this.config.push(res.data);
+      },
+      init() {
+        if (this.formConfig.htmlType == 'checkbox' || this.formConfig.htmlType == 'imageUpload' || this.formConfig.htmlType ==
+          'fileUpload') {
+          this.config = []
+        } else {
+          this.$set(this.config, this.formConfig.columnName, (this.formConfig.columnValue || ''))
+        }
+
+        if(this.formConfig.fkInfo){
+          this.aliemg.table = this.formConfig.fkInfo.fkTableName
+          if(this.formConfig.fkInfo.value){
+            this.aliemg.fixedData.condition[this.formConfig.fkInfo.dkColumnName] = this.formConfig.fkInfo.value
+          }
+          this.listIndexfouFn()
+        }
+      },
+      handleChange(file, fileList) {
+        this.fileList = fileList.slice(-3);
+      },
+      getToken() {
+        return getToken()
+      },
+      reseImage(file, fileList) {
+        let urls = ""
+        if (file.response) {
+          urls = file.response.url
+        } else {
+          urls = file.url
+        }
+        for (let i = this.config.length - 1; i >= 0; i--) {
+          if (this.config[i].url == urls) {
+            this.config.splice(i, 1);
+          }
+        }
+      },
+      reseImage1(file, fileList) {
+        let urls = ""
+        if (file.response) {
+          urls = file.response.url
+        } else {
+          urls = file.url
+        }
+        for (let i = this.config.length - 1; i >= 0; i--) {
+          if (this.config[i].url == urls) {
+            this.config.splice(i, 1);
+          }
+        }
+      },
+      handlePictureCardPreview(file) {
+        console.log(file)
+        this.dialogImageUrl = file.url;
+        this.dialogVisible = true;
+      },
+      handleDownload(file) {
+        console.log(file);
+      },
+      handleQuery() {
+        this.$emit('btns')
+      },
+      handleCheckedCitiesChange(value) {
+        console.log(this.config)
+      }
+    }
+  }
+</script>
+
+<style>
+</style>

+ 1 - 1
ruoyi-ui/src/layout/components/Sidebar/Item.vue

@@ -22,7 +22,7 @@ export default {
 
     if (title) {
       vnodes.push(<span slot='title' style="color: #343434">{(title)}</span>)
-    }
+    }  
     return vnodes
   }
 }

+ 2 - 0
ruoyi-ui/src/main.js

@@ -32,6 +32,7 @@ import Pagination from "@/components/Pagination";
 import RightToolbar from "@/components/RightToolbar"
 import DynamicForm from "@/components/DynamicForm"
 import DynamicForms from "@/components/DynamicForms"
+import DynamicFormsteo from "@/components/DynamicFormsteo"
 import MemoranDum from "@/components/MemoranDum"
 import 'burgeon-ui/dist/styles/burgeon-ui.css';
 import 'burgeon-ui/dist/styles/bjIconfonts/iconfont.css';
@@ -71,6 +72,7 @@ Vue.component('Pagination', Pagination)
 Vue.component('RightToolbar', RightToolbar)
 Vue.component('DynamicForm', DynamicForm)
 Vue.component('DynamicForms', DynamicForms)
+Vue.component('DynamicFormsteo', DynamicFormsteo)
 Vue.component('MemoranDum', MemoranDum)
 
 Vue.use(permission)

+ 44 - 16
ruoyi-ui/src/utils/currencyFn.js

@@ -1,31 +1,59 @@
-export function getDyn(col,arr,comp) {
+export function getDyn(col, arr, comp) {
   let str = comp
   let is = true
-  for(let item of arr){
-    for(let itemChild of item.hrChildren){
-      for(let colItem of col){
-        if(itemChild.columnValue){
+  let type = ''
+
+  for (let item of arr) {
+    for (let itemChild of item.hrChildren) {
+      for (let colItem of col) {
+        if (itemChild.columnValue) {
           is = false
         }
-        if(colItem == itemChild.columnName){
-          str = str.replace(itemChild.columnName,itemChild.columnValue)
+        if (colItem == itemChild.columnName) {
+          if (itemChild.htmlType == "input") {
+            type = 1
+            str = str.replace(itemChild.columnName, itemChild.columnValue)
+          } else if (itemChild.htmlType == "datetime") {
+            type = 2
+            if(getTime(itemChild.columnValue)){
+              str = str.replace(itemChild.columnName, getTime(itemChild.columnValue))
+            }else{
+              is=true
+            }
+          }
         }
       }
     }
   }
-  if(is){
+  if (is) {
     return
   }
-  console.log(str,888)
-  return str
+  if (type == 2) {
+    return setTime(evals(str))
+  }
+  return evals(str)
+}
+
+function evals(code) {
+  let fun = new Function(`return ${code}`)();
+  return fun
+}
+// 时间戳转成天
+function setTime(val) {
+  return Number(val) / (1000 * 3600 * 24)
+}
+// 转化成时间戳
+function getTime(val) {
+  var date = new Date(val);
+  return date.getTime()
 }
-export function setDyn(col,arr,comp) {
+export function setDyn(col, arr, comp) {
   let str = comp
-  for(let item of arr){
-    for(let itemChild of item.hrChildren){
-      for(let colItem of col){
-        if(colItem == itemChild.columnName){
-          str = str.replace(itemChild.columnName,itemChild.columnValue)
+  for (let item of arr) {
+    for (let itemChild of item.hrChildren) {
+      for (let colItem of col) {
+        if (colItem == itemChild.columnName) {
+          str = str.replace(itemChild.columnName, itemChild.columnValue)
         }
       }
     }

+ 40 - 26
ruoyi-ui/src/views/system/editing/index.vue

@@ -32,17 +32,17 @@
     <!-- 内容 -->
     <div class="eniting_nav">
       <el-collapse v-model="activeNames" @change="handleChange" >
-       <el-form v-show="num == 0" :rules="queryData.rules" :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
-          <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index"
-            class="eitde">
-            <el-row>
-              <el-col :span="24" :key="index">
-                <dynamic-forms @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs="changeFn" :formConfig="items"
-                  v-for="(items,indexs) in item.hrChildren" :key='indexs' />
-              </el-col>
-            </el-row>
-          </el-collapse-item>
-        </el-form>
+       <div class="table_forem">
+         <el-form v-show="num == 0" :rules="queryData.rules" :model="queryParams" ref="queryForm" :inline="true" :label-width="this.queryData.table_column == 6 ? '70px' :'120px'">
+            <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index"
+              class="eitde">
+              <el-row>
+                  <dynamic-formsteo @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs="changeFn" :formConfig="items"
+                    v-for="(items,indexs) in item.hrChildren" :key='indexs' />
+              </el-row>
+            </el-collapse-item>
+          </el-form>
+       </div>
         <div v-show= "num !==0" style="background-color: #fff; padding-bottom: 40px; padding-left: 23px; padding-right: 23px; padding-top: 23px;" >
           <el-table v-loading="loading" :data="postList.rows" @selection-change="handleSelectionChange">
             <el-table-column type="selection" width="55" style="color: red;" align="center" />
@@ -157,7 +157,7 @@
          taheus:'',
          taheusid:0,
          tabName:'',
-         queryParamstwoi:{}
+         queryParamstwoi:{},
       };
     },
     mounted() {
@@ -176,6 +176,7 @@
       this.taheus = this.$route.query.tables
       this.taheusid = this.$route.query.id
       this.deledlid.idList.push(this.$route.query.id)
+
       // tab
       this.edingelsietab()
       this.init()
@@ -265,11 +266,18 @@
                  this.imgShoew = route.cssClass
                  if(route.cssClass == 2 || route.cssClass == 4 ){
                    route.hrChildren.filter(routers =>{
-
+                    if(this.queryData.table_column == undefined){
+                      this.queryData.table_column = null
+                    }
+                    routers.tableColumnuy = this.queryData.table_column
                      routers.isonliy = true
                    })
                  }else{
                    route.hrChildren.filter(routers =>{
+                     if(this.queryData.table_column == undefined){
+                       this.queryData.table_column = null
+                     }
+                     routers.tableColumnuy = this.queryData.table_column
                      routers.isonliy = false
                    })
                  }
@@ -513,7 +521,7 @@
         this.multiple = !selection.length
       },
       routerFn(id, tables) {
-        if (this.queryDatatwo.viewType == 'crud') {
+        // if (this.queryDatatwo.viewType == 'crud') {
           this.$router.push({
             path: 'table',
             query: {
@@ -521,15 +529,6 @@
               tables,
             },
           })
-        } else if (this.queryDatatwo.viewType == 'itemTab') {
-          this.$router.push({
-            path: '../form/index.vue',
-            query: {
-              id,
-              tables,
-            },
-          })
-        }
       },
      // 搜索
      handleQueryiu(){
@@ -561,6 +560,20 @@
 </script>
 
 <style lang="scss">
+  .table_forem{
+    .el-form--inline .el-form-item{
+      width: 100% !important;
+    }
+    .el-select{
+      width: 100%;
+    }
+    .el-date-editor.el-input{
+      width: 100% !important;
+    }
+    .el-form-item--medium .el-form-item__content{
+      width: 70%;
+    }
+  }
   .eniting_header {
     position: relative;
     .el-divider--horizontal {
@@ -645,7 +658,8 @@
       background-color: #fff;
       border-radius: 6px;
       padding: 23px;
-      margin-bottom: 20px;
+      padding-top: 0;
+      margin-bottom: 10px;
     }
   }
 </style>
@@ -668,8 +682,8 @@
     .eniting_header {
       background-color: #fff;
       border-radius: 6px;
-      padding: 23px;
-      margin-bottom: 20px;
+      padding: 13px;
+      margin-bottom: 10px;
 
       .p {
         font-size: 15px;

+ 113 - 36
ruoyi-ui/src/views/system/form/index.vue

@@ -13,17 +13,17 @@
       </div>
     </div>
     <!-- 内容 -->
-    <div class="table_nav">
+    <div class="table_nav " >
       <el-collapse v-model="activeNames">
-         <el-form :model="queryParams" :rules="queryData.rules" ref="queryForm" :inline="true" label-width="120px">
-        <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index" class="eitde">
-            <el-row :gutter="0">
-              <el-col :span="24"  :key="index">
-                  <dynamic-forms @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren" :key='indexs' />
-              </el-col>
-            </el-row>
-        </el-collapse-item>
-        </el-form>
+         <div class="table_forem">
+           <el-form :model="queryParams"  :rules="queryData.rules" ref="queryForm" :inline="true" :label-width="this.queryData.table_column == 6 ? '70px' :'120px'">
+           <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index" class="eitde">
+               <el-row :gutter="0">
+                     <dynamic-formsteo @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren" :key='indexs' />
+               </el-row>
+           </el-collapse-item>
+           </el-form>
+         </div>
         <!-- 列表 -->
         <el-collapse-item :title="title" name="lised"  class="eitde" v-if="tabShoes">
           <div class="ppl">
@@ -36,7 +36,7 @@
           <el-divider></el-divider>
           <div style="display: flex; align-items: center; margin-bottom: 20px;" class="hiueo">
             <el-form style="display: flex; align-items:center;" :model="queryParamstwoi" ref="queryForm" :inline="true" >
-              <dynamic-forms :ref="item.columnName" :config="queryParamstwoi" @inputs="changeFn" :formConfig="item" v-for="(item,index) in queryDatatao.queryList"
+              <DynamicForms :ref="item.columnName" :config="queryParamstwoi" @inputs="changeFn" :formConfig="item" v-for="(item,index) in queryDatatao.queryList"
                 :key='index' />
               <el-form-item>
                 <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryiu">搜索</el-button>
@@ -166,7 +166,10 @@
         single: true,
         multiple: true,
         tabName:'',
-        oieufr:''
+        oieufr:'',
+        cielsshow:false,
+        foremTtae:'',
+        foremTtaid:-1
       };
     },
     filters:{
@@ -203,9 +206,22 @@
       this.deledlid.table = this.$route.query.tables
       this.deledlid.idList.push(this.$route.query.id)
       this.queryParamslist.table = this.$route.query.tables
+      if(this.$route.query.id == -1){
+        console.log(this.$route.query.id)
+        this.foremTtae = this.$route.query.tables+'_id'
+        this.queryParamslist.fixedData.condition[this.foremTtae] = this.$route.query.id
+      }else{
+        let begad = this.$route.query.tables+'_id'
+        this.queryParamslist.fixedData.condition[begad] = this.$route.query.id
+        this.foremTtae = this.$route.query.tables+'_id'
+      }
       // this.objParamstue.fixedData.id = this.$route.query.id
       this.init()
-      this.edingelsietab()
+      this.edingelsietab()
+
+    },
+    destroyed(){
+
     },
     methods: {
       imgBtn(url) {
@@ -253,11 +269,18 @@
           // 图片的显示隐藏
           if(this.queryData.showData.length !==0){
            this.queryData.showData.filter(route => {
+                route.hrChildren.filter(routerst =>{
+                  if(this.queryData.table_column == undefined){
+                    this.queryData.table_column = null
+                  }
+                  routerst.tableColumnuy = this.queryData.table_column
+                })
                if(route.cssClass !== null){
                  this.imgShoew = route.cssClass
                  if(route.cssClass == 2 || route.cssClass == 4){
                    route.hrChildren.filter(routers =>{
                      routers.isonliy = true
+
                    })
                  }else{
                    route.hrChildren.filter(routers =>{
@@ -369,7 +392,12 @@
       handleQuery(index) {
         if(index == 'fh'){
           this.$store.dispatch("tagsView/delView", this.$route);
-          this.$router.go(-1)
+          if(this.cielsshow == true){
+            this.$router.go(-2)
+          }else{
+            this.$router.go(-1)
+          }
+
           return
         }else if(index == 'sx'){
           this.xidugje = 'sx'
@@ -415,6 +443,9 @@
            this.forme.fixedData = this.queryParams
            this.submitForm()
          }else if(index == 'A'){
+          //  let query = Object.assign({'id':'630'},{} )
+          // this.$router.push({ query})
+          //  this.reload()
            this.forme.fixedData = this.queryParams
            this.submitForm()
          }
@@ -438,7 +469,9 @@
            this.queryParamstwoi[items] = undefined
          }
        }
+       this.queryParamstwoi[this.foremTtae] = this.oieufr
        this.queryParamslist.fixedData.condition = this.queryParamstwoi
+       // this.queryParamslist.fixedData.condition[this.foremTtae] = this.oieufr
        this.foremliseju()
 
       },
@@ -448,9 +481,31 @@
          if (valid) {
            addbjectSave(this.forme).then(response => {
              this.msgSuccess("保存成功");
-             this.open = false;
-             this.$store.dispatch("tagsView/delView", this.$route);
-             this.$router.go(-1)
+             if(this.formy.id == -1){
+               if(response.code == 200){
+                 console.log(200)
+                 this.cielsshow = true;
+                 this.formy.id = response.data
+               }else{
+                 this.cielsshow = false;
+               }
+               let query = Object.assign({'id':response.data,'tables': this.forme.table},{} )
+               this.$router.push({ query})
+               this.queryParamslist.fixedData.condition[this.foremTtae] = response.data
+               this.oieufr = response.data
+               this.objParams.fixedData.id = response.data
+               this.init()
+               this.foremliseju()
+               // this.reload()
+             }else{
+               this.$store.dispatch("tagsView/delView", this.$route);
+               this.$router.go(-1)
+             }
+
+             // this.$store.dispatch("tagsView/delView", this.$route);
+
+             // this.$store.dispatch("tagsView/delView", this.$route);
+             // this.$router.go(-1)
              // this.getList();
            });
          }
@@ -543,37 +598,44 @@
          //删除
          this.handleDeletetwo(this.deledlid)
        }  else if(index == '新增'){
-           this.routerFn(-1, this.tabName,this.oieufr)
+         if(this.cielsshow == true){
+           this.routerFn(-1, this.tabName,this.oieufr,this.forme.table)
+         }else{
+           this.msgInfo('基本信息暂未保存')
+         }
        }else if(index == '修改'){
          if (this.single) {
            this.msgInfo('请勾选一条信息')
            return
          }
          const id = this.ids.join(',')
-         this.routerFn(id, this.tabName,this.oieufr)
+         this.routerFn(id, this.tabName,this.oieufr,this.forme.table)
        }
      },
-     routerFn(id, tables,tabfe) {
-       if (this.queryDatatao.viewType == 'crud') {
+     routerFn(id, tables,tabfe, tabik) {
+       // if (this.queryDatatao.viewType == 'crud') {
          this.$router.push({
            path: 'table',
            query: {
              id,
              tables,
-             tabfe
+             tabfe,
+             tabik
            },
          })
-       } else if (this.queryDatatao.viewType == 'headTab') {
-         this.$router.push({
-           path: 'editing',
-           query: {
-             id,
-             tables,
-             tabfe
-           },
-         })
-       }
+       // } else if (this.queryDatatao.viewType == 'headTab') {
+       //   this.$router.push({
+       //     path: 'editing',
+       //     query: {
+       //       id,
+       //       tables,
+       //       tabfe,
+       //       tabik
+       //     },
+       //   })
+       // }
      },
+
 
     },
   };
@@ -621,10 +683,25 @@
       .eitde {
         background-color: #fff;
         border-radius: 6px;
-        padding: 23px;
-        margin-bottom: 20px;
+        padding: 23px;
+        padding-top: 0;
+        margin-bottom: 10px;
       }
     }
+  }
+  .table_forem{
+    .el-form--inline .el-form-item{
+      width: 100% !important;
+    }
+    .el-select{
+      width: 100%;
+    }
+    .el-date-editor.el-input{
+      width: 100% !important;
+    }
+    .el-form-item--medium .el-form-item__content{
+      width: 70%;
+    }
   }
 </style>
 
@@ -642,8 +719,8 @@
     .tabForm_header {
       background-color: #fff;
       border-radius: 6px;
-      padding: 23px;
-      margin-bottom: 20px;
+      padding: 13px;
+      margin-bottom: 10px;
       position: relative;
     }
 

+ 45 - 19
ruoyi-ui/src/views/system/table/index.vue

@@ -13,18 +13,14 @@
       </div>
     </div>
     <!-- 内容 -->
-    <div class="table_nav headertable_nav" >
-      <el-collapse v-model="activeNames" @change="handleChange">
-        <el-form :model="queryParams" :rules="queryData.rules" ref="queryForm" :inline="true" label-width="120px">
+    <div class="table_nav headertable_nav table_forem" >
+      <el-collapse v-model="activeNames" @change="handleChange">
+        <el-form :model="queryParams" :rules="queryData.rules" ref="queryForm" :inline="true" :label-width="this.queryData.table_column == 6 ? '70px' :'110px'" >
           <el-collapse-item :title="item.columnComment" :name="index" v-for="(item,index) in queryData.showData" :key="index">
-            <el-row>
-              <el-col :span="24" :key="index">
                 <dynamic-forms @iChange="iChange" :queryData="queryData" @modelFn="modelFn" :ref="items.columnName" :config="queryParams" @inputs="changeFn" :formConfig="items" v-for="(items,indexs) in item.hrChildren"
                   :key='indexs' />
-              </el-col>
-            </el-row>
-          </el-collapse-item>
-        </el-form>
+          </el-collapse-item>
+        </el-form>
       </el-collapse>
     </div>
   </div>
@@ -90,7 +86,8 @@
         tijeq:0,
         imgShoew:0,
         tablees:-1,
-        juegkae:''
+        juegkae:'',
+        tabdiese:''
       };
     },
     mounted() {
@@ -107,8 +104,14 @@
       this.deledlid.idList.push(this.$route.query.id)
       if(this.$route.query.tabfe){
        this.tablees = this.$route.query.tabfe
-       this.juegkae = this.$route.query.tables + '_id'
-      }
+       this.juegkae = this.$route.query.tabik + '_id'
+       this.tabdiese = this.$route.query.tabik
+       console.log(this.juegkae)
+      }else{
+        this.tablees = undefined
+        this.juegkae = undefined
+        this.tabdiese = this.$route.query.tabik
+      }
       this.init()
       // this.tablsie()
     },
@@ -117,7 +120,7 @@
         for(let item of this.queryData.showData){
           for(let itemChild of item.hrChildren){
             if(itemChild.columnName == name){
-              itemChild.columnValue = val
+              itemChild.columnValue = (val?val:null)
             }
           }
         }
@@ -178,7 +181,9 @@
           this.formeanti.commitData.push(this.formy)
           this.antiSubmission()
         } else if (index == '保存') {
-          // 修改
+          // 修改
+
+
           this.forme.fixedData = this.queryParams
           this.forme.fixedData[this.juegkae] =  this.tablees
           this.submitForm()
@@ -262,6 +267,12 @@
          // 图片的显示隐藏
          if(this.queryData.showData.length !==0){
           this.queryData.showData.filter(route => {
+             route.hrChildren.filter(routerst =>{
+               if(this.queryData.table_column == undefined){
+                 this.queryData.table_column = null
+               }
+               routerst.tableColumnuy = 34
+             })
             if(route.cssClass !== null){
               this.imgShoew = route.cssClass
               if(route.cssClass == 2 || route.cssClass == 4){
@@ -360,6 +371,20 @@
       margin-top: 16px;
     }
   }
+  .table_forem{
+    .el-form--inline .el-form-item{
+      width: 100% !important;
+    }
+    .el-select{
+      width: 100%;
+    }
+    .el-date-editor.el-input{
+      width: 100% !important;
+    }
+    .el-form-item--medium .el-form-item__content{
+      width: 70%;
+    }
+  }
   .headertable_nav{
     .el-collapse-item__wrap{
       border-bottom: 0;
@@ -396,8 +421,8 @@
      .table_header{
         background-color: #fff;
         border-radius: 6px;
-        padding: 23px;
-        margin-bottom: 20px;
+        padding: 13px;
+        margin-bottom: 10px;
       p{
          font-size: 15px;
          font-weight: bold;
@@ -451,8 +476,8 @@
     .table_header {
       background-color: #fff;
       border-radius: 6px;
-      padding: 23px;
-      margin-bottom: 20px;
+      padding: 13px;
+      margin-bottom: 10px;
 
       p {
         font-size: 15px;
@@ -476,7 +501,8 @@
     .headertable_nav {
       background-color: #fff;
       border-radius: 6px;
-      padding: 23px;
+      padding: 23px;
+      padding-top: 0;
     }
   }
 

+ 9 - 1
ruoyi-ui/src/views/tool/gen/basicInfoForm.vue

@@ -23,6 +23,11 @@
             <el-radio label="N">否</el-radio>
           </el-radio-group>
         </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item  label="列数" prop="tableColumn">
+          <el-input type="number" :max="4" :min="1" v-model="info.tableColumn" placeholder="请输入列数" />
+        </el-form-item>
       </el-col>
       <el-col :span="12">
         <el-form-item  label="菜单权限" prop="menuRole">
@@ -130,7 +135,10 @@ export default {
         ],
         viewType: [
           { required: true, message: "页面模板不能为空", trigger: "blur" }
-        ],
+        ],
+        tableColumn: [
+          { required: true, message: "列数不能为空", trigger: "blur" }
+        ]
       }
     };
   }

+ 11 - 0
ruoyi-ui/src/views/tool/gen/editTable.vue

@@ -898,6 +898,17 @@
           return
         }
         const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
+        const tabnum = Object.assign({}, basicForm.model)
+        console.log(tabnum.tableColumn,234)
+        if(tabnum.tableColumn >4 ){
+           this.msgError('列数最大只能输入4')
+           return
+        }
+        if( tabnum.tableColumn <1){
+          this.msgError('最小只能输入1')
+          return
+        }
+
 
         // const genForm = this.$refs.genInfo.$refs.genInfoForm;
         Promise.all([basicForm].map(this.getFormPromise)).then(res => {

+ 19 - 0
ruoyi-ui/src/views/tool/gen/index.vue

@@ -124,6 +124,11 @@
               </el-radio-group>
             </el-form-item>
           </el-col>
+          <el-col :span="12">
+            <el-form-item label="列数" prop="tableColumn">
+              <el-input type="number" :max="4" :min="1" v-model="form.tableColumn" placeholder="请输入列数" maxlength="50" />
+            </el-form-item>
+          </el-col>
           <el-col :span="12">
             <el-form-item label="菜单权限" prop="menuRole">
               <el-input v-model="form.menuRole" placeholder="请输入菜单权限" />
@@ -164,6 +169,7 @@
               <el-input v-model="form.extendedAttributes" type="textarea" placeholder="请输入内容"></el-input>
             </el-form-item>
           </el-col>
+
           <el-col :span="12">
             <el-form-item label="备注" prop="remark">
               <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
@@ -262,6 +268,11 @@
             required: true,
             message: "菜单权限不能为空",
             trigger: "blur"
+          }],
+          tableColumn: [{
+            required: true,
+            message: "列数不能为空",
+            trigger: "blur"
           }]
         }
       };
@@ -396,6 +407,14 @@
       },
       /** 提交按钮 */
       submitForm: function() {
+        if( this.form.tableColumn > 4 ){
+          this.msgSuccess("列数不能大于4");
+          return false
+        }else if(this.form.tableColumn <1){
+          this.msgSuccess("列数不能小于1");
+          return false
+        }
+
         this.$refs["form"].validate(valid => {
           if (valid) {
             if (this.form.id != undefined) {