<template>
  <div slot="title">
    <div class="task_state">
      <div v-if="item.isRead === 0" class="task_dot"></div>
      <div
        v-if="TODO_READ_STATUS_CALSS[item.status] && status == 'wait'"
        :class="TODO_READ_STATUS_CALSS[item.status]"
        class="task_status"
        type="success"
      >
        <span>{{ TODO_READ_STATUS[item.status] }}</span>
      </div>
      <div
        v-else
        :class="TODO_REVOKE_STATUS_CALSS[item.isRevoke]"
        class="task_status"
        type="success"
      >
        <span>{{ TODO_REVOKE_STATUS[item.isRevoke] }}</span>
      </div>
      <div class="task_list_name" v-html="hightLight(searchValue,item.subject)">
      </div>
    </div>
    <div class="task_list_word">
      <div class="task_list_flowname">
        <div class="task_list_flex">
          <div class="task_list_time">
            <i class="icon-time-circle"></i>
            {{ item.createTime }}
          </div>
          <div class="task_list_procDefName" style="margin-left: 40px">
            <i class="icon-dangqianjiedian"></i>
            {{ item.name }}
          </div>
        </div>
        <div>
          <i class="icon-liuchengbianhao"></i>
          <span v-html="hightLight(searchValue,item.procInstId)"></span>
          <i
            class="icon-fuzhi"
            style="color: #409eff"
            @click.stop="(event) => clipboard(item.procInstId, event)"
          ></i>
        </div>
      </div>
      <div class="task_list_user_box">
        <div class="task_list_user">
          <div class="left-img-box">
            <img v-if="item.imgSrc" class="image" :src="item.imgSrc" />
            <span v-else class="text">
              {{ item.ownerName.replace(/,/g, '/').substr(0, 1) }}
            </span>
          </div>
          <span>{{ item.ownerName }}</span>
        </div>
        <div
          class="task_list_operation"
          v-if="status == 'mine' && item.isRevoke === 0"
        >
          <van-button
            type="info"
            :disabled="item.supportMobile != 1"
            size="small"
            @click.stop="$emit('revoke', item.id)"
          >
            撤回
          </van-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  import clipboard from '@/utils/clipboard'
  import hightLight from '@/mixins/hightLight.js'
  export default {
    components: {},
    mixins: [hightLight],
    props: ['item', 'status','searchValue'],
    data() {
      return {
        TODO_READ_STATUS: {
          COPYTO: '待回复',
          COMMU: '待反馈',
          feedback: '已反馈',
          copyto_reply: '已回复',
          FOLLOW: '跟踪',
        },
        TODO_READ_STATUS_CALSS: {
          COPYTO: 'theme-bgcolor',
          COMMU: 'blue-bgcolor',
          feedback: 'green-bgcolor',
          copyto_reply: 'green-bgcolor',
          FOLLOW: 'purple-bgcolor',
        },
        TODO_REVOKE_STATUS: {
          0: '未撤回',
          1: '已撤回',
        },
        TODO_REVOKE_STATUS_CALSS: {
          0: 'theme-bgcolor',
          1: 'gray-bgcolor ',
        },
      }
    },
    methods: { clipboard },
  }
</script>
<style lang="scss" scoped>
  .task_state {
    display: flex;
    align-items: center;
    justify-self: start;
    white-space: nowrap;
    .task_dot {
      &::before {
        content: ''; /* 设置伪元素 */
        display: inline-block;
        width: 6px; /* 设置圆点大小 */
        height: 6px;
        background-color: $base-danger-color; /* 设置圆点颜色 */
        border-radius: 50%; /* 设置圆点形状 */
        margin-right: 8px; /* 设置圆点与文字之间的间距 */
      }
    }
    .task_status {
      margin-right: 8px;
      margin-left: 4px;
      color: $base-white-color;
      font-size: 10px;
      border-radius: 5px;
      padding: 0 5px;
      transform: skew(345deg, 0deg);
      height: 18px;
      line-height: 18px;
      span {
        display: block;
        transform: skew(-345deg, 0deg);
      }
    }
    .task_list_name {
      word-break: break-all;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      font-size: $base-font-size-big;
      font-weight: bold;
      color: $base-text-color;
    }
  }
  .task_list_word {
    font-size: $base-font-size-small;
    i {
      font-size: $base-font-size-big;
    }
    .task_list_flowname {
      padding: 7px 0;
      color: $base-gray-text-color;
      border-bottom: 1px solid $base-gray-line-color;
      .task_list_flex {
        display: flex;
      }
    }
    .task_list_user_box {
      display: flex;
      align-items: center;
      justify-content: space-between;
      white-space: nowrap;
      padding-top: 12px;
      .task_list_procDefName {
        color: $base-text-color;
        word-break: break-all;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        max-width: 140px;
      }
      .task_list_user {
        display: flex;
        align-items: center;
        .left-img-box {
          width: 30px;
          height: 30px;
          line-height: 30px;
          text-align: center;
          border-radius: 50%;
          margin-right: 4px;
          background: $--color-primary;
          .text {
            color: $base-white-color;
          }
          .span {
            color: $base-text-color;
          }
        }
      }
    }
    .task_list_operation {
      float: right;
      .van-button--small {
        width: 78px;
        border-radius: 8px;
      }
    }
  }
</style>
