| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448 |
- <template>
- <view class="task-card">
- <view @click="handleClick">
- <view class="task-card__header">
- <view class="task-card__title">{{dataSource.task_type}}</view>
- <view class="task-card__name">处理人:{{dataSource.operator_user}}</view>
- </view>
- <view class="task-card__content">
- <view class="content__header">
- <view class="content__title">{{dataSource.start_time}} → {{dataSource.last_time}}</view>
- <view class="content__tag" v-if="dataSource.task_status!=='已完成'"
- :class="{warn:dataSource.is_overdue}">
- {{dataSource.is_overdue?`已逾期${dataSource.diff_day || 0}天`:`距离结束${dataSource.diff_day||0}天`}}
- </view>
- <view class="content__tag warn" v-if="dataSource.task_status==='已完成' && dataSource.is_overdue">
- {{dataSource.is_overdue&&`已逾期${dataSource.diff_day || 0}天`}}
- </view>
- </view>
- <view class="content__desc">
- {{dataSource.tesk_msg}}
- </view>
- </view>
- </view>
- <view class="task-card__actions" :class="{'flex-end':dataSource.task_status === '待处理'}" v-if="type==='action'">
- <view class="start-btn" v-if="dataSource.task_status === '待处理'">
- <u-button text="接收任务" size="mini" type="primary" @click="handleReceiveClick"></u-button>
- </view>
- <view class="actions__list" :class="{'border-none':dataSource.task_status === '已完成'}"
- v-if="dataSource.task_status !== '待处理'">
- <view class="actions__item middle">
- <view class="actions__icon">
- <image src="@/static/image/task/icon/progress.png" mode="aspectFit" class="img"></image>
- </view>
- <view class="actions__text">{{dataSource.clock_in_count||0}}次</view>
- </view>
- <view class="actions__item middle">
- <view class="actions__icon">
- <image src="@/static/image/task/icon/tool.png" mode="aspectFit" class="img"></image>
- </view>
- <view class="actions__text">
- <u-tooltip :zIndex="8" :showCopy="false" :overlay="false" size="12" :color="'#1B76FF'"
- :text="meter(dataSource.walk_length) "
- :buttons="[meter(dataSource.walk_length) ]"></u-tooltip>
- <!-- {{dataSource.walk_length | meter}} -->
- </view>
- </view>
- <view class="actions__item middle">
- <view class="actions__icon">
- <image src="@/static/image/task/icon/area.png" mode="aspectFit" class="img"></image>
- </view>
- <view class="actions__text">
- <u-tooltip :zIndex="8" :showCopy="false" :overlay="false" size="12" :color="'#1B76FF'"
- :text="numberFixed(dataSource.walk_area) + '㎡'"
- :buttons="[numberFixed(dataSource.walk_area) + '㎡']"></u-tooltip>
- </view>
- </view>
- </view>
- <template v-if="dataSource.task_status === '处理中'">
- <view class="actions__btns">
- <view class="actions__btn blocked" v-if="dataSource.walk_status === TASK_WALK_TYPE.IS_READY"
- @click="handleBtnClick(TASK_ACTION_TYPE.START)">
- <view class="actions__btn-icon">
- <image src="@/static/image/task/icon/play.svg" mode="aspectFit" class="img"></image>
- </view>
- <view class="actions__btn-text">开始</view>
- </view>
- <template v-else>
- <view class="actions__btn" @click="handleBtnClick(TASK_ACTION_TYPE.PAUSE)"
- v-if="dataSource.walk_status === TASK_WALK_TYPE.IS_RECORDING">
- <view class="actions__btn-icon">
- <image src="@/static/image/task/icon/pause.svg" mode="aspectFit" class="img">
- </image>
- </view>
- <view class="actions__btn-text">暂停</view>
- </view>
- <view class="actions__btn" @click="handleBtnClick(TASK_ACTION_TYPE.RESTART)"
- v-if="dataSource.walk_status === TASK_WALK_TYPE.IS_PAUSED">
- <view class="actions__btn-icon">
- <image src="@/static/image/task/icon/play.svg" mode="aspectFit" class="img">
- </image>
- </view>
- <view class="actions__btn-text">重新开始</view>
- </view>
- <view class="actions__btn" @click="handleBtnClick(TASK_ACTION_TYPE.CLOCK)">
- <view class="actions__btn-icon">
- <image src="@/static/image/task/icon/clockin.svg" mode="aspectFit" class="img">
- </image>
- </view>
- <view class="actions__btn-text">打卡</view>
- </view>
- <view class="actions__btn" @click="handleBtnClick(TASK_ACTION_TYPE.FINISHED)">
- <view class="actions__btn-icon">
- <image src="@/static/image/task/icon/finished.svg" mode="aspectFit" class="img">
- </image>
- </view>
- <view class="actions__btn-text">填报</view>
- </view>
- </template>
- </view>
- <view class="actions__tips" v-if="dataSource.walk_status === TASK_WALK_TYPE.IS_RECORDING">
- (任务轨迹监测中,如需暂停请点击暂停任务…)</view>
- </template>
- </view>
- <view class="task-card__footer" v-else>
- <view class="task-card__decoration-title">
- 任务派发人:{{dataSource.owner_user}}
- </view>
- <view class="task-card__decoration-title">
- 任务监督人:{{dataSource.supervisor_user}}
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- TASK_ACTION_TYPE,
- TASK_WALK_TYPE
- } from '@/util/constants.js';
- export default {
- props: {
- type: {
- type: String,
- default: 'action'
- },
- status: {
- type: Number,
- default: 1
- },
- dataSource: {
- type: Object,
- default: () => ({})
- }
- },
- data() {
- return {
- TASK_ACTION_TYPE,
- TASK_WALK_TYPE
- }
- },
- filters: {
- numberFixed: function(val) {
- if(!val){
- return 0
- }
-
- return Number(val) ? Number(val).toFixed(2) : (val || 0)
- },
- meter: function(val) {
- if(!val){
- return '0m'
- }
-
- return val / 1000 > 1 ? (val / 1000).toFixed(2) + 'km' : Number(val).toFixed(2) + 'm'
- },
- },
- mounted() {},
- methods: {
- numberFixed(val) {
- if(!val){
- return 0
- }
-
- return Number(val) ? Number(val).toFixed(2) : val
- },
- meter: function(val) {
- if(!val){
- return '0 m'
- }
-
- return val / 1000 > 1 ? (val / 1000).toFixed(2) + 'km' : Number(val).toFixed(2) + 'm'
- },
- handleClick() {
- this.$emit('click', this.dataSource.task_id);
- },
- handleBtnClick(type) {
- this.$emit('btntap', type, this.dataSource.task_id);
- },
- handleReceiveClick() {
- this.$emit('confirm', this.dataSource.task_id);
- },
- handleResetRecordLocation() {
- this.$emit('checkRecordStatus', this.dataSource.task_id)
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .task-card {
- background-color: #fff;
- border-radius: 16rpx;
- padding: 16rpx;
- margin-bottom: 24rpx;
- &__header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- &__title {
- flex: 1 1 auto;
- font-size: 14px;
- color: #333;
- line-height: 40rpx;
- margin-right: 100rpx;
- padding-bottom: 10rpx;
- @include hairline-bottom(rgba(151, 151, 151, 0.09));
- }
- &__name {
- flex: 0 0 auto;
- font-size: 12px;
- line-height: 40rpx;
- color: #1B76FF;
- }
- &__content {
- padding: 10rpx 16rpx;
- }
- .content {
- &__header {
- display: flex;
- align-items: center;
- }
- &__title {
- font-size: 12px;
- line-height: 36rpx;
- color: #1B76FF;
- margin-right: 20rpx;
- }
- &__tag {
- padding: 0 12rpx;
- color: #1B76FF;
- font-size: 12px;
- line-height: 28rpx;
- border-radius: 8rpx;
- border: 1px solid #1B76FF;
- &.warn {
- color: #F33E43;
- border: 1px solid #F33E43;
- }
- }
- &__desc {
- height: 56rpx;
- padding: 10rpx 0;
- color: #656565;
- font-size: 12px;
- line-height: 36rpx;
- margin-bottom: 10rpx;
- @include line(2);
- }
- }
- &__actions {
- padding: 0 20rpx;
-
- &.flex-end {
- text-align: right;
- }
- .start-btn {
- display: inline-block;
- // float: right;
- }
- .actions {
- &__list {
- display: flex;
- align-items: center;
- padding: 20rpx 0;
- border-bottom: 1px solid rgba(2, 2, 2, 0.3);
- &.border-none {
- border-bottom-color: transparent;
- }
- }
- &__item {
- box-sizing: border-box;
- width: 0;
- flex: 1 1 auto;
- height: 50rpx;
- display: flex;
- align-items: center;
- @include hairline-right(rgba(0, 0, 0, 0.3));
- // @include line;
- &.middle {
- justify-content: center;
- padding: 0 30rpx;
-
- .actions__text {
- width: 0;
- // background-color: #F33E43;
- flex: 1 1 auto;
- text-align: right;
-
- ::v-deep {
- .u-tooltip__wrapper {
- width: 100%;
- }
-
- .u-tooltip__wrapper__text {
- width: 100%;
- // font-size: 12px;
- // text-align: right;
- @include line;
- }
- }
- }
- }
- &.right {
- padding-left: 20rpx;
- padding-right: 2rpx;
- justify-content: space-between;
- .actions__text {
- // width: 0;
- // flex: 1 1 auto;
- // text-align: right;
- ::v-deep {
- // .u-tooltip__wrapper {
- // width: 100%;
- // }
-
- .u-tooltip__wrapper__text {
- width: 100%;
- // font-size: 12px;
- // text-align: right;
- // @include line;
- }
- }
- }
- }
- &:last-child {
- @include hairline-right(transparent);
- }
- }
- &__icon {
- flex: 0 0 auto;
- width: 32rpx;
- height: 32rpx;
- margin-right: 36rpx;
- .img {
- width: 100%;
- height: 100%;
- }
- }
- &__text {
- font-size: 14px;
- line-height: 36rpx;
- color: #1B76FF;
-
- // @include line;
- }
- &__btns {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 24rpx 0;
- }
- &__btn {
- display: flex;
- align-items: center;
- padding: 10rpx 20rpx;
- border-radius: 8rpx;
- background-color: #F8F8F8;
- &.blocked {
- flex: 1;
- justify-content: center;
- }
- &-icon {
- width: 40rpx;
- height: 40rpx;
- overflow: hidden;
- .img {
- width: 100%;
- height: 100%;
- }
- }
- &-text {
- min-width: 88rpx;
- text-align: center;
- font-size: 12px;
- line-height: 36rpx;
- color: #555555;
- }
- }
- &__tips {
- font-size: 12px;
- line-height: 28rpx;
- color: #1B76FF;
- margin-bottom: 8rpx;
- }
- }
- }
- &__footer {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20rpx 16rpx;
- }
- &__decoration-title {
- position: relative;
- padding-left: 24rpx;
- font-size: 12px;
- line-height: 36rpx;
- height: 36rpx;
- color: #656565;
- &::before {
- content: '';
- position: absolute;
- left: 0;
- top: 50%;
- width: 8rpx;
- height: 30rpx;
- transform: translateY(-50%);
- background-color: #1B76FF;
- border-radius: 8rpx;
- }
- }
- }
- </style>
|