浏览代码

Merge remote-tracking branch 'origin/master'

Administrator 4 年之前
父节点
当前提交
91795d4fd8

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

@@ -6,10 +6,10 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
 
 /**
  * @author shiqian
@@ -176,4 +176,46 @@ public class ObjectUtils {
     public static boolean ltZero(Long aLong) {
         return null != aLong && aLong < 0;
     }
+
+
+    /**
+     * 功能描述: 根据规则过滤
+     *
+     * @param input     原数据
+     * @param predicate FunctionalInterface
+     * @return java.util.List<T>
+     */
+    public static <T> List<T> filter(List<T> input, Predicate<T> predicate) {
+        return requireNonNull(input, "list is null")
+                .stream().filter(predicate).collect(Collectors.toList());
+    }
+
+    /**
+     * 功能描述: 根据规则获取
+     *
+     * @param input    原数据
+     * @param function FunctionalInterface
+     * @return java.util.List<T>
+     */
+    public static <T, R> List<R> map(List<T> input, Function<T, R> function) {
+        return requireNonNull(input, "list is null")
+                .stream().map(function).collect(Collectors.toList());
+    }
+
+
+    /**
+     * 功能描述: 根据规则获取单个
+     *
+     * @param input    原数据
+     * @param function FunctionalInterface
+     * @return java.util.List<T>
+     */
+    public static <T, R> R mapFirst(List<T> input, Function<T, R> function) {
+        requireNonNull(input, "list is null");
+        List<R> rList = input.stream().map(function).collect(Collectors.toList());
+        requireNonNull(rList, "rList is null");
+        Optional<R> optionalR = rList.stream().findFirst();
+        return optionalR.orElse(null);
+    }
+
 }

+ 22 - 0
boman-modules/boman-gen/src/main/java/com/boman/gen/domain/GenTableColumn.java

@@ -86,6 +86,12 @@ public class GenTableColumn extends BaseEntity
     /** 如果是下拉框,单选,复选框 对应的子节点的值 */
     private List<SysDictData> sysDictData;
 
+    /** 哪些字段属于这些hr的 */
+    private Long hrParentId;
+
+    /** hr的孩子们 */
+    private List<GenTableColumn> hrChildren;
+
     public String getForeignKey() {
         return foreignKey;
     }
@@ -404,4 +410,20 @@ public class GenTableColumn extends BaseEntity
     public void setSysDictData(List<SysDictData> sysDictData) {
         this.sysDictData = sysDictData;
     }
+
+    public Long getHrParentId() {
+        return hrParentId;
+    }
+
+    public void setHrParentId(Long hrParentId) {
+        this.hrParentId = hrParentId;
+    }
+
+    public List<GenTableColumn> getHrChildren() {
+        return hrChildren;
+    }
+
+    public void setHrChildren(List<GenTableColumn> hrChildren) {
+        this.hrChildren = hrChildren;
+    }
 }

+ 2 - 1
boman-modules/boman-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml

@@ -28,10 +28,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime"     column="create_time"    />
         <result property="updateBy"       column="update_by"      />
         <result property="updateTime"     column="update_time"    />
+        <result property="hrParentId"     column="hr_parent_id"    />
     </resultMap>
 	
 	<sql id="selectGenTableColumnVo">
-        select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, foreign_key, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
+        select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, foreign_key, dict_type, sort, create_by, create_time, update_by, update_time, hr_parent_id from gen_table_column
     </sql>
 	
     <select id="selectGenTableColumnListByTableId" parameterType="GenTableColumn" resultMap="GenTableColumnResult">

+ 3 - 0
boman-web-core/src/main/java/com/boman/web/core/constant/FormDataConstant.java

@@ -137,6 +137,9 @@ public class FormDataConstant {
     /**  需要查字典表的框框 */
     public static final List<String> NEED_QUERY_DICT_LIST = Lists.newArrayList(RADIO, CHECKBOX, SELECT);
 
+    /**  hr 日志、基础信息..... */
+    public static final String HR = "hr";
+
 
 
 }

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/controller/TableController.java

