Pārlūkot izejas kodu

fix: 生成模块修改

wanggaokun 1 gadu atpakaļ
vecāks
revīzija
44b07e202a

+ 0 - 131
src/api/interface/db/connection.ts

@@ -1,131 +0,0 @@
-import { PageQuery, BaseEntity } from '@/api/interface/index'
-export interface ConnectionVO extends BaseEntity {
-  /**
-   * 唯一主键
-   */
-  id: string | number
-
-  /**
-   * 链接名称
-   */
-  name: string
-
-  /**
-   * 数据库类型
-   */
-  type: string
-
-  /**
-   * 驱动版本
-   */
-  driverVersion: string
-
-  /**
-   * 驱动类名
-   */
-  driver: string
-
-  /**
-   * jdbc-url连接串
-   */
-  url: string
-
-  /**
-   * 数据库账号
-   */
-  userName: string
-
-  /**
-   * 账号密码
-   */
-  password: string
-}
-
-export interface ConnectionForm {
-  /**
-   * 唯一主键
-   */
-  id?: string | number
-
-  /**
-   * 链接名称
-   */
-  name?: string
-
-  /**
-   * 数据库类型
-   */
-  type?: string
-
-  /**
-   * 驱动版本
-   */
-  driverVersion?: string
-
-  /**
-   * 驱动类名
-   */
-  driver?: string
-
-  /**
-   * jdbc-url连接串
-   */
-  url?: string
-
-  /**
-   * 数据库账号
-   */
-  userName?: string
-
-  /**
-   * 账号密码
-   */
-  password?: string
-
-  /**
-   * 乐观锁
-   */
-  version?: number
-}
-
-export interface ConnectionQuery extends PageQuery {
-  /**
-   * 链接名称
-   */
-  name?: string
-
-  /**
-   * 数据库类型
-   */
-  type?: string
-
-  /**
-   * 驱动版本
-   */
-  driverVersion?: string
-
-  /**
-   * 驱动类名
-   */
-  driver?: string
-
-  /**
-   * jdbc-url连接串
-   */
-  url?: string
-
-  /**
-   * 数据库账号
-   */
-  userName?: string
-
-  /**
-   * 账号密码
-   */
-  password?: string
-
-  /**
-   * 日期范围参数
-   */
-  params?: any
-}

+ 0 - 79
src/api/modules/db/connection.ts

@@ -1,79 +0,0 @@
-import http from '@/api'
-import { ConnectionVO, ConnectionForm, ConnectionQuery } from '@/api/interface/db/connection'
-/**
- * @name 查询数据库链接列表
- * @param query 参数
- * @returns 返回列表
- */
-export const listConnectionApi = (query: ConnectionQuery) => {
-  return http.get<ConnectionVO[]>('/db/connection/list', query, { loading: true })
-}
-
-/**
- * @name 查询数据库链接详细
- * @param id id
- * @returns returns
- */
-export const getConnectionApi = (id: string | number) => {
-  return http.get<ConnectionVO>(`/db/connection/${id}`)
-}
-
-/**
- * @name 测试数据库连接
- * @param id id
- * @returns returns
- */
-export const testApi = (id: string | number) => {
-  return http.get<any>(`/db/connection/test/${id}`)
-}
-/**
- * @name 获取连接名称
- * @returns returns
- */
-export const getNameListApi = () => {
-  return http.get<any>(`/db/connection/list/name`)
-}
-
-/**
- * @name 查询数据库产品类型
- * @returns returns
- */
-export const getTypesApi = () => {
-  return http.get<any>(`/db/connection/types`)
-}
-
-/**
- * @name 查询数据库链驱动
- * @param type type
- * @returns returns
- */
-export const getDriversApi = (type: string | number) => {
-  return http.get<any>(`/db/connection/drivers/${type}`)
-}
-
-/**
- * @name 新增数据库链接
- * @param data data
- * @returns returns
- */
-export const addConnectionApi = (data: ConnectionForm) => {
-  return http.post<any>('/db/connection', data, { loading: false })
-}
-
-/**
- * @name 修改数据库链接
- * @param data data
- * @returns returns
- */
-export const updateConnectionApi = (data: ConnectionForm) => {
-  return http.put<any>('/db/connection', data, { loading: false })
-}
-
-/**
- * @name 删除数据库链接
- * @param id id
- * @returns returns
- */
-export const delConnectionApi = (id: string | number | Array<string | number>) => {
-  return http.delete<any>(`/db/connection/${id}`)
-}

