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(`
外业巡检
`); 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 += '正常'; 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); }