Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

Administrator 4 lat temu
rodzic
commit
31363ab45f

+ 8 - 11
boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/obj/ObjectUtils.java

@@ -27,6 +27,14 @@ public class ObjectUtils {
         return input;
     }
 
+    public static  <T> boolean isEmpty(Collection<T> input){
+        return null == input || input.size() == 0;
+    }
+
+    public static  <T> boolean isNotEmpty(Collection<T> input){
+        return !isEmpty(input);
+    }
+
     public static long[] requireNonNull(long[] input, String... errorMsg){
         if (ArrayUtils.isEmpty(input)) {
             throw new IllegalArgumentException(errorMsg[0]);
@@ -219,17 +227,6 @@ public class ObjectUtils {
     }
 
 
-    public static <V> List<V> map(Map<String, V> input, Function<String, V> function) {
-        requireNonNull(input, "map is null");
-        List<V> result = new ArrayList<>(input.size());
-        for (Map.Entry<String, V> entry : input.entrySet()) {
-            result.add(entry.getValue());
-        }
-
-        return result;
-    }
-
-
     /**
      * 功能描述: 根据规则获取单个
      *

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

@@ -133,6 +133,8 @@ public class TableServiceCmdService {
         String pkName = context.getPkName();
         JSONObject commitData = context.getCommitData();
 
+        checkColumn(commitData, context.getColumns());
+
         // 新增
         if (ActionType.INSERT.equals(context.getActionType())) {
             Long maxId = IdUtils.getMaxId(dto.getTable(), pkName);
@@ -224,6 +226,7 @@ public class TableServiceCmdService {
         // 拿到每个字段对应的查询类型,=、 like、 >、 <
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, dto.getTable());
         JSONObject fixedData = dto.getFixedData();
+        checkColumn(fixedData, genTable.getColumns());
         fixedData = ifNullSetEmpty(fixedData);
 
         // 查询条件
@@ -231,12 +234,15 @@ public class TableServiceCmdService {
         List<GenTableColumn> columns = genTable.getColumns();
         // 封装好以后的查询条件
         JSONObject packCondition = ifNullSetEmpty(packColCondition(columns, condition));
+        JSONArray jsonArray = fixedData.getJSONArray(SHOW_DATA);
+        checkColumn(jsonArray, genTable.getColumns());
         // 需要返回到前台的列, 需要判断是否是列表展示, 4为判断列表是否可见
-        JSONArray showData = filterData(columns, 4, fixedData.getJSONArray(SHOW_DATA), MaskConstant.LIST_VISIBLE::equals);
+        JSONArray showData = filterData(columns, 4, jsonArray, MaskConstant.LIST_VISIBLE::equals);
 
         JSONObject rows = new JSONObject();
         int total = selectService.countByCondition(genTable.getTableName(), condition, packCondition);
         rows.put(FormDataConstant.PAGE_TOTAL, total);
+        rows.put(TABLE_HEAD_LIST, getTableHeadList(genTable));
         if (total <= 0) {
             rows.put(FormDataConstant.PAGE_ROWS, null);
             return AjaxResult.success(rows);
@@ -256,7 +262,6 @@ public class TableServiceCmdService {
         result = isCustomized(dto.getTable(),result,"trigger_retrieve");
 
         rows.put(PAGE_ROWS, result);
-        rows.put(TABLE_HEAD_LIST, getTableHeadList(genTable));
         return AjaxResult.success(rows);
     }
 
@@ -559,15 +564,10 @@ public class TableServiceCmdService {
     }
 
     /**
-     * 功能描述: 获取表单按钮
+     * 功能描述:  单独获取按钮
      * 注意: 都是从redis中拿的,如果数据库和redis不一致,则需刷新一下redis
-     * 刷新的入口为 {@link MyController#loadTable(com.boman.gen.domain.GenTable)}
      *
-     *                    eg:{
-     *                          "table": "sys_config"
-     *                        }
-     *
-     * @param condition condition
+     * @param tableName tableName
      * @return com.boman.common.core.web.domain.AjaxResult
      */
     public String getButton(String tableName) {

+ 8 - 1
boman-web-core/src/main/java/com/boman/web/core/service/select/BaseSelectServiceImpl.java

@@ -2,7 +2,11 @@ package com.boman.web.core.service.select;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.boman.common.redis.RedisKey;
+import com.boman.gen.domain.GenTable;
 import com.boman.web.core.mapper.StandardlyMapper;
+import com.boman.web.core.service.TableServiceCmdService;
+import com.boman.web.core.utils.ColumnUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,6 +27,8 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
 
     @Autowired
     private StandardlyMapper mapper;
+    @Autowired
+    private TableServiceCmdService cmdService;
 
 
     /**
@@ -58,7 +64,8 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
         requireNonNull(tableName, "表名为空");
 
         // 判断condition中列是否都在此table中
-
+        GenTable gent = cmdService.getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
+        ColumnUtils.checkColumn(param, gent.getColumns());
         return mapper.getByMap(tableName, param);
     }
 

+ 39 - 7
boman-web-core/src/main/java/com/boman/web/core/utils/ColumnUtils.java

@@ -3,9 +3,11 @@ package com.boman.web.core.utils;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.boman.common.core.utils.SecurityUtils;
+import com.boman.common.core.utils.obj.ObjectUtils;
 import com.boman.gen.domain.GenTableColumn;
 import com.boman.web.core.constant.FormDataConstant;
 import com.google.common.collect.Lists;
+import org.apache.commons.collections4.MapUtils;
 
 import java.sql.Timestamp;
 import java.util.List;
@@ -134,15 +136,45 @@ public class ColumnUtils {
         return variables.replaceAll("\\$", "");
     }
 
+    /**
+     * 功能描述: 前台传过来的列是否都在表中
+     *
+     * @param target 前台传过来的列
+     * @param origin 此表对应的所有的列
+     */
+    public static void checkColumn(Map<String, Object> target, List<GenTableColumn> origin) {
+        if (MapUtils.isEmpty(target) || ObjectUtils.isEmpty(origin)) {
+            return;
+        }
 
-    public <T> void checkColumn(Map<String, T> form, List<GenTableColumn> allColumns){
-        requireNonNull(form, "jsonObject is empty");
-        requireNonNull(allColumns, "allColumns is empty");
-
-
-        List<String> all = map(allColumns, GenTableColumn::getColumnName);
-//        map(form, );
+        String tableName = origin.get(0).getTableName();
+        List<String> all = map(origin, GenTableColumn::getColumnName);
+        for (Map.Entry<String, Object> entry : target.entrySet()) {
+            String columnName = entry.getKey();
+            if (!all.contains(columnName.toLowerCase()) || !all.contains(columnName.toUpperCase())) {
+                throw new IllegalArgumentException("此表 [" + tableName + "]中没有 [" + columnName + "] 字段");
+            }
+        }
+    }
 
+    /**
+     * 功能描述: 前台传过来的列是否都在表中, List中的泛型必须为String
+     *
+     * @param target 前台传过来的列
+     * @param origin 此表对应的所有的列
+     */
+    public static void checkColumn(List<Object> target, List<GenTableColumn> origin) {
+        if (ObjectUtils.isEmpty(target) || ObjectUtils.isEmpty(origin)) {
+            return;
+        }
 
+        String tableName = origin.get(0).getTableName();
+        List<String> all = map(origin, GenTableColumn::getColumnName);
+        for (Object obj : target) {
+            String columnName = (String) obj;
+            if (!all.contains(columnName.toLowerCase()) || !all.contains(columnName.toUpperCase())) {
+                throw new IllegalArgumentException("此表 [" + tableName + "]中没有 [" + columnName + "] 字段");
+            }
+        }
     }
 }

+ 9 - 0
ruoyi-ui/src/App.vue

@@ -9,3 +9,12 @@ export default  {
   name:  'App',
 }
 </script>
+<style>
+	.el-table--medium th{
+    height: 35px !important;
+		padding: 2px 0 !important;
+	}
+  .el-table--medium td{
+  	padding: 2px 0 !important;
+  }
+</style>

+ 1 - 1
ruoyi-ui/src/api/system/config.js

@@ -65,7 +65,7 @@ export function listIndex(data) {
 }
 export function listIndexfou(data) {
   return request({
-    url: '/boman-web-core/p/cs/getTableQuery',
+    url: '/boman-web-core/p/cs/queryList',
     method: 'post',
     data: data
   })

+ 14 - 5
ruoyi-ui/src/api/system/table.js

@@ -3,7 +3,7 @@ import request from '@/utils/request'
 // 获取表单数据
 export function getQueryList(data) {
   return request({
-    url: '/boman-web-core/p/cs/table/getByTableName',
+    url: '/boman-web-core/p/cs/queryList',
     method: 'POST',
     data
   })
@@ -16,6 +16,14 @@ export function getTableQuery(data) {
     data
   })
 }
+// 获取表单查询字段、按钮、表头
+export function tableQuery(data) {
+  return request({
+    url: '/boman-web-core/p/cs/getTableQuery',
+    method: 'POST',
+    data
+  })
+}
 
 // 保存
 export function addbjectSave(data) {
@@ -41,10 +49,11 @@ export function getByTableName(data) {
     data
   })
 }
-export function delMenu(id) {
+export function delMenu(data) {
   return request({
-    url: 'boman-web-core/p/cs/objectDelete',
-    method: 'delete'
+    url: '/boman-web-core/p/cs/objectDelete',
+    method: 'POST',
+    data
   })
 }
 
@@ -71,4 +80,4 @@ export function tableSubimt(data) {
      method: 'POST',
      data
    })
- }
+ }

