...
|
...
|
@@ -28,8 +28,8 @@ func (ptr *QuerySetService) LoadCalculateSetData(ctx *domain.Context, qs *domain |
|
|
// 加载Tables数据
|
|
|
q := queryComponents[0]
|
|
|
cells := q.Layout.LayoutCells()
|
|
|
if len(cells)==0{
|
|
|
return res,nil
|
|
|
if len(cells) == 0 {
|
|
|
return res, nil
|
|
|
}
|
|
|
dataTables, err = ptr.LoadDataTables(ctx, cells)
|
|
|
if err != nil {
|
...
|
...
|
@@ -107,7 +107,7 @@ func CellsLocationAdjust(cells []*domain.LayoutCell) { |
|
|
}
|
|
|
//move = cell.Length
|
|
|
//c = cell
|
|
|
if max(move, cell.Length) != move && c==nil {
|
|
|
if max(move, cell.Length) != move && c == nil {
|
|
|
c = cell
|
|
|
}
|
|
|
move = max(move, cell.Length)
|
...
|
...
|
@@ -118,9 +118,9 @@ func CellsLocationAdjust(cells []*domain.LayoutCell) { |
|
|
}
|
|
|
|
|
|
func CellsLocationAdjustV1(cells []*domain.LayoutCell) {
|
|
|
yList:=cellsRange(cells,"y")
|
|
|
xList:=cellsRange(cells,"x")
|
|
|
for i := 0; i <len(yList); i++ {
|
|
|
yList := cellsRange(cells, "y")
|
|
|
xList := cellsRange(cells, "x")
|
|
|
for i := 0; i < len(yList); i++ {
|
|
|
j := yList[i]
|
|
|
move := 0
|
|
|
var c *domain.LayoutCell
|
...
|
...
|
@@ -138,7 +138,7 @@ func CellsLocationAdjustV1(cells []*domain.LayoutCell) { |
|
|
}
|
|
|
ChangeLocation(cells, domain.DirectionRight, j, move, c)
|
|
|
}
|
|
|
for j := 0; j <len(xList); j++ {
|
|
|
for j := 0; j < len(xList); j++ {
|
|
|
i := xList[j]
|
|
|
move := 0
|
|
|
var c *domain.LayoutCell
|
...
|
...
|
@@ -149,7 +149,7 @@ func CellsLocationAdjustV1(cells []*domain.LayoutCell) { |
|
|
if cell.Direction != domain.DirectionDown {
|
|
|
continue
|
|
|
}
|
|
|
if max(move, cell.Length) != move && c==nil {
|
|
|
if max(move, cell.Length) != move && c == nil {
|
|
|
c = cell
|
|
|
}
|
|
|
move = max(move, cell.Length)
|
...
|
...
|
@@ -158,16 +158,16 @@ func CellsLocationAdjustV1(cells []*domain.LayoutCell) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
func cellsRange(cells []*domain.LayoutCell,direction string)[]int{
|
|
|
list:=collection.NewSet()
|
|
|
for i:=range cells{
|
|
|
if strings.ToLower(direction)=="x"{
|
|
|
func cellsRange(cells []*domain.LayoutCell, direction string) []int {
|
|
|
list := collection.NewSet()
|
|
|
for i := range cells {
|
|
|
if strings.ToLower(direction) == "x" {
|
|
|
list.Add(cells[i].X)
|
|
|
}else{
|
|
|
} else {
|
|
|
list.Add(cells[i].Y)
|
|
|
}
|
|
|
}
|
|
|
sortList :=list.KeysInt()
|
|
|
sortList := list.KeysInt()
|
|
|
sort.Ints(sortList)
|
|
|
return sortList
|
|
|
}
|
...
|
...
|
@@ -200,7 +200,7 @@ func FastTable(table *domain.Table) (*domain.DataTable, error) { |
|
|
Select: table.Fields(false),
|
|
|
}
|
|
|
options.SetDefaultOrder()
|
|
|
options.SetOffsetLimit(1,10000)
|
|
|
options.SetOffsetLimit(1, 10000)
|
|
|
var dataTable *domain.DataTable
|
|
|
dataTable, err = FastDataTable(options)
|
|
|
if err != nil {
|
...
|
...
|
@@ -260,7 +260,7 @@ func (ptr *QuerySetService) LoadDataTables(ctx *domain.Context, cells []*domain. |
|
|
|
|
|
func DataLayout(res *domain.DataTable, cells []*domain.LayoutCell) (*domain.DataTable, error) {
|
|
|
dt := &DataLayoutDataTable{
|
|
|
DataTable: res,
|
|
|
DataTable: res,
|
|
|
unprocessed: cells,
|
|
|
}
|
|
|
dt.Init(DefaultExpandNum)
|
...
|
...
|
@@ -349,7 +349,6 @@ func (d *DataLayoutDataTable) addByLocation(cell *domain.LayoutCell, blockData [ |
|
|
}
|
|
|
|
|
|
func (d *DataLayoutDataTable) changeUnProcessedLocation(lastCell *domain.LayoutCell, length int) {
|
|
|
// log.Logger.Info("修改定位点")
|
|
|
for _, cell := range d.unprocessed {
|
|
|
switch lastCell.Direction {
|
|
|
case domain.DirectionRight:
|
...
|
...
|
@@ -361,7 +360,6 @@ func (d *DataLayoutDataTable) changeUnProcessedLocation(lastCell *domain.LayoutC |
|
|
cell.X += length - 1
|
|
|
}
|
|
|
}
|
|
|
// log.Logger.Info(fmt.Sprintf("%s %s X:%d Y:%d", cell.Data.Field.SQLName, cell.Direction, cell.X, cell.Y))
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|