HM-SPMS/web/nginx/html/js/design2.min.js

2 lines
44 KiB
JavaScript
Raw Normal View History

2026-01-06 04:47:40 +08:00
function setStyle(e){var t="padding:"+e.top+"px "+e.right+"px "+e.bottom+"px "+e.left+"px ;font-family:"+e.font_family+";color:"+e.font_color+";font-size:"+e.font_size+";text-align:"+e.align+";display:"+e.is_show;return t}function filterDefined(e,t){for(var i,r=[],n=0;n<e.length;n++){var o=e[n];if((o.code+"").indexOf("definedId")===-1){if(r.push(o),o.children&&o.children.length>0){var s=filterDefined(o.children,t);r[r.length-1].children=s.node,void 0===i&&(i=s.index)}}else o.code===t&&(i=vm.formulas.length,vm.formulas_index=i),vm.formulas.push(o),vm.formulas["ind"+o.code]=vm.formulas.length-1}return{node:r,index:i}}function showTimeout(e,t){setTimeout(function(){vm[e]=!1},1e3*t)}function formulaTreeData(e,t){for(var i=0;i<e.length;i++){var r=t["ind"+e[i].code];void 0!==r&&(e[i].label=t[r].label,e[i].formula=t[r].formula),e[i].children&&e[i].children.length>0&&formulaTreeData(e[i].children,t)}}function getFormulaType(e){e||(e=""),e+="";var t=e.indexOf("(");if(t===-1)return"string";var i=e.substr(0,t);return i?i:"defined"}function dataOp(e,t,i){void 0===i&&(i=[]);var r=[];i[i.length]=r;for(var n=0,o=[];n<e.length;n++){var s=vm.$refs[t].getNode(e[n]);if(!s||s.visible!==!1){r.push(e[n]);var d=e[n].children;d instanceof Array&&d.length>0&&(o=o.concat(d))}}return o.length>0?dataOp(o,t,i):i}function creatTHRow(e,t,i){for(var r={},n=[],o="",s=e.length,d=s-1;d>=0;d--){n[d]=[];for(var l=e[d],a="",c=0;c<l.length;c++){var h=l[c];if(r[h.ptid]=(void 0===r[h.ptid]?0:r[h.ptid])+(void 0===r[h.tid]?1:r[h.tid]),void 0===r[h.tid]){var _=vm.ck_sx&&0==vm.cur_report_style.value?";display:none;":"";a+="<th style='"+i+_+"' rowspan="+(s-d)+"><div>"+(h.label||h.name)+"</div></th>",n[d].push(h)}else a+="<th style='"+i+";' colspan="+r[h.tid]+"><div>"+(h.label||h.name)+"</div></th>",void 0!==n[d+1]&&(n[d]=n[d].concat(n[d].splice(0,r[h.tid])))}if(d>0)var p="<tr>";else{vm.ck_sx&&0!=vm.cur_report_style.value&&t--;var p='<tr><th style="'+i+'" rowspan="'+s+'" colspan="'+t+'"><div>'+vm.table_y_name+"</div></th>"}o=p+a+"</tr>"+o}return{str:o,arr:n[0]}}function creatTHCol(e,t,i){for(var r={},n={},o="",s=t+"</tr>",d=e.length,l=d-1;l>=0;l--)for(var a=e[l],c=0;c<a.length;c++){var h=a[c];h.ptid||(h.ptid="root"),void 0===r[h.ptid]&&(r[h.ptid]=0),r[h.ptid]+=void 0===r[h.tid]?1:r[h.tid];var _="";if(void 0===r[h.tid]){var p=vm.ck_sx&&0!=vm.cur_report_style.value?";display:none;":"";_='<th style="'+i+p+'" colspan="'+(d-l)+'"><div>'+(h.label||h.name)+"</div></th>",1==r[h.ptid]&&(n[h.ptid]=[]);var v=(1!=r[h.ptid]||0==l?"<tr>":"")+_+s;n[h.ptid].push(v),0==l&&(o+=v)}else _='<th style="'+i+'" rowspan="'+r[h.tid]+'"><div>'+(h.label||h.name)+"</div></th>",0==l?(n[h.tid][0]="<tr>"+_+n[h.tid][0],o+=n[h.tid].join("")):(void 0===n[h.ptid]?(n[h.ptid]=[],n[h.tid][0]=_+n[h.tid][0]):n[h.tid][0]="<tr>"+_+n[h.tid][0],n[h.ptid]=n[h.ptid].concat(n[h.tid]))}return o}function changeTid(e,t,i,r){var n=t instanceof Array?t:[t];void 0===e&&(e="root"),void 0===r&&(r={});for(var o=0;o<n.length;o++){var s=n[o],d="t_"+i++;if(void 0===r[s.code]?r[s.code]=[s]:r[s.code].push(s),void 0===s.tid&&(s.tid=d,s.ptid=e),s.children instanceof Array&&s.children.length>0)return changeTid(d,s.children,i,r)}return i}function getLastNode(e){for(var t=[],i=0,r=e.length;i<r;i++){var n=e[i];n.children instanceof Array&&n.children.length>0?t=t.concat(getLastNode(n.children)):t.push(n)}return t}function objClone(e,t){var i={};for(var r in e)"function"==typeof t?t(r,e,i):i[r]=e[r];return i}function filterTree(e){if(!(e instanceof Array))return e;for(var t=0,i=[];t<e.length;t++)e[t]=Object.assign({},e[t]),e[t].children&&e[t].children.length>0&&(i=i.concat(e[t].children));return i.length>0?filterTree(i):void 0}function deleteReportFileItem(e){var t={substep:1,cur_report_type:1,cur_report_style:1,sketch_index:1,report_s_month:1,report_s_day:1,report_s_hours:1,report_interval:1,check_station:1,check_profession:1,checked_node:1,checked_total_index:1,checked_contrast_index:1,totals:1,contrasts:1,ck_cd:1,ck_sx:1,table:1,row_chang_color:1,dev_tree:1,time_tree:1,dev_map:1,time_map:1,tb_title:1,tb_sub:1,tb_width:1,tb_detailed
}};n(i,r);var o=function(e,t){var i=e.parent;if(!i)return!1;if(t){if(i.checked)return!1;i.checked=!0}else{for(var r=0,n=!1;r<i.childNodes.length;r++){var s=i.childNodes[r];s.checked&&(n=!0)}n||(i.checked=!1)}return o(i,t)};o(i,r)},creatProperty:function(){if(this.property_tree=[],"sy"==this.sketch.value){if(void 0===post[8].data){var e=vm.$refs.adev_tree.getCurrentNode();return e&&getProceeds(e.devCode),!1}vm.all_property=post[8].data}else vm.all_property=post[3].data;if("yx"==this.sketch.value)this.property_tree.push(this.all_property.yc);else if("dd"==this.sketch.value)this.property_tree.push(this.all_property.ym);else for(var t in this.all_property)this.property_tree.push(this.all_property[t]);this.clone_property_tree=JSON.parse(JSON.stringify(vm.property_tree))},recursion:function(e,t,i){void 0===i&&(i={c_:{},d_:{},t_:{},p_:{},s_:{},__other:{}});for(var r=0,n=[];r<t.length;r++){var o=t[r],s=e.key?t[r][e.key]:t[r].code;i[s]=o,"dev_type"===o.nodetype?i.c_[s]=o:"dev"===o.nodetype?i.d_[s]=o:"property_type"===o.nodetype?i.t_[s]=o:"property"===o.nodetype?i.p_[s]=o:"property_value"===o.nodetype?i.s_[s]=o:i.__other[s]=o,i[o.code]=o,o.children&&o.children.length>0&&(n=n.concat(o.children))}return 0!=n.length&&e.recursion?this.recursion(e,n,i):i},nodeFor:function(e){var t=objClone(e);return t.children&&t.children.length>0?t.tid="c_"+this.t_num++:t.tid="d_"+this.t_num++,t.children=[],t},creatDevTree:function(){if("sy"==this.sketch.value){var e=vm.$refs.adev_tree.getCurrentNode();this.checked_node.nodes=[];for(var t=0,i=["峰","平","谷","尖"];t<i.length;t++){var r=e.devCode+";"+vm.t_num+";",n={label:i[t],code:r,nodetype:"dev",devCode:e.devCode,devType:!0,children:[],tid:"d_"+vm.t_num++};this.checked_node[r]=n,this.checked_node.nodes.push(n)}return getProceeds(e.devCode),e?this.substep=Math.roundFixed(++this.substep):this.$alert("您未选中任何设备!","提示",{confirmButtonText:"确定",callback:function(){}}),!1}this.check_all=!0;var o={},s={};if(o=this.checked_node,s.dev_list=vm.$refs.adev_tree.getCheckedNodes(!1,!0),!(o.nodes.length>0||s.dev_list.length>0))return this.$alert("您未选中任何设备!","提示",{confirmButtonText:"确定",callback:function(){}}),!1;if(this.substep=Math.roundFixed(++this.substep),o.nodes.length>0&&o.nodes[0]!==o[o.nodes[0].treeCode]){var d=o.nodes;o={nodes:d};for(var l=d;l.length>0;){for(var t=0,i=[];t<l.length;t++){var a=l[t];if(o[a.treeCode]=a,a.children&&a.children.length>0){var c=a.children[0].nodetype;"property_type"!==c&&"property"!==c&&(i=i.concat(a.children))}}l=i}}for(var t=0,h={};t<s.dev_list.length;t++){var a=s.dev_list[t];if(void 0===o[a.treeCode]){var _=this.nodeFor(a);o[a.treeCode]=_,h[_.treeCode]=_}}var p=[];for(var v in h){var a=h[v];a.treePCode&&void 0!==h[a.treePCode]?(a.ptid=h[a.treePCode].tid,h[a.treePCode].children.push(a)):p.push(a)}for(var t=0;t<p.length;t++){var a=p[t];void 0===o[a.treePCode]?(a.ptid="",o.nodes.push(a)):(a.ptid=o[a.treePCode].tid,o[a.treePCode].children.push(a))}var f={arr:[]};for(var v in o)"nodes"!=v&&o[v].devModelCode&&(f.arr.push(v),f[v]=o[v]);getCdInfo({devTpName:f.arr.join(";")})},checkSelectedStatus:function(e){for(var t=0,i=0,r=0,n=e.childNodes.length;r<n;r++){var o=e.childNodes[r];o.checked||o.indeterminate?t++:i++}t==n?(e.checked=!0,e.indeterminate=!1):i==n?(e.checked=!1,e.indeterminate=!1):(e.checked=!0,e.indeterminate=!0)},checkVisible:function(e,t){for(var i=this.$refs.adev_tree.getNode(e),r=!1,n=!1,o=i.checked,s=i.childNodes;s.length>0;){for(var d=0,l=[];d<s.length;d++){var a=s[d];a.visible&&this.$refs.adev_tree.setChecked(a.data,o),a.childNodes.length>0&&(l=l.concat(a.childNodes)),a.checked?r=!0:n=!0}s=l,r&&n&&(a.parent.indeterminate=!0)}this.checkSelectedStatus(i.parent)},postDev:function(){var e=this;this.all_dev=[],this.tree_loading=!0,this&&this.check_profession&&getDev(e.check_profession,e.check_station)},filterMspsNode:function(e,t){if(!this.filter_c&&!this.filter_q)return!0;var i,r=!1,n=this.filter_c.split(/\s+/g),o=this.filter_q.split(/\s+/g);return 0==t.tid.indexOf("s")&&(i=this.editNodePanel?this.$refs.clone_c_tree.getN