Files
dvcp_v2_wxcp_app/src/pages/workTask/components/detail.vue
2021-11-23 11:05:52 +08:00

445 lines
11 KiB
Vue
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.

<template>
<div class="detail">
<ai-top-fixed>
<u-tabs :list="tabs" height="96" :is-scroll="false" item-width="33.33%" bar-width="250" :current="index"
@change="change"></u-tabs>
</ai-top-fixed>
<template v-if="index==0">
<div class="card">
<header>{{detail.taskTitle}}</header>
<u-gap height="16"></u-gap>
<u-row>
<span>任务类型</span>
<span>{{$dict.getLabel("workTaskType",detail.type)}}</span>
</u-row>
<u-gap height="8"></u-gap>
<u-row>
<span>开始时间</span>
<span>{{detail.createTime}}</span>
</u-row>
<u-gap height="8"></u-gap>
<u-row>
<span>截止时间</span>
<span style="color:#1365DD">{{detail.lastTime}}</span>
</u-row>
<u-gap height="8"></u-gap>
<u-row>
<span>剩余时间</span>
<span style="color:#1365DD">{{detail.overTimeStatus}}</span>
</u-row>
<u-gap height="8"></u-gap>
<u-row>
<span>任务状态</span>
<span>{{$dict.getLabel("workTaskDoStatus",detail.status)}}</span>
</u-row>
<u-gap height="8"></u-gap>
<u-row>
<span>执行说明</span>
<span>{{detail.doDescription}}</span>
</u-row>
<u-gap height="16"></u-gap>
</div>
<div class="card" style="padding-top: 0">
<div class="label">任务说明</div>
<u-read-more close-text="展开" color="#999999" show-height="300">
<span>{{detail.taskDescription}}</span>
</u-read-more>
</div>
<div class="card" style="padding-top: 0" v-if="detail.fileList && detail.fileList.length">
<div class="label">相关附件</div>
<div class="file" v-for="(item,index) in detail.fileList" :key="index" @click="preFile(item)">
<u-row justify="between">
<label class="left">
<img :src="$cdn + 'common/appendix.png'" alt="">
<span>{{item.name}}.{{item.postfix}}</span>
</label>
<span>{{(item.size/1024).toFixed(2)}}KB</span>
</u-row>
</div>
</div>
</template>
<template v-if="index==1">
<template v-if="['0','1'].includes(isMine)">
<div class="card">
<div class="label">我的进度</div>
<text>已完成{{detail.myUserInfo.percent}}%</text>
<div class="progress">
<div class="pro-active" :style="{width:detail.myUserInfo.percent + '%'}"></div>
</div>
</div>
<div class="card" v-if="detail.processList.length">
<u-collapse>
<u-collapse-item :title="item.createDate && item.createDate.split(' ')[0]" v-for="(item, index) in detail.processList" :key="index">
<template slot="info">
完成到<em>{{item.percent}}%</em>
</template>
{{item.remarks}}
</u-collapse-item>
</u-collapse>
</div>
</template>
<template v-else>
<div class="card" v-for="(item,index) in detail.userInfoList" :key="index">
<div class="label">{{item.userName}}</div>
<text>已完成{{item.percent}}%</text>
<div class="progress">
<div class="pro-active" :style="{width:item.percent + '%'}"></div>
</div>
</div>
</template>
</template>
<template v-if="index==2">
<div class="card" v-if="list.length">
<u-row justify="between" v-for="(item,index) in list" :key="index" class="item" @click="subDetail(item)">
<label class="title">{{item.taskTitle}}</label>
<label class="right">{{item.percent}}%
<div class="arrow"></div>
</label>
</u-row>
</div>
<AiEmpty v-else></AiEmpty>
</template>
<ai-back></ai-back>
<div class="footer" v-if="index==1 && detail.myUserInfo.taskRole == 1 && detail.myUserInfo.doStatus==0" @click="handleClick">去完成</div>
<div class="footer" v-if="index==2" @click="createSubTask">创建子任务</div>
</div>
</template>
<script>
import AiTopFixed from "../../../components/AiTopFixed";
import AiBack from "../../../components/AiBack";
import AiEmpty from "../../../components/AiEmpty";
import {mapActions} from "vuex";
export default {
name: "detail",
components: {AiTopFixed, AiBack,AiEmpty},
data() {
return {
current: 1,
index: 0,
id: null,
taskCode: null,
isMine: null,
detail: {},
list: [],
}
},
onLoad(opt) {
this.id = opt.id
this.taskCode = opt.taskCode
this.isMine = opt.isMine
this.$dict.load("workTaskType", "workTaskDoStatus")
},
computed: {
tabs() {
return [
{name: "信息"},
{name: "进度"},
{name: "子任务"},
]
}
},
methods: {
...mapActions(['previewFile', 'injectJWeixin']),
preFile(e) {
if([".jpg",".png",".gif"].includes(e.postfix.toLowerCase())){
uni.previewImage({
current: e.url,
urls: [e.url]
})
}else {
this.previewFile({ ...e})
}
},
getDetail() {
this.$http.post("/app/appworktaskinfo/queryDetailById", null, {
params: {
id: this.id
}
}).then(res => {
if (res && res.data) {
this.detail = res.data
}
})
},
getList(){
this.$http.post("/app/appworktaskinfo/list", null, {
params: {
parentTaskCode: this.detail.taskCode,
size: 999,
}
}).then(res => {
if (res && res.data) {
this.list = res.data.records
}
})
},
createSubTask() {
uni.navigateTo({
url: "/pages/workTask/components/create?taskCode=" + this.taskCode
})
},
subDetail({id}) {
uni.navigateTo({
url: "/pages/workTask/components/subDetail?id=" + id
})
},
handleClick() {
uni.navigateTo({
url: "/pages/workTask/components/finish?taskCode=" + this.detail.taskCode + "&percent=" + this.detail.myUserInfo.percent
})
},
change(e) {
this.index = e
if (e == 2) {
this.getList()
}
}
},
onShow(){
this.getDetail()
this.getList()
}
}
</script>
<style lang="scss" scoped>
.detail {
min-height: 100%;
background-color: #F5F5F5;
padding-bottom: 140px;
::v-deep .content {
padding: 0;
}
.card {
background-color: #FFFFFF;
margin-bottom: 8px;
box-sizing: border-box;
padding: 16px 32px;
header {
font-size: 40px;
font-weight: 600;
color: #333333;
line-height: 64px;
letter-spacing: 1px;
}
.u-row {
& > div {
background-color: #2266FF;
border-radius: 50%;
text-align: center;
font-size: 22px;
font-weight: bold;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
}
& > span:first-child {
font-size: 30px;
color: #999999;;
line-height: 48px;
}
& > span:last-child {
font-size: 30px;
color: #343D65;
margin-left: 16px;
line-height: 48px;
}
.title {
width: 490px;
height: 112px;
display: flex;
align-items: center;
font-size: 32px;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.right {
font-size: 28px;
color: #1365DD;
display: flex;
align-items: center;
.arrow {
width: 16px;
height: 16px;
border-top: 3px solid #CCCCCC;
border-right: 3px solid #CCCCCC;
transform: rotate(45deg);
}
}
}
.item {
position: relative;
&:after {
width: 100%;
height: 1px;
background-color: rgba(216, 221, 230, 0.5);
content: "";
position: absolute;
left: 0;
bottom: 0;
}
}
& > span {
font-size: 32px;
color: #333333;
line-height: 48px;
letter-spacing: 1px;
display: inline-block;
}
.label {
height: 80px;
font-size: 32px;
color: #333333;
display: flex;
align-items: center;
margin-bottom: 16px;
& > em {
font-style: normal;
font-size: 32px;
color: #1365DD;
}
}
.file {
height: 128px;
background: #FFFFFF;
border-radius: 8px;
border: 1px solid #CCCCCC;
box-sizing: border-box;
padding: 0 16px;
margin-bottom: 32px;
& > .u-row {
height: 100%;
.left {
width: 476px;
display: flex;
align-items: center;
& > img {
flex-shrink: 0;
width: 96px;
height: 96px;
}
& > span {
font-size: 32px;
color: #333333;
display: inline-block;
line-height: 44px;
overflow: hidden;
text-overflow: ellipsis;
display:-webkit-box;
-webkit-box-orient:vertical;
-webkit-line-clamp:2;
}
}
& > span {
font-size: 28px;
color: #999999;
}
}
}
.active {
background-color: #F3F6F9;
}
& > text {
width: 100%;
display: inline-block;
font-size: 30px;
color: #649EFD;
text-align: center;
}
.progress {
height: 12px;
background: #F2F4FC;
border-radius: 12px;
position: relative;
margin: 16px 0 64px 0;
.pro-active {
height: 12px;
background: #639EFD;
border-radius: 12px;
position: absolute;
left: 0;
top: 0;
}
}
em {
font-style: normal;
font-size: 28px;
color: #1365DD;
}
::v-deep .u-collapse {
position: relative;
&:after {
content: "";
width: 718px;
height: 1px;
background-color: rgba(216, 221, 230, 0.5);
position: absolute;
left: 0;
bottom: 0;
}
.u-collapse-head {
padding: 40px 0;
}
.u-collapse-content {
font-size: 32px;
color: #333333;
line-height: 48px;
letter-spacing: 1px;
}
}
}
.footer {
height: 112px;
width: 100%;
position: fixed;
left: 0;
bottom: 0;
background: #1365DD;
display: flex;
align-items: center;
justify-content: center;
font-size: 36px;
color: #FFFFFF;
}
}
</style>