Foxtable(狐表)用户栏目专家坐堂 → 怎样重复调用相同的一段代码


  共有324人关注过本帖树形打印复制链接

主题:怎样重复调用相同的一段代码

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106430 积分:541297 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/3/21 11:14:00 [显示全部帖子]

上面截图里单元格存储的是json字符串,不是代码。

把代码放到函数里就可以重复调用了:http://www.foxtable.com/webhelp/topics/1486.htm

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106430 积分:541297 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/3/21 14:50:00 [显示全部帖子]

Dim e As RequestEventArgs = args(0)
Dim wb As New weui = args(1)
Dim drs As List(Of DataRow) = args(2)
With ExWeUI.WebUI.AddListGroup("page1", "lst01", 1)
    Dim color1 As String = "style='background-color:#f69797'" '暗红色,未检疫
    Dim color2 As String = "style='background-color:#d9a738'" '淡黄色,正在检疫
    Dim color3 As String = "style='background-color:#198d65'" '淡绿色,已检疫
    Dim color As String
    For Each dr As DataRow In drs
        If dr("是否离轮") = True Or dr("电讯检疫") = True Then '已检疫
            color = color3
        ElseIf dr("卫检登轮") = True And dr("是否离轮") <> True Then '检疫中
            color = color2
        ElseIf dr("卫检登轮") <> True Then 
            color = color1 
        End If 
        Dim txt As String = "<p " & color & ">中文船名:" & dr("中文船名") & "<br/>"
        txt = txt & "入境时间:" & dr("入境时间") & "<br/>"
        txt = txt & "船&emsp;&emsp;籍:" & dr("船籍") & "<br/>"
        txt = txt & "IMO号:" & dr("IMO号") & "</p>"
        
        Dim s As String = dr("船舶资料")
        If s.length > 10 Then
            txt = txt & "<p>船舶资料:" & s.substring(0, 10) & "......" & "</p>"
        Else
            txt = txt & "<p>船舶资料:" & dr("船舶资料") & "</p>"
        End If
        With .AddList(dr("中文船名") & "(" & dr("检查类别") & ")", "")
            .TextStyle = "color:red;font-size:20px" '字体颜色,字体大小
            .ImageWidth = 2 '图片大小
            With .LeftFooter
                .AddFoot(txt).Attribute = "style='color:white;background-color:#f69797';font-size:17px'"
                If e.Cookies("用户类别") = "企业" Then
                    .AddFoot("详细信息").Attribute = " & dr("_Identify") & "'"" style='color:blue;font-size:20px'"
                Else
                    .AddFoot("详细信息").Attribute = " & dr("_Identify") & "'"" style='color:blue;font-size:20px'"
                End If 
            End With
            With .rightFooter
                If e.Cookies("用户类别") = "企业" And dr("检查类别") = "进检" Then
                    '                         .AddFoot("申报出检").Attribute = " & dr("_Identify") & "'"" style='color:green;font-size:20px'"
                    .AddFoot("申报出检").Attribute = " & dr("_Identify") & "'"" style='color:green;font-size:20px'"
                ElseIf e.Cookies("用户类别") <> "企业" Then
                    
                    .AddFoot("拨打电话").Attribute = " & dr("手机号") & "'"" style='color:green;font-size:20px'"
                End If 
            End With
        End With
    Next
    p1Div1.InnerHtml = p1Div.InnerHtml & ExWeUI.WebUI.AddHtmlTag("", "p1", "div",.BuildHtml, "class=""exui-scrollview""").buildhtml
End With
wb.InsertHTML("<div style='height:50px'></div>")
wb.InsertHTML("page1", p1Div1.buildhtml)
wb.InsertHTML("</div>")

wb.InsertHTML("<div style='height:50px'></div>")
wb.AddPage("", "page3").Attribute = "style='position: fixed;bottom: 0;right: 0;left: 0'" '增加两个page
With wb.AddButtonGroup("page3", "btg1", False)
    .Add("btn1", "返回首页", "", "default.htm")
    If page > 0 Then
        .Add("btnPrev", "上一页", "", "renamecx.htm?page=" & page - 1)
    End If
    If Endrow < count Then
        .Add("btnNext", "下一页", "", "renamecx.htm?page=" & page + 1)
    End If
    .Add("btn2", "清除查询", "button", "Renamecx.htm")
End With

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106430 积分:541297 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/3/21 16:41:00 [显示全部帖子]

Functions.Execute("xxx",e,wb,drs)

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106430 积分:541297 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/3/22 9:05:00 [显示全部帖子]

因为里面的代码用到

 回到顶部