1
Jianw
9 天以前 70f29da38121b9a467841253e3268feb5df02902
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
--[[
    编码: JX-800-03
    名称: 出库任务列表
    作者:HAN  
    日期:2025-1-29
    级别: 固定 (说明本段代码在项目中不太会变化)
    
    函数: GenerateViewHTML
 
    功能:
        统计作业各种状态的数量(测试一下用)
 
    更改记录:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function GetHtmlStyle()
    return '<style>' .. '.table3 {' .. '    border: 2px solid #fff;' .. '    width: 100%;' .. '    height: 100%;' ..
               '}' .. '.table-head {' .. '    border-bottom: 2px solid #fff;    color: #fff;' .. '}' .. '.table-head>div {' ..
               '    text-align: center;' .. '    display: inline-block;' .. '    padding: 5px 0px;' ..
               '    font-size: 17px;' .. '    font-weight: 600;' .. '}' .. '.table-head .table-col1 {' ..
               '    width: 34%;' .. '    border-right: 2px solid;' .. '}' .. '.table-head .table-col2 {' ..
               '    width: 32%;' .. '    border-right: 2px solid;' .. '}' .. '.table-head .table-col3 {' ..
               '    width: 31%;' .. '}' .. '.table-body .table-row-data{    margin-top: 10px;} .table-body .table-row-data>div {' .. '    text-align: center;' ..
               '    display: inline-block;' .. '    padding: 5px 0px;' .. '    color: #fff;' .. '}' ..
 
               '.table-row-data .table-col1 {' .. '    width: 34%;' .. '}' .. '.table-row-data .table-col1>div {' ..
               '    border-radius: 50px;' .. '    width: 92%;' .. '    display: inline-block;' .. '    padding: 5px 1px;' ..
               '    font-size: 12px;' .. '}' .. '.table-row-data .table-col2 {' .. '    width: 32%;' .. '}' ..
 
               '.table-row-data .table-col3 {' .. '    width: 31%;' .. '}' .. '</style>'
end
 
 
function GenerateViewHTML(strLuaDEID)
    local nRet, strRetInfo
    local strHtmlTitle = "";
    local strHtmlRow = "";
    --[[ 获取样式 ]]
    local strHtmlStyle = GetHtmlStyle();
    --[[    列明 ]]
    local tabTitleList = {"作业编码", "起点", "终点"}
 
    --[[ 组织列名 ]]
    --[[ class 处理样式 这里 组成(table-col' .. i .. ') table-col1,table-col2,table-col3 ]]
    for i = 1, #tabTitleList do
        strHtmlTitle = strHtmlTitle .. '<div class="table-col' .. i .. '">' .. tabTitleList[i] .. '</div>'
    end
    --[[ 数据 ]]
    local tabDataList = {
        {
            code = "OP2402-0120",
            qd = "K2-122-131",
            zd = "K2-122-135",
            back = "#2196F3"
        }, 
        {
            code = "OP2402-0112",
            qd = "K2-122-132",
            zd = "K2-122-136",
            back = "#ff5722"
        }, 
        {
            code = "OP2402-0020",
            qd = "K2-122-133",
            zd = "K2-122-137",
            back = "#ffc107"
        }, 
        {
            code = "OP2402-0110",
            qd = "K2-122-134",
            zd = "K2-122-135",
            back = "#2196F3"
        }
    }
 
    --[[ 组织行数据html ]]
    for i = 1, #tabDataList do
        strHtmlRow = strHtmlRow .. '<div class="table-row-data">' .. '<div class="table-col1">' ..
                         '<div style=" background: ' .. tabDataList[i].back .. ';">' .. tabDataList[i].code .. '</div>' ..
                         '</div>' .. '<div class="table-col2">' .. tabDataList[i].qd .. '</div>' ..
                         '<div class="table-col3">' .. tabDataList[i].zd .. '</div>' .. '</div>'
    end
 
    --[[ 总html ]]
    local strHtml = ' <div class="table3">' .. '<div class="table-head">' .. strHtmlTitle .. '</div>' ..
                        '<div class="table-body">' .. strHtmlRow .. '</div>' .. '</div>'
 
    local action = {}
    action[1] = {
        action_type = "chart",
        value = {
            graphicType = "html",
            title = {
                text = "当前出库任务",
                align = "left",
                color = "#fff",
                font = "微软雅黑",
                fontSize = 18
            },
            html = strHtmlStyle .. strHtml
        }
    }
 
    -- lua.Debug( strLuaDEID, debug.getinfo(1), "action! ", action )
 
    nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "setAction失败! " .. strRetInfo .. ' action = ' .. strAction)
    end
end