Bläddra i källkod

:sparkles: 添加新特性。 重构开发平台,支持功能更强大

冷冷 6 år sedan
förälder
incheckning
8831d46a55

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
public/cdn/avue/index.css


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 4 - 4
public/cdn/avue/index.js


+ 56 - 0
src/api/gen/form.js

@@ -0,0 +1,56 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+import request from '@/router/axios'
+
+export function fetchList(query) {
+  return request({
+    url: '/gen/form/page',
+    method: 'get',
+    params: query
+  })
+}
+
+export function addObj(obj) {
+  return request({
+    url: '/gen/form',
+    method: 'post',
+    data: obj
+  })
+}
+
+export function getObj(id) {
+  return request({
+    url: '/gen/form/' + id,
+    method: 'get'
+  })
+}
+
+export function delObj(id) {
+  return request({
+    url: '/gen/form/' + id,
+    method: 'delete'
+  })
+}
+
+export function putObj(obj) {
+  return request({
+    url: '/gen/form',
+    method: 'put',
+    data: obj
+  })
+}

+ 1 - 1
src/config/env.js

@@ -3,7 +3,7 @@
 const env = process.env
 const baseUrl = ''
 // 图表库为avue和pig2套地址
-const iconfontVersion = ['567566_qo5lxgtishg', '667895_cg8sxwocfzr']
+const iconfontVersion = ['567566_qo5lxgtishg', '667895_1q6ow8soi2m']
 const iconfontUrl = '//at.alicdn.com/t/font_$key.css'
 const codeUrl = `${window.location.origin}/code`
 const actUrl = `${window.location.origin}/act/modeler.html?modelId=`

+ 29 - 23
src/const/crud/admin/client.js

@@ -65,53 +65,59 @@ export const tableOption = {
       trigger: 'blur'
     }]
   }, {
-    label: '授权模式',
-    prop: 'authorizedGrantTypes',
+    label: '自动放行',
+    prop: 'autoapprove',
     align: 'center',
-    overHidden: true,
+    type: 'radio',
+    dicData: DIC.vaild,
     rules: [{
       required: true,
-      message: '请输入授权模式',
+      message: '请选择是否放行',
       trigger: 'blur'
     }]
   }, {
-    label: '回调地址',
-    prop: 'webServerRedirectUri',
-    align: 'center',
-    hide: true
-  }, {
-    label: '权限',
-    prop: 'authorities',
-    align: 'center',
-    hide: true
-  }, {
-    label: '自动放行',
-    prop: 'autoapprove',
+    label: '授权模式',
+    prop: 'authorizedGrantTypes',
+    type: 'checkbox',
+    dicUrl: '/admin/dict/type/grant_types',
     align: 'center',
-    type: 'radio',
-    dicData: DIC.vaild,
+    overHidden: true,
+    row: true,
+    span: 24,
     rules: [{
       required: true,
-      message: '请选择是否放行',
+      message: '请输入授权模式',
       trigger: 'blur'
     }]
   }, {
     label: '令牌时效',
+    type: 'number',
     prop: 'accessTokenValidity',
     align: 'center'
   }, {
     label: '刷新时效',
+    type: 'number',
     prop: 'refreshTokenValidity',
     align: 'center'
   }, {
-    label: '扩展信息',
-    prop: 'additionalInformation',
+    label: '回调地址',
+    prop: 'webServerRedirectUri',
     align: 'center',
     hide: true
   }, {
-    label: '资源ID',
-    prop: 'resourceIds',
+    label: '权限',
+    prop: 'authorities',
     align: 'center',
     hide: true
+  }, {
+    label: '扩展信息',
+    prop: 'additionalInformation',
+    align: 'center',
+    type: 'textarea',
+    placeholder: 'JSON格式数据',
+    hide: true,
+    minRows: 2,
+    row: true,
+    span: 24,
   }]
 }

+ 60 - 0
src/const/crud/gen/form.js

@@ -0,0 +1,60 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+export const tableOption = {
+  border: true,
+  index: true,
+  indexLabel: '序号',
+  stripe: true,
+  menuAlign: 'center',
+  align: 'center',
+  viewBtn: true,
+  editBtn: false,
+  addBtn: false,
+  column: [
+    {
+      label: 'ID',
+      prop: 'id',
+      hide: true,
+    },
+    {
+      label: '数据源',
+      prop: 'dsName',
+      search: true
+    },
+    {
+      label: '表名称',
+      prop: 'tableName'
+    },
+    {
+      label: '创建时间',
+      prop: 'createTime',
+      type: 'datetime',
+      format: 'yyyy-MM-dd HH:mm:ss',
+      valueFormat: 'yyyy-MM-dd HH:mm:ss'
+    },
+    {
+      label: '表单信息',
+      prop: 'formInfo',
+      overHidden: true,
+      type: 'textarea',
+      minRows: 3,
+      row: true,
+      span: 24
+    }
+  ]
+}