+ 0 - 1
ruoyi-ui/src/components/SignNumArr/index.vue

@@ -38,7 +38,6 @@
         // if (meta.activeMenu) {
         //     return meta.activeMenu;
         // }
-        console.log(this.tabIndex, 887)
         return this.tabIndex;
       },
     },

+ 46 - 6
ruoyi-ui/src/views/index.vue

@@ -34,7 +34,7 @@
                <div class="index_heade index_headeNav">
                  <img src="../assets/images/icon_more.png" alt="" class="index_headerImg">
                  <p class="index_headetab">
-                   <span :class="[num == index ? ' spanto' : '']" v-for="(item,index) in editableTabs" :key="index" @click="tabSbu(index)">{{item.title}} <p class="tab_i">3</p></span></span>
+                   <span :class="[numlist == index ? ' spanto' : '']" v-for="(item,index) in attendance" :key="index" @click="tabList(index)">{{item}} <p class="tab_i">3</p></span></span>
                  </p>
                  <!-- <el-tabs v-model="activeName" @tab-click="handleClick" > -->
                      <!-- <el-tab-pane  name="first">
@@ -204,7 +204,10 @@
                          </p>
                         <div class="index_memoranduMailnav">
                            <div class="tab_tol">
-                          	<tr class="tr_one">
+                             <el-table stripe v-loading="loading" :data="postList.rows" @selection-change="handleSelectionChange">
+                               <el-table-column :label="item.columnComment" align="center" :prop="item.columnName" v-for="(item,index) in postList.tableHeadList" :key="index" />
+                             </el-table>
+                          	<!-- <tr class="tr_one">
                           		<th style=" text-align: center;" v-for="(item,index) in tableDataalid" :key="index">{{item.columnComment}}</th>
                           	</tr>
                           		<tr v-for="(item,index) in getLisaillie" :key="index" :class=" [index%2  ==0 ? 'two_tr two_trtwo':'two_tr']" @click="chakn(item)">
