Prechádzať zdrojové kódy

修复表格注释和默认填写业务名

Master 2 rokov pred
rodič
commit
5e436b7a9a

+ 1 - 1
Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs

@@ -281,7 +281,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
             {
                 EntityName = c.Name,
                 DbTableName = sugarAttribute == null ? c.Name : ((SugarTable)sugarAttribute).TableName,
-                TableDescription = description,
+                TableDescription = sugarAttribute == null ? description : ((SugarTable)sugarAttribute).TableDescription,
                 Type = c
             });
         }

+ 9 - 2
Web/src/views/system/codeGen/component/editCodeGenDialog.vue

@@ -45,8 +45,8 @@
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
 						<el-form-item label="生成表" prop="tableName" :rules="[{ required: true, message: '生成表不能为空', trigger: 'blur' }]">
-							<el-select v-model="state.ruleForm.tableName" filterable clearable class="w100">
-								<el-option v-for="item in state.tableData" :key="item.entityName" :label="item.entityName + ' ( ' + item.tableName + ' )'" :value="item.entityName" />
+							<el-select v-model="state.tableName" @change="tableChanged" value-key="value" filterable clearable class="w100">
+								<el-option v-for="item in state.tableData" :key="item.entityName" :label="item.entityName + ' ( ' + item.tableName + ' )'" :value="item" />
 							</el-select>
 						</el-form-item>
 					</el-col>
@@ -135,6 +135,7 @@ const state = reactive({
 	isShowDialog: false,
 	ruleForm: {} as UpdateCodeGenInput,
 	tableData: [] as any,
+	tableName: '',
 	dbData: [] as any,
 	menuData: [] as Array<SysMenu>,
 	codeGenTypeList: [] as any,
@@ -170,6 +171,12 @@ const dbChanged = async () => {
 	state.ruleForm.dbType = db[0].dbType.toString();
 };
 
+// table改变
+const tableChanged = (item: any) => {
+	state.tableName = item.tableName;
+	state.ruleForm.busName = item.tableComment;
+};
+
 // 打开弹窗
 const openDialog = (row: any) => {
 	state.ruleForm = JSON.parse(JSON.stringify(row));