<!--
 * @Author: liuzhenlin 461480418@qq.ocm
 * @Date: 2023-02-15 16:25:58
 * @LastEditors: liuzhenlin
 * @LastEditTime: 2023-03-06 16:12:12
 * @Description: file content
 * @FilePath: \oms\pages\schedule\supervise\components\taskDetails.vue
-->
<template>
  <view>
    <view class="info-item">
      <u-row justify="space-between" gutter="10">
        <u-col span="12">
          <view class="flex_l">
            <view class="label">督办内容：</view>
            <view class="desc">{{ detail.taskDesc }}</view>
          </view>
        </u-col>
      </u-row>
    </view>
    <view class="info-item">
      <u-row justify="space-between" gutter="10">
        <u-col span="12">
          <view class="flex_l">
            <view class="label">要求完成时间：</view>
            <view class="desc">{{ parseTime(detail.taskEndDate, '{y}-{m}-{d}') }}</view>
          </view>
        </u-col>
      </u-row>
    </view>
    <view class="info-item">
      <u-row justify="space-between" gutter="10">
        <u-col span="12">
          <view class="flex_l">
            <view class="label">负责人：</view>
            <view class="desc">{{ selectDictLabel(userList, detail.mainUserId) }}</view>
          </view>
        </u-col>
      </u-row>
    </view>
    <view class="info-item">
      <u-row justify="space-between" gutter="10">
        <u-col span="12">
          <view class="flex_l">
            <view class="label">协办人：</view>
            <view class="desc">{{ generateOwnerUser(detail.ownerUserId) }}</view>
          </view>
        </u-col>
      </u-row>
    </view>
    <view class="info-item">
      <u-row justify="space-between" gutter="10">
        <u-col span="12">
          <view class="flex_l">
            <view class="label">督办人：</view>
            <view class="desc">{{ selectDictLabel(userList, detail.watchUserId) }}</view>
          </view>
        </u-col>
      </u-row>
    </view>
    <view class="info-item">
      <u-row justify="space-between" gutter="10">
        <u-col span="12">
          <view class="flex_l">
            <view class="label">监办人：</view>
            <view class="desc">{{ selectDictLabel(userList, detail.supervisorUserId) }}</view>
          </view>
        </u-col>
      </u-row>
    </view>
  </view>
</template>

<script>
  export default {
    props: {
      detail: {
        type: [Object],
        default: {},
      },
      taskTypeOption: {
        type: [Array],
        default: [],
      },
      sourceOption: {
        type: [Array],
        default: [],
      },
      userList: {
        type: [Array],
        default: [],
      },
    },
    data() {
      return {}
    },

    mounted() {},

    methods: {
      // 协办人
      generateOwnerUser(ids = null) {
        let nameArr = []
        if (ids) {
          let idList = ids.split(',')
          console.log(idList)
          idList.forEach((item) => {
            let findUser = this.userList.find((user) => user.key == item)
            console.log(findUser)
            if (findUser.value) nameArr.push(findUser.value)
          })
        }
        return nameArr.join(',')
      },
    },
  }
</script>

<style lang="scss" scoped>
  .info-item {
    padding: 20rpx;
    .label {
      color: #646464;
      font-size: 26rpx;
    }
    .desc {
      font-size: 26rpx;
      text-indent: 20rpx;
    }
  }
</style>