@@ -213,7 +216,7 @@
                           			<td style=" text-align: center;" >{{ item.phone }}</td>
                           			<td style=" text-align: center;" >{{ item.is_del == 1? '删除' :  '未删除'}}</td>
                           			<td style="text-align: center; " >{{ item.remark}}</td>
-                          		</tr>
+                          		</tr> -->
                            </div>
                           <div class="index_haderPagin index_haderPaginfoiu">
                             <el-pagination
@@ -237,7 +240,7 @@
     </el-row>
     <!-- <el-divider /> -->
   <!-- 添加或修改公告对话框 -->
-  <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="980px" append-to-body>
+  <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" >
@@ -286,6 +289,7 @@ export default {
        title: "",
        value: new Date(),
        editableTabs: [],
+       attendance:['待我审批','已办理','我的流程','驳回审批'],
        editableTabsteo:[],
        configList:[],
        queryParams:{
@@ -338,6 +342,7 @@ export default {
         pageSize:6,
       },
       num:0,
+      numlist:0,
       numprofile:0,
       dictType:'sys_notice_type',
       // 公司概况
@@ -348,7 +353,10 @@ export default {
       getmemorandum:[],
       //通讯录参数
       aliemg:{
-        table:'sys_memorandum'
+        table:'sys_contacts',
+        orderBy:'create_time desc',
+        pageNo:1,
+        pageSize:6,
       },
       tableDataalid:[],
       getLisaillie:[],
@@ -396,11 +404,14 @@ export default {
       },
       rjtu:[],
       truew:[],
-      fales:[]
+      fales:[],
+      postList:{},
+      arr:'2,2,3,3,4,4'
     };
   },
 
   created() {
+    this.unique(this.arr)
     this.getLisalendar()//日历
     this.getList()
     this.getListtab()
@@ -468,6 +479,12 @@ export default {
                  if(this.truew.length >1){
                     content  = content + ',' + this.calendarData[i].schedule_content
                     // nujeug = content.split(',')
+                    // for(var i = 0 ; i < nujeug.length; i++){
+                    //   if (setre.indexOf(nujeug[i]) === -1) {
+                    //      setre.push(nujeug[i])
+                    //      }
+                    // }
+                    // content = setre.join(',')
                     // setre = [...new set(nujeug)]
                     // conert = setre.join(',')
                  }else{
@@ -653,6 +670,7 @@ export default {
      listIndexfou(this.aliemg).then(response => {
          if(response.data !== undefined){
            this.tableDataalid = response.data.tableHeadList;
+           this.postList = response.data
            console.log(this.tableDataalid,67)
            this.totalprofile = response.data.total;
          }
@@ -751,6 +769,10 @@ export default {
      this.queryParams.condition.notice_type = index
      this.getList()
     },
+    // 第二部分tab点击numlist
+    tabList(index){
+      this.numlist = index
+    },
     // 第三部分tab点击
     tabSbuprofile(index){
       this.numprofile = index - 1
@@ -836,6 +858,24 @@ export default {
      this.open = true;
      this.title = "添加备忘录";
      this.getLisalendaradddmer()
+    },
+    handleSelectionChange() {
+
+    },
+    // 字符串去重
+    unique(arr) {
+      let arfe = []
+      let serfgt = []
+      arfe = arr.split(',')
+      for(var i = 0 ; i < arfe.length; i++){
+         if (serfgt.indexOf(arfe[i]) === -1) {
+            serfgt.push(arfe[i])
+            }
+      }
+      console.log(serfgt.join(','))
+     // const res = new Map();
+     // console.log(arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1)))
+     // return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));
     }
   },
 };

+ 0 - 8
ruoyi-ui/src/views/system/form/index.vue

@@ -26,14 +26,6 @@
               <span :class="[index == numtab ? 'span' : '']">{{item.tableComment}}</span>
             </p>
           </div>
-        <!--  <el-form style="margin-top: 30px;" :model="queryParams" ref="queryForm" :inline="true" label-width="120px">
-            <el-form-item label="岗位编码" prop="postCode" v-for="(item,index) in 2" :key="index">
-              <el-input v-model="queryParams.postCode" placeholder="请输入岗位编码" clearable size="small" @keyup.enter.native="handleQuery" />
-            </el-form-item>
-            <el-form-item>
-              <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-            </el-form-item>
-          </el-form> -->
           <el-divider></el-divider>
           <el-table stripe v-loading="loading" :data="postList.rows" @selection-change="handleSelectionChange">
             <el-table-column :label="item.columnComment" align="center" :prop="item.columnName" v-for="(item,index) in postList.tableHeadList" :key="index" />

+ 134 - 66
ruoyi-ui/src/views/system/surface/index.vue

@@ -4,10 +4,12 @@
       <!-- <p>单表</p>
       <el-divider></el-divider> -->
       <div class="table_headerBtun" v-if="queryData.buttonList">
-        <el-button type="primary" plain @click="headerBtn(item)" v-for="(item,index) in queryData.buttonList.split('')" :key="index">{{item | btnConversion}}</el-button>
+        <el-button type="primary" plain @click="headerBtn(item)" v-for="(item,index) in queryData.buttonList.split('')"
+          :key="index">{{item | btnConversion}}</el-button>
       </div>
-      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" >
-        <dynamic-form :ref="item.columnName" :config="queryParams" @inputs = "changeFn" :formConfig="item" v-for="(item,index) in queryData.queryList" :key='index' />
+      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
+        <dynamic-form :ref="item.columnName" :config="queryParams" @inputs="changeFn" :formConfig="item" v-for="(item,index) in queryData.queryList"
+          :key='index' />
         <el-form-item>
           <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
           <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -18,15 +20,11 @@
     <div class="table_nav">
       <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
-        <el-table-column :label="item.columnComment" align="center" :prop="item.columnName" v-for="(item,index) in queryData.tableHeadList" :key="index"/>
+        <el-table-column :label="item.columnComment" align="center" :prop="item.columnName" v-for="(item,index) in tabData"
+          :key="index" />
       </el-table>
-      <pagination
-        v-show="total>0"
-        :total="total"
-        :page.sync="queryParams.pageNo"
-        :limit.sync="queryParams.pageSize"
-        @pagination="getList"
-      />
+      <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
+        @pagination="getList" />
     </div>
   </div>
 
@@ -34,16 +32,24 @@
 
 <script>
   import {
-    getTableQuery,
+    tableQuery,
     getQueryList,
     addbjectSave,
     getByTableName,
+    delMenu,
     getObject
   } from '@/api/system/table.js'
+  import {
+    mapGetters,
+    mapState
+  } from "vuex";
   export default {
     name: "index",
     data() {
       return {
+        tabData: [],
+        multiple: true,
+        single: true,
         open: false,
         // 遮罩层
         loading: true,
@@ -53,75 +59,126 @@
         // 显示搜索条件
         showSearch: true,
         activeNames: ['1'],
-        title: '单表1',
+        title: '',
         queryData: {},
         form: {
           table: 'obj_test',
           objId: -1,
-          fixedData: {}
+          fixedData: {
+            condition: {
+
+            }
+          }
         },
         // 查询参数
         queryParams: {
           table: 'obj_test',
           pageNo: 1,
-          isUi:false,
+          isUi: false,
           pageSize: 10,
           orderBy: 'create_time desc',
-          fixedData: {}
+          fixedData: {
+            condition: {
+
+            }
+          }
         }
       };
     },
-    filters:{
+    filters: {
       btnConversion(val) {
-        switch(val){
+        switch (val) {
           case 'A':
-          return '新增';
+            return '新增';
           case 'M':
-          return '修改';
+            return '修改';
           case 'D':
-          return '删除';
+            return '删除';
           case 'Q':
-          return '查询';
+            return '查询';
           case 'S':
-          return '提交';
+            return '提交';
           case 'U':
-          return '反提交';
+            return '反提交';
           case 'I':
-          return '导入';
+            return '导入';
           case 'E':
-          return '导出';
+            return '导出';
         }
       }
     },
+    computed: {
+      ...mapGetters(["sidebarRouters", "sidebar", "tabIndex"]),
+    },
     mounted() {
+      const route = this.$route;
+      const {
+        meta,
+        path
+      } = route;
+      console.log(route,this.tabIndex,99112)
+      // if (meta.activeMenu) {
+      //   this.$store.dispatch('TabFn', meta.activeMenu)
+      // }
+      // this.$store.dispatch('TabFn', path)
       this.init();
       this.getList();
     },
     methods: {
       headerBtn(item) {
-        switch(item) {
-          case 'A': {
-            this.$router.push('/system/table')
-            return
-          }
-          case 'M': {
-            return
-          }
-          case 'D': {
-            return
-          }
-          case 'Q': {
-            return
-          }
-          case 'S': {
-            return
-          }
-          case 'U': {
-            return
-          }
-          case 'E': {
-            return
-          }
+        switch (item) {
+          case 'A':
+            {
+              this.$router.push({
+                path: '/business/table'
+              })
+              return
+            }
+          case 'M':
+            {
+              if (this.single) {
+                this.msgInfo('请勾选一条信息')
+                return
+              }
+              const id = this.ids
+              this.$router.push({
+                path: '/business/table'
+              })
+              return
+            }
+          case 'D':
+            {
+              if (this.multiple) {
+                this.msgInfo('请勾选一条信息')
+                return
+              }
+              delMenu({
+                table: 'obj_test',
+                idList: this.ids
+              }).then(res => {
+                this.msgSuccess('删除成功')
+                this.getList()
+              })
+              return
+            }
+          case 'Q':
+            {
+              this.handleQuery()
+              return
+            }
+          case 'S':
+            {
+              return
+            }
+          case 'U':
+            {
+              return
+            }
+          case 'E':
+            {
+              this.handleExport()
+              return
+            }
         }
       },
       // 取消按钮
@@ -129,15 +186,21 @@
         this.open = false;
         this.reset();
       },
+      /** 导出按钮操作 */
+      handleExport() {
+        this.download('system/post/export', {
+          ...this.queryParams
+        }, `post_${new Date().getTime()}.xlsx`)
+      },
       // 多选框选中数据
       handleSelectionChange(selection) {
         this.ids = selection.map(item => item.id)
-        this.single = selection.length!=1
+        this.single = selection.length != 1
         this.multiple = !selection.length
       },
       changeFn(obj) {
-        for(let key in obj){
-          this.queryParams.fixedData[key] = obj[key]
+        for (let key in obj) {
+          this.queryParams.fixedData.condition[key] = obj[key]
         }
       },
       // 表单重置
@@ -145,41 +208,46 @@
         this.form = {
           table: 'obj_test',
           objId: '',
-          fixedData: {},
+          fixedData: {
+            condition: {
+
+            }
+          },
         };
         this.resetForm("form");
       },
       resetQuery() {
-
+        this.resetForm("queryForm");
+        this.handleQuery();
       },
       /** 搜索按钮操作 */
       handleQuery() {
-        this.grabFn(this.queryData.queryList,this.queryParams.fixedData)
+        this.queryParams.pageNo = 1;
+        this.grabFn(this.queryData.queryList, this.queryParams.fixedData.condition)
         this.getList();
       },
       // 抓取参数
-      grabFn(arr,parForm) {
-        for(let item of arr){
-          if(item.htmlType == 'checkbox' || item.htmlType == 'imageUpload' || item.htmlType == 'fileUpload'){
-            if(this.$refs[item.columnName][0].config.length){
-              console.log(this.$refs[item.columnName][0].config)
+      grabFn(arr, parForm) {
+        for (let item of arr) {
+          if (item.htmlType == 'checkbox' || item.htmlType == 'imageUpload' || item.htmlType == 'fileUpload') {
+            if (this.$refs[item.columnName][0].config.length) {
               parForm[item.columnName] = this.$refs[item.columnName][0].config
             }
-          } else{
-            console.log(this.$refs[item.columnName][0].config[item.columnName])
+          } else {
             parForm[item.columnName] = this.$refs[item.columnName][0].config[item.columnName]
           }
         }
       },
       getList() {
         getQueryList(this.queryParams).then(response => {
-          this.postList = response.data.rows;
           this.total = response.data.total;
+          this.tabData = response.data.tableHeadList
+          this.postList = response.data.rows;
           this.loading = false;
         });
       },
       init() {
-        getTableQuery({
+        tableQuery({
           table: 'obj_test',
         }).then(res => {
           let data = res.data
@@ -187,7 +255,6 @@
         })
       },
       handleChange(val) {
-        console.log(val);
       }
     },
   };
@@ -199,7 +266,8 @@
     .el-divider--horizontal {
       margin-top: 16px;
     }
-    .table_headerBtun{
+
+    .table_headerBtun {
       margin-bottom: 20px;
     }
   }

+ 86 - 56
ruoyi-ui/src/views/tool/gen/editTable.vue

@@ -1,15 +1,14 @@
 <template>
   <el-card>
-    <el-row type="flex" justify="space-between" style="margin: 10px 0;">
+    <el-row type="flex" justify="space-between">
       <el-col :span="1.5" style="display: flex; align-items: center;">
         <el-form label-width="100px" style="display: flex; align-items: center;">
-          <el-form-item style="text-align: center;margin-left:-100px;margin-top:0; margin-bottom: 0;">
-            <el-button type="primary" v-if="activeName=='basic' || activeName=='cloum'" @click="submitForm()">保存</el-button>
-            <el-button @click="close()">返回</el-button>
+          <el-form-item style="text-align: center;margin: 0 0 0 -100px;">
+            <el-button size="mini" type="primary" v-if="activeName=='basic' || activeName=='cloum'" @click="submitForm()">保存</el-button>
+            <el-button size="mini" @click="close()">返回</el-button>
           </el-form-item>
         </el-form>
       </el-col>
-
     </el-row>
 
     <el-tabs v-model="activeName">
@@ -19,7 +18,8 @@
       <el-tab-pane label="字段信息" name="cloum">
         <el-row type="flex" style="margin-bottom: 20px;" v-if="activeName=='cloum'" :gutter="10" justify="end">
           <el-col :span="1.5" style="display: flex; align-items: center;">
-            <el-button style="background-color: #FFE9ED;color: #E58481;border: 1px solid #E58481;" type="warning" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:post:add']">新增</el-button>
+            <el-button style="background-color: #FFE9ED;color: #E58481;border: 1px solid #E58481;" type="warning" plain
+              icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:post:add']">新增</el-button>
           </el-col>
           <el-col :span="1.5" style="display: flex; align-items: center;">
             <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
@@ -27,54 +27,55 @@
           </el-col>
           <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
         </el-row>
-        <el-table ref="dragTable" @row-dblclick="dbSelectedZd" :data="cloumns" row-key="columnId" :max-height="tableHeight" @selection-change="handleSelectionChange">
+        <el-table ref="dragTable" @row-dblclick="dbSelectedZd" align="center" :data="cloumns" row-key="columnId"
+          :max-height="tableHeight" @selection-change="handleSelectionChange">
           <el-table-column type="selection" width="55" align="center" />
-          <el-table-column label="序号" type="index" min-width="5%" class-name="allowDrag" />
-          <el-table-column label="字段列名" prop="columnName" min-width="10%" :show-overflow-tooltip="true" />
-          <el-table-column label="字段描述" min-width="10%">
+          <el-table-column label="序号" type="index" min-width="5%" class-name="allowDrag" align="center" />
+          <el-table-column label="字段列名" prop="columnName" min-width="10%" :show-overflow-tooltip="true" align="center" />
+          <el-table-column label="字段描述" min-width="10%" align="center">
             <template slot-scope="scope">
               <el-input v-model="scope.row.columnComment"></el-input>
             </template>
           </el-table-column>
-          <el-table-column label="物理类型" prop="columnType" min-width="10%" :show-overflow-tooltip="true" />
-          <el-table-column label="字段显示规则" align="center" prop="mask" min-width="11%" />
+          <el-table-column label="物理类型" prop="columnType" align="center" min-width="10%" :show-overflow-tooltip="true" />
+          <el-table-column label="字段显示规则" align="center" prop="mask" min-width="13%" />
           <el-table-column label="排序" min-width="8%" align="center" prop="sort" />
-          <el-table-column label="输入字段" min-width="10%">
+          <el-table-column label="输入字段" min-width="10%" align="center">
             <template slot-scope="scope">
               <el-checkbox true-label="Y" false-label="N" v-model="scope.row.isIn"></el-checkbox>
             </template>
           </el-table-column>
-          <el-table-column label="显示字段" min-width="10%">
+          <el-table-column label="显示字段" min-width="10%" align="center">
             <template slot-scope="scope">
               <el-checkbox true-label="Y" false-label="N" v-model="scope.row.isOut"></el-checkbox>
             </template>
           </el-table-column>
-          <el-table-column label="查询" min-width="8%">
+          <el-table-column label="查询" min-width="8%" align="center">
             <template slot-scope="scope">
               <el-checkbox true-label="1" false-label="0" v-model="scope.row.isQuery"></el-checkbox>
             </template>
           </el-table-column>
-          <el-table-column label="关联HR字段" min-width="10%" align="center" prop="hrParentId" >
+          <el-table-column label="关联HR字段" min-width="13%" align="center" prop="hrParentId">
             <template slot-scope="scope">
-                <div>
-                  {{scope.row.hrParentId | zdFn}}
-                </div>
-              </template>
-            </el-table-column>
+              <div>
+                {{scope.row.hrParentId | zdFn}}
+              </div>
+            </template>
+          </el-table-column>
           <el-table-column label="缺省值" min-width="10%" align="center" prop="defaultValue" />
           <el-table-column label="外键" min-width="10%" align="center" prop="foreignKey">
             <template slot-scope="scope">
-                <div>
-                  {{scope.row.foreignKey | zdFn}}
-                </div>
-              </template>
-            </el-table-column>
-          <el-table-column label="必填" min-width="8%">
+              <div>
+                {{scope.row.foreignKey | zdFn}}
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column label="必填" min-width="8%" align="center">
             <template slot-scope="scope">
               <el-checkbox true-label="1" false-label="0" v-model="scope.row.isRequired"></el-checkbox>
             </template>
           </el-table-column>
-          <el-table-column label="显示类型" min-width="12%">
+          <el-table-column label="显示类型" min-width="12%" align="center">
             <template slot-scope="scope">
               <el-select v-model="scope.row.htmlType">
                 <el-option label="文本框" value="input" />
@@ -90,7 +91,7 @@
               </el-select>
             </template>
           </el-table-column>
-          <el-table-column label="字典类型" min-width="12%">
+          <el-table-column label="字典类型" min-width="12%" align="center">
             <template slot-scope="scope">
               <el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择">
                 <el-option v-for="dict in dictOptions" :key="dict.dictType" :label="dict.dictName" :value="dict.dictType">
@@ -107,7 +108,7 @@
             <el-row>
               <el-col :span="8">
                 <el-form-item label="字段名:" prop="columnName">
-                  <el-input v-model="formZd.columnName" placeholder="请输入字段名" />
+                  <el-input :disabled="this.formZd.columnId" v-model="formZd.columnName" placeholder="请输入字段名" />
                 </el-form-item>
               </el-col>
               <el-col :span="8">
@@ -269,7 +270,7 @@
         <el-table ref="dragTable" @row-dblclick="dbSelected" v-loading="loading" :data="postList" row-key="columnId"
           align="center" :max-height="tableHeight" @selection-change="handleSelectionChange1">
           <el-table-column type="selection" width="55" align="center" />
-          <el-table-column label="id" align="center" prop="id" />
+          <el-table-column label="id" width="60" align="center" prop="id" />
           <el-table-column label="可用" align="center" prop="isDel">
             <template slot-scope="scope">
               <el-checkbox true-label="Y" disabled false-label="N" v-model="scope.row.isDel"></el-checkbox>
@@ -278,7 +279,7 @@
           <el-table-column label="序号" align="center" prop="sort" />
           <el-table-column label="描述" align="center" prop="description" />
           <el-table-column label="关联表" align="center" prop="tableName" />
-          <el-table-column label="字段(关联到主表PK)" align="center" prop="columnName" />
+          <el-table-column label="字段(关联到主表PK)" width="160px" align="center" prop="columnName" />
           <el-table-column label="显示条件" align="center" prop="displayConditions" />
           <el-table-column label="关联方式" align="center" prop="relationType">
             <template slot-scope="scope">
@@ -297,16 +298,16 @@
           @pagination="tabList" />
       </el-tab-pane>
       <el-tab-pane label="数据库SQL" name="genSql">
-        <el-row>
-          <el-button @click="zxCreaBtn" style="background-color: #FFE9ED;color: #E58481;border: 1px solid #E58481;">执行创建语句</el-button>
-          <el-button @click="sxCreaBtn" style="background-color: #FFD6B0;color: #EA551A;border: 1px solid #F4AD6B;">刷新创建语句</el-button>
+        <el-row type="flex" justify="end">
+          <el-button @click="zxCreaBtn" size="mini" style="background-color: #FFE9ED;color: #E58481;border: 1px solid #E58481;">执行创建语句</el-button>
+          <el-button @click="sxCreaBtn" size="mini" style="background-color: #FFD6B0;color: #EA551A;border: 1px solid #F4AD6B;">刷新创建语句</el-button>
         </el-row>
         <el-form>
           <el-form-item label="创建语句:" style="margin-top: 20px;">
-            <el-input class="resizeNone" v-model="tableSqlData.createSql" type="textarea"/>
+            <el-input class="resizeNone" v-model="tableSqlData.createSql" type="textarea" />
           </el-form-item>
           <el-form-item label="修改日志:">
-            <el-input class="resizeNone" v-model="tableSqlData.createLog" type="textarea"/>
+            <el-input class="resizeNone" v-model="tableSqlData.createLog" type="textarea" />
           </el-form-item>
         </el-form>
       </el-tab-pane>
@@ -318,7 +319,8 @@
           <el-input v-model="form.description" placeholder="请输入描述" />
         </el-form-item>
         <el-form-item label="关联表:" prop="relationParentId">
-          <el-select style="width: 100%;" v-model="form.relationParentId" placeholder="请选择关联表" @change="relationFn" v-loadmore="loadMore">
+          <el-select style="width: 100%;" v-model="form.relationParentId" placeholder="请选择关联表" @change="relationFn"
+            v-loadmore="loadMore">
             <el-option v-for="item in tableList.rows" :key="item.tableId" :label="item.tableComment" :value="item.tableId">
             </el-option>
           </el-select>
@@ -538,7 +540,7 @@
         });
         //查询数据库sql
         tableSql(tableId).then(res => {
-          if(res.data){
+          if (res.data) {
             this.tableSqlData = res.data
           }
         })
@@ -615,20 +617,27 @@
           this.msgSuccess('刷新成功')
           //查询数据库sql
           tableSql(tableId).then(res => {
-            if(res.data){
+            if (res.data) {
               this.tableSqlData = res.data
             }
           })
         })
       },
       zxCreaBtn() {
-        zxImplement({
-          tableId: this.$route.params && this.$route.params.tableId,
-          createSql: this.tableSqlData.createSql,
-          createLog: this.tableSqlData.createLog,
-          id: this.tableSqlData.id
+        const _this = this
+        this.$confirm('是否确认执行创建语句?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return zxImplement({
+            tableId: _this.$route.params && _this.$route.params.tableId,
+            createSql: _this.tableSqlData.createSql,
+            createLog: _this.tableSqlData.createLog,
+            id: _this.tableSqlData.id
+          })
         }).then(res => {
-          this.msgSuccess('执行成功')
+          _this.msgSuccess('执行成功')
         })
       },
       dbSelectedZd(row) {
@@ -636,7 +645,7 @@
         const id = row.columnId
         getGenTableColumn(id).then(response => {
           let data = response.data
-          data.foreignKey = data.foreignKey?data.foreignKey-0:''
+          data.foreignKey = data.foreignKey ? data.foreignKey - 0 : ''
           this.formZd = data;
           this.openZd = true;
           this.title = "修改字段信息";
@@ -747,9 +756,27 @@
       },
       /** 提交按钮 */
       submitForm() {
+        let isInFlag = 0
+        let isOutFlag = 0
+        console.log(this.cloumns,333)
+        for(let item of this.cloumns){
+          if(item.isIn=='Y'){
+            isInFlag++
+          }
+          if(item.isOut=='Y'){
+            isOutFlag++
+          }
+        }
+        if(isInFlag>1){
+          this.msgError('"输入字段"最多只能选择一个!')
+          return
+        }
+        if(isOutFlag>1){
+          this.msgError('"显示字段"最多只能选择一个!')
+          return
+        }
         const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
         // const genForm = this.$refs.genInfo.$refs.genInfoForm;
-        // console.log(basicForm)
         Promise.all([basicForm].map(this.getFormPromise)).then(res => {
           const validateResult = res.every(item => !!item);
           if (validateResult) {
@@ -846,12 +873,15 @@
   .pagination-container {
     height: 35px;
   }
-  .resizeNone{
-     width: 60vw;
-     border-radius: 3px;
-     .el-textarea__inner{ //el_input中的隐藏属性
-              resize: none;  //主要是这个样式
-              height: 200px;
-          }
-   }
+
+  .resizeNone {
+    width: 60vw;
+    border-radius: 3px;
+
+    .el-textarea__inner {
+      //el_input中的隐藏属性
+      resize: none; //主要是这个样式
+      height: 200px;
+    }
+  }
 </style>

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

@@ -1,42 +1,5 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="表名称" prop="tableName">
-        <el-input
-          v-model="queryParams.tableName"
-          placeholder="请输入表名称"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="表描述" prop="tableComment">
-        <el-input
-          v-model="queryParams.tableComment"
-          placeholder="请输入表描述"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="创建时间">
-        <el-date-picker
-          v-model="dateRange"
-          size="small"
-          style="width: 240px"
-          value-format="yyyy-MM-dd"
-          type="daterange"
-          range-separator="-"
-          start-placeholder="开始日期"
-          end-placeholder="结束日期"
-        ></el-date-picker>
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-      </el-form-item>
-    </el-form>
-
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
@@ -104,8 +67,45 @@
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
+    
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="表名称" prop="tableName">
+        <el-input
+          v-model="queryParams.tableName"
+          placeholder="请输入表名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="表描述" prop="tableComment">
+        <el-input
+          v-model="queryParams.tableComment"
+          placeholder="请输入表描述"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建时间">
+        <el-date-picker
+          v-model="dateRange"
+          size="small"
+          style="width: 240px"
+          value-format="yyyy-MM-dd"
+          type="daterange"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
 
-    <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
+    <el-table v-loading="loading" style="max-height: calc(100vh - 288px);overflow-y: auto;" :data="tableList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" align="center" width="55"></el-table-column>
       <el-table-column label="序号" type="index" width="50" align="center">
         <template slot-scope="scope">
@@ -127,7 +127,7 @@
       <el-table-column
         label="实际数据库表"
         align="center"
-        prop="className"
+        prop="realTableName"
         :show-overflow-tooltip="true"
       />
       <el-table-column label="是否菜单" align="center">
@@ -136,8 +136,8 @@
         </template>
       </el-table-column>
       <el-table-column label="菜单权限" align="center" prop="menuRole" />
-      <el-table-column label="创建时间" align="center" prop="createTime" />
-      <el-table-column label="更新时间" align="center" prop="updateTime" />
+     <!-- <el-table-column label="创建时间" align="center" prop="createTime" />
+      <el-table-column label="更新时间" align="center" prop="updateTime" /> -->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <!-- <el-button