+ 0 - 34
src/api/modules/db/metadata.ts

@@ -1,34 +0,0 @@
-import http from '@/api'
-/**
- * @name 查询数据库allSchemas
- * @param query 参数
- * @returns 返回列表
- */
-export const getSchemasApi = (id: string | number) => {
-  return http.get<any[]>(`/db/metadata/schemas/${id}`, { loading: false })
-}
-
-/**
- * @name 查询数据库allTables
- * @param query 参数
- * @returns 返回列表
- */
-export const getTablesApi = (id: string | number, param: any) => {
-  return http.get<any[]>(`/db/metadata/tables/${id}`, param, { loading: false })
-}
-/**
- * @name 查询数据库allTables
- * @param query 参数
- * @returns 返回列表
- */
-export const getTablesMetaApi = (id: string | number, param: any) => {
-  return http.get<any>(`/db/metadata/meta/table/${id}`, param, { loading: false })
-}
-/**
- * @name 查询数据库tableMeta
- * @param query 参数
- * @returns 返回列表
- */
-export const getTablesDataApi = (id: string | number, param: any) => {
-  return http.get<any>(`/db/metadata/data/table/${id}`, param, { loading: false })
-}

+ 14 - 10
src/utils/common.ts

@@ -40,8 +40,12 @@ export const lodashFunc = (callback: Function, wait: number, type?: any, options
  * @param {*} parentId 父节点字段 默认 'parentId'
  * @param {*} children 孩子节点字段 默认 'children'
  */
-export function handleTree(data: any, id: any, parentId?: any, children?: any) {
-  const config = {
+export const handleTree = <T>(data: any, id: any, parentId?: any, children?: any) => {
+  const config: {
+    id: string
+    parentId: string
+    childrenList: string
+  } = {
     id: id || 'id',
     parentId: parentId || 'parentId',
     childrenList: children || 'children'
@@ -49,7 +53,7 @@ export function handleTree(data: any, id: any, parentId?: any, children?: any) {
 
   const childrenListMap: any = {}
   const nodeIds: any = {}
-  const tree = <any>[]
+  const tree: T[] = []
 
   for (const d of data) {
     const parentId = d[config.parentId]
@@ -66,12 +70,7 @@ export function handleTree(data: any, id: any, parentId?: any, children?: any) {
       tree.push(d)
     }
   }
-
-  for (const t of tree) {
-    adaptToChildrenList(t)
-  }
-
-  function adaptToChildrenList(o: any) {
+  const adaptToChildrenList = (o: any) => {
     if (childrenListMap[o[config.id]] !== null) {
       o[config.childrenList] = childrenListMap[o[config.id]]
     }
@@ -81,6 +80,11 @@ export function handleTree(data: any, id: any, parentId?: any, children?: any) {
       }
     }
   }
+
+  for (const t of tree) {
+    adaptToChildrenList(t)
+  }
+
   return tree
 }
 
@@ -89,7 +93,7 @@ export function handleTree(data: any, id: any, parentId?: any, children?: any) {
  *
  * @param {*} params  参数
  */
-export function tansParams(params: { [x: string]: any }) {
+export const tansParams = (params: { [x: string]: any }) => {
   let result = ''
   for (const propName of Object.keys(params)) {
     const value = params[propName]

+ 0 - 234
src/views/db/connection/index.vue

@@ -1,234 +0,0 @@
-<template>
-  <div class="table-box">
-    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listConnectionApi">
-      <!-- 表格 header 按钮 -->
-      <template #tableHeader="scope">
-        <el-button type="primary" v-auth="['db:connection:add']" icon="CirclePlus" @click="openDialog(1, '数据库链接新增')"> 新增 </el-button>
-        <el-button
-          type="danger"
-          v-auth="['db:connection:remove']"
-          icon="Delete"
-          plain
-          :disabled="!scope.isSelected"
-          @click="batchDelete(scope.selectedListIds)"
-        >
-          批量删除
-        </el-button>
-      </template>
-      <!-- 表格操作 -->
-      <template #operation="scope">
-        <el-button type="primary" link icon="View" v-auth="['db:connection:query']" @click="openDialog(3, '数据库链接查看', scope.row)">
-          查看
-        </el-button>
-        <el-button type="primary" link icon="View" v-auth="['db:connection:query']" @click="test(scope.row)"> 测试 </el-button>
-        <el-button type="primary" link icon="EditPen" v-auth="['db:connection:edit']" @click="openDialog(2, '数据库链接编辑', scope.row)">
-          编辑
-        </el-button>
-        <el-button type="primary" link icon="Delete" v-auth="['db:connection:remove']" @click="deleteConnection(scope.row)"> 删除 </el-button>
-      </template>
-    </ProTable>
-    <FormDialog :items-options="itemsOptions" :model="connectionForm" ref="formDialogRef" />
-  </div>
-</template>
-
-<script setup lang="tsx" name="Connection">
-import { ref, reactive } from 'vue'
-import { useHandleData } from '@/hooks/useHandleData'
-import ProTable from '@/components/ProTable/index.vue'
-import FormDialog from '@/components/FormDialog/index.vue'
-import { ElMessage } from 'element-plus'
-import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
-import {
-  listConnectionApi,
-  delConnectionApi,
-  addConnectionApi,
-  updateConnectionApi,
-  getConnectionApi,
-  getTypesApi,
-  getDriversApi,
-  testApi
-} from '@/api/modules/db/connection'
-
-// ProTable 实例
-const proTable = ref<ProTableInstance>()
-
-let connectionForm = ref({ type: '' })
-
-let databaseType = ref([])
-
-// 删除数据库链接信息
-const deleteConnection = async (params: any) => {
-  await useHandleData(delConnectionApi, params.id, '删除【' + params.id + '】数据库链接')
-  proTable.value?.getTableList()
-}
-
-// 批量删除数据库链接信息
-const batchDelete = async (ids: string[]) => {
-  await useHandleData(delConnectionApi, ids, '删除所选数据库链接信息')
-  proTable.value?.clearSelection()
-  proTable.value?.getTableList()
-}
-const test = async (params: any) => {
-  const res = await testApi(params.id)
-  if (res.code == 200) {
-    ElMessage.success('测试连接成功!')
-  } else {
-    ElMessage({
-      type: 'error',
-      message: '测试失败!'
-    })
-  }
-}
-
-const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
-// 打开弹框的功能
-const openDialog = async (type: number, title: string, row?: any) => {
-  connectionForm.value = { type: '' }
-  if (row?.id) {
-    const res = await getConnectionApi(row?.id || null)
-    connectionForm.value = res.data
-  }
-  const params = {
-    title,
-    width: 580,
-    isEdit: type !== 3,
-    api: type == 1 ? addConnectionApi : updateConnectionApi,
-    getTableList: proTable.value?.getTableList
-  }
-  formDialogRef.value?.openDialog(params)
-}
-
-// 表格配置项
-const columns = reactive<ColumnProps<any>[]>([
-  { type: 'selection', fixed: 'left', width: 70 },
-  {
-    prop: 'id',
-    label: '编号'
-  },
-  {
-    prop: 'name',
-    label: '链接名称',
-    search: {
-      el: 'input'
-    }
-  },
-  {
-    prop: 'type',
-    label: '数据库类型',
-    search: {
-      el: 'input'
-    }
-  },
-  {
-    prop: 'driverVersion',
-    label: '驱动版本',
-    search: {
-      el: 'input'
-    }
-  },
-  {
-    prop: 'driver',
-    label: '驱动类名',
-    search: {
-      el: 'input'
-    }
-  },
-  {
-    prop: 'url',
-    label: 'jdbc-url连接串'
-  },
-  {
-    prop: 'userName',
-    label: '数据库账号'
-  },
-  {
-    prop: 'password',
-    label: '账号密码'
-  },
-  { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
-])
-// 表单配置项
-let itemsOptions = ref<ProForm.ItemsOptions[]>([
-  {
-    label: '链接名称',
-    prop: 'name',
-    rules: [{ required: true, message: '链接名称不能为空', trigger: 'blur' }],
-    compOptions: {
-      placeholder: '请输入链接名称'
-    }
-  },
-  {
-    label: '数据库类型',
-    prop: 'type',
-    rules: [{ required: true, message: '数据库类型不能为空', trigger: 'blur' }],
-    compOptions: {
-      elTagName: 'select',
-      enum: getTypesApi,
-      labelKey: 'type',
-      valueKey: 'type',
-      placeholder: '请输入数据库类型',
-      onChange: value => {
-        if (value) {
-          connectionForm.value['driverVersion'] = ''
-          getDriversApi(value).then(res => {
-            itemsOptions.value[2].compOptions.enum = res.data
-            databaseType.value = res.data
-          })
-        }
-      }
-    }
-  },
-  {
-    label: '驱动版本',
-    prop: 'driverVersion',
-    rules: [{ required: true, message: '驱动版本不能为空', trigger: 'blur' }],
-    compOptions: {
-      elTagName: 'select',
-      labelKey: 'driverVersion',
-      valueKey: 'driverVersion',
-      onChange: value => {
-        if (value) {
-          if (databaseType.value.length > 0) {
-            for (let i = 0; i < databaseType.value.length; i++) {
-              if (value == databaseType.value[i]['driverVersion']) {
-                connectionForm.value['driver'] = databaseType.value[i]['driverClass']
-                break
-              }
-            }
-          }
-        }
-      },
-      placeholder: '请选择驱动版本'
-    }
-  },
-  {
-    label: 'jdbc-url',
-    prop: 'url',
-    tooltip: 'jdbc:dm://localhost:5236',
-    rules: [{ required: true, message: 'jdbc-url连接串不能为空', trigger: 'blur' }],
-    compOptions: {
-      type: 'textarea',
-      clearable: true,
-      placeholder: '请输入内容'
-    }
-  },
-  {
-    label: '数据库账号',
-    prop: 'userName',
-    rules: [{ required: true, message: '数据库账号不能为空', trigger: 'blur' }],
-    compOptions: {
-      placeholder: '请输入数据库账号'
-    }
-  },
-  {
-    label: '账号密码',
-    prop: 'password',
-    rules: [{ required: true, message: '账号密码不能为空', trigger: 'blur' }],
-    compOptions: {
-      placeholder: '请输入账号密码',
-      type: 'password',
-      showPassword: true
-    }
-  }
-])
-</script>

+ 0 - 42
src/views/db/database/index.scss

@@ -1,42 +0,0 @@
-.table-container {
-  width: 100%;
-  padding: 10px;
-}
-.filter {
-  box-sizing: border-box;
-  width: 210px;
-  height: 100%;
-  padding: 12px;
-  margin-right: 6px;
-  .title {
-    margin: 0 0 15px;
-    font-size: 18px;
-    font-weight: bold;
-    color: var(--el-color-info-dark-2);
-    letter-spacing: 0.5px;
-  }
-  .el-input {
-    margin: 0 0 15px;
-  }
-  .el-scrollbar {
-    :deep(.el-tree) {
-      height: 80%;
-      overflow: auto;
-      .el-tree-node__content {
-        height: 33px;
-      }
-    }
-    :deep(.el-tree--highlight-current) {
-      .el-tree-node.is-current > .el-tree-node__content {
-        background-color: var(--el-color-primary);
-        .el-tree-node__label,
-        .el-tree-node__expand-icon {
-          color: white;
-        }
-        .is-leaf {
-          color: transparent;
-        }
-      }
-    }
-  }
-}

+ 0 - 216
src/views/db/database/index.vue

@@ -1,216 +0,0 @@
-<template>
-  <div class="main-box">
-    <div class="card filter">
-      <el-tree
-        class="scroller"
-        :load="loadNode"
-        :expand-on-click-node="true"
-        :highlight-current="true"
-        :render-content="renderContent"
-        @node-click="handleNodeClick"
-        :lazy="true"
-      >
-      </el-tree>
-    </div>
-    <div class="table-box card content-box-c">
-      <div class="table-container">
-        <span>当前表:{{ currentNode.schemaName }} / {{ currentNode.tableName }}</span>
-        <el-tabs v-model="activeName" class="demo-tabs">
-          <el-tab-pane label="基本信息" name="1">
-            <el-descriptions title="元数据" size="small" :column="1" colon border>
-              <el-descriptions-item label="表名称">{{ tableMeta.tableName }}</el-descriptions-item>
-              <el-descriptions-item label="表类型">{{ tableMeta.type }}</el-descriptions-item>
-              <el-descriptions-item label="模式名">{{ tableMeta.schemaName }}</el-descriptions-item>
-              <el-descriptions-item label="表注释">
-                <el-input type="textarea" :rows="2" v-model="tableMeta.remarks" auto-complete="off" :readonly="true"></el-input>
-              </el-descriptions-item>
-              <el-descriptions-item label="建表DDL">
-                <el-input type="textarea" :rows="16" v-model="tableMeta.createSql" auto-complete="off" :readonly="true"></el-input>
-              </el-descriptions-item>
-            </el-descriptions>
-          </el-tab-pane>
-          <el-tab-pane label="字段信息" name="2">
-            <ProTable :pagination="false" :is-show-search="false" :tool-button="false" :columns="fieldColumns" :data="tableMeta.columns">
-              <!-- 表格操作 -->
-              <template #empty>
-                <span>单击左侧展开"数据源"来查看表的元数据记录</span>
-              </template>
-            </ProTable>
-          </el-tab-pane>
-          <el-tab-pane label="索引信息" name="3">
-            <ProTable :pagination="false" :is-show-search="false" :tool-button="false" :columns="indexColumns" :data="tableMeta.indexes">
-              <!-- 表格操作 -->
-              <template #empty>
-                <span>单击左侧展开"数据源"来查看表的元数据记录</span>
-              </template>
-            </ProTable>
-          </el-tab-pane>
-          <el-tab-pane label="取样数据" name="4">
-            <el-table :data="sampleData?.rows" border>
-              <template #empty>
-                <span>单击左侧展开"数据源导航树"来查看表的数据记录</span>
-              </template>
-              <el-table-column v-for="(item, index) in sampleData?.columns" :prop="item" :label="item" :key="index" show-overflow-tooltip>
-              </el-table-column>
-            </el-table>
-          </el-tab-pane>
-        </el-tabs>
-      </div>
-    </div>
-  </div>
-</template>
-
-<script setup lang="tsx" name="UserManage">
-import { ref, reactive } from 'vue'
-// import TreeFilter from '@/components/TreeFilter/index.vue'
-import { getNameListApi } from '@/api/modules/db/connection'
-import { getSchemasApi, getTablesApi, getTablesMetaApi, getTablesDataApi } from '@/api/modules/db/metadata'
-// import type { TabsPaneContext } from 'element-plus'
-import ProTable from '@/components/ProTable/index.vue'
-import { ColumnProps } from '@/components/ProTable/interface'
-const activeName = ref('1')
-const tableMeta = ref({
-  tableName: '-',
-  schemaName: '-',
-  remarks: '',
-  type: '-',
-  createSql: '',
-  primaryKeys: [],
-  columns: [],
-  indexes: []
-})
-const currentNode = ref({
-  tableName: '-',
-  schemaName: '-'
-})
-
-let sampleData = ref<any>()
-
-// const handleClick = (tab: TabsPaneContext, event: Event) => {
-//   console.log(tab, event)
-// }
-const loadNode = (node, resolve) => {
-  if (node.level === 0) {
-    const rootNode = [{ label: '数据源导航树', value: 0, hasChild: true, children: 'child' }]
-    return resolve(rootNode)
-  }
-
-  setTimeout(() => {
-    if (node.level === 1) {
-      getNameListApi().then(res => {
-        res.data.forEach(item => {
-          item['label'] = item.name
-          item['parent'] = 0
-          item['value'] = item.id
-          item['hasChild'] = true
-          item['children'] = 'child'
-        })
-        resolve(res.data)
-      })
-    } else if (node.level === 2) {
-      getSchemasApi(node.data.value).then(res => {
-        res.data.forEach(item => {
-          item['label'] = item.schema
-          item['parent'] = node.data.value
-          item['value'] = item.connection
-          item['hasChild'] = true
-          item['children'] = 'child'
-        })
-        resolve(res.data)
-      })
-    } else if (node.level === 3) {
-      getTablesApi(node.data.parent, { schema: node.data.label }).then(res => {
-        res.data.forEach(item => {
-          item['label'] = item.tableName
-          item['parent'] = node.data.label
-          item['id'] = node.data.parent
-          item['value'] = item.type
-          item['hasChild'] = false
-          item['children'] = 'child'
-        })
-        resolve(res.data)
-      })
-    } else if (node.level == 4) {
-      resolve([])
-    } else {
-      resolve([])
-    }
-  }, 500)
-}
-const handleNodeClick = data => {
-  let id = data.id
-  let schema = data.schemaName
-  let table = data.tableName
-  if (!data.hasChild && id && schema && table) {
-    activeName.value = '1'
-    getTablesMetaApi(id, { schema, table }).then(res => {
-      tableMeta.value = res.data
-      currentNode.value.tableName = table
-      currentNode.value.schemaName = schema
-    })
-    getTablesDataApi(id, { schema, table }).then(res => {
-      sampleData.value = res.data
-    })
-  }
-}
-const renderContent = (h, { node, data }) => {
-  if (node.level === 1) {
-    return (
-      <div class="custom-tree-node">
-        <i class="el-icon-takeaway-box"></i>
-        <span>{data.label}</span>
-      </div>
-    )
-  } else if (node.level === 2) {
-    return (
-      <div class="custom-tree-node">
-        <i class="el-icon-folder-opened"></i>
-        <span>{data.label}</span>
-      </div>
-    )
-  } else if (node.level === 3) {
-    return (
-      <div class="custom-tree-node">
-        <i class="iconfont icon-shujuku1"></i>
-        <span>{data.label}</span>
-      </div>
-    )
-  } else {
-    let icon_pic = 'iconfont icon-shitu_biaoge'
-    if (data.value === 'VIEW') {
-      icon_pic = 'iconfont icon-viewList'
-    }
-
-    return (
-      <div class="custom-tree-node">
-        <i class={icon_pic}></i>
-        <el-tooltip class="item" content={node.label} effect="light" placement="left">
-          <span>{data.label}</span>
-        </el-tooltip>
-      </div>
-    )
-  }
-}
-
-// 表格配置项
-const fieldColumns = reactive<ColumnProps<any>[]>([
-  { prop: 'fieldName', label: '名称' },
-  { prop: 'typeName', label: '类型' },
-  { prop: 'fieldType', label: 'jdbcType' },
-  { prop: 'displaySize', label: '长度' },
-  { prop: 'precision', label: '精度' },
-  { prop: 'scale', label: '位数' },
-  { prop: 'isPrimaryKey', label: '主键' },
-  { prop: 'isAutoIncrement', label: '自增' },
-  { prop: 'isNullable', label: '可空' },
-  { prop: 'remarks', label: '注释' }
-])
-const indexColumns = reactive<ColumnProps<any>[]>([
-  { prop: 'indexType', label: '索引类型' },
-  { prop: 'indexName', label: '索引名称' },
-  { prop: 'indexFields', label: '索引字段' }
-])
-</script>
-<style scoped lang="scss">
-@import './index.scss';
-</style>

+ 5 - 5
src/views/tool/gen/components/columnInfo.vue

@@ -75,7 +75,7 @@ const columns = reactive<ColumnProps<any>[]>([
     render: scope => {
       return (
         <div>
-          <el-checkbox vModel_trim={scope.row.isInsert} true-value="1" />
+          <el-checkbox vModel_trim={scope.row.isInsert} true-value="1" false-value="0" />
         </div>
       )
     }
@@ -87,7 +87,7 @@ const columns = reactive<ColumnProps<any>[]>([
     render: scope => {
       return (
         <div>
-          <el-checkbox vModel_trim={scope.row.isEdit} true-value="1" />
+          <el-checkbox vModel_trim={scope.row.isEdit} true-value="1" false-value="0" />
         </div>
       )
     }
@@ -99,7 +99,7 @@ const columns = reactive<ColumnProps<any>[]>([
     render: scope => {
       return (
         <div>
-          <el-checkbox vModel_trim={scope.row.isList} true-value="1" />
+          <el-checkbox vModel_trim={scope.row.isList} true-value="1" false-value="0" />
         </div>
       )
     }
@@ -111,7 +111,7 @@ const columns = reactive<ColumnProps<any>[]>([
     render: scope => {
       return (
         <div>
-          <el-checkbox vModel_trim={scope.row.isQuery} true-value="1" />
+          <el-checkbox vModel_trim={scope.row.isQuery} true-value="1" false-value="0" />
         </div>
       )
     }
@@ -144,7 +144,7 @@ const columns = reactive<ColumnProps<any>[]>([
     render: scope => {
       return (
         <div>
-          <el-checkbox vModel_trim={scope.row.isRequired} />
+          <el-checkbox vModel_trim={scope.row.isRequired} true-value="1" false-value="0" />
         </div>
       )
     }

+ 2 - 5
src/views/tool/gen/components/genInfoForm.vue

@@ -56,10 +56,6 @@ const genTypeData = [
   {
     label: 'zip压缩包',
     value: '0'
-  },
-  {
-    label: '自定义路径',
-    value: '1'
   }
 ]
 const _formOptions = {
@@ -268,6 +264,7 @@ const setItem = () => {
         filterable: true,
         props: {
           value: 'menuId',
+          nodeKey: 'menuId',
           label: 'menuName',
           children: 'children'
         }
@@ -275,7 +272,7 @@ const setItem = () => {
     },
     {
       label: '生成方式',
-      prop: 'functionAuthor',
+      prop: 'genType',
       tooltip: '默认为zip压缩包下载,也可以自定义生成路径',
       span: 12,
       compOptions: {

+ 7 - 1
src/views/tool/gen/editGenTable.vue

@@ -29,6 +29,11 @@ import { getTableApi, updateGenTableApi } from '@/api/modules/tool/gen'
 import { optionSelectApi } from '@/api/modules/system/dict'
 import { listMenuApi } from '@/api/modules/system/menu'
 import { handleTree } from '@/utils/common'
+interface MenuOptionsType {
+  menuId: number | string
+  menuName: string
+  children?: MenuOptionsType[]
+}
 const basicInfoRef = ref<InstanceType<typeof BasicInfoForm> | null>(null)
 const genInfoRef = ref<InstanceType<typeof GenInfoForm> | null>(null)
 const tableInfoRef = ref<InstanceType<typeof ColumnInfo> | null>(null)
@@ -76,7 +81,8 @@ const initTabsData = async (tableId: string) => {
   /** 查询菜单下拉列表 */
   const response = await listMenuApi()
   if (response.code === 200) {
-    menus.value = handleTree(response.data, 'menuId')
+    response.data.forEach(m => (m.menuId = String(m.menuId)))
+    menus.value = handleTree<MenuOptionsType>(response.data, 'menuId')
   }
   isRouter.value = true
 }