+ 32 - 0
src/const/crud/gen/gen.js

@@ -16,6 +16,7 @@
  */
 
 export const tableOption = {
+  selection: true,
   border: true,
   index: true,
   stripe: true,
@@ -76,6 +77,37 @@ export const formOption = {
     }
   ]
 }
+export const formBatchOption = {
+  submitText: '生成',
+  column: [
+    {
+      label: '表名称',
+      prop: 'tableName',
+      disabled: true,
+      minRows: 2,
+      type: 'textarea',
+      row: true,
+      span: 24
+    },
+    {
+      label: '包名',
+      prop: 'packageName',
+      placeholder: '可为空,加载系统默认配置'
+    }, {
+      label: '作者',
+      prop: 'author',
+      placeholder: '可为空,加载系统默认配置'
+    }, {
+      label: '模块',
+      prop: 'moduleName',
+      placeholder: '可为空,加载系统默认配置'
+    }, {
+      label: '注释',
+      prop: 'comments',
+      placeholder: '可为空,加载表备注'
+    }
+  ]
+}
 
 export const tableDsOption = {
   border: true,

+ 5 - 1
src/const/iconList.js

@@ -37,7 +37,11 @@ export default [
       'icon-tuikuan',
       'icon-webicon14',
       'icon-shouyintai',
-      'icon-wenjianguanli'
+      'icon-wenjianguanli',
+      'icon-mysql',
+      'icon-shejiyukaifa-',
+      'icon-record',
+      'icon-biaodanbiaoqian'
     ]
   }
 ]

+ 4 - 1
src/page/index/index.vue