@@ -24,7 +24,7 @@ public class TableController {
     private TableServiceCmdService tableServiceCmdService;
 
     /**
-     * 功能描述: 反提交接口, 更改的字段类型和字段值都是一致的
+     * 功能描述: 根据表名获取表信息、表字段和表字段对应的字典值
      *                {
      *                    "table": "sys_config",
      *                }

+ 14 - 0
boman-web-core/src/main/java/com/boman/web/core/domain/BaseTableSaveDTO.java

@@ -74,6 +74,12 @@ public class BaseTableSaveDTO implements Serializable {
     @JSONField(name = "status")
     private String status;
 
+    /**
+     * 跳转新增或者编辑页面显示的类型带不带折叠,如果isUi=true, 带折叠
+     */
+    @JSONField(name = "isUi")
+    private Boolean isUi;
+
 
     public int getLimit() {
         return pageNo == 0 ? 0 : (pageNo - 1) * pageSize;
@@ -174,6 +180,14 @@ public class BaseTableSaveDTO implements Serializable {
     public void setPageSize(Integer pageSize) {
         this.pageSize = pageSize;
     }
+
+    public Boolean getIsUi() {
+        return isUi;
+    }
+
+    public void setIsUi(Boolean ui) {
+        isUi = ui;
+    }
 }
 
 

+ 43 - 9
boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java

@@ -28,6 +28,7 @@ import com.boman.web.core.service.update.IBaseUpdateService;
 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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -37,12 +38,11 @@ import javax.annotation.Resource;
 import java.sql.Timestamp;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
-import static com.boman.common.core.utils.obj.ObjectUtils.ifNullSetEmpty;
-import static com.boman.common.core.utils.obj.ObjectUtils.requireNonNull;
-import static com.boman.web.core.constant.FormDataConstant.CONDITION;
-import static com.boman.web.core.constant.FormDataConstant.SHOW_DATA;
+import static com.boman.common.core.utils.obj.ObjectUtils.*;
+import static com.boman.web.core.constant.FormDataConstant.*;
 
 /**
  * @author shiqian
@@ -522,7 +522,7 @@ public class TableServiceCmdService {
     }
 
     /**
-     * 功能描述: 反提交接口, 更改的字段类型和字段值都是一致的
+     * 功能描述: 根据表名获取表信息、表字段和表字段对应的字典值
      *                {
      *                    "table": "sys_config",
      *                }
@@ -533,18 +533,52 @@ public class TableServiceCmdService {
      */
     public AjaxResult getByTableName(BaseTableSaveDTO condition) {
         requireNonNull(condition.getTable(), "表名为空");
+        requireNonNull(condition.getIsUi(), "根据表名获取表字段,未传 isUi 这个字段");
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
-        List<GenTableColumn> columns = genTable.getColumns();
+        List<GenTableColumn> allColumns = genTable.getColumns();
+        // 普通的展示,不带折叠的
+        if (BooleanUtils.isFalse(condition.getIsUi())) {
+            packDictDataToColumns(allColumns, ObjectUtils::isNotEmpty);
+            return AjaxResult.success(genTable);
+        } else {
+            // 带折叠的展示
+            return getByTableName(allColumns);
+        }
+    }
+
+    public AjaxResult getByTableName( List<GenTableColumn> allColumns) {
+        List<GenTableColumn> parentColumns = filter(allColumns, col -> HR.equalsIgnoreCase(col.getHtmlType()));
+
+        // 把孩子放入父亲的怀抱
+        for (GenTableColumn hrColumn : parentColumns) {
+            List<GenTableColumn> children = Lists.newArrayListWithCapacity(16);
+            for (GenTableColumn column : allColumns) {
+                if (hrColumn.getColumnId().equals(column.getHrParentId())) {
+                    children.add(column);
+                }
+            }
+            hrColumn.setHrChildren(children);
+        }
+
+        // 把孩子对应的字典值放进去
+        for (GenTableColumn hrColumn : parentColumns) {
+            packDictDataToColumns(hrColumn.getHrChildren(), ObjectUtils::isNotEmpty);
+        }
+
+        return AjaxResult.success(parentColumns);
+    }
+
+    public void packDictDataToColumns(List<GenTableColumn> columns, Predicate<String> predicate) {
+        requireNonNull(columns, "columns 为空");
         for (GenTableColumn column : columns) {
             String dictType = column.getDictType();
-            if (ObjectUtils.isNotEmpty(dictType)) {
+            if (predicate.test(dictType)) {
                 List<SysDictData> sysDictData1 = remoteDictDataService.listByType(dictType);
                 column.setSysDictData(sysDictData1);
             }
         }
-
-        return AjaxResult.success(genTable);
     }
 
+
 }
 

+ 92 - 121
ruoyi-ui/src/components/DynamicForms/index.vue

@@ -1,70 +1,57 @@
 <template>
-    <div>
-      <el-form ref="form" :model="form" :rules="rules" label-width="160px" class="from_index">
-        <el-row>
-          <el-col :span="24"  v-for="(item,index) in formConfig.columns" :key="index">
-            <el-form-item :label="item.columnComment" style="display: inline-block;" :prop="item.columnName" v-if="item.isEdit == 1">
-              <!-- 输入框 -->
-              <el-input v-if="item.htmlType == 'input'" v-model="config[item.columnName]" :placeholder="'请输入'+item.columnComment"
-                clearable @keyup.enter.native="submitForm" />
-              <!-- 多行输入框 -->
-              <el-input v-if="item.htmlType == 'textarea'" type="textarea" v-model="config[item.columnName]" :placeholder="'请输入'+item.columnComment"
-                clearable @keyup.enter.native="submitForm" />
-              <!-- 下拉框 -->
-              <el-select v-model="config[item.columnName]" v-if="item.htmlType == 'select'" filterable :placeholder="'请输入'+item.columnComment">
-                <el-option v-for="itemChild in item.sysDictData" :key="itemChild.dictValue" :label="itemChild.dictLabel" :value="itemChild.dictValue" >
-                </el-option>
-              </el-select>
-              <!-- 复选框 -->
-              <el-checkbox-group v-model="config[item.columnName]" v-if="item.htmlType == 'checkbox'">
-                <el-checkbox  v-for="itemChild in item.sysDictData" :label="itemChild.dictValue" :key="itemChild.dictLabel" >
-                  {{itemChild.dictLabel}}
-                </el-checkbox>
-              </el-checkbox-group>
-              <!-- 单选框 -->
-              <el-radio-group v-model="config[item.columnName]" v-if="item.htmlType == 'radio'">
-                <el-radio v-for="itemChild in item.sysDictData" :key="itemChild.dictValue" :label="itemChild.dictLabel" :value="itemChild.dictValue" ></el-radio>
-              </el-radio-group>
-              <!-- 时间控件 -->
-              <el-date-picker v-model="config[item.columnName]" v-if="item.htmlType == 'datetime'" type="date" :placeholder="'请输入'+item.columnComment">
-              </el-date-picker>
-              <!-- 上传图片 -->
-              <el-upload v-if="item.htmlType == 'imageUpload'" :headers="{Authorization: 'Bearer ' + getToken()}" :action="process + '/boman-file/upload'" list-type="picture-card"
-                :on-preview="handlePictureCardPreview" :on-remove="handleRemove">
-                <i class="el-icon-plus"></i>
-              </el-upload>
-              <el-dialog :visible.sync="dialogVisible" v-if="item.htmlType == 'imageUpload'">
-                <img width="100%" :src="dialogImageUrl" alt="">
-              </el-dialog>
-              <!-- 上传文件 -->
-              <el-upload
-                class="upload-demo"
-                :headers="{Authorization: 'Bearer ' + getToken()}"
-                v-if="item.htmlType == 'fileUpload'"
-                :action="process + '/boman-file/upload'"
-                :on-change="handleChange"
-                :file-list="fileList">
-                <el-button size="small" type="primary">点击上传</el-button>
-                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
-              </el-upload>
-              <!-- 富文本 -->
-              <editor v-model="config[item.columnName]" v-if="item.htmlType == 'editor'"  :min-height="192"/>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-
-    </div>
-
+    <el-form-item :label="formConfig.columnComment" style="display: inline-block;" :prop="formConfig.columnName">
+      <!-- 输入框 -->
+      <el-input v-if="formConfig.htmlType == 'input'" v-model="config[formConfig.columnName]" :placeholder="'请输入'+formConfig.columnComment"
+        clearable @keyup.enter.native="handleQuery" />
+      <!-- 多行输入框 -->
+      <el-input v-if="formConfig.htmlType == 'textarea'" type="textarea" v-model="config[formConfig.columnName]" :placeholder="'请输入'+formConfig.columnComment"
+        clearable @keyup.enter.native="handleQuery" />
+      <!-- 下拉框 -->
+      <el-select v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'select'" filterable :placeholder="'请输入'+formConfig.columnComment">
+        <el-option v-for="itemChild in formConfig.sysDictData" :key="itemChild.dictValue" :label="itemChild.dictLabel" :value="itemChild.dictValue">
+        </el-option>
+      </el-select>
+      <!-- 复选框 -->
+      <el-checkbox-group 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 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  v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'datetime'" type="date" :placeholder="'请输入'+formConfig.columnComment">
+      </el-date-picker>
+      <!-- 上传图片 -->
+      <el-upload 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 :visible.sync="dialogVisible" v-if="formConfig.htmlType == 'imageUpload'">
+        <img width="100%" :src="dialogImageUrl" alt="">
+      </el-dialog>
+      <!-- 上传文件 -->
+      <el-upload
+        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 v-model="config[formConfig.columnName]" v-if="formConfig.htmlType == 'editor'" :min-height="192"/>
+    </el-form-item>
 </template>
 
 <script>
   const defaultSettings = require('@/settings.js')
-  import { addConfigindex } from "@/api/system/config";
   import Editor from '@/components/Editor';
   import { getToken } from "@/utils/auth";
   export default {
@@ -77,32 +64,38 @@
         dialogVisible: false,
         disabled: false,
         config: {},
-        form:{},
-        // 表单校验
-        rules: {
-        },
-        open:false
       }
     },
     components: {
       Editor
     },
     props: {
-      formConfig: {},
-      nummer:0
+      formConfig: {
+        type: Object,
+        required: true,
+        'default': {
+          sysDictData: []
+        }
+      },
     },
     created() {
+      this.config = {}
       this.init()
     },
     mounted() {
     },
     methods: {
+      upImageFn(res, file){
+        this.config.push({
+          name: res.data.name,
+          url: res.data.url,
+        });
+      },
       init() {
-        // if(this.formConfig.htmlType == 'checkbox'){
-        //   this.config = []
-        // }
+        if(this.formConfig.htmlType == 'checkbox' || this.formConfig.htmlType == 'imageUpload' || this.formConfig.htmlType == 'fileUpload'){
+          this.config = []
+        }
         console.log(this.config,99888)
-        console.log(this.nummer)
       },
       handleChange(file, fileList) {
         this.fileList = fileList.slice(-3);
@@ -110,8 +103,31 @@
       getToken() {
         return getToken()
       },
-      handleRemove(file, fileList) {
-        console.log(file, fileList);
+      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) {
         this.dialogImageUrl = file.url;
@@ -123,34 +139,6 @@
       handleQuery() {
         this.$emit('btns')
       },
-      submitForm(value){
-        console.log(1243)
-        console.log(this.config,value)
-        this.form.fixedData = this.config
-        this.form.table = 'sys_schedule'
-        this.form.objId = -1
-        this.$refs["form"].validate(valid => {
-          if (valid) {
-            // if (this.form.id != undefined) {
-            //   updateNotice(this.form).then(response => {
-            //     this.msgSuccess("修改成功");
-            //     this.open = false;
-            //     this.getList();
-            //   });
-            // } else {
-              addConfigindex(this.form).then(response => {
-                this.msgSuccess("新增成功");
-                // this.open = false;
-                this.cancel();
-              });
-            // }
-          }
-        });
-        // this.$emit('submitForm',this.config)
-      },
-      cancel(){
-       this.$emit('cancel',this.config)
-      },
       handleCheckedCitiesChange(value){
         console.log(this.config)
       }
@@ -158,22 +146,5 @@
   }
 </script>
 
-<style lang="scss">
-  .from_index{
-    .el-form-item{
-      width: 93%;
-    }
-    .el-input{
-      width: 100%;
-    }
-    .el-select{
-      width: 100%;
-    }
-  }
-</style>
-<style scoped lang="scss">
-  .dialog-footer{
-    display: flex;
-    justify-content: flex-end;
-  }
+<style>
 </style>

+ 179 - 0
ruoyi-ui/src/components/MemoranDum/index.vue

@@ -0,0 +1,179 @@
+<template>
+    <div>
+      <el-form ref="form" :model="form" :rules="rules" label-width="160px" class="from_index">
+        <el-row>
+          <el-col :span="24"  v-for="(item,index) in formConfig.columns" :key="index">
+            <el-form-item :label="item.columnComment" style="display: inline-block;" :prop="item.columnName" v-if="item.isEdit == 1">
+              <!-- 输入框 -->
+              <el-input v-if="item.htmlType == 'input'" v-model="config[item.columnName]" :placeholder="'请输入'+item.columnComment"
+                clearable @keyup.enter.native="submitForm" />
+              <!-- 多行输入框 -->
+              <el-input v-if="item.htmlType == 'textarea'" type="textarea" v-model="config[item.columnName]" :placeholder="'请输入'+item.columnComment"
+                clearable @keyup.enter.native="submitForm" @change="submitForm"/>
+              <!-- 下拉框 -->
+              <el-select v-model="config[item.columnName]" v-if="item.htmlType == 'select'" filterable :placeholder="'请输入'+item.columnComment">
+                <el-option v-for="itemChild in item.sysDictData" :key="itemChild.dictValue" :label="itemChild.dictLabel" :value="itemChild.dictValue" @change="submitForm">
+                </el-option>
+              </el-select>
+              <!-- 复选框 -->
+              <el-checkbox-group v-model="config" v-if="item.htmlType == 'checkbox'">
+                <el-checkbox @change="submitForm" v-for="itemChild in item.sysDictData" :label="itemChild.dictValue" :key="itemChild.dictLabel" >
+                  {{itemChild.dictLabel}}
+                </el-checkbox>
+              </el-checkbox-group>
+              <!-- 单选框 -->
+              <el-radio-group v-model="config[item.columnName]" v-if="item.htmlType == 'radio'">
+                <el-radio v-for="itemChild in item.sysDictData" :key="itemChild.dictValue" :label="itemChild.dictLabel" :value="itemChild.dictValue" @change="submitForm"></el-radio>
+              </el-radio-group>
+              <!-- 时间控件 -->
+              <el-date-picker v-model="config[item.columnName]" v-if="item.htmlType == 'datetime'" type="date" :placeholder="'请输入'+item.columnComment" @change="submitForm">
+              </el-date-picker>
+              <!-- 上传图片 -->
+              <el-upload v-if="item.htmlType == 'imageUpload'" :headers="{Authorization: 'Bearer ' + getToken()}" :action="process + '/boman-file/upload'" list-type="picture-card"
+                :on-preview="handlePictureCardPreview" :on-remove="handleRemove">
+                <i class="el-icon-plus"></i>
+              </el-upload>
+              <el-dialog :visible.sync="dialogVisible" v-if="item.htmlType == 'imageUpload'">
+                <img width="100%" :src="dialogImageUrl" alt="">
+              </el-dialog>
+              <!-- 上传文件 -->
+              <el-upload
+                class="upload-demo"
+                :headers="{Authorization: 'Bearer ' + getToken()}"
+                v-if="item.htmlType == 'fileUpload'"
+                :action="process + '/boman-file/upload'"
+                :on-change="handleChange"
+                :file-list="fileList">
+                <el-button size="small" type="primary">点击上传</el-button>
+                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+              </el-upload>
+              <!-- 富文本 -->
+              <editor v-model="config[item.columnName]" v-if="item.htmlType == 'editor'"  :min-height="192"/>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+
+    </div>
+
+</template>
+
+<script>
+  const defaultSettings = require('@/settings.js')
+  import { addConfigindex } from "@/api/system/config";
+  import Editor from '@/components/Editor';
+  import { getToken } from "@/utils/auth";
+  export default {
+    data() {
+      return {
+        fileList: [],
+        defaultSettings,
+        dialogImageUrl: '',
+        process: process.env.VUE_APP_BASE_API,
+        dialogVisible: false,
+        disabled: false,
+        config: {},
+        form:{},
+        // 表单校验
+        rules: {
+        },
+        open:false
+      }
+    },
+    components: {
+      Editor
+    },
+    props: {
+      formConfig: {},
+      nummer:0
+    },
+    created() {
+      this.init()
+    },
+    mounted() {
+    },
+    methods: {
+      init() {
+        // if(this.formConfig.htmlType == 'checkbox'){
+        //   this.config = []
+        // }
+        console.log(this.config,99888)
+        console.log(this.nummer)
+      },
+      handleChange(file, fileList) {
+        this.fileList = fileList.slice(-3);
+      },
+      getToken() {
+        return getToken()
+      },
+      handleRemove(file, fileList) {
+        console.log(file, fileList);
+      },
+      handlePictureCardPreview(file) {
+        this.dialogImageUrl = file.url;
+        this.dialogVisible = true;
+      },
+      handleDownload(file) {
+        console.log(file);
+      },
+      handleQuery() {
+        this.$emit('btns')
+      },
+      submitForm(value){
+        console.log(1243)
+        console.log(this.config,value)
+        this.form.fixedData = this.config
+        this.form.table = 'sys_memorandum'
+        this.form.objId = -1
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            // if (this.form.id != undefined) {
+            //   updateNotice(this.form).then(response => {
+            //     this.msgSuccess("修改成功");
+            //     this.open = false;
+            //     this.getList();
+            //   });
+            // } else {
+              addConfigindex(this.form).then(response => {
+                this.msgSuccess("新增成功");
+                // this.open = false;
+                this.cancel();
+              });
+            // }
+          }
+        });
+        // this.$emit('submitForm',this.config)
+      },
+      cancel(){
+       this.$emit('cancel',this.config)
+      },
+      handleCheckedCitiesChange(value){
+        console.log(this.config)
+      }
+    }
+  }
+</script>
+
+<style lang="scss">
+  .from_index{
+    .el-form-item{
+      width: 93%;
+    }
+    .el-input{
+      width: 100%;
+    }
+    .el-select{
+      width: 100%;
+    }
+  }
+</style>
+<style scoped lang="scss">
+  .dialog-footer{
+    display: flex;
+    justify-content: flex-end;
+  }
+</style>

