<template>
  <div class="col-sm-12" style="margin: 20px 0px;">
    <header slot="modal-header" class="modal-header">
      <h4 class="modal-title">用户评价</h4>
    </header>
    <article slot="modal-body" class="modal-body clearfix">
      <div class="form-group col-sm-6">
        <label class="col-sm-4 control-label">整体评价：</label>
        <div class="col-sm-8">
          <input
            class="form-control input_view"
            placeholder="暂无评价"
            :value="selectdata.f_overall_evaluation"
            v-model="selectdata.f_overall_evaluation"
            :readonly="mark === 1"/>
        </div>
      </div>
      <div class="form-group col-sm-6">
        <label class="col-sm-4 control-label">受理评价：</label>
        <div class="col-sm-8">
          <input class="form-control input_view" style=""
                 placeholder="暂无评价"
                 v-model="selectdata.f_accept_evaluation"
                 :value="selectdata.f_accept_evaluation"
                 :readonly="mark === 1"/>
        </div>
      </div>
      <div class="form-group col-sm-6">
        <label class="col-sm-4 control-label">勘察评价：</label>
        <div class="col-sm-8">
          <input class="form-control input_view" style=""
                 placeholder="暂无评价"
                 v-model="selectdata.f_investigate_evaluation"
                 :value="selectdata.f_investigate_evaluation"
                 :readonly="mark === 1"/>
        </div>
      </div>
      <div class="form-group col-sm-6">
        <label class="col-sm-4 control-label">施工评价：</label>
        <div class="col-sm-8">
          <input class="form-control input_view" style=""
                 placeholder="暂无评价"
                 v-model="selectdata.f_construction_evaluation"
                 :value="selectdata.f_construction_evaluation"
                 :readonly="mark === 1"/>
        </div>
      </div>
      <div class="form-group col-sm-6" >
        <label class="col-sm-4 control-label">通气评价：</label>
        <div class="col-sm-8">
          <input class="form-control input_view" style=""
                 placeholder="暂无评价"
                 v-model="selectdata.f_ventilation_evaluation"
                 :value="selectdata.f_ventilation_evaluation"
                 :readonly="mark === 1"/>
        </div>
      </div>
      <div class="form-group col-sm-12">
        <label class="col-sm-2 control-label">整体意见：</label>
        <div class="col-sm-10">
          <input class="form-control input_view" style=""
                 placeholder="暂无意见"
                 v-model="selectdata.f_overall_opinion"
                 :value="selectdata.f_overall_opinion"
                 :readonly="mark === 1"/>
        </div>
      </div>
    </article>
    <header slot="modal-header" class="modal-header">
      <h4 class="modal-title">流程消耗时间</h4>
    </header>
    <data-grid :model="model" v-ref:grid class="list_area table_sy" style="padding: 0px">
      <template partial='head'>
        <tr>
          <th class="textNoLineBreak">序号</th>
          <th class="textNoLineBreak">办理环节</th>
          <th class="textNoLineBreak">操作人</th>
          <th class="textNoLineBreak">开始时间</th>
          <th class="textNoLineBreak">完成时间</th>
          <th class="textNoLineBreak">总消耗时间</th>
        </tr>
      </template>
      <template partial='body'>
        <tr>
          <td style="text-align: center;">
            <nobr>{{$index+1}}</nobr>
          </td>
          <td style="text-align: center;">
            <nobr>{{row.defname}}</nobr>
          </td>
          <td style="text-align: center;">
            <nobr>{{row.person}}</nobr>
          </td>
          <td style="text-align: center;">
            <nobr>{{row.sendtime}}</nobr>
          </td>
          <td style="text-align: center;">
            <nobr>{{row.finishtime}}</nobr>
          </td>
          <td style="text-align: center;">
            <nobr>{{row.time}}</nobr>
          </td>
        </tr>
      </template>
    </data-grid>
  </div>
</template>
<script>
import {getNowDate, isEmpty} from '../../../Util'
import {PagedList} from 'vue-client'
import Vue from 'vue'
import {HttpResetClass} from 'vue-client'
// Date格式化
Date.prototype.Format = function (fmt) {
  var o = {
    'M+': this.getMonth() + 1, // 月份
    'd+': this.getDate(), // 日
    'H+': this.getHours(), // 小时
    'm+': this.getMinutes(), // 分
    's+': this.getSeconds(), // 秒
    'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
    'S': this.getMilliseconds() // 毫秒
  }
  if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
  for (var k in o) {
    if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
  }
  return fmt
}

export default {
  title: '绩效',
  props: {
    selectdata: {
      type: Object
    },
    mark: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      model: {
        data: null
      },
      defnames: []
    }
  },
  ready() {
    this.applyTypeChange()
  },
  methods: {
    async applyTypeChange() {
      let res = await this.$resetpost('rs/logic/getDefnamePerformance',
        {f_apply_type: this.selectdata.f_apply_type, f_process_id: this.selectdata.f_process_id},
        {resolveMsg: null, rejectMsg: '节点信息获取失败！！！'}
      )

      this.model.data = res.data
      console.log("当前信息", this.model.data)
    }

  },
  events: {},
  computed: {
    installdate() {
      return function (f_install_date) {
        if (isEmpty(f_install_date)) {
          return new Date().Format('yyyy-MM-dd HH:mm:ss')
        }
        return f_install_date
      }
    }

  },
  watch: {}
}
</script>
<style scoped>
.textNoLineBreak {
  white-space: nowrap;
}

.input_view {
  background-color: #ffffff;
  border-radius: 2px;
  border: solid 1px #c7c7c7 !important;
  color: #333333 !important;
  font-size: 15px !important;
}

.input_view[readonly] {
  border: 1px solid #DDD !important;
  color: #ACA899 !important;
}

.input_view:disabled {
  border: 1px solid #DDD !important;
  color: #ACA899 !important;
}
</style>
