You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
295 lines
6.7 KiB
295 lines
6.7 KiB
<template>
|
|
<view class="container">
|
|
<!-- 导航栏 -->
|
|
<view class="module-tongji">
|
|
<view class="title">统计</view>
|
|
<view class="module-cont">
|
|
<view class="left" @click="handleTJclick('RECEIVED')">
|
|
<view class="hd">
|
|
<view class="text1">已接单</view>
|
|
<view class="text2">{{tjData.RECEIVED}}<text class="text3"> 单</text></view>
|
|
</view>
|
|
<image class="img" mode="aspectFit" src="http://118.195.155.9:8112/hl/yjd.png"></image>
|
|
</view>
|
|
<view class="right">
|
|
<view class="item" @click="handleTJclick('PROCESSING')">
|
|
<view class="hd">
|
|
<view class="text1">进行中</view>
|
|
<view class="text2">{{tjData.PROCESSING}}<text class="text3"> 单</text></view>
|
|
</view>
|
|
<image class="img" mode="aspectFit" src="http://118.195.155.9:8112/hl/jxz.png"></image>
|
|
</view>
|
|
<view class="item" @click="handleTJclick('FINISHED')">
|
|
<view class="hd">
|
|
<view class="text1">已完成</view>
|
|
<view class="text2">{{tjData.FINISHED}}<text class="text3"> 单</text></view>
|
|
</view>
|
|
<image class="img" mode="aspectFit" src="http://118.195.155.9:8112/hl/dwc.png"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="module-task">
|
|
<view class="title">任务</view>
|
|
<view class="module-cont">
|
|
<view class="item" @click="handleTaskclick">
|
|
<image class="img" mode="aspectFit" src="http://118.195.155.9:8112/hl/task-center.png"></image>
|
|
<text class="name">任务中心</text>
|
|
</view>
|
|
<view class="item" @click="handleTaskKg">
|
|
<image class="img" mode="aspectFit" src="http://118.195.155.9:8112/hl/yjkg.png"></image>
|
|
<text class="name">一键开工</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import { getToken } from '@/utils/auth'
|
|
import {
|
|
homeTjApi,
|
|
} from '@/api/home'
|
|
import {
|
|
taskListApi
|
|
} from '@/api/task-list'
|
|
export default {
|
|
name: 'index',
|
|
components: {},
|
|
data() {
|
|
return {
|
|
tjData: {
|
|
RECEIVED: 0,
|
|
PROCESSING: 0,
|
|
FINISHED: 0
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
userInfo() {
|
|
return this.$store.state.user.userInfo || {};
|
|
},
|
|
produceGroupType() {
|
|
const produceGroupType = this.$store.state.user.userInfo.produceGroupType || '';
|
|
return produceGroupType
|
|
}
|
|
// isLogin() {
|
|
// return !!getToken()
|
|
// }
|
|
},
|
|
onLoad() {
|
|
console.log("页面数据加载完成");
|
|
},
|
|
onShow() {
|
|
},
|
|
onReady() {
|
|
// console.log(uni.$u.getPx('18rpx')); // 以750物理像素(rpx)为基准 1rpx = 0.5px
|
|
console.log("页面渲染完成");
|
|
const isLogin = getToken()
|
|
if (isLogin) {
|
|
this.initData()
|
|
}
|
|
},
|
|
methods: {
|
|
// 统计跳转
|
|
handleTJclick(status) {
|
|
const url = '/pages/task-list/index?' + 'status=' + status
|
|
this.$tab.navigateTo(url)
|
|
},
|
|
// 任务中心
|
|
handleTaskclick() {
|
|
const url = '/pages/task-center/index'
|
|
this.$tab.switchTab(url)
|
|
},
|
|
getKGlist(status) {
|
|
const params = {
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
taskType: this.produceGroupType,
|
|
status
|
|
}
|
|
return taskListApi(params)
|
|
},
|
|
// 一键开工
|
|
handleTaskKg() {
|
|
this.getKGlist('PROCESSING').then(res => {
|
|
const { code, data, msg } = res
|
|
if (data.list && data.list.length) {
|
|
const id = data.list[0].id
|
|
const url = `/pages/bg-detail/index?id=${id}&status=RECEIVED`
|
|
this.$tab.navigateTo(url)
|
|
} else {
|
|
this.getKGlist('RECEIVED').then(res2 => {
|
|
const { code, data, msg } = res2
|
|
if (data.list && data.list.length) {
|
|
const id = data.list[0].id
|
|
const url = `/pages/bg-detail/index?id=${id}&status=RECEIVED`
|
|
this.$tab.navigateTo(url)
|
|
} else {
|
|
this.$modal.showToast("任务中心没有已接单任务,请联系管理员分派~");
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
initData() {
|
|
const taskType = this.$store.state.user.userInfo.produceGroupType
|
|
const params = {
|
|
taskType
|
|
}
|
|
homeTjApi(params).then(res => {
|
|
const user = res.data
|
|
this.tjData = {
|
|
...this.tjData,
|
|
...user
|
|
}
|
|
}).catch(error => {
|
|
reject(error)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
// 覆盖组件内置样式方式
|
|
.container ::v-deep {
|
|
height: 100vh;
|
|
background-color: #f2f2f2;
|
|
|
|
.module-tongji {
|
|
background-color: #fff;
|
|
margin: 20rpx;
|
|
padding: 20rpx;
|
|
border-radius: 10rpx;
|
|
box-sizing: border-box;
|
|
box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.15);
|
|
|
|
.title {
|
|
padding-bottom: 8rpx;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
color: #666666;
|
|
border-bottom: 2rpx solid #f2f2f2;
|
|
}
|
|
|
|
.module-cont {
|
|
display: flex;
|
|
width: 100%;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
.left {
|
|
width: 320rpx;
|
|
height: 260rpx;
|
|
padding: 20rpx;
|
|
background: #F4F6F8;
|
|
border-radius: 10rpx;
|
|
position: relative;
|
|
margin-right: 20rpx;
|
|
.hd {
|
|
.text1 {
|
|
color: #0D0D26;
|
|
font-size: 28rpx;
|
|
}
|
|
.text2 {
|
|
color: #0D0D26;
|
|
margin-top: 6rpx;
|
|
font-size: 32rpx;
|
|
}
|
|
.text3 {
|
|
color: #0D0D26;
|
|
font-size: 20rpx;
|
|
margin-left: 6rpx;
|
|
}
|
|
}
|
|
.img {
|
|
width: 80px;
|
|
height: 60px;
|
|
position: absolute;
|
|
right: 0;
|
|
bottom: 0rpx;
|
|
}
|
|
|
|
}
|
|
.right {
|
|
width: 320rpx;
|
|
.item {
|
|
background: #F4F6F8;
|
|
height: 120rpx;
|
|
width: 314rpx;
|
|
margin: 10px 0;
|
|
padding: 10px;
|
|
border-radius: 10rpx;
|
|
position: relative;
|
|
.hd {
|
|
.text1 {
|
|
color: #0D0D26;
|
|
font-size: 28rpx;
|
|
}
|
|
.text2 {
|
|
color: #0D0D26;
|
|
font-size: 32rpx;
|
|
margin-top: 6rpx;
|
|
}
|
|
.text3 {
|
|
color: #0D0D26;
|
|
font-size: 20rpx;
|
|
margin-left: 6rpx;
|
|
}
|
|
|
|
}
|
|
.img {
|
|
position: absolute;
|
|
right: 0;
|
|
bottom: 0rpx;
|
|
width: 32px;
|
|
height: 23px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.module-task {
|
|
background-color: #fff;
|
|
margin: 20rpx;
|
|
padding: 20rpx;
|
|
border-radius: 10rpx;
|
|
box-sizing: border-box;
|
|
box-shadow: 0px 0px 20rpx 0px rgba(0, 0, 0, 0.15);
|
|
|
|
.title {
|
|
padding-bottom: 8rpx;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
color: #666666;
|
|
border-bottom: 2rpx solid #f2f2f2;
|
|
}
|
|
|
|
.module-cont {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: flex-start;
|
|
margin: 0 40rpx;
|
|
.item {
|
|
box-sizing: content-box;
|
|
padding: 36rpx 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
margin-right: 40rpx;
|
|
|
|
.img {
|
|
width: 50px;
|
|
height: 50px;
|
|
}
|
|
|
|
.name {
|
|
margin-top: 20rpx;
|
|
color: #666666;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style> |