+ 181 - 36
ruoyi-ui/src/views/index.vue

@@ -238,12 +238,24 @@
     <!-- <el-divider /> -->
   <!-- 添加或修改公告对话框 -->
   <el-dialog :title="title" :visible.sync="open" width="980px" append-to-body>
+           <el-form ref="form" :model="form" :rules="rules" label-width="160px" class="from_index">
+             <el-row>
+               <el-col :span="24" >
+                <dynamic-forms   :ref="item.columnName" :config="form.fixedData" @inputs = "changeFn" :formConfig="item" v-for="(item,index) in queryData.columns" :key='index' />
+               </el-col>
+             </el-row>
+           </el-form>
+           <div slot="footer" class="dialog-footer">
+             <el-button type="primary" @click="handleQuery">确 定</el-button>
+             <el-button @click="cancel">取 消</el-button>
+           </div>
             <!-- if(){ -->
               <!-- 日历 -->
-              <dynamic-forms v-if="nummer == 0" :config="form" @inputs = "changeFn" :formConfig="queryData" :open="open" @submitForm="submitForm($event)" @cancel="cancel($event)" :nummer = "nummer" />
+
+              <!-- <dynamic-forms v-if="nummer == 0" :config="form" @inputs = "changeFn" :formConfig="queryData" :open="open" @submitForm="submitForm($event)" @cancel="cancel($event)" :nummer = "nummer" /> -->
             <!-- }else if(){ -->
               <!-- 备忘录 -->
-              <memoran-dum v-if="nummer == 1" :config="form" @inputs = "changeFn" :formConfig="queryDatatwo" :open="open"  @cancel="cancel($event)" :nummer = "nummer" />
+              <!-- <memoran-dum v-if="nummer == 1" :config="form" @inputs = "changeFn" :formConfig="queryDatatwo" :open="open"  @cancel="cancel($event)" :nummer = "nummer" /> -->
             <!-- } -->
 
   </el-dialog>
