修复筛选条件问题
This commit is contained in:
parent
2125e8fb0c
commit
2757932e48
@ -29,8 +29,11 @@ import (
|
||||
type RtaskTestView struct {
|
||||
BaseformView
|
||||
itemList *common.ItemList
|
||||
result chan int
|
||||
resultCount int //结果条数
|
||||
resultChan chan string //结果内容
|
||||
flag bool
|
||||
msgs []string
|
||||
reportPath string //Json Data数据路径
|
||||
}
|
||||
|
||||
func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
@ -38,7 +41,7 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
this.itemList = common.NewItemList()
|
||||
this.itemList.ItemList = this.itemList.CreateDefaultCheckList()
|
||||
|
||||
this.result = make(chan int)
|
||||
this.resultChan = make(chan string)
|
||||
|
||||
rtaskTypeInput := widget.NewEntry()
|
||||
|
||||
@ -82,7 +85,7 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
jsonPathEntry := widget.NewEntry()
|
||||
jsonPathEntry.SetText("F:\\projects\\workspace\\go_dreamfactory\\bin\\json")
|
||||
reportEntry := widget.NewEntry()
|
||||
reportEntry.SetText("F:\\result.txt")
|
||||
reportEntry.SetText("F:\\")
|
||||
|
||||
autoTestForm := widget.NewForm(
|
||||
widget.NewFormItem("Json配置", jsonPathEntry),
|
||||
@ -93,11 +96,14 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
commCfg := &common.Config{
|
||||
Path: jsonPathEntry.Text,
|
||||
}
|
||||
|
||||
this.reportPath = reportEntry.Text
|
||||
var wg sync.WaitGroup
|
||||
var msgs []string
|
||||
|
||||
if tb, err := cfg.NewTables(commCfg.Loader); err == nil {
|
||||
for _, v := range tb.RdtaskCondi.GetDataList() {
|
||||
wg.Add(1)
|
||||
this.resultCount++
|
||||
params := []int32{v.Data1, v.Data2, v.Data3, v.Data4, v.Data5}
|
||||
var p []int32
|
||||
for _, v := range params {
|
||||
@ -119,20 +125,31 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
return
|
||||
}
|
||||
// logrus.Debugf("执行任务 id:%v rtype:%v params:%v", condId, rtype, p)
|
||||
msgs = append(msgs, fmt.Sprintf("condId:%v rtype:%v params:%v", condId, rtype, p))
|
||||
// msgs = append(msgs, fmt.Sprintf("condId:%v rtype:%v params:%v", condId, rtype, p))
|
||||
}(v.Id, v.Type, p)
|
||||
wg.Wait()
|
||||
// time.Sleep(time.Millisecond * 100)
|
||||
}
|
||||
}
|
||||
|
||||
record := strings.Join(msgs, "\n")
|
||||
go func() {
|
||||
for msg := range this.resultChan {
|
||||
this.msgs = append(this.msgs, msg)
|
||||
}
|
||||
|
||||
}()
|
||||
|
||||
go func() {
|
||||
if this.resultCount == 0 {
|
||||
logrus.Debug("结束")
|
||||
|
||||
record := strings.Join(this.msgs, "\n")
|
||||
var buf bytes.Buffer
|
||||
buf.WriteString(fmt.Sprintf("---任务参数测试报告---\n"))
|
||||
buf.WriteString(record)
|
||||
buf.WriteString("\n-------")
|
||||
|
||||
file, err := os.OpenFile(filepath.Join(reportEntry.Text, "report.log"), os.O_TRUNC|os.O_CREATE, os.ModePerm)
|
||||
file, err := os.OpenFile(filepath.Join(this.reportPath, "report.txt"), os.O_TRUNC|os.O_CREATE, os.ModePerm)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
@ -142,6 +159,8 @@ func (this *RtaskTestView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
logrus.Error(err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
autoTestBtn := widget.NewButton("自动触发配置", func() {
|
||||
paiWin := dialog.NewCustom("自动触发配置", "关闭", autoTestForm, this.w)
|
||||
@ -203,7 +222,10 @@ func (this *RtaskTestView) rtestListener() {
|
||||
}
|
||||
|
||||
// if !rsp.Flag {
|
||||
logrus.Debug(fmt.Sprintf("%v - %v", rsp.RtaskType, rsp.Flag))
|
||||
msg := fmt.Sprintf("%v - %v", rsp.RtaskType, rsp.Flag)
|
||||
|
||||
this.resultChan <- msg
|
||||
this.resultCount--
|
||||
// }
|
||||
}
|
||||
},
|
||||
|
@ -93,38 +93,48 @@ func hasUpdateData(len int, data *pb.RtaskData, vals ...int32) map[int32]int32 {
|
||||
case 2:
|
||||
if vals[0] > data.Data[0] {
|
||||
res[0] = vals[0]
|
||||
} else if vals[1] > data.Data[1] {
|
||||
}
|
||||
if vals[1] >= data.Data[1] {
|
||||
res[1] = vals[1]
|
||||
}
|
||||
|
||||
case 3:
|
||||
if vals[0] > data.Data[0] {
|
||||
res[0] = vals[0]
|
||||
} else if vals[1] > data.Data[1] {
|
||||
}
|
||||
if vals[1] > data.Data[1] {
|
||||
res[1] = vals[1]
|
||||
} else if vals[2] > data.Data[2] {
|
||||
}
|
||||
if vals[2] > data.Data[2] {
|
||||
res[2] = vals[2]
|
||||
}
|
||||
case 4:
|
||||
if vals[0] > data.Data[0] {
|
||||
res[0] = vals[0]
|
||||
} else if vals[1] > data.Data[1] {
|
||||
}
|
||||
if vals[1] > data.Data[1] {
|
||||
res[1] = vals[1]
|
||||
} else if vals[2] > data.Data[2] {
|
||||
}
|
||||
if vals[2] > data.Data[2] {
|
||||
res[2] = vals[2]
|
||||
} else if vals[3] > data.Data[3] {
|
||||
}
|
||||
if vals[3] > data.Data[3] {
|
||||
res[3] = vals[3]
|
||||
}
|
||||
case 5:
|
||||
if vals[0] > data.Data[0] {
|
||||
res[0] = vals[0]
|
||||
} else if vals[1] > data.Data[1] {
|
||||
}
|
||||
if vals[1] > data.Data[1] {
|
||||
res[1] = vals[1]
|
||||
} else if vals[2] > data.Data[2] {
|
||||
}
|
||||
if vals[2] > data.Data[2] {
|
||||
res[2] = vals[2]
|
||||
} else if vals[3] > data.Data[3] {
|
||||
}
|
||||
if vals[3] > data.Data[3] {
|
||||
res[3] = vals[3]
|
||||
} else if vals[4] > data.Data[4] {
|
||||
}
|
||||
if vals[4] > data.Data[4] {
|
||||
res[4] = vals[4]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user