Files
t-admin/unpackage/dist/build/web/assets/pages-uni-stat-error-app-app.CTIY7uEc.js
T
2025-06-13 21:16:12 +08:00

2 lines
17 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as e,e as t,W as a,r as i,a as r,c as o,w as l,i as s,am as n,E as d,b as c,d as p,f as u,g as _,o as m,h as f,j as h,a0 as g,k as y,l as v,F as b,m as x,G as D,aq as k,t as w,q}from"./index-CS85kPhe.js";import{_ as z}from"./uni-stat-breadcrumb.xQt2SQkt.js";import{_ as C}from"./uni-data-select.CTvmxnrn.js";import{_ as T}from"./uni-stat-tabs.BqxEYTBM.js";import{_ as A}from"./uni-stat-panel.BC5-OoT8.js";import{_ as E}from"./qiun-data-charts.DPCUsCu6.js";import{_ as V}from"./download-excel.B45WMLhc.js";import{_ as j}from"./uni-tooltip.Bon-gzRk.js";import{_ as S}from"./uni-dateformat.AFBZPd5V.js";import{_ as P}from"./uni-pagination.b7xQ_-xQ.js";import{_ as F}from"./unicloud-db.CIw_Ucsr.js";import{s as $,d as L,g as B,m as M,j as O,h as U}from"./util.BgZN-4QF.js";const G=[{title:"报错时间",field:"create_time",tooltip:"",formatter:"",filter:"timestamp"},{title:"错误信息",field:"error_msg",formatter:"",filter:"search"},{title:"原生应用包名",field:"package_name",formatter:"",filter:"search"},{title:"用户端上报的应用版本号",field:"version",formatter:"",tooltip:"manifest.json中的versionName的值",filter:"search"},{title:"平台",field:"platform",formatter:"",tooltip:"用户端上报的平台code",filter:"search"},{title:"渠道",field:"channel",formatter:"",tooltip:"用户端上报的渠道code场景值",filter:"search"},{title:"基础库版本号",field:"sdk_version",formatter:"",tooltip:"",filter:"search"},{title:"设备标识",field:"device_id",formatter:"",tooltip:"客户端携带的设备标识",filter:"search"},{title:"设备网络型号",field:"device_net",formatter:"",tooltip:"设备网络型号wifi/3G/4G/",filter:"search"},{title:"系统版本",field:"device_os",formatter:"",tooltip:"iOS平台为系统版本号,如15.1;Android平台为API等级,如30",filter:"search"},{title:"系统版本名称",field:"device_os_version",formatter:"",tooltip:"iOS平台与os字段一致;Android平台为版本名称,如5.1.1",filter:"search"},{title:"设备供应商",field:"device_vendor",formatter:"",tooltip:"",filter:"search"},{title:"设备型号",field:"device_model",formatter:"",tooltip:"",filter:"search"},{title:"是否root",field:"device_is_root",formatter:"",tooltip:"1表示root;0表示未root",filter:"range"},{title:"系统名称",field:"device_os_name",formatter:"",tooltip:"用于区别Android和鸿蒙,仅Android支持",filter:"search"},{title:"设备电池电量",field:"device_batt_level",formatter:"",tooltip:"取值范围0-100,仅Android支持",filter:"range"},{title:"电池温度",field:"device_batt_temp",formatter:"",tooltip:"仅Android支持",filter:"search"},{title:"系统已使用内存",field:"device_memory_use_size",formatter:"",tooltip:"单位为Byte,仅Android支持",filter:"range"},{title:"系统总内存",field:"device_memory_total_size",formatter:"",tooltip:"单位为Byte,仅Android支持",filter:"range"},{title:"系统磁盘已使用大小",field:"device_disk_use_size",formatter:"",tooltip:"单位为Byte,仅Android支持",filter:"range"},{title:"系统磁盘总大小",field:"device_disk_total_size",formatter:"",tooltip:"单位为Byte,仅Android支持",filter:"range"},{title:"设备支持的CPU架构",field:"device_abis",formatter:"",tooltip:"多个使用,分割,如arm64-v8a,armeabi-v7a,armeabi,仅Android支持",filter:"search"},{title:"运行的app个数",field:"app_count",formatter:"",tooltip:"包括运行的uni小程序数目,独立App时值为1",filter:"range"},{title:"APP使用的内存量",field:"app_use_memory_size",formatter:"",tooltip:"单位为Byte",filter:"range"},{title:"运行应用的个数",field:"app_count",formatter:"",filter:"range"},{title:"打开 Webview 的个数",field:"app_webview_count",formatter:"",filter:"range"},{title:"APP使用时长",field:"app_use_duration",formatter:"",tooltip:"单位为s",filter:"range"},{title:"是否前台运行",field:"app_run_fore",formatter:"",tooltip:"1表示前台运行,0表示后台运行",filter:"search"},{title:"原生应用版本名称",field:"package_version",formatter:"",tooltip:"Android的apk版本名称;iOS的ipa版本名称",filter:"search"},{title:"页面url",field:"page_url",formatter:"",filter:"search"}],I={};const N=[{title:"崩溃总数",field:"count",value:0,formatter:",",tooltip:"指原生应用在某个时间段内出现崩溃的总数"},{title:"崩溃率",field:"count/app_launch_count",computed:"count/app_launch_count",formatter:"%",value:0,tooltip:"时间范围内的总崩溃数/原生应用启动次数,如果小于0.01%,默认显示为0"}],Q=t.database(),R=[],W={ascending:"asc",descending:"desc"};const J=e({data(){return{fieldsMap:G,query:{type:"crash",dimension:"day",appid:"",platform_id:"",uni_platform:"",version_id:"",start_time:[]},loading:!1,popupLoading:!1,currentDateTab:0,tableData:[],popupTableData:[],panelData:JSON.parse(JSON.stringify(N)),chartData:{},chartTab:"errorCount",chartTabs:[{_id:"errorCount",name:"崩溃次数"},{_id:"errorRate",name:"崩溃率"}],collectionList:"uni-stat-app-crash-logs",schemaQuery:"",where:this.tableData,orderby:"create_time desc",orderByFieldName:"",selectedIndexs:[],options:{pageCurrent:1,total:0,pageSizeIndex:0,pageSizeRange:[10,20,50,100],pageSize:20,pageCurrent:1,filterData:{},...I},errorMessage:"",exportExcel:{filename:"uni-stat-app-crash-logs.xls",type:"xls",fields:{appid:"appid",version:"version",platform:"platform",channel:"channel",sdk_version:"sdk_version",device_id:"device_id",device_net:"device_net",device_os:"device_os",device_os_version:"device_os_version",device_vendor:"device_vendor",device_model:"device_model",device_is_root:"device_is_root",device_os_name:"device_os_name",device_batt_level:"device_batt_level",device_batt_temp:"device_batt_temp",device_memory_use_size:"device_memory_use_size",device_memory_total_size:"device_memory_total_size",device_disk_use_size:"device_disk_use_size",device_disk_total_size:"device_disk_total_size",device_abis:"device_abis",app_count:"app_count",app_use_memory_size:"app_use_memory_size",app_webview_count:"app_webview_count",app_use_duration:"app_use_duration",app_run_fore:"app_run_fore",package_name:"package_name",package_version:"package_version",page_url:"page_url",error_msg:"error_msg",create_time:"create_time"}},exportExcelData:[]}},computed:{queryStr(){return $(this.query)},tableQuery(){const{appid:e,platform_id:t,version_id:a,start_time:i}=this.query,r=this.getPlatform(t),o=this.getVersion(a);return $({appid:e,create_time:i,platform:r,version:o})},versionQuery(){const{appid:e,uni_platform:t}=this.query;return $({appid:e,uni_platform:t,type:"native_app"})}},created(){this.debounceGet=L((()=>{this.getAllData(this.queryStr),this.where=this.tableQuery,this.$nextTick((()=>{this.$refs.udb&&this.$refs.udb.loadData()}),200)}),300),this.debounceGet()},watch:{query:{deep:!0,handler(e){this.options.pageCurrent=1,this.debounceGet()}},chartTab(e){this.getChartData(this.queryStr)}},onLoad(){this._filter={}},methods:{onqueryload(e){this.exportExcelData=e,this.tableData=e},getWhere(){const e=this.schemaQuery.trim();if(!e)return"";const t=new RegExp(e,"i");return R.map((e=>t+".test("+e+")")).join(" || ")},loadData(e=!0){this.$refs.udb.loadData({clear:e})},onPageChanged(e){this.selectedIndexs.length=0,this.$refs.table.clearSelection(),this.$refs.udb.loadData({current:e.current})},sortChange(e,t){this.orderByFieldName=t,e.order?this.orderby=t+" "+W[e.order]:this.orderby="",this.$refs.table.clearSelection(),this.$nextTick((()=>{this.$refs.udb.loadData()}))},filterChange(e,t){this._filter[t]={type:e.filterType,value:e.filter};let a=function(e,t){let a={};for(let i in e){let{type:r,value:o}=e[i];switch(r){case"search":"string"==typeof o&&o.length&&(a[i]=new RegExp(o));break;case"select":if(o.length){let e=[];for(let a of o)e.push(t.eq(a));a[i]=t.or(e)}break;case"range":if(o.length){let e=o[0],r=o[1];a[i]=t.and([t.gte(e),t.lte(r)])}break;case"date":if(o.length){let[e,r]=o,l=new Date(e),s=new Date(r);a[i]=t.and([t.gte(l),t.lte(s)])}break;case"timestamp":if(o.length){let[e,r]=o;a[i]=t.and([t.gte(e),t.lte(r)])}}}return a}(this._filter,Q.command);Object.keys(a).length?this.where=a:this.where="",this.$nextTick((()=>{this.$refs.udb.loadData()}))},useDatetimePicker(){this.currentDateTab=-1},changePlatform(e,t,a,i){this.query.version_id=0,this.query.uni_platform=i.code},changeTimeRange(e,t){this.currentDateTab=t;const a=B(e),i=B(0)-1;this.query.start_time=[a,i]},getPlatform(e){const t=a("uni-admin-statTabsData")["platform-channel"],i=Array.isArray(t)&&t.find((t=>t._id===e));return i&&i.code||""},getVersion(e){let t=[];this.$refs["app-versions"]&&"function"==typeof this.$refs["app-versions"].getLoadData&&(t=this.$refs["app-versions"].getLoadData());const a=Array.isArray(t)&&t.find((t=>t._id===e));return a&&a.text||""},getAllData(e){-1!==e.indexOf("appid")?(this.errorMessage="",this.getPanelData(e),this.getChartData(e)):this.errorMessage="请先选择应用"},getPanelData(e){let a=$(this.query,!1,["uni_platform"]);t.database().collection("uni-stat-error-result").where(a).field("count as temp_count, app_launch_count as temp_app_launch_count, appid").groupBy("appid").groupField("sum(temp_count) as count, sum(temp_app_launch_count) as app_launch_count").get({getCount:!0}).then((e=>{e.result;const t=e.result.data[0]||{count:0,app_launch_count:0};let a=Object.assign({},this.query);delete a.type,this.getTotalLaunch($(a,!1,["uni_platform"])).then((e=>{const a=e.result.data[0];if(t){let e=a&&a.total_app_launch_count;t.app_launch_count=e,this.panelData=M(N,t)}}))}))},getTotalLaunch:e=>t.database().collection("uni-stat-result").where(e).groupBy("appid").groupField("sum(app_launch_count) as total_app_launch_count").get(),getChartData(e,a="day_count"){let i=$(this.query,!1,["uni_platform"]);this.chartData={},this.options;const r=t.database(),[o,l]=this.query.start_time,s=O(new Date(o),new Date(l));r.collection("uni-stat-error-result").where(i).field("count as temp_count, app_launch_count as temp_app_launch_count, start_time").groupBy("start_time").groupField("sum(temp_count) as count, sum(temp_app_launch_count) as app_launch_count").orderBy("start_time","asc").get({getCount:!0}).then((e=>{const{count:t,data:a}=e.result;let i=[];s.forEach((e=>{let t=a.find((t=>t.start_time===e));t?i.push(t):i.push({app_launch_count:0,count:0,start_time:e})}));const r={categories:[],series:[{name:"暂无数据",data:[]}]};if("errorCount"===this.chartTab){const e=r.series[0]={name:"崩溃次数",data:[]},t=r.categories;for(const a of i){let i=a.start_time;const r=U(i,"day"),o=a.count;t.push(r),e.data.push(o)}this.chartData=r}else{const e=r.series[0]={name:"崩溃率(%)",data:[],lineStyle:{color:"#EE6666",width:1},itemStyle:{borderWidth:1,borderColor:"#EE6666",color:"#EE6666"},areaStyle:{color:{colorStops:[{offset:0,color:"#EE6666"},{offset:1,color:"#FFFFFF"}]}}},t=r.categories;for(const a of i){const{count:i,app_launch_count:r}=a;let o=a.start_time;const l=U(o,"day");t.push(l);let s=i/r;s=s?s.toFixed(2):0,e.data.push(s)}this.chartData=r}})).finally((()=>{}))}}},[["render",function(e,t,a,$,L,B){const M=i(r("uni-stat-breadcrumb"),z),O=s,U=i(r("uni-data-select"),C),G=i(r("uni-stat-tabs"),T),I=i(r("uni-datetime-picker"),n),N=i(r("uni-stat-panel"),A),Q=i(r("qiun-data-charts"),E),R=x,W=i(r("download-excel"),V),J=i(r("uni-icons"),d),H=i(r("uni-tooltip"),j),K=i(r("uni-th"),c),X=i(r("uni-tr"),p),Y=i(r("uni-td"),u),Z=i(r("uni-dateformat"),S),ee=i(r("uni-table"),_),te=i(r("uni-pagination"),P),ae=i(r("unicloud-db"),F);return m(),o(O,{class:"fix-top-window"},{default:l((()=>[f(O,{class:"uni-header"},{default:l((()=>[f(M,{class:"uni-stat-breadcrumb-on-phone"}),f(O,{class:"uni-group hide-on-phone"},{default:l((()=>[f(O,{class:"uni-sub-title"},{default:l((()=>[h("开发者可以在这里快速查询原生应用最近出现的具体崩溃内容,了解崩溃概况信息,以便快速修复问题")])),_:1})])),_:1})])),_:1}),f(O,{class:"uni-container"},{default:l((()=>[f(O,{class:"uni-stat--x flex p-1015"},{default:l((()=>[f(O,{class:"uni-stat--app-select"},{default:l((()=>[f(U,{collection:"opendb-app-list",field:"appid as value, name as text",orderby:"text asc",defItem:1,label:"应用选择",modelValue:L.query.appid,"onUpdate:modelValue":t[0]||(t[0]=e=>L.query.appid=e),clear:!1},null,8,["modelValue"]),f(U,{ref:"app-versions",collection:"opendb-app-versions",where:B.versionQuery,class:"ml-m",field:"_id as value, version as text, uni_platform as label, create_date as date",format:"{label} - {text}",orderby:"date desc",label:"版本选择",modelValue:L.query.version_id,"onUpdate:modelValue":t[1]||(t[1]=e=>L.query.version_id=e)},null,8,["where","modelValue"])])),_:1}),f(G,{label:"平台选择",type:"boldLine",all:!1,mode:"platform-channel",modelValue:L.query.platform_id,"onUpdate:modelValue":t[2]||(t[2]=e=>L.query.platform_id=e),onChange:B.changePlatform},null,8,["modelValue","onChange"])])),_:1}),f(O,{class:"uni-stat--x flex"},{default:l((()=>[f(G,{label:"日期选择",current:L.currentDateTab,yesterday:!1,mode:"date",onChange:B.changeTimeRange},null,8,["current","onChange"]),f(I,{type:"datetimerange",end:(new Date).getTime(),modelValue:L.query.start_time,"onUpdate:modelValue":t[3]||(t[3]=e=>L.query.start_time=e),returnType:"timestamp",clearIcon:!1,class:g(["uni-stat-datetime-picker",{"uni-stat__actived":L.currentDateTab<0&&!!L.query.start_time.length}]),onChange:B.useDatetimePicker},null,8,["end","modelValue","class","onChange"])])),_:1}),f(O,{class:"uni-stat--x",style:{padding:"15px 0"}},{default:l((()=>[f(N,{items:L.panelData,class:"uni-stat-panel"},null,8,["items"]),f(G,{type:"box",modelValue:L.chartTab,"onUpdate:modelValue":t[4]||(t[4]=e=>L.chartTab=e),tabs:L.chartTabs,class:"mb-l"},null,8,["modelValue","tabs"]),f(O,{class:"uni-charts-box"},{default:l((()=>[f(Q,{type:"area",chartData:L.chartData,eopts:{notMerge:!0},echartsH5:"",echartsApp:"",tooltipFormat:"tooltipCustom",errorMessage:L.errorMessage},null,8,["chartData","errorMessage"])])),_:1})])),_:1}),f(O,{class:"uni-stat--x p-m"},{default:l((()=>[f(O,{class:"flex-between"},{default:l((()=>[f(O,{class:"uni-stat-card-header"},{default:l((()=>[h("信息列表")])),_:1}),f(O,{class:"uni-group"},{default:l((()=>[f(W,{class:"hide-on-phone",fields:L.exportExcel.fields,data:L.exportExcelData,type:L.exportExcel.type,name:L.exportExcel.filename},{default:l((()=>[f(R,{class:"uni-button",type:"primary",size:"mini"},{default:l((()=>[h("导出 Excel")])),_:1})])),_:1},8,["fields","data","type","name"])])),_:1})])),_:1}),f(ae,{ref:"udb",collection:L.collectionList,field:"appid,version,platform,channel,sdk_version,device_id,device_net,device_os,device_os_version,device_vendor,device_model,device_is_root,device_os_name,device_batt_level,device_batt_temp,device_memory_use_size,device_memory_total_size,device_disk_use_size,device_disk_total_size,device_abis,app_count,app_use_memory_size,app_webview_count,app_use_duration,app_run_fore,package_name,package_version,page_url,error_msg,create_time",where:L.where,"page-data":"replace",orderby:L.orderby,getcount:!0,"page-size":L.options.pageSize,"page-current":L.options.pageCurrent,loadtime:"manual",options:L.options,onLoad:B.onqueryload},{default:l((({data:t,pagination:a,loading:i,error:r,options:s})=>[f(ee,{ref:"table",loading:i,border:"",stripe:"",emptyText:L.errorMessage||e.$t("common.empty"),style:{"overflow-y":"scroll"}},{default:l((()=>[f(X,null,{default:l((()=>[(m(!0),y(b,null,v(L.fieldsMap,((e,t)=>(m(),y(b,{key:t},[e.title?(m(),o(K,{key:t,align:"center",style:D({minWidth:15*e.title.length+80+"px"})},{default:l((()=>[f(H,null,k({default:l((()=>[h(w(e.title)+" ",1),e.tooltip?(m(),o(J,{key:0,type:"help",color:"#666"})):q("",!0)])),_:2},[e.tooltip?{name:"content",fn:l((()=>[f(O,{class:"uni-stat-tooltip-s"},{default:l((()=>[h(w(e.tooltip),1)])),_:2},1024)])),key:"0"}:void 0]),1024)])),_:2},1032,["style"])):q("",!0)],64)))),128))])),_:1}),(m(!0),y(b,null,v(L.tableData,((e,t)=>(m(),o(X,{key:t},{default:l((()=>[(m(!0),y(b,null,v(L.fieldsMap,((t,a)=>(m(),y(b,{key:a},["error_msg"===t.field?(m(),o(Y,{key:t.field,align:"left",style:{"min-width":"500px"}},{default:l((()=>[f(H,null,k({default:l((()=>[h(w(e.error_msg?e.error_msg.substring(0,100)+"...":"")+" ",1),e.error_msg?(m(),o(J,{key:0,type:"help",color:"#666"})):q("",!0)])),_:2},[e.error_msg?{name:"content",fn:l((()=>[f(O,{class:"uni-stat-tooltip-l"},{default:l((()=>[h(w(e.error_msg),1)])),_:2},1024)])),key:"0"}:void 0]),1024)])),_:2},1024)):"create_time"===t.field?(m(),o(Y,{key:t.field,align:"center"},{default:l((()=>[f(Z,{threshold:[0,0],date:e.create_time},null,8,["date"])])),_:2},1024)):(m(),o(Y,{key:t.field,align:"center"},{default:l((()=>[h(w(void 0!==e[t.field]?e[t.field]:"-"),1)])),_:2},1024))],64)))),128))])),_:2},1024)))),128))])),_:2},1032,["loading","emptyText"]),f(O,{class:"uni-pagination-box"},{default:l((()=>[f(te,{"show-icon":"","page-size":a.size,modelValue:a.current,"onUpdate:modelValue":e=>a.current=e,total:a.count,onChange:B.onPageChanged},null,8,["page-size","modelValue","onUpdate:modelValue","total","onChange"])])),_:2},1024)])),_:1},8,["collection","where","orderby","page-size","page-current","options","onLoad"])])),_:1})])),_:1})])),_:1})}]]);export{J as default};