/*初始化主窗口*/ func StartMF() { // var mainFrame *walk.MainWindow mw := new(TaxMainWindow) // 空集合 var taxs []*modelp.TaxRecordRef // 如果库里有数据会优先展示库里的数据 taxs = defaDisplayData() model = NewTaxRecModel(taxs) // 筛选参数绑定对象 var binder *walk.DataBinder param := new(StatFilter) // 主菜单 // var mainMenu *walk.Menu if _, err := (MainWindow{ AssignTo: &mw.MainWindow, Title: TITLE, MinSize: Size{800, 600}, // 最小大小 Layout: VBox{}, DataBinder: DataBinder{ AssignTo: &binder, DataSource: param, }, Children: []Widget{ // 表格部分 TableView{ Columns: []TableViewColumn{ {Title: "序号"}, {Title: "纳税人名称"}, {Title: "纳税人识别号"}, {Title: "行业"}, {Title: "经营范围"}, {Title: "法定代表人"}, {Title: "开业日期", Format: "2006-01-02"}, {Title: "生产经营地址"}, {Title: "注册资本", Format: "%.2f", Alignment: AlignFar}, {Title: "主管税务机关"}, {Title: "是否出口企业"}, {Title: "第一年应税收入", Format: "%.2f", Alignment: AlignFar}, {Title: "第一年出口收入", Format: "%.2f", Alignment: AlignFar}, {Title: "第一年增值税", Format: "%.2f", Alignment: AlignFar}, {Title: "第一年所得税", Format: "%.2f", Alignment: AlignFar}, {Title: "第一年税额合计", Format: "%.2f", Alignment: AlignFar}, {Title: "第二年应税收入", Format: "%.2f", Alignment: AlignFar}, {Title: "第二年出口收入", Format: "%.2f", Alignment: AlignFar}, {Title: "第二年增值税", Format: "%.2f", Alignment: AlignFar}, {Title: "第二年所得税", Format: "%.2f", Alignment: AlignFar}, {Title: "第二年税额合计", Format: "%.2f", Alignment: AlignFar}, {Title: "第三年应税收入", Format: "%.2f", Alignment: AlignFar}, {Title: "第三年出口收入", Format: "%.2f", Alignment: AlignFar}, {Title: "第三年增值税", Format: "%.2f", Alignment: AlignFar}, {Title: "第三年所得税", Format: "%.2f", Alignment: AlignFar}, {Title: "第三年税额合计", Format: "%.2f", Alignment: AlignFar}, {Title: "三年缴纳税款总计", Format: "%.2f", Alignment: AlignFar}, {Title: "稽查时间", Format: "2006-01-02"}, {Title: "稽查年度"}, {Title: "是否重点税源"}, }, Model: model, }, GroupBox{ Title: "筛选数据", Layout: VBox{}, Children: []Widget{ Composite{ Layout: HBox{}, Children: []Widget{ Label{ Text: "行业:", }, ComboBox{ AssignTo: &indusComb, Value: Bind("OrgIndus"), BindingMember: "Val", DisplayMember: "Name", Model: modelp.ShowTestIndus(), }, Label{ Text: "经营范围:", }, LineEdit{ Text: Bind("OrgBusScope"), }, }, }, Composite{ Layout: HBox{}, Children: []Widget{ Label{ Text: "税收收入大于:", }, NumberEdit{ Value: Bind("StatTaxSumStart", Range{0.00, 99999999999999999.99}), Prefix: "¥ ", Decimals: 2, }, Label{ Text: "税收收入小于:", }, NumberEdit{ Value: Bind("StatTaxSumEnd", Range{0.00, 99999999999999999.99}), Prefix: "¥ ", Decimals: 2, }, }, }, Composite{ Layout: HBox{}, Children: []Widget{ CheckBox{ Checked: Bind("IsImportant"), }, Label{ Text: "是否是重点税源企业", }, CheckBox{ Checked: Bind("OrgIsExport"), }, Label{ Text: "是否是出口企业", }, PushButton{ Text: "抽查数据", OnClicked: func() { // 提交数据到绑定器 if err := binder.Submit(); err != nil { log.Print(err) return } // 执行查询并更新列表 fmt.Println("Params:", param) model.RestRows(queryData(param)) }, }, PushButton{ Text: "导入数据", OnClicked: func() { mw.openFileAction() }, }, PushButton{ Text: "刷新数据", OnClicked: func() { // 刷新行业列表 getCombs() // 清空参数 err := binder.Reset() if err != nil { fmt.Println(err) } // 刷新数据 model.RestRows(defaDisplayData()) }, }, PushButton{ Text: "清空数据", OnClicked: func() { // 清空数据然后查询展示空列表 truncateData(vatTable) model.RestRows(defaDisplayData()) walk.MsgBox(mw, "成功", "清空成功", walk.MsgBoxIconInformation) }, }, }, }, }, }, }, // 这里直接Run,否则碰到了莫名奇妙的二次才能响应的问题 }.Run()); err != nil { fmt.Println(err) } // mw.MainWindow.Run() }
// 刷新行业数据 func getCombs() { indusComb.SetModel(modelp.ShowTestIndus()) }