123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <template>
- <view class="child-task">
- <view class="task-main" @click="handleEdit">
- <view class="top">
- <!-- <view
- :class="{over: isOver}"
- class="task-checkbox"
- @click.stop="updateTaskStatus">
- <image
- v-if="isOver"
- :src="$static('images/oa/task-check.png')"
- alt
- class="icon" />
- </view> -->
- <view
- :class="{over: isOver}"
- class="check-box"
- @click.stop="updateTaskStatus">
- <text class="icon wk wk-check" />
- </view>
- <view :class="{over: isOver}" class="task-title">
- {{ itemData.name }}
- </view>
- </view>
- <view class="bottom">
- <view
- v-if="itemData.stopTime"
- class="task-time">
- <image :src="$static('images/icon/time.png')" alt="" class="icon" />
- {{ itemData.stopTime }}截止
- </view>
- <wk-avatar
- v-if="itemData.mainUserId"
- :name="itemData.mainUser.realname"
- :avatar="itemData.mainUser.img"
- :size="12"
- class="avatar" />
- </view>
- </view>
- <text class="wk wk-close task-delete" @click="handleDelete" />
- </view>
- </template>
- <script>
- import { SetWorkChildTaskStatus } from 'API/oa/task'
- export default {
- name: 'ChildTaskItem',
- props: {
- itemData: {
- type: Object,
- required: true
- }
- },
- computed: {
- isOver() {
- return this.itemData.status === 5
- }
- },
- methods: {
- /**
- * 更改子任务状态
- */
- updateTaskStatus() {
- // this.$message.confirm('您确定要更改子任务的状态吗?').then(() => {
- // SetWorkChildTaskStatus({
- // taskId: this.itemData.taskId,
- // status: this.isOver ? 1 : 5
- // }).then(() => {
- // this.isOver = !this.isOver
- // }).catch()
- // }).catch();
- this.$emit('status', {
- taskId: this.itemData.taskId,
- status: this.isOver ? 1 : 5,
- index: this.index
- })
- },
- /**
- * 编辑子任务
- */
- handleEdit() {
- getApp().globalData.formBridge = {
- default: {
- name: this.itemData.name,
- mainUserId: [this.itemData.mainUser],
- stopTime: this.itemData.stopTime
- }
- }
- this.$Router.navigateTo({
- url: '/pages_task/add',
- query: {
- id: this.itemData.taskId,
- pid: this.itemData.pid
- }
- })
- },
- /**
- * 删除子任务
- */
- handleDelete() {
- this.$emit('delete', this.itemData.taskId)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .child-task {
- @include left;
- margin: 10rpx 0;
- .task-main {
- flex: 1;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- .top {
- width: 100%;
- @include left;
- .check-box {
- width: 36rpx;
- height: 36rpx;
- border: 1rpx solid #ccc;
- border-radius: 6rpx;
- overflow: hidden;
- margin-right: 25rpx;
- margin-top: 5rpx;
- @include center;
- &.over {
- background-color: $theme-color;
- border-color: $theme-color;
- }
- .icon {
- font-size: 26rpx;
- line-height: 1;
- color: white;
- }
- }
- .task-title {
- flex: 1;
- font-size: 30rpx;
- @include ellipsis;
- &.over {
- text-decoration: line-through;
- color: $gray;
- }
- }
- }
- .bottom {
- @include left;
- margin-top: 10rpx;
- padding-left: 50rpx;
- .task-time {
- font-size: 26rpx;
- color: $light;
- @include center;
- margin-right: 20rpx;
- .icon {
- width: 30rpx;
- height: 30rpx;
- margin-right: 10rpx;
- }
- }
- .avatar {
- width: 60rpx;
- height: 60rpx;
- }
- }
- }
- .task-delete {
- font-size: 32rpx;
- font-weight: bold;
- color: $light;
- margin-right: 30rpx;
- }
- }
- </style>
|