lzh
2025-06-24 13c4a636539584ab977fddacfae884b3ec250aee
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
ÿþ--[[
    x: hh-mobox-005
     Tðy: úQeQ“^N¡R
    \O€ÿSGX
    åegÿ2024-11-27
    ýQpeÿ GenChartJson
 
    ŸRý€:
       àS˜b¿~þV
 
    ôf9e°‹U_:
 
--]]
json = require("json")
mobox = require("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function GenChartJson(strLuaDEID)
    local nRet, strRetInfo
    --[[ h˜˜œ˜r‚ ]]
    local strTitle = "úQeQ“^N¡R"
    --[[ h˜˜œ˜r‚ ]]
    local strColor = "#fff"
    --[[ ñg¶rþVñgP[ Tðy ÿù[”^ series  Nname ]]
    local tabLegendData = { 'eQ“^', 'úQ“^' }
    --[[ Xtpenc ÎNæ]TóS ]]
    -- ·ƒÖSS_MRåeg
    local current_time = os.time()
    local current_date = os.date("*t", current_time)
    local current_month = current_date.month
    local current_day = current_date.day
 
    local num = 7
    local tabXAxis = {}
    local tabSeriesRKData = {} -- eQ“^peϑ
    local tabSeriesCKData = {} -- úQ“^peϑ
    for i = 1, 8 do
        local one_week_ago_time = current_time - num * 24 * 60 * 60
        local one_week_ago_date = os.date("*t", one_week_ago_time)
        local one_week_ago_month = one_week_ago_date.month
        local one_week_ago_day = one_week_ago_date.day
 
        tabXAxis[i] = one_week_ago_month..'-'..one_week_ago_day
 
        -- 9hncgýNŒT)Ype·ƒÖSeQ“^ûN¡Rpeϑ
        local count
        local strCondtion = "EXTRACT(MONTH FROM T_CREATE) = "..one_week_ago_month.." AND EXTRACT(DAY FROM T_CREATE) = "..one_week_ago_day.." AND S_OP_NAME IN('‰|™eeQ“^','™eeQ“^','ýVêzzXbÞV“^','Ëz“^eQ“^','ÝO)nPg™eeQ“^')"
        nRet, count = mobox.getDataObjCount(strLuaDEID, "Task", strCondtion)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSûN¡R1Y%!"..count) end
        tabSeriesRKData[i] = count
 
        -- 9hncgýNŒT)Ype·ƒÖSúQ“^ûN¡Rpeϑ
        strCondtion = "EXTRACT(MONTH FROM T_CREATE) = "..one_week_ago_month.." AND EXTRACT(DAY FROM T_CREATE) = "..one_week_ago_day.." AND S_OP_NAME IN('‰|™eúQ“^','|TëSzzXb','Ǒ-'','Ëz“^úQ“^')"
        nRet, count = mobox.getDataObjCount(strLuaDEID, "Task", strCondtion)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSûN¡R1Y%!"..count) end
        tabSeriesCKData[i] = count
 
        num = num - 1
    end
    tabXAxis[8] = current_month .. '-' .. current_day
 
    --[[ eQ“^œ˜r‚ ]]
    local strRKColor = '#EE822F'
    --[[ úQ“^œ˜r‚ ]]
    local strCKColor = '#F2BA02'
    --[[ ñg¶rþVpenc ù[”^Xtpenc ]]
    --[[eQ“^ ]]
    -- local tabSeriesRKData = { 220, 182, 191, 234, 290, 330, 310, 400 }
    --[[ úQ“^]]
    -- local tabSeriesCKData = { 120, 132, 101, 134, 90, 230, 210, 300 }
 
    local option = {
        title = {
            text = strTitle,
            left = 20,
            textStyle = {
                color = strColor
            },
            top = 10
        },
        tooltip = {
            trigger = 'axis',
            axisPointer = {
                type = 'cross',
                label = {
                    backgroundColor = '#6a7985'
                }
            }
        },
        legend = {
            data = tabLegendData,
            textStyle = {
                color = strColor
            },
            top = 10
        },
        grid = {
            left = '5%',
            right = '5%',
            bottom = '5%',
            top = '18%',
            containLabel = true
        },
        xAxis = { {
            type = 'category',
            boundaryGap = false,
            data = tabXAxis,
            axisLabel = {
                textStyle = {
                    color = strColor
                }
            }
        } },
        yAxis = { {
            type = 'value',
            axisLabel = {
                textStyle = {
                    color = strColor
                }
            }
        } },
        series = { {
            name = 'eQ“^',
            type = 'line',
            stack = 'Total',
            areaStyle = {},
            emphasis = {
                focus = 'series'
            },
            label = {
                show = true
            },
            color = strRKColor,
            data = tabSeriesRKData
        }, {
            name = 'úQ“^',
            type = 'line',
            stack = 'Total',
            areaStyle = {},
            emphasis = {
                focus = 'series'
            },
            label = {
                show = true
            },
            color = strCKColor,
            data = tabSeriesCKData
        } }
    }
 
    local action = {}
    action[1] = {
        action_type = "chart",
        value = {
            graphicType = "echart",
            title = {
                text = strTitle,
                align = "center",
                color = "#515a6e",
                font = "®_oÅ–Ñž",
                fontSize = 12
            },
            option = option
        }
    }
 
    nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "setAction1Y%! " .. strRetInfo)
    end
end