<template>
  <div class="ls-vertical">
    <div class="ls-container">
      <div v-if="state==1">
        <div class="title">
          <span>处理信息</span>
        </div>
        <div>
          <el-form ref="ruleForm" class="demo-ruleForm">
            <el-form-item label="请选择" prop="resource">
              <el-radio-group class="cl" v-model="result" v-for="(item,index) in processStatus" :key="index">
                <el-radio :label="item.label">{{item.text}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </div>
        <el-form ref="information" label-width="80px">
          <el-form-item label="处理信息">
            <el-input type="textarea" @blur="processInformation" placeholder="请输入处理说明" maxlength="300" show-word-limit
              v-model="information"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <div v-if="state==2">
        <div class="title">
          <span>处理信息</span>
        </div>
        <table class="ls-table-comm">
          <tbody>
            <tr>
              <td style="width: 16%;">完成状态</td>
              <td colspan="5">{{reviewerParam.status}}</td>
            </tr>
            <tr>
              <td>处理人员</td>
              <td colspan="5">{{reviewerParam.creater}}</td>
            </tr>
            <tr>
              <td>处理时间</td>
              <td colspan="5">{{reviewerParam.createTime}}</td>
            </tr>
            <tr>
              <td>备注信息</td>
              <td colspan="5">{{reviewerParam.content}}</td>
            </tr>
          </tbody>
        </table>
      </div>


    </div>
  </div>
</template>

<script>
  import commonSelectList from '../../../../common/commonSelectList.js'
  export default {
    name: 'task-process-informationtab',
    props: {
      infoStatus: {
        type: String,
        default: '',
        required: true
      },
      reviewerParam: {
        type: Object,
        default: () => {},
        required: true
      }
    },
    components: {

    },

    created() {
      this.tasklist()
      this.infost()
    },
    mounted() {

    },
    methods: {
       tasklist() {
         console.log(this.submitStatus)
         let infoStatus = localStorage.getItem('taskStatus')
        if (infoStatus =='finish') {
          this.state = 2
        } else {
          this.state = 1
        }
      },
      async infost() {
        let  submitStatus = await commonSelectList.initDictDataGet(this, 'Crm_Task_Operate');
        console.log(this.infoStatus, 7777)
        console.log(submitStatus, `字典数组`)
        let infoStatus = localStorage.getItem('taskStatus')
        for (var i = 0; i < submitStatus.length; i++) {
          if (submitStatus[i].ext1 == infoStatus) {
            let arrData = {
              label: submitStatus[i].vaule,
              text: submitStatus[i].key
            }
            this.processStatus.push(arrData)
            console.log('成功次数')
          }

        }
        console.log(8888, this.processStatus)
      },
      processInformation() {
        let taskinfo = {
          information: this.information,
          result: this.result
        }
        console.log(this.result)
        this.$emit('information', taskinfo);
      }


    },
    data() {
      return {
        users: [],
        information: "",
        submitStatus:[],
        state: 1,
        statusText:'',
        result: '', //选择处理信息方式
        taskRad: 2, //根据不同人进入的处理信息状态不同
        processStatus: [],
        toBeVerified: [{
          label: "adjust_cancel",
          text: "取消任务"
        }, ], //待验证状态
        adjustment: [{
            label: "1",
            text: "已取消"
          },
          {
            label: "2",
            text: "待处理"
          }
        ], //任务调整状态
        pending: [{
            label: "dealed",
            text: "已处理"
          },
          {
            label: "adjust",
            text: "调整任务"
          },
          {
            label: "change",
            text: "转办"
          }
        ], //待处理状态
        processed: [{
            label: "dealing",
            text: "已完成"
          },
          {
            label: "unpass",
            text: "退回任务"
          },
          {
            label: "cancel",
            text: "已取消"
          }
        ], //待验证状态
        taskAdjustment: [{
            label: "1",
            text: "已取消"
          },
          {
            label: "2",
            text: "待处理"
          },
        ], //任务调整状态
        taskDraft: [{
            label: "adjust_cancel",
            text: "取消"
          },
          {
            label: "submit",
            text: "提交"
          },
        ], //草稿状态
      }
    }
  }
</script>

<style scoped lang="scss">
  .ls-container {
    min-height: auto;
    margin: 0;
    border-top: 1px solid #f4f4f4;
    overflow: hidden;

    .title {
      margin-top: 20px;
      margin-bottom: 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;

      >span {
        color: #357FB9;
        font-size: 16px;
        font-weight: bold;
      }

      .right {
        display: flex;
        margin-bottom: 5px;

        .leaf {
          width: 80px;
          height: 31px;
          text-align: center;
          line-height: 31px;
          background: #4BCED0;
          border-radius: 10px 0px 10px 0px;
          margin-left: 10px;
        }

        .important {
          background: #FEF0F0;
          border: 1px solid #FBC4C4;
          color: #FB6260;
        }
      }

    }

    .cl {
      margin-left: 20px;
    }
  }
</style>