@@ -251,7 +263,7 @@
 </template>
 
 <script>
-import { listIndex, listIndextwo, listIndextherr, listIndexfou, listIndextanl, getConfig, delConfig, addConfig, updateConfig, clearCache } from "@/api/system/config";
+import { listIndex, listIndextwo, listIndextherr, listIndexfou, listIndextanl, getConfig, delConfig, addConfig, addConfigindex, updateConfig, clearCache } from "@/api/system/config";
 import Editor from '@/components/Editor';
 export default {
   name: "index",
@@ -374,7 +386,15 @@ export default {
       editorList:[],
       queryData: {},
       queryDatatwo:{},
-      nummer:0   //0 是日历  1 是备忘录
+      nummer:0   ,//0 是日历  1 是备忘录
+      forme:{
+        table:'',
+        objId:-1,
+        fixedData:{}
+      },
+      rjtu:[],
+      truew:[],
+      fales:[]
     };
   },
 
@@ -395,17 +415,26 @@ export default {
      brightDate () {
        // let ary = []
        var that =  this
-       console.log(that.calendarData,887)
+       // console.log(that.calendarData,887)
        for (var i = 0 ; i < that.calendarData.length; i++) {
          // that.ary.push(that.calendarData[i].startDate)
          // that.ary.push(that.calendarData[i].begin_time.slice(0,10))
          // that.ary.push(that.calendarData[i].all_date.split(','))
+         that.calendarData[i].love="yu"
          if(that.calendarData[i].all_date !== undefined){
+           // that.rjtu.concat(that.calendarData[i].all_date.join(','))
            that.ary.push(that.calendarData[i].all_date.join(','))
-           console.log(that.calendarData[i].all_date.join(','),754)
+           // that.calendarData[i].all_date.fi
+           that.calendarData[i].all_date.filter(route => {
+             // console.log(route,9875)
+             that.ary.push(route)
+           })
+           // that.ary = that.calendarData[i].all_date
+           // console.log(that.calendarData[i].all_date.join(','),754)
          }
          // console.log(that.calendarData[i].all_date,754)
        }
+       // console.log( that.rjtu,7545)
        console.log(that.ary)
        return that.ary
      }
@@ -415,20 +444,109 @@ export default {
       // Tooltip 文字提示
         content (date) {
           console.log(date,37645)
+          let data = date
           let content = ''
+          let conert = ''
+          let conertre = ''
+          let nujue= 0
+          let nujeug = []
+          let setre = []
+          this.truew = []
+          console.log(this.calendarData)
           // console.log(data,37645)
           for (var i = 0 ; i < this.calendarData.length; i++) {
-          // this.calendarData[i].begin_time = this.calendarData[i].begin_time.slice(0,10)
-            console.log(this.calendarData[i].begin_time,123)
             // if (date === this.calendarData[i].begin_time) {
+              // console.log(this.calendarData[i])
               if(this.calendarData[i].all_date !== undefined){
-                content = this.calendarData[i].remind_type
-              }
+                console.log(this.calendarData[i].all_date.includes(data))
+                if(this.calendarData[i].all_date.includes(data) == true){
+                 console.log(this.calendarData[i].all_date.includes(data))
+                 this.truew.push(this.calendarData[i].all_date.includes(data))
+                 console.log(this.truew)
+                 if(this.truew.length >1){
+                    content  = content + ',' + this.calendarData[i].schedule_content
+                    // nujeug = content.split(',')
+                    // setre = [...new set(nujeug)]
+                    // conert = setre.join(',')
+                 }else{
+                   content  = this.calendarData[i].schedule_content
+                 }
+
+                  // content  = this.calendarData[i].schedule_content
+                  // return content
+                }
+                console.log(content)
+                //  if(this.calendarData[i].all_date.includes(data) == false){
+                //    console.log(this.calendarData[i].all_date.includes(data))
+                //   // this.rjtu.push(this.calendarData[i].schedule_content)
+                //   // content  = this.calendarData[i].schedule_content
+
+                // }
+                //
+                }
+                // return content
+              // }
+
+              // if(this.calendarData[i].all_date !== undefined){
+              //   for(var j= 0 ; j<this.calendarData[i].all_date.length; j++){
+              //     // if(data == this.calendarData[i].all_date[j]){
+              //     //   // console.log(124)
+              //     //   // console.log(this.calendarData[i])
+              //     //   // content  = this.calendarData[i].schedule_content
+              //     //   // console.log(content)
+              //     // }else if(data !== this.calendarData[i].all_date[j]){
+              //     //   content  = this.calendarData[i].schedule_content
+              //     //   console.log(876543)
+              //     //   console.log(content)
+              //     // }
+              //   }
+              //   // this.calendarData[i].all_date.filter(route => {
+              //   //   if(data == route){
+              //   //     console.log(124)
+              //   //     console.log(route.schedule_content)
+              //   //     content  = route.schedule_content
+              //   //     console.log(content)
+              //   //   }else{
+              //   //     console.log(876543)
+              //   //   }
+              //   // })
+              // }
+
+                // console.log(route,9875)
+                // that.ary.push(route)
+
+              // if(this.calendarData[i].schedule_content !== undefined){
+              //   nujue = nujue +1
+              //   if(this.calendarData[i].schedule_content !== this.calendarData[nujue].schedule_content){
+              //     // this.rjtu.push(this.calendarData[i].schedule_content)
+              //   }
+              //   // content = this.rjtu.join(',')
+
+              // }
 
             // }
           }
+          // this.calendarData.filter(route =>{
+          //   if(route.schedule_content !== undefined){
+          //     // if(date == route.all_date)
+
+          //     console.log(route.schedule_content,23456)
+          //     content  = route.schedule_content
+          //   }
+
+          // })
+          // if(content.length >1){
+          //   for(var k = 0 ; k < content.length; k++){
+          //     console.log(content[i])
+          //     // if(conertre.indexOf(conert[i])==-1){
+          //     // conertre+=conert[i];
+          //     }
+          // }
+
           console.log(content)
-          return content
+          // console.log(this.rjtu,12345)
+          // content = this.rjtu.join(',')
+         return content
         },
     //数据  第一部分列表
     getList() {
@@ -543,6 +661,7 @@ export default {
    //日历新增弹框数据
    getLisalendaraddd() {
      this.loading = true;
+     this.queryData = []
      listIndextanl(this.calendaradd).then(response => {
          if(response.data !== undefined){
            this.queryData = response.data
@@ -568,10 +687,11 @@ export default {
    //备忘录新增弹框数据
    getLisalendaradddmer() {
      this.loading = true;
+     this.queryData = []
      listIndextanl(this.calendaraddmer).then(response => {
          if(response.data !== undefined){
-           this.queryDatatwo = response.data
-           this.queryDatatwo.columns.filter(route => {
+           this.queryData = response.data
+           this.queryData.columns.filter(route => {
              // console.log(route)
              if(route.htmlType == "input" || route.htmlType == 'textarea'){
                this.inputList.push(route)
@@ -637,8 +757,8 @@ export default {
     },
     // 表单重置
     reset() {
-      this.form = {
-      };
+      this.form ={
+      },
       this.resetForm("form");
     },
     // 取消按钮
@@ -651,36 +771,61 @@ export default {
       this.nummer = 0
       console.log(this.open)
       this.reset();
+      this.form ={
+      }
       this.getLisalendaraddd()
       this.open = true;
       this.title = "添加日历";
     },
-    /** 提交按钮 */
-    submitForm: function(data) {
-      console.log(this.form,data)
-      // this.$refs["form"].validate(valid => {
-      //   if (valid) {
-      //     if (this.form.id != undefined) {
-      //       updateNotice(this.form).then(response => {
-      //         this.msgSuccess("修改成功");
-      //         this.open = false;
-      //         this.getList();
-      //       });
-      //     } else {
-      //       addNotice(this.form).then(response => {
-      //         this.msgSuccess("新增成功");
-      //         this.open = false;
-      //         this.getList();
-      //       });
-      //     }
-      //   }
-      // });
+    /** 提交按钮操作 */
+    handleQuery() {
+      for(let item of this.queryData.columns){
+        if(item.htmlType == 'checkbox' || item.htmlType == 'imageUpload' || item.htmlType == 'fileUpload'){
+          this.form[item.columnName] = this.$refs[item.columnName][0].config
+        } else{
+          this.form[item.columnName] = this.$refs[item.columnName][0].config[item.columnName]
+        }
+      }
+      // this.forme = this.form
+      if(this.nummer == 0){
+        this.forme.table = 'sys_schedule'
+        this.forme.objId = -1
+        this.forme.fixedData = this.form
+        if(this.forme.fixedData.remind_type !== undefined){
+          this.forme.fixedData.remind_type = this.forme.fixedData.remind_type.join(',');
+        }
+        //日历
+        console.log(this.forme.fixedData,this.forme)
+        addConfigindex(this.forme).then(response => {
+          this.msgSuccess("新增成功");
+          // this.open = false;
+          this.getLisalendar()
+          this.cancel();
+        });
+      }else if(this.nummer == 1){
+        // this.form.table = 'sys_memorandum'
+        this.forme.table = 'sys_memorandum'
+        this.forme.objId = -1
+        this.forme.fixedData = this.form
+        if(this.forme.fixedData.remind_type !== undefined){
+          this.forme.fixedData.remind_type = this.forme.fixedData.remind_type.join(',');
+        }
+        //备忘录
+       addConfigindex(this.forme).then(response => {
+         this.msgSuccess("新增成功");
+         // this.open = false;
+         this.getLismemorandum()
+         this.cancel();
+       });
+      }
+      console.log(this.form.fixedData,22311)
+      // this.getList();
     },
     // 弹框
     changeFn(obj) {
       console.log(obj)
       for(let key in obj){
-        this.form[key] = obj[key]
+        this.form.fixedData[key] = obj[key]
       }
     },
     // 新增备忘录