2 lines
44 KiB
JavaScript
2 lines
44 KiB
JavaScript
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_1:1,tb_detailed_2:1,tb_detailed_3:1,tb_detailed_4:1,data_point:1,digits_fixed:1,report_bgcolor:1,report_font:1,report_size:1,report_color:1,report_textarea:1,row_line_height:1,row_chang_color:1,border_type:1,border_bgcolor:1,border_zise:1,th_bgcolor:1,th_color:1,all_totals:1,cols_width:1,t_num:1};for(var i in e.vm)void 0===t[i]&&delete e.vm[i]}function widthTd(e,t){var i="",r="";vm.cols_width.length=e+t;for(var n=0;n<e;n++)vm.cols_width[n]=vm.cols_width[n]?vm.cols_width[n]:70,i+='<th style="width:'+vm.cols_width[n]+'px;"></th>';for(var o=0;o<t;o++){var s=n+o;vm.cols_width[s]=vm.cols_width[s]?vm.cols_width[s]:70,r+='<td style="width:'+vm.cols_width[s]+'px;"></td>'}return'<tr class="udf-width">'+i+r+"</tr>"}var reiniting=!1,timeout=0,outtime=800,vm=new Vue({el:"#app",data:{i18n:{title1:"报表管理",title4:"其他配置",title5:"预览",t1_1:"新建报表",t1_2:"打开报表",t1_3:"保存报表",t2_1:"图片"},save_loading:!1,openedFile:{},reportFilesPanel:!1,reportFiles:[{label:"报表",code:"root",expand:!1,filetype:"report",children:[]}],reportModes:[{label:"模板",code:"mode",filetype:"mode",type:"files",children:[{label:"模板1",code:"mode_1",filetype:"mode",type:"file",children:[]}]}],fileName:"",fileSelected:"",checkedFiles:[],showFileRename:!1,fileRename:"",isSave:!0,newFile:!1,newFiles:!1,isMode:!1,fileSelected:"",fileSelectedReport:{},reportFilesTips_nofile:!1,reportFilesTips_file:!1,reportFilesTips_files:!1,addColPanel:!1,zx_colName_show:"",zx_colName:"",zx_colValue_show:"",zx_colValue:"",formulaType:"defined",saveFlag:!1,cols:[],check_cols:[],check_cols_index:"-1",x_check:[],col_check_node:[],editNodePanel:!1,addNodePanel:!1,edit_node_type:"",checked_dev_index:0,check_dev:[],dev_name_text:"",dev_code_text:"",clone_all_dev:[],edit_is_add:!1,delete_box:!1,show_field:!1,dev_field:{label:"label"},deleteFlag:!0,configure:!1,activeName:"first",border_type:"",border_type_list:[{label:"实线",value:"solid"},{label:"点线",value:"dotted"},{label:"虚线",value:"dashed"},{label:"双线",value:"double"},{label:"3D凹槽线边框(需要边框线较大才有明显的效果)",value:"groove"},{label:"3D垄状线边框(需要边框线较大才有明显的效果)",value:"ridge"},{label:"3D凹形",value:"inset"},{label:"3D凸形",value:"outset"}],border_bgcolor:"",border_zise:"",th_bgcolor:"rgba(16, 67, 102, 1)",th_color:"rgba(0, 172, 245, 1)",row_line_height:27,row_chang_color:"two-color",report_bgcolor:"",report_font:"",report_size:"",report_color:"",report_textarea:"",paper_type:"A4",paper_orientation:"col",paper_size:{A4:{col:1086,row:756},A3:{col:1548,row:1084}},form:{},cols_width:[],radio_form:"",tb_title:{name:"表格标题",is_show:"block",font_family:"微软雅黑",font_color:"#0096D7",font_size:"",align:"center",top:30,right:10,bottom:10,left:10},tb_sub:{name:"表格副标题",is_show:"none",font_family:"微软雅黑",font_color:"#0096D7",font_size:"",align:"center",top:10,right:10,bottom:10,left:10},tb_detailed_1:{name:" 自定义被描述:描述内容",is_show:"none",font_family:"微软雅黑",font_color:"#0096D7",font_size:"center",align:"",top:"",right:"",bottom:"",left:""},tb_detailed_2:{name:" 表格编号:000",is_show:"none",font_family:"微软雅黑",font_color:"#0096D7",font_size:"",align:"center",top:"",right:"",bottom:"",left:""},tb_detailed_3:{name:" 制表时间:"+(new Date).toLocaleDateString(),is_show:"block",font_family:"微软雅黑",font_color:"#0096D7",font_size:"",align:"center",top:"",right:"",bottom:"",left:""},tb_detailed_4:{name:" 制表人:"+(sessionStorage.getItem("name")||""),is_show:"block",font_family:"微软雅黑",font_color:"#0096D7",font_size:"",align:"center",top:"",right:"",bottom:"",left:""},tb_width:"600px",table:"<tr><td>###</td><td>###</td><td>###</td><td>###</td><td>###</td><td>###</td><td>###</td><td>###</td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>",sidetabs:"dev",adding:!1,deling:!1,step:!1,substep:0,report_types:[],filter_check_dev:"",cur_report_type:{},sketch_index:0,report_s_month:1,report_s_day:1,report_s_hours:0,report_interval:"1",report_style:[],cur_report_style:{},station:[],profession:[],check_station:"",check_profession:"",all_dev:[],check_all:!0,all_property:{},property_tree:[],clone_property_tree:[],filter_all_dev:"",filter_all_dev_type:"name",tree_loading:!1,checked_node:{nodes:[]},t_num:0,check_off:"全选",filter_c:"",filter_q:"",ck_cd:!0,ck_cy:!0,ck_sx:!0,ck_value:"",cd_info_check:{list:[]},contrasts:[],all_totals:[],checked_contrast_index:[],checked_total_index:[],dev_tree:function(e){for(var t=0,i=[];t<e;t++)i.push({label:"###",tid:t});return i}(8),time_tree:[],dev_map:[],dev_head:[],time_map:[],dataConfig:!1,data_cd:!1,data_dev:!1,data_point:2,text_key:"code",old_text:"",new_text:"",digits_fixed:!1,input_focus:!1,timerNo:"",cols_type:"father",cols_parent:"",cols_value:"",formule_name:"",formule_value:"",formule_view:"",protree_to_option:[],powerPanel:!1,checkedGroup:[],allUserGroup:[],curTreeCode:""},computed:{totals:function(){var e=this;if(!e.all_totals)return[];var t=JSON.parse(JSON.stringify(e.all_totals));return"sy"==this.sketch.value||"dd"==this.sketch.value?[t[t.length-1]]:t},devtree_to_option:function(){for(var e=this.dev_tree,t=e,i=0,r=[],n=[];t[i];)"dev"===t[i].nodetype?n.push(t[i]):t[i].children&&t[i].children.length>0&&Array.prototype.push.apply(r,t[i].children),i++,void 0===t[i]&&(t=r,r=[],i=0);return n},adev_check:function(){var e=this.cur_report_type.type,t=this.sketch_index;return this.postDev(),"sy"!=e[t].value},table_y_name:function(){var e=this.cur_report_style.value;return 0==e?"tj"!=this.sketch.value?"时间":"测点":1==e?"设备":void 0},checked_dev_node:function(){return vm.check_dev[vm.checked_dev_index]},checked_total:function(){for(var e=this.totals,t=this.checked_total_index,i=0,r=[];i<t.length;i++)r.push(e[t[i]]);return r},checked_contrast:function(){for(var e=this.contrasts,t=this.checked_contrast_index,i=0,r=[];i<t.length;i++)r.push(e[t[i]]);return r},sketch:function(){var e=this.cur_report_type.type,t=this.sketch_index,i=getReportStyle(),r="报表";return this.report_style=[],"sy"===e[t].value?(this.cur_report_style=i[0],this.report_style.push(i[0])):this.report_style=i,this.tb_title.name=e[t].name,this.tb_title.name.indexOf(r)===-1&&(this.tb_title.name=this.tb_title.name+r),e[t]},border_style:function(){return"border-style:"+this.border_type+";border-color:"+this.border_bgcolor+";border-width:"+this.border_zise+"px;height:"+this.row_line_height+"px"},th_style:function(){return"background-color:"+this.th_bgcolor+";color:"+this.th_color},panel_style:function(){return"background-color:"+this.report_bgcolor+";color:"+this.report_color+";font-family:"+this.report_font+";font-size:"+this.report_size+";"+this.report_textarea},papers:function(){for(var e=this.paper_size[this.paper_type],t=0,i=[];t<100;t++){var r="";r="col"==this.paper_orientation?"width:"+e.col+"px;height:"+e.row+"px;":"height:"+e.col+"px;width:"+e.row+"px;",i.push(r)}return i},tb_title_style:function(){var e=this.tb_title;return"margin:auto;width:100%;"+setStyle(e)},tb_sub_style:function(){var e=this.tb_sub;return"margin:auto;width:width:100%;"+setStyle(e)},tb_detailed_1_style:function(){var e=this.tb_detailed_1;return setStyle(e)},tb_detailed_2_style:function(){var e=this.tb_detailed_2;return setStyle(e)},tb_detailed_3_style:function(){var e=this.tb_detailed_3;return setStyle(e)},tb_detailed_4_style:function(){var e=this.tb_detailed_4;return setStyle(e)},reportInterval:function(){var e=getReportIntreval();return"udf"!==this.cur_report_type.value&&(e.length=3),e}},methods:{userGroupOn:function(){this.checkedGroup=[];for(var e=0;e<this.allUserGroup.length;e++){var t=this.allUserGroup[e];this.checkedGroup.push(t.id)}},userGroupOff:function(){this.checkedGroup=[],this.checkedGroup.shift()},userGroupSubmit:function(){setGroupPower({usergArr:vm.checkedGroup.join(";"),treeCode:vm.curTreeCode})},showPowerPanel:function(e){this.powerPanel=!0,this.curTreeCode=e},selectDesabled:function(){return"sy"==this.sketch.value&&(this.report_s_month=1,this.report_s_day=1,this.report_s_hours=0,this.report_interval="1",!0)},filteColsNode:function(e,t){return"formula"!==t.nodetype},addNewCol:function(){this.zx_colName="新建节点",this.zx_colValue="",this.formulaType="defined",this.check_cols=[]},editCol:function(e){this.zx_colName=e.name,this.zx_colValue=e.code,this.formulaType=e.formulaType,this.check_cols=e.detail},colsDel:function(){},colsFormulaDel:function(e){this.check_cols.splice(e,1);for(var t=0;t<this.check_cols.length;t++)this.check_cols[t].key=this.getABC(t);var i=vm.getABC(t);this.zx_colValue.indexOf("+"+i)!==-1?this.zx_colValue.replace("+"+i,""):this.zx_colValue.indexOf(i+"+")!==-1?this.zx_colValue.replace(i+"+",""):this.zx_colValue.indexOf(i)!==-1&&this.zx_colValue.replace(i,"")},colsSave:function(){var e={name:vm.zx_colName,label:vm.zx_colName,tid:vm.t_num++,ptid:"",formulaType:vm.formulaType,code:vm.zx_colValue,nodetype:"formula",detail:vm.check_cols};this.check_cols_index==-1?(this.cols.push(e),this.$refs.x_tree.append(e),this.check_cols_index=this.cols.length-1):(this.cols[vm.check_cols_index]=e,vm.$refs.x_tree.append(e),this.cols.push(""),this.cols.pop())},checkEvent:function(e,t,i){var r,n,o=e.nodetype;switch(o){case"property_value":r=t.parent,n=r.parent;break;case"property":return!1;case"dev":return!1;case"dev_type":return!1;case"col_defined":return!1}var s=JSON.parse(JSON.stringify(n.data)),d=JSON.parse(JSON.stringify(r.data)),l=JSON.parse(JSON.stringify(e));d.children=[],s.children=[];var a=this,c={key:a.getABC(a.check_cols.length),nodes:[s,d,l],code:"["+s.code+"]_&_["+d.code+"]_&_["+l.code+"]"};this.zx_colValue?this.zx_colValue+="+"+c.key:this.zx_colValue=c.key,this.check_cols.push(c)},getABC:function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),i=t.length,r=t[e%i],n=r,o=Math.floor(e/i),s=0;s<o;s++)n+=r;return n},formulaResetName:function(){},formulaResetFormula:function(){},formulaTypeChange:function(){},reportReName:function(e){if(0==e.rename)return!1;var t=function(e,t){vm.newFile=!1},i={operateFlag:1,name:e.label,treeCode:e.treeCode};i.name||(i.name=(new Date).getTime()),vm.timerNo=setTimeout(function(){e.rename=!1,auReport(i,i,t)},80)},reInit:function(){var e=this.fileSelectedReport;return e?0==e.type?(this.checkedFiles=this.fileSelectedReport.children,!1):void this.$msgbox({message:"确定打开该报表?",title:"提示",type:"info",showCancelButton:!0,confirmButtonText:"确定",cancelButtonText:"取消",callback:function(t,i){"confirm"==t&&getReportDetail({treeCode:e.treeCode},function(e){var t=JSON.parse(e);vm.dev_tree=[],vm.cols_width=[],reiniting=!0;for(var i in t.vm)"table"!==i&&(vm[i]=t.vm[i]);vm.initOption(t.vm),vm.reportFilesPanel=!1,vm.newFile=!1,vm.table=t.vm.table,setTimeout(function(){reiniting=!1,vm.refreshDevTree()},200)})}}):(vm.$notify({title:"错误",message:"未选中报表。",type:"error"}),!1)},initOption:function(e){void 0===e&&(e=vm),void 0===e.ck_sx&&this.setCk_sx()},setCk_sx:function(){this.ck_sx=!("yx"!=this.sketch.value&&"dd"!=this.sketch.value&&"bb"!=this.sketch.value&&"cr"!=this.sketch.value)},goStyle:function(){this.substep=Math.roundFixed(vm.substep+1),this.setCk_sx()},returnBack:function(){var e=this;switch(e.sketch.value){case"yx":case"dd":case"bb":case"cr":case"sy":this.substep=this.substep-1;break;case"tj":this.substep=this.substep;break;case"db":this.substep=this.substep-1}this.step=!0},update_checkedFiles:function(){this.checkedFiles.push(""),this.checkedFiles.pop()},fileClick:function(e,t,i){this.checkedFiles=t.parent.data.children||t.parent.data,this.fileSelectedReport=e,this.update_checkedFiles()},reportDelete:function(){var e=this.fileSelectedReport,t="";e&&"0"==e.type?t="确定删除该文件夹以及该文件夹下所有报表?":e&&"1"==e.type&&(t="确定删除该报表?"),this.$confirm(t,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"info",callback:function(t,i){"confirm"==t&&deleteReport(e,function(t){t&&(vm.$refs.report_tree.remove(e),vm.fileSelectedReport={})})}})},addFiles:function(){if(0!==timeout)return!1;if(timeout=setTimeout(function(){timeout=0},outtime),0==vm.newFiles)return!1;this.fileRename.trim()||(this.fileRename="新建文件夹_"+(new Date).getTime());var e={treePCode:"",name:"",type:0,operateFlag:0==this.newFiles?1:0},t=this.fileRename,i=[],r={};if(e.name=t,this.checkedFiles[0])i=this.checkedFiles[0].path.split("/"),e.treePCode=this.checkedFiles[0].treePCode;else if(this.fileSelectedReport&&0==this.fileSelectedReport.type)e.treePCode=this.fileSelectedReport.treeCode;else if(this.fileSelectedReport&&1==this.fileSelectedReport.type)return vm.$notify({title:"提示",message:"不能添加为报表的子级",type:"warning"}),!1;i.length<2?i=t:(i[i.length-1]=t,i=i.join("/")),r={label:t,code:"files"+vm.t_num++,type:0,path:i,treePCode:e.treePCode||"",children:[]};var n=function(e,t){e.treeCode=t.treeCode,vm.checkedFiles.push(e),vm.fileRename="",vm.newFiles=!1};this.save_loading=!0,auReport(e,r,n)},updateFile:function(){return 0===timeout&&(timeout=setTimeout(function(){timeout=0},outtime),!this.newFile&&!this.newFiles&&(this.fileSelectedReport.treeCode&&1==this.fileSelectedReport.type?void this.$confirm('确定到报表 "'+this.fileSelectedReport.label+'" ?',"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"info",callback:function(e,t){if("confirm"==e){var i=JSON.parse(JSON.stringify({vm:vm.$data}));deleteReportFileItem(i),auReport({treeCode:vm.fileSelectedReport.treeCode,treePCode:vm.fileSelectedReport.treePCode,name:vm.fileSelectedReport.label,type:1,fileDetail:JSON.stringify(i),operateFlag:1})}}}):(vm.$notify({title:"提示",message:"没有选中的报表",type:"warning"}),!1)))},addFile:function(){if(0!==timeout)return!1;if(timeout=setTimeout(function(){timeout=0},outtime),0==vm.newFile)return!1;this.fileRename.trim()||(this.fileRename="新建报表_"+(new Date).getTime());var e=JSON.parse(JSON.stringify({vm:vm.$data}));deleteReportFileItem(e);var t={treePCode:"",name:"",type:1,fileDetail:JSON.stringify(e),operateFlag:vm.newFile?0:1},i=[],r=this.fileRename;if(t.name=r,this.checkedFiles[0])i=this.checkedFiles[0].path.split("/"),t.treePCode=this.checkedFiles[0].treePCode;else if(this.fileSelectedReport&&0==this.fileSelectedReport.type)t.treePCode=this.fileSelectedReport.treeCode;else if(this.fileSelectedReport&&1==this.fileSelectedReport.type)return vm.$notify({title:"提示",message:"不能添加为报表的子级",type:"warning"}),!1;i.length<2?i=r:(i[i.length-1]=r,i=i.join("/"));var n={label:r,code:"file"+vm.t_num++,type:1,treePCode:t.treePCode||"",path:i},o=function(e,t){e.treeCode=t.treeCode,vm.checkedFiles.push(e),vm.fileRename="",vm.newFile=!1};this.save_loading=!0,auReport(t,n,o)},reportPanelDblClick:function(e){"0"==e.type?(e.children||(e.children=[]),this.checkedFiles=e.children,this.update_checkedFiles()):"1"!=e.type||this.isSave||this.reInit()},scrollBottom:function(){var e=this;this.$nextTick(function(){var t=e.$el.querySelector("#fileScroll");t.scrollTop=t.scrollHeight})},addNewFiles:function(){this.newFiles=!0,this.fileRename="",this.scrollBottom()},addNewFile:function(){this.newFile=!0,this.fileRename="",this.scrollBottom()},reportRename:function(){this.fileSelectedReport&&(vm.input_focus=!0,vm.$set(this.fileSelectedReport,"rename",!0))},reportPanelClick:function(e){this.$refs.report_tree.setCurrentKey(e.code),this.fileSelectedReport=e,this.isSave||(this.fileName=e.path)},addFormula:function(){this.cols_type="father",this.cols_parent="",this.cols_value="",this.formule_name="",this.formule_value="",this.formule_view="",this.protree_to_option=[],this.addNodePanel=!0},navBack:function(){var e=vm.substep;this.sketch_index<3?e=4+vm.substep-Math.floor(vm.substep):3==this.sketch_index?e=3+vm.substep-Math.floor(vm.substep):4==this.sketch_index&&(e=3+vm.substep-Math.floor(vm.substep)),this.postDev(),getCdInfo({devTpName:""}),this.substep=Math.roundFixed(e),this.step=!0},changeAllXNode:function(){var e=this.text_key,t=this.old_text,i=this.new_text;return!(!t||!i)&&(this.changeNodeCode(vm.dev_tree,e,t,i),void this.refreshDevTree())},changeNodeCode:function(e,t,i,r){for(var n=0;n<e.length;n++){var o=e[n];o[t]&&o[t].indexOf(i)!==-1&&(o[t]=o[t].replace(i,r)),o.children&&o.children.length>0&&this.changeNodeCode(o.children,t,i,r)}},change_input_text:function(e){e.nodetype==this.checked_dev_node.nodetype?(this.dev_name_text=e.label,this.dev_code_text=e.code):this.$notify({title:"提示",message:"不是相同中类的节点"})},editXNode:function(e,t){this.edit_node_type=t.devType;var i=[t];if(t.devType)for(var r=0;r<t.children.length;r++){var n=t.children[r];i.push(n);for(var o=0;o<n.children.length;o++)i.push(n.children[o])}this.check_dev=i,this.checked_dev_index=0,this.checked_dev_node.label="",this.checked_dev_node.code="",this.editNodePanel=!0},changeLabel:function(){this.checked_dev_node.label=this.dev_name_text,this.checked_dev_node.code=this.dev_code_text,this.refreshDevTree()},addXNode:function(){var e=[];vm&&vm.dev_tree&&(e=JSON.stringify(vm.dev_tree)),this.x_check=JSON.parse(e),this.addColPanel=!0,this.$refs.col_tree&&this.$refs.col_tree.filter()},refreshDevTree:function(){this.dev_tree.push(""),this.dev_tree.pop()},transposition:function(){this.cur_report_style=this.cur_report_style.value==this.report_style[0].value?this.report_style[1]:this.report_style[0],this.refreshDevTree()},allowDrag:function(){return!0},allowDrop:function(e,t,i){this.$refs.x_tree.setCurrentNode(t);var r=t.key,n=!0;switch(0){case e.key.indexOf("p_f"):n="inner"!=i?0==r.indexOf("p_"):0==r.indexOf("d_f");break;case e.key.indexOf("c_"):n=0==r.indexOf("c_");break;case e.key.indexOf("d_"):n="inner"!=i?0==r.indexOf("d_"):0==r.indexOf("c_");break;case e.key.indexOf("t_"):n="inner"!=i?0==r.indexOf("t_"):0==r.indexOf("d_");break;case e.key.indexOf("p_"):n="inner"!=i?0==r.indexOf("p_"):0==r.indexOf("t_");break;case e.key.indexOf("s_"):n="inner"!=i?0==r.indexOf("s_"):0==r.indexOf("p_")}return n},nodeDrop:function(e,t,i){this.refreshDevTree();var r="";r="inner"==i?t.data.tid:t.data.ptid,this.$set(e.data,"ptid",r)},expendDev:function(e,t){void 0===t&&(t=this.$refs.x_tree.store.root.childNodes);for(var i=0;i<t.length;i++)"dev"==t[i].data.nodetype?t[i].expanded=!1:(t[i].expanded=!0,t[i].childNodes.length>0&&this.expendDev(e,t[i].childNodes))},changePtid:function(){},deleteNode:function(e,t){this.$createElement;t.devType===!1?this.delete_box=!0:this.$confirm("确定删除该节点?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",callback:function(t,i){"confirm"==t&&(vm.$refs.x_tree.remove(e),vm.refreshDevTree())}})},filterXNode:function(e,t){return!e||t.label.indexOf(e)!==-1},makeFormule:function(){var e=this.cols_type,t=this.formule_name,i=this.formule_value;return t?"father"===e||i?(this.dev_tree.push({label:t,name:t,nodetype:"father"==e?"fml_type":"code"==e?"fml":"fml_string",code:i,tid:"father"!==e?"p_f"+vm.t_num++:"d_f"+vm.t_num++}),void(this.addNodePanel=!1)):void vm.$notify({title:"错误",message:"请输入列值!",type:"error"}):void vm.$notify({title:"错误",message:"请输入列名!",type:"error"})},formulAddCode:function(){var e,t=this.formule_value,i=this.formule_view,r=this.protree_to_option,n=this.cols_value;if(e="sy"==this.sketch.value?"["+r[n].code+"]":"["+this.devtree_to_option[vm.cols_parent].code+";"+r[n].code+"]",t){var o=t[t.length-1];"+"===o||"-"===o||"*"===o||"/"===o||"("===o?(this.formule_value=t+e,this.formule_view=i+"["+r[n].label+"]"):vm.$notify({title:"错误",message:"请先输入运算符!",type:"error"})}else this.formule_value=e,this.formule_view="["+r[n].label+"]"},formulAddNum:function(e){var t=this.formule_value,i=this.formule_view;if(t){var r=t[t.length-1];"+"===r||"-"===r||"*"===r||"/"===r||"("===r?(this.formule_value=t+e,this.formule_view=i+e):Number(r)?(this.formule_value=t+e,this.formule_view=i+e):vm.$notify({title:"错误",message:"请先输入运算符!",type:"error"})}else this.formule_value=e,this.formule_view=e},formulAddPrth:function(e){var t=this.formule_value,i=this.formule_view;t=t?t:"",i=i?i:"","("===e?t&&"+"!==t[t.length-1]&&"-"!==t[t.length-1]&&"*"!==t[t.length-1]&&"/"!==t[t.length-1]&&"("!==t[t.length-1]?vm.$notify({title:"错误",message:"请先输入运算符!",type:"error"}):(this.formule_value=t+"(",this.formule_view=i+"("):t&&"+"!==t[t.length-1]&&"-"!==t[t.length-1]&&"*"!==t[t.length-1]&&"/"!==t[t.length-1]&&"("!==t[t.length-1]?(this.formule_value=t+")",this.formule_view=i+")"):vm.$notify({title:"错误",message:"请先输入代码或数字!",type:"error"})},formuleBack:function(){var e=this.formule_value,t=this.formule_view;if(e){var i=e[e.length-1];if("+"===i||"-"===i||"*"===i||"/"===i||"("===i||")"===i)this.formule_value=e.substring(0,e.length-1),this.formule_view=t.substring(0,t.length-1);else{var r=this.formule_value.split(/[\+\-\*\/\(\)]/);this.formule_value=e.substring(0,e.length-r[r.length-1].length);var n=this.formule_view.split(/[\+\-\*\/\(\)]/);this.formule_view=t.substring(0,t.length-n[n.length-1].length)}}},formulAddOperator:function(e){var t=this.formule_value,i=this.formule_view;if(t){var r=t[t.length-1];"+"===r||"-"===r||"*"===r||"/"===r||"("===r?vm.$notify({title:"错误",message:"请先输入代码或数字!",type:"error"}):(this.formule_value=t+e,this.formule_view=i+e)}else vm.$notify({title:"错误",message:"请先输入代码或数字!",type:"error"})},reInitSDate:function(){this.report_s_month=1,this.report_s_day=1,this.report_s_hours=0,this.report_interval="1"},reIniCheckNode:function(){this.checked_node={nodes:[]}},expendChecked:function(e){var t=this.$refs.dev_tree.store.root.childNodes;this.expendDev(e,t)},checkedchecked:function(e){var t=this.$refs.dev_tree.getNode(e);this.checkedAll(t.childNodes,t.checked)},checkedAll:function(e,t){void 0===e&&(e=this.$refs.dev_tree.store.root.childNodes),void 0===t&&(t=!this.check_all);for(var i=0;i<e.length;i++)void 0!==e[i].data.devType&&e[i].visible&&(e[i].checked=t),e[i].childNodes.length>0&&this.checkedAll(e[i].childNodes,t)},checkedDel:function(){for(var e=this.$refs.dev_tree.getCheckedNodes(),t=0;t<e.length;t++)this.$refs.dev_tree.remove(e[t]),delete this.checked_node[e[t].treeCode]},noneChild:function(){var e=!0;for(var t in this.checked_node)if("nodes"!==t&&this.checked_node[t].devType&&(void 0==this.checked_node[t].children||0==this.checked_node[t].children.length)){this.$confirm("您有设备未添加测点,是否继续下一步?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",callback:function(e,t){if("confirm"==e)vm.substep=Math.roundFixed(++vm.substep);else if("cancel"==e)return!1}}),e=!1;break}e&&(vm.substep=Math.roundFixed(++vm.substep))},statisticFinish:function(){var e=this.$refs.c_tree.getCheckedNodes();if(0==e.length)return this.$alert("请选择要添加的测点","错误",{confirmButtonText:"确定",callback:function(){}}),!1;var t=this.propertyDataOp(e,vm.t_num++,"");this.time_tree=t.arr,this.createXTree(),this.step=!1,this.openedFile={}},totalFinish:function(){this.createYTree();for(var e=0;e<this.checked_total.length;e++){var t=this.checked_total[e];this.time_tree.push({label:t.label,code:t.value,tid:"l_"+this.t_num++})}this.createXTree(),this.step=!1,this.openedFile={}},contrastFinish:function(){for(var e=0,t=[];e<this.checked_contrast.length;e++){var i=this.checked_contrast[e];t.push({label:i.label,code:i.value,tid:"_c"+vm.t_num++})}this.time_tree=t,this.createXTree(),this.step=!1,this.openedFile={}},createXTree:function(){var e=JSON.parse(JSON.stringify(vm.checked_node.nodes));this.dev_tree=e},createYTree:function(){var e,t=this.cur_report_type.value,i=this.sketch.value;e="day"==t||"udf"==t?this.report_s_hours:"year"==t?this.report_s_month:this.report_s_day,e=isNaN(1*e)?1:1*e,this.time_tree=getTimeList(t,e,vm.report_interval,i)},propertyDataOp:function(e,t,i){for(var r={arr:[]},n=0;n<e.length;n++){var o=objClone(e[n]);o.children=[],o.tid=o.tid+"_"+t,o.ptid=o.ptid+"_"+t,void 0===r[o.tid]?r[o.tid]=o:(o.children=r[o.tid].children,r[o.tid]=o);var s=function(){void 0===r[o.ptid]?r[o.ptid]={tid:o.ptid,children:[o]}:r[o.ptid].children.push(o)};0==o.tid.indexOf("p")?this.ck_cd?(o.ptid=i,r.arr.push(r[o.tid])):s():0==o.tid.indexOf("s")?s():this.ck_cd||(o.ptid=i,r.arr.push(r[o.tid]))}return r},addProperty:function(){setTimeout(function(){this.adding=!0});var e=this.$refs.dev_tree.getCheckedNodes(),t=this.$refs.c_tree.getCheckedNodes(),i=this.recursion({recursion:!1},e),r=this.recursion({key:"tid",recursion:!1},t);if(0==e.length||0==t.length)return this.$alert(0==e.length?"请选择要添加测点的设备":"请选择要添加的测点","提示",{confirmButtonText:"确定"}),this.adding=!1,!1;var n=JSON.stringify(r);for(var o in i.d_){var s=this.t_num++,d=JSON.parse(n),l=this.recursion({key:"tid",recursion:!0},i.d_[o].children),a={},c={},h=[];for(var _ in d.t_){var p="";for(var v in l.t_)0===v.indexOf(_)&&(p=v);""===p?(a[d.t_[_].tid]=d.t_[_],h.push(d.t_[_])):c[_]=l.t_[p]}var f={},u={};for(var m in d.p_){var y="";for(var b in l.p_)0===b.indexOf(m)&&(y=b);if(""===y)if(void 0===c[d.p_[m].ptid])f[d.p_[m].tid]=d.p_[m],h.push(d.p_[m]);else{var g=d.p_[m],k=d.p_[m].ptid;g.tid=g.tid+"_"+s,g.ptid=c[k].tid,c[k].children.push(g)}else u[m]=l.p_[y]}var x={};for(var w in d.s_){var N="";for(var S in l.s_)0===S.indexOf(w)&&(N=S);if(""===N)if(void 0===u[d.s_[w].ptid])x[d.s_[w].tid]=d.s_[w],h.push(d.s_[w]);else{var g=d.s_[w],k=d.s_[w].ptid;g.tid=g.tid+"_"+s,g.ptid=u[k].tid,u[k].children.push(g)}}var C=this.propertyDataOp(h,s,i.d_[o].tid);i.d_[o].children=i.d_[o].children.concat(C.arr)}this.adding=!1},delProperty:function(){var e={},t=this.$refs.dev_tree.getCheckedNodes(),i={},r=this.$refs.c_tree.getCheckedNodes();if(e=this.recursion({recursion:!1},t),i=this.recursion({key:"tid",recursion:!1},r),0==t.length||0==r.length)return this.$alert(0==t.length?"请选择要删除测点的设备":"请选择要删除的测点","提示",{confirmButtonText:"确定"}),!1;for(var n in e.d_){var o=e.d_[n].children,s=this.recursion({key:"tid",recursion:!0},o),d="s_";"sy"==this.sketch.value&&(d="p_");for(var l in i[d]){var a="";for(var c in s[d])if(0===c.indexOf(l)){a=c;break}if(""!=a){var h=this.$refs.dev_tree.getNode(s[d][a]).parent;if(this.$refs.dev_tree.remove(s[d][a]),0==h.childNodes.length){var _=h.parent;"dev"!==h.data.nodetype&&(this.$refs.dev_tree.remove(h),"property_type"==_.data.nodetype&&0==_.childNodes.length&&this.$refs.dev_tree.remove(_))}}}}},checkCd:function(e,t){var i=this.$refs.c_tree.getNode(e);this.editNodePanel?i=this.$refs.clone_c_tree.getNode(e):"property_value"==e.nodetype&&console.log(i);var r=i.checked,n=function(e,t){var i=e.childNodes;if(!i[0]){if(e.checked=t,t){vm.cd_info_check.dev=e.data.ptid,vm.cd_info_check.list=[];for(var r=0;r<e.parent.childNodes.length;r++){var o=e.parent.childNodes[r];1==o.checked&&vm.cd_info_check.list.push({code:o.data.code,index:r})}}return!1}if(t){if(e.checked=!0,"property"!==e.data.nodetype||e.data.ptid==vm.cd_info_check.dev)return n(i[0],!0);for(var r=0,s=!0;r<vm.cd_info_check.list.length;r++){var d=vm.cd_info_check.list[r];e.childNodes[d.index]&&e.childNodes[d.index].data.code==d.code&&(s=!1,e.childNodes[d.index].checked=!0)}s&&(e.childNodes[0].checked=!0)}else{e.checked=!1;for(var r=0;r<i.length;r++)i[r].checked&&n(i[r],!1);
|
|
}};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.getNode(t).parent.data:this.$refs.c_tree.getNode(t).parent.data),this.filter_q?this.filter_c?0==t.tid.indexOf("p")?r=this.filterMulty(t.label,n):0==t.tid.indexOf("s")&&(r=this.filterMulty(t.label,o)&&this.filterMulty(i.label,n)):0==t.tid.indexOf("s")&&(r=this.filterMulty(t.label,o)):0==t.tid.indexOf("p")?r=this.filterMulty(t.label,n):0==t.tid.indexOf("s")&&(r=this.filterMulty(i.label,n)),r},filter_all_dev_enter:function(){var e=this.filter_all_dev;this.step?this.$refs.adev_tree.filter(e):this.editNodePanel&&this.$refs.clone_adev_tree.filter(e)},filter_check_dev_enter:function(){var e=this.filter_check_dev;this.$refs.dev_tree.filter(e)},filter_c_enter:function(){var e=this.filter_c;this.step?this.$refs.c_tree.filter(e):this.editNodePanel&&this.$refs.clone_c_tree.filter(e)},filter_q_enter:function(){var e=this.filter_q;this.step?this.$refs.c_tree.filter(e):this.editNodePanel&&this.$refs.clone_c_tree.filter(e)},filterCheckNode:function(e,t){if(!e||"dev_type"===t.nodetype)return!0;var i=e.split(/\s+/g),r=t;if("dev"!==r.nodetype)do{var n=this.$refs.dev_tree.getNode(r).parent;r=n?n.data:r}while(n&&"dev"!==r.nodetype);return this.filterMulty(r.label,i)},filterDevNode:function(e,t){if(!e)return!0;var i=e.split(/\s+/g);if(this.step){this.$refs.adev_tree.getNode(t)}else{this.$refs.clone_adev_tree.getNode(t)}var r=!1;return r="code"==this.filter_all_dev_type?this.filterMulty(t.code,i):this.filterMulty(t.label,i)},filterMulty:function(e,t){for(var i=0,r=!1;i<t.length;i++)""!==t[i]&&void 0!==t[i]&&null!==t[i]&&e.indexOf(t[i])!==-1&&(r=!0);return r},setTableType:function(e){this.cur_report_type=e,this.sketch=e.type[0],(""===this.sketch_index||void 0===this.sketch_index||this.sketch_index>this.cur_report_type.type.length-1)&&(this.sketch_index=0),this.reInitSDate()},changeReportType:function(){var e=this.sketch.value,t=Math.floor(vm.substep);"yx"===e?this.substep=t:"dd"===e?this.substep=t+.01:"bb"===e?this.substep=t+.02:"cr"===e?this.substep=t+.03:"tj"===e?(this.substep=t+.05,this.reIniCheckNode()):"db"===e?this.substep=t+.06:"qx"===e&&(this.substep=t+.07)},reportIntervalClear:function(){this.report_interval=""},preview:function(){var e=JSON.parse(JSON.stringify({vm:vm.$data}));deleteReportFileItem(e),delete e.vm.checked_node,sessionStorage.setItem("dev_tree",pako.gzip(JSON.stringify(e.vm.dev_tree),{to:"string"})),delete e.vm.dev_tree,sessionStorage.setItem("vm",pako.gzip(JSON.stringify(e.vm),{to:"string"}))},menuSelect:function(e){if(4==e)this.configure=!0;else if(6==e);else if("1-1"==e)vm.filter_check_dev="",vm.filter_c="",vm.filter_q="",vm.filter_all_dev="",vm.filter_all_dev_type="name",0!=this.substep?this.$confirm("是否清除现有报表向导数据?","",{confirmButtonText:"是,从空白新建",cancelButtonText:"否,从现有新建",type:"warning",callback:function(e,t){"cancel"!==e&&(vm.cur_report_type=vm.report_types[0],vm.sketch=vm.report_types[0].type[0],vm.cur_report_style=vm.report_style[0],vm.sketch_index=0,vm.report_s_month=1,vm.report_s_day=1,vm.report_s_hours=0,vm.report_interval="1",vm.check_station=vm.station[0].id,vm.check_profession=vm.profession[0].id,vm.postDev(),vm.ck_cd=!0,vm.ck_cy=!0,vm.ck_sx=!0,vm.checked_node={nodes:[]},vm.checked_total_index=[],vm.checked_contrast_index=[],vm.cd_info_check={list:[]},vm.cols_width=[]),vm.substep=0,vm.step=!0}}):(this.substep=0,this.step=!0);else if("1-2"==e)this.reportFilesPanel=!0,this.isSave=!1;else if("1-3"==e){var t=JSON.parse(JSON.stringify({vm:vm.$data}));deleteReportFileItem(t),vm.openedFile.treeCode?this.$confirm('确定保存到报表"'+vm.openedFile.name+'"?',"",{confirmButtonText:"保存修改",cancelButtonText:"打开报表库",type:"warning",callback:function(e,i){"cancel"==e?(vm.reportFilesPanel=!0,vm.isSave=!0):(vm.openedFile.fileDetail=JSON.stringify(t),auReport(vm.openedFile))}}):(vm.reportFilesPanel=!0,vm.isSave=!0)}},tabClick:function(){},querySearchFont:function(e,t){t([{name:"宋体",value:"宋体",v:"SimSun"},{name:"新宋体",value:"新宋体",v:"SimSun"},{name:"仿宋",value:"仿宋",v:"SimSun"},{name:"楷体",value:"楷体",v:"SimSun"},{name:"黑体",value:"黑体",v:"SimSun"},{name:"微软雅黑",value:"微软雅黑",v:"Microsoft YaHei"},{name:"Arial",value:"Arial",v:"Arial"},{name:"Arial Black",value:"Arial Black",v:"Arial Black"},{name:"Times New Roman",value:"Times New Roman",v:"Times New Roman"},{name:"Courier New",value:"Courier New",v:"Courier New"},{name:"Tahoma",value:"Tahoma",v:"Tahoma"},{name:"Verdana",value:"Verdana",v:"Verdana"}])},querySearchSize:function(e,t){t([{value:"12px"},{value:"14px"},{value:"22px"},{value:"30px"},{value:"46px"}])},handleComplete:function(){},handleIconClick5:function(){this.state5=""},handleIconClick6:function(){this.state6=""},changeStyle:function(e){this.sidetabs="table",this.radio_form=e}},watch:{cols_parent:function(e){var t=this.devtree_to_option;this.protree_to_option=[],Array.prototype.push.apply(vm.protree_to_option,t[e].children)},checked_dev_index:function(e){var t=this.check_dev[e];return!!t&&(this.dev_name_text=t.label,this.dev_code_text=t.code,void(this.edit_node_type=t.nodetype))},radio_form:function(e,t){vm.form=vm[e]},show_field:function(e){this.$set(vm.dev_field,"label",e?"code":"label")},dev_tree:function(e,t){if(reiniting)return!1;var i=JSON.stringify(e),r=dataOp(JSON.parse(i),"x_tree");this.dev_map=getLastNode(JSON.parse(i));var n=this.border_style+";"+this.th_style,o="";if(this.time_map.length>0){var s,d,l=dataOp(JSON.parse(JSON.stringify(vm.time_tree)),"y_tree");0==this.cur_report_style.value?(o=widthTd(l.length,vm.dev_map.length),s=creatTHRow(r,l.length,n).str,d=creatTHCol(l,new Array(vm.dev_map.length+1).join('<td style="'+this.border_style+'"><div> </div></td>'),n)):(o=widthTd(r.length,vm.time_map.length),s=creatTHRow(l,r.length,n).str,d=creatTHCol(r,new Array(vm.time_map.length+1).join('<td style="'+this.border_style+'"><div> </div></td>'),n)),this.table="<thead>"+o+s+"</thead><tbody>"+d+"</tbody>"}for(var a=0,c=0;a<vm.cols_width.length;a++)c+=1*vm.cols_width[a];vm.tb_width=c+"px",setTimeout(function(){document.getElementById("table").style.width=vm.tb_width},20)},time_tree:function(e,t){if(reiniting)return!1;var i=JSON.stringify(e),r=dataOp(JSON.parse(i),"y_tree");this.time_map=getLastNode(JSON.parse(i));var n=this.border_style+";"+this.th_style,o="";if(this.dev_map.length>0){var s,d,l=dataOp(JSON.parse(JSON.stringify(vm.dev_tree)),"x_tree");new Array(vm.time_map.length+1).join('<td style="'+this.border_style+'"><div> </div></td>');0!=this.cur_report_style.value?(o=widthTd(l.length,vm.time_map.length),s=creatTHRow(r,l.length,n).str,d=creatTHCol(l,new Array(vm.time_map.length+1).join('<td style="'+this.border_style+'"><div> </div></td>'),n)):(o=widthTd(r.length,vm.dev_map.length),s=creatTHRow(l,r.length,n).str,d=creatTHCol(r,new Array(vm.dev_map.length+1).join('<td style="'+this.border_style+'"><div> </div></td>'),n)),this.table="<thead>"+o+s+"</thead><tbody>"+d+"</tbody>"}for(var a=0,c=0;a<vm.cols_width.length;a++)c+=1*vm.cols_width[a];vm.tb_width=c+"px",setTimeout(function(){document.getElementById("table").style.width=vm.tb_width},20)}},created:function(){var e=this;this.contrasts=getAllContrasts(),this.all_totals=getALLTotals(),init(e)},directives:{treefocus:{update:function(e,t,i,r){var n=e.getElementsByTagName("input")[0];if(n.focus(),o==s&&vm.input_focus&&"none"!==i.elm.style.display){var o=i.data.props.value,s=r.data.props.value;n.select(),vm.input_focus=!1}}}}});Math.roundFixed=function(e,t){t||(t=2);var i=Math.pow(10,t);return Math.round(e*i)/i}; |