🎈 perf(genCode): 优化列配置拖拽排序
This commit is contained in:
parent
f2c88056b7
commit
394cf4e201
47
Admin.NET/Admin.NET.Application/Entity/Demo.cs
Normal file
47
Admin.NET/Admin.NET.Application/Entity/Demo.cs
Normal file
@ -0,0 +1,47 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
using Admin.NET.Core;
|
||||
|
||||
namespace Admin.NET.Application.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// Demo业务表
|
||||
/// </summary>
|
||||
[SugarTable(null, "Demo业务表")]
|
||||
public class Demo : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Code", ColumnDescription = "", Length = 64)]
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Name", ColumnDescription = "", Length = 64)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "Description", ColumnDescription = "", Length = 500)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "CreateOrgId", ColumnDescription = "")]
|
||||
public long? CreateOrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "CreateOrgName", ColumnDescription = "", Length = 64)]
|
||||
public string? CreateOrgName { get; set; }
|
||||
|
||||
}
|
||||
@ -86,7 +86,7 @@ public class SysCodeGenConfigService : IDynamicApiController, ITransient
|
||||
if (tableColumnOutputList == null) return;
|
||||
|
||||
var codeGenConfigs = new List<SysCodeGenConfig>();
|
||||
var orderNo = 100;
|
||||
var orderNo = 1;
|
||||
foreach (var tableColumn in tableColumnOutputList)
|
||||
{
|
||||
if (_db.Queryable<SysCodeGenConfig>().Any(u => u.ColumnName == tableColumn.ColumnName && u.CodeGenId == codeGenerate.Id))
|
||||
@ -154,7 +154,7 @@ public class SysCodeGenConfigService : IDynamicApiController, ITransient
|
||||
codeGenConfig.DefaultValue = GetDefaultValue(tableColumn.DefaultValue);
|
||||
codeGenConfigs.Add(codeGenConfig);
|
||||
|
||||
orderNo += 10; // 每个配置排序间隔10
|
||||
orderNo += 1; // 每个配置排序间隔1
|
||||
}
|
||||
// 多库代码生成---这里要切回主库
|
||||
var provider = _db.AsTenant().GetConnectionScope(SqlSugarConst.MainConfigId);
|
||||
|
||||
2
Web/src/types/mitt.d.ts
vendored
2
Web/src/types/mitt.d.ts
vendored
@ -11,6 +11,7 @@
|
||||
* @method openShareTagsView 布局设置弹窗,开启 TagsView 共用
|
||||
* @method onTagsViewRefreshRouterView tagsview 刷新界面
|
||||
* @method onCurrentContextmenuClick tagsview 右键菜单每项点击时
|
||||
* @method submitRefreshFk
|
||||
*/
|
||||
declare type MittType<T = any> = {
|
||||
openSettingsDrawer?: string;
|
||||
@ -23,6 +24,7 @@ declare type MittType<T = any> = {
|
||||
openShareTagsView?: string;
|
||||
onTagsViewRefreshRouterView?: T;
|
||||
onCurrentContextmenuClick?: T;
|
||||
submitRefreshFk?:T
|
||||
};
|
||||
|
||||
// mitt 参数类型定义
|
||||
|
||||
@ -80,6 +80,7 @@
|
||||
import { SysCodeGenConfigApi, SysConstApi, SysDictDataApi, SysDictTypeApi, SysEnumApi } from '/@/api-services/api';
|
||||
import { VxeGridInstance, VxeGridProps } from 'vxe-pc-ui';
|
||||
import Sortable from 'sortablejs';
|
||||
import { log } from 'console';
|
||||
// import { CodeGenConfig } from '/@/api-services/models/code-gen-config';
|
||||
const xGrid = ref<VxeGridInstance<any>>();
|
||||
const emits = defineEmits(['handleQuery']);
|
||||
@ -236,14 +237,14 @@
|
||||
const fullData = xGrid.value?.getTableData().fullData || [];
|
||||
const newIndex = sortableEvent.newIndex as number;
|
||||
const oldIndex = sortableEvent.oldIndex as number;
|
||||
console.log("oldIndex", oldIndex);
|
||||
|
||||
// 往前移动
|
||||
if (oldIndex > newIndex) {
|
||||
const moveRow = fullData?.find((e) => e.orderNo == oldIndex + 1);
|
||||
for (let i = oldIndex; i > newIndex; i--) {
|
||||
const row = fullData?.find((e) => e.orderNo == i);
|
||||
row.orderNo += 1;
|
||||
if (row) {
|
||||
row.orderNo += 1;
|
||||
}
|
||||
}
|
||||
moveRow.orderNo = newIndex + 1;
|
||||
} else {
|
||||
@ -251,7 +252,9 @@
|
||||
const moveRow = fullData?.find((e) => e.orderNo == oldIndex + 1);
|
||||
for (let i = oldIndex; i < newIndex; i++) {
|
||||
const row = fullData?.find((e) => e.orderNo == i + 2);
|
||||
row.orderNo -= 1;
|
||||
if (row) {
|
||||
row.orderNo -= 1;
|
||||
}
|
||||
}
|
||||
moveRow.orderNo = newIndex + 1;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user