|
@@ -0,0 +1,177 @@
|
|
|
+<template>
|
|
|
+ <a-card>
|
|
|
+ <a-row :gutter="16">
|
|
|
+ <div v-if="taskInfo.isComplete == true" style="margin-top:5px;">
|
|
|
+ <a-col :span="2">
|
|
|
+ <a-tooltip>
|
|
|
+ <template slot="title">
|
|
|
+ 标记为未完成
|
|
|
+ </template>
|
|
|
+ <a-button shape="circle" type="primary" icon="check" size="small" @click="completeTask" />
|
|
|
+ </a-tooltip>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="20">
|
|
|
+ <a-checkable-tag>
|
|
|
+ <del> <span style="font-size:15px">{{ taskInfo.title }}</span></del>
|
|
|
+ </a-checkable-tag>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="2">
|
|
|
+ <div v-if="taskInfo.isImportant == false">
|
|
|
+ <a-tooltip>
|
|
|
+ <template slot="title">
|
|
|
+ 将任务标记为重要
|
|
|
+ </template>
|
|
|
+ <a-popconfirm :visible="false" @visibleChange="signImportance">
|
|
|
+ <a-icon type="star" />
|
|
|
+ </a-popconfirm>
|
|
|
+ </a-tooltip>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <a-tooltip>
|
|
|
+ <template slot="title">
|
|
|
+ 删除重要性
|
|
|
+ </template>
|
|
|
+ <a-popconfirm :visible="false" @visibleChange="signImportance">
|
|
|
+ <a-icon style="color:#4169E1" type="star" theme="filled" />
|
|
|
+ </a-popconfirm>
|
|
|
+ </a-tooltip>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <a-col :span="2" style="margin-top:5px;">
|
|
|
+ <a-tooltip>
|
|
|
+ <template slot="title">
|
|
|
+ 标记为已完成
|
|
|
+ </template>
|
|
|
+ <a-button shape="circle" size="small" @click="completeTask" />
|
|
|
+ </a-tooltip>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="20">
|
|
|
+ <a-input v-model="taskInfo.title" @pressEnter="updateTask" />
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="2" style="margin-top:5px;">
|
|
|
+ <div v-if="taskInfo.isImportant == false">
|
|
|
+ <a-tooltip>
|
|
|
+ <template slot="title">
|
|
|
+ 将任务标记为重要
|
|
|
+ </template>
|
|
|
+ <a-popconfirm :visible="false" @visibleChange="signImportance">
|
|
|
+ <a-icon type="star" />
|
|
|
+ </a-popconfirm>
|
|
|
+ </a-tooltip>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <a-tooltip>
|
|
|
+ <template slot="title">
|
|
|
+ 删除重要性
|
|
|
+ </template>
|
|
|
+ <a-popconfirm :visible="false" @visibleChange="signImportance">
|
|
|
+ <a-icon style="color:#4169E1" type="star" theme="filled" />
|
|
|
+ </a-popconfirm>
|
|
|
+ </a-tooltip>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </div>
|
|
|
+ </a-row>
|
|
|
+ <a-row style="margin-top:15px">
|
|
|
+ <a-col>
|
|
|
+ <a-list v-show="isShowStepList" item-layout="horizontal" size="small" :data-source="stepData">
|
|
|
+ <a-list-item slot="renderItem" slot-scope="item, index">
|
|
|
+ <div v-if="item.isStepComplete == true">
|
|
|
+ <a-list-item-meta>
|
|
|
+ <a slot="title" href="#"><del v-show="true">{{ item.title }}</del></a>
|
|
|
+ <div slot="avatar">
|
|
|
+ <a-tooltip>
|
|
|
+ <template slot="title">
|
|
|
+ 标记为未完成
|
|
|
+ </template>
|
|
|
+ <a-button shape="circle" type="primary" icon="check" size="small" @click="completeStep(index)" />
|
|
|
+ </a-tooltip>
|
|
|
+ </div>
|
|
|
+ </a-list-item-meta>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <a-list-item-meta>
|
|
|
+ <a slot="title" href="#">{{ item.title }}</a>
|
|
|
+ <div slot="avatar">
|
|
|
+ <a-tooltip>
|
|
|
+ <template slot="title">
|
|
|
+ 标记为已完成
|
|
|
+ </template>
|
|
|
+ <a-button shape="circle" size="small" @click="completeStep(index)" />
|
|
|
+ </a-tooltip>
|
|
|
+ </div>
|
|
|
+ </a-list-item-meta>
|
|
|
+ </div>
|
|
|
+ <a-tooltip>
|
|
|
+ <template slot="title">
|
|
|
+ 删除步骤
|
|
|
+ </template>
|
|
|
+ <a-popconfirm title="是否确认删除步骤?" ok-text="是" cancel-text="否" @confirm="deleteStep">
|
|
|
+ <a-icon type="close" />
|
|
|
+ </a-popconfirm>
|
|
|
+ </a-tooltip>
|
|
|
+ </a-list-item>
|
|
|
+ </a-list>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-row>
|
|
|
+ <a-col>
|
|
|
+ <a-input v-model="stepContent" :placeholder="isShowStepList?' 下一步 ':' 添加步骤 '" @pressEnter="addStep">
|
|
|
+ <a-icon slot="prefix" type="plus" />
|
|
|
+ </a-input>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ taskInfo: {
|
|
|
+ type: Object,
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ type: Array,
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ stepContent: '',
|
|
|
+ stepData: this.data
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ // 是否显示任务步骤列表
|
|
|
+ isShowStepList: function() {
|
|
|
+ return this.stepData.length > 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ completeTask() {
|
|
|
+ this.taskInfo.isComplete = !this.taskInfo.isComplete
|
|
|
+ },
|
|
|
+ updateTask(e) {
|
|
|
+ this.$message.success('修改任务')
|
|
|
+ },
|
|
|
+ signImportance() {
|
|
|
+ this.taskInfo.isImportant = !this.taskInfo.isImportant
|
|
|
+ },
|
|
|
+ addStep() {
|
|
|
+ this.stepData.push({
|
|
|
+ 'title': this.stepContent
|
|
|
+ })
|
|
|
+ this.stepContent = ''
|
|
|
+ },
|
|
|
+ completeStep(index) {
|
|
|
+ this.stepData[index].isStepComplete = !this.stepData[index].isStepComplete
|
|
|
+ },
|
|
|
+ deleteStep(e) {
|
|
|
+ this.$message.success('删除步骤')
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|