123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- <template>
- <view class="page-index">
- <view class="status_bar"></view>
- <div class="title">
- <text class="tab" :class="type==='user'?'active':''" @click="changeTab('user')">我的</text>
- <text class="tab" :class="type==='group'?'active':''" @click="changeTab('group')">部门</text>
- </div>
- <div class="statistics">
- <div class="head">任务统计</div>
- <div class="container">
- <div :class="conditions.status===0?'item active':'item'" @click="changeStuas(0,'待巡检')">
- <image class="icon" src="@/static/index/wait.png" alt=""></image>
- <text>待巡检{{statistics.wait}}个</text>
- </div>
- <div :class="conditions.status===2?'item active':'item'" @click="changeStuas(2,'已逾期')">
- <image class="icon" src="@/static/index/expire.png" alt=""></image>
- <text>已逾期{{statistics.expire}}个</text>
- </div>
- <div :class="conditions.status===1?'item active':'item'" @click="changeStuas(1,'已完成')">
- <image class="icon" src="@/static/index/complete.png" alt=""></image>
- <text>已完成{{statistics.complete}}个</text>
- </div>
- </div>
- </div>
- <div class="task-list">
- <div class="head">{{title}}任务</div>
- <template v-if="items.length>0">
- <div class="item" v-for="(item,index) in items" :key="item.taskId" @click="linkTo(item)">
- <div class="task-title">{{item.taskTitle}}</div>
- <h4 class="goafName" v-if="item.goafName">{{formateGoafName(item)}}</h4>
- <div class="time">{{item.expectedStartDate}}-{{item.expectedEndDate}}</div>
- </div>
- </template>
- <template v-else>
- <view class="empty">
- <image class="icon-empty" src="/static/icon/empty.png" mode="widthFix"></image>
- <p>暂无数据</p>
- </view>
- </template>
- </div>
- </view>
- </template>
- <script>
- import {getCheckTaskByList,goaftaskstatis,goafhdangerstatis} from '@/api/task.js'
- import { NumConvertLM } from '@/libs/tool'
- export default {
- data() {
- return {
- statusBarHeight:0,
- type:'user',
- title:"待巡检",
- statistics: {
- wait:0,
- expire:0,
- complete:0
- },
- items:[],
- conditions: {
- status: 0,
- accountId:undefined
- },
- accountId:undefined,
- groupId:undefined
- }
- },
- onLoad(){
- this.initStatusBarHeight()
- },
- onPullDownRefresh (){
- this.getData()
- },
- onShow() {
- const accountInfo=uni.getStorageSync('accountInfo');
- const groupId=accountInfo.groupId
- const accountId=accountInfo.userId
- this.accountId=accountId
- this.groupId=groupId
- this.getData()
- this.goaftaskstatis()
- },
- methods: {
- initStatusBarHeight(){
- this.statusBarHeight=uni.getSystemInfoSync().statusBarHeight
- },
- formateGoafName({
- goafOrebelt,
- goafOrebody,
- goafOreheight,
- goafName
- }){
- return `${NumConvertLM(goafOrebelt)}/${ goafOrebody}/${goafOreheight}/${goafName}`
- },
- getData(){
- let conditions={}
- if(this.type==='user'){
- conditions.handleAccountId=this.accountId
- }else{
- conditions.handleGroupId=this.groupId
- }
- getCheckTaskByList({
- status:this.conditions.status,
- ...conditions,
- }).then((res)=>{
- this.items=res.data
- })
- },
- goaftaskstatis(){
- let conditions={}
- if(this.type==='user'){
- conditions.handleAccountId=this.accountId
- }else{
- conditions.handleGroupId=this.groupId
- }
- goaftaskstatis(conditions).then((res)=>{
- this.statistics={
- wait:res.data.goafTaskWaitingNum,
- expire:res.data.goafTaskExceedNum,
- complete:res.data.goafTaskCompletedNum
- }
- })
- },
- changeTab(type){
- this.type=type
- this.getData()
- this.goaftaskstatis()
- },
- linkTo(item){
- if(this.type==='user'){
- uni.setStorageSync('task-item',item)
- uni.navigateTo({
- url:'/pages/task/task'
- })
- }
- },
- changeStuas(status,name){
- this.conditions.status=status
- this.title=name
- this.getData()
- },
- onScanCode(){
- uni.scanCode({
- success: function (res) {
- uni.setStorageSync('scanCode-info',res.result)
- uni.navigateTo({
- url:'/pages/task/taskList/taskList'
- })
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .page-index{
- background: linear-gradient(180deg, #4D73FF 0%, rgba(77, 115, 255, 0) 100%);
- padding: 0 30upx;
- .title{
- display: flex;
- align-items: center;
- .tab{
- font-size: 34upx;
- line-height: 50upx;
- margin-right: 32upx;
- color: rgba(255, 255, 255, 0.6);
- &.active{
- color: #fff;
- }
- }
- .icon-xiangji{
- font-size: 44rpx;
- line-height: 1;
- color: #fff;
- padding: 0 20rpx;
- }
- }
- .statistics{
- &{
- border-radius: 24upx;
- background-color: #fff;
- padding:36upx 0 0 24upx;
- margin-top: 48upx;
- }
- .head{
- font-weight: 900;
- font-size: 34upx;
- line-height: 50upx;
- color: #151515;
- }
- .container{
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 20rpx 20rpx 0 20rpx;
- font-size: 14px;
- line-height: 24px;
- .item{
- width: 33.33%;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- padding-bottom: 40rpx;
- &.active{
- background-image: url('/static/icon/selectEd.png');
- background-size: 32rpx 20rpx;
- background-repeat: no-repeat;
- background-position: center bottom;
- }
- .icon{
- display: block;
- width:88upx;
- height: 88upx;
- }
- text{
- font-size: 28upx;
- line-height: 42upx;
- color: #151515;
- padding-top: 18upx;
- }
- }
- }
- }
- .task-list{
- border-radius: 24upx;
- background-color: #fff;
- margin-top: 24upx;
- padding: 36upx 24upx;
- .head{
- font-weight: 900;
- font-size: 34upx;
- line-height: 50upx;
- color: #151515;
- }
- .item{
- padding: 30upx 40upx 38upx 40upx;
- .task-title{
- color: #212121;
- font-size: 32upx;
- padding-bottom: 24rpx;
- }
- .goafName{
- color: #666;
- font-weight: normal;
- font-size: 28rpx;
- word-break: break-all;
- padding-bottom: 16rpx;
- }
- .time{
- background-image: url(/static/index/time.png);
- background-repeat: no-repeat;
- background-position: left center;
- background-size: 24upx 24upx;
- padding-left: 36upx;
- color: #999;
- font-size: 24upx;
- }
- }
- }
- }
- .empty{
- text-align: center;
- font-size: 28rpx;
- margin-top: 10%;
- color: #666;
- .icon-empty{
- display: block;
- width: 100px;
- margin: 0 auto;
- }
- }
- </style>
|