浏览代码

Merge remote-tracking branch 'origin/master'

侯茂昌 1 年之前
父节点
当前提交
e4c77df9c7

+ 21 - 0
ruoyi-ui/src/api/dialogMange/index.js

@@ -0,0 +1,21 @@
+import request from '@/utils/request'
+
+// 新增拖拽格组
+export function addDialogGroup(data) {
+  return request({
+    url: '/system/group/addConfigurationGroup',
+    method: 'post',
+    data: data,
+    baseURL: process.env.VUE_APP_BASE_API3
+  })
+}
+
+// 修改拖拽格组
+export function undataDialogGroup(data) {
+  return request({
+    url: '/system/group/editConfigurationGroup',
+    method: 'put',
+    data: data,
+    baseURL: process.env.VUE_APP_BASE_API3
+  })
+}

+ 323 - 0
ruoyi-ui/src/views/dialogMange/components/StyleFormPanel.vue

@@ -0,0 +1,323 @@
+<template>
+  <div class="style-wrap">
+    <el-form
+      ref="formData"
+      :model="formData"
+      label-width="100px"
+      :rules="rules"
+    >
+      <el-form-item label="表格名称" prop="menuName">
+        <el-input v-model="formData.menuName" @input="iptChange()"></el-input>
+      </el-form-item>
+      <el-form-item label="时间格式" prop="timeFormate">
+        <el-select
+        @input="iptChange()"
+          v-model="formData.timeFormate"
+          placeholder="请选择时间格式"
+        >
+          <el-option
+            v-for="val in dict.type.sys_time_format"
+            :key="val.value"
+            :label="val.label"
+            :value="val.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="表格主键" prop="primaryKey">
+        <el-select
+        @input="iptChange()"
+          v-model="formData.primaryKey"
+          placeholder="请选择表格主键"
+        >
+          <el-option
+            v-for="val in primaryKeyList"
+            :key="val.fieldName"
+            :label="val.fieldDescription"
+            :value="val.fieldName"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="操作列按钮" prop="btnGroupList">
+        <el-select
+        @input="iptChange()"
+          v-model="formData.btnGroupList"
+          placeholder="请选择按钮组"
+          clearable
+          multiple
+        >
+          <el-option
+            v-for="val in btnGroupOptions"
+            :key="val.btnKey"
+            :label="val.btnGroupName"
+            :value="val.btnKey"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="排序依赖字段">
+        <el-select
+        @input="iptChange()"
+          v-model="formData.orderByColumn"
+          placeholder="请选择排序依赖"
+        >
+          <el-option
+            v-for="val in orderByFieldList"
+            :key="val.fieldName"
+            :label="val.fieldDescription"
+            :value="val.tableName + '.' + val.fieldName"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="排序方式" v-show="formData.orderByColumn">
+        <el-radio v-model="formData.isAsc" :label="false"
+          >升序</el-radio
+        >
+        <el-radio v-model="formData.isAsc" :label="true"
+          >降序</el-radio
+        >
+      </el-form-item>
+      <el-form-item label="当前表字段">
+        <el-select v-model="formData.relyFile" placeholder="请选择当前表字段">
+          <el-option
+            v-for="item in orderByFieldList"
+            :key="item.fieldName"
+            :label="item.fieldDescription"
+            :value="item.tableName + '.' + item.fieldName">
+          </el-option>
+        </el-select>
+      </el-form-item> 
+      <!-- <el-form-item label="依赖方式">
+        <el-select v-model="formData.relyOption" placeholder="请选择依赖方式">
+          <el-option
+            v-for="item in relyOptions"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item> -->
+      
+      <!-- <el-form-item label="自定义依赖值" v-show="formData.relyOption === '0'">
+        <el-input v-model="formData.relayValue" placeholder="请输入依赖值"></el-input>
+      </el-form-item> -->
+      
+      <el-form-item label="依赖表">
+        <el-select
+          v-model="formData.relytableName"
+          placeholder="请选择依赖表"
+          filterable
+          @change="getrelyList"
+          class="mb10"
+        >
+          <el-option
+            v-for="item in dragTableList"
+            :key="item.dtName"
+            :label="item.dtName"
+            :value="item.dtName"
+          >
+            <span style="float: left">{{ item.dtName }}</span>
+            <span style="float: right; color: #8492a6; font-size: 13px">{{
+              item.dtTableName
+            }}</span>
+          </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="依赖表字段">
+        <el-select
+            v-model="formData.relaykey"
+            placeholder="请选择依赖字段"
+          >
+          <el-option
+            v-for="item in dragTableFilds"
+            :key="item.keu"
+            :label="item.val"
+            :value="item.key"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import { listType } from "@/api/system/tenant/type";
+import { getDicts } from "@/api/system/dict/data";
+import { listTable, removeTableList } from "@/api/dragform/tableList";
+export default {
+  name: "StyleFormPanel",
+  dicts: ["sys_time_format", "table_statistic_type"],
+  props: {
+    subFieldList: {
+      default: [],
+      type: Array,
+    },
+    btnGroupOptions: {
+      default: [],
+      type: Array,
+    },
+    echoData:{
+      default: {},
+    }
+  },
+  components: {},
+  data() {
+    return {
+      dragTableList:[],
+      dragTableFilds:[],
+      editData:{},
+      dragTableFilds:{},
+      rules: {},
+      formData: {
+        timeFormate:'',
+        relytableName:'',
+        isAsc: false,
+        primaryKey: "",
+        btnGroupList: [],
+      },
+      relyFileds: {},
+      conditionDefaultValueMap: '',
+      relyOptions:[
+        {
+         value: '0',
+         label: '自定义依赖值'
+        },
+        {
+          value: '1',
+          label: '依赖其他字段'
+        }
+      ],
+      tableList: []
+    }
+  },
+  computed: {
+    orderByFieldList() {
+      return this.tableFieldList;
+    },
+    primaryKeyList() {
+      // console.log(this.subFieldList)
+      return this.subFieldList.filter((item) => !item.isChildren);
+    },
+    orderByFieldList() {
+      return this.subFieldList;
+    },
+    relayKeyList(){
+      return this.subFieldList.filter((item) => !item.isChildren);
+    }
+  },
+  watch: {
+    tableFieldList: {
+      handler(nval) {
+        if (!nval || !nval.length) return;
+        this.allFieldList = nval;
+        this.isShowFieldList = nval.filter((item) => item.isShow);
+        let tempList = nval.map((item) => {
+          return {
+            tableName: item.tableName,
+            tableComment: item.tableComment,
+          };
+        });
+        this.tableList = [];
+        tempList.forEach((item) => {
+          let isHas = this.tableList.find(
+            (it) => it.tableName == item.tableName
+          );
+          if (!isHas) {
+            this.tableList.push(item);
+          }
+        });
+      },
+      immediate: true,
+      deep: true,
+    },
+
+    formData:{
+      handler(nval){
+        this.$emit('subFormData', this.formData)
+      },
+      immediate: true,
+      deep: true,
+    },
+    echoData:{
+      handler(nval){
+          let {
+            menuName,
+            timeFormate,
+            orderByColumn,
+            isAsc,
+            primaryKey,
+            btnGroupList,
+            relyFile,
+            relytableName,
+            relaykey,
+            relyOption
+          } = nval.formData;
+          Object.assign(this.formData, {
+            menuName,
+            timeFormate,
+            orderByColumn,
+            isAsc,
+            primaryKey,
+            btnGroupList,
+            relyFile,
+            relytableName,
+            relaykey,
+            relyOption
+
+          });
+        
+        this.getdragTable()
+        this.getrelyList()
+        // this.editData = item;
+      },
+      // immediate: true,
+      deep: true,
+    }
+  },
+  methods: {
+    iptChange(){
+	    this.$forceUpdate();  //强制刷新
+    },
+    getdragTable(){
+       let queryParams = {
+        isEnablePaging:false,
+        dtType: 0
+      }
+      listTable(queryParams).then(res => {
+        this.dragTableList = res.rows
+      })
+    },
+    getrelyList() {
+      this.dragTableList.forEach(item => {
+        if(this.formData.relytableName == item.dtName){
+          this.dragTableFilds = JSON.parse(item.dtColumnName)
+        }
+      })
+      this.dragTableFilds.forEach(item => {
+        for(let val in item){
+          item.key = val
+          item.val = item[val]
+        }
+      })
+    },
+  },
+  async mounted() {
+    this.getdragTable()
+  },
+};
+</script>
+
+<style scoped lang="scss">
+.style-wrap {
+  .condition-table-wrap {
+    width: 100%;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    .table-title {
+      margin-bottom: 10px;
+      font-size: 16px;
+      font-weight: 600;
+    }
+  }
+}
+</style>

+ 2488 - 0
ruoyi-ui/src/views/dialogMange/index.vue

