以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  InsertHTML 循环 求助  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=116397)

--  作者:yifan3429
--  发布时间:2018/3/23 19:51:00
--  InsertHTML 循环 求助

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI \'定义一个基于weui框架的网页生成器
Select Case e.Path
    Case "lsrz1.htm"
        Dim bm As String
        Dim gw As String
        Dim name As String
        Dim userid = Functions.Execute("验证函数",e,"lsrz1.htm")
        If userid > "" Then
            wb.AppendCookie("userid",userid) \'将用户名和密码写入cookie
            Dim wxdr As DataRow =  DataTables("users").SQLFind("userid=\'" & userid & "\'")
            If wxdr IsNot Nothing Then
                gw =  wxdr("position")
                name = wxdr("name")
                Dim wxdr1 As DataRow = DataTables("departments").SQLFind("id=\'" & wxdr("department") & "\'")
                If wxdr1 IsNot Nothing Then
                    bm= wxdr1("name")
                End If



 wb.InsertHTML("page2", "<div onclick=""if(pg1.style.display != \'none\') {pg1.style.display = \'none\'} else {pg1.style.display = \'block\'}""><label style=\'line-height:3\'>木作事业部</label></div>")
wb.AddPage("page2","pg1")
For Each dr As DataRow In DataTables("工作日报").sqlSelect("[部门] = \'木作事业部\'", "", "日期 Desc")
    With wb.AddPreview("pg1","pv" & dr("_Identify"),"职员",dr("姓名")&":"&dr("岗位"))
        .AddItem("日期",dr("日期"))
        .AddItem("今日达成",dr("今日达成"))
        .AddItem("明日计划",dr("明日计划"))
        .AddItem("营业收入",dr("营业收入"))
    End With
Next

有 很多部门 需要一次性读取出来

for each dr as datarow in datatables("工作日报")

    next
[此贴子已经被作者于2018/3/23 19:52:19编辑过]

--  作者:有点蓝
--  发布时间:2018/3/23 20:37:00
--  
Dim idx As Integer = 10
For Each bm As String In DataTables("工作日报").GetValues("部门")
    wb.InsertHTML("page2", "<div "><label style=\'line-height:3\'>木作事业部</label></div>")
    wb.AddPage("page2" ,"pg" & idx)
    For Each dr As DataRow In DataTables("工作日报").sqlSelect("[部门] = \'" & bm & "\'", "", "日期 Desc")
        With wb.AddPreview("pg" & idx,"pv" & dr("_Identify"),"职员",dr("姓名") & ":" &dr("岗位"))
            .AddItem("日期",dr("日期"))
            .AddItem("今日达成",dr("今日达成"))
            .AddItem("明日计划",dr("明日计划"))
            .AddItem("营业收入",dr("营业收入"))
        End With
    Next
    idx += 1
Next

--  作者:yifan3429
--  发布时间:2018/3/24 1:00:00
--  
Dim idx As Integer = 10
For Each bm As String In DataTables("工作日报").GetValues("部门")
    wb.InsertHTML("page2", "<div "><label style=\'line-height:3\'>木作事业部</label></div>")  这里还是不能自动根据部门生成标签呀   标签需要自动生成    我想一个标签下自动放入对应的部门  
    wb.AddPage("page2" ,"pg" & idx)
    For Each dr As DataRow In DataTables("工作日报").sqlSelect("[部门] = \'" & bm & "\'", "", "日期 Desc")
        With wb.AddPreview("pg" & idx,"pv" & dr("_Identify"),"职员",dr("姓名") & ":" &dr("岗位"))
            .AddItem("日期",dr("日期"))
            .AddItem("今日达成",dr("今日达成"))
            .AddItem("明日计划",dr("明日计划"))
            .AddItem("营业收入",dr("营业收入"))
        End With
    Next
    idx += 1
Next




--  作者:有点蓝
--  发布时间:2018/3/24 8:42:00
--  
图片点击可在新窗口打开查看

wb.InsertHTML("page" & idx, "<div "><label style=\'line-height:3\'>" & bm & "</label></div>")
wb.AddPage("page" & idx ,"pg" & idx)

--  作者:yifan3429
--  发布时间:2018/3/25 18:39:00
--  
---------------------------
错误
---------------------------
编译错误:应为表达式。



错误代码:wb.InsertHTML("page2", "<div "><label style=\'line-height:3\'>" & bm1 & "</label></div>")
---------------------------
确定   
---------------------------
Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI \'定义一个基于weui框架的网页生成器
Select Case e.Path
    Case "lsrz1.htm"
        Dim bm As String
        Dim gw As String
        Dim name As String
        Dim userid = Functions.Execute("验证函数",e,"lsrz1.htm")
        If userid > "" Then
            wb.AppendCookie("userid",userid) \'将用户名和密码写入cookie
            Dim wxdr As DataRow =  DataTables("users").SQLFind("userid=\'" & userid & "\'")
            If wxdr IsNot Nothing Then
                gw =  wxdr("position")
                name = wxdr("name")
                Dim wxdr1 As DataRow = DataTables("departments").SQLFind("id=\'" & wxdr("department") & "\'")
                If wxdr1 IsNot Nothing Then
                    bm= wxdr1("name")
                End If
                
                \'e.WriteString(name & userid & "USERID获取成功" & gw & bm)
                \'------------------------------------------------------------------------------------------------------------------------------
                With wb.AddTabBar("", "tb1", 1)
                    .AddPage("page1","高管日志","./images/tb/1 (1).png")
                    .AddPage("page2","部门日志","./images/tb/1 (2).png")
                    .AddPage("page3","渠道日志","./images/tb/1 (3).png")
                    .AddPage("page4","今日报备","./images/tb/1 (4).png")
                End With
                
                Dim idx As Integer = 10
                For Each bm1 As String In DataTables("工作日报").GetValues("部门")
                wb.InsertHTML("page2", "<div "><label style=\'line-height:3\'>" & bm1 & "</label></div>") 
                wb.AddPage("page2" ,"pg" & idx)
                For Each dr As DataRow In DataTables("工作日报").sqlSelect("[部门] = \'" & bm1 & "\'", "", "日期 Desc")
                    With wb.AddPreview("pg" & idx,"pv" & dr("_Identify"),"职员",dr("姓名") & ":" &dr("岗位"))
                        .AddItem("日期",dr("日期"))
                        .AddItem("今日达成",dr("今日达成"))
                        .AddItem("明日计划",dr("明日计划"))
                        .AddItem("营业收入",dr("营业收入"))
                    End With
                Next
                idx += 1
            Next
            
            
            wb.AppendHTML("<script>"pg" & idx.style.display = \'none\';</script>")
            \'wb.AppendHTML("<script>pg2.style.display = \'none\';</script>")
            \'wb.AppendHTML("<script>pg3.style.display = \'none\';</script>")
            \'wb.AppendHTML("<script>pg4.style.display = \'none\';</script>")
            e.WriteString(wb.Build)
            \'-----------------------------------------------------------------------------------
        End If
    End If
End Select

--  作者:有点甜
--  发布时间:2018/3/25 21:15:00
--  

 

wb.InsertHTML("page" & bm1, "<div><label style=\'line-height:3\'>" & bm1 & "</label></div>")