正在显示
13 个修改的文件
包含
45 行增加
和
18 行删除
@@ -36,7 +36,7 @@ func (tableEventService *TableEventService) DigitalPlatformEventSubscribe(ctx *d | @@ -36,7 +36,7 @@ func (tableEventService *TableEventService) DigitalPlatformEventSubscribe(ctx *d | ||
36 | data := cmd.EventTable | 36 | data := cmd.EventTable |
37 | tableId := 0 | 37 | tableId := 0 |
38 | switch data.Type { | 38 | switch data.Type { |
39 | - case domain.TableDataImportEvent, domain.TableDataEditEvent, domain.TableDeleteEvent: | 39 | + case domain.TableDataImportEvent, domain.TableDataEditEvent, domain.TableDeleteEvent, domain.TableStructEditEvent: |
40 | tableId = data.Table.TableId | 40 | tableId = data.Table.TableId |
41 | case domain.QuerySetUpdateEvent, domain.QuerySetUpdateRenameEvent: | 41 | case domain.QuerySetUpdateEvent, domain.QuerySetUpdateRenameEvent: |
42 | tableId = data.QuerySet.QuerySetInfo.BindTableId | 42 | tableId = data.QuerySet.QuerySetInfo.BindTableId |
@@ -37,7 +37,7 @@ func (tableEventService *TableEventService) Handler(ctx *domain.Context, cmd *co | @@ -37,7 +37,7 @@ func (tableEventService *TableEventService) Handler(ctx *domain.Context, cmd *co | ||
37 | data := cmd.EventTable | 37 | data := cmd.EventTable |
38 | tableId := 0 | 38 | tableId := 0 |
39 | switch data.Type { | 39 | switch data.Type { |
40 | - case domain.TableDataImportEvent, domain.TableDataEditEvent, domain.TableDeleteEvent: | 40 | + case domain.TableDataImportEvent, domain.TableDataEditEvent, domain.TableDeleteEvent, domain.TableStructEditEvent: |
41 | tableId = data.Table.TableId | 41 | tableId = data.Table.TableId |
42 | case domain.QuerySetUpdateEvent: | 42 | case domain.QuerySetUpdateEvent: |
43 | tableId = data.QuerySet.QuerySetInfo.BindTableId | 43 | tableId = data.QuerySet.QuerySetInfo.BindTableId |
@@ -92,7 +92,7 @@ func (tableEventService *TableEventService) HandlerTableAffectedMarkToConflictSt | @@ -92,7 +92,7 @@ func (tableEventService *TableEventService) HandlerTableAffectedMarkToConflictSt | ||
92 | data := cmd.EventTable | 92 | data := cmd.EventTable |
93 | tableId := 0 | 93 | tableId := 0 |
94 | switch data.Type { | 94 | switch data.Type { |
95 | - case domain.TableDataEditEvent: | 95 | + case domain.TableStructEditEvent, domain.TableDeleteEvent: |
96 | tableId = data.Table.TableId | 96 | tableId = data.Table.TableId |
97 | case domain.QuerySetUpdateEvent, domain.QuerySetUpdateRenameEvent: | 97 | case domain.QuerySetUpdateEvent, domain.QuerySetUpdateRenameEvent: |
98 | tableId = data.QuerySet.QuerySetInfo.BindTableId | 98 | tableId = data.QuerySet.QuerySetInfo.BindTableId |
@@ -35,7 +35,7 @@ func (d *TableDto) Load(m *domain.Table) *TableDto { | @@ -35,7 +35,7 @@ func (d *TableDto) Load(m *domain.Table) *TableDto { | ||
35 | d.Modules = make([]int, 0) | 35 | d.Modules = make([]int, 0) |
36 | if m.TableInfo != nil { | 36 | if m.TableInfo != nil { |
37 | //d.Module = m.TableInfo.ApplyOnModule | 37 | //d.Module = m.TableInfo.ApplyOnModule |
38 | - for i := 1; i <= 3; i++ { | 38 | + for i := 1; i <= 4; i++ { |
39 | if m.TableInfo.ApplyOnModule&(1<<(i-1)) > 0 { | 39 | if m.TableInfo.ApplyOnModule&(1<<(i-1)) > 0 { |
40 | d.Modules = append(d.Modules, 1<<(i-1)) | 40 | d.Modules = append(d.Modules, 1<<(i-1)) |
41 | } | 41 | } |
@@ -24,7 +24,7 @@ type SearchTableQuery struct { | @@ -24,7 +24,7 @@ type SearchTableQuery struct { | ||
24 | // 返回结构信息 | 24 | // 返回结构信息 |
25 | ReturnDetailStructInfo bool `cname:"返回具体的结构信息 默认不返回" json:"returnDetailStructInfo"` | 25 | ReturnDetailStructInfo bool `cname:"返回具体的结构信息 默认不返回" json:"returnDetailStructInfo"` |
26 | // 排除分组项,只返回一级列表;默认 false 不排除,连分组也返回 | 26 | // 排除分组项,只返回一级列表;默认 false 不排除,连分组也返回 |
27 | - ReturnGroupItem bool `cname:"排除分组" json:"returnGroupItem"` | 27 | + ReturnGroupItem *bool `cname:"排除分组" json:"returnGroupItem"` |
28 | // 排除指定表 | 28 | // 排除指定表 |
29 | ExcludeTables []int `cname:"排除指定表" json:"excludeTables"` | 29 | ExcludeTables []int `cname:"排除指定表" json:"excludeTables"` |
30 | Context *domain.Context | 30 | Context *domain.Context |
@@ -56,7 +56,7 @@ func (tableService *TableService) TableObjectSearch(searchQuery *query.SearchTab | @@ -56,7 +56,7 @@ func (tableService *TableService) TableObjectSearch(searchQuery *query.SearchTab | ||
56 | querySetMapById = make(map[int]*domain.QuerySet) | 56 | querySetMapById = make(map[int]*domain.QuerySet) |
57 | querySetMapByTableId = make(map[int]*domain.QuerySet) | 57 | querySetMapByTableId = make(map[int]*domain.QuerySet) |
58 | ) | 58 | ) |
59 | - if searchQuery.ReturnGroupItem { | 59 | + if searchQuery.ReturnGroupItem != nil && *searchQuery.ReturnGroupItem { |
60 | for _, qs := range querySets { | 60 | for _, qs := range querySets { |
61 | querySetMapById[qs.QuerySetId] = qs | 61 | querySetMapById[qs.QuerySetId] = qs |
62 | } | 62 | } |
@@ -540,8 +540,9 @@ const ( | @@ -540,8 +540,9 @@ const ( | ||
540 | ) | 540 | ) |
541 | 541 | ||
542 | const ( | 542 | const ( |
543 | - ModuleAll = ModuleDigitalCenter | ModuleQuerySetCenter | ModuleCalculateCenter | 543 | + ModuleAll = ModuleDigitalCenter | ModuleQuerySetCenter | ModuleCalculateCenter | ModuleChartTemplate |
544 | ModuleDigitalCenter = 1 | 544 | ModuleDigitalCenter = 1 |
545 | ModuleQuerySetCenter = 2 | 545 | ModuleQuerySetCenter = 2 |
546 | ModuleCalculateCenter = 4 | 546 | ModuleCalculateCenter = 4 |
547 | + ModuleChartTemplate = 8 | ||
547 | ) | 548 | ) |
@@ -10,6 +10,7 @@ func (et EventType) ToString() string { | @@ -10,6 +10,7 @@ func (et EventType) ToString() string { | ||
10 | 10 | ||
11 | const ( | 11 | const ( |
12 | TableDataEditEvent EventType = "table.data.edit" | 12 | TableDataEditEvent EventType = "table.data.edit" |
13 | + TableStructEditEvent EventType = "table.struct.edit" | ||
13 | TableDataImportEvent EventType = "table.data.import" | 14 | TableDataImportEvent EventType = "table.data.import" |
14 | TableDeleteEvent EventType = "table.delete" | 15 | TableDeleteEvent EventType = "table.delete" |
15 | QuerySetUpdateEvent EventType = "table.query.set.update" | 16 | QuerySetUpdateEvent EventType = "table.query.set.update" |
1 | package domain | 1 | package domain |
2 | 2 | ||
3 | type TableInfo struct { | 3 | type TableInfo struct { |
4 | - // 应用于模块 1:数控中心 2:拆解模块 4:计算模块 | 4 | + // 应用于模块 1:数控中心 2:拆解模块 4:计算模块 8:图表模板 |
5 | ApplyOnModule int `json:"module"` | 5 | ApplyOnModule int `json:"module"` |
6 | // 依赖关联的表 | 6 | // 依赖关联的表 |
7 | DependencyTables []int `json:"dependencyTables"` | 7 | DependencyTables []int `json:"dependencyTables"` |
@@ -1039,7 +1039,7 @@ func copyQuerySet(qs *domain.QuerySet, t string, groupId int, name string) *doma | @@ -1039,7 +1039,7 @@ func copyQuerySet(qs *domain.QuerySet, t string, groupId int, name string) *doma | ||
1039 | Name: name, | 1039 | Name: name, |
1040 | PinName: pinFull(name), | 1040 | PinName: pinFull(name), |
1041 | ParentId: groupId, | 1041 | ParentId: groupId, |
1042 | - Status: qs.Status, | 1042 | + Status: domain.StatusOff, |
1043 | QuerySetInfo: qs.QuerySetInfo, | 1043 | QuerySetInfo: qs.QuerySetInfo, |
1044 | QueryComponents: qs.QueryComponents, | 1044 | QueryComponents: qs.QueryComponents, |
1045 | Sort: 0, | 1045 | Sort: 0, |
@@ -419,7 +419,7 @@ func (d *DataLayoutDataTable) BlockData(cells *domain.LayoutCell) ([]string, int | @@ -419,7 +419,7 @@ func (d *DataLayoutDataTable) BlockData(cells *domain.LayoutCell) ([]string, int | ||
419 | return values, len(values) | 419 | return values, len(values) |
420 | } | 420 | } |
421 | 421 | ||
422 | -func (d *DataLayoutDataTable) Shrink() { | 422 | +func (d *DataLayoutDataTable) Shrink() error { |
423 | x := d.PointEnd.X - d.PointBegin.X | 423 | x := d.PointEnd.X - d.PointBegin.X |
424 | y := d.PointEnd.Y - d.PointBegin.Y | 424 | y := d.PointEnd.Y - d.PointBegin.Y |
425 | data := make([][]string, x+1) | 425 | data := make([][]string, x+1) |
@@ -435,14 +435,34 @@ func (d *DataLayoutDataTable) Shrink() { | @@ -435,14 +435,34 @@ func (d *DataLayoutDataTable) Shrink() { | ||
435 | } | 435 | } |
436 | iData++ | 436 | iData++ |
437 | } | 437 | } |
438 | - d.DataTable.Data = data | ||
439 | - for i := 0; i <= y; i++ { | ||
440 | - d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{ | ||
441 | - Name: fmt.Sprintf("列%d", i), | ||
442 | - SQLName: fmt.Sprintf("col%d", i), | ||
443 | - SQLType: domain.String.ToString(), | ||
444 | - }) | 438 | + //d.DataTable.Data = data |
439 | + //for i := 0; i <= y; i++ { | ||
440 | + // d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{ | ||
441 | + // Name: fmt.Sprintf("列%d", i), | ||
442 | + // SQLName: fmt.Sprintf("col%d", i), | ||
443 | + // SQLType: domain.String.ToString(), | ||
444 | + // }) | ||
445 | + //} | ||
446 | + // 默认计算集第一行作为标题 | ||
447 | + if len(data) > 1 { | ||
448 | + d.DataTable.Data = data[1:] | ||
449 | + columnMap := collection.NewSet() | ||
450 | + for i := 0; i < len(data[0]); i++ { | ||
451 | + if len(data[0][i]) == 0 { | ||
452 | + return fmt.Errorf("计算集标题不能为空") | ||
453 | + } | ||
454 | + if columnMap.Contains(data[0][i]) { | ||
455 | + return fmt.Errorf("计算集列重复:%v", data[0][i]) | ||
456 | + } | ||
457 | + columnMap.Add(data[0][i]) | ||
458 | + d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{ | ||
459 | + Name: data[0][i], | ||
460 | + SQLName: fmt.Sprintf("col%d", i), | ||
461 | + SQLType: domain.String.ToString(), | ||
462 | + }) | ||
463 | + } | ||
445 | } | 464 | } |
465 | + return nil | ||
446 | } | 466 | } |
447 | 467 | ||
448 | func (d *DataLayoutDataTable) Expand(cell *domain.LayoutCell, length int) error { | 468 | func (d *DataLayoutDataTable) Expand(cell *domain.LayoutCell, length int) error { |
@@ -66,7 +66,7 @@ func (ptr *UpdateTableStructService) UpdateTableStruct(ctx *domain.Context, tabl | @@ -66,7 +66,7 @@ func (ptr *UpdateTableStructService) UpdateTableStruct(ctx *domain.Context, tabl | ||
66 | } | 66 | } |
67 | } | 67 | } |
68 | defer func() { | 68 | defer func() { |
69 | - AsyncEvent(domain.NewEventTable(ctx, domain.TableDataEditEvent).WithTable(table)) | 69 | + AsyncEvent(domain.NewEventTable(ctx, domain.TableStructEditEvent).WithTable(table)) |
70 | }() | 70 | }() |
71 | // 日志 | 71 | // 日志 |
72 | if err = FastLog(ptr.transactionContext, domain.CommonLog, table.TableId, &SubTableEditLog{ | 72 | if err = FastLog(ptr.transactionContext, domain.CommonLog, table.TableId, &SubTableEditLog{ |
@@ -156,6 +156,10 @@ func (controller *TableController) TableObjectSearch() { | @@ -156,6 +156,10 @@ func (controller *TableController) TableObjectSearch() { | ||
156 | tableService := service.NewTableService(nil) | 156 | tableService := service.NewTableService(nil) |
157 | cmd := &query.SearchTableQuery{} | 157 | cmd := &query.SearchTableQuery{} |
158 | Must(controller.Unmarshal(cmd)) | 158 | Must(controller.Unmarshal(cmd)) |
159 | + defaultReturnGroup := true | ||
160 | + if cmd.ReturnGroupItem == nil { | ||
161 | + cmd.ReturnGroupItem = &defaultReturnGroup | ||
162 | + } | ||
159 | cmd.Context = ParseContext(controller.BaseController) | 163 | cmd.Context = ParseContext(controller.BaseController) |
160 | data, err := tableService.TableObjectSearch(cmd) | 164 | data, err := tableService.TableObjectSearch(cmd) |
161 | controller.Response(data, err) | 165 | controller.Response(data, err) |
@@ -11,6 +11,7 @@ func Start() { | @@ -11,6 +11,7 @@ func Start() { | ||
11 | 11 | ||
12 | func RegisterEvent() { | 12 | func RegisterEvent() { |
13 | event.On(domain.TableDataEditEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High) | 13 | event.On(domain.TableDataEditEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High) |
14 | + event.On(domain.TableStructEditEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High) | ||
14 | event.On(domain.TableDataImportEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High) | 15 | event.On(domain.TableDataImportEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High) |
15 | event.On(domain.TableDeleteEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High) | 16 | event.On(domain.TableDeleteEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High) |
16 | event.On(domain.QuerySetUpdateEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High) | 17 | event.On(domain.QuerySetUpdateEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High) |
-
请 注册 或 登录 后发表评论