@@ -0,0 +1,2488 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="20">
+      <el-col 
+      :span="18" 
+      :class="{ edit: menudata }">
+        <el-card v-if="tabIndex == '0' || tabIndex == '2'" shadow="always" :body-style="{ padding: '20px' }">
+          <template #header>
+            <div>
+              <span>基础信息</span>
+            </div>
+          </template>
+          <el-select
+            v-model="tableName"
+            placeholder="请选择数据表"
+            filterable
+            @change="getList"
+            class="mb10"
+          >
+            <el-option
+              v-for="item in tableList"
+              :key="item.tableName"
+              :label="item.tableComment"
+              :value="item.tableName"
+            >
+              <span style="float: left">{{ item.tableComment }}</span>
+              <span style="float: right; color: #8492a6; font-size: 13px">{{
+                item.tableName
+              }}</span>
+            </el-option>
+          </el-select>
+          <el-table
+            :data="tableFieldList"
+            border
+            ref="dragTable"
+            row-key="id"
+            max-height="500px"
+          >
+            >
+            <el-table-column
+              type="index"
+              label="序号"
+              width="50"
+              class-name="allowDrag"
+            >
+            </el-table-column>
+            <el-table-column prop="fieldName" label="数据字段">
+            </el-table-column>
+            <el-table-column prop="fieldDescription" label="字段描述">
+              <template slot-scope="scope">
+                <input
+                  :class="{
+                    isNullDesc:
+                      scope.row.fieldDescription == '' &&
+                      scope.row.isShow &&
+                      isInputInvalid
+                        ? true
+                        : false,
+                    ipt: true,
+                  }"
+                  v-model="scope.row.fieldDescription"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column prop="relationTable" label="关联表">
+              <template slot-scope="scope">
+                <el-select
+                  v-model="scope.row.relationTable"
+                  :disabled="
+                    !scope.row.relationTableList ||
+                    !scope.row.relationTableList.length
+                  "
+                  placeholder="请选择关联的表"
+                  clearable
+                  filterable
+                  @change="ralationTableChange(scope.row)"
+                >
+                  <el-option
+                    v-for="item in scope.row.relationTableList"
+                    :key="item.tableName"
+                    :label="item.tableComment"
+                    :value="item.tableName"
+                  >
+                    <span style="float: left">{{ item.tableComment }}</span>
+                    <span
+                      style="float: right; color: #8492a6; font-size: 13px"
+                      >{{ item.tableName }}</span
+                    >
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column prop="relationFieldName" label="关联条件字段">
+              <template slot-scope="scope">
+                <el-select
+                  v-model="scope.row.relationFieldName"
+                  @change="relationFieldChange(scope.row)"
+                  :disabled="!scope.row.disableRelaFieldName"
+                  placeholder="关联字段"
+                  filterable
+                >
+                  <el-option
+                    v-for="item in scope.row.relaFieldNameList"
+                    :key="item.fieldName"
+                    :label="item.fieldDescription"
+                    :value="item.fieldName"
+                  >
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column prop="relationType" label="关联方式">
+              <template slot-scope="scope">
+                <el-select
+                  v-model="scope.row.relationType"
+                  placeholder="请选择关联方式"
+                  :disabled="!scope.row.disableRelaType"
+                  @change="relationTypeChangeHandler(scope.row)"
+                  filterable
+                >
+                  <el-option
+                    v-for="item in relaTypeList"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column prop="isShow" label="是否显示">
+              <template slot-scope="scope">
+                <el-switch v-model="scope.row.isShow"> </el-switch>
+              </template>
+            </el-table-column>
+           
+          </el-table>
+        </el-card>
+
+        <SubList ref="subList" v-if="tabIndex == '1'" :menudata="menudata" :tableList="tableList" 
+        @tableNameChange="subNameHandler" @fieldListChange="filedListHandler"
+
+        />
+      </el-col>
+
+      <el-col :span="6" :class="{ menudata: menudata }">
+        <el-tabs v-model="activeName" @tab-click="tabhandleClick">
+          <el-tab-pane label="基础信息" name="menuedit">
+            <el-card shadow="always" :body-style="{ padding: '10px' }">
+              <el-form
+                ref="formData"
+                :model="formData"
+                label-width="100px"
+                :rules="rules"
+              >
+                <el-form-item label="组名称" prop="groupName">
+                  <el-input v-model="formData.groupName"></el-input>
+                </el-form-item>
+                <el-form-item label="组描述" prop="groupDescription">
+                  <el-input v-model="formData.groupDescription"></el-input>
+                </el-form-item>
+                <el-form-item label="时间格式" prop="timeFormate">
+                  <el-select
+                    v-model="formData.timeFormate"
+                    placeholder="请选择时间格式"
+                  >
+                    <el-option
+                      v-for="val in dict.type.sys_time_format"
+                      :key="val.value"
+                      :label="val.label"
+                      :value="val.value"
+                    ></el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="表格主键" prop="primaryKey">
+                  <el-select
+                    v-model="formData.primaryKey"
+                    placeholder="请选择表格主键"
+                  >
+                    <el-option
+                      v-for="val in primaryKeyList"
+                      :key="val.fieldName"
+                      :label="val.fieldDescription"
+                      :value="val.fieldName"
+                    ></el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="操作列按钮" prop="btnGroupList">
+                  <el-select
+                    v-model="formData.btnGroupList"
+                    placeholder="请选择按钮组"
+                    clearable
+                    multiple
+                  >
+                    <el-option
+                      v-for="val in btnGroupOptions"
+                      :key="val.btnKey"
+                      :label="val.btnGroupName"
+                      :value="val.btnKey"
+                    ></el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="排序依赖字段">
+                  <el-select
+                    v-model="formData.orderByColumn"
+                    placeholder="请选择排序依赖"
+                  >
+                    <el-option
+                      v-for="val in primaryKeyList"
+                      :key="val.fieldName"
+                      :label="val.fieldDescription"
+                      :value="val.fieldName"
+                    ></el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="排序方式" v-show="formData.orderByColumn">
+                  <el-radio v-model="formData.isAsc" :label="false"
+                    >升序</el-radio
+                  >
+                  <el-radio v-model="formData.isAsc" :label="true"
+                    >降序</el-radio
+                  >
+                </el-form-item>
+                <el-form-item label="当前表字段">
+                  <el-select v-model="formData.relyFile" placeholder="请选择当前表字段">
+                    <el-option
+                      v-for="item in orderByFieldList"
+                      :key="item.fieldName"
+                      :label="item.fieldDescription"
+                      :value="item.tableName + '.' + item.fieldName">
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+
+                <!-- <el-form-item label="依赖方式">
+                  <el-select v-model="formData.relyOption" placeholder="请选择依赖方式">
+                    <el-option
+                      v-for="item in relyOptions"
+                      :key="item.value"
+                      :label="item.label"
+                      :value="item.value">
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+                -->
+
+                <!-- <el-form-item label="自定义依赖值" v-show="formData.relyOption === '0'">
+                  <el-input v-model="relayValue" placeholder="请输入依赖值"></el-input>
+                </el-form-item> -->
+
+                <el-form-item label="依赖表">
+                  <el-select
+                    v-model="formData.relytableName"
+                    placeholder="请选择依赖表"
+                    filterable
+                    @change="getrelyList"
+                    class="mb10"
+                  >
+                    <el-option
+                      v-for="item in dragTableList"
+                      :key="item.dtName"
+                      :label="item.dtName"
+                      :value="item.dtName"
+                    >
+                      <span style="float: left">{{ item.dtName }}</span>
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+
+                <el-form-item label="依赖表字段">
+                  <el-select
+                      v-model="formData.relaykey"
+                      placeholder="请选择依赖字段"
+                    >
+                    <el-option
+                      v-for="item in dragTableFilds"
+                      :key="item.keu"
+                      :label="item.val"
+                      :value="item.key"
+                    ></el-option>
+                  </el-select>
+                </el-form-item>
+
+                <el-form-item>
+                  <el-button size="mini" @click="previewHandle">预览</el-button>
+                  <el-button size="mini" type="primary" @click="createHandle">{{
+                    tId ? "确认修改" : "确认创建"
+                  }}</el-button>
+                </el-form-item>
+
+              </el-form>
+            </el-card>
+          </el-tab-pane>
+          <el-tab-pane label="关联子表" name="styleEdit">
+            <el-card shadow="always" :body-style="{ padding: '10px' }">
+              <StyleFormPanel
+                ref="styleTableRef"
+                :echoData = "echoData"
+                :btnGroupOptions="btnGroupOptions"
+                :subFieldList="subFiledList"
+                @subFormData="subFormDataHandler" 
+                :dragTableList="dragTableList"
+              />
+            </el-card>
+          </el-tab-pane>
+          <el-tab-pane label="数据统计" name="datacount">
+            <el-card shadow="always" :body-style="{ padding: '10px' }">
+             
+              <el-form
+                ref="countData"
+                :model="countData"
+                label-width="100px"
+              >
+                <el-form-item label="按钮组" prop="btnGroupList">
+                  <el-select
+                    v-model="countData.btnGroupList"
+                    placeholder="请选择按钮组"
+                    clearable
+                    multiple
+                  >
+                    <el-option
+                      v-for="val in btnGroupOptions"
+                      :key="val.btnKey"
+                      :label="val.btnGroupName"
+                      :value="val.btnKey"
+                    ></el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="状态展示标题" prop="title">
+                  <el-input @input="iptChange()" v-model="countData.title" placeholder="请输入展示标题"></el-input>
+                </el-form-item>
+                
+                <el-form-item label="选择数据表" prop="table">
+                  <el-select
+                  @input="iptChange()"
+                    v-model="countData.countName"
+                    placeholder="请选择数据表"
+                    filterable
+                    @change="getCountList"
+                    class="mb10"
+                  >
+                    <el-option
+                      v-for="item in countList"
+                      :key="item.tableName"
+                      :label="item.tableComment"
+                      :value="item.tableName"
+                    >
+                      <span style="float: left">{{ item.tableComment }}</span>
+                      <span style="float: right; color: #8492a6; font-size: 13px">{{
+                        item.tableName
+                      }}</span>
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+                
+                <el-form-item label="表格主键" prop="primaryKey">
+                <el-select
+                @input="iptChange()"
+                  v-model="countData.primaryKey"
+                  placeholder="请选择表格主键"
+                >
+                  <el-option
+                    v-for="val in countPrimaryKeyList"
+                    :key="val.fieldName"
+                    :label="val.fieldDescription"
+                    :value="val.fieldName"
+                  ></el-option>
+                </el-select>
+                </el-form-item>
+
+                <el-form-item label="当前表字段">
+                  <el-select v-model="countData.relyFile" placeholder="请选择当前表字段">
+                    <el-option
+                      v-for="item in countByFieldList"
+                      :key="item.fieldName"
+                      :label="item.fieldDescription"
+                      :value="item.tableName + '.' + item.fieldName">
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item label="统计字段">
+                  <el-select v-model="countData.countFile" placeholder="请选择统计字段" @input="iptChange()">
+                    <el-option
+                      v-for="item in countByFieldList"
+                      :key="item.fieldName"
+                      :label="item.fieldDescription"
+                      :value="item.fieldName">
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+                <!-- <el-form-item label="依赖方式">
+                <el-select v-model="countData.relyOption" placeholder="请选择依赖方式">
+                  <el-option
+                    v-for="item in relyOptions"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value">
+                  </el-option>
+                </el-select>
+              </el-form-item> -->
+              
+
+              <!-- <el-form-item label="自定义依赖值" v-show="countData.relyOption === '0'">
+                <el-input v-model="countData.relayValue" placeholder="请输入依赖值"></el-input>
+              </el-form-item> -->
+
+              <el-form-item label="依赖表">
+                <el-select
+                @input="iptChange()"
+                  v-model="countData.relytableName"
+                  placeholder="请选择依赖表"
+                  filterable
+                  @change="getCountrelyList"
+                  class="mb10"
+                >
+                  <el-option
+                    v-for="item in countdragTableList"
+                    :key="item.dtName"
+                    :label="item.dtName"
+                    :value="item.dtName"
+                  >
+                    <span style="float: left">{{ item.dtName }}</span>
+                  </el-option>
+                </el-select>
+              </el-form-item>
+
+              <el-form-item label="依赖表字段">
+                <el-select
+                  @input="iptChange()"
+                    v-model="countData.relaykey"
+                    placeholder="请选择依赖字段"
+                  >
+                  <el-option
+                    v-for="item in countdragTableFilds"
+                    :key="item.keu"
+                    :label="item.val"
+                    :value="item.key"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-form>
+                <el-button
+                type="primary"
+                class="inline-large-button addcount"
+                icon="el-icon-plus"
+                size="mini"
+                @click="addDataDialog"
+              >
+                添加数据字段
+              </el-button>
+              <el-table
+              :data="dragTableStatisticList"
+              border
+              class="mb10"
+              style="width: 100%"
+              >
+              <!-- <el-table-column prop="number" label="序号" width="50"> -->
+              <!-- style="width: 100%"> -->
+              <el-table-column
+                type="index"
+                label="序号"
+                width="50"
+                class-name="allowDrag"
+              >
+              </el-table-column>
+       
+              <el-table-column
+                prop="statisticTitle"
+                label="统计标题"
+                width="83"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="statisticField"
+                label="统计数据"
+                width="80"
+              >
+              </el-table-column>
+              <el-table-column prop="statisticType" label="统计类型" width="50">
+              </el-table-column>
+              <el-table-column
+                label="操作"
+                align="center"
+                class-name="small-padding fixed-width"
+              >
+                <template slot-scope="scope">
+                  <el-dropdown>
+                    <el-button type="warning" plain size="small">
+                      处理<i class="el-icon-arrow-down el-icon--right"></i>
+                    </el-button>
+                    <el-dropdown-menu slot="dropdown">
+                      <el-dropdown-item>
+                        <el-button
+                          size="mini"
+                          type="text"
+                          icon="el-icon-edit"
+                          @click="handleUpdateStat(scope.row)"
+                          >修改
+                        </el-button>
+                      </el-dropdown-item>
+                      <el-dropdown-item>
+                        <el-button
+                          size="mini"
+                          type="text"
+                          icon="el-icon-delete"
+                          @click="handleDeleteStat(scope.row)"
+                          >删除
+                        </el-button>
+                      </el-dropdown-item>
+                    </el-dropdown-menu>
+                  </el-dropdown>
+                </template>
+              </el-table-column>
+            </el-table>
+            </el-card>
+          </el-tab-pane>
+          
+        </el-tabs>
+      </el-col>
+    </el-row>
+
+    <el-dialog title="效果预览" :visible.sync="isShowPreview" width="50%">
+      <div class="cardBox">
+        <el-card
+          shadow="hover"
+          :body-style="{ padding: '20px' }"
+          class="card"
+          v-for="(item, index) in deepragTableStatisticList"
+          :key="index"
+        >
+          <el-tooltip
+            class="item"
+            effect="dark"
+            :content="item.statisticTitle"
+            placement="top-start"
+          >
+            <div class="title">
+              {{
+                item.statisticTitle
+                  ? item.statisticTitle
+                  : item.statisticDescription
+              }}
+            </div>
+          </el-tooltip>
+
+          <div class="type">
+            <div class="count">统计结果</div>
+          </div>
+        </el-card>
+      </div>
+
+      <el-row :gutter="10" class="mb8">
+        <el-col :span="18">
+          <el-input placeholder="请输入" clearable />
+        </el-col>
+
+        <el-col :span="6" class="previewbtn">
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            size="small"
+            @click="() => {}"
+            >搜索</el-button
+          >
+          <el-button icon="el-icon-refresh" size="small" @click="() => {}"
+            >重置</el-button
+          >
+        </el-col>
+      </el-row>
+
+      <el-row :gutter="10" class="mb8">
+        <el-col :span="1.5">
+          <el-button
+            type="primary"
+            plain
+            icon="el-icon-plus"
+            size="mini"
+            @click="() => {}"
+            >新增
+          </el-button>
+        </el-col>
+        <el-col :span="1.5">
+          <el-button
+            type="success"
+            plain
+            icon="el-icon-edit"
+            size="mini"
+            :disabled="false"
+            @click="() => {}"
+            >修改
+          </el-button>
+        </el-col>
+        <el-col :span="1.5">
+          <el-button
+            type="danger"
+            plain
+            icon="el-icon-delete"
+            size="mini"
+            :disabled="false"
+            @click="() => {}"
+            >删除
+          </el-button>
+        </el-col>
+        <el-col :span="1.5">
+          <el-button plain icon="el-icon-upload2" size="mini" @click="() => {}"
+            >导入
+          </el-button>
+        </el-col>
+        <el-col :span="1.5">
+          <el-button
+            type="warning"
+            plain
+            icon="el-icon-download"
+            size="mini"
+            @click="() => {}"
+            >导出
+          </el-button>
+        </el-col>
+      </el-row>
+      <el-table :data="tableDataList" @selection-change="() => {}">
+        <el-table-column
+          type="selection"
+          width="55"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          v-for="item in columns"
+          :key="item.key + item.value"
+          :label="item.value"
+          align="center"
+          :prop="toUpperCase(item.key)"
+        />
+        <el-table-column
+          label="操作"
+          align="center"
+          class-name="small-padding fixed-width"
+        >
+          <template>
+
+            <el-dropdown>
+              <el-button type="warning" plain size="small">
+                处理<i class="el-icon-arrow-down el-icon--right"></i>
+              </el-button>
+              <el-dropdown-menu slot="dropdown">
+                <el-dropdown-item
+                  ><el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-edit"
+                    @click="() => {}"
+                    >修改</el-button
+                  ></el-dropdown-item
+                >
+                <el-dropdown-item
+                  ><el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-delete"
+                    @click="() => {}"
+                    >删除</el-button
+                  >
+                </el-dropdown-item>
+              </el-dropdown-menu>
+            </el-dropdown>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="pageList"
+      />
+      <template #footer>
+        <span>
+          <el-button @click="isShowPreview = false">关闭</el-button>
+          <el-button type="primary" @click="createHandle">{{
+            tId ? "确认修改" : "确认关联"
+          }}</el-button>
+        </span>
+      </template>
+    </el-dialog>
+
+    <!-- 添加数据统计对话框 -->
+    <el-dialog :title="staictitle" :visible.sync="isShowAddData" width="30%">
+      <el-form label-width="100px" :model="dataCountFormData">
+        <el-form-item label="统计标题" prop="statisticTitle">
+          <el-input v-model="dataCountFormData.statisticTitle"></el-input>
+        </el-form-item>
+
+        <el-form-item label="统计数据">
+          <el-select
+            v-model="dataCountFormData.statisticField"
+            placeholder="请选择统计字段"
+          >
+            <el-option
+              v-for="item in dataArr"
+              :key="item.id"
+              :label="item.fieldName"
+              :value="item.tableName + '.' + item.fieldName"
+            >
+              <span style="float: left; margin-right: 5px"
+                >{{ isShowTableName }}
+              </span>
+              <span style="float: right; color: #8492a6; font-size: 13px">{{
+                item.fieldName
+              }}</span>
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="统计类型">
+          <el-select
+            v-model="dataCountFormData.statisticType"
+            placeholder="请选择统计类型"
+          >
+            <el-option
+              v-for="item in dataType"
+              :key="item.dictCode"
+              :label="item.dictLabel"
+              :value="item.dictValue"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeAddDialog">取 消</el-button>
+        <el-button
+          v-if="staictitle == '修改统计数据字段'"
+          type="primary"
+          @click="upadtaData"
+          >确 定</el-button
+        >
+
+        <el-button v-else type="primary" @click="addData">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getTableInfo, editTable } from "@/api/system/table.js";
+import {
+  delTableData,
+  dragTableInfo,
+  unionListTableData,
+  getInfoBySqlKey,
+  addTableData,
+  addStatistic,
+  updateStatistic,
+} from "@/api/tablelist/commonTable";
+import { listTable, removeTableList } from "@/api/dragform/tableList";
+import { getDicts } from "@/api/system/dict/data";
+import {
+  getFormName,
+  getListName,
+  dragTablePreview,
+} from "@/api/dragform/form.js";
+import { addGroup, listGroup, getTable, delGroup, updataGroup} from '@/api/relateTable/index.js'
+import { addDialogGroup, undataDialogGroup } from "@/api/dialogMange/index.js"
+import { listType } from "@/api/system/dict/type.js";
+import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
+import { mapState } from "vuex";
+import Sortable from "sortablejs";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { v4 as uuidv4 } from "uuid";
+import { listBtn } from "@/api/system/btn";
+import StyleFormPanel from "./components/StyleFormPanel.vue";
+import SubList from "./styleMange/tablelist.vue";
+
+
+export default {
+  name: "tableMange",
+  dicts: ["sys_time_format", "table_statistic_type"],
+  props: [],
+  components: { Queryfrom, Treeselect, StyleFormPanel, SubList},
+  data() {
+    return {
+      // 关联子表数据回显
+      echoData:{},
+      dragTableList:[],
+      countdragTableList:[],
+      dragTableFilds:{},
+      // 统计子表
+      countdragTableFilds:{},
+      // 子表tablename
+      subTableName:'',
+      subFiledList:[],
+      // 依赖表名称
+      // relytableName: '',
+      staictitle: "添加统计数据字段",
+      isInputInvalid: false,
+      // 修改表格时的menuId
+      menuId: "",
+      // 修改表格的id
+      tId: "",
+      // 当前模板信息
+      templateInfo: {},
+      // 排序方式 默认降序
+      sortState: true,
+      // 列信息
+      columns: {},
+      // 查询条件
+      queryFromWhere: {},
+      // 当前table唯一标识
+      sqlKey: "",
+      // 动态数据sqlkey
+      staticSqlKey: "",
+      // 表格的高度
+      tableKey: "",
+      // tableHeight: document.documentElement.scrollHeight - 245 + "px",
+      tableList: [], //所有表格列表
+      tableFieldList: [], // 当前表格字段数据
+      relayFieldList: [],
+      tableName: "", // 当前表名称
+
+      relationTableList: [], //关联表格列表
+      relationFieldList: [], //关联字段列表
+      relationTypeList: [], //关联方式列表
+      total: 0, //表格数据总数
+      relyOptions:[
+        {
+         value: '0',
+         label: '自定义依赖值'
+        },
+        {
+          value: '1',
+          label: '依赖其他表字段'
+        }
+      ],
+      // 依赖值
+      relayValue: '',
+      // 依赖字段
+      relyFileds: {},
+      relaTypeList: [
+        {
+          label: "等值连接",
+          value: "INNER JOIN",
+        },
+        {
+          label: "左连接",
+          value: "LEFT JOIN",
+        },
+        {
+          label: "右连接",
+          value: "RIGHT JOIN",
+        },
+      ],
+      headerList: [
+        {
+          prop: "fieldName",
+          label: "数据字段",
+        },
+        {
+          prop: "fieldDescription",
+          label: "字段描述",
+        },
+        {
+          prop: "relationTable",
+          label: "关联表",
+        },
+        {
+          prop: "relationFieldName",
+          label: "关联字段",
+        },
+        {
+          prop: "relationType",
+          label: "关联方式",
+        },
+        {
+          prop: "isShow",
+          label: "是否显示",
+        },
+        {
+          prop: "isSearch",
+          label: "是否包含查询",
+        },
+        {
+          prop: "isExport",
+          label: "是否导出",
+        },
+        {
+          prop: "isCount",
+          label: "是否统计",
+        },
+      ], //表头列表
+
+      // 基础信息编辑
+      formData: {
+        groupName: "",
+        groupDescription: "",
+        routePath: undefined,
+        isShowList: true,
+        timeFormate: "",
+        orderByColumn: "",
+        isAsc: false,
+        primaryKey: "",
+        btnGroupList: [],
+      },
+      // 统计信息
+      countData: {},
+      rules: {
+        groupName: [
+          { required: true, message: "请输入组名称", trigger: "blur" },
+        ],
+        groupDescription: [
+          { required: true, message: "请输入组描述", trigger: "blur" },
+        ],
+        timeFormate: [
+          { required: true, message: "请选择时间格式", trigger: "change" },
+        ],
+        primaryKey: [
+          { required: true, message: "请选择表格主键", trigger: "blur" },
+        ],
+        fieldDescription: [
+          { required: true, message: "请输入字段描述", trigger: "blur" },
+        ],
+      },
+      // tab切换
+      tabIndex: "0",
+      menus: [], //路由列表数据
+
+      // 预览弹窗相关
+      isShowPreview: false, //弹窗显示与隐藏
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        orderByColumn: "",
+        isAsc: false,
+        basicMap: {
+          sql: "",
+        },
+      },
+      loading: false, //表格加载
+      tableDataList: [], //数据
+      // 基础信息数据回显
+      editData: {},
+      // 关联子表数据回显
+      subEchoData:{},
+      // 统计数据回显
+      countEchoData:{},
+      gruopKey:'',
+      menuOrderNum: 0,
+      // tab动态切换
+      activeName: "menuedit",
+      // 数据统计对象
+      dataCountFormData: {},
+      // 添加数据统计表格
+      dragTableStatisticList: [],
+      deepragTableStatisticList: [],
+      tableSqlList: [],
+      searchFieldList: [],
+      // 是否切换到数据统计
+      menudata: false,
+      // 显示添加字段对话框dataArr
+      isShowAddData: false,
+      dataType: [],
+      uuid: "",
+
+      // 样式编辑tab数据
+      // dragTableStyleList: [],
+
+      //操作列按钮组数据
+      btnGroupOptions: [],
+
+      // 统计展示字段
+      countFiledsList: [
+        {
+          label: '直接展示',
+          value: '0'
+        },
+        {
+          label: '字段关联展示',
+          value: '1'
+        }
+      ],
+      // 关联字段字典
+      countDicts:[],
+      // 子表表单数据
+      subformData:{},
+      // 数据统计
+      countName:'',
+      countFieldList: [],
+      // 统计状态信息回显
+      statusCount: [],
+    };
+  },
+  computed: {
+    // 数据字段
+    dataArr() {
+      // console.log(this.subFiledList);
+      return this.subFiledList?.filter((item) => item.isShow);
+    },
+    countList(){
+      return this.tableList;
+    },
+    infoTableList(){
+      return this.tableList;
+    },
+    // 数据统计字段表名中文
+    isShowTableName() {
+      let tableComment;
+      this.subFiledList.forEach(item => {
+        if(item.tableName === this.subTableName){
+          tableComment = item.tableComment
+        }
+      })
+      // console.log(tableComment);
+      return tableComment
+    },
+    ...mapState({
+      databaseName: (state) => state.user.dataSource.databaseName,
+      databaseType: (state) => state.user.dataSource.databaseType,
+      username: (state) => state.user.dataSource.username,
+      tenantId: (state) => state.user.tenant.tenantId,
+    }),
+    searchArr() {
+      if (!this.templateInfo?.where?.length) return [];
+      return this.templateInfo.where.map((item) => item.conditionName);
+    },
+    checkedWhere() {
+      if (!this.templateInfo?.where?.length) return [];
+      return this.templateInfo?.where.filter((item) => {
+        return this.checkedList.includes(item.conditionName);
+      });
+    },
+    orderByFieldList() {
+      // return this.tableFieldList.filter((item) => item.isShow);
+      return this.tableFieldList;
+    },
+    countByFieldList(){
+      return this.countFieldList
+    },
+    primaryKeyList() {
+      return this.tableFieldList.filter((item) => !item.isChildren);
+    },
+    countPrimaryKeyList() {
+      // console.log(this.countFieldList);
+      return this.countFieldList.filter((item) => !item.isChildren);
+    },
+    relayKeyList(){
+      return this.relayFieldList.filter((item) => !item.isChildren);
+    }
+  },
+  watch: {
+    tableName: function (val) {
+      if (val) {
+        this.relationTableList = this.tableList
+          .filter((item) => item.tableName != val)
+          .map((item) => {
+            return {
+              tableName: item.tableName,
+              tableComment: item.tableComment,
+            };
+          });
+      } else {
+        this.relationTableList = [];
+      }
+    }
+  },
+  methods: {
+    // 数据统计tag选择数据表
+    getCountList(){
+      if (!this.countData.countName) return;
+      let data = {
+        databaseName: this.databaseName,
+        databaseType: this.databaseType,
+        tableName: this.countData.countName,
+      };
+      let tableComment = this.getTableCommont( this.countData.countName, this.tableList);
+      // 获取当前表单结构信息
+      getListName(data).then((res) => {
+        // console.log(res);
+        this.countFieldList = res.map((item, index) => {
+          return {
+            id: this.countData.countName + "_" + item.fieldName,
+            fieldName: item.fieldName,
+            fieldDescription: item.fieldDescription,
+            relationTable: "",
+            relationFieldName: "",
+            relaFieldNameList: [],
+            disableRelaFieldName: false,
+            relationType: "",
+            relationShowField: [],
+            relationShowFiledList: [],
+            disableRelaType: false,
+            isShow: true,
+            isSearch: false,
+            isExport: true,
+            relationTableList: this.relationTableList,
+            tableName: this.tableName,
+            tableComment,
+            relationFieldList: [],
+          };
+        });
+      });
+
+    },
+    // 关联字典字段
+    async getDictType() {
+      let data = {
+        isEnablePaging:false 
+      }
+      let res = await listType(data)
+      // console.log('字典数据', res);
+      this.countDicts = res.rows
+    },
+    // 关联子表名
+    subNameHandler(val){
+      this.subTableName = val
+    },
+    // 关联子表字段
+    filedListHandler(list){
+      this.subFiledList = list
+    },
+    subFormDataHandler(data){
+      this.subformData = data
+    },
+    /** 查询列表 */
+    getList(queryParams) {
+      if (!this.tableName) return;
+      let data = {
+        databaseName: this.databaseName,
+        databaseType: this.databaseType,
+        tableName: this.tableName,
+      };
+      let tableComment = this.getTableCommont(this.tableName, this.tableList);
+      // 获取当前表单结构信息
+      getListName(data).then((res) => {
+        // console.log(res);
+        this.tableFieldList = res.map((item, index) => {
+          return {
+            id: this.tableName + "_" + item.fieldName,
+            fieldName: item.fieldName,
+            fieldDescription: item.fieldDescription,
+            relationTable: "",
+            relationFieldName: "",
+            relaFieldNameList: [],
+            disableRelaFieldName: false,
+            relationType: "",
+            relationShowField: [],
+            relationShowFiledList: [],
+            disableRelaType: false,
+            isShow: true,
+            isSearch: false,
+            isExport: true,
+            relationTableList: this.relationTableList,
+            tableName: this.tableName,
+            tableComment,
+            relationFieldList: [],
+          };
+        });
+        // console.log(this.tableFieldList);
+      });
+    },
+    getrelyList() {
+      // console.log(this.formData.relytableName);
+      this.dragTableList.forEach(item => {
+        if(this.formData.relytableName == item.dtName){
+          this.dragTableFilds = JSON.parse(item.dtColumnName)
+        }
+      })
+      this.dragTableFilds.forEach(item => {
+        for(let val in item){
+          item.key = val
+          item.val = item[val]
+        }
+      })
+    },
+    getCountrelyList(){
+      // console.log('123456');
+      this.countdragTableList.forEach(item => {
+        // console.log(this.countData.relytableName);
+        if(this.countData.relytableName == item.dtName){
+          this.countdragTableFilds = JSON.parse(item.dtColumnName)
+        }
+      })
+      this.countdragTableFilds.forEach(item => {
+        for(let val in item){
+          item.key = val
+          item.val = item[val]
+        }
+      })
+      // console.log(this.countdragTableFilds);
+    },
+    getdragTable(){
+       let queryParams = {
+        isEnablePaging:false,
+        dtType: 0
+      }
+      listTable(queryParams).then(res => {
+        this.dragTableList = res.rows
+        this.countdragTableList = res.rows
+      })
+    },
+    // 关联表变化回调
+    async ralationTableChange(row) {
+      this.tableFieldList = this.tableFieldList.filter((item) => {
+        return !row.relationFieldList.some((val) => {
+          return val.id == item.id;
+        });
+      });
+      row.relationFieldName = "";
+      row.relationType = "";
+      row.disableRelaFieldName = false;
+      row.disableRelaType = false;
+      row.relationFieldList = [];
+      if (!row.relationTable) {
+        return;
+      }
+      // 获取关联表的字段
+      let data = {
+        databaseName: this.databaseName,
+        databaseType: this.databaseType,
+        tableName: row.relationTable,
+      };
+      let tableComment = this.getTableCommont(
+        row.relationTable,
+        this.tableList
+      );
+      let res = await getListName(data);
+      // 关联字段下拉列表数据
+      row.relaFieldNameList = res.map((item) => {
+        return {
+          fieldName: item.fieldName,
+          fieldDescription: item.fieldDescription,
+        };
+      });
+      let relationTableList = row.relationTableList.filter(
+        (item) => row.relationTable != item.tableName
+      );
+      row.relationFieldList = row.relaFieldNameList.map((item, index) => {
+        return {
+          id: row.relationTable + "_" + item.fieldName,
+          fieldName: item.fieldName,
+          fieldDescription: item.fieldDescription,
+          relationTable: "",
+          relationFieldName: "",
+          relaFieldNameList: [],
+          disableRelaFieldName: false,
+          relationType: "",
+          relationShowField: [],
+          relationShowFiledList: [],
+          disableRelaType: false,
+          isShow: true,
+          isSearch: false,
+          isExport: true,
+          relationTableList,
+          tableName: row.relationTable,
+          tableComment,
+          relationFieldList: [],
+          isChildren: true,
+        };
+      });
+      // this.tableFieldList = [...this.tableFieldList, ...row.relationFieldList];
+      row.disableRelaFieldName = true;
+    },
+    // 关联类型变化回调
+    relationTypeChangeHandler(row) {
+      let tempRelationFieldList = row.relationFieldList.filter((item) => {
+        return !this.tableFieldList.find((val) => val.id === item.id);
+      });
+      this.tableFieldList = [...this.tableFieldList, ...tempRelationFieldList];
+    },
+    // 关联字段回调
+    relationFieldChange(row) {
+      if (!row.relationFieldName) {
+        row.relationType = "";
+        row.disableRelaType = false;
+        row.relaFieldNameList = [];
+        return;
+      }
+      row.disableRelaType = true;
+    },
+    // 勾选框回调
+    handleSelectionChange(selection) {
+      this.ids = selection.map((item) => item.id);
+      // this.single = selection.length != 1;
+      this.multiple = !selection.length;
+    },
+    // 分页查询
+    pageList(row) {
+      this.$refs.mychild.pageList(
+        row == undefined
+          ? {
+              limit: this.queryParams.pageSize,
+              page: this.queryParams.pageNum,
+            }
+          : row
+      );
+    },
+    // 多选框改变回调
+    checkedChangeHandle(val) {},
+    // 获取所有表格
+    async getAllTable() {
+      let data = {
+        databaseName: this.databaseName,
+        databaseType: this.databaseType,
+      };
+      let res = await getFormName(data);
+      const baseTable = await this.getDicts("base_table");
+
+      this.tableList = res.data.filter((item) => {
+        return !baseTable.data.some(
+          (value) =>
+            value.dictValue.toLowerCase() == item.tableName.toLowerCase()
+        );
+      });
+    },
+    //处理表格行拖拽
+    initDragTable() {
+      const el = this.$refs.dragTable.$el.querySelectorAll(
+        ".el-table__body-wrapper > table > tbody"
+      )[0];
+      const sortable = Sortable.create(el, {
+        handle: ".allowDrag",
+        onEnd: (evt) => {
+          const targetRow = this.tableFieldList.splice(evt.oldIndex, 1)[0];
+          this.tableFieldList.splice(evt.newIndex, 0, targetRow);
+          for (let index in this.tableFieldList) {
+            this.tableFieldList[index].sort = parseInt(index) + 1;
+          }
+        },
+      });
+    },
+    // 校验字段合法性(递归版)
+    validateField(tableFieldList, validateParams) {
+      if (!tableFieldList.length) {
+        return;
+      }
+      for (let i = 0; i < tableFieldList.length; i++) {
+        let temp = tableFieldList[i];
+        if (!temp.fieldDescription?.trim() && temp.isShow) {
+          //描述字段不能为空
+          validateParams.isFieldDescrib = true;
+        }
+        if (
+          temp.relationTable &&
+          (!temp.relationFieldName || !temp.relationType)
+        ) {
+          // 关联条件不足
+          validateParams.isRelationFieldAll = true;
+        }
+        if (temp.relationFieldList.length) {
+          this.validateField(temp.relationFieldList, validateParams);
+        }
+      }
+    },
+    // 校验字段合法性(非递归版)
+    validateTableData(tableFieldList) {
+      if (!tableFieldList.length) {
+        return {
+          val: false,
+          meg: "字段个数不能为空",
+        };
+      }
+      for (let i = 0; i < tableFieldList.length; i++) {
+        let temp = tableFieldList[i];
+        if (!temp.fieldDescription?.trim() && temp.isShow) {
+          return {
+            val: false,
+            msg: "显示的字段,字段描述不能为空",
+          };
+        }
+        if (
+          temp.relationTable &&
+          (!temp.relationFieldName || !temp.relationType)
+        ) {
+          return {
+            val: false,
+            msg: "关联条件不足,请完善关联条件",
+          };
+        }
+      }
+      if (tableFieldList.filter((item) => item.isShow).length == 0) {
+        return {
+          val: false,
+          msg: "显示的字段数不能为空",
+        };
+      }
+      if (
+        tableFieldList.filter((item) => item.isExport && !item.isChildren)
+          .length == 0
+      ) {
+        return {
+          val: false,
+          msg: "导出字段中至少应有一个主表字段",
+        };
+      }
+      // 导出的字段的描述不能重复
+      let describeArr = tableFieldList
+        .filter((item) => item.isExport)
+        .map((item) => item.fieldDescription);
+      let isRepeat = false;
+      describeArr.map((item) => {
+        if (describeArr.indexOf(item) != describeArr.lastIndexOf(item)) {
+          isRepeat = true;
+        }
+      });
+      if (isRepeat) {
+        return {
+          val: false,
+          msg: "导出的字段描述不能重复",
+        };
+      }
+
+      return {
+        val: true,
+        msg: "",
+      };
+    },
+    // 递归拼接查询语句
+    getSQLString(tableFieldList, fieldArr, tableArr, sqlType = "mysql") {
+      let prefix = "{DBNAME}.";
+      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
+      for (let i = 0; i < tableFieldList.length; i++) {
+        let temp = tableFieldList[i];
+        if (temp.isShow) {
+          let tempArr = prefix + temp.tableName + "." + temp.fieldName;
+          if (temp.isChildren) {
+            tempArr += asOrSpace + temp.tableName + "_" + temp.fieldName;
+          }
+          fieldArr.push(tempArr);
+        }
+        if (temp.relationTable && temp.relationFieldName && temp.relationType) {
+          let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
+          tableArr.push(
+            temp.relationType +
+              " " +
+              isNeedUsername +
+              prefix +
+              temp.relationTable +
+              asOrSpace +
+              temp.relationTable +
+              " ON " +
+              prefix +
+              temp.relationTable +
+              "." +
+              temp.relationFieldName +
+              " = " +
+              prefix +
+              temp.tableName +
+              "." +
+              temp.fieldName
+          );
+        }
+      }
+      // 如果主键不包含显示,则添加至sql语句中
+      let isNotInclude = this.primaryKeyList.find(
+        (val) => !val.isShow && val.fieldName == this.formData.primaryKey
+      );
+      if (isNotInclude) {
+        fieldArr.push(
+          prefix + isNotInclude.tableName + "." + isNotInclude.fieldName
+        );
+      }
+    },
+    // 递归拼接查询语句
+    getSQLCountString(tableFieldList, fieldArr, tableArr, sqlType = "mysql") {
+      let prefix = "{DBNAME}.";
+      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
+      for (let i = 0; i < tableFieldList.length; i++) {
+        let temp = tableFieldList[i];
+        if (temp.isShow) {
+          let tempArr = prefix + temp.tableName + "." + temp.fieldName;
+          if (temp.isChildren) {
+            tempArr += asOrSpace + temp.tableName + "_" + temp.fieldName;
+          }
+          fieldArr.push(tempArr);
+        }
+        if (temp.relationTable && temp.relationFieldName && temp.relationType) {
+          let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
+          tableArr.push(
+            temp.relationType +
+              " " +
+              isNeedUsername +
+              prefix +
+              temp.relationTable +
+              asOrSpace +
+              temp.relationTable +
+              " ON " +
+              prefix +
+              temp.relationTable +
+              "." +
+              temp.relationFieldName +
+              " = " +
+              prefix +
+              temp.tableName +
+              "." +
+              temp.fieldName
+          );
+        }
+      }
+      // 如果主键不包含显示,则添加至sql语句中
+      let isNotInclude = this.countPrimaryKeyList.find(
+        (val) => !val.isShow && val.fieldName == this.countData.primaryKey
+      );
+      if (isNotInclude) {
+        fieldArr.push(
+          prefix + isNotInclude.tableName + "." + isNotInclude.fieldName
+        );
+      }
+    },
+    // 拼接查询sql语句
+    getSQLStr() {
+      let prefix = "{DBNAME}.";
+      let sqlType = this.databaseType; //数据库类型
+      // let sqlType = "oracle";
+      let sql = "";
+      // mysql
+      sql += "SELECT ";
+      let fieldNameArr = [],
+        relaTypeArr = [];
+      this.getSQLString(
+        this.tableFieldList,
+        fieldNameArr,
+        relaTypeArr,
+        sqlType
+      );
+      let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
+      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
+      sql +=
+        fieldNameArr.join(",") +
+        " FROM " +
+        isNeedUsername +
+        prefix +
+        this.tableName +
+        asOrSpace +
+        this.tableName;
+      if (relaTypeArr.length) {
+        sql += " " + relaTypeArr.join(" ");
+      }
+      return sql;
+    },
+    // 拼接查询sql语句
+    getSQLStr2() {
+      let prefix = "{DBNAME}.";
+      let sqlType = this.databaseType; //数据库类型
+      // let sqlType = "oracle";
+      let sql = "";
+      // mysql
+      sql += "SELECT ";
+      let fieldNameArr = [],
+        relaTypeArr = [];
+      this.getSQLString(
+        this.subFiledList,
+        fieldNameArr,
+        relaTypeArr,
+        sqlType
+      );
+      let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
+      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
+      sql +=
+        fieldNameArr.join(",") +
+        " FROM " +
+        isNeedUsername +
+        prefix +
+        this.subTableName +
+        asOrSpace +
+        this.subTableName;
+      if (relaTypeArr.length) {
+        sql += " " + relaTypeArr.join(" ");
+      }
+      return sql;
+    },
+    countGetSQLStr(){
+      let prefix = "{DBNAME}.";
+      let sqlType = this.databaseType; //数据库类型
+      // let sqlType = "oracle";
+      let sql = "";
+      // mysql
+      sql += "SELECT ";
+      let fieldNameArr = [],
+        relaTypeArr = [];
+      this.getSQLCountString(
+        this.countByFieldList,
+        fieldNameArr,
+        relaTypeArr,
+        sqlType
+      );
+      let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
+      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
+      sql +=
+        fieldNameArr.join(",") +
+        " FROM " +
+        isNeedUsername +
+        prefix +
+        this.countData.countName +
+        asOrSpace +
+        this.countData.countName;
+      if (relaTypeArr.length) {
+        sql += " " + relaTypeArr.join(" ");
+      }
+      return sql;
+    },
+    // 统计信息
+    getStaticSQL(key) {
+      let prefix = "{DBNAME}.";
+      let sqlType = this.databaseType; //数据库类型
+      // let sqlType = "oracle";
+      let sql = "";
+      // mysql
+      sql += "SELECT ";
+      let fieldNameArr = [],
+        relaTypeArr = [];
+      this.getSQLString(
+        this.subFiledList,
+        fieldNameArr,
+        relaTypeArr,
+        sqlType
+      );
+      let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
+      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
+
+      sql +=
+        key +
+        " FROM " +
+        isNeedUsername +
+        prefix +
+        this.subTableName +
+        asOrSpace +
+        this.subTableName;
+      if (relaTypeArr.length) {
+        sql += " " + relaTypeArr.join(" ");
+      }
+      return sql;
+    },
+    // 统计状态
+    getstateSQL(formName,fieldName){
+      let prefix = "{DBNAME}.";
+      let sqlType = this.databaseType; //数据库类型
+      // let sqlType = "oracle";
+      let sql = "";
+      // mysql
+      sql += "SELECT ";
+      let fieldNameArr = [],
+        relaTypeArr = [];
+      this.getSQLString(
+        this.subFiledList,
+        fieldNameArr,
+        relaTypeArr,
+        sqlType
+      );
+      let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
+      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
+
+      sql +=
+        fieldName +
+        " FROM " +
+        isNeedUsername +
+        prefix +
+        formName +
+        asOrSpace +
+        formName;
+      if (relaTypeArr.length) {
+        sql += " " + relaTypeArr.join(" ");
+      }
+      return sql;
+    },
+    // 处理列表信息
+    columnsHandler(columns) {
+      let resArr = [];
+      columns.forEach((item) => {
+        for (const key in item) {
+          let tempObj = {};
+          tempObj.key = key;
+          tempObj.value = item[key];
+          resArr.push(tempObj);
+        }
+      });
+      return resArr;
+    },
+    // 下划线命名转驼峰命名
+    toUpperCase(str) {
+      let nstr = str.replace(/(?:_)+([^_])/g, function ($0, $1) {
+        return $1.toUpperCase();
+      });
+      nstr = nstr.replace(nstr[0], nstr[0].toLowerCase());
+      return nstr;
+    },
+    // 递归获取列表信息
+    getCol(
+      tableFieldList,
+      columns,
+      searchFieldList = [],
+      tableExportField = {}
+    ) {
+      if (!tableFieldList.length) return;
+      for (let i = 0; i < tableFieldList.length; i++) {
+        let temp = tableFieldList[i];
+        let tempFieldName = "",
+          exportFieldName = "";
+        if (temp.isChildren) {
+          tempFieldName = temp.tableName + "_" + temp.fieldName;
+          exportFieldName = temp.tableName + "@" + temp.fieldName;
+        } else {
+          tempFieldName = temp.fieldName;
+          exportFieldName = temp.fieldName;
+        }
+        if (temp.isShow) {
+          let tempObj = {};
+          tempObj[tempFieldName] = temp.fieldDescription;
+          columns.push(tempObj);
+        }
+        if (temp.isSearch) {
+          searchFieldList.push(temp.tableName + "." + temp.fieldName);
+        }
+
+        if (temp.isExport) {
+          tableExportField[exportFieldName] = temp.fieldDescription;
+        }
+      }
+    },
+    // 预览结果回调
+    async previewHandle() {
+      this.$refs.formData.validate(async (valid) => {
+        // 至少包含一个查询项
+        if (valid) {
+          if (!this.tableName) {
+            this.$message.error("请选择数据表");
+            return;
+          }
+          // 检验表单合法性
+          let validRes = this.validateTableData(this.tableFieldList);
+          if (!validRes.val) {
+            this.$message.error(validRes.msg);
+            return;
+          }
+          // 拼接预览的sql查询语句
+          this.queryParams.basicMap.sql = this.getSQLStr();
+          // 获取表头信息
+          let tempColumns = [],
+            searchFieldList = [];
+          this.getCol(this.tableFieldList, tempColumns, searchFieldList);
+          if (!searchFieldList.length) {
+            this.$message.warning("请至少选择一个包含查询字段");
+            return false;
+          }
+          const dataType = await this.getDicts("table_statistic_type");
+          this.deepragTableStatisticList = JSON.parse(
+            JSON.stringify(this.dragTableStatisticList)
+          );
+          this.deepragTableStatisticList.forEach((item) => {
+            dataType.data.forEach((val) => {
+              if (val.dictValue == item.statisticType) {
+                item.statisticType = val.dictLabel;
+              }
+            });
+          });
+          this.columns = this.columnsHandler(tempColumns);
+          this.queryParams.isAsc = this.formData.isAsc;
+          // 发送请求获取预览数据
+          let res = await dragTablePreview(this.queryParams);
+          this.tableDataList = [];
+          res.rows.forEach((item) => {
+            this.tableDataList.push(item.resultMap);
+          });
+          this.total = res.total;
+          this.isShowPreview = true;
+        } else {
+          this.$message.warning("请完善表单");
+          return false;
+        }
+      });
+    },
+    // 创建回调
+    async createHandle() {
+      this.isInputInvalid = true;
+      this.$refs.formData.validate(async (valid) => {
+        if (valid) {
+          // 检验表单合法性
+          let validRes = this.validateTableData(this.tableFieldList);
+          if (!validRes.val) {
+            this.$message.error(validRes.msg);
+            return;
+          }
+
+          let relyName = ''
+          let subrelayName = ''
+          // 基础信息关联
+          let conditionDefault = {}
+          // 基础信息tableKey
+          let table1tableKey = uuidv4()
+          // 处理基础信息列数据
+          let columns1 = []
+          // 基础信息查询条件
+          let searchFieldList1 = []
+
+          this.getCol(
+            this.tableFieldList,
+            columns1,
+          );
+
+          // 基础信息回显
+          let echoData = {
+            tableName: this.tableName,
+            tableFieldData: this.tableFieldList,
+            formData: this.formData,
+          };
+          // 处理基础信息依赖表
+          this.dragTableList.forEach(item => {
+            if(item.dtName == this.formData.relytableName){
+              relyName = item.dtTableName
+            }
+          })
+
+          // 基础信息判断表格依赖方式
+          if(this.formData.relyOption === '0'){
+            conditionDefault[this.formData.relyFile] = this.relayValue
+          }else{
+            conditionDefault[this.formData.relyFile] = '#{' + relyName + '.' + this.formData.relaykey
+          }
+          // 基础信息查询条件
+          searchFieldList1.push(this.formData.relyFile)
+          // 基础信息请求数据接口
+          let tableList1 = {
+            tId: this.tId,
+            tableKey: table1tableKey, //  暂定
+            dtTableName: this.tableName,
+            primaryKey: this.formData.primaryKey,
+            orderByColumn: this.formData.orderByColumn,
+            sortOrder: this.formData.isAsc,
+            sqlKey: uuidv4(),
+            dtColumnName: columns1, //列字
+            timeFormat: this.formData.timeFormate,
+            searchFieldList: searchFieldList1,//搜索字段数组
+            tableSql: this.getSQLStr(), //  暂定
+            echoData: JSON.stringify(echoData),
+            conditionDefaultValueMap: conditionDefault
+          }
+          // 基础信息绑定按钮
+          tableList1.dragTableBtnRelevanceList = this.getBtnMapList(
+            tableList1.tableKey
+          );
+
+          // 关联子表回显
+          let echoData2 = {
+            tableName: this.subTableName,
+            tableFieldData: this.subFiledList,
+            formData: this.subformData,
+          };
+          // 处理关联子表依赖表
+          this.dragTableList.forEach(item => {
+            if(item.dtName == this.subformData.relytableName){
+              subrelayName = item.dtTableName
+            }
+          })
+
+          let subCondition = {}
+           // 判断表格依赖方式
+           if(this.subformData.relyOption === '0'){
+            subCondition[this.subformData.relyFile] =this.subformData.relayValue
+            }else{
+              subCondition[this.subformData.relyFile] = '#{' + subrelayName + '.' + this.subformData.relaykey
+            }
+          // 关联子表类信息
+          let columns2 = [],searchFieldList2=[]
+          this.getCol(
+            this.subFiledList,
+            columns2,
+          );
+          let table2tableKey = uuidv4()
+          searchFieldList2.push(this.subformData.relyFile)
+
+          // 关联子表请求数据
+          let tableList2 ={
+            tId: this.tId,
+            tableKey: table2tableKey, //  暂定
+            dtTableName: this.subTableName,
+            primaryKey: this.subformData.primaryKey,
+            orderByColumn: this.subformData.orderByColumn,
+            sortOrder: this.subformData.isAsc,
+            sqlKey: uuidv4(),
+            dtColumnName: columns2, //列字
+            timeFormat: this.subformData.timeFormate,
+            searchFieldList: searchFieldList2, //搜索字段数组
+            tableSql: this.getSQLStr2(), //  暂定
+            echoData: JSON.stringify(echoData2),
+            conditionDefaultValueMap: subCondition,
+          }
+
+          tableList2.dragTableBtnRelevanceList = this.getBtnMapList(
+            tableList2.tableKey
+          );
+
+          // 统计信息
+          let countEchoData = {
+            formData: this.countData,
+            tableFieldData: this.countFieldList,
+          };
+          let conutrelayName = ''
+
+          // 处理关联子表依赖表
+          this.dragTableList.forEach(item => {
+            if(item.dtName == this.countData.relytableName){
+              conutrelayName = item.dtTableName
+            }
+          })
+          let countFieldLists = []
+          countFieldLists.push(this.countData.relyFile)
+          let countTableKey = uuidv4()
+          let conutCondition = {}
+           // 判断表格依赖方式
+       
+          conutCondition[this.countData.relyFile] = '#{' + conutrelayName + '.' + this.countData.relaykey
+      
+          // 数据统计表格参数
+          let countTableList ={
+            tId: this.tId,
+            tableKey: countTableKey, //  暂定
+            dtTableName: this.countData.countName,
+            primaryKey: this.countData.primaryKey,
+            orderByColumn: '',
+            sortOrder: '',
+            sqlKey: uuidv4(),
+            dtColumnName: '', //列字
+            timeFormat:'',
+            searchFieldList: countFieldLists, //搜索字段数组
+            tableSql: this.countGetSQLStr(), 
+            echoData: JSON.stringify(countEchoData),
+            conditionDefaultValueMap: conutCondition,
+          }
+          countTableList.dragTableBtnRelevanceList = this.getBtnMapList(
+            countTableList.tableKey
+          );
+          let stateSqlkey = uuidv4()
+          let stateList = [{
+            sqlKey: stateSqlkey,
+            statisticTitle: this.countData.title,
+            statisticField: this.countData.relaykey,
+            statisticType: "等值",
+          }]
+          let stateSql;
+          let stateSqlList;
+          let stateName = ''
+          // console.log(this.dragTableList)
+          // console.log(this.dragTableList);
+          // 统计状态信息
+          let search = []
+          let conditionDefaultValueMap = {}
+          this.dragTableList.forEach(async item => {
+           
+            if(item.dtName == this.countData.relytableName){
+
+              console.log(123);
+              const info = await dragTableInfo({queryMap: {tableKey : item.tableKey }})
+              console.log('info', info);
+              let infoSql = info.data.resultMap.querySql.tableSql
+
+              let state = this.getTableSql(infoSql,this.countData.relaykey)
+
+              // stateSql = state + ' where ' + item.dtTableName + '.' + item.primaryKey + ' = #{' + item.dtTableName + '.' +  item.primaryKey
+
+              stateSql = state
+              search.push(item.dtTableName + '.' + item.primaryKey)
+              // console.log('sql', stateSql);
+              conditionDefaultValueMap[item.dtTableName + '.' + item.primaryKey]=' #{' + item.dtTableName + '.' +  item.primaryKey
+              stateSqlList = [{
+                  sqlKey: stateSqlkey,
+                  tableSql : stateSql
+              }]
+
+              stateName = item.dtTableName
+            }
+           
+          })
+          
+          // 统计信息
+          this.dragTableStatisticList.forEach((item) => {
+              if (this.tId == "") {
+                item.tableKey = tableList2.tableKey;
+                this.staticSqlKey = uuidv4();
+                item.sqlKey = this.staticSqlKey;
+              }
+              if (item.sqlKey) {
+                this.staticSqlKey = item.sqlKey;
+              } else {
+                this.staticSqlKey = uuidv4();
+                item.sqlKey = this.staticSqlKey;
+              }
+
+          
+              let key =
+              item.statisticType +
+              "(" +
+              item.statisticField +
+              ")" +
+              " as result";
+
+              this.tableSqlList.push({
+                tableSql: this.getStaticSQL(key),
+                sqlKey: this.staticSqlKey,
+              });
+              
+             
+              // this.searchFieldList = searchFieldList;
+          });
+
+          let res;
+          let res1;
+          // 判断修改还是新增
+          if(this.tId){
+            // console.log('修改');
+            // console.log(this.editData);
+            tableList1.sqlKey = this.editData.sqlKey
+            tableList1.tableKey = this.editData.tableKey
+
+
+            tableList2.tableKey = this.subEchoData.tableKey
+            tableList2.sqlKey = this.subEchoData.sqlKey
+
+            tableList2.dragTableBtnRelevanceList = this.getBtnMapList(this.subEchoData.tableKey);
+
+            tableList1.dragTableBtnRelevanceList = this.getBtnMapList(this.echoData.sqlKey);
+
+            countTableList.tableKey = this.countEchoData.tableKey
+            countTableList.sqlKey = this.countEchoData.sqlKey
+            countTableList.dragTableBtnRelevanceList = this.getBtnMapList(this.countEchoData.sqlKey);
+
+          let data = {
+            id : this.tId,
+            groupType : 1,
+            groupKey: this.groupKey,
+            groupName: this.formData.groupName,
+            groupDescription: this.formData.groupDescription,
+            groupTableInfo: [],
+            dragTables:[]
+          }
+          data.groupTableInfo.push({
+            tableKey: tableList1.tableKey,
+            sort:0
+          },{
+            tableKey: tableList2.tableKey,
+            sort:1
+          },{
+            tableKey: countTableList.tableKey,
+            sort:2
+          })
+          data.groupTableInfo = JSON.stringify(data.groupTableInfo)
+          data.dragTables.push(tableList1,tableList2,countTableList)
+
+          res = await undataDialogGroup(data)
+
+          this.dragTableStatisticList.forEach((item) => {
+            item.tableKey = this.subEchoData.tableKey;
+          });
+
+          console.log('回显', this.statusCount);
+          stateList.forEach((item) => {
+            item.id = this.statusCount.id
+            item.sqlKey = this.statusCount.sqlKey
+            item.tableKey = this.statusCount.tableKey;
+          });
+          // 修改统计数据
+          await updateStatistic({
+            tableKey: this.subEchoData.tableKey,
+            dragTableStatisticList: this.dragTableStatisticList,
+            tableSqlList: this.tableSqlList,
+            searchFieldList: searchFieldList2,
+            dtTableName: this.subTableName,
+          });
+
+          // 修改统计状态
+          await updateStatistic({
+            tableKey: this.countEchoData.tableKey,
+            dragTableStatisticList: stateList,
+            tableSqlList: stateSqlList,
+            searchFieldList: search,
+            dtTableName: stateName,
+            conditionDefaultValueMap: conditionDefaultValueMap
+          });
+          }else{
+          // 统计信息
+          let graguuid = uuidv4()
+          let statusuuid = uuidv4()
+          let uuid = uuidv4()
+          this.dragTableStatisticList.forEach((item) => {
+              item.tableKey = tableList2.tableKey;
+          });
+          stateList.forEach(item => {
+            item.tableKey = countTableList.tableKey;
+          })
+          // 新增操作
+          let groupKeyObj = { groupKey: uuid};
+          let data = {
+            groupType : 1,
+            groupKey: groupKeyObj.groupKey,
+            groupName: this.formData.groupName,
+            groupDescription: this.formData.groupDescription,
+            groupTableInfo: [],
+            dragTables:[]
+          }
+          data.groupTableInfo.push({
+            tableKey: tableList1.tableKey,
+            sort:0
+          },{
+            tableKey: tableList2.tableKey,
+            sort:1
+          },{
+            tableKey: countTableList.tableKey,
+            sort:2
+            }
+          )
+          data.groupTableInfo = JSON.stringify(data.groupTableInfo)
+          data.dragTables.push(tableList1,tableList2,countTableList)
+
+           res = await addDialogGroup(data)
+
+           console.log('统计', stateList);
+           console.log(stateSqlList);
+          //  统计数据
+          addStatistic({
+                tableKey: tableList2.tableKey,
+                dragTableStatisticList: this.dragTableStatisticList,
+                tableSqlList: this.tableSqlList,
+                searchFieldList: searchFieldList2,
+                dtTableName: this.subTableName,
+            });
+
+            // 统计状态
+          addStatistic({
+                tableKey: countTableList.tableKey,
+                dragTableStatisticList: stateList,
+                tableSqlList: stateSqlList,
+                searchFieldList: search,
+                dtTableName: stateName,
+                conditionDefaultValueMap: conditionDefaultValueMap
+            });
+          }
+
+          if (this.tId) {
+            if (res.code == 200) {
+              this.$message.success("修改成功");
+            } else {
+              this.$message.warning("修改失败");
+            }
+            this.$tab.closePage();
+            this.$router.push({
+              path: "/system/fromModel/index/tableDialog",
+            });
+          } else {
+            if (res.code == 200) {
+              this.$message.success("创建成功");
+            } else {
+              this.$message.warning("创建失败");
+            }
+            this.isShowPreview = false;
+          }
+
+        } else {
+          this.$message.warning("请完善表单");
+          return false;
+        }
+      });
+    },
+    getBtnMapList(tableKey) {
+      let res = this.formData.btnGroupList.map((item) => {
+        return {
+          tableKey,
+          btnKey: item,
+        };
+      });
+      return res;
+    },
+    iptChange(){
+	    this.$forceUpdate();  //强制刷新
+    },
+    // 处理统计sql语句
+    getTableSql(sql, key){
+      // console.log(key);
+      let Sql;
+      let arrSql = sql.split('FROM')
+      // console.log(arrSql);
+
+      let fromFields = arrSql[1].split('AS')
+      
+      let tableArr = []
+      fromFields.forEach((item, index) => {
+        if(index !== 0){
+          let arr = item.trim().split(' ')
+          tableArr.push(arr[0])
+        }
+      })
+      tableArr.forEach((item, index) => {
+        if(key.includes(item)){
+          // let keyfileld = keyarr[keyarr]
+          let str = key.substring(item.length + 1)
+          // Sql = 'SELECT ' + item +'.' + str + 'as result ' + ' FROM' + arrSql[1]
+          console.log('表名', this.countData.countName);
+          console.log('zidaun', this.countData.countFile)
+          Sql = 'SELECT ' + this.countData.countName +'.' + this.countData.countFile + ' as result ' + ' FROM' + arrSql[1]
+        }
+      })
+      console.log('sql', Sql);
+      return Sql 
+    },
+    // 修改表格回显数据
+    async initTableData(tId) {
+      let res = await getTable({id : tId});
+      // console.log(res);
+      if (res.code == 200) {
+        this.groupKey = res.data.groupKey
+        let lists = res.data.dragTables
+
+        this.formData.groupName =  res.data.groupName
+        this.formData.groupDescription = res.data.groupDescription
+
+        let groupInfo =JSON.parse(res.data.groupTableInfo)
+
+        lists.forEach(async item => {
+          if(item.tableKey == groupInfo[0].tableKey){
+            this.editData = item;
+            // console.log('123',this.editData);
+            let echoData = JSON.parse(item.echoData);
+              this.tableName = echoData.tableName;
+              this.tableFieldList = echoData.tableFieldData;
+              let {
+                timeFormate,
+                orderByColumn,
+                isAsc,
+                primaryKey,
+                btnGroupList,
+                relyFile,
+                relytableName,
+                relaykey,
+                relyOption
+              } = echoData.formData;
+              Object.assign(this.formData, {
+                timeFormate,
+                orderByColumn,
+                isAsc,
+                primaryKey,
+                btnGroupList,
+                relyFile,
+                relytableName,
+                relaykey,
+                relyOption
+              }); 
+
+          }else if(item.tableKey == groupInfo[1].tableKey){
+            let res = await getTableInfo(item.tId);
+
+            // console.log('tji', res);
+            this.subEchoData = item
+            this.echoData = JSON.parse(item.echoData);
+            console.log(this.echoData);
+            this.subTableName = this.echoData.tableName
+            this.subFiledList = this.echoData.tableFieldData; 
+            this.dragTableStatisticList = res.data.dragTableStatisticList;
+
+          }else if(item.tableKey == groupInfo[2].tableKey){
+
+            let res = await getTableInfo(item.tId);
+            // console.log('统计', res.data);
+            this.statusCount = res.data.dragTableStatisticList[0]
+
+            // console.log('zhuangt', res);
+            let echoData = JSON.parse(item.echoData);
+            this.countFieldList =  echoData.tableFieldData;
+            // console.log('echo123', echoData);
+
+            this.countData.title =  this.statusCount.statisticTitle
+            // this.countData.relaykey = this.statusCount.statisticField
+            this.countEchoData = item
+            console.log(this.countEchoData);
+            // this.dragTableStatisticList = []
+            let {
+              relaykey,
+              btnGroupList,
+              countName,
+              primaryKey,
+              relyFile,
+              countFile,
+              relytableName,
+              } = echoData.formData;
+              Object.assign(this.countData, {
+                relaykey,
+                btnGroupList,
+                countName,
+                primaryKey,
+                relyFile,
+                countFile,
+                relytableName,
+              }); 
+          }
+
+          await this.getdragTable()
+
+        })
+ 
+        this.getrelyList()
+
+        this.getCountrelyList()
+      } else {
+        this.$message.error("数据回显失败");
+      }
+    },
+    // tab切换
+    tabhandleClick(tab,event) {
+
+      this.tabIndex = tab.index
+      if(this.tabIndex == '2'){
+        this.getCountrelyList()
+
+      }
+      this.menudata = this.activeName != "menuedit" ? true : false;
+    },
+    // 添加数据字段对话框
+    async addDataDialog() {
+      this.staictitle = "添加统计数据字段";
+      this.isShowAddData = true;
+      this.dataType = await this.getDicts("table_statistic_type");
+
+      this.dataType = this.dataType.data;
+      // console.log(this.dataType)
+    },
+    async updataDialog() {
+      // console.log(this.dataType)
+    },
+    // 修改数据字段
+    upadtaData() {
+      this.dragTableStatisticList.forEach((item, index) => {
+        // console.log(this.dataCountFormData);
+        if (item.id !== undefined && item.id == this.dataCountFormData.id) {
+          this.dragTableStatisticList[index] = this.dataCountFormData;
+        } else if (item.xid == this.dataCountFormData.xid) {
+          this.dragTableStatisticList[index] = this.dataCountFormData;
+        }
+      });
+      this.isShowAddData = false;
+      // console.log(this.dragTableStatisticList)
+      this.dataCountFormData = {};
+    },
+    // 添加数据字段
+    addData() {
+      // console.log(this.dataCountFormData);
+      this.dataCountFormData.xid = Date.now();
+      this.dataCountFormData.tableKey = this.tableKey;
+      this.dragTableStatisticList.push(this.dataCountFormData);
+      this.isShowAddData = false;
+      this.dataCountFormData = {};
+    },
+    // 关闭添加数据字段
+    closeAddDialog() {
+      this.isShowAddData = false;
+      this.dataCountFormData = {};
+    },
+    // 修改统计信息
+    async handleUpdateStat(row) {
+      // console.log(row);
+      this.dataCountFormData = row;
+      this.dataCountFormData.xid = Date.now();
+      this.staictitle = "修改统计数据字段";
+      this.dataType = await this.getDicts("table_statistic_type");
+      this.dataType = this.dataType.data;
+      this.isShowAddData = true;
+      // console.log(this.dataCountFormData)
+      // console.log(this.dragTableStatisticList);
+    },
+    // 删除统计信息
+    handleDeleteStat(row) {
+      this.dragTableStatisticList.forEach((item, index) => {
+        if (item.id == row.id) {
+          this.dragTableStatisticList.splice(index, 1);
+        }
+      });
+    },
+    // 获取当前表描述
+    getTableCommont(tableName, tableList) {
+      return tableList.find((item) => item.tableName == tableName).tableComment;
+    },
+    // 获取按钮组数据
+    async getBtnList() {
+      let res = await listBtn({ isEnablePaging: false, btnParentId: 0 });
+      this.btnGroupOptions = res.rows;
+    },
+  },
+  created() {},
+  async mounted() {
+    await this.getAllTable();
+    this.getdragTable()
+    this.initDragTable();
+    this.getBtnList();
+    this.getDictType();
+    // await this.getMenuList();
+    if (this.$route.query.tId) {
+      this.tId = this.$route.query.tId;
+      this.initTableData(this.tId);
+    }
+  },
+};
+</script>
+
+<style scoped lang="scss">
+.ipt {
+  height: 36px;
+  line-height: 36px;
+  font-size: 14px;
+  width: 100%;
+  outline: none;
+  text-align: center;
+  background-color: #fff;
+  border: 1px solid #dcdfe6;
+  color: #606266;
+  display: inline-block;
+  border-radius: 4px;
+}
+.isNullDesc {
+  border-color: #ff4949 !important;
+}
+
+.ipt:focus {
+  border-color: #1890ff;
+}
+::v-deep .right_card {
+  min-height: 500px !important;
+}
+::v-deep .vue-treeselect--has-value .vue-treeselect__input {
+  vertical-align: middle !important;
+}
+.menudata {
+  width: 30% !important;
+}
+.edit {
+  width: 70% !important;
+}
+.mb10 {
+  margin-top: 10px;
+}
+.cardBox {
+  display: flex;
+  align-content: space-between;
+  flex-wrap: wrap;
+  align-content: flex-start;
+}
+.card {
+  /* width:15%; */
+  height: 150px;
+  flex-basis: 15%;
+  margin-bottom: 10px;
+  margin-right: 15px;
+  min-width: 180px;
+  .title {
+    /* width:20%; */
+    font-size: 18px;
+    margin-bottom: 5px;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+  }
+  .description {
+    width: 70%;
+    font-size: 13px;
+    color: #9699a2;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    -webkit-line-clamp: 3;
+    word-break: break-all;
+    float: left;
+  }
+  .type {
+    float: right;
+    margin-top: 40px;
+    .statisticType {
+      font-size: 18px;
+    }
+  }
+  .count {
+    font-size: 25px;
+  }
+}
+.mb8 {
+  ::v-deep .el-col-18 {
+    width: 30% !important;
+    min-width: 220px !important;
+  }
+  ::v-deep .previewbtn {
+    min-width: 190px !important;
+  }
+}
+.addcount{
+  margin-bottom: 5px;
+}
+</style>

