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
ÿþ--[[
    x: GT-03-12
     Tðy: >f:yMR
    \O€ÿLZH  
    åegÿ2024-05-28
  
    ýQpeÿ BeforeGridShow
 
    ŸRý€:
        --    Lˆ    c®”§c6R ÿ"/T(u"¶r`„vpencLˆ N>f:y" Rd–","îO9e"    c®” "°eú^"¶r`„vpencLˆ N>f:y sQí•"    c®”                                                                
        --  "/T¨R"¶r`R̀ofœ˜r‚9eØS                                                                
                                            
 
 
    ôf9e°‹U_:
 
--]]
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
function BeforeGridShow ( strLuaDEID ) 
    local nRet, strRetInfo
    local arobjs, attrs
    local n, nCount
 
    nRet, arobjs = m3.GetSysDataJson( strLuaDEID )
    if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), arobjs ) end 
    -- lua.Debug( strLuaDEID, debug.getinfo(1), 'arobjs', arobjs )
    -- [{"id":"","attrs":[{"attr":"","value":""},..]},..]
    nCount = #arobjs
    if (nCount == 0) then  return end
 
    local obj, attrs, id
    local strCellBkground, strDataJson
    local strRowCtrl = ''
    local strCurYear = os.date("%Y")
    strCurYear = strCurYear.."--"
 
    strDataJson = '['
    for n = 1, nCount do
        obj = arobjs[n]
        attrs = obj.attrs
        nattr_count = #attrs
        id = obj.id
 
        local strAttrs = ''
         -- Øž¤‹Å`µQ/f N—‰ "͑n" Ù*NLˆ    c®”„v, êS    g•ï‹„vöeP—‰
        strRowCtrl = ',"row_button_hidden":""'
        -- ·ƒÖS ir™ex ŒT “^:Sx
        for nIndex = 1, nattr_count do
            local strAttr,strValue,strItem
            strAttr = attrs[nIndex].attr
            strValue = attrs[nIndex].value
            strCellBkground = ''
            if (strAttr == 'S_STATE') then
                if ( strValue == '°eú^' ) then
                    strRowCtrl = ',"row_button_hidden":"sQí•"'
                elseif ( strValue == '/T(u' ) then 
                    strRowCtrl = ',"row_button_hidden":" Rd–;/T¨R;‘"'
                    strCellBkground = ', "bk_color":"#BDB76B","text_color":"#000000"'
                elseif ( strValue == 'sQí•' ) then 
                    strRowCtrl = ',"row_button_hidden":" Rd–"'
                    strCellBkground = ', "bk_color":"#FF0000","text_color":"#FFFFFF"'
                elseif ( strValue == 'Œ[b' ) then 
                    strRowCtrl = ',"row_button_hidden":""'
                    strCellBkground = ', "bk_color":"#00FF00","text_color":"#008000"'
                end
            end
            strItem = '{"attr":"' .. strAttr .. '","value":"' .. strValue .. '"'..strCellBkground..'},'
            strAttrs = strAttrs .. strItem
        end
        strAttrs = lua.trim_laster_char(strAttrs)
        local strRow = '{"id":"'..id..'"'..strRowCtrl..',"attrs":['..strAttrs..']},'
        strDataJson = strDataJson .. strRow
    end
    -- ÖSˆmgTN*N,÷S
    strDataJson = lua.trim_laster_char(strDataJson)
    strDataJson = strDataJson .. ']'
 
    local strAction = '[{"action_type":"reset_data_attr","value":' .. strDataJson .. '}]'
    -- lua.Debug( strLuaDEID, debug.getinfo(1), 'strAction', strAction )
    nRet, strRetInfo = mobox.setAction(strLuaDEID, strAction)
    if ( nRet ~= 0 ) then 
        lua.Warning( strLuaDEID, debug.getinfo(1), strAction )
        lua.Error( strLuaDEID, debug.getinfo(1), "setAction•ï‹: "..strRetInfo) 
    end    
end