张卓
2022-09-29 4ef1c909df36c48f7f040e9ec408fc15e6745e71
1
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4260e5ce"],{15:function(e,t){},16:function(e,t){},17:function(e,t){},"8d54":function(e,t,a){"use strict";a("9bfa")},"9bfa":function(e,t,a){},d240:function(e,t,a){"use strict";a.r(t);var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticStyle:{width:"100%"}},[a("div",{staticClass:"topSelect"},[a("div",[a("el-select",{staticStyle:{width:"300px"},attrs:{multiple:"","collapse-tags":"",placeholder:"请选择国控站点"},model:{value:e.value,callback:function(t){e.value=t},expression:"value"}},e._l(e.options,(function(e){return a("el-option",{key:e.id,attrs:{label:e.name,value:e.guid}})})),1),e._v(" "),a("el-date-picker",{staticStyle:{"margin-left":"20px"},attrs:{"picker-options":e.pickerOptions,type:"date",placeholder:"选择日期","value-format":"yyyy-MM-dd"},model:{value:e.dateValue,callback:function(t){e.dateValue=t},expression:"dateValue"}})],1),e._v(" "),a("div",[a("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.queryHourData()}}},[e._v("查询")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.setExport2Excel()}}},[e._v("报表导出")])],1)]),e._v(" "),a("div",{staticClass:"topTitle"},[a("el-table",{staticStyle:{height:"760px","overflow-y":"auto"},attrs:{id:"mytable",data:e.tableData,"row-style":{padding:"1px"},"header-cell-style":{padding:"6px"},"cell-style":{padding:"0.5px"},"cell-class-name":e.tableCellClassName}},[e.govMtC.length>0?a("el-table-column",{staticStyle:{height:"30px"},attrs:{label:e.title,align:"center",height:"30"}},[a("el-table-column",{staticStyle:{height:"30px"},attrs:{label:"",align:"center"}},[a("el-table-column",{attrs:{prop:"time",label:"时间",width:"60%",align:"center"}})],1),e._v(" "),e._l(e.govMtC,(function(t,o){return a("el-table-column",{key:o,staticStyle:{height:"30px"},attrs:{label:t.name,align:"center"}},e._l(e.sensorArr,(function(e,o,n){return a("el-table-column",{key:n,attrs:{align:"center",prop:e.code+"_"+t.id,label:e.name,width:"60",height:"30"}})})),1)})),e._v(" "),e.govMtC.length>0?a("el-table-column",{attrs:{prop:"aqi",label:"AQI",width:"60%",align:"center"}}):e._e(),e._v(" "),e.govMtC.length>0?a("el-table-column",{attrs:{prop:"pollutant",label:"首要污染物",width:"150%",align:"center"}}):e._e()],2):e._e()],1)],1)])},n=[],l=a("53ca"),r=(a("34ef"),a("c5f6"),a("a481"),a("28a5"),a("7f7f"),a("ac6a"),a("1146")),i=a.n(r),s=a("1088"),c=a.n(s),u={data:function(){return{tableData:[],govMt:[],value:[],dateValue:"",pickerOptions:{disabledDate:function(e){return e.getTime()>Date.now()}},options:[],sensorArr:[{code:"a34004",name:"PM2.5"},{code:"a34002",name:"PM10"},{code:"a21026",name:"SO2"},{code:"a21004",name:"NO2"},{code:"a21005",name:"CO"},{code:"a05024",name:"O3_1h"},{code:"O3_8h",name:"O3_8h"}],aqi:{code:"aqi",name:"AQI"},levelSensor:{a34004:[35,75,115,150,250],a34002:[50,150,250,350,420],a21026:[150,500,650,800,1600],a21004:[100,200,700,1200,2340],a21005:[5,10,35,60,90],a05024:[160,200,300,400,800],O3_8h:[100,160,215,265,800],aqi:[50,100,150,200,300]},title:""}},computed:{govMtC:function(){var e="c",t=[];return this.govMt.forEach((function(a){var o=!1;e!==a.name&&(o=!0);var n={};n={id:a.id,name:a.name,showData:o},t.push(n),e=a.name})),t}},created:function(){this.getGovData()},methods:{tableCellClassName:function(e){var t=e.row,a=e.column;e.rowIndex,e.columnIndex;for(var o in t)if(-1!==o.indexOf("_")){if(o===a.property){var n=a.property.split("_")[0];return"O3"===n&&(n=a.property.split("_")[0]+"_"+a.property.split("_")[1]),0===t[o]||""===t[o]||null===t[o]?"":t[o]<=this.levelSensor[n][0]?"green":t[o]<=this.levelSensor[n][1]?"yellow":t[o]<=this.levelSensor[n][2]?"orange":t[o]<=this.levelSensor[n][3]?"red":t[o]<=this.levelSensor[n][4]?"oRed":"violet"}}else if("aqi"===o&&o===a.property)return 0===t[o]||""===t[o]||null===t[o]?"":t[o]<=50?"green":t[o]<=100?"yellow":t[o]<=150?"orange":t[o]<=200?"red":t[o]<=300?"oRed":"violet";return""},queryHourData:function(){for(var e=this,t="",a=0;a<this.value.length;a++)t=a!==this.value.length-1?t+""+this.value[a]+",":t+""+this.value[a];""!==this.dateValue?""!==t?this.$request({url:"/govMonitorPoint/queryGovMonitorPointHourlyDataByGuidsAndOrgid",method:"get",params:{organization_id:this.$store.state.orgId,guids:t,date:this.dateValue}}).then((function(t){if(0===t.code)if(t.data.govMonitorPoint.length>0){e.govMt=t.data.govMonitorPoint;var a="";if(e.govMt.length>1)for(var o=0;o<e.govMt.length-1;o++)a=o!==e.govMt.length-2?a+""+e.govMt[o].name+"、":a+""+e.govMt[o].name;e.title=e.dateValue+"日 "+a+" 六因子浓度小时播报",e.tableData=t.data.data}else e.$message.warning("所选站点该时间无数据!")})):this.$message.warning("请选择国控站点"):this.$message.warning("请选择时间")},getGovData:function(){var e=this;this.$request({url:"/govMonitorPoint/getGovMonitorPointsByOrgId",method:"get",params:{organization_id:this.$store.state.orgId}}).then((function(t){0===t.code&&(e.options=t.data)})).catch((function(e){console.log(e)}))},setExport2Excel:function(){var e=i.a.utils.table_to_sheet(document.querySelector("#mytable"));if(e["!merges"]){for(var t=1+7*this.govMt.length+2,a=0;a<t;a++)e["!cols"][a]=a===t-1?{wpx:120}:{wpx:60};var o=[];for(var n in e)if(-1===n.indexOf("!")){e[n].s={font:{sz:13,bold:!1,color:{rgb:"000000"}},border:{top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}},alignment:{horizontal:"center",vertical:"center",wrap_text:!0}};var l=n.replace(/[^0-9]/gi,"");if("3"===l){for(var r={},s=0;s<this.sensorArr.length;s++)if(this.sensorArr[s].name===e[n].v){var c=n.replace(/[^a-z]+/gi,"");r.key=c,r.code=this.sensorArr[s].code;break}r.key&&o.push(r)}else if("2"===l){var u={};if(this.aqi.name===e[n].v){c=n.replace(/[^a-z]+/gi,"");u.key=c,u.code=this.aqi.code}u.key&&o.push(u)}}for(var d in e){c=d.replace(/[^a-z]+/gi,"");for(var h=0;h<o.length;h++)c===o[h].key&&"number"===typeof e[d].v&&(e[d].v<=this.levelSensor[o[h].code][0]?e[d].s.fill={fgColor:{rgb:"00e400"}}:e[d].v<=this.levelSensor[o[h].code][1]?e[d].s.fill={fgColor:{rgb:"ffff00"}}:e[d].v<=this.levelSensor[o[h].code][2]?e[d].s.fill={fgColor:{rgb:"ff7e00"}}:e[d].v<=this.levelSensor[o[h].code][3]?e[d].s.fill={fgColor:{rgb:"ff0000"}}:e[d].v<=this.levelSensor[o[h].code][4]?e[d].s.fill={fgColor:{rgb:"99004c"}}:e[d].s.fill={fgColor:{rgb:"7e0023"}})}var v=this.addRangeBorder(e["!merges"],e),g=this.sheet2blob(v);this.openDownloadDialog(g,this.title+"-数据报表.xlsx")}else this.$message.warning("无法导出:报表无数据")},addRangeBorder:function(e,t){var a=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];return e.forEach((function(e){for(var o=Number(e.s.r),n=Number(e.e.r),l=Number(e.s.c),r=Number(e.e.c),i=t[a[l]+(o+1)],s=o;s<=n;s++)for(var c=l;c<=r;c++)t[a[c]+(s+1)]=i})),t},sheet2blob:function(e,t){t=t||"sheet1",console.log(t,"sheetName");var a={SheetNames:[t],Sheets:{}};a.Sheets[t]=e;var o={bookType:"xlsx",bookSST:!1,type:"binary"},n=c.a.write(a,o),l=new Blob([r(n)],{type:"application/octet-stream"});function r(e){for(var t=new ArrayBuffer(e.length),a=new Uint8Array(t),o=0;o!==e.length;++o)a[o]=255&e.charCodeAt(o);return t}return l},openDownloadDialog:function(e,t){"object"===Object(l["a"])(e)&&e instanceof Blob&&(e=URL.createObjectURL(e));var a,o=document.createElement("a");o.href=e,o.download=t||"",window.MouseEvent?a=new MouseEvent("click"):(a=document.createEvent("MouseEvents"),a.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null)),o.dispatchEvent(a)}}},d=u,h=(a("8d54"),a("2877")),v=Object(h["a"])(d,o,n,!1,null,"139e20f6",null);t["default"]=v.exports}}]);