UNPKG

manage-client

Version:

经营管控模块前台组件

586 lines (571 loc) 31.1 kB
import {HttpResetClass} from "vue-client"; // 待传入sql的参数 export var param = '' export var param1 = '' export var param2 = '' //请求后台数据,self=this,conditon=查询条件,singleTableParam内容为 select {items} from {tablename} where {condition} export function getData(self,sqlname, condition, resultname) { var ss='' console.log(self.$parent.$parent.$parent.typemodel,self.$parent.$parent.$parent.typemodel,'dsds') if(self.$parent.$parent.typemodel!=undefined){ ss=self.$parent.$parent.typemodel } let load = new HttpResetClass(); load.load("POST", 'api/af-revenue/sql/' + ss + 'jy' + sqlname, {data: condition}, {resolveMsg: null, rejectMsg: null}) .then((res) => { console.log(sqlname, res.data, '返回数据') // 返回数据给resdata self[resultname] = res.data }) } export function getData1(self, sqlname, condition, resultname) { let load = new HttpResetClass(); load.load("POST", 'api/af-revenue/sql/' + sqlname, {data: condition}, {resolveMsg: null, rejectMsg: null}) .then((res) => { console.log(sqlname, res.data, '返回数据') // 返回数据给resdata self[resultname] = res.data }) } // 获取sql,titlt=所属分类页面name,param=当前页面中所属的模块名,返回结果=所需的sql条件 // export function getSql(title, param) { // //Sql配置,items=查询列名,tablename=表名,condition=条件 // var Sql = { // //====================================主页============================================= // // 主页 // Manage: { // //获取安全服务时间 // home: { // items: 'f_createfile_date stardate', // tablename: "(select f_createfile_date from t_userinfo where f_user_state='正常' order by f_createfile_date asc)", // condition: "rownum=1", // orderitem: "1" // }, // //用户数据 // user: { // items: '(aa.qq-cc.ee) 民用, bb.ww 非民用, cc.ee 民用锅炉', // tablename: '(select count(f_userinfo_id) qq from t_userinfo where f_user_type=\'民用\' and f_user_state=\'正常\') aa,' + // '(select count(f_user_type) ww from t_userinfo where f_user_type=\'非民用\' and f_user_state=\'正常\') bb,' + // '(select count(b.f_userinfo_id) ee from t_userinfo a, t_devices b where a.f_userinfo_id=b.f_userinfo_id and f_devices_type=\'壁挂炉\' and a.f_user_type=\'民用\' and f_user_state=\'正常\') cc', // condition: "1=1", // orderitem: "1" // }, // // 潜在用户 // useri: { // items: 'a.ss year,a.totalnum', // tablename: '(SELECT ss,count(ss) totalnum from (SELECT to_char(f_createfile_date,\'yyyy\') ss from T_USERINFO ' + // 'where f_user_state=\'正常\') GROUP BY ss )a ', // condition: "1=1", // orderitem: "ss desc" // }, // // 报建用户 // userapply: { // items: 'count(1) totalnum', // tablename: 't_applyback', // condition: "1=1", // orderitem: "1" // }, // //总售气量 // pregas: { // items: 'sum(f_pregas) as value', // tablename: 'A_GASCOMPARISON', // condition: 'f_delivery_date>=TO_DATE(\'' + this.param + '-01-01 00:00:00\',\'yyyy-mm-dd hh24:mi:ss\')', // orderitem: '1' // }, // //物联网监控 // monitor: { // items: 'a1.aa 磁干扰,b1.bb 报警关阀,c1.cc 周期关阀,d1.dd 过流保护关阀,e1.ee 关阀走气', // tablename: '(SELECT count(f_userinfo_id) aa from T_METEREAD WHERE f_magneticInterference=1 ) a1,' + // '(SELECT count(f_userinfo_id) bb from T_METEREAD WHERE f_alarmShutValve=1 ) b1,' + // '(SELECT count(f_userinfo_id) cc from T_METEREAD WHERE f_cycleShutValue=1 ) c1,' + // '(SELECT count(f_userinfo_id) dd from T_METEREAD WHERE f_overCurrentProtection=1 ) d1,' + // '(SELECT count(f_userinfo_id) ee from T_METEREAD WHERE f_leakageFlag=1 ) e1', // condition: "1=1", // orderitem: "1" // }, // //警告用户数量统计 // warningcount: { // items: '*', // tablename: 'V_WARNCOUNT', // condition: '1=1', // orderitem: '1' // } // }, // // //===================================用户========================================= // //用户 // User: // { // //用户数据 // usernum: { // items: '(aa.qq-cc.ee) 民用, bb.ww 非民用, cc.ee 民用锅炉', // tablename: // '(select count(f_userinfo_id) qq from t_userinfo where f_user_type=\'民用\' and f_user_state=\'正常\') aa,' + // '(select count(f_user_type) ww from t_userinfo where f_user_type=\'非民用\' and f_user_state=\'正常\') bb,' + // '(select count(b.f_userinfo_id) ee from t_userinfo a, t_devices b where a.f_userinfo_id=b.f_userinfo_id and f_devices_type=\'壁挂炉\' and a.f_user_type=\'民用\' and f_user_state=\'正常\') cc', // condition: // "1=1", // orderitem: "1" // }, // //用户增长 // userincrease: { // items: 'a.ss year,a.totalnum,b.civiluse,c.nociviluse', // tablename: // '(select ss,count(ss) totalnum from (select to_char(f_createfile_date,\'yyyy\') ss from t_userinfo ' + // 'where f_user_state=\'正常\') group by ss)a,' + // '(select ss,count(ss) civiluse from (select to_char(f_createfile_date,\'yyyy\') ss from t_userinfo' + // ' where f_user_state=\'正常\' and f_user_type=\'民用\')group by ss)b,' + // '(select ss,count(ss) nociviluse from (select to_char(f_createfile_date,\'yyyy\') ss from t_userinfo ' + // 'where f_user_state=\'正常\' and f_user_type=\'非民用\')group by ss)c', // condition: // "a.ss=b.ss and b.ss=c.ss ", // orderitem: "year desc" // }, // // 主要用户 // usergas: { // items: '* FROM (SELECT F_USER_NAME name,SUM(F_PREGAS) value', // tablename: // 'A_MAINUSER', // condition: // "F_DELIVERY_DATE >= TO_DATE (\'" + this.param + "-01-01 00:00:00\',\'yyyy-mm-dd hh24:mi:ss\') GROUP BY F_USER_NAME ORDER BY value DESC) WHERE ROWNUM <= 5", // orderitem: "value desc" // }, // // 售气同比 // salegas: { // items: 'to_char(F_DELIVERY_DATE,\'yyyy-mm\') name,sum(F_COLLECTION) value', // tablename: 'A_GASCOMPARISON', // condition: // "F_DELIVERY_DATE >= TO_DATE (\'" + this.param + "-01-01 00:00:00\',\'yyyy-mm-dd hh24:mi:ss\') GROUP BY to_char(F_DELIVERY_DATE,'yyyy-mm')", // orderitem: "name" // }, // //报建 // apply: { // items: 'count(1) value,f_gasprope name', // tablename: 't_applyback', // condition: "1=1 group by f_gasprope", // orderitem: "1" // }, // //用气性质 // gasdistri: { // items: this.param + 'a.f_gasproperties,count(a.f_userinfo_id) as num', // tablename: // 't_userinfo a,t_userfiles b,t_stairprice c', // condition: // "a.f_user_state='正常' and b.f_table_state='正常' and c.f_state='有效' and a.f_userinfo_id=b.f_userinfo_id and b.f_price_id=c.f_price_id" + // " group by " + this.param + "a.f_gasproperties", // orderitem: "a.f_gasproperties desc" // } // , // } // , // // //=====================================安检===================================== // //安检 // Check: { // //安检计划 // noplancheck: { // items: 'userinfo.num as totalsafe,checks.num as complete,nvl(userinfo.num-checks.num,0) as undone', // tablename: // '(select count(f_userinfo_id) num from t_userinfo where f_user_state=\'正常\') userinfo,' + // '(select count(f_userinfo_id) num from t_check_plan where f_userstate=\'正常\') checks', // condition: // '1=1', // orderitem: "1" // }, // // // 安检状态 // safestatus: { // items: 'f_last_check_state name,count(*) value', // tablename: // 'T_CHECK_PLAN', // condition: // '1=1 GROUP BY f_last_check_state', // orderitem: "1" // }, // //安检用户类型 // safeusertype: { // items: 'f_user_type name,count(*) value', // tablename: // 'T_CHECK_PLAN', // condition: // '1=1 GROUP BY f_user_type', // orderitem: "1" // }, // //安检员任务统计 // checkertask: { // items: 'f_checker name,count(*) value', // tablename: // 'T_CHECK_PLAN', // condition: // '1=1 GROUP BY f_checker', // orderitem: "value desc" // }, // // 隐患分布 // danger: { // items: 'name,value', // tablename:'(select \'擅自改动燃气管道及设施\' name,sum(plumbing) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'用户改变用气环境\' name,sum(environment) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'燃气设施房间内住人\' name,sum(accommodate) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'告诉用户应该定期清除厨油污\' name,sum(cookingoil) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'未安装燃气泄露报警器\' name,sum(annunciator) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'未安装防爆照明灯\' name,sum(floodlight) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'管道作为其他电器设备的地接线\' name,sum(groundconnection) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\')union all ' + // 'select \'管道及其气表上有物体搭挂\' name,sum(hitched) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'连接灶具软管不牢固\' name,sum(flexiblehose) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'软管长度超过两米\' name,sum(piplong) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'软管使用超过两年\' name,sum(yearlong) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'告知用户更换软管\' name,sum(changeflexi) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'管道生锈\' name,sum(pipelinecorrosion) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'告知用户定期更换点火棒胶管\' name,sum(boosterhose) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'连接不牢固\' name,sum(strongconnection) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'存在其他安全隐患\' name,sum(hiddendanger) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'私拉乱接\' name,sum(diepullrandomaccess) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'厨房住人\' name,sum(livekitchen) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'厨房无隔断\' name,sum(nopartition) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'软管过长\' name,sum(hosetoolong) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'气表包裹\' name,sum(gmeterpackage) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'通风不良\' name,sum(ventilation) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'两种火源\' name,sum(twofire) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'私接三通\' name,sum(connectthree) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'燃气设备安装在浴室,卫生间\' name,sum(gasappliance) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'改变用气性质\' name,sum(changeproperties) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // 'union all ' + // 'select \'其他隐患\' name,sum(otherrisks) VALUE ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" and f_check_date>=to_date(\''+this.param+' 00:00:00\',\'yyyy-MM-dd hh24:mi:ss\') and ' + // 'f_check_date<=to_date(\''+this.param1+' 23:59:59\',\'yyyy-MM-dd hh24:mi:ss\') ' + // ') hiddendanger ', // condition: // 'value>0', // orderitem: "1" // }, // //隐患统计 // hiddennum: { // items: 'name,value', // tablename: '(select \'隐患数\' name, ' + // 'count(*) value ' + // 'from( ' + // 'select count(*) ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" ' + // 'where ' + // 'plumbing = 1 OR ' + // 'environment = 1 OR ' + // 'accommodate = 1 OR ' + // 'cookingoil = 1 OR ' + // 'annunciator = 1 OR ' + // 'floodlight = 1 OR ' + // 'groundconnection = 1 OR ' + // 'hitched = 1 OR ' + // 'flexiblehose = 1 OR ' + // 'piplong = 1 OR ' + // 'yearlong = 1 OR ' + // 'changeflexi = 1 OR ' + // 'pipelinecorrosion = 1 OR ' + // 'boosterhose = 1 OR ' + // 'strongconnection = 1 OR ' + // 'hiddendanger = 1 OR ' + // 'diepullrandomaccess = 1 OR ' + // 'livekitchen = 1 OR ' + // 'nopartition = 1 OR ' + // 'hosetoolong = 1 OR ' + // 'gmeterpackage = 1 OR ' + // 'ventilation = 1 OR ' + // 'twofire = 1 OR ' + // 'connectthree = 1 OR ' + // 'gasappliance = 1 OR ' + // 'changeproperties = 1 OR ' + // 'otherrisks = 1 ' + // 'group by a.F_USERINFO_ID) ' + // 'union all ' + // 'select \'已修隐患\' name, ' + // 'count(*) value ' + // 'from( ' + // 'select count(*) ' + // 'from T_HINVESTIGATION b ' + // 'join T_CHECK_PLAN a on a."ID" = b."ID" ' + // 'where ' + // '(plumbing = 0 or plumbing is null) and ' + // '(environment = 0 or environment is null) and ' + // '(accommodate = 0 or accommodate is null) and ' + // '(cookingoil = 0 or cookingoil is null) and ' + // '(annunciator = 0 or annunciator is null) and ' + // '(floodlight = 0 or floodlight is null) and ' + // '(groundconnection = 0 or groundconnection is null) and ' + // '(hitched = 0 or hitched is null) and ' + // '(flexiblehose = 0 or flexiblehose is null) and ' + // '(piplong =0 or piplong is null) and ' + // '(yearlong = 0 or yearlong is null) and ' + // '(changeflexi = 0 or changeflexi is null) and ' + // '(pipelinecorrosion = 0 or pipelinecorrosion is null) and ' + // '(boosterhose = 0 or boosterhose is null) and ' + // '(strongconnection = 0 or strongconnection is null) and ' + // '(hiddendanger = 0 or hiddendanger is null) and ' + // '(diepullrandomaccess =0 or diepullrandomaccess is null) and ' + // '(livekitchen =0 or livekitchen is null) and ' + // '(nopartition =0 or nopartition is null) and ' + // '(hosetoolong =0 or hosetoolong is null) and ' + // '(gmeterpackage =0 or gmeterpackage is null) and ' + // '(ventilation =0 or ventilation is null) and ' + // '(twofire =0 or twofire is null) and ' + // '(connectthree =0 or connectthree is null) and ' + // '(gasappliance =0 or gasappliance is null) and ' + // '(changeproperties =0 or changeproperties is null) and ' + // '(otherrisks =0 or otherrisks is null) ' + // 'group by a.F_USERINFO_ID) ' + // ') hiddendanger ', // condition: ' value>0', // orderitem: "1" // }, // }, // // // //监控 // Monitor: { // // 表品牌分布 // meterbrand: { // items: '* FROM (SELECT t.F_METER_BRAND as name,u.count as value from T_GASBRAND t,(SELECT F_GASBRAND_ID as Id,COUNT(F_GASBRAND_ID) as count', // tablename: 'T_USERFILES TF,T_USERINFO TI WHERE TF.F_USERINFO_ID = TI.F_USERINFO_ID GROUP BY F_GASBRAND_ID) u', // condition: 'u.id = t.ID ORDER BY count DESC) WHERE ROWNUM <=5', // orderitem: "value desc" // }, // //监控中心 // monitorcenter: { // items: 'aa.num-bb.num name1,bb.num name2', // tablename: '(SELECT count(f_userinfo_id) num from T_USERINFO where F_USER_STATE=\'正常\' )aa,' + // '(SELECT count(ti.f_userinfo_id) num from T_USERINFO ti,T_USERFILES tf where ti.f_userinfo_id=tf.f_userinfo_id ' + // 'and ti.F_USER_STATE=\'正常\' and TF.f_meter_classify= \'物联网表\')bb', // condition: '1=1', // orderitem: '1' // }, // //售差比 // buysub: { // items: "YEAR,NVL (minyong * buysub, 0) AS mingyong,NVL (gongye * buysub, 0) AS gongye, NVL (bigua * buysub, 0) AS bigua," + // "NVL (minyong * buysub, 0) + NVL (gongye * buysub, 0) + NVL (bigua * buysub, 0) AS SUM,NVL (menzhan, 0) AS menzhan,buysub", // tablename: // "(SELECT A .*, b.gongye,c.bigua,l.menzhan,bs.buysub FROM (SELECT TO_NUMBER (TO_CHAR (ts.F_DELIVERY_DATE, 'yyyy')) AS YEAR," + // "SUM (ts.F_PREAMOUNT) AS minyong FROM t_sellinggas ts,t_devices td WHERE ts.f_user_id = td.F_USERINFO_ID AND ts.F_USER_TYPE = '民用' " + // "AND ts.F_DELIVERY_DATE >= TO_DATE (\'" + this.param + "\','yyyy-MM-dd hh24:mi:ss') AND ts.F_DELIVERY_DATE <= " + // "TO_DATE (\'" + this.param1 + "\','yyyy-MM-dd hh24:mi:ss') GROUP BY TO_NUMBER (TO_CHAR (ts.F_DELIVERY_DATE, 'yyyy'))) A LEFT JOIN " + // "(SELECT TO_NUMBER (TO_CHAR (ts.F_DELIVERY_DATE, 'yyyy')) AS YEAR,SUM (ts.F_PREAMOUNT) AS gongye FROM t_sellinggas ts,t_devices " + // "td WHERE ts.f_user_id = td.F_USERINFO_ID AND ts.F_USER_TYPE = '非民用'AND ts.F_DELIVERY_DATE >= TO_DATE (\'" + this.param + "\','yyyy-MM-dd hh24:mi:ss') " + // "AND ts.F_DELIVERY_DATE <= TO_DATE (\'" + this.param1 + "\','yyyy-MM-dd hh24:mi:ss') GROUP BY TO_NUMBER (TO_CHAR (ts.F_DELIVERY_DATE, 'yyyy'))) " + // "b ON A . YEAR = b. YEAR LEFT JOIN (SELECT TO_NUMBER (TO_CHAR (ts.F_DELIVERY_DATE, 'yyyy')) AS YEAR,SUM (ts.F_PREAMOUNT) AS bigua FROM t_sellinggas ts,t_devices " + // "td WHERE ts.f_user_id = td.F_USERINFO_ID AND td.f_devices_type = '壁挂炉' AND ts.F_USER_TYPE = '民用' AND ts.F_DELIVERY_DATE >= TO_DATE (\'" + this.param + "\', 'yyyy-MM-dd hh24:mi:ss')" + // " AND ts.F_DELIVERY_DATE <= TO_DATE (\'" + this.param1 + "\', 'yyyy-MM-dd hh24:mi:ss') GROUP BY TO_NUMBER (TO_CHAR (ts.F_DELIVERY_DATE, 'yyyy'))) c ON b. YEAR = c. YEAR LEFT JOIN " + // " (SELECT TO_NUMBER (SUBSTR(f_gasdate, 1, 4)) AS YEAR, NVL (SUM(f_gasmun), 0) AS menzhan FROM t_supplygas WHERE TO_DATE (f_gasdate, 'yyyy-MM-dd hh24:mi:ss') >= " + // "TO_DATE (\'" + this.param + "\', 'yyyy-MM-dd hh24:mi:ss') AND TO_DATE (f_gasdate, 'yyyy-MM-dd hh24:mi:ss') <= TO_DATE (\'" + this.param1 + "\', 'yyyy-MM-dd hh24:mi:ss') " + // "GROUP BY TO_NUMBER (SUBSTR(f_gasdate, 1, 4))) l ON b. YEAR = l. YEAR LEFT JOIN (SELECT SUBSTR (f_startdate, 0, 4) AS YEAR, NVL (AVG(f_gasmun), 0) AS buysub FROM t_buysub " + // "WHERE f_startdate >= \'" + this.param + "\' AND f_enddate <= \'" + this.param1 + "\' GROUP BY SUBSTR (f_startdate, 0, 4)) bs ON b. YEAR = bs. YEAR) M", // condition: // "1=1", // orderitem: 'year asc' // }, // // 长期未购气 // longnotbuygas: { // items: 'count(f_userinfo_id) num,to_char(f_delivery_date,\'yyyy-mm\') dates', // tablename: 'A_LONGNOTBUYGAS', // condition: // ' f_delivery_date>= TO_DATE (\'' + this.param + '\', \'yyyy-mm-dd hh24:mi:ss\') GROUP BY to_char(f_delivery_date,\'yyyy-mm\')', // orderitem: 'dates' // }, // //往期购气对比 // pastscale: { // items: 'count(qq.r1) above,count(qq.r2) below', // tablename: // '(SELECT (case when pastscale>' + this.param1 + ' then f_userinfo_id end) r1,(case when pastscale<' + this.param2 + ' then f_userinfo_id end) r2 ' + // ' FROM (A_BUYGASCHANGE) where F_DELIVERY_DATE>=to_date(\'' + this.param + '\',\'yyyy-mm-dd hh24:mi:ss\') and f_last_pregas!=0 ' + // ')qq', // condition: // 'qq.r1 is not null or qq.r2 is not null', // orderitem: '1' // }, // //失联用户 // lossassociation: { // items: 'count(f_userinfo_id) num,to_char(f_hand_date,\'yyyy-mm\') dates', // tablename: 'a_lossassociation', // condition: '1=1 group by to_char(f_hand_date,\'yyyy-mm\')', // orderitem: 'dates' // }, // //长期未用气 // longnotusegas: { // items: 'count(distinct(f_userinfo_id)) num,to_char(f_hand_date,\'yyyy-mm\') dates', // tablename: 'a_longnotusegas', // condition: '1=1 group by to_char(f_hand_date,\'yyyy-mm\')', // orderitem: 'dates' // } // } // , // } // // 返回sql条件 // return Sql[title][param] // } // 数据增加单位,data=待单位化的数据,函数返回为单位化的数据字符串 export function dataunit(data) { var value = data //去掉小数点 var index0 = value.toString().indexOf('.') if (index0 != -1) { value = value.toString().substring(0, index0) } // 对整数部分进行位数判定,因数据原因,暂取‘万’为单位 var result = '' var index = value.toString().length var t, s, l var unit = '' if (index > 4 && index < 9) { t = value.toString().substring(0, index - 4) s = value.toString().substring(index - 4, index - 3) l = value.toString().substring(index - 3, index - 2) unit = '万' } if (index > 8) { t = value.toString().substring(0, index - 8) s = value.toString().substring(index - 8, index - 7) l = value.toString().substring(index - 7, index - 6) unit = '亿' } if (index <= 4) { return value } // 四舍五入 if (l > 4) { s = eval(s + '+1') } // 产生进位 if (s > 9) { s = 0 t = eval(t + '+1') } result = t + '.' + s + unit return result } //数组进行单位化,self=this,param=待单位化数组数据的变量名,param1=接受单位化数组数据的变量名 export function dataunitarray(self, param, param1) { let result = [] // 遍历数组 for (var i = 0; i < self[param].length; i++) { var name = self[param][i].name let res = {} res.name = name // 单位化数据 res.value = this.dataunit(self[param][i].value) result.push(res) } self[param1] = result } //获取前day的时间 export function toBeforeDate(day) { var dd = new Date(); dd.setDate(dd.getDate() - day);//获取前day天的日期 var y = dd.getFullYear(); var m = (dd.getMonth() + 1) < 10 ? "0" + (dd.getMonth() + 1) : (dd.getMonth() + 1);//获取当前月份的日期,不足100 var d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();//获取当前几号,不足100 return y + "-" + m + "-" + d; }