Просмотр исходного кода

代码生成前端字段修改

kenny 4 лет назад
Родитель
Сommit
fbf96f7e2c
2 измененных файлов с 24 добавлено и 24 удалено
  1. 4 4
      Vben2/src/api/sys/admin.ts
  2. 20 20
      Vben2/src/views/sys/admin/code/codeGenerate.data.ts

+ 4 - 4
Vben2/src/api/sys/admin.ts

@@ -371,11 +371,11 @@ export const deleGenerate = (params: any) =>
 export const getDatabaseList = (params?: any) =>
   defHttp.get<any>({ url: Api.GetDatabaseList, params });
 // 获取数据库表(实体)集合
-export const getTableList = (dbConfigId: string) =>
-  defHttp.get<any>({ url: Api.GetTableList + '/' + dbConfigId });
+export const getTableList = (configId: string) =>
+  defHttp.get<any>({ url: Api.GetTableList + '/' + configId });
 // 根据表名获取列
-export const getColumnList = (dbConfigId: string, tableName: string) =>
-  defHttp.get<any>({ url: Api.GetColumnList + '/' + dbConfigId + '/' + tableName });
+export const getColumnList = (configId: string, tableName: string) =>
+  defHttp.get<any>({ url: Api.GetColumnList + '/' + configId + '/' + tableName });
 // 本地生成
 export const generateRunLocal = (params: any) =>
   defHttp.post<any>({

+ 20 - 20
Vben2/src/views/sys/admin/code/codeGenerate.data.ts

@@ -32,7 +32,7 @@ const apiColumnList = async (param: any) => {
   //if (typeof param !== 'string') return [];
   if (columnList.length === 0 || currentTable !== param.e) {
     //console.log('param:' + param);
-    const result = await getColumnList(param.dbConfigId, param.e);
+    const result = await getColumnList(param.configId, param.e);
     columnList = result;
   } else {
   }
@@ -48,7 +48,7 @@ const apiDictTypeDropDown = async () => {
 export const codeShowColumns: BasicColumn[] = [
   {
     title: '库定位器',
-    dataIndex: 'dbConfigId',
+    dataIndex: 'configId',
   },
   {
     title: '表名称',
@@ -81,15 +81,15 @@ export const codeFormSchema: FormSchema[] = [
     show: false,
   },
   {
-    field: 'dbConfigId',
+    field: 'configId',
     label: '库定位器',
     component: 'ApiSelect',
     componentProps: ({ formModel, formActionType }) => {
       return {
         api: apiDatabaseList,
         fieldNames: {
-          label: 'dbConfigId',
-          value: 'dbConfigId',
+          label: 'configId',
+          value: 'configId',
         },
         onChange: (e: any, option: any) => {
           formModel.tableName = undefined;
@@ -299,23 +299,23 @@ export const columns = [
 //外键
 export const fkFormSchema: FormSchema[] = [
   {
-    field: 'dbConfigId',
+    field: 'configId',
     label: '库定位器',
     component: 'ApiSelect',
     componentProps: ({ formModel, formActionType }) => {
       return {
         api: apiDatabaseList,
         fieldNames: {
-          label: 'dbConfigId',
-          value: 'dbConfigId',
+          label: 'configId',
+          value: 'configId',
         },
         onChange: (e: any, option: any) => {
           formModel.tableName = option.tableName;
           formModel.dbType = option.dbType;
           formModel.connectionString = option.connectionString;
           const { updateSchema } = formActionType;
-          const dbConfigId = e;
-          console.log('dbchange' + dbConfigId);
+          const configId = e;
+          console.log('dbchange' + configId);
           updateSchema([
             {
               field: 'tableName',
@@ -334,7 +334,7 @@ export const fkFormSchema: FormSchema[] = [
                     formModel.columnName = undefined;
                     formModel.entityName = option.entityName;
                     const { updateSchema } = formActionType;
-                    console.log('tableNamechange' + dbConfigId);
+                    console.log('tableNamechange' + configId);
                     updateSchema({
                       field: 'columnName',
                       componentProps: {
@@ -344,9 +344,9 @@ export const fkFormSchema: FormSchema[] = [
                           label: 'columnName',
                           value: 'columnName',
                         },
-                        params: { dbConfigId, e },
+                        params: { configId, e },
                         onChange: (e: any, option: any) => {
-                          console.log(e + 'columnNamechange' + dbConfigId);
+                          console.log(e + 'columnNamechange' + configId);
                           formModel.columnNetType = option.netType;
                         },
                       },
@@ -421,22 +421,22 @@ export const fkFormSchema: FormSchema[] = [
 //树形
 export const treeFormSchema: FormSchema[] = [
   {
-    field: 'dbConfigId',
+    field: 'configId',
     label: '库定位器',
     component: 'ApiSelect',
     componentProps: ({ formModel, formActionType }) => {
       return {
         api: apiDatabaseList,
         fieldNames: {
-          label: 'dbConfigId',
-          value: 'dbConfigId',
+          label: 'configId',
+          value: 'configId',
         },
         onChange: (e: any, option: any) => {
           formModel.tableName = undefined;
           formModel.dbType = option.dbType;
           formModel.connectionString = option.connectionString;
           const { updateSchema } = formActionType;
-          const dbConfigId = e;
+          const configId = e;
           updateSchema([
             {
               field: 'tableName',
@@ -461,7 +461,7 @@ export const treeFormSchema: FormSchema[] = [
                         componentProps: {
                           api: apiColumnList,
                           immediate: false,
-                          params: { dbConfigId, e },
+                          params: { configId, e },
                           fieldNames: {
                             label: 'columnName',
                             value: 'columnName',
@@ -473,7 +473,7 @@ export const treeFormSchema: FormSchema[] = [
                         componentProps: {
                           api: apiColumnList,
                           immediate: false,
-                          params: { dbConfigId, e },
+                          params: { configId, e },
                           fieldNames: {
                             label: 'columnName',
                             value: 'columnName',
@@ -485,7 +485,7 @@ export const treeFormSchema: FormSchema[] = [
                         componentProps: {
                           api: apiColumnList,
                           immediate: false,
-                          params: { dbConfigId, e },
+                          params: { configId, e },
                           fieldNames: {
                             label: 'columnName',
                             value: 'columnName',