+ 465 - 0
ruoyi-ui/src/views/dialogMange/styleMange/index.vue

@@ -0,0 +1,465 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="68px"
+    >
+      <el-form-item label="样式key" prop="styleKey">
+        <el-input
+          v-model="queryParams.styleKey"
+          placeholder="请输入样式key"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="样式名称" prop="styleName">
+        <el-input
+          v-model="queryParams.styleName"
+          placeholder="请输入样式名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="样式描述" prop="styleDescription">
+        <el-input
+          v-model="queryParams.styleDescription"
+          placeholder="请输入样式描述"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建者ID" prop="createById">
+        <el-input
+          v-model="queryParams.createById"
+          placeholder="请输入创建者ID"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="更新者ID" prop="updateById">
+        <el-input
+          v-model="queryParams.updateById"
+          placeholder="请输入更新者ID"
+          clearable
+          @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-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
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['system:style:add']"
+          >新增</el-button
+        >
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['system:style:edit']"
+          >修改</el-button
+        >
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['system:style:remove']"
+          >删除</el-button
+        >
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['system:style:export']"
+          >导出</el-button
+        >
+      </el-col>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
+    </el-row>
+
+    <el-table
+      v-loading="loading"
+      stripe
+      :data="styleList"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="编号" align="center" prop="id" />
+      <!-- <el-table-column label="样式key" align="center" prop="styleKey" /> -->
+      <el-table-column label="样式名称" align="center" prop="styleName" />
+      <el-table-column label="样式类型" align="center" prop="styleType">
+        <template slot-scope="scope">
+          {{ theGetDictLabel(scope.row.styleType, dict.type.table_style_type) }}
+        </template>
+      </el-table-column>
+      <!-- <el-table-column label="样式代码" align="center" prop="styleCode" /> -->
+      <el-table-column
+        label="样式描述"
+        align="center"
+        prop="styleDescription"
+      />
+      <!-- <el-table-column label="样式状态" align="center" prop="styleStatus" /> -->
+      <!-- <el-table-column label="创建者ID" align="center" prop="createById" />
+      <el-table-column label="更新者ID" align="center" prop="updateById" /> -->
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['system:style:edit']"
+            >修改</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['system:style:remove']"
+            >删除</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改动态格样式模板对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <!-- <el-form-item label="样式key" prop="styleKey">
+          <el-input v-model="form.styleKey" placeholder="请输入样式key" />
+        </el-form-item> -->
+        <el-form-item label="样式名称" prop="styleName">
+          <el-input v-model="form.styleName" placeholder="请输入样式名称" />
+        </el-form-item>
+        <el-form-item label="样式类型" prop="styleType">
+          <el-select
+            v-model="form.styleType"
+            placeholder="请选择样式类型"
+            filterable
+          >
+            <el-option
+              v-for="item in dict.type.table_style_type"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="样式代码" prop="styleCode">
+          <el-input
+            v-model="form.styleCode"
+            type="textarea"
+            placeholder="请输入内容"
+          />
+          <!-- <el-button icon="el-icon-edit" @click="drawerOpenHandler"></el-button> -->
+        </el-form-item>
+        <el-form-item label="样式描述" prop="styleDescription">
+          <el-input
+            v-model="form.styleDescription"
+            placeholder="请输入样式描述"
+          />
+        </el-form-item>
+        <!-- <el-form-item label="删除标志" prop="delFlag">
+          <el-input v-model="form.delFlag" placeholder="请输入删除标志" />
+        </el-form-item>
+        <el-form-item label="创建者ID" prop="createById">
+          <el-input v-model="form.createById" placeholder="请输入创建者ID" />
+        </el-form-item>
+        <el-form-item label="更新者ID" prop="updateById">
+          <el-input v-model="form.updateById" placeholder="请输入更新者ID" />
+        </el-form-item> -->
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-drawer
+      :visible.sync="drawer"
+      direction="rtl"
+      :before-close="drawerHandleClose"
+      :with-header="false"
+    >
+      <div ref="container" class="monaco-container"></div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import {
+  listStyle,
+  getStyle,
+  delStyle,
+  addStyle,
+  updateStyle,
+} from "@/api/system/style";
+import { getDictLabel } from "@/utils/other";
+import * as monaco from "monaco-editor";
+
+export default {
+  name: "StyleMange",
+  dicts: ["table_style_type"],
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 动态格样式模板表格数据
+      styleList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        styleKey: null,
+        styleName: null,
+        styleType: null,
+        styleCode: null,
+        styleDescription: null,
+        styleStatus: null,
+        createById: null,
+        updateById: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        styleName: [
+          { required: true, message: "请输入样式名", trigger: "blur" },
+        ],
+        styleType: [
+          { required: true, message: "请选择样式类型", trigger: "change" },
+        ],
+        styleCode: [
+          { required: true, message: "请输入样式代码", trigger: "blur" },
+        ],
+        styleDescription: [
+          { required: true, message: "请输入样式样式描述", trigger: "blur" },
+        ],
+      },
+      // 代码编辑器
+      monacoEditor: null,
+      drawer: false,
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询动态格样式模板列表 */
+    getList() {
+      this.loading = true;
+      listStyle(this.queryParams).then((response) => {
+        this.styleList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        styleKey: null,
+        styleName: null,
+        styleType: null,
+        styleCode: null,
+        styleDescription: null,
+        styleStatus: null,
+        delFlag: null,
+        createBy: null,
+        createById: null,
+        createTime: null,
+        updateBy: null,
+        updateById: null,
+        updateTime: null,
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map((item) => item.id);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加动态格样式模板";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids;
+      getStyle(id).then((response) => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改动态格样式模板";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateStyle(this.form).then((response) => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addStyle(this.form).then((response) => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal
+        .confirm('是否确认删除动态格样式模板编号为"' + ids + '"的数据项?')
+        .then(function () {
+          return delStyle(ids);
+        })
+        .then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download(
+        "system/style/export",
+        {
+          ...this.queryParams,
+        },
+        `style_${new Date().getTime()}.xlsx`
+      );
+    },
+    theGetDictLabel(value, dictList) {
+      return getDictLabel(value, dictList);
+    },
+    // 抽屉打开回调
+    drawerOpenHandler() {
+      this.monacoEditor?.dispose();
+      this.drawer = true;
+      this.$nextTick(() => {
+        this.monacoEditor = monaco.editor.create(this.$refs.container, {
+          value: this.form.styleCode,
+          language: "css",
+          theme: "vs-dark", // 编辑器主题:vs, hc-black, or vs-dark,更多选择详见官网
+          contextmenu: false, // 禁用右键菜单
+          editorOptions: this.editorOptions, // 同codes
+        });
+      });
+    },
+    // 抽屉关闭前回调
+    drawerHandleClose(done) {
+      this.$confirm("即将关闭编辑器,是否保存代码?")
+        .then(
+          (val) => {
+            this.form.styleCode = this.monacoEditor?.getValue();
+            // this.drawer = false;
+            done();
+          },
+          (res) => {
+            // this.drawer = false;
+            done();
+          }
+        )
+        .catch(() => {});
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.monaco-container {
+  width: 100%;
+  height: 100%;
+}
+</style>

+ 1151 - 0
ruoyi-ui/src/views/dialogMange/styleMange/tablelist.vue

@@ -0,0 +1,1151 @@
+<template>
+  <div>
+    <el-card shadow="always" :body-style="{ padding: '20px' }">
+          <template #header>
+            <div>
+              <span>关联子表</span>
+            </div>
+          </template>
+          <el-select
+            v-model="tableName"
+            placeholder="请选择数据表"
+            filterable
+            @change="getList"
+            class="mb10"
+          >
+          <el-option
+            v-for="item in tableList"
+            :key="item.tableName"
+            :label="item.tableComment"
+            :value="item.tableName"
+          >
+            <span style="float: left">{{ item.tableComment }}</span>
+            <span style="float: right; color: #8492a6; font-size: 13px">{{
+              item.tableName
+            }}</span>
+          </el-option>
+          </el-select>
+          <el-table
+            :data="tableFieldList"
+            border
+            ref="dragTable"
+            row-key="id"
+            max-height="500px"
+          >
+            >
+            <el-table-column
+              type="index"
+              label="序号"
+              width="50"
+              class-name="allowDrag"
+            >
+            </el-table-column>
+            <el-table-column prop="fieldName" label="数据字段">
+            </el-table-column>
+            <el-table-column prop="fieldDescription" label="字段描述">
+              <template slot-scope="scope">
+                <input
+                @input="iptChange()"
+                  :class="{
+                    isNullDesc:
+                      scope.row.fieldDescription == '' &&
+                      scope.row.isShow &&
+                      isInputInvalid
+                        ? true
+                        : false,
+                    ipt: true,
+                  }"
+                  v-model="scope.row.fieldDescription"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column prop="relationTable" label="关联表">
+              <template slot-scope="scope">
+                <el-select
+                @input="iptChange()"
+                  v-model="scope.row.relationTable"
+                  :disabled="
+                    !scope.row.relationTableList ||
+                    !scope.row.relationTableList.length
+                  "
+                  placeholder="请选择关联的表"
+                  clearable
+                  filterable
+                  @change="ralationTableChange(scope.row)"
+                >
+                  <el-option
+                    v-for="item in scope.row.relationTableList"
+                    :key="item.tableName"
+                    :label="item.tableComment"
+                    :value="item.tableName"
+                  >
+                    <span style="float: left">{{ item.tableComment }}</span>
+                    <span
+                      style="float: right; color: #8492a6; font-size: 13px"
+                      >{{ item.tableName }}</span
+                    >
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column prop="relationFieldName" label="关联条件字段">
+              <template slot-scope="scope">
+                <el-select
+                  v-model="scope.row.relationFieldName"
+                  @change="relationFieldChange(scope.row)"
+                  :disabled="!scope.row.disableRelaFieldName"
+                  placeholder="关联字段"
+                  filterable
+                >
+                  <el-option
+                    v-for="item in scope.row.relaFieldNameList"
+                    :key="item.fieldName"
+                    :label="item.fieldDescription"
+                    :value="item.fieldName"
+                  >
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column prop="relationType" label="关联方式">
+              <template slot-scope="scope">
+                <el-select
+                  v-model="scope.row.relationType"
+                  placeholder="请选择关联方式"
+                  :disabled="!scope.row.disableRelaType"
+                  @change="relationTypeChangeHandler(scope.row)"
+                  filterable
+                >
+                  <el-option
+                    v-for="item in relaTypeList"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column prop="isShow" label="是否显示">
+              <template slot-scope="scope">
+                <el-switch v-model="scope.row.isShow"> </el-switch>
+              </template>
+            </el-table-column>
+           
+          </el-table>
+    </el-card>
+  </div>
+</template>
+
+<script>
+import {
+  delTableData,
+  dragTableInfo,
+  listTable,
+  unionListTableData,
+  getInfoBySqlKey,
+  addTableData,
+  addStatistic,
+  updateStatistic,
+} from "@/api/tablelist/commonTable";
+import { getDicts } from "@/api/system/dict/data";
+import {
+  getFormName,
+  getListName,
+  dragTablePreview,
+} from "@/api/dragform/form.js";
+import { getTableInfo, editTable } from "@/api/system/table.js";
+import { addDragTable } from "@/api/tablelist/commonTable.js";
+import { getParticMenu, updateMenu } from "@/api/system/menu.js";
+import { addGroup, listGroup, getTable, delGroup, updataGroup} from '@/api/relateTable/index.js'
+import { getMenuList, addMenu } from "@/api/menu.js";
+import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
+import { mapState } from "vuex";
+import Sortable from "sortablejs";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { v4 as uuidv4 } from "uuid";
+import { listBtn } from "@/api/system/btn";
+export default {
+  name: "SubList",
+  dicts: ["sys_time_format", "table_statistic_type"],
+  props: ['menudata','echoName','echoList'],
+  components: { Queryfrom, Treeselect },
+  data() {
+    return {
+      staictitle: "添加统计数据字段",
+      isInputInvalid: false,
+      // 修改表格时的menuId
+      menuId: "",
+      // 修改表格的id
+      tId: "",
+      // 当前模板信息
+      templateInfo: {},
+      // 排序方式 默认降序
+      sortState: true,
+      // 列信息
+      columns: {},
+      // 查询条件
+      queryFromWhere: {},
+      // 当前table唯一标识
+      sqlKey: "",
+      // 动态数据sqlkey
+      staticSqlKey: "",
+      // 表格的高度
+      tableKey: "",
+      // tableHeight: document.documentElement.scrollHeight - 245 + "px",
+      tableList: [], //所有表格列表
+      tableFieldList: [], // 当前表格字段数据
+      tableName: "", // 当前表名称
+
+      relationTableList: [], //关联表格列表
+      relationFieldList: [], //关联字段列表
+      relationTypeList: [], //关联方式列表
+      total: 0, //表格数据总数
+      relyOptions:[
+        {
+         value: '0',
+         label: '自定义依赖值'
+        },
+        {
+          value: '1',
+          label: '依赖其他字段'
+        }
+      ],
+      conditionDefaultValueMap: '',
+      relyFileds: {},
+      relaTypeList: [
+        {
+          label: "等值连接",
+          value: "INNER JOIN",
+        },
+        {
+          label: "左连接",
+          value: "LEFT JOIN",
+        },
+        {
+          label: "右连接",
+          value: "RIGHT JOIN",
+        },
+      ],
+      headerList: [
+        {
+          prop: "fieldName",
+          label: "数据字段",
+        },
+        {
+          prop: "fieldDescription",
+          label: "字段描述",
+        },
+        {
+          prop: "relationTable",
+          label: "关联表",
+        },
+        {
+          prop: "relationFieldName",
+          label: "关联字段",
+        },
+        {
+          prop: "relationType",
+          label: "关联方式",
+        },
+        {
+          prop: "isShow",
+          label: "是否显示",
+        },
+        {
+          prop: "isSearch",
+          label: "是否包含查询",
+        },
+        {
+          prop: "isExport",
+          label: "是否导出",
+        },
+        {
+          prop: "isCount",
+          label: "是否统计",
+        },
+      ], //表头列表
+
+      // 基础信息编辑
+      formData: {
+        menuName: "",
+        routePath: undefined,
+        isShowList: true,
+        timeFormate: "",
+        orderByColumn: "",
+        isAsc: false,
+        primaryKey: "",
+        btnGroupList: [],
+      },
+      // 统计信息
+      countData: {},
+      rules: {
+        menuName: [
+          { required: true, message: "请输入菜单名称", trigger: "blur" },
+        ],
+        routePath: [
+          { required: true, message: "请选择路由", trigger: "change" },
+        ],
+        timeFormate: [
+          { required: true, message: "请选择时间格式", trigger: "change" },
+        ],
+        primaryKey: [
+          { required: true, message: "请选择表格主键", trigger: "blur" },
+        ],
+        fieldDescription: [
+          { required: true, message: "请输入字段描述", trigger: "blur" },
+        ],
+      },
+      menus: [], //路由列表数据
+
+      // 预览弹窗相关
+      isShowPreview: false, //弹窗显示与隐藏
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        orderByColumn: "",
+        isAsc: false,
+        basicMap: {
+          sql: "",
+        },
+      },
+      loading: false, //表格加载
+      tableDataList: [], //数据
+      editData: {},
+      menuOrderNum: 0,
+      // tab动态切换
+      activeName: "menuedit",
+      // 数据统计对象
+      dataCountFormData: {},
+      // 添加数据统计表格
+      dragTableStatisticList: [],
+      deepragTableStatisticList: [],
+      tableSqlList: [],
+      searchFieldList: [],
+      // // 是否切换到数据统计
+      // menudata: false,
+      // 显示添加字段对话框dataArr
+      isShowAddData: false,
+      dataType: [],
+      uuid: "",
+
+      // 样式编辑tab数据
+      // dragTableStyleList: [],
+
+      //操作列按钮组数据
+      btnGroupOptions: [],
+    };
+  },
+  async mounted() {
+    this.getAllTable();
+    this.initDragTable();
+    this.getBtnList();
+    if (this.$route.query.tId) {
+      this.tId = this.$route.query.tId;
+      this.initTableData(this.tId);
+    }
+  },
+  computed: {
+    ...mapState({
+      databaseName: (state) => state.user.dataSource.databaseName,
+      databaseType: (state) => state.user.dataSource.databaseType,
+      username: (state) => state.user.dataSource.username,
+      tenantId: (state) => state.user.tenant.tenantId,
+    }),
+    searchArr() {
+      if (!this.templateInfo?.where?.length) return [];
+      return this.templateInfo.where.map((item) => item.conditionName);
+    },
+    checkedWhere() {
+      if (!this.templateInfo?.where?.length) return [];
+      return this.templateInfo?.where.filter((item) => {
+        return this.checkedList.includes(item.conditionName);
+      });
+    },
+    orderByFieldList() {
+      return this.tableFieldList;
+    },
+    primaryKeyList() {
+      return this.tableFieldList.filter((item) => !item.isChildren);
+    },
+
+  },
+  watch: {
+    tableName: function (val) {
+      if (val) {
+        this.relationTableList = this.tableList
+          .filter((item) => item.tableName != val)
+          .map((item) => {
+            return {
+              tableName: item.tableName,
+              tableComment: item.tableComment,
+            };
+          });
+
+          this.$emit('tableNameChange', 
+          this.tableName)
+      } else {
+        this.relationTableList = [];
+      }
+    },
+    "formData.routePath"(nval, oval) {
+      let targetMenu = this.getTargetMenu(this.menus);
+      this.menuOrderNum = targetMenu.children ? targetMenu.children.length : 0;
+    },
+    echoName: function(val){
+      if(val){
+        console.log(val);
+        this.tableName = this.echoName
+        this.tableFieldList = this.echoList
+      }
+    }
+  },
+  methods: {
+    /** 查询列表 */
+    getList(queryParams) {
+      if (!this.tableName) return;
+      let data = {
+        databaseName: this.databaseName,
+        databaseType: this.databaseType,
+        tableName: this.tableName,
+      };
+      let tableComment = this.getTableCommont(this.tableName, this.tableList);
+      // 获取当前表单结构信息
+      getListName(data).then((res) => {
+        // console.log(res);
+        this.tableFieldList = res.map((item, index) => {
+          return {
+            id: this.tableName + "_" + item.fieldName,
+            fieldName: item.fieldName,
+            fieldDescription: item.fieldDescription,
+            relationTable: "",
+            relationFieldName: "",
+            relaFieldNameList: [],
+            disableRelaFieldName: false,
+            relationType: "",
+            relationShowField: [],
+            relationShowFiledList: [],
+            disableRelaType: false,
+            isShow: true,
+            isSearch: false,
+            isExport: true,
+            relationTableList: this.relationTableList,
+            tableName: this.tableName,
+            tableComment,
+            relationFieldList: [],
+          };
+        });
+
+        this.$emit('fieldListChange', 
+          this.tableFieldList)
+
+        // console.log(this.tableFieldList);
+      });
+    },
+    // 关联表变化回调
+    async ralationTableChange(row) {
+      this.tableFieldList = this.tableFieldList.filter((item) => {
+        return !row.relationFieldList.some((val) => {
+          return val.id == item.id;
+        });
+      });
+      row.relationFieldName = "";
+      row.relationType = "";
+      row.disableRelaFieldName = false;
+      row.disableRelaType = false;
+      row.relationFieldList = [];
+      if (!row.relationTable) {
+        return;
+      }
+      // 获取关联表的字段
+      let data = {
+        databaseName: this.databaseName,
+        databaseType: this.databaseType,
+        tableName: row.relationTable,
+      };
+      let tableComment = this.getTableCommont(
+        row.relationTable,
+        this.tableList
+      );
+      let res = await getListName(data);
+      // 关联字段下拉列表数据
+      row.relaFieldNameList = res.map((item) => {
+        return {
+          fieldName: item.fieldName,
+          fieldDescription: item.fieldDescription,
+        };
+      });
+      let relationTableList = row.relationTableList.filter(
+        (item) => row.relationTable != item.tableName
+      );
+      row.relationFieldList = row.relaFieldNameList.map((item, index) => {
+        return {
+          id: row.relationTable + "_" + item.fieldName,
+          fieldName: item.fieldName,
+          fieldDescription: item.fieldDescription,
+          relationTable: "",
+          relationFieldName: "",
+          relaFieldNameList: [],
+          disableRelaFieldName: false,
+          relationType: "",
+          relationShowField: [],
+          relationShowFiledList: [],
+          disableRelaType: false,
+          isShow: true,
+          isSearch: false,
+          isExport: true,
+          relationTableList,
+          tableName: row.relationTable,
+          tableComment,
+          relationFieldList: [],
+          isChildren: true,
+        };
+      });
+      // this.tableFieldList = [...this.tableFieldList, ...row.relationFieldList];
+      row.disableRelaFieldName = true;
+    },
+    // 关联类型变化回调
+    relationTypeChangeHandler(row) {
+      let tempRelationFieldList = row.relationFieldList.filter((item) => {
+        return !this.tableFieldList.find((val) => val.id === item.id);
+      });
+      this.tableFieldList = [...this.tableFieldList, ...tempRelationFieldList];
+    },
+    // 关联字段回调
+    relationFieldChange(row) {
+      if (!row.relationFieldName) {
+        row.relationType = "";
+        row.disableRelaType = false;
+        row.relaFieldNameList = [];
+        return;
+      }
+      row.disableRelaType = true;
+    },
+     // 修改表格回显数据
+     async initTableData(tId) {
+      let res = await getTable({id : tId});
+      if (res.code == 200) {
+        let lists = res.data.dragTables
+        let groupInfo =JSON.parse(res.data.groupTableInfo)
+
+        lists.forEach(item => {
+          if(item.tableKey == groupInfo[1].tableKey){
+            let echoData = JSON.parse(item.echoData);
+              this.tableName = echoData.tableName;
+              this.tableFieldList = echoData.tableFieldData;
+
+              this.$emit('fieldListChange', this.tableFieldList)
+              this.editData = item;
+          }
+        })
+        console.log('info', groupInfo)
+      } else {
+        this.$message.error("数据回显失败");
+      }
+    },
+    // 勾选框回调
+    handleSelectionChange(selection) {
+      this.ids = selection.map((item) => item.id);
+      // this.single = selection.length != 1;
+      this.multiple = !selection.length;
+    },
+    // 分页查询
+    pageList(row) {
+      this.$refs.mychild.pageList(
+        row == undefined
+          ? {
+              limit: this.queryParams.pageSize,
+              page: this.queryParams.pageNum,
+            }
+          : row
+      );
+    },
+    // 多选框改变回调
+    checkedChangeHandle(val) {},
+    // 获取所有表格
+    async getAllTable() {
+      let data = {
+        databaseName: this.databaseName,
+        databaseType: this.databaseType,
+      };
+      let res = await getFormName(data);
+
+      const baseTable = await this.getDicts("base_table");
+
+      this.tableList = res.data.filter((item) => {
+        return !baseTable.data.some(
+          (value) =>
+            value.dictValue.toLowerCase() == item.tableName.toLowerCase()
+        );
+      });
+
+    },
+    //处理表格行拖拽
+    initDragTable() {
+      const el = this.$refs.dragTable.$el.querySelectorAll(
+        ".el-table__body-wrapper > table > tbody"
+      )[0];
+      const sortable = Sortable.create(el, {
+        handle: ".allowDrag",
+        onEnd: (evt) => {
+          const targetRow = this.tableFieldList.splice(evt.oldIndex, 1)[0];
+          this.tableFieldList.splice(evt.newIndex, 0, targetRow);
+          for (let index in this.tableFieldList) {
+            this.tableFieldList[index].sort = parseInt(index) + 1;
+          }
+        },
+      });
+    },
+    // 校验字段合法性(递归版)
+    validateField(tableFieldList, validateParams) {
+      if (!tableFieldList.length) {
+        return;
+      }
+      for (let i = 0; i < tableFieldList.length; i++) {
+        let temp = tableFieldList[i];
+        if (!temp.fieldDescription?.trim() && temp.isShow) {
+          //描述字段不能为空
+          validateParams.isFieldDescrib = true;
+        }
+        if (
+          temp.relationTable &&
+          (!temp.relationFieldName || !temp.relationType)
+        ) {
+          // 关联条件不足
+          validateParams.isRelationFieldAll = true;
+        }
+        if (temp.relationFieldList.length) {
+          this.validateField(temp.relationFieldList, validateParams);
+        }
+      }
+    },
+    // 校验字段合法性(非递归版)
+    validateTableData(tableFieldList) {
+      if (!tableFieldList.length) {
+        return {
+          val: false,
+          meg: "字段个数不能为空",
+        };
+      }
+      for (let i = 0; i < tableFieldList.length; i++) {
+        let temp = tableFieldList[i];
+        if (!temp.fieldDescription?.trim() && temp.isShow) {
+          return {
+            val: false,
+            msg: "显示的字段,字段描述不能为空",
+          };
+        }
+        if (
+          temp.relationTable &&
+          (!temp.relationFieldName || !temp.relationType)
+        ) {
+          return {
+            val: false,
+            msg: "关联条件不足,请完善关联条件",
+          };
+        }
+      }
+      if (tableFieldList.filter((item) => item.isShow).length == 0) {
+        return {
+          val: false,
+          msg: "显示的字段数不能为空",
+        };
+      }
+      if (
+        tableFieldList.filter((item) => item.isExport && !item.isChildren)
+          .length == 0
+      ) {
+        return {
+          val: false,
+          msg: "导出字段中至少应有一个主表字段",
+        };
+      }
+      // 导出的字段的描述不能重复
+      let describeArr = tableFieldList
+        .filter((item) => item.isExport)
+        .map((item) => item.fieldDescription);
+      let isRepeat = false;
+      describeArr.map((item) => {
+        if (describeArr.indexOf(item) != describeArr.lastIndexOf(item)) {
+          isRepeat = true;
+        }
+      });
+      if (isRepeat) {
+        return {
+          val: false,
+          msg: "导出的字段描述不能重复",
+        };
+      }
+
+      return {
+        val: true,
+        msg: "",
+      };
+    },
+    // 递归拼接查询语句
+    getSQLString(tableFieldList, fieldArr, tableArr, sqlType = "mysql") {
+      let prefix = "{DBNAME}.";
+      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
+      for (let i = 0; i < tableFieldList.length; i++) {
+        let temp = tableFieldList[i];
+        if (temp.isShow) {
+          let tempArr = prefix + temp.tableName + "." + temp.fieldName;
+          // 给主表也加上表名前缀
+          // if (temp.isChildren) {
+          tempArr += asOrSpace + temp.tableName + "_" + temp.fieldName;
+          // }
+          fieldArr.push(tempArr);
+        }
+        if (temp.relationTable && temp.relationFieldName && temp.relationType) {
+          // fieldArr.push(temp.relationTable + "." + temp.relationFieldName);
+          let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
+          tableArr.push(
+            temp.relationType +
+              " " +
+              isNeedUsername +
+              prefix +
+              temp.relationTable +
+              asOrSpace +
+              temp.relationTable +
+              " ON " +
+              prefix +
+              temp.relationTable +
+              "." +
+              temp.relationFieldName +
+              " = " +
+              prefix +
+              temp.tableName +
+              "." +
+              temp.fieldName
+          );
+        }
+        // if (temp.relationFieldList.length) {
+        //   this.getSQLString(temp.relationFieldList, fieldArr, tableArr);
+        // }
+      }
+      // 如果主键不包含显示,则添加至sql语句中
+      let isNotInclude = this.primaryKeyList.find(
+        (val) => !val.isShow && val.fieldName == this.formData.primaryKey
+      );
+      if (isNotInclude) {
+        fieldArr.push(
+          prefix + isNotInclude.tableName + "." + isNotInclude.fieldName
+        );
+      }
+    },
+
+    // 拼接查询sql语句
+    getSQLStr() {
+      let prefix = "{DBNAME}.";
+      let sqlType = this.databaseType; //数据库类型
+      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
+      // let sqlType = "oracle";
+      let sql = "";
+      // mysql
+      sql += "SELECT ";
+      let fieldNameArr = [],
+        relaTypeArr = [];
+      this.getSQLString(
+        this.tableFieldList,
+        fieldNameArr,
+        relaTypeArr,
+        sqlType
+      );
+      // if (discriISEmpty) {
+      //   return false;
+      // }
+      let styleFieldList = this.$refs.styleTableRef.getStyleTableField();
+      styleFieldList = styleFieldList.map((item) => {
+        return `${prefix}${item}${asOrSpace}${item.replace(".", "_")}`;
+      });
+      let set = new Set([...fieldNameArr, ...styleFieldList]);
+      fieldNameArr = [...set];
+      let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
+      sql +=
+        fieldNameArr.join(",") +
+        " FROM " +
+        isNeedUsername +
+        prefix +
+        this.tableName +
+        asOrSpace +
+        this.tableName;
+      if (relaTypeArr.length) {
+        sql += " " + relaTypeArr.join(" ");
+      }
+      return sql;
+    },
+    getStaticSQL(key) {
+      // let prefix = "{DBNAME}.";
+      let sqlType = this.databaseType; //数据库类型
+      // let sqlType = "oracle";
+      let sql = "";
+      // mysql
+      sql += "SELECT ";
+      let fieldNameArr = [],
+        relaTypeArr = [];
+      this.getSQLString(
+        this.tableFieldList,
+        fieldNameArr,
+        relaTypeArr,
+        sqlType
+      );
+      let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
+      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
+
+      sql +=
+        key +
+        " FROM " +
+        isNeedUsername +
+        // prefix +
+        this.tableName +
+        asOrSpace +
+        this.tableName;
+      if (relaTypeArr.length) {
+        sql += " " + relaTypeArr.join(" ");
+      }
+      return sql;
+    },
+    // 处理列表信息
+    columnsHandler(columns) {
+      let resArr = [];
+      columns.forEach((item) => {
+        for (const key in item) {
+          let tempObj = {};
+          tempObj.key = key;
+          tempObj.value = item[key];
+          resArr.push(tempObj);
+        }
+      });
+      return resArr;
+    },
+    // 下划线命名转驼峰命名
+    toUpperCase(str) {
+      let nstr = str.replace(/(?:_)+([^_])/g, function ($0, $1) {
+        return $1.toUpperCase();
+      });
+      nstr = nstr.replace(nstr[0], nstr[0].toLowerCase());
+      return nstr;
+    },
+
+    // 递归获取列表信息
+    getCol(
+      tableFieldList,
+      columns,
+      searchFieldList = [],
+      tableExportField = {}
+    ) {
+      if (!tableFieldList.length) return;
+      for (let i = 0; i < tableFieldList.length; i++) {
+        let temp = tableFieldList[i];
+        let tempFieldName = "",
+          exportFieldName = "";
+        if (temp.isChildren) {
+          tempFieldName = temp.tableName + "_" + temp.fieldName;
+          exportFieldName = temp.tableName + "@" + temp.fieldName;
+        } else {
+          // tempFieldName = temp.fieldName;
+          tempFieldName = temp.tableName + "_" + temp.fieldName;
+          exportFieldName = temp.fieldName;
+        }
+        if (temp.isShow) {
+          let tempObj = {};
+          // if (temp.isChildren) {
+          //   tempObj[temp.tableName + "_" + temp.fieldName] =
+          //     temp.fieldDescription;
+          // } else {
+          //   tempObj[temp.fieldName] = temp.fieldDescription;
+          // }
+          tempObj[tempFieldName] = temp.fieldDescription;
+          columns.push(tempObj);
+        }
+        if (temp.isSearch) {
+          searchFieldList.push(temp.tableName + "." + temp.fieldName);
+        }
+
+        if (temp.isExport) {
+          tableExportField[exportFieldName] = temp.fieldDescription;
+        }
+        // 递归
+        // if (temp.relationFieldList) {
+        //   this.getCol(
+        //     temp.relationFieldList,
+        //     columns,
+        //     searchFieldList,
+        //     tableExportField
+        //   );
+        // }
+      }
+    },
+    // 更新路由
+    reloadRouter() {
+      this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {
+        this.$router.addRoutes(accessRoutes); // 动态添加可访问路由表
+      });
+    },
+
+    // 预览结果回调
+    async previewHandle() {
+      this.$refs.formData.validate(async (valid) => {
+        // 至少包含一个查询项
+        if (valid) {
+          if (!this.tableName) {
+            this.$message.error("请选择数据表");
+            return;
+          }
+          // 检验表单合法性
+          let validRes = this.validateTableData(this.tableFieldList);
+          if (!validRes.val) {
+            this.$message.error(validRes.msg);
+            return;
+          }
+          // let validateParams = {
+          //   isFieldDescrib: false,
+          //   isRelationFieldAll: false,
+          // };
+          // this.validateField(this.tableFieldList, validateParams);
+          // console.log(validateParams);
+          // if (validateParams.isFieldDescrib) {
+          //   this.$message.error("需要显示的字段描述不能为空");
+          //   return;
+          // }
+          // if (validateParams.isRelationFieldAll) {
+          //   this.$message.error("请补全关联条件");
+          //   return;
+          // }
+          // 拼接预览的sql查询语句
+          this.queryParams.basicMap.sql = this.getSQLStr();
+          // 获取表头信息
+          let tempColumns = [],
+            searchFieldList = [];
+          this.getCol(this.tableFieldList, tempColumns, searchFieldList);
+          if (!searchFieldList.length) {
+            this.$message.warning("请至少选择一个包含查询字段");
+            return false;
+          }
+          const dataType = await this.getDicts("table_statistic_type");
+          this.deepragTableStatisticList = JSON.parse(
+            JSON.stringify(this.dragTableStatisticList)
+          );
+          this.deepragTableStatisticList.forEach((item) => {
+            dataType.data.forEach((val) => {
+              if (val.dictValue == item.statisticType) {
+                item.statisticType = val.dictLabel;
+              }
+            });
+          });
+          this.columns = this.columnsHandler(tempColumns);
+          this.queryParams.isAsc = this.formData.isAsc;
+          // 发送请求获取预览数据
+          let res = await dragTablePreview(this.queryParams);
+          this.tableDataList = [];
+          res.rows.forEach((item) => {
+            this.tableDataList.push(item.resultMap);
+          });
+          this.total = res.total;
+          this.isShowPreview = true;
+        } else {
+          this.$message.warning("请完善表单");
+          return false;
+        }
+      });
+
+      // this.$refs.tableForm.validate((val) => {
+      //   if (val) {
+
+      //   } else {
+      //     this.$message.warning("请完善表单");
+      //     return false;
+      //   }
+      // });
+    },
+    getBtnMapList(tableKey) {
+      let res = this.formData.btnGroupList.map((item) => {
+        return {
+          tableKey,
+          btnKey: item,
+        };
+      });
+      return res;
+    },
+
+    // tab切换
+    tabhandleClick() {
+      this.menudata = this.activeName != "menuedit" ? true : false;
+    },
+    // 添加数据字段对话框
+    async addDataDialog() {
+      this.staictitle = "添加统计数据字段";
+      this.isShowAddData = true;
+      this.dataType = await this.getDicts("table_statistic_type");
+      this.dataType = this.dataType.data;
+      // console.log(this.dataType)
+    },
+    async updataDialog() {
+      // console.log(this.dataType)
+    },
+    // 修改数据字段
+    upadtaData() {
+      this.dragTableStatisticList.forEach((item, index) => {
+        // console.log(this.dataCountFormData);
+        if (item.id !== undefined && item.id == this.dataCountFormData.id) {
+          this.dragTableStatisticList[index] = this.dataCountFormData;
+        } else if (item.xid == this.dataCountFormData.xid) {
+          this.dragTableStatisticList[index] = this.dataCountFormData;
+        }
+      });
+      this.isShowAddData = false;
+      // console.log(this.dragTableStatisticList)
+      this.dataCountFormData = {};
+    },
+    // 添加数据字段
+    addData() {
+      // console.log(this.dataCountFormData);
+      this.dataCountFormData.xid = Date.now();
+      this.dataCountFormData.tableKey = this.tableKey;
+      this.dragTableStatisticList.push(this.dataCountFormData);
+      this.isShowAddData = false;
+      this.dataCountFormData = {};
+    },
+    // 关闭添加数据字段
+    closeAddDialog() {
+      this.isShowAddData = false;
+      this.dataCountFormData = {};
+    },
+    // 确定统计
+    countHandle() {
+      addStatistic({
+        dragTableStatisticList: this.dragTableStatisticList,
+        tableSqlList: this.tableSqlList,
+        searchFieldList: this.searchFieldList,
+        dtTableName: this.tableName,
+      }).then((res) => {
+        // console.log(res)
+      });
+    },
+    // 修改统计信息
+    async handleUpdateStat(row) {
+      // console.log(row);
+      this.dataCountFormData = row;
+      this.dataCountFormData.xid = Date.now();
+      this.staictitle = "修改统计数据字段";
+      this.dataType = await this.getDicts("table_statistic_type");
+      this.dataType = this.dataType.data;
+      this.isShowAddData = true;
+      // console.log(this.dataCountFormData)
+      // console.log(this.dragTableStatisticList);
+    },
+    // 删除统计信息
+    handleDeleteStat(row) {
+      this.dragTableStatisticList.forEach((item, index) => {
+        if (item.id == row.id) {
+          this.dragTableStatisticList.splice(index, 1);
+        }
+      });
+    },
+
+    // 获取当前表描述
+    getTableCommont(tableName, tableList) {
+      return tableList.find((item) => item.tableName == tableName).tableComment;
+    },
+
+    // 获取按钮组数据
+    async getBtnList() {
+      let res = await listBtn({ isEnablePaging: false, btnParentId: 0 });
+      this.btnGroupOptions = res.rows;
+    },
+  },
+
+};
+</script>
+
+<style scoped lang="scss">
+.ipt {
+  height: 36px;
+  line-height: 36px;
+  font-size: 14px;
+  width: 100%;
+  outline: none;
+  text-align: center;
+  background-color: #fff;
+  border: 1px solid #dcdfe6;
+  color: #606266;
+  display: inline-block;
+  border-radius: 4px;
+}
+.isNullDesc {
+  border-color: #ff4949 !important;
+}
+
+.ipt:focus {
+  border-color: #1890ff;
+}
+::v-deep .right_card {
+  min-height: 500px !important;
+}
+::v-deep .vue-treeselect--has-value .vue-treeselect__input {
+  vertical-align: middle !important;
+}
+.menudata {
+  width: 30% !important;
+}
+.edit {
+  width: 70% !important;
+}
+.mb10 {
+  margin-top: 10px;
+}
+.cardBox {
+  display: flex;
+  align-content: space-between;
+  flex-wrap: wrap;
+  align-content: flex-start;
+}
+.card {
+  /* width:15%; */
+  height: 150px;
+  flex-basis: 15%;
+  margin-bottom: 10px;
+  margin-right: 15px;
+  min-width: 180px;
+  .title {
+    /* width:20%; */
+    font-size: 18px;
+    margin-bottom: 5px;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+  }
+  .description {
+    width: 70%;
+    font-size: 13px;
+    color: #9699a2;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    -webkit-line-clamp: 3;
+    word-break: break-all;
+    float: left;
+  }
+  .type {
+    float: right;
+    margin-top: 40px;
+    .statisticType {
+      font-size: 18px;
+    }
+  }
+  .count {
+    font-size: 25px;
+  }
+}
+.mb8 {
+  ::v-deep .el-col-18 {
+    width: 30% !important;
+    min-width: 220px !important;
+  }
+  ::v-deep .previewbtn {
+    min-width: 190px !important;
+  }
+}
+</style>

+ 350 - 138
ruoyi-ui/src/views/dialogTemplate/components/index.vue

@@ -2,16 +2,16 @@
   <div class="bigBox">
    <div class="info">
     <p class="tt">基础信息</p>
-    <div v-for="item in infoData" :key="item.title">
-      <span class="titlestyle">{{ item.title }}</span>
-      <span class="infostyle">{{ item.info }}</span>
+    <div v-for="(item, index) in infoData[0]" :key="item.title">
+      <span class="titlestyle">{{ item.value }}</span>
+      <span class="infostyle" v-for="(val, index) in infoData[1]">{{ val[item.key] }}</span>
     </div>
    </div>
    <div class="tableBox">
     <div class="top">
-      <div class="left">
-        <p>工序状态:</p>
-        <i>初始</i>
+      <div class="left" v-if="tableCount[0]">
+        <p>{{ tableCount[0].statisticTitle }}</p>
+        <i>{{ tableCount[0].result }}</i>
       </div>
       <div class="right">
         <p>是否外协</p>
@@ -20,85 +20,60 @@
     </div>
     <!-- 按钮组 -->
     <el-button-group>
-      <el-button icon="el-icon-caret-right" class="custom">开始</el-button>
-      <el-button icon="el-icon-switch-button" class="custom">暂停</el-button>
-      <el-button icon="el-icon-finished" class="custom">完成</el-button>
-      <el-button icon="el-icon-refresh" class="custom">重置</el-button>
+      <el-button v-for="item in controlBtnArr">
+        <template>
+          <span @click="clickHandler(item, row)"
+              ><svg-icon
+                v-if="item.btnIcon"
+                class="pre-icon"
+                slot="prefix"
+                :icon-class="item.btnIcon"
+              />{{ item.btnName }}</span
+            >
+        </template>
+      </el-button>
     </el-button-group>
     
-    <el-table
-      border
-      :data="tableData"
-      style="width: 100%">
-      <el-table-column
-        prop="date"
-        label="日期"
-        width="180">
-      </el-table-column>
-      <el-table-column
-        prop="name"
-        label="姓名"
-        width="180">
-      </el-table-column>
-      <el-table-column
-        prop="address"
-        label="地址">
-      </el-table-column>
-    </el-table>
-
     <el-form ref="tableform" :model="tableDataForm">
-      <div class="titleitem">人员及工时分配</div>
       <el-table
-      class="addTable"
-      border
-      :data="editData"
-      style="width: 100%">
-      <el-table-column prop="date" label="日期" width="180">
-        <template slot-scope="scope">
-          <el-input v-model="scope.row.date"></el-input>
-        </template>
-      </el-table-column>
-      <el-table-column
-        prop="name"
-        label="姓名"
-        width="180">
-        <template slot-scope="scope">
-          <el-input v-model="scope.row.name"></el-input>
-        </template>
-      </el-table-column>
+        border
+        :data="tableData[1].data"
+        style="width: 100%; margin-bottom: 20px">
         <el-table-column
-          label="操作"
-          align="center"
-          class-name="small-padding fixed-width"
-        >
-        <template slot-scope="scope">
-          <el-dropdown>
-            <el-button type="warning" plain size="small">
-              处理<i class="el-icon-arrow-down el-icon--right"></i>
-            </el-button>
-            <el-dropdown-menu slot="dropdown">
-              <el-dropdown-item>
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-edit"
-                  >修改
-                </el-button>
-              </el-dropdown-item>
-              <el-dropdown-item>
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-delete"
-                  >删除
-                </el-button>
-              </el-dropdown-item>
-            </el-dropdown-menu>
-          </el-dropdown>
-        </template>
+          v-for="item in tableData[0].column"
+          v-if="item.key !== 'id'"
+          :prop="item.key"
+          :label="item.value"
+          width="180">
+          <template slot-scope="scope" >
+            <el-input :v-if="scope.row[item.key]" v-model="scope.row[item.key]"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column
+            v-if="isShowExcuteCol"
+            label="操作"
+            align="center"
+            class-name="small-padding fixed-width"
+          >
+
+          <template slot-scope="scope">
+            <Menu
+              :row="scope.row"
+              v-for="btnObj in excuteBtnArr"
+              :key="btnObj.id"
+              :listAll="btnObj"
+              @excuteHandler="excuteHandler"
+            ></Menu>
+          </template>
         </el-table-column>
+
       </el-table>
 
+      <div>
+        <b>统计信息 </b>
+        <span v-for="item in subCount">{{ item.statisticTitle }}: {{ item.result }}</span>
+      </div>
+
       <el-form-item>
         <el-button class="addBtn" icon="el-icon-plus"
         @click="addBtnHandler"
@@ -112,95 +87,327 @@
     </el-form>
    
     <div>
-      
     </div>
    </div>
   </div>
 </template>
 
 <script>
-
+import { dragGroupTableInfo } from "@/api/relateTable/index"
+import {
+  btnCommonApi,
+  delTableData,
+  dragTableInfo,
+  listTable,
+  unionListTableData,
+  getInfoBySqlKey,
+  addTableData,
+  batchEdit,
+  getStatisticList
+} from "@/api/tablelist/commonTable";
+import {camelCase} from "@/utils";
+import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
 export default {
+  components: { Menu },
   data () {
    return {
     // 基础信息行数据
-    infoData: [
-      {
-        title: '任务',
-        info: '154ccxz5'
-      },
-      {
-        title: '固号',
-        info: '1545'
-      },
-      {
-        title: '名称',
-        info: '1545'
-      },
-      {
-        title: '数量',
-        info: '1545'
-      },
-      {
-        title: '工艺',
-        info: '指控'
-      },
-    ],
+    infoData: [],
+    listInfo: {},
     // 是否外协
     checked: false,
-    tableData: [{
-      date: '2016-05-02',
-      name: '王小虎',
-      address: '上海市普陀区金沙江路 1518 弄'
-    }, {
-      date: '2016-05-04',
-      name: '王小虎',
-      address: '上海市普陀区金沙江路 1517 弄'
-    }, {
-      date: '2016-05-01',
-      name: '王小虎',
-      address: '上海市普陀区金沙江路 1519 弄'
-    }, {
-      date: '2016-05-03',
-      name: '王小虎',
-      address: '上海市普陀区金沙江路 1516 弄'
-    }],
+    tableData: [],
     // 动态增加表格数据
     editData: [],
-    tableDataForm: {}
+    tableDataForm: {},
+    tableLists: [],
+    queryParams: {
+        pageNum: 1, // 第几页
+        pageSize: 10, // 每页大小
+        orderByColumn: "", // 根据某列排序
+        isAsc: "", // desc(降序)或 asc(升序)
+        // 基本查询参数
+        basicMap: {
+          tableName: "drag_form",
+        },
+        // 当前表字段筛选参数
+        queryMap: {
+          // 当前查询基本参数
+          // ... key : value         当前页面的筛选条件
+          // 超级查询的唯一值
+          queryCriteriaValue: "",
+          // tableCondition: ''
+        },
+    },
+    columns: [],
+    // 排序方式 默认降序
+    sortOrder: true,
+    tableName: "",
+    // 当前模版信息
+    templateInfo: {},
+    queryFromWhere:'',
+    condition: [],
+    // 当前点击按钮的数据
+    currentBtnData: {},
+    // 操作列 按钮数据
+    excuteBtnArr: [],
+    // 新增保存的数据
+    addListData:[],
+    controlBtnArr: [],
    }
  },
+  props: ['groupKey','rowobj','tableCount','subCount', 'subTableName' ],
+  computed: {
+    isShowExcuteCol() {
+      // console.log(!this.excuteBtnArr?.every((arr) => arr.children.length == 0));
+      // return true;
+      return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
+    },
+  },
   methods: {
     // 新增
     addBtnHandler(){
-      if (this.editData == undefined) {
-        this.editData = new Array();
-      }
+      // if (this.editData == undefined) {
+      //   this.editData = new Array();
+      // }
 
       let obj = {
-        date: '',
-        name: ''
+        // id:'',
       }
-
-      this.editData.push(obj);
+      this.addListData.push(obj)
+      this.tableData[1].data.push(obj);
     },
     // 保存
     saveBtnHandler(){
-      this.editData.forEach(item => {
-        this.tableData.push(item)
+      console.log(this.addListData);
+      let data = {
+        addListMap:this.addListData,
+        basicMap:{
+          btnType: 10,
+          tableName: this.subTableName,
+          visible: true,
+        },
+        commMap: {},
+        conditionMap: {},
+      }
+      btnCommonApi(data).then(res => {
+        console.log('保存', res);
       })
-      this.editData = []
-    }
-  }
+    },
+    async getLists(groupKey){
+      let res = await dragGroupTableInfo({queryMap: {groupKey: groupKey}})
+      this.tableLists = JSON.parse(res.msg)
+      // console.log(this.tableLists);
+
+      this.tableLists.forEach(async item => {
+        if(item.sort == 0){
+
+          const res = await dragTableInfo({queryMap: {tableKey : item.tableKey }})
+          this.getTableHandle(res,item.sort).then(result => {
+            console.log('result:',result);
+            this.infoData.push(result)
+            this.$set(this.infoData)
+          })
+
+        }else if(item.sort == 1){
+
+          const res = await dragTableInfo({queryMap: {tableKey : item.tableKey }})
+          this.excuteBtnArr = res.data.resultMap.button;
+          this.getTableHandle(res,item.sort).then(result => {
+            this.tableData.push({
+              column: result
+            })
+          })
+          // console.log(this.tableData);
+        }else if(item.sort == 2){
+
+          const res = await dragTableInfo({queryMap: {tableKey : item.tableKey }})
+          
+          this.controlBtnArr = res.data.resultMap.button[0]
+          this.controlBtnArr = this.controlBtnArr.children
+          console.log('butt',this.controlBtnArr)
+        }
+      })
+    },
+    async getTableHandle(res,sort){
+        this.columns = []
+        // 得到当前模版信息 --- sql columns queryWhere
+        this.templateInfo = res.data.resultMap;
+      
+        // console.log(res.data.resultMap.querySql);
+        this.queryParams.orderByColumn =
+          res.data.resultMap.querySql.orderByColumn;
+
+        this.sortOrder = JSON.parse(res.data.resultMap.querySql.sortOrder);
+        // 根据拖拽时设置当前列表排列顺序
+        this.queryParams.isAsc = this.sortOrder ? "DESC" : "ASC"
+        this.tableName = this.templateInfo.template.dtTableName;
+        // 得到查询条件
+        this.queryFromWhere = res.data.resultMap.where;
+        //  得到当前列表信息
+        this.columns = this.columnsHandler(
+          JSON.parse(this.templateInfo.template.dtColumnName)
+        );
+        if (this.templateInfo !== {}) {
+            this.tableCondition = this.templateInfo.querySql.tableCondition
+            this.tableCondition = this.tableCondition.split('AND')
+            // console.log(this.tableCondition);
+            this.condition = [];
+              
+            // 调用查询需要携带当前table的唯一标识
+            this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
+
+            this.queryParams.orderByColumn = camelCase(
+              this.queryParams.orderByColumn || ""
+            );
+            // 根据sql语句查询当前表数据
+
+            let k;
+            this.tableCondition.forEach((item, i) => {
+              let val = item.split('=')
+              if(i!==0){
+                
+                k =val[0].split('.')
+                let str = k[0].trim() + '.' + k[1]
+                this.condition.push({
+                  key: k[0].trim(),
+                  value: k[1]
+                })
+              }
+            })
+  
+            this.getDataHandler(this.tableCondition[1]).then(res => {
+              console.log(res);
+              if(sort == 0){
+                this.infoData.push(res)
+                // this.$set(this.infoData)
+              }else if(sort ==1){
+                this.tableData.push({
+                  data: res
+                })
+                // this.$set(this.tableData)
+              }
+            })
+            // console.log('columns', this.columns);
+            return this.columns
+        }  
+    },
+    // 获取表数据
+    async getDataHandler(contion){
+      let con = contion.split('=')
+      // console.log(con);
+      let key = con[1].trim()
+      // console.log(this.rowobj);
+      // console.log(key);
+      
+      let value = key.split('.')
+
+      // console.log(value);
+      this.queryParams.queryMap[key] = "'" + this.rowobj[value[1]] + "'";
+  
+      let tableLists = await unionListTableData(this.queryParams)
+      // console.log(tableLists.rows);
+      if(tableLists.code == 200){
+          this.tableList = [];
+          tableLists.rows.forEach((item) => {
+            this.tableList.push(item.resultMap);
+          });
+        
+          // 驼峰转换
+          this.tableList = this.tableList.map((item) => {
+            let kv = {};
+            for (let itemKey in item) {
+              kv[camelCase(itemKey)] = item[itemKey];
+            }
+            return kv;
+          })
+          // console.log(this.tableList);
+          // console.log('123', this.tableList);
+          return this.tableList
+
+      }
+      // this.total = tableLists.total;
+      // this.loading = false; 
+    },
+    // 处理列表信息
+    columnsHandler(columns) {
+      let resArr = [];
+      columns.forEach((item) => {
+        for (const key in item) {
+          let tempObj = {};
+          tempObj.key = camelCase(key);
+          tempObj.value = item[key];
+          resArr.push(tempObj);
+        }
+      });
+      return resArr;
+    },
+     // 操作列回调
+     excuteHandler(btnData, row) {
+      let { btnType, btnParams } = btnData;
+      this.currentBtnData = btnData;
+      switch (
+        btnType //3:内链  6:目录  7:外链  8:修改  9:删除
+      ) {
+        case "3":
+          this.routerHandler(btnData, btnType);
+          break;
+        case "7":
+          this.routerHandler(btnData, btnType);
+          break;
+        case "8":
+          this.handleUpdate(row, btnData);
+          break;
+        case "9":
+          this.handleDelete(row, btnData);
+          break;
+        default:
+          break;
+      }
+    },
+    // 内链页面跳转
+    routerHandler(btnData, type) {
+      let link = btnData.btnParams;
+      if (type == "3") {
+        this.$router.push(link);
+      } else {
+        window.open("http://" + link, "_blank");
+      }
+    },
+    handleDelete(row, btnData){
+      // console.log(row, btnData);
+      // if(row.id){
+      //   this.editData.forEach((item ,index) => {
+      //     if(item.id == row.id){
+      //       this.editData.splice(index, 1);
+      //     }
+      //   })
+      // }else{
+      //   this.$message.error("请输入id");
+      // }
+    },
+    // 修改
+    handleUpdate(row, btnData){
+      console.log(row);
+
+    },
+    // 按钮组点击
+    clickHandler(item, row){},
+  },
+  mounted() {
+    // this.getLists()
+  },
 }
 </script>
 
 <style scoped lang="scss">
+
   .bigBox{
-    width: 800px;
     margin: auto;
     display: flex;
-  
+    ::v-deep .info[data-v-32a636fc]{
+      min-width: 200px !important;
+    }
     .info{
       margin-right: 60px;
       .tt{
@@ -212,12 +419,16 @@ export default {
       }
       .titlestyle{
         background-color: #34bfa3;
-        width: 50px;
+        /* width: 50px; */
+        display: inline-block;
+        /* height: 25px; */
+        line-height: 1;
+        padding: 5px;
         margin-bottom: 20px;
         margin-right: 5px;
         text-align: center;
         color: white;
-        border-radius: 20px;
+        border-radius: 20px; 
       }
       .infostyle{
         background-color: #ebedf2;
@@ -226,7 +437,10 @@ export default {
     }
 
     .tableBox{
-      width: 500px;
+      .svg-icon[data-v-c8a70580]{
+        margin-right: 5px;
+      }
+      min-width: 300px;
       .addTable{
         margin: 0px 0px 20px 0px
       }
@@ -260,7 +474,6 @@ export default {
         background-color: white;
         
         .el-button:first-child{
-          border-radius: 20px 0px 0px 20px;
           color: blue;
           border: 1px solid blue;
         }
@@ -273,7 +486,6 @@ export default {
           border: 1px solid green;
         }
         .el-button:last-child{
-          border-radius: 0px 20px 20px 0px;
           color:burlywood;
           border: 1px solid burlywood;
         }

+ 78 - 403
ruoyi-ui/src/views/dialogTemplate/indexTable.vue

@@ -49,7 +49,7 @@
           icon="el-icon-delete"
           size="mini"
           :disabled="multiple"
-          @click=""
+          @click="DeleteTableGroup"
           >删除</el-button
         >
       </el-col>
@@ -64,7 +64,8 @@
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="表格主键" align="center" prop="id" />
       <el-table-column label="表格名称" align="center" prop="groupName" />
-      <el-table-column label="描述" align="center" prop="groupDescription" />
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="创建时间" align="center" prop="createTime" />
 
       <el-table-column
         label="操作"
@@ -82,7 +83,7 @@
                   size="mini"
                   type="text"
                   icon="el-icon-edit"
-                  @click=""
+                  @click="handleUpdate(scope.row)"
                   >修改
                 </el-button>
               </el-dropdown-item>
@@ -91,7 +92,7 @@
                   size="mini"
                   type="text"
                   icon="el-icon-delete"
-                  @click=""
+                  @click="DeleteTableGroup(scope.row)"
                   >删除
                 </el-button>
               </el-dropdown-item>
@@ -101,228 +102,13 @@
       </el-table-column>
     </el-table>
 
-    <el-dialog
-      title="新增表格信息"
-      :visible.sync="dialogVisible"
-      width="30%"
-    >
-    <div class="formWrap">
-        <el-form
-          :rules="tableItemRules"
-          ref="tableItemForm"
-          style="max-width: 750px; width: 1000px"
-          :model="tableItemForm"
-          label-width="100px"
-        >
-          <el-form-item label="表格标题:" prop="title">
-            <el-input
-            @input="change1($evevt)"
-              v-model="tableItemForm.title"
-              style="max-width: 221px"
-              @change="iptChange()"
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="表格名称:" prop="tableName">
-            <el-select
-              v-model="tableItemForm.tableName"
-              @change="getList()"
-              placeholder="请选择表格名称"
-            >
-              <el-option
-              v-for="item in tableList"
-              :key="item.tableName"
-              :label="item.tableComment"
-              :value="item.tableName"
-              >
-              <span style="float: left">{{ item.tableComment }}</span>
-              <span style="float: right; color: #8492a6; font-size: 13px">{{
-                item.tableName
-              }}</span>
-              </el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="表格主键:" prop="selectFields">
-            <el-select
-              v-model="tableItemForm.selectFields"
-              placeholder="请选择表格主键"
-            >
-            <el-option
-              v-for="item in tableFieldList"
-              :key="item.fieldName"
-              :label="item.fieldDescription"
-              :value="item.fieldName"
-            >
-              <span style="float: left">{{ item.fieldDescription }}</span>
-              <span style="float: right; color: #8492a6; font-size: 13px">{{
-                item.fieldName
-              }}</span>
-            </el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="时间格式" prop="timeFormate">
-            <el-select
-              v-model="tableItemForm.timeFormate"
-              placeholder="请选择时间格式"
-            >
-              <el-option
-                v-for="val in dict.type.sys_time_format"
-                :key="val.value"
-                :label="val.label"
-                :value="val.value"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="排序依赖字段">
-            <el-select
-              v-model="tableItemForm.orderByColumn"
-              placeholder="请选择排序依赖"
-            >
-              <el-option
-                v-for="val in orderByFieldList"
-                :key="val.fieldName"
-                :label="val.fieldDescription"
-                :value="val.tableName + '.' + val.fieldName"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="排序方式" v-show="tableItemForm.orderByColumn">
-            <el-radio v-model="tableItemForm.isAsc" :label="false"
-              >升序</el-radio
-            >
-            <el-radio v-model="tableItemForm.isAsc" :label="true"
-              >降序</el-radio
-            >
-          </el-form-item>
-          <el-form-item label="菜单路由" prop="routePath">
-          <div class="treeselect">
-            <treeselect
-              :append-to-body="true"
-              v-model="tableItemForm.routePath"
-              :options="menus"
-              :normalizer="normalizer"
-              :show-count="true"
-              placeholder="请选择父级路由"
-            />
-          </div>
-        </el-form-item>
-          <el-form-item label="展示字段:" prop="FieldList">
-            <el-table
-            :data="tableFieldList"
-            border
-            ref="dragTable"
-            row-key="id"
-            max-height="500px"
-            class="tablefiled"
-            >
-            <el-table-column
-              type="index"
-              label="序号"
-              width="50"
-              class-name="allowDrag"
-            >
-            </el-table-column>
-            <el-table-column prop="fieldName" label="数据字段"></el-table-column>
-            <el-table-column prop="fieldDescription" label="字段描述">
-              <template slot-scope="scope">
-                <input
-                  :class="{
-                    isNullDesc:
-                      scope.row.fieldDescription == '' &&
-                      scope.row.isShow &&
-                      isInputInvalid
-                        ? true
-                        : false,
-                    ipt: true,
-                  }"
-                  v-model="scope.row.fieldDescription"
-                />
-              </template>
-            </el-table-column>
-            <el-table-column width="95px" prop="relationTable" label="关联表">
-              <template slot-scope="scope">
-                <el-select
-                  v-model="scope.row.relationTable"
-                  :disabled="
-                    !scope.row.relationTableList ||
-                    !scope.row.relationTableList.length
-                  "
-                  placeholder="请选择关联的表"
-                  clearable
-                  filterable
-                  @change="ralationTableChange(scope.row)"
-                >
-                  <el-option
-                    v-for="(item, index) in scope.row.relationTableList"
-                    :key="index"
-                    :label="item.tableComment"
-                    :value="item.tableName"
-                  >
-                    <span style="float: left">{{ item.tableComment }}</span>
-                    <span
-                      style="float: right; color: #8492a6; font-size: 13px"
-                      >{{ item.tableName }}</span
-                    >
-                  </el-option>
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column width="95px" prop="relationFieldName" label="关联条件字段">
-              <template slot-scope="scope">
-                <el-select
-                  v-model="scope.row.relationFieldName"
-                  @change="relationFieldChange(scope.row)"
-                  :disabled="!scope.row.disableRelaFieldName"
-                  placeholder="关联字段"
-                  filterable
-                >
-                  <el-option
-                    v-for="(item, index) in scope.row.relaFieldNameList"
-                    :key="index"
-                    :label="item.fieldDescription"
-                    :value="item.fieldName"
-                  >
-                  </el-option>
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column width="95px" prop="relationType" label="关联方式">
-              <template slot-scope="scope">
-                <el-select
-                  v-model="scope.row.relationType"
-                  placeholder="请选择关联方式"
-                  :disabled="!scope.row.disableRelaType"
-                  @change="relationTypeChangeHandler(scope.row)"
-                  filterable
-                >
-                  <el-option
-                    v-for="(item, index) in relaTypeList"
-                    :key="index"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column prop="isShow" label="是否显示">
-              <template slot-scope="scope">
-                <el-switch v-model="scope.row.isShow"> </el-switch>
-              </template>
-            </el-table-column>
-            <el-table-column prop="isSearch" label="是否包含查询">
-              <template slot-scope="scope">
-                <el-switch v-model="scope.row.isSearch" @change="isSearchChange($event, scope.row,  scope.$index)"> </el-switch>
-              </template>
-            </el-table-column>
-          </el-table>
-          </el-form-item>
-          <el-form-item class="btn">
-            <el-button @click="dialogVisible = false">取 消</el-button>
-            <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
-          </el-form-item>
-        </el-form>
-      </div>
-    </el-dialog>
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getLists"
+    />
   </div>
 </template>
 
@@ -371,8 +157,9 @@ export default {
      loading: false,
 
      tableItemRules: [],
+    total: 0,
     // 新增弹框数据
-     tableItemForm: {
+    tableItemForm: {
         tId: "",
         rowId: "",
         title: "",
@@ -383,9 +170,9 @@ export default {
         orderByColumn: "",
         routePath: undefined,
       },
-     tableFieldList: [],
+    tableFieldList: [],
         // 关联方式
-      relaTypeList: [
+    relaTypeList: [
       {
         label: "等值连接",
         value: "INNER JOIN",
@@ -398,9 +185,28 @@ export default {
         label: "右连接",
         value: "RIGHT JOIN",
       },
-    ],
+      ],
+    queryParams: {
+        groupType: 1,
+        pageNum: 1,
+        pageSize: 10,
+        dtName: null,
+        dtNickname: null,
+        tableKey: null,
+        sqlKey: null,
+        dtTableName: null,
+        dtNotes: null,
+        dtColumnName: null,
+        timeFormat: null,
+        spare: null,
+        spare1: null,
+        isSelection: null,
+      },
    }
  },
+ created() {
+    this.getLists();
+  },
  computed: {
     selectRelate(){
       if(this.tableItemForm.tableName =='') return
@@ -441,15 +247,54 @@ export default {
     },
   },
   methods: {
+    getLists(){
+      this.loading = true;
+      listGroup(this.queryParams).then((response) => {
+        this.tableData = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+        
+    },
+     // 删除表格组
+     DeleteTableGroup(row){
+      const fIds = row.id || this.ids;
+      this.$modal
+        .confirm('是否确认删除动态单编号为"' + fIds + '"的数据项?删除后表格中所有的数据都将删除!')
+        .then(function () {
+          
+          return delGroup(fIds);
+        })
+        .then(async () => {
+          this.getLists();
+          this.$modal.msgSuccess("删除成功");
+
+        })
+        .catch(() => {});
+    },
     // 搜索
     handleQuery(){},
     // 重置
     resetQuery(){},
     // 新增按钮
     async handleAdd(){
-      this.dialogVisible = true
-      this.getAllTable()
-      await this.getMenuList()
+      // this.dialogVisible = true
+      this.$router.push({
+        path: "/system/fromModel/index/dialogMange",
+      });
+      // this.getAllTable()
+      // await this.getMenuList()
+    },
+
+    /** 修改按钮操作 */
+    async handleUpdate(row) {
+      // 兼容勾选单个的修改
+      this.$router.push({
+        path: "/system/fromModel/index/dialogMange",
+        query: {
+          tId: row.id,
+        },
+      });
     },
     // 获取所有表格
     async getAllTable() {
@@ -468,41 +313,6 @@ export default {
         );
       });
     },
-    /** 查询列表 */
-    getList(queryParams) {
-      if (!this.tableItemForm.tableName) return;
-      let data = {
-        databaseName: this.databaseName,
-        databaseType: this.databaseType,
-        tableName: this.tableItemForm.tableName,
-      };
-      
-      // 获取当前表单结构信息
-      getListName(data).then((res) => {
-        this.tableFieldList = res.map((item, index) => {
-          return {
-            id: this.tableItemForm.tableName + "_" + item.fieldName,
-            fieldName: item.fieldName,
-            fieldDescription: item.fieldDescription,
-            relationTable: "",
-            relationFieldName: "",
-            relaFieldNameList: [],
-            disableRelaFieldName: false,
-            relationType: "",
-            relationShowField: [],
-            relationShowFiledList: [],
-            disableRelaType: false,
-            isShow: true,
-            isSearch: false,
-            isExport: true,
-            relationTableList: this.relationTableList,
-            tableName: this.tableItemForm.tableName,
-            relationFieldList: [],
-          };
-        });
-      });
-
-    },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.id);
@@ -513,83 +323,6 @@ export default {
       this.multiple = !selection.length;
     },
 
-    // 递归拼接查询语句
-    getSQLString(tableFieldList, fieldArr, tableArr, sqlType = "mysql") {
-      let prefix = "{DBNAME}.";
-      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
-      for (let i = 0; i < tableFieldList.length; i++) {
-        let temp = tableFieldList[i];
-        if (temp.isShow) {
-          let tempArr = prefix + temp.tableName + "." + temp.fieldName;
-          if (temp.isChildren) {
-            tempArr += asOrSpace + temp.tableName + "_" + temp.fieldName;
-          }
-          fieldArr.push(tempArr);
-        }
-        if (temp.relationTable && temp.relationFieldName && temp.relationType) {
-          let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
-          tableArr.push(
-            temp.relationType +
-              " " +
-              isNeedUsername +
-              prefix +
-              temp.relationTable +
-              asOrSpace +
-              temp.relationTable +
-              " ON " +
-              prefix +
-              temp.relationTable +
-              "." +
-              temp.relationFieldName +
-              " = " +
-              prefix +
-              temp.tableName +
-              "." +
-              temp.fieldName
-          );
-        }
-      }
-      // 如果主键不包含显示,则添加至sql语句中
-      let isNotInclude = this.tableFieldList.find(
-        (val) => !val.isShow && val.fieldName == this.tableItemForm.selectFields
-      );
-      if (isNotInclude) {
-        fieldArr.push(
-          prefix + isNotInclude.tableName + "." + isNotInclude.fieldName
-        );
-      }
-    },
-    // 拼接查询sql语句
-    getSQLStr() {
-      let prefix = "{DBNAME}.";
-      let sqlType = this.databaseType; //数据库类型
-      // let sqlType = "oracle";
-      let sql = "";
-      // mysql
-      sql += "SELECT ";
-      let fieldNameArr = [],
-        relaTypeArr = [];
-      this.getSQLString(
-        this.tableFieldList,
-        fieldNameArr,
-        relaTypeArr,
-        sqlType
-      );
-      let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
-      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
-      sql +=
-        fieldNameArr.join(",") +
-        " FROM " +
-        isNeedUsername +
-        prefix +
-        this.tableItemForm.tableName +
-        asOrSpace +
-        this.tableItemForm.tableName;
-      if (relaTypeArr.length) {
-        sql += " " + relaTypeArr.join(" ");
-      }
-      return sql;
-    },
     // 关联表变化回调
     async ralationTableChange(row) {
       this.tableFieldList = this.tableFieldList.filter((item) => {
@@ -696,69 +429,11 @@ export default {
         }
       }
     },
-    // 更新路由
-    reloadRouter() {
-      this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {
-        this.$router.addRoutes(accessRoutes); // 动态添加可访问路由表
-      });
-    },
-    // 获取路由表单数据
-    async getMenuList() {
-      let res = await listGroup();
-      this.menus = this.handleTree(res.data, "menuId");
-    },
-    // 获取目标menu
-    getTargetMenu(menus) {
-      for (let i = 0; i < menus.length; i++) {
-        if (menus[i].menuId == this.groupForm.routePath) {
-          return menus[i];
-        } else if (menus.children?.length) {
-          return this.getTargetMenu(menus.children);
-        }
-      }
-      return false;
-    },
-    // 获取父级menuId
-    getParentMenuId(menuId, menus) {
-      let res;
-      for (let i = 0; i < menus.length; i++) {
-        let item = menus[i];
-        if (item.menuId == menuId) {
-          res = item.parentId;
-          break;
-        } else if (item.children?.length) {
-          if (
-            this.getParentMenuId(
-              menuId,
-              JSON.parse(JSON.stringify(item.children))
-            )
-          ) {
-            res = this.getParentMenuId(
-              menuId,
-              JSON.parse(JSON.stringify(item.children))
-            );
-          }
-        }
-      }
-      return res;
-    },
     // 获取路由表单数据
     async getMenuList() {
       let res = await getMenuList();
       this.menus = this.handleTree(res.data, "menuId");
     },
-    
-    /** 转换菜单数据结构 */
-    normalizer(node) {
-      if (node.children && !node.children.length) {
-        delete node.children;
-      }
-      return {
-        id: node.menuId,
-        label: node.menuName,
-        children: node.children,
-      };
-    },
     // 更新路由
     reloadRouter() {
       this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {

+ 1 - 1
ruoyi-ui/src/views/dragform/tableList.vue

@@ -259,6 +259,7 @@ export default {
       open: false,
       // 查询参数
       queryParams: {
+        dtType: 0,
         pageNum: 1,
         pageSize: 10,
         dtName: null,
@@ -364,7 +365,6 @@ export default {
     //   this.title = "添加动态格";
     // },
     handleAdd() {
-      console.log(this.addRoutes);
       this.$router.push({
         path: "/system/fromModel/index/tableMange",
       });

+ 31 - 30
ruoyi-ui/src/views/relateTable/components/RelateTableCard.vue

@@ -192,13 +192,12 @@ export default {
     // 请求数据
     async gettableListHandler(tableKey, paramsContion = [], defaultVal ={}){
       const res = await dragTableInfo({queryMap: {tableKey : tableKey }})
-      this.getTableHandle(res,paramsContion = [],defaultVal = {})
+      this.getTableHandle(res, paramsContion = [],defaultVal = {})
     },
     async getTableHandle(res){
         this.columns = []
         // 得到当前模版信息 --- sql columns queryWhere
         this.templateInfo = res.data.resultMap;
-  
         this.queryParams.orderByColumn =
           res.data.resultMap.querySql.orderByColumn;
         this.sortOrder = JSON.parse(res.data.resultMap.querySql.sortOrder);
@@ -229,33 +228,39 @@ export default {
             if(this.newsort == 0){
               this.getDataHandler()
               // this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
-            } else {
-
             }
             let k;
+            
             // console.log('conditions', this.tableCondition);
-            // this.tableCondition[1].
-            this.tableCondition.forEach((item, i) => {
-              let val = item.split('=')
-              if(i!==0){
-                
-                k =val[0].split('.')
-                let str = k[0].trim() + '.' + k[1]
-                this.condition.push({
-                  key: k[0].trim(),
-                  value: k[1]
-                })
-
+           this.contion = this.templateInfo.template.dtTableName + '.' + this.templateInfo.template.primaryKey
+            // this.tableCondition.forEach((item, i) => {
+            //   let val = item.split('=')
+            //   if(i!==0){
                 
-              }
-            })
+            //     k =val[0].split('.')
+            //     let str = k[0].trim() + '.' + k[1]
+            //     this.condition.push({
+            //       key: k[0].trim(),
+            //       value: k[1]
+            //     })
+            //   }
+            // })
+            
         }  
     },
     // 获取表数据
     async getDataHandler(contion, list){
-      contion?.forEach(item => {
-        this.queryParams.queryMap['#{' + item.key + '.' + item.value] = "'" + list[item.value] + "'";
-      })
+      console.log(contion);
+      console.log(list);
+      if(contion){
+        let key = contion.split('.')
+        this.queryParams.queryMap['#{' + contion] = "'" + list[key[1]] + "'";
+      }
+      this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
+      
+      // contion?.forEach(item => {
+      //   this.queryParams.queryMap['#{' + item.key + '.' + item.value] = "'" + list[item.value] + "'";
+      // })
       this.tableList = [];
       let tableLists = await unionListTableData(this.queryParams)
       if(tableLists.code == 200){
@@ -272,16 +277,11 @@ export default {
             }
             return kv;
           })
-        if(this.tableList.length !== 0){
-          this.$emit(
-            "updateData",
-            this.tableList[0],
-            this.index,
-          );
+
+          console.log(this.tableList);
         }
-      }
-      this.total = tableLists.total;
-      this.loading = false; 
+        this.total = tableLists.total;
+        this.loading = false; 
     },
     // 处理列表信息
     columnsHandler(columns) {
@@ -298,6 +298,7 @@ export default {
     },
     // 调用父组件方法更新表格数据
     handleCurrentChange(row,event,column,val) {
+      // console.log(row);
       this.$emit(
         "updateData",
         row,

+ 0 - 1685
ruoyi-ui/src/views/relateTable/index copy.vue

@@ -1,1685 +0,0 @@
-<template>
-  <div class="app-container">
-    <el-form
-      :model="queryParams"
-      ref="queryForm"
-      size="small"
-      :inline="true"
-      v-show="showSearch"
-      label-width="68px"
-    >
-      <el-form-item label="表格组名" prop="dtName">
-        <el-input
-          v-model="queryParams.dtName"
-          placeholder="请输入表格组名"
-          clearable
-          @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-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
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          >新增</el-button
-        >
-      </el-col>
-
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="DeleteTableGroup"
-          >删除</el-button
-        >
-      </el-col>
-      <!-- <el-col :span="1.5">
-        <el-button type="danger" plain size="mini" @click="handlePreview"
-          >动态页面</el-button
-        >
-      </el-col> -->
-    </el-row>
-
-    <el-table
-      v-loading="loading"
-      :data="tableGroupList"
-      ref="tableRef"
-      @selection-change="handleSelectionChange"
-    >
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="表格主键" align="center" prop="id" />
-      <el-table-column label="表格组名" align="center" prop="groupName" />
-      <el-table-column label="描述" align="center" prop="groupDescription" />
-      <el-table-column label="表格数" align="center" prop="groupCount" />
-
-      <el-table-column
-        label="成员表格"
-        width="180"
-        >
-        <template slot-scope="scope">
-          <el-popover trigger="hover" placement="top">
-            <p v-for="(item,index) in scope.row.groupTableInfo"> {{ index == 0 ? '' :item.tablename }}</p>
-            
-            <div slot="reference" class="name-wrapper">
-            <el-tag size="medium">{{ scope.row.groupTableInfo[0].tablename }}</el-tag>
-            </div>
-          </el-popover>
-        </template>
-      </el-table-column>
-
-      <el-table-column
-        label="操作"
-        align="center"
-        class-name="small-padding fixed-width"
-      >
-        <template slot-scope="scope">
-          <el-dropdown>
-            <el-button type="warning" plain size="small">
-              处理<i class="el-icon-arrow-down el-icon--right"></i>
-            </el-button>
-            <el-dropdown-menu slot="dropdown">
-              <el-dropdown-item>
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-edit"
-                  @click="UpdateTableGroup(scope.row)"
-                  >修改
-                </el-button>
-              </el-dropdown-item>
-              <el-dropdown-item>
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-delete"
-                  @click="DeleteTableGroup(scope.row)"
-                  >删除
-                </el-button>
-              </el-dropdown-item>
-            </el-dropdown-menu>
-          </el-dropdown>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <pagination
-      v-show="total > 0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getTableList"
-    />
-
-    <!-- 新增联动表格组弹窗 -->
-    <el-dialog :title="groupTitle ? '新增动态表格组' : '修改动态表格组'" :visible.sync="isShowTable">
-      <div class="dialog_wrap">
-        <el-button
-          type="primary"
-          size="small"
-          icon="el-icon-plus"
-          @click="addOneTable"
-          class="mb10"
-          >新增</el-button
-        >
-        <el-form :model="groupForm" :rules="grouprules" ref="groupForm" label-width="100px" class="demo-ruleForm">
-          <el-form-item label="表格组名" prop="groupName">
-            <el-input v-model="groupForm.groupName" placeholder="请输入表格组名"></el-input>
-          </el-form-item>
-          <el-form-item label="表格描述" prop="groupDescription">
-            <el-input v-model="groupForm.groupDescription" placeholder="请输入表格描述"></el-input>
-          </el-form-item>
-          <el-form-item label="菜单路由" prop="routePath">
-          <div class="treeselect">
-            <treeselect
-              :append-to-body="true"
-              v-model="groupForm.routePath"
-              :options="menus"
-              :normalizer="normalizer"
-              :show-count="true"
-              placeholder="请选择父级路由"
-            />
-          </div>
-           
-          </el-form-item>
-        <el-form-item>
-          <el-table
-          :data="tableDataList"
-          border
-          stripe
-          @selection-change="handleSelectionChange"
-        >
-          <el-table-column label="序号" type="index" />
-          <el-table-column label="表格标题" prop="dtName" />
-          <el-table-column
-            label="表格名称"
-            prop="dtTableName"
-          ></el-table-column>
-          <el-table-column label="表格主键" prop="primaryKey">
-            <!-- <template slot-scope="scope" v-for="item in conditionDefaultValueMap ">
-              {{ item }}
-            </template> -->
-          </el-table-column>
-
-          <el-table-column
-            label="操作"
-            align="center"
-            class-name="small-padding fixed-width"
-          >
-            <template slot-scope="scope">
-              <el-dropdown>
-                <el-button type="warning" plain size="small">
-                  处理<i class="el-icon-arrow-down el-icon--right"></i>
-                </el-button>
-                <el-dropdown-menu slot="dropdown">
-                  <el-dropdown-item>
-                    <el-button
-                      size="mini"
-                      type="text"
-                      icon="el-icon-edit"
-                      @click="relateOne(scope.row)"
-                      >修改
-                    </el-button>
-                  </el-dropdown-item>
-                  <el-dropdown-item>
-                    <el-button
-                      size="mini"
-                      type="text"
-                      icon="el-icon-delete"
-                      @click="handleDelete(scope.row)"
-                      >删除
-                    </el-button>
-                  </el-dropdown-item>
-                </el-dropdown-menu>
-              </el-dropdown>
-            </template>
-          </el-table-column>
-          </el-table>
-        </el-form-item>
-        
-        <el-form-item class="btn">
-          <el-button @click="cancelGroup">取消</el-button>
-          <el-button type="primary" @click="addTableGroup('groupForm')">确认</el-button>
-        </el-form-item>
-        </el-form>
-      </div>
-    </el-dialog>
-
-    <!-- 编辑某一条表格数据弹窗 -->
-    <el-dialog :title="relateTitle ? '添加关联表格' :'修改关联表格' " :visible.sync="isShowForm" >
-      <div class="formWrap">
-        <el-form
-          :rules="tableItemRules"
-          ref="tableItemForm"
-          style="max-width: 750px; width: 1000px"
-          :model="tableItemForm"
-          label-width="100px"
-        >
-          <el-form-item label="表格标题:" prop="title">
-            <el-input
-              v-model="tableItemForm.title"
-              style="max-width: 221px"
-              @change="iptChange()"
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="表格名称:" prop="tableName">
-            <el-select
-              v-model="tableItemForm.tableName"
-              @change="getList()"
-              placeholder="请选择表格名称"
-            >
-              <el-option
-              v-for="item in tableList"
-              :key="item.tableName"
-              :label="item.tableComment"
-              :value="item.tableName"
-              >
-              <span style="float: left">{{ item.tableComment }}</span>
-              <span style="float: right; color: #8492a6; font-size: 13px">{{
-                item.tableName
-              }}</span>
-              </el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="表格主键:" prop="selectFields">
-            <el-select
-              v-model="tableItemForm.selectFields"
-              placeholder="请选择表格主键"
-            >
-            <el-option
-              v-for="item in tableFieldList"
-              :key="item.fieldName"
-              :label="item.fieldDescription"
-              :value="item.fieldName"
-            >
-              <span style="float: left">{{ item.fieldDescription }}</span>
-              <span style="float: right; color: #8492a6; font-size: 13px">{{
-                item.fieldName
-              }}</span>
-            </el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="时间格式" prop="timeFormate">
-            <el-select
-              v-model="tableItemForm.timeFormate"
-              placeholder="请选择时间格式"
-            >
-              <el-option
-                v-for="val in dict.type.sys_time_format"
-                :key="val.value"
-                :label="val.label"
-                :value="val.value"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="排序依赖字段">
-            <el-select
-              v-model="tableItemForm.orderByColumn"
-              placeholder="请选择排序依赖"
-            >
-              <el-option
-                v-for="val in orderByFieldList"
-                :key="val.fieldName"
-                :label="val.fieldDescription"
-                :value="val.tableName + '.' + val.fieldName"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item label="排序方式" v-show="tableItemForm.orderByColumn">
-            <el-radio v-model="tableItemForm.isAsc" :label="false"
-              >升序</el-radio
-            >
-            <el-radio v-model="tableItemForm.isAsc" :label="true"
-              >降序</el-radio
-            >
-          </el-form-item>
-          <el-form-item label="展示字段:" prop="FieldList">
-            <el-table
-            :data="tableFieldList"
-            border
-            ref="dragTable"
-            row-key="id"
-            max-height="500px"
-            class="tablefiled"
-            >
-            <el-table-column
-              type="index"
-              label="序号"
-              width="50"
-              class-name="allowDrag"
-            >
-            </el-table-column>
-            <el-table-column prop="fieldName" label="数据字段"></el-table-column>
-            <el-table-column prop="fieldDescription" label="字段描述">
-              <template slot-scope="scope">
-                <input
-                  :class="{
-                    isNullDesc:
-                      scope.row.fieldDescription == '' &&
-                      scope.row.isShow &&
-                      isInputInvalid
-                        ? true
-                        : false,
-                    ipt: true,
-                  }"
-                  v-model="scope.row.fieldDescription"
-                />
-              </template>
-            </el-table-column>
-            <el-table-column width="95px" prop="relationTable" label="关联表">
-              <template slot-scope="scope">
-                <el-select
-                  v-model="scope.row.relationTable"
-                  :disabled="
-                    !scope.row.relationTableList ||
-                    !scope.row.relationTableList.length
-                  "
-                  placeholder="请选择关联的表"
-                  clearable
-                  filterable
-                  @change="ralationTableChange(scope.row)"
-                >
-                  <el-option
-                    v-for="(item, index) in scope.row.relationTableList"
-                    :key="index"
-                    :label="item.tableComment"
-                    :value="item.tableName"
-                  >
-                    <span style="float: left">{{ item.tableComment }}</span>
-                    <span
-                      style="float: right; color: #8492a6; font-size: 13px"
-                      >{{ item.tableName }}</span
-                    >
-                  </el-option>
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column width="95px" prop="relationFieldName" label="关联条件字段">
-              <template slot-scope="scope">
-                <el-select
-                  v-model="scope.row.relationFieldName"
-                  @change="relationFieldChange(scope.row)"
-                  :disabled="!scope.row.disableRelaFieldName"
-                  placeholder="关联字段"
-                  filterable
-                >
-                  <el-option
-                    v-for="(item, index) in scope.row.relaFieldNameList"
-                    :key="index"
-                    :label="item.fieldDescription"
-                    :value="item.fieldName"
-                  >
-                  </el-option>
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column width="95px" prop="relationType" label="关联方式">
-              <template slot-scope="scope">
-                <el-select
-                  v-model="scope.row.relationType"
-                  placeholder="请选择关联方式"
-                  :disabled="!scope.row.disableRelaType"
-                  @change="relationTypeChangeHandler(scope.row)"
-                  filterable
-                >
-                  <el-option
-                    v-for="(item, index) in relaTypeList"
-                    :key="index"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </el-select>
-              </template>
-            </el-table-column>
-            <el-table-column prop="isShow" label="是否显示">
-              <template slot-scope="scope">
-                <el-switch v-model="scope.row.isShow"> </el-switch>
-              </template>
-            </el-table-column>
-            <el-table-column prop="isSearch" label="是否包含查询">
-              <template slot-scope="scope">
-                <el-switch v-model="scope.row.isSearch" @change="isSearchChange($event, scope.row,  scope.$index)"> </el-switch>
-              </template>
-            </el-table-column>
-          </el-table>
-          </el-form-item>
-          <el-form-item class="btn">
-            <el-button @click="cancelAddHandler">取消</el-button>
-            <el-button type="primary" @click="confirmAddHandler('tableItemForm')">确认</el-button>
-          </el-form-item>
-        </el-form>
-      </div>
-    </el-dialog>
-
-    <!-- 是否包含查询字段依赖值对话框 -->
-    <div class="isSearch">
-      <el-dialog
-      title="包含查询依赖值"
-      :visible.sync="isSearchDialog">
-      <el-select v-model="relyOption" placeholder="请选择依赖方式">
-        <el-option
-          v-for="item in relyOptions"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value">
-        </el-option>
-      </el-select>
-      <el-input v-show="relyOption === '0'" v-model="conditionDefaultValueMap" placeholder="请输入依赖内容"></el-input>
-
-      <el-select v-show="relyOption === '1'" v-model="conditionDefaultValueMap" placeholder="请选择依赖字段">
-        <el-option
-          v-for="item in relyFileds.tableFieldList"
-          :key="item.fieldName"
-          :label="item.fieldDescription"
-          :value="item.fieldName">
-        </el-option>
-      </el-select>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="isSearchCancel">取 消</el-button>
-        <el-button type="primary" @click="isSearchBtn">确 定</el-button>
-      </span>
-      </el-dialog>
-    </div>
-    
-  </div>
-</template>
-<script>
-import { listTable, removeTableList } from "@/api/dragform/tableList";
-import { getFormName, getListName, dragTablePreview, } from "@/api/dragform/form.js";
-import { delMenu } from "@/api/system/menu";
-import { getMenuList, addMenu} from "@/api/menu.js";
-import { getParticMenu, updateMenu } from "@/api/system/menu.js";
-import { addGroup, listGroup, getTable, delGroup, updataGroup } from '@/api/relateTable/index.js'
-import { addDragTable } from "@/api/tablelist/commonTable.js";
-import { mapGetters, mapState } from "vuex";
-import DictData from "@/components/DictData";
-import { FastBackwardFill, async } from "@/components/updateModule/k-form-design/lib/k-form-design.common";
-import { v4 as uuidv4 } from "uuid";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import json from "highlight.js/lib/languages/json";
-import { getTableInfo, editTable } from "@/api/system/table.js";
-
-export default {
-  name: "relateTable",
-  components: { Treeselect },
-  dicts: ["sys_time_format", "table_statistic_type"],
-  data() {
-    return {
-      isInputInvalid: false,
-
-      // 包含查询依赖字段dialog
-      isSearchDialog: false,
-      isSearchIndex: null,
-      // 依赖方式
-      relyOption: null,
-      relyOptions:[
-        {
-         value: '0',
-         label: '自定义依赖值'
-        },
-        {
-          value: '1',
-          label: '依赖其他字段'
-        }
-      ],
-      // 依赖值
-      conditionDefaultValueMap: '',
-      // 上个表格名称及字段
-      relyFileds: {},
-      formdata:{
-        conditionDefaultValueMap: {}
-      },
-      conditionDefault:[],
-      addDragData:[],
-      groupList:[],
-      menus: [], //路由列表数据
-      // 添加关联表格校验规则
-      tableItemRules:{
-        title:[{ required: true, message: '请输入表格标题', trigger: 'blur' }],
-        // tableName:[{ required: true, message: '请选择表格名称', trigger: 'change' }],
-        // selectFields: [{ required: true, message: '请选择关联字段', trigger: 'change' }],
-      },
-      groupForm: {
-        groupName: '',
-        groupDescription:'',
-        routePath: undefined,
-      },
-      grouprules:{
-        groupName:[{ required: true, message: '请输入表格组名', trigger: 'blur' }],
-        groupDescription:[{ required: true, message: '请输入表格描述', trigger: 'blur' }],
-        routePath: [
-          { required: true, message: "请选择路由", trigger: "change" },
-        ],
-      },
-      menuOrderNum: 0,
-      // 关联方式
-      relaTypeList: [
-        {
-          label: "等值连接",
-          value: "INNER JOIN",
-        },
-        {
-          label: "左连接",
-          value: "LEFT JOIN",
-        },
-        {
-          label: "右连接",
-          value: "RIGHT JOIN",
-        },
-      ],
-      searchFieldList: [],
-      // 依赖字段
-      relyFiledsList: [],
-      // 修改row
-      updataGroupRow:{},
-      // 遮罩层
-      loading: false,
-      // 选中数组
-      ids: [],
-      menuIds: [],
-      // 选中数组(包含所有数据)
-      selection: [],
-      Keys: [],
-      menuIds: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      tableList: [], //所有表格列表
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        dtName: null,
-        dtNickname: null,
-        tableKey: null,
-        sqlKey: null,
-        dtTableName: null,
-        dtNotes: null,
-        dtColumnName: null,
-        timeFormat: null,
-        spare: null,
-        spare1: null,
-        isSelection: null,
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {},
-
-      // dialog弹窗数据
-      isShowTable: false,
-      isShowForm: false,
-      // 新增关联表数据
-      tableDataList: [],
-
-      tableFieldList: [], // 当前表格字段数据
-      tableName: "", // 当前表名称
-      selectFields: '', //关联字段
-      relateTitle: true,
-      relateTableName: "", //关联表名称
-      relateFields: "", //子集关联字段
-      relateFieldList: [], //子集关联字段数据
-      groupTitle: true,
-      tableItemForm: {
-        tId: "",
-        rowId: "",
-        title: "",
-        tableName: "",
-        selectFields: "",
-        isAsc: false,
-        timeFormate: "",
-        orderByColumn: "",
-      },
-      tableGroupList: [],
-      // 成员表格提示
-      tableKeyContent: '',
-      groupsMenuId: "",
-      // 修改表格时的menuId
-      menuId: "",
-      // 修改是表格的id
-      groupId:''
-    };
-  },
-  async created() {
-    this.getTableList()
-  },
-  async mounted() {
-    await this.getMenuList();
-  },
-  computed: {
-    selectRelate(){
-      if(this.tableItemForm.tableName =='') return
-      return this.tableList.filter(item => item.tableName !== this.tableItemForm.tableName)
-    },
-    dataArr() {
-      return this.tableFieldList.filter((item) => item.isShow);
-    },
-    ...mapGetters(["addRoutes"]),
-    ...mapState({
-      databaseName: (state) => state.user.dataSource.databaseName,
-      databaseType: (state) => state.user.dataSource.databaseType,
-      username: (state) => state.user.dataSource.username,
-      tenantId: (state) => state.user.tenant.tenantId,
-    }),
-    orderByFieldList() {
-      return this.tableFieldList;
-    },
-  },
-  watch: {
-    'tableItemForm.tableName': function (val) {
-      if (val) {
-        this.relationTableList = this.tableList
-          .filter((item) => item.tableName != val)
-          .map((item) => {
-            return {
-              tableName: item.tableName,
-              tableComment: item.tableComment,
-            };
-          });
-      } else {
-        this.relationTableList = [];
-      }
-    },
-    'groupForm.routePath'(nval, oval) {
-      let targetMenu = this.getTargetMenu(this.menus);
-      this.menuOrderNum = targetMenu.children ? targetMenu.children.length : 0;
-    },
-  },
-  methods: {
-    iptChange(){
-	    this.$forceUpdate();  //强制刷新
-    },
-    async getTableList(){
-      let res = await listGroup(this.queryParams);
-      this.total = res.total;
-      let info = []
-      res.rows.forEach(item => {
-        item.groupCount = JSON.parse(item.groupTableInfo).length
-
-        info = JSON.parse(item.groupTableInfo)
-        this.groupsMenuId = info[0].menuId
-        item.menuId = info[0].menuId
-        item.groupTableInfo = info
-      })
-      console.log(info);
-      this.tableGroupList = res.rows
-      console.log(this.tableGroupList)
-    },
-    // 是否包含查询switch
-    isSearchChange(status, row,index){
-      this.isSearchDialog = status
-      if(this.isSearchDialog == true){
-        this.conditionDefaultValueMap = ''
-      }
-      this.isSearchIndex = index
-    },
-    // 添加依赖字段取消
-    isSearchCancel(){
-      this.relyOption = null
-      this.conditionDefaultValueMap = ''
-      this.isSearchDialog = false
-      this.tableFieldList[this.isSearchIndex].isSearch = false
-    },
-    isSearchBtn(){
-      if(this.relyFileds.tableName !== undefined){
-        console.log(this.relyFileds.tableName);
-        this.conditionDefault.push('#{'+this.relyFileds.tableName+'.'+this.conditionDefaultValueMap)
-      }else{
-        this.conditionDefault.push(this.conditionDefaultValueMap)
-      }
-      console.log(this.conditionDefault)
-      this.isSearchDialog = false
-      this.conditionDefaultValueMap = ''
-      this.relyFileds.tableName = ''
-    },
-    // 获取路由表单数据
-    async getMenuList() {
-    let res = await listGroup();
-    console.log('res',  res);
-    this.menus = this.handleTree(res.data, "menuId");
-    },
-    // 递归拼接查询语句
-    getSQLString(tableFieldList, fieldArr, tableArr, sqlType = "mysql") {
-      let prefix = "{DBNAME}.";
-      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
-      for (let i = 0; i < tableFieldList.length; i++) {
-        let temp = tableFieldList[i];
-        if (temp.isShow) {
-          let tempArr = prefix + temp.tableName + "." + temp.fieldName;
-          if (temp.isChildren) {
-            tempArr += asOrSpace + temp.tableName + "_" + temp.fieldName;
-          }
-          fieldArr.push(tempArr);
-        }
-        if (temp.relationTable && temp.relationFieldName && temp.relationType) {
-          let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
-          tableArr.push(
-            temp.relationType +
-              " " +
-              isNeedUsername +
-              prefix +
-              temp.relationTable +
-              asOrSpace +
-              temp.relationTable +
-              " ON " +
-              prefix +
-              temp.relationTable +
-              "." +
-              temp.relationFieldName +
-              " = " +
-              prefix +
-              temp.tableName +
-              "." +
-              temp.fieldName
-          );
-        }
-      }
-      // 如果主键不包含显示,则添加至sql语句中
-      let isNotInclude = this.tableFieldList.find(
-        (val) => !val.isShow && val.fieldName == this.tableItemForm.selectFields
-      );
-      if (isNotInclude) {
-        fieldArr.push(
-          prefix + isNotInclude.tableName + "." + isNotInclude.fieldName
-        );
-      }
-    },
-    // 拼接查询sql语句
-    getSQLStr() {
-      let prefix = "{DBNAME}.";
-      let sqlType = this.databaseType; //数据库类型
-      // let sqlType = "oracle";
-      let sql = "";
-      // mysql
-      sql += "SELECT ";
-      let fieldNameArr = [],
-        relaTypeArr = [];
-      this.getSQLString(
-        this.tableFieldList,
-        fieldNameArr,
-        relaTypeArr,
-        sqlType
-      );
-      let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
-      let asOrSpace = sqlType == "oracle" ? " " : " AS ";
-      sql +=
-        fieldNameArr.join(",") +
-        " FROM " +
-        isNeedUsername +
-        prefix +
-        this.tableItemForm.tableName +
-        asOrSpace +
-        this.tableItemForm.tableName;
-      if (relaTypeArr.length) {
-        sql += " " + relaTypeArr.join(" ");
-      }
-      return sql;
-    },
-    /** 查询列表 */
-    getList(queryParams) {
-      if (!this.tableItemForm.tableName) return;
-      let data = {
-        databaseName: this.databaseName,
-        databaseType: this.databaseType,
-        tableName: this.tableItemForm.tableName,
-      };
-      
-      // 获取当前表单结构信息
-      getListName(data).then((res) => {
-        this.tableFieldList = res.map((item, index) => {
-          return {
-            id: this.tableItemForm.tableName + "_" + item.fieldName,
-            fieldName: item.fieldName,
-            fieldDescription: item.fieldDescription,
-            relationTable: "",
-            relationFieldName: "",
-            relaFieldNameList: [],
-            disableRelaFieldName: false,
-            relationType: "",
-            relationShowField: [],
-            relationShowFiledList: [],
-            disableRelaType: false,
-            isShow: true,
-            isSearch: false,
-            isExport: true,
-            relationTableList: this.relationTableList,
-            tableName: this.tableItemForm.tableName,
-            relationFieldList: [],
-          };
-        });
-      });
-
-    },
-    // 关联表变化回调
-    async ralationTableChange(row) {
-      this.tableFieldList = this.tableFieldList.filter((item) => {
-        return !row.relationFieldList.some((val) => {
-          return val.id == item.id;
-        });
-      });
-      row.relationFieldName = "";
-      row.relationType = "";
-      row.disableRelaFieldName = false;
-      row.disableRelaType = false;
-      row.relationFieldList = [];
-      if (!row.relationTable) {
-        return;
-      }
-      // 获取关联表的字段
-      let data = {
-        databaseName: this.databaseName,
-        databaseType: this.databaseType,
-        tableName: row.relationTable,
-      };
-      let res = await getListName(data);
-      // 关联字段下拉列表数据
-      row.relaFieldNameList = res.map((item) => {
-        return {
-          fieldName: item.fieldName,
-          fieldDescription: item.fieldDescription,
-        };
-      });
-      let relationTableList = row.relationTableList.filter(
-        (item) => row.relationTable != item.tableName
-      );
-      row.relationFieldList = row.relaFieldNameList.map((item, index) => {
-        return {
-          id: row.relationTable + "_" + item.fieldName,
-          fieldName: item.fieldName,
-          fieldDescription: item.fieldDescription,
-          relationTable: "",
-          relationFieldName: "",
-          relaFieldNameList: [],
-          disableRelaFieldName: false,
-          relationType: "",
-          relationShowField: [],
-          relationShowFiledList: [],
-          disableRelaType: false,
-          isShow: true,
-          isSearch: false,
-          isExport: true,
-          relationTableList,
-          tableName: row.relationTable,
-          relationFieldList: [],
-          isChildren: true,
-        };
-      });
-      row.disableRelaFieldName = true;
-    },
-    // 关联类型变化回调
-    relationTypeChangeHandler(row) {
-      let tempRelationFieldList = row.relationFieldList.filter((item) => {
-        return !this.tableFieldList.find((val) => val.id === item.id);
-      });
-      this.tableFieldList = [...this.tableFieldList, ...tempRelationFieldList];
-    },
-    // 关联字段回调
-    relationFieldChange(row) {
-      if (!row.relationFieldName) {
-        row.relationType = "";
-        row.disableRelaType = false;
-        row.relaFieldNameList = [];
-        return;
-      }
-      row.disableRelaType = true;
-    },
-    // 递归获取列表信息
-    getCol(
-      tableFieldList,
-      columns,
-      searchFieldList = [],
-      tableExportField = {}
-    ) {
-      if (!tableFieldList.length) return;
-      for (let i = 0; i < tableFieldList.length; i++) {
-        let temp = tableFieldList[i];
-        let tempFieldName = "",
-          exportFieldName = "";
-        if (temp.isChildren) {
-          tempFieldName = temp.tableName + "_" + temp.fieldName;
-          exportFieldName = temp.tableName + "@" + temp.fieldName;
-        } else {
-          tempFieldName = temp.fieldName;
-          exportFieldName = temp.fieldName;
-        }
-        if (temp.isShow) {
-          let tempObj = {};
-          tempObj[tempFieldName] = temp.fieldDescription;
-          columns.push(tempObj);
-        }
-        if (temp.isSearch) {
-          searchFieldList.push(temp.tableName + "." + temp.fieldName);
-        }
-
-        if (temp.isExport) {
-          tableExportField[exportFieldName] = temp.fieldDescription;
-        }
-      }
-    },
-     // 获取所有表格
-    async getAllTable() {
-      let data = {
-        databaseName: this.databaseName,
-        databaseType: this.databaseType,
-      };
-      let res = await getFormName(data);
-
-      const baseTable = await this.getDicts("base_table");
-
-      this.tableList = res.data.filter((item) => {
-        return !baseTable.data.some(
-          (value) =>
-            value.dictValue.toLowerCase() == item.tableName.toLowerCase()
-        );
-      });
-    },
-    // 确认添加一个表格
-    confirmAddHandler(formName) {
-      this.$refs[formName].validate((valid) => {
-        if (valid) {
-          let columns = [],
-            searchFieldList = []
-            this.getCol(
-              this.tableFieldList,
-              columns,
-              searchFieldList,
-            );
-          // 判断是否有包含查询字段
-          if (!searchFieldList.length) {
-          this.$message.warning("请至少选择一个包含查询字段");
-          return false;
-          }
-          let echoData = {
-            tableName: this.tableItemForm.tableName,
-            tableFieldData: this.tableFieldList,
-            formData: this.groupForm,
-          }
-          // 判断修改还是新增
-          if(this.relateTitle){ 
-            console.log('新增');
-            let tableKey = uuidv4();
-            let sqlKey = uuidv4();
-            searchFieldList.forEach((item, index) => {
-              this.formdata.conditionDefaultValueMap[item] = this.conditionDefault[index]
-            })
-            this.relyFileds.tableFieldList = this.tableFieldList
-            this.relyFileds.tableName = this.tableItemForm.tableName
-            this.tableItemForm.rowId = Date.now();
-
-            this.tableDataList.push({
-              dtName: this.tableItemForm.title,
-              dtTableName: this.tableItemForm.tableName,
-              rowId: this.tableItemForm.rowId,
-              selectFields: this.tableItemForm.selectFields,
-              orderByColumn: this.tableItemForm.orderByColumn,
-              timeFormate: this.tableItemForm.timeFormate,
-
-              rowId: this.tableItemForm.rowId,
-              tId: this.tId,
-              tableKey: tableKey,
-              sortOrder: this.tableItemForm.isAsc,
-              sqlKey: sqlKey,
-              dtColumnName: columns, 
-              timeFormat: 'yyyy-MM-dd',
-              searchFieldList: searchFieldList, 
-              conditionDefaultValueMap: this.formdata.conditionDefaultValueMap,
-              tableSql: this.getSQLStr(), 
-              tableExportField: '',
-              echoData: JSON.stringify(echoData),
-            });
-
-            // 选择依赖字段
-            this.groupList.push({tableFieldList: this.tableFieldList, tableItemForm: this.tableItemForm, conditionDefaultValueMap: this.conditionDefaultValueMap})
-
-            if(this.groupTitle){
-              this.addDragData.push({
-              rowId: this.tableItemForm.rowId,
-              tId: this.tId,
-              dtName: this.tableItemForm.title,
-              tableKey: tableKey,
-              dtTableName: this.tableItemForm.tableName,
-              primaryKey: this.tableItemForm.selectFields,
-              orderByColumn: this.tableItemForm.orderByColumn,
-              sortOrder: this.tableItemForm.isAsc,
-              sqlKey: sqlKey,
-              dtColumnName: columns, 
-              timeFormat: 'yyyy-MM-dd',
-              searchFieldList: searchFieldList, 
-              conditionDefaultValueMap: this.formdata.conditionDefaultValueMap,
-              tableSql: this.getSQLStr(), 
-              tableExportField: '',
-              echoData: JSON.stringify(echoData),
-              })
-            }
-            
-          } else {
-            console.log(456);
-            let tableKey = uuidv4();
-            let sqlKey = uuidv4();
-
-              this.relyFileds.tableFieldList = this.tableFieldList
-
-              this.relyFileds.tableName = this.tableItemForm.tableName
-
-
-              console.log(this.conditionDefault);
-              searchFieldList.forEach((item, index) => {
-                // if(this.conditionDefault.length > 1){
-                  this.formdata.conditionDefaultValueMap[item] = this.conditionDefault[index]
-                // }else{
-                //   this.formdata.conditionDefaultValueMap = this.conditionDefault
-                // }
-              })
-
-             console.log(this.tableItemForm);
-              this.tableDataList.forEach((item, index) => {
-                if(item.tId == this.tableItemForm.tId) {
-                  this.tableDataList[index] = {
-                    tId: this.tableItemForm.tId,
-                    dtName: this.tableItemForm.title,
-                    tableKey: tableKey,
-                    dtTableName: this.tableItemForm.tableName,
-                    primaryKey: this.tableItemForm.selectFields,
-                    orderByColumn: this.tableItemForm.orderByColumn,
-                    sortOrder: this.tableItemForm.isAsc,
-                    sqlKey: sqlKey,
-                    dtColumnName: columns, 
-                    timeFormat: 'yyyy-MM-dd',
-                    searchFieldList: searchFieldList, 
-                    conditionDefaultValueMap: this.formdata?.conditionDefaultValueMap,
-                    tableSql: this.getSQLStr(), 
-                    tableExportField: '',
-                    echoData: JSON.stringify(echoData),
-                  }
-                }
-              })
-
-              console.log('11',this.tableDataList);
-              this.$set(this.tableDataList)
-              console.log('11',this.addDragData);
-          }
-          this.isShowForm = false
-          this.tableItemForm = {}
-          this.tableFieldList = []
-          this.relyFiledsList = []
-          this.conditionDefault = []
-          this.conditionDefaultValueMap= ''
-          this.formdata.conditionDefaultValueMap = {}
-        } else {
-          this.$message.error("请完善表单信息");
-          return false;
-        }
-      });
-    },
-    // 修改一个表格数据
-    relateOne(row){
-      console.log(row);
-      if(row.tableKey){
-        this.menuId = row.menuId
-        
-        
-        for (const key in row.conditionDefaultValueMap) {  
-          // this.conditionDefaultValueMap = row.conditionDefaultValueMap[key]
-          console.log(key);
-        this.conditionDefaultValueMap = row.conditionDefaultValueMap[key]
-        
-        this.conditionDefault.push(row.conditionDefaultValueMap[key])
-      }
-        console.log(this.conditionDefaultValueMap);
-        // this.initTableData(row.tId);
-        let echoData = JSON.parse(row.echoData)
-
-        this.tableDataList.forEach((item, index) => {
-          if(item.tableKey == row.tableKey){
-            if(index == 0){
-
-              this.relyFileds.tableFieldList = ''
-            }else{
-
-              let beforeEcho = JSON.parse(this.tableDataList[index-1].echoData)
-              
-              this.relyFileds.tableFieldList = beforeEcho.tableFieldData
-
-            }
-          }
-        } )
-        this.tableFieldList = echoData.tableFieldData;
-        // this.tableItemForm = row
-        this.tableItemForm.tId = row.tId
-        this.tableItemForm.rowId = row.tableKey,
-        this.tableItemForm.isAsc = false,
-        this.tableItemForm.orderByColumn = "",
-        this.tableItemForm.title = row.dtName
-        this.tableItemForm.tableName = row.dtTableName
-        this.tableItemForm.selectFields = row.primaryKey
-        this.tableItemForm.timeFormate = row.timeFormat
-
-      }else{
-        this.tableItemForm.rowId = row.rowId,
-        this.tableItemForm.title = row.dtName
-        this.tableItemForm.selectFields = row.selectFields
-        this.tableItemForm.tableName = row.dtTableName
-        this.tableItemForm.orderByColumn = row.orderByColumn
-        this.tableItemForm.timeFormate = row.timeFormat
-      
-        this.getList()
-        this.groupList.forEach(item => {
-          if(item.tableItemForm.rowId == row.rowId){
-            item.tableFieldList = this.tableFieldList
-          }
-        })
-      }
-
-      this.getAllTable()
-      // console.log('修改', this.groupList);
-      // 展示字段的回显
-      this.relateTitle = false
-      this.isShowForm = true;
-    },
-    // 删除表格组
-    DeleteTableGroup(row){
-      const fIds = row.id || this.ids;
-      const menus = row.menuId || this.menuIds
-      this.$modal
-        .confirm('是否确认删除动态单编号为"' + fIds + '"的数据项?删除后表格中所有的数据都将删除!')
-        .then(function () {
-          return delGroup(fIds);
-        })
-        .then(async () => {
-          let res = await delMenu(menus);
-
-          this.getTableList();
-          this.reloadRouter();
-          this.$modal.msgSuccess("删除成功");
-
-        })
-        .catch(() => {});
-    },
-    // 取消新增
-    cancelAddHandler(){
-      this.isShowForm = false;
-      this.tableItemForm = {}
-      this.tableFieldList = []
-    },
-    // 关联类型变化回调
-    relationTypeChangeHandler(row) {
-      let tempRelationFieldList = row.relationFieldList.filter((item) => {
-        return !this.tableFieldList.find((val) => val.id === item.id);
-      });
-      this.tableFieldList = [...this.tableFieldList, ...tempRelationFieldList];
-    },
-    // 更新路由
-    reloadRouter() {
-      this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {
-        this.$router.addRoutes(accessRoutes); // 动态添加可访问路由表
-      });
-    },
-    // 获取目标menu
-    getTargetMenu(menus) {
-      for (let i = 0; i < menus.length; i++) {
-        if (menus[i].menuId == this.groupForm.routePath) {
-          return menus[i];
-        } else if (menus.children?.length) {
-          return this.getTargetMenu(menus.children);
-        }
-      }
-      return false;
-    },
-    // 获取父级menuId
-    getParentMenuId(menuId, menus) {
-      let res;
-      for (let i = 0; i < menus.length; i++) {
-        let item = menus[i];
-        if (item.menuId == menuId) {
-          res = item.parentId;
-          break;
-        } else if (item.children?.length) {
-          if (
-            this.getParentMenuId(
-              menuId,
-              JSON.parse(JSON.stringify(item.children))
-            )
-          ) {
-            res = this.getParentMenuId(
-              menuId,
-              JSON.parse(JSON.stringify(item.children))
-            );
-          }
-        }
-      }
-      return res;
-    },
-    // 修改表格回显数据
-    async initTableData(tId) {
-      let res = await getTableInfo(tId);
-      console.log('回显数据', res);
-      if (res.code == 200) {
-        if (!this.formData.routePath) {
-          this.$message.warning("该表格菜单路由已经删除,请重新配置");
-        }
-        // this.formData.routePath
-        this.editData = res.data;
-        let val = await getParticMenu(res.data.tableKey);
-        if (val.code == 200) {
-          this.menuId = val.data.menuId;
-        }
-      } else {
-        this.$message.error("数据回显失败");
-      }
-    },
-    // 新增动态表格组
-    addTableGroup(formName){
-      this.$refs[formName].validate(async (valid) => {
-          if (valid) { 
-            // console.log('groupList', this.groupList);
-            if(this.addDragData.length < 2) return this.$message.error("请包含多个表格");
-            if(this.groupTitle){
-              let groupKeyObj = {
-              groupKey: uuidv4(),
-              };
-              let payLoad = {
-                component: "relateTable/relateTableEdit",
-                icon: "",
-                isCache: "0",
-                isFrame: "1",
-                menuName: this.groupForm.groupName,
-                menuType: "C",
-                orderNum: this.menuOrderNum,
-                parentId: this.groupForm.routePath,
-                path: groupKeyObj.groupKey,
-                query: JSON.stringify(groupKeyObj),
-                status: "0",
-                visible: "0",
-                tenantId: this.tenantId,
-              };
-              let result;
-              result = await addMenu(payLoad);
-
-              if(result.code == 200){
-                this.reloadRouter();
-                let data = {
-                  groupKey: groupKeyObj.groupKey,
-                  groupName: '',
-                  groupDescription: '',
-                  groupTableInfo: [],
-                  dragTables:[]
-                }
-                this.addDragData.forEach((item, index) => {
-                item.menuId = result.data;
-                // item.sqlKey = tableKeyObj.tableKey
-                let echo = JSON.parse(item.echoData)
-                echo.formData = this.groupForm
-                item.echoData = JSON.stringify(echo)
-                data.groupTableInfo.push({
-                  tableKey: item.tableKey,
-                  sort: index,
-                  tablename: item.dtTableName,
-                  menuId: result.data
-                  })
-                })
-                data.groupName = this.groupForm.groupName
-                data.groupDescription = this.groupForm.groupDescription
-                data.groupTableInfo = JSON.stringify(data.groupTableInfo)
-                data.dragTables = this.addDragData
-
-                // 添加表格组
-                let res = await addGroup(data)
-
-                if(res.code == 200){
-                  this.$message.success("创建成功");
-
-                  this.isShowTable = false
-                  this.groupForm = {}
-                } else {
-                  this.$message.success("创建失败");
-                  }
-                }
-            }else{
-            
-              let groupKeyObj = {
-                groupKey: uuidv4(),
-              };
-              let data = {
-                groupKey: groupKeyObj.groupKey,
-                groupName: '',
-                groupDescription: '',
-                groupTableInfo: [],
-                dragTables:[],
-                id: this.groupId
-              }
-              this.addDragData.forEach((item, index) => {
-                // item.sqlKey = tableKeyObj.tableKey
-                let echo = JSON.parse(item.echoData)
-                echo.formData = this.groupForm
-                item.echoData = JSON.stringify(echo)
-                data.groupTableInfo.push({
-                  tableKey: item.tableKey,
-                  sort: index,
-                  tablename: item.dtTableName,
-                  })
-              })
-                data.groupName = this.groupForm.groupName
-                data.groupDescription = this.groupForm.groupDescription
-                data.groupTableInfo = JSON.stringify(data.groupTableInfo)
-                data.dragTables = this.addDragData
-              let res = await updataGroup(data)
-              console.log(res)
-
-              if(res.code == 200){
-                let payLoad = {
-                  menuId: this.menuId,
-                  menuName: this.groupForm.groupName,
-                  parentId: this.groupForm.routePath,
-                  component: "tablelist/commonTable/listInfo",
-                  icon: "",
-                  isCache: "0",
-                  isFrame: "1",
-                  menuType: "C",
-                  orderNum: this.menuOrderNum,
-                  status: "0",
-                  visible: "0",
-                  tenantId: this.tenantId,
-              };
-                console.log(payLoad);
-                let result = await updateMenu(payLoad);
-                console.log('确认修改', result);
-              }          
-            }
-
-            this.isShowTable = false
-            this.addDragData = []
-            this.groupForm = []
-            this.tableDataList = []
-            this.getTableList()
-          } else {
-            this.$message.error("请完善表单信息");
-            return false;
-          }
-      });
-    },
-    /** 新增按钮操作 */
-    async handleAdd() {
-      // dialog弹窗
-      this.isShowTable = true
-
-      // dialog标题
-      this.groupTitle = true
-
-      // 新增关联表格
-      this.isShowForm = true
-      this.relateTitle = true
-      this.tableItemForm = {}
-      this.groupForm = {}
-      this.tableDataList = []
-      this.tableFieldList = []
-      this.relyOption = ''
-      this.conditionDefaultValueMap = ''
-    },
-    // 取消
-    cancelGroup(){
-      this.groupTitle = true
-      this.isShowTable = false
-    },
-    // 获取路由表单数据
-    async getMenuList() {
-      let res = await getMenuList();
-      this.menus = this.handleTree(res.data, "menuId");
-    },
-    /** 转换菜单数据结构 */
-    normalizer(node) {
-      if (node.children && !node.children.length) {
-        delete node.children;
-      }
-      return {
-        id: node.menuId,
-        label: node.menuName,
-        children: node.children,
-      };
-    },
-    // 修改动态表格组回显
-    UpdateTableGroup(row){
-      console.log(row);
-      // let id = JSON.parse(row.id)
-      getTable({ id: row.id }).then(res => {
-        this.groupId = res.data.id
-        // 关联表格
-        this.groupTableInfo = JSON.parse(res.data.groupTableInfo)
-        this.menuId = res.data.dragTables[0].menuId
-
-        this.groupForm = res.data
-        this.addDragData = res.data.dragTables
-        // 菜单路由回显
-        this.tableDataList = this.groupForm.dragTables
-        this.groupForm.routePath = this.getParentMenuId(
-          res.data.dragTables[0].menuId,
-          this.menus,
-          {}
-        )
-
-        if (!this.groupForm.routePath) {
-          this.$message.warning("该表格菜单路由已经删除,请重新配置");
-        }
-      })
-
-      this.groupTitle = false
-      this.isShowTable = true 
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        tId: null,
-        dtName: null,
-        dtNickname: null,
-        tableKey: null,
-        sqlKey: null,
-        dtTableName: null,
-        dtNotes: null,
-        dtColumnName: null,
-        timeFormat: null,
-        spare: null,
-        spare1: null,
-        delFlag: null,
-        createBy: null,
-        createTime: null,
-        updateBy: null,
-        updateTime: null,
-        isSelection: null,
-      };
-      this.resetForm("form");
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.getTableList();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.id);
-      this.Keys = selection.map((item) => item.sqlKey);
-      this.menuIds = selection.map((item) => item.menuId);
-      this.selection = selection;
-      this.single = selection.length !== 1;
-      this.multiple = !selection.length;
-    },
-    
-    /** 修改按钮操作 */
-    async handleUpdate(row) {
-      // 兼容勾选单个的修改
-      let tId = row?.tId || this.ids[0];
-      // this.$router.push({
-      //   path: "/system/fromModel/index/tableMange",
-      //   query: {
-      //     tId: tId,
-      //   },
-      // });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate((valid) => {
-        if (valid) {
-          if (this.form.tId != null) {
-            updateTable(this.form).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addTable(this.form).then((response) => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      console.log(row);
-      this.tableDataList.forEach((item, index) => {
-        if(row.tableKey == item.tableKey) {
-          this.tableDataList.splice(index, 1);
-        }
-      })
-      console.log(this.tableDataList)
-    },
-    // 更新路由
-    reloadRouter() {
-      this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {
-        this.$router.addRoutes(accessRoutes); // 动态添加可访问路由表
-      });
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download(
-        process.env.VUE_APP_BASE_API3 + "system/table/export",
-        {
-          ...this.queryParams,
-        },
-        `table_${new Date().getTime()}.xlsx`
-      );
-    },
-    // 新增一个联动表格
-    addOneTable() {
-      this.relateTitle = true
-      if(this.relateTitle){
-        this.tableItemForm = {}
-        this.tableFieldList = []
-      }
-      if(!this.groupTitle){
-        // console.log('修改新增');
-        console.log(this.tableDataList[this.tableDataList.length-1].dtTableName)
-       
-        this.relyFileds.tableName = this.tableDataList[this.tableDataList.length-1].dtTableName
-        let echoData = JSON.parse(this.tableDataList[this.tableDataList.length-1].echoData)
-
-        this.relyFileds.tableFieldList = echoData.tableFieldData
-      }
-      this.getAllTable()
-      // 注意校验最后一条数据是否合法
-      this.isShowForm = true;
-    },
-
-    // 重置表单
-    // tableItemFormReset() {
-    //   Object.assign(this.tableItemForm, {
-    //     title: "",
-    //     tableId: "",
-    //     tableName: "",
-    //     showFields: [],
-    //     theRelateField: "",
-    //     executeOptions: [],
-    //   });
-    // },
-    // handlePreview() {
-    //   this.$router.push({
-    //     path: "/system/fromModel/index/relateTableEdit",
-    //   });
-    // },
-  },
-};
-</script>
-<style scoped lang="scss">
-::v-deep .el-dialog:not(.is-fullscreen){
-  width: 900px !important;
-}
-.isSearch {
-  ::v-deep .el-dialog:not(.is-fullscreen){
-  width: 320px !important;
-  }
-  ::v-deep .el-input--medium .el-input__inner{
-    margin-bottom: 10px !important;
-  }
-}
-.tablefiled{
-  ::v-deep .el-input--medium .el-input__inner{
-    width: 70px !important;
-  }
-}
-::v-deep .el-input--medium .el-input__inner{
-  width: 230px !important;
-}
-::v-deep .btn{
-  text-align: right !important;
-}
-.ipt {
-  height: 36px;
-  line-height: 36px;
-  font-size: 14px;
-  width: 100%;
-  outline: none;
-  text-align: center;
-  background-color: #fff;
-  border: 1px solid #dcdfe6;
-  color: #606266;
-  display: inline-block;
-  border-radius: 4px;
-}
-.isNullDesc {
-  border-color: #ff4949 !important;
-}
-
-.ipt:focus {
-  border-color: #1890ff;
-}
-::v-deep .vue-treeselect--has-value .vue-treeselect__input {
-  vertical-align: middle !important;
-}
-.formWrap {
-  display: flex;
-  justify-content: center;
-}
-
-::v-deep .el-table{
-  margin-top: 10px;
-}
-.nameipt{
-  display: inline;
-  margin-left: 10px;
-  ::v-deep .el-input--medium .el-input__inner{
-  width: 30%;
-  }
-  ::v-deep .el-input--medium{
-  display: inline;
-  }
-}
-.desc{
-  margin-left: 10px;
-}
-::v-deep .vue-treeselect--has-value .vue-treeselect__input {
-  vertical-align: middle !important;
-
-}
-.treeselect{
-   .vue-treeselect{
-    width: 230px !important;
-  }
-}
-</style>
-
-<style lang="scss">
- 
-.vue-treeselect{
-  z-index: 9999 !important;
-}
-</style>

+ 68 - 49
ruoyi-ui/src/views/relateTable/index.vue

@@ -10,7 +10,6 @@
     >
       <el-form-item label="表格组名" prop="dtName">
         <el-input
-          @input="change1($evevt)"
           v-model="queryParams.dtName"
           placeholder="请输入表格组名"
           clearable
@@ -145,11 +144,11 @@
         <el-form :model="groupForm" :rules="grouprules" ref="groupForm" label-width="100px" class="demo-ruleForm">
           <el-form-item label="表格组名" prop="groupName">
             <el-input v-model="groupForm.groupName" placeholder="请输入表格组名"
-            @input="change1($evevt)"></el-input>
+            ></el-input>
           </el-form-item>
           <el-form-item label="表格描述" prop="groupDescription">
             <el-input v-model="groupForm.groupDescription" placeholder="请输入表格描述"
-            @input="change1($evevt)"></el-input>
+            ></el-input>
           </el-form-item>
           <el-form-item label="菜单路由" prop="routePath">
           <div class="treeselect">
@@ -238,10 +237,10 @@
         >
           <el-form-item label="表格标题:" prop="title">
             <el-input
-            @input="change1($evevt)"
               v-model="tableItemForm.title"
               style="max-width: 221px"
               @change="iptChange()"
+              @input="iptChange()"
             ></el-input>
           </el-form-item>
           <el-form-item label="表格名称:" prop="tableName">
@@ -249,6 +248,7 @@
               v-model="tableItemForm.tableName"
               @change="getList()"
               placeholder="请选择表格名称"
+              @input="iptChange()"
             >
               <el-option
               v-for="item in tableList"
@@ -267,6 +267,7 @@
             <el-select
               v-model="tableItemForm.selectFields"
               placeholder="请选择表格主键"
+              @input="iptChange()"
             >
             <el-option
               v-for="item in tableFieldList"
@@ -285,6 +286,7 @@
             <el-select
               v-model="tableItemForm.timeFormate"
               placeholder="请选择时间格式"
+              @input="iptChange()"
             >
               <el-option
                 v-for="val in dict.type.sys_time_format"
@@ -298,6 +300,7 @@
             <el-select
               v-model="tableItemForm.orderByColumn"
               placeholder="请选择排序依赖"
+              @input="iptChange()"
             >
               <el-option
                 v-for="val in orderByFieldList"
@@ -515,11 +518,11 @@ export default {
       groupList:[],
       menus: [], //路由列表数据
       // 添加关联表格校验规则
-      // tableItemRules:{
-      //   title:[{ required: true, message: '请输入表格标题', trigger: 'blur' }],
-      //   tableName:[{ required: true, message: '请选择表格名称', trigger: 'change' }],
-      //   selectFields: [{ required: true, message: '请选择关联字段', trigger: 'change' }],
-      // },
+      tableItemRules:{
+        // title:[{ required: true, message: '请输入表格标题', trigger: 'blur' }],
+        // tableName:[{ required: true, message: '请选择表格名称', trigger: 'change' }],
+        // selectFields: [{ required: true, message: '请选择关联字段', trigger: 'change' }],
+      },
       groupForm: {
         groupName: '',
         groupDescription:'',
@@ -577,6 +580,7 @@ export default {
       open: false,
       // 查询参数
       queryParams: {
+        groupType: 0,
         pageNum: 1,
         pageSize: 10,
         dtName: null,
@@ -627,7 +631,10 @@ export default {
       // 修改表格时的menuId
       menuId: "",
       // 修改是表格的id
-      groupId:''
+      groupId:'',
+      serachIndex: '',
+      //修改数据回显
+      echogroup:{},
     };
   },
   async created() {
@@ -667,7 +674,7 @@ export default {
             };
           });
       } else {
-        this.relationTableList = [];
+        this.relaiptChangetableItemRulestionTableList = [];
       }
     },
     'groupForm.routePath'(nval, oval) {
@@ -697,6 +704,7 @@ export default {
     },
     // 是否包含查询switch
     isSearchChange(status, row,index){
+      this.serachIndex = index
       this.isSearchIndex = row.tableName + '.' + row.fieldName
       if(!status){
         delete this.conditionDefault[this.isSearchIndex]
@@ -709,7 +717,7 @@ export default {
       this.relyOption = null
       this.conditionDefaultValueMap = ''
       this.isSearchDialog = false
-      this.tableFieldList[this.isSearchIndex].isSearch = false
+      this.tableFieldList[this.serachIndex].isSearch = false
     },
     isSearchBtn(){
       if(this.relyOption == 0){
@@ -981,13 +989,13 @@ export default {
           this.$message.warning("请至少选择一个包含查询字段");
           return false;
           }
-          let echoData = {
-            tableName: this.tableItemForm.tableName,
-            tableFieldData: this.tableFieldList,
-          }
+          let echoData = {}
           // 判断修改还是新增
           if(this.relateTitle){ 
-  
+            echoData = {
+            tableName: this.tableItemForm.tableName,
+            tableFieldData: this.tableFieldList,
+           }
             let tableKey = uuidv4();
             let sqlKey = uuidv4();
 
@@ -1003,7 +1011,7 @@ export default {
               selectFields: this.tableItemForm.selectFields,
               orderByColumn: this.tableItemForm.orderByColumn,
               timeFormate: this.tableItemForm.timeFormate,
-
+              primaryKey: this.tableItemForm.selectFields,
               rowId: this.tableItemForm.rowId,
               tId: this.tId,
               tableKey: tableKey,
@@ -1043,29 +1051,27 @@ export default {
             }
             
           } else {
-            let tableKey = uuidv4();
-            let sqlKey = uuidv4();
-            console.log(this.conditionDefault);
-
-            console.log(searchFieldList);
+            echoData = {
+              tableName: this.tableItemForm.tableName,
+              tableFieldData: this.tableFieldList,
+            }
+            // console.log('123456', echoData);
             this.tableDataList.forEach((item, index) => {
               if(item.tId == this.tableItemForm.tId){
-                // 判断依赖字段是否为一个
                 item.conditionDefaultValueMap = this.conditionDefault
-               
                 item.echoData = JSON.stringify(echoData),
                 item.sortOrder = this.tableItemForm.isAsc
                 item.orderByColumn = this.tableItemForm.orderByColumn
                 item.primaryKey = this.tableItemForm.selectFields
                 item.dtTableName = this.tableItemForm.tableName
                 item.dtName = this.tableItemForm.title
-                item.dtColumnName = columns
+                item.dtColumnName = JSON.stringify(columns)
                 item.searchFieldList = searchFieldList 
               }
             })
           }
-          console.log(this.tableDataList)
           this.isShowForm = false
+          echoData = {}
           this.tableItemForm = {}
           this.tableFieldList = []
           this.relyFiledsList = []
@@ -1080,7 +1086,6 @@ export default {
     },
     // 修改一个表格数据
     relateOne(row){
-      console.log(row);
       if(row.tableKey){
         this.menuId = row.menuId
         this.conditionDefault = row.conditionDefaultValueMap
@@ -1102,7 +1107,7 @@ export default {
         this.tableItemForm.tId = row.tId
         this.tableItemForm.rowId = row.tableKey,
         this.tableItemForm.isAsc = false,
-        this.tableItemForm.orderByColumn = "",
+        this.tableItemForm.orderByColumn = row.orderByColumn,
         this.tableItemForm.title = row.dtName
         this.tableItemForm.tableName = row.dtTableName
         this.tableItemForm.selectFields = row.primaryKey
@@ -1272,7 +1277,7 @@ export default {
                 // item.sqlKey = tableKeyObj.tableKey
                 let echo = JSON.parse(item.echoData)
                 echo.formData = this.groupForm
-                item.echoData = JSON.stringify(echo)
+                // item.echoData = JSON.stringify(echo)
                 data.groupTableInfo.push({
                   tableKey: item.tableKey,
                   sort: index,
@@ -1287,7 +1292,7 @@ export default {
 
                 // 添加表格组
                 let res = await addGroup(data)
-
+                console.log(res);
                 if(res.code == 200){
                   this.$message.success("创建成功");
 
@@ -1295,15 +1300,13 @@ export default {
                   this.groupForm = {}
                 } else {
                   this.$message.success("创建失败");
-                  }
+                  this.isShowTable = false
+                  this.groupForm = {}
                 }
+              }
             }else{
-            
-              let groupKeyObj = {
-                groupKey: uuidv4(),
-              };
               let data = {
-                groupKey: groupKeyObj.groupKey,
+                groupKey: this.echogroup.groupKey,
                 groupName: '',
                 groupDescription: '',
                 groupTableInfo: [],
@@ -1313,13 +1316,14 @@ export default {
               this.addDragData.forEach((item, index) => {
                 // item.sqlKey = tableKeyObj.tableKey
                 let echo = JSON.parse(item.echoData)
-                echo.formData = this.groupForm
+                // echo.formData = this.groupForm
+                // console.log(echo);
                 item.echoData = JSON.stringify(echo)
                 data.groupTableInfo.push({
                   tableKey: item.tableKey,
                   sort: index,
                   tablename: item.dtTableName,
-                  })
+                })
               })
                 data.groupName = this.groupForm.groupName
                 data.groupDescription = this.groupForm.groupDescription
@@ -1327,14 +1331,13 @@ export default {
                 data.dragTables = this.addDragData
                 console.log(data);
               let res = await updataGroup(data)
-              console.log(res)
 
               if(res.code == 200){
                 let payLoad = {
                   menuId: this.menuId,
                   menuName: this.groupForm.groupName,
                   parentId: this.groupForm.routePath,
-                  component: "tablelist/commonTable/listInfo",
+                  component: "relateTable/relateTableEdit",
                   icon: "",
                   isCache: "0",
                   isFrame: "1",
@@ -1344,17 +1347,28 @@ export default {
                   visible: "0",
                   tenantId: this.tenantId,
               };
-                console.log(payLoad);
                 let result = await updateMenu(payLoad);
-                console.log('确认修改', result);
-              }          
+
+                if(result.code == 200){
+                  this.$message.success("修改成功");
+
+                  this.isShowTable = false
+                  this.groupForm = {}
+                } else {
+                  this.$message.success("修改失败");
+                  this.isShowTable = false
+                  this.groupForm = {}
+                }
+
+              } 
             }
             this.isShowTable = false
             this.addDragData = []
-            this.groupForm = []
+            this.groupForm = {}
             this.tableDataList = []
             this.reloadRouter();
             this.getTableList()
+
           } else {
             this.$message.error("请完善表单信息");
             return false;
@@ -1395,17 +1409,22 @@ export default {
       };
     },
     // 修改动态表格组回显
-    UpdateTableGroup(row){
-      getRouters().then(res => {})
-      console.log(row);
+    async UpdateTableGroup(row){
+      await this.getMenuList();
       // let id = JSON.parse(row.id)
       getTable({ id: row.id }).then(res => {
+        this.echogroup = res.data
         this.groupId = res.data.id
         // 关联表格
         this.groupTableInfo = JSON.parse(res.data.groupTableInfo)
         this.menuId = res.data.dragTables[0].menuId
-
+        
         this.groupForm = res.data
+        res.data.dragTables.forEach(item => {
+          if(item.orderByColumn.includes('.')){
+            item.orderByColumn = item.orderByColumn.split('.')[1]
+          }
+        })
         this.addDragData = res.data.dragTables
         // 菜单路由回显
         this.tableDataList = this.groupForm.dragTables

+ 3 - 3
ruoyi-ui/src/views/relateTable/relateTableEdit.vue

@@ -160,17 +160,17 @@ export default {
       this.tableLists = JSON.parse(res.msg)
     },
     updateDataList(row,index) {
-      // console.log(row, index);
       // let tableKey = this.tableLists[index+1].tableKey
       let beforeChild = this.$refs['childComponent'+index][0]
       index++
+      console.log(beforeChild);
       const chlid = this.$refs['childComponent'+index][0]
       // console.log(chlid);
       if(!chlid) return
-      let contion = beforeChild.condition
+      // let contion = beforeChild.condition
       // let tableList = beforeChild.tableList[0]
       // console.log(contion,tableList);
-      chlid.getDataHandler(contion,row)
+      chlid.getDataHandler(beforeChild.contion,row)
     },
   },
 };

+ 6 - 34
ruoyi-ui/src/views/tableMange/index.vue

@@ -362,27 +362,7 @@
               <!-- <el-table-column prop="type" label="类型" width="50"> -->
               <el-table-column prop="statisticType" label="统计类型" width="50">
               </el-table-column>
-              <el-table-column prop="statuscode" label="状态码" width="70">
-              </el-table-column>
-              <!-- <el-table-column prop="title" label="标题" width="83"> -->
-              <!-- <el-table-column
-                prop="statuscode"
-                label="状态码"
-                width="70">
-              </el-table-column> -->
-              <el-table-column
-                prop="statisticDescription"
-                label="统计描述"
-                width="150"
-              >
-              </el-table-column>
-              <!-- <el-table-column prop="description" label="描述" width="150"> -->
-              <el-table-column
-                prop="statisticObject"
-                label="统计对象"
-                width="150"
-              >
-              </el-table-column>
+             
               <el-table-column
                 label="操作"
                 align="center"
@@ -668,13 +648,6 @@
             <!-- <el-option label="状态" value="status"></el-option> -->
           </el-select>
         </el-form-item>
-
-        <el-form-item label="统计描述" prop="statisticDescription">
-          <el-input v-model="dataCountFormData.statisticDescription"></el-input>
-        </el-form-item>
-        <el-form-item label="统计对象" prop="statisticObject">
-          <el-input v-model="dataCountFormData.statisticObject"></el-input>
-        </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="closeAddDialog">取 消</el-button>
@@ -1336,7 +1309,7 @@ export default {
       return sql;
     },
     getStaticSQL(key) {
-      // let prefix = "{DBNAME}.";
+      let prefix = "{DBNAME}.";
       let sqlType = this.databaseType; //数据库类型
       // let sqlType = "oracle";
       let sql = "";
@@ -1357,7 +1330,7 @@ export default {
         key +
         " FROM " +
         isNeedUsername +
-        // prefix +
+        prefix +
         this.tableName +
         asOrSpace +
         this.tableName;
@@ -1590,7 +1563,6 @@ export default {
             let tableKeyObj = {
               tableKey: this.uuid,
             };
-            // console.log(this.formData)
             let payLoad = {
               component: "tablelist/commonTable/listInfo",
               icon: "",
@@ -1626,7 +1598,6 @@ export default {
               sortOrder: this.formData.isAsc,
               sqlKey: this.tableKey,
               dtColumnName: columns, //列字段标题名称(存储显示字段信息
-              // dtColumnName: JSON.stringify(columns).replace(/"/g, "'"), //列字段标题名称(存储显示字段信息
               timeFormat: this.formData.timeFormate,
               searchFieldList: searchFieldList, //搜索字段数组
               tableSql: this.getSQLStr(), //  暂定
@@ -1663,6 +1634,7 @@ export default {
               });
               this.searchFieldList = searchFieldList;
             });
+            
             let res;
             let res1;
             if (this.tId) {
@@ -1676,7 +1648,7 @@ export default {
               this.dragTableStatisticList.forEach((item) => {
                 item.tableKey = this.editData.tableKey;
               });
-              console.log(res);
+              // console.log(res);
               res1 = await updateStatistic({
                 tableKey: this.editData.tableKey,
                 dragTableStatisticList: this.dragTableStatisticList,
@@ -1690,7 +1662,7 @@ export default {
                 data.tableKey
               );
               res = await addDragTable(data);
-
+              // console.log('123456789', res)
               this.dragTableStatisticList.forEach((item) => {
                 item.tableKey = this.uuid;
               });

+ 150 - 17
ruoyi-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -255,6 +255,27 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+    <!-- 绑定按钮dialog -->
+    <el-dialog
+      title="提示"
+      :visible.sync="btnDialogVisible"
+      :before-close="handleClose">
+      <DialogTemplate 
+       ref="dialogRef"
+        :groupKey="groupKey"
+        :rowobj="rowobj" 
+        :subCount="subCount"
+        :tableCount="tableCount"
+        :subTableName="subTableName"
+        @addList="addListHandler"
+        >
+      </DialogTemplate>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="btnDialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="btnComfirm">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -276,12 +297,17 @@ import { camelCase, toUnderline } from "@/utils";
 import { inputDisableComplete } from "@/utils/other";
 import Menu from "./BtnMenu.vue";
 import { checkRole } from "@/utils/permission";
+import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
 
 export default {
   name: "listInfo",
-  components: { Queryfrom, Menu },
+  components: { Queryfrom, Menu, DialogTemplate },
   data() {
     return {
+      // 绑定按钮dialog
+      btnDialogVisible: false,
+      // 绑定修改dialog
+      groupKey: '',
       // 遮罩层
       loading: true,
       // 选中数组
@@ -370,6 +396,14 @@ export default {
       dynamicData: {},
       // 当前点击按钮的数据
       currentBtnData: {},
+      // 修改选中行
+      rowobj:{},
+      // 该行的统计信息
+      subCount:[],
+      tableCount:[],
+      // 弹窗新增数据
+      addLists:[],
+      subTableName: '',
       // 当前点击行的数据
       currentRow: {},
     };
@@ -603,10 +637,38 @@ export default {
       }
       return strs[0];
     },
-
+    // 绑定dialog对话框关闭
+    handleClose(){
+      this.btnDialogVisible = false
+    },
+    getLastUppercaseWord(text) {
+      const pattern = /\b[A-Z][a-z]*\b/g;
+      const matches = [...text.matchAll(pattern)];
+      if (matches.length > 0) {
+        const lastMatch = matches[matches.length - 1][0];
+        return lastMatch;
+      } else {
+        return null;
+      }
+    },
     /** 修改按钮操作 */
     async handleUpdate(row, btnData) {
-      console.log(this.currentBtnData);
+      // console.log(this.currentBtnData);
+      
+      let nameTable = this.templateInfo.template.dtTableName
+      // console.log(nameTable);
+      // console.log('row', row);
+      this.rowobj = {}
+      let obj = {}
+      for(let key in row) {
+
+        let modifiedTable = key.replace(/[A-Z]/g, (match) => `_${match}`).toLowerCase(); 
+
+        this.rowobj[modifiedTable] = row[key];
+
+        let str = modifiedTable.substring(nameTable.length+1)
+        obj[str] = row[key];
+      }
       console.log("row", row);
 
       // 新的修改请求
@@ -627,14 +689,66 @@ export default {
         payLoad.conditionMap[this.templateInfo.template?.primaryKey] =
           row[primary];
         let res = await btnCommonApi(payLoad);
-        if (!res.data || !res.data.template.dfVueTemplate) {
+        this.subTableName = res.data.result.dragTables[1].dtTableName
+        // 判断是否绑定dialog弹窗
+        if (this.currentBtnData.btnTableFormGroupKey == '') {
           this.$message.error("当前表格未绑定表单!");
           return;
-        }
-        res.data.template.dfFormSql &&
+
+          res.data.template.dfFormSql &&
           (this.dynamicData = JSON.parse(res.data.template.dfFormSql));
-        this.addRealFieldName(res.data.result.resultMap);
-        let resultMap = res.data.result.resultMap;
+           this.addRealFieldName(res.data.result.resultMap);
+          let resultMap = res.data.result.resultMap;
+
+          Object.assign(this.defaultValue, resultMap);
+          this.jsonData = JSON.parse(res.data.template.dfVueTemplate);
+          this.open = true;
+          this.title = "修改信息";
+          this.form.password = this.initPassword;
+          this.$nextTick(() => {
+            this.$refs.addFromRef.setData(res.data.result.resultMap);
+          });
+        }else{
+          this.btnDialogVisible = true
+          this.groupKey = this.currentBtnData.btnTableFormGroupKey
+          this.$nextTick(()=>{
+            let refChild = this.$refs.dialogRef
+
+            // console.log(this.$refs.dialogRef);
+            refChild.getLists(this.groupKey)
+          })
+
+          let tablesubKey = res.data.result.dragTables[1].tableKey
+     
+          // 查询统计信息
+          getStatisticList({
+            queryMap: {
+              tableKey: tablesubKey,
+            },
+          }).then((res) => {
+            // console.log('统计', res);
+            this.subCount = res.data
+          });
+
+          let prmKey = this.templateInfo.template.primaryKey
+          let pkey = prmKey.replace(/_([a-z])/g, (match, p1) => p1.toUpperCase());
+
+          let data = {
+            queryMap:{
+              tableKey:res.data.result.dragTables[2].tableKey,
+            }
+          }
+
+          let key = '#{' + this.templateInfo.template.dtTableName + '.' + this.templateInfo.template.primaryKey
+
+          data.queryMap[key] = "'" + obj[this.templateInfo.template.primaryKey] + "'";
+
+          getStatisticList(data).then((res) => {
+            // console.log('统计', res);
+            this.tableCount = res.data
+          });
+        }
+       
         // let fieldList = Object.keys(resultMap);
         // let tableName = this.longestCommonSubstring(fieldList);
         // fieldList.forEach((field) => {
@@ -642,14 +756,7 @@ export default {
         //   realField = realField[0].toLocaleLowerCase() + realField.substring(1);
         //   resultMap[realField] = resultMap[field];
         // });
-        Object.assign(this.defaultValue, resultMap);
-        this.jsonData = JSON.parse(res.data.template.dfVueTemplate);
-        this.open = true;
-        this.title = "修改信息";
-        this.form.password = this.initPassword;
-        this.$nextTick(() => {
-          this.$refs.addFromRef.setData(res.data.result.resultMap);
-        });
+   
       } catch (error) {
         this.$message.error("网络异常,请稍后再试");
         console.log(error);
@@ -841,6 +948,28 @@ export default {
     submitFileForm() {
       this.$refs.upload.submit();
     },
+    // 弹窗新增的数
+    addListHandler(val){
+      this.addLists.push(...val)
+      console.log(this.addLists);
+    },
+    // 绑定弹窗Dialog确定按钮
+    btnComfirm(){
+      // let data = {
+      //   addListMap:[],
+      //   basicMap:{
+      //     btnType: 10,
+      //     tableName: this.subTableName,
+      //     visible: true,
+      //   },
+      //   commMap: {},
+      //   conditionMap: {},
+      // }
+      // // data.addListMap =
+      // btnCommonApi(data).then(res => {
+      //   console.log('弹窗确定', res);
+      // })
+    },
     // 去掉表名 开头字母小写
     formatField(field = "", tableName) {
       console.log(field, tableName);
@@ -1129,4 +1258,8 @@ export default {
 };
 </script>
 
-<style scoped lang="scss"></style>
+<style scoped lang="scss">
+  ::v-deep .el-dialog:not(.is-fullscreen){
+    min-width: 610px !important;
+  }
+</style>

+ 2 - 0
ruoyi-ui/src/views/tablelist/components/cardCountPanel.vue

@@ -23,6 +23,8 @@
       </el-card>
     </div>
   </div>
+
+  
 </template>
 
 <script>