--定义ListView
local m_lvEqpt = CLuaListViewUtil();
m_lvEqpt:setWnd(ui:getDialogName(),'id_eqpt_list');

--查询数据
local helpEqptState = CSelectHelp();
local cStr = CTNString();
local sql = [[
    select a.eqpt_id,b.eqpt_name,a.eqpt_cur_state,a.update_time from dc_real_eqpt_state a 
    left join bs_eqpt b on a.eqpt_id = b.eqpt_id 
    where a.eqpt_cur_state <> 0 and b.eqpt_name <> ''
]];
db:commandStr('plugin.dc_server.select_sqlite',sql, cStr);
helpEqptState:reset();
helpEqptState:fromString(cStr:get());

--数据传入和设置ListView子UI的数据
m_lvEqpt:setHelp(helpEqptState);
for i=0,helpEqptState:size()-1 do
    local itTmp = CIntent();
    local eqpt_id = helpEqptState:valueStringByCol(i, 0);
    local State = helpEqptState:vs(i,'eqpt_cur_state');
    --print(State)
    if State == '0' then
        itTmp:set('color', '12303291');
    elseif State == '1' then
        itTmp:set('color', '4042303');    
    elseif State == '2' then
        itTmp:set('color', '5296617');    
    elseif State == '3' then
        itTmp:set('color', '12224767');
    elseif State == '4' then--故障
        itTmp:set('color', '16719932');
    elseif State == '7' then--保养
        itTmp:set('color', '12719932');
    elseif State == '8' then--换模
        itTmp:set('color', '16416882');
    else
        itTmp:set('color', '5165031');
    end

    --ListView控件的ui_code属性要和子UI的名称绑定
    --设置子UI的控件属性
    m_lvEqpt:setProp(i,'eqpt_name','f_text_c',itTmp:get('color'));
end
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:04

results matching ""

    No results matching ""