@@ -74,7 +74,10 @@ export default {
   },
   mounted() {
     this.init()
-    this.initWebSocket()
+   /*
+    * 默认关闭websocket,如需工作流通知,则开启
+    * this.initWebSocket()
+   */
   },
   computed: mapGetters(['userInfo', 'isLock', 'isCollapse', 'website', 'expires_in']),
   methods: {

+ 1 - 1
src/page/wel.vue

@@ -4,7 +4,7 @@
       <div class="banner-text">
         <span>
           <a href="https://avue.top/#/pay" target="_blank">
-            <img src="https://img.shields.io/badge/Avue-2.0.4-green.svg" alt="Build Status">
+            <img src="https://img.shields.io/badge/Avue-2.0.6-green.svg" alt="Build Status">
           </a>
           <img src="https://img.shields.io/badge/Spring%20Boot-2.1.7.RELEASE-yellowgreen.svg" alt="Downloads">
           <img src="https://img.shields.io/badge/Spring%20Cloud-Greenwich.SR2-blue.svg" alt="Coverage Status">

+ 83 - 88
src/views/admin/client/index.vue

@@ -35,103 +35,98 @@
 </template>
 
 <script>
-import {
-  addObj,
-  delObj,
-  fetchList,
-  putObj
-} from '@/api/admin/client'
-import { tableOption } from '@/const/crud/admin/client'
-import { mapGetters } from 'vuex'
+  import {addObj, delObj, fetchList, putObj} from '@/api/admin/client'
+  import {tableOption} from '@/const/crud/admin/client'
+  import {mapGetters} from 'vuex'
 
-export default {
-  name: 'Client',
-  data() {
-    return {
-      tableData: [],
-      page: {
-        total: 0, // 总页数
-        currentPage: 1, // 当前页数
-        pageSize: 20 // 每页显示多少条
-      },
-      tableLoading: false,
-      tableOption: tableOption
-    }
-  },
-  created() {
-  },
-  mounted: function() {
-  },
-  computed: {
-    ...mapGetters(['permissions']),
-    permissionList() {
+  export default {
+    name: 'Client',
+    data() {
       return {
-        addBtn: this.vaildData(this.permissions.sys_client_add, false),
-        delBtn: this.vaildData(this.permissions.sys_client_del, false),
-        editBtn: this.vaildData(this.permissions.sys_client_edit, false)
+        tableData: [],
+        page: {
+          total: 0, // 总页数
+          currentPage: 1, // 当前页数
+          pageSize: 20 // 每页显示多少条
+        },
+        tableLoading: false,
+        tableOption: tableOption
       }
-    }
-  },
-  methods: {
-    getList(page, params) {
-      this.tableLoading = true
-      fetchList(Object.assign({
-        current: page.currentPage,
-        size: page.pageSize
-      }, params)).then(response => {
-        this.tableData = response.data.data.records
-        this.page.total = response.data.data.total
-        this.tableLoading = false
-      })
     },
-    handleDelete: function(row, index) {
-      var _this = this
-      this.$confirm('是否确认删除ID为' + row.clientId, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(function() {
-        return delObj(row.clientId)
-      }).then(() => {
-        _this.tableData.splice(index, 1)
-        _this.$message({
-          showClose: true,
-          message: '删除成功',
-          type: 'success'
-        })
-        this.refreshChange()
-      }).catch(function() {
-      })
+    created() {
     },
-    handleUpdate: function(row, index, done) {
-      putObj(row).then(() => {
-        this.tableData.splice(index, 1, Object.assign({}, row))
-        this.$message({
-          showClose: true,
-          message: '修改成功',
-          type: 'success'
-        })
-        this.refreshChange()
-        done()
-      })
+    mounted: function () {
     },
-    handleSave: function(row, done) {
-      addObj(row).then(() => {
-        this.tableData.push(Object.assign({}, row))
-        this.$message({
-          showClose: true,
-          message: '添加成功',
-          type: 'success'
-        })
-        this.refreshChange()
-        done()
-      })
+    computed: {
+      ...mapGetters(['permissions']),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permissions.sys_client_add, false),
+          delBtn: this.vaildData(this.permissions.sys_client_del, false),
+          editBtn: this.vaildData(this.permissions.sys_client_edit, false)
+        }
+      }
     },
-    refreshChange() {
-      this.getList(this.page)
+    methods: {
+      getList(page, params) {
+        this.tableLoading = true
+        fetchList(Object.assign({
+          current: page.currentPage,
+          size: page.pageSize
+        }, params)).then(response => {
+          this.tableData = response.data.data.records
+          this.page.total = response.data.data.total
+          this.tableLoading = false
+        })
+      },
+      handleDelete: function (row, index) {
+        var _this = this
+        this.$confirm('是否确认删除ID为' + row.clientId, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(function () {
+          return delObj(row.clientId)
+        }).then(() => {
+          _this.tableData.splice(index, 1)
+          _this.$message({
+            showClose: true,
+            message: '删除成功',
+            type: 'success'
+          })
+          this.refreshChange()
+        }).catch(function () {
+        })
+      },
+      handleUpdate: function (row, index, done) {
+        putObj(row).then(() => {
+          this.tableData.splice(index, 1, Object.assign({}, row))
+          this.$message({
+            showClose: true,
+            message: '修改成功',
+            type: 'success'
+          })
+          this.refreshChange()
+          done()
+        })
+      },
+      handleSave: function (row, done) {
+        addObj(row).then(() => {
+          this.tableData.push(Object.assign({}, row))
+          this.$message({
+            showClose: true,
+            message: '添加成功',
+            type: 'success'
+          })
+          this.refreshChange()
+          done()
+        })
+      },
+      refreshChange() {
+        this.getList(this.page)
+      }
     }
   }
-}
 </script>
 
 <style lang="scss" scoped>

+ 115 - 0
src/views/gen/datasource.vue

@@ -0,0 +1,115 @@
+<!--
+  -    Copyright (c) 2018-2025, lengleng All rights reserved.
+  -
+  - Redistribution and use in source and binary forms, with or without
+  - modification, are permitted provided that the following conditions are met:
+  -
+  - Redistributions of source code must retain the above copyright notice,
+  - this list of conditions and the following disclaimer.
+  - Redistributions in binary form must reproduce the above copyright
+  - notice, this list of conditions and the following disclaimer in the
+  - documentation and/or other materials provided with the distribution.
+  - Neither the name of the pig4cloud.com developer nor the names of its
+  - contributors may be used to endorse or promote products derived from
+  - this software without specific prior written permission.
+  - Author: lengleng (wangiegie@gmail.com)
+  -->
+
+<template>
+  <div class="execution">
+    <basic-container>
+      <avue-crud
+        ref="data-source-settings-crud"
+        v-model="dsForm"
+        :page="dsPage"
+        :data="tableDsData"
+        :option="tableDsOption"
+        :before-open="handleOpenBefore"
+        @row-update="handleUpdate"
+        @row-save="handleSave"
+        @row-del="rowDel"
+        @refresh-change="refreshDsChange"
+        @on-load="getDsList"/>
+    </basic-container>
+  </div>
+</template>
+
+<script>
+  import {addObj, delObj, fetchDsList, putObj} from '@/api/gen/gen'
+  import {formOption, tableDsOption, tableOption} from '@/const/crud/gen/gen'
+
+  export default {
+  name: 'CodeGenerator',
+  data() {
+    return {
+      dataSourceList: [],
+      tableDsData: [],
+      box: false,
+      dsPage: {
+        total: 0, // 总页数
+        currentPage: 1, // 当前页数
+        pageSize: 20 // 每页显示多少条
+      },
+      dsForm: {},
+      tableLoading: false,
+      tableOption: tableOption,
+      tableDsOption: tableDsOption,
+      formOption: formOption
+    }
+  },
+  created() {
+  },
+  methods: {
+    rowDel: function(row, index) {
+      this.$confirm('是否确认删除ID为' + row.id, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(function() {
+        return delObj(row.id)
+      }).then(() => {
+        this.tableData.splice(index, 1)
+        this.$message.success('删除成功')
+        this.getDsList(this.page)
+      }).catch(function() {
+      })
+    },
+    handleOpenBefore: function(show) {
+      this.dsForm.password = undefined
+      show()
+    },
+    handleUpdate: function(row, index, done) {
+      putObj(row).then(() => {
+        this.tableData.splice(index, 1, Object.assign({}, row))
+        this.$message.success('修改成功')
+        done()
+        this.getDsList(this.page)
+      })
+    },
+    handleSave: function(row, done) {
+      addObj(row).then(() => {
+        this.tableData.push(Object.assign({}, row))
+        this.$message.success('添加成功')
+        done()
+        this.getDsList(this.page)
+      })
+    },
+    getDsList(page, params) {
+      fetchDsList(Object.assign({
+        current: page.currentPage,
+        size: page.pageSize
+      }, params)).then(response => {
+        this.tableDsData = response.data.data.records
+        this.dsPage.total = response.data.data.total
+      })
+    },
+    refreshDsChange() {
+      this.getDsList(this.page)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+</style>
+

+ 138 - 0
src/views/gen/form.vue

@@ -0,0 +1,138 @@
+<!--
+  -    Copyright (c) 2018-2025, lengleng All rights reserved.
+  -
+  - Redistribution and use in source and binary forms, with or without
+  - modification, are permitted provided that the following conditions are met:
+  -
+  - Redistributions of source code must retain the above copyright notice,
+  - this list of conditions and the following disclaimer.
+  - Redistributions in binary form must reproduce the above copyright
+  - notice, this list of conditions and the following disclaimer in the
+  - documentation and/or other materials provided with the distribution.
+  - Neither the name of the pig4cloud.com developer nor the names of its
+  - contributors may be used to endorse or promote products derived from
+  - this software without specific prior written permission.
+  - Author: lengleng (wangiegie@gmail.com)
+  -->
+<template>
+  <div class="execution">
+    <basic-container>
+      <avue-crud ref="crud"
+                 :page="page"
+                 :data="tableData"
+                 :permission="permissionList"
+                 :table-loading="tableLoading"
+                 :option="tableOption"
+                 @on-load="getList"
+                 @search-change="searchChange"
+                 @refresh-change="refreshChange"
+                 @row-update="handleUpdate"
+                 @row-save="handleSave"
+                 @row-del="rowDel">
+      </avue-crud>
+    </basic-container>
+  </div>
+</template>
+
+<script>
+  import {addObj, delObj, fetchList, putObj} from '@/api/gen/form'
+  import {tableOption} from '@/const/crud/gen/form'
+  import {mapGetters} from 'vuex'
+
+  export default {
+    name: 'genForm',
+    data() {
+      return {
+        searchForm: {},
+        tableData: [],
+        page: {
+          total: 0, // 总页数
+          currentPage: 1, // 当前页数
+          pageSize: 20 // 每页显示多少条
+        },
+        tableLoading: false,
+        tableOption: tableOption
+      }
+    },
+    computed: {
+      ...mapGetters(['permissions']),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permissions.gen_form_add, false),
+          delBtn: this.vaildData(this.permissions.gen_form_del, false),
+          editBtn: this.vaildData(this.permissions.gen_form_edit, false)
+        };
+      }
+    },
+    methods: {
+      getList(page, params) {
+        this.tableLoading = true
+        fetchList(Object.assign({
+          descs: 'create_time',
+          current: page.currentPage,
+          size: page.pageSize
+        }, params, this.searchForm)).then(response => {
+          this.tableData = response.data.data.records
+          this.page.total = response.data.data.total
+          this.tableLoading = false
+        }).catch(() => {
+          this.tableLoading = false
+        })
+      },
+      rowDel: function (row, index) {
+        var _this = this
+        this.$confirm('是否确认删除ID为' + row.id, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(function () {
+          return delObj(row.id)
+        }).then(data => {
+          _this.tableData.splice(index, 1)
+          _this.$message({
+            showClose: true,
+            message: '删除成功',
+            type: 'success'
+          })
+          this.getList(this.page)
+        })
+      },
+      handleUpdate: function (row, index, done, loading) {
+        putObj(row).then(data => {
+          this.$message({
+            showClose: true,
+            message: '修改成功',
+            type: 'success'
+          })
+          done()
+          this.getList(this.page)
+        }).catch(() => {
+          loading();
+        });
+      },
+      handleSave: function (row, done, loading) {
+        addObj(row).then(data => {
+          this.$message({
+            showClose: true,
+            message: '添加成功',
+            type: 'success'
+          })
+          done()
+          this.getList(this.page)
+        }).catch(() => {
+          loading();
+        });
+      },
+      searchChange(form) {
+        this.searchForm = form
+        this.getList(this.page, form)
+      },
+      refreshChange() {
+        this.getList(this.page)
+      }
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 88 - 133
src/views/gen/index.vue

@@ -35,11 +35,10 @@
             <el-input v-model="q.tableName" placeholder="表名称"/>
           </div>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="12">
           <div class="grid-content bg-purple">
             <el-button type="primary" icon="el-icon-search" @click="search">搜索</el-button>
-            <el-button type="primary" icon="el-icon-setting" @click="setting" @close="dsBox=false">维护
-            </el-button>
+            <el-button type="primary" icon="el-icon-download" @click="openBatch">批量生成</el-button>
           </div>
         </el-col>
       </el-row>
@@ -75,25 +74,18 @@
             @submit="gen()"/>
         </div>
       </el-dialog>
-
       <el-dialog
-        :visible.sync="dsBox"
-        :table-loading="tableLoading"
-        title="数据源管理"
-        width="90%"
-        @close="dsBox=false">
-        <avue-crud
-          ref="data-source-settings-crud"
-          v-model="dsForm"
-          :page="dsPage"
-          :data="tableDsData"
-          :option="tableDsOption"
-          :before-open="handleOpenBefore"
-          @row-update="handleUpdate"
-          @row-save="handleSave"
-          @row-del="rowDel"
-          @refresh-change="refreshDsChange"
-          @on-load="getDsList"/>
+        :visible.sync="boxBatch"
+        title="批量生成"
+        width="50%"
+        lock-scroll>
+        <div class="pull-auto">
+          <avue-form
+            ref="formBatchData"
+            :option="formBatchOption"
+            v-model="formBatchData"
+            @submit="batchGen()"/>
+        </div>
       </el-dialog>
 
     </basic-container>
@@ -101,124 +93,87 @@
 </template>
 
 <script>
-import { addObj, delObj, fetchDsList, fetchList, fetchSelectDsList, handleDown, putObj } from '@/api/gen/gen'
-import { formOption, tableDsOption, tableOption } from '@/const/crud/gen/gen'
+  import {fetchList, fetchSelectDsList, handleDown} from '@/api/gen/gen'
+  import {formBatchOption, formOption, tableOption} from '@/const/crud/gen/gen'
 
-export default {
-  name: 'CodeGenerator',
-  data() {
-    return {
-      dsBox: false,
-      q: {},
-      dataSourceList: [],
-      tableData: [],
-      tableDsData: [],
-      formData: {},
-      box: false,
-      page: {
-        total: 0, // 总页数
-        currentPage: 1, // 当前页数
-        pageSize: 20 // 每页显示多少条
-      },
-      dsPage: {
-        total: 0, // 总页数
-        currentPage: 1, // 当前页数
-        pageSize: 20 // 每页显示多少条
-      },
-      dsForm: {},
-      tableLoading: false,
-      tableOption: tableOption,
-      tableDsOption: tableDsOption,
-      formOption: formOption
-    }
-  },
-  created() {
-    this.getdataSourceList()
-  },
-  methods: {
-    getList(page) {
-      this.tableLoading = true
-      fetchList(Object.assign({
-        current: page.currentPage,
-        size: page.pageSize
-      }, this.q)).then(response => {
-        this.tableData = response.data.data.records
-        this.page.total = response.data.data.total
-        this.tableLoading = false
-      })
-    },
-    rowDel: function(row, index) {
-      this.$confirm('是否确认删除ID为' + row.id, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(function() {
-        return delObj(row.id)
-      }).then(() => {
-        this.tableData.splice(index, 1)
-        this.$message.success('删除成功')
-        this.getDsList(this.page)
-      }).catch(function() {
-      })
-    },
-    handleOpenBefore: function(show) {
-      this.dsForm.password = undefined
-      show()
-    },
-    handleUpdate: function(row, index, done) {
-      putObj(row).then(() => {
-        this.tableData.splice(index, 1, Object.assign({}, row))
-        this.$message.success('修改成功')
-        done()
-        this.getDsList(this.page)
-      })
-    },
-    handleSave: function(row, done) {
-      addObj(row).then(() => {
-        this.tableData.push(Object.assign({}, row))
-        this.$message.success('添加成功')
-        done()
-        this.getDsList(this.page)
-      })
+  export default {
+    name: 'CodeGenerator',
+    data() {
+      return {
+        q: {},
+        dataSourceList: [],
+        tableData: [],
+        formData: {},
+        formBatchData: {},
+        box: false,
+        boxBatch: false,
+        page: {
+          total: 0, // 总页数
+          currentPage: 1, // 当前页数
+          pageSize: 20 // 每页显示多少条
+        },
+        tableLoading: false,
+        tableOption: tableOption,
+        formOption: formOption,
+        formBatchOption: formBatchOption
+      }
     },
-    getDsList(page, params) {
-      fetchDsList(Object.assign({
-        current: page.currentPage,
-        size: page.pageSize
-      }, params)).then(response => {
-        this.tableDsData = response.data.data.records
-        this.dsPage.total = response.data.data.total
-      })
+    created() {
+      this.getdataSourceList()
     },
-    handleDown: function(row) {
-      this.formData.tableName = row.tableName
-      this.box = true
-    },
-    refreshChange() {
-      this.getList(this.page)
-    },
-    refreshDsChange() {
-      this.getDsList(this.page)
-    },
-    gen() {
-      this.formData.id = this.q.id
-      handleDown(this.formData).then(() => {
+    methods: {
+      getList(page) {
+        this.tableLoading = true
+        fetchList(Object.assign({
+          current: page.currentPage,
+          size: page.pageSize
+        }, this.q)).then(response => {
+          this.tableData = response.data.data.records
+          this.page.total = response.data.data.total
+          this.tableLoading = false
+        })
+      },
+      handleDown: function (row) {
+        this.formData.tableName = row.tableName
         this.box = true
-      })
-    },
-    setting() {
-      this.dsBox = true
-    },
-    search() {
-      this.getList(this.page)
-    },
-    getdataSourceList() {
-      fetchSelectDsList().then(response => {
-        this.dataSourceList = response.data.data
-      })
+      },
+      refreshChange() {
+        this.getList(this.page)
+      },
+      gen() {
+        this.formData.id = this.q.id
+        handleDown(this.formData).then(() => {
+          this.box = false
+        })
+      },
+      getdataSourceList() {
+        fetchSelectDsList().then(response => {
+          this.dataSourceList = response.data.data
+        })
+      },
+      search() {
+        this.getList(this.page)
+      },
+      openBatch() {
+        if (this.$refs.crud.tableSelect.length <= 1 || this.$refs.crud.tableSelect.length > 10) {
+          this.$message.error('选中表数量不合法,数量最多10个')
+          return false
+        }
+        let tableName = []
+        for (const table of this.$refs.crud.tableSelect) {
+          tableName.push(table.tableName)
+        }
+        this.formBatchData.tableName = tableName.join('-')
+        this.boxBatch = true
+      },
+      batchGen() {
+        this.formBatchData.id = this.q.id
+        handleDown(this.formBatchData).then(() => {
+          this.boxBatch = false
+        })
+      }
     }
   }
-}
 </script>
 
 <style lang="scss" scoped>