zxl
昨天 2f5150337fa53d7c5ea2fb19f3c5a259e37c8765
1
2
"use strict";const e=require("../../common/vendor.js"),l=require("../../api/index/index.js"),g=require("../../utils/util.js"),u=require("../../api/workStationSchedule/workStationSchedule.js"),p=()=>"../../components/BottomTabBar.js",f=()=>"../../uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.js",m={name:"Index",components:{BottomTabBar:p,qiunDataCharts:f},data(){return{userName:"",initials:"",greeting:"",today:"",filterVisible:!1,selectedIds:[],searchQuery:"",inintLimit:5,displayLimit:5,loadMoreStep:5,selectedMonth:g.getCurrentMonth(),count:{total:0,red:0,yellow:0,green:0},projectSelectList:[],projectList:[],chartData:{},opts:{color:["#73C0DE","#91CB74","#EE6666"],padding:[15,30,0,10],enableScroll:!0,legend:{},xAxis:{boundaryGap:"justify",disableGrid:!1,min:0,axisLine:!1},yAxis:{data:[{type:"categories",disabled:!1,fontSize:10,formatter:t=>t.length>6?t.substring(0,6)+"...":t}]},extra:{bar:{type:"stack",width:32,categoryGap:2,dataLabel:!0,labelPosition:"right",labelWidth:40}}},chartDataPhase:{},optsPhase:{color:["#1890FF"],padding:[30,20,20,20],legend:{},xAxis:{disableGrid:!1},yAxis:{data:[{min:0,max:105}]},extra:{line:{type:"straight",width:2,dataLabel:!0}}},todoTotal:0,todoPageSzie:5,todoCurrentPage:1,todoLoading:!1,todos:[],auditHistory:[],auditHistoryTotal:0,auditHistoryPageSize:5,auditHistoryCurrentPage:1,auditHistoryLoading:!1,noticeLimited:!0}},onLoad(){this.initUser(),this.initMeta(),this.loadData()},onReachBottom(){this.loadMoreAuditHistory()},methods:{async initWaitTask(){let t={pageSize:10,currentPage:this.todoCurrentPage,id:"all"};const i=await u.getWaitTaskList(t);if(i.statusCode===200){const o=i.data.data?i.data.data:[];this.todoCurrentPage===1?this.todos=o:this.todos=this.todos.concat(o),this.todoTotal=i.data.total}},async loadData(){const t=await l.getCodingCount();t.statusCode===200&&(this.count=t.data.data),await this.initSelectList(),await this.initTaskStatus(),this.selectedIds=this.projectSelectList.slice(0,this.inintLimit).map(i=>i.id),this.buildChartData(),this.buildPhaseChart(),this.initAuditHistory(),this.initWaitTask()},async initAuditHistory(){let t={pageSize:this.auditHistoryPageSize,currentPage:this.auditHistoryCurrentPage,projectId:"all"};const i=await u.auditHistoryPage(t);if(i.statusCode===200){const o=Array.isArray(i.data.data)?i.data.data:[];this.auditHistoryCurrentPage===1?this.auditHistory=o:this.auditHistory=this.auditHistory.concat(o),this.auditHistoryTotal=i.data.total||this.auditHistoryTotal}},loadMoreWaitTask(){this.todoLoading||this.todos.length>=this.todoTotal||(this.todoLoading=!0,this.todoCurrentPage+=1,this.initWaitTask().finally(()=>{this.todoLoading=!1}))},loadMoreAuditHistory(){this.auditHistoryLoading||this.auditHistory.length>=this.auditHistoryTotal||(this.auditHistoryLoading=!0,this.auditHistoryCurrentPage+=1,this.initAuditHistory().finally(()=>{this.auditHistoryLoading=!1}))},async initTaskStatus(){const t={startTime:this.selectedMonth},i=await l.getTaskStatus(t);i.statusCode===200&&(this.projectList=i.data.data)},async initSelectList(){const t=await l.getProjectSelectList();t.statusCode===200&&(this.projectSelectList=this.normalizeSelectList(t.data.data))},normalizeSelectList(t){return t?Array.isArray(t)?t.map(i=>{if(i&&typeof i=="object"){const o=i.id!=null?i.id:i.key!=null?i.key:i.value,n=i.name!=null?i.name:i.label!=null?i.label:i.text;if(o!=null&&n!=null)return{id:typeof o=="string"?Number(o):o,name:String(n)}}return null}).filter(Boolean):typeof t=="object"?Object.keys(t).map(i=>({id:Number(i),name:String(t[i])})):[]:[]},toggleId(t){if((this.searchQuery||"").trim()){const n=this.filteredList.map(a=>a.id);this.selectedIds=this.selectedIds.filter(a=>n.includes(a))}const o=this.selectedIds.indexOf(t);o>=0?this.selectedIds.splice(o,1):this.selectedIds.push(t)},increaseLimit(){this.displayLimit+=this.loadMoreStep},applyFilter(){this.buildChartData()},clearFilter(){this.searchQuery="",this.displayLimit=this.inintLimit,this.selectedIds=this.projectSelectList.slice(0,this.inintLimit).map(t=>t.id),this.buildChartData()},initUser(){const t=e.index.getStorageSync("userInfo")||{},i=t.user&&t.user.userName?t.user.userName:"用户";this.userName=i;const o=i||"";this.initials=o.length>=2?o.slice(-2):o},initMeta(){const t=new Date,i=t.getHours();this.greeting=i<12?"上午好,"+this.userName:i<18?"下午好,"+this.userName:"晚上好,"+this.userName;const o=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");this.today=`${o}-${n}-${a}`},getAuditTypeText(t){return{Submit:"提交",Review:"审核",Reject:"驳回",Forward:"转交"}[t]||"未知操作"},statusClass(t){return t==="待完成"?"status-green":"status-blue"},openTodo(t){if(e.index.__f__("log","at pages/index/index.vue:411",t),t.taskType==="容缺")e.index.navigateTo({url:"/subpackage/flowable/task-process"+this.formatQueryParams({deployId:t.checkPointInfo.deployId,procDefId:t.checkPointInfo.processDefinitionId,procInsId:t.checkPointInfo.processInstanceId,processName:t.taskName,flowName:t.checkPointInfo.processName,projectName:t.checkPointInfo.projectName,taskId:t.id,showAuditing:!1,projectId:t.checkPointInfo.id,isWait:!0})});else{let i={processDefId:t.checkPointInfo.processDefinitionId,taskId:t.id};u.getTaskIsAuditing(i).then(o=>{const n={deployId:t.checkPointInfo.deployId,procDefId:t.checkPointInfo.processDefinitionId,procInsId:t.checkPointInfo.processInstanceId,processName:t.taskName,flowName:t.checkPointInfo.processName,projectName:t.checkPointInfo.projectName,taskId:t.id,showAuditing:o.data,projectId:t.checkPointInfo.id,isWait:!1};e.index.navigateTo({url:"/subpackage/flowable/task-process"+this.formatQueryParams(n)})})}},formatQueryParams(t){const i=Object.entries(t||{}).filter(([o,n])=>n!=null);return i.length?"?"+i.map(([o,n])=>encodeURIComponent(o)+"="+encodeURIComponent(n)).join("&"):""},goFunctions(){e.index.navigateTo({url:"/subpackage/user/functions"})},goProgress(){e.index.navigateTo({url:"/subpackage/manager/progress"})},goPending(){e.index.navigateTo({url:"/subpackage/user/pending"})},goReport(){e.index.navigateTo({url:"/subpackage/manager/report"})},goSchedule(){e.index.navigateTo({url:"/subpackage/manager/schedule"})},buildChartData(){e.index.__f__("log","at pages/index/index.vue:473",this.selectedIds),e.index.__f__("log","at pages/index/index.vue:474",this.projectList);const t=this.selectedIds.length?this.projectList.filter(r=>this.selectedIds.includes(Number(r.id))):this.projectList;e.index.__f__("log","at pages/index/index.vue:476","筛选后:{}",t);const i=t.map(r=>r.projectName),o=t.map(r=>r.co),n=t.map(r=>r.co2),a=t.map(r=>r.co3);this.chartData={categories:i,series:[{name:"已处理",data:o},{name:"待处理",data:n},{name:"未处理",data:a}]}},async buildPhaseChart(){let t=["在库","前期","实施","竣工"],i=[0,0,0,0];try{const o=await l.getStageCount();o.statusCode===200&&(t=o.data.data.xData,i=o.data.data.yData)}catch(o){e.index.__f__("log","at pages/index/index.vue:501",o)}this.chartDataPhase={categories:t,series:[{name:"数量",data:i}]}}},computed:{filteredList(){let t=this.projectSelectList;const i=(this.searchQuery||"").trim().toLowerCase();return i&&(t=t.filter(o=>(o.name||"").toLowerCase().includes(i))),t}}};if(!Array){const t=e.resolveComponent("uni-icons"),i=e.resolveComponent("qiun-data-charts"),o=e.resolveComponent("BottomTabBar");(t+i+o)()}const y=()=>"../../uni_modules/uni-icons/components/uni-icons/uni-icons.js",I=()=>"../../uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.js";Math||(y+I)();function b(t,i,o,n,a,r){return e.e({a:e.t(a.initials),b:e.t(a.greeting),c:e.t(a.today),d:e.p({type:"list",color:"#fff",size:"24"}),e:e.o((...s)=>r.goFunctions&&r.goFunctions(...s)),f:e.t(a.count.total),g:e.t(a.count.green),h:e.t(a.count.yellow),i:e.t(a.count.red),j:e.p({type:a.filterVisible?"top":"down",color:"#1E88E5",size:"22"}),k:e.t(a.filterVisible?"收起":"展开"),l:e.o(s=>a.filterVisible=!a.filterVisible),m:e.o((...s)=>r.applyFilter&&r.applyFilter(...s)),n:e.o((...s)=>r.clearFilter&&r.clearFilter(...s)),o:a.filterVisible},a.filterVisible?e.e({p:a.searchQuery,q:e.o(s=>a.searchQuery=s.detail.value),r:e.f(r.filteredList.slice(0,a.displayLimit),(s,c,d)=>e.e({a:e.t(s.name),b:a.selectedIds.includes(s.id)},a.selectedIds.includes(s.id)?{c:"1cf27b2a-2-"+d,d:e.p({type:"checkmarkempty",color:"#fff",size:"20"})}:{},{e:s.id,f:a.selectedIds.includes(s.id)?1:"",g:e.o(h=>r.toggleId(s.id),s.id)})),s:r.filteredList.length>a.displayLimit},r.filteredList.length>a.displayLimit?{t:e.p({type:"down",color:"#1E88E5",size:"22"}),v:e.o((...s)=>r.increaseLimit&&r.increaseLimit(...s))}:{}):{},{w:e.p({type:"bar",opts:a.opts,chartData:a.chartData,tooltipShow:!1}),x:e.p({type:"line",opts:a.optsPhase,chartData:a.chartDataPhase}),y:e.p({type:"calendar",color:"#fff",size:"36"}),z:e.o((...s)=>r.goPending&&r.goPending(...s)),A:e.p({type:"compose",color:"#fff",size:"36"}),B:e.o((...s)=>r.goReport&&r.goReport(...s)),C:e.p({type:"flag",color:"#fff",size:"36"}),D:e.o((...s)=>r.goProgress&&r.goProgress(...s)),E:e.p({type:"folder",color:"#fff",size:"36"}),F:e.o((...s)=>r.goSchedule&&r.goSchedule(...s)),G:e.p({type:a.noticeLimited?"top":"down",color:"#1E88E5",size:"22"}),H:e.t(a.noticeLimited?"取消展开":"展开"),I:e.o(s=>a.noticeLimited=!a.noticeLimited),J:a.noticeLimited},a.noticeLimited?{K:e.f(a.auditHistory,(s,c,d)=>({a:e.t(s.title||s.projectName||s.name||"通知"),b:e.t(s.time||s.auditTime||s.createTime),c:e.t(s.source||s.auditor||""),d:c})),L:e.o((...s)=>r.loadMoreAuditHistory&&r.loadMoreAuditHistory(...s))}:{M:e.f(a.auditHistory,(s,c,d)=>({a:e.t(s.projectName||"通知"),b:e.t(r.getAuditTypeText(s.auditType)),c:e.t(s.content),d:c}))},{N:a.todos.length===0},a.todos.length===0?{}:{O:e.f(a.todos,(s,c,d)=>({a:e.t(s.taskName),b:e.t(s.taskType),c:e.n(r.statusClass(s.taskType)),d:s.id,e:e.o(h=>r.openTodo(s),s.id)}))},{P:e.o((...s)=>r.loadMoreWaitTask&&r.loadMoreWaitTask(...s)),Q:e.p({active:"home"})})}const L=e._export_sfc(m,[["render",b],["__scopeId","data-v-1cf27b2a"]]);wx.createPage(L);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/index.js.map