
function ciy_chart_farm1_r2(opdata) {
    this.func = ['farm_r2'];
    this.lastdata = {};
    this.resize = function () {
    }

    var cappatrols = null;
    this.setdata = function (funame, data) {
        if (!data)
            return;

        this.lastdata[funame] = data;

        cappatrols = [];
        var picscd = data.patrol.split('~');
        for (var t in picscd)
            cappatrols.push({ 'img': picscd[t], 'data': data.patrol });
            console.log(cappatrols);
            console.log(data);
        fillimg(true);
    }
    this.distory = function () {
        clearInterval(t_autoimg);
    }


    var thos = this;
    opdata.container.append(`<div class="brimg cehide" style="background: #00000066;border-radius: 0.5em;height: 100%;">
        <div style="pointer-events: none;min-width:180px;padding-top: 0.5em;padding-left:4px;">
            <span style="color:#fffffd;font-weight: bolder;letter-spacing: 2px;padding-left:1em;">外业巡检</span>
            <div style="position: relative;margin-top: 0.6em;">
            <img src="/ud/bigscreen/tit/06.png" style="height:0.3em;display: block;">
            <div style="position: absolute;left: 12em;right: 4px;border-bottom:0.05em solid #64ecf7;"></div>
            </div>
        </div>
        <div class="cont" style="height: calc(100% - 3em);padding: 5px 5px 0 5px;">
            <div style="height: calc(100% - 3em);display: flex;">
            <img id="pic_img" src="./b64/nozz.jpg" style="max-width:100%;max-height:100%;display:block;margin:auto;"/>
            </div>
            <div id="pt_data" style="height:3em;display:flex;align-items: center;justify-content: center;">
            </div>
        </div>
    </div>`);


    this.resize();
    //3秒，换缩略图。
    var idx_autoimg = -1;
    var t_autoimg = setInterval(function () {
        fillimg();
    }, 3000);
    function filldata(dom, data) {
        $5('#pic_img', dom).attr('src', data.img);
        var html = '';
        html += '<span style="background:#009f38;padding: 0.2em 0.5em;border-radius: 0.3em;">正常</span>';
        html += '　巡检人 xxx';
        $5('#pt_data', dom).html(html);
    }
    function fillimg(first) {
        if ((first && idx_autoimg > -1))
            return;
        if (cappatrols === null)
            return;
        idx_autoimg++;
        if (idx_autoimg >= cappatrols.length)
            idx_autoimg = 0;
        if (!cappatrols[idx_autoimg])
            return;
        var contdom = $5('.cont', opdata.container);
        if (cappatrols.length == 1)
            return filldata(contdom, cappatrols[idx_autoimg]);
        contdom.hide('down', 0.2);
        setTimeout(function () {
            filldata(contdom, cappatrols[idx_autoimg]);
            contdom.show('up', 0.2);
        }, 200);
    }
    fillimg();

    // var style = document.createElement("style");
    // style.innerHTML = `
    // `;
    // window.document.head.appendChild(style);

}