<template>
  <div>
    <el-dialog
      v-dialogDrag
      :visible.sync="showModal"
      width="700px"
      title="通知消息"
    >
      <div class="maxHeight">
        <table class="tableClass">
          <tbody>
            <tr>
              <th style="width: 80px;">
                类型
              </th>
              <td v-if="obj.type == 0">
                通知
              </td>
              <td v-else-if="obj.type == 1">
                消息
              </td>
              <td v-else>
                待办
              </td>
            </tr>
            <tr>
              <th style="width: 80px;">
                标题
              </th>
              <!--<td><a @click.stop="_toLink(obj.msgType)">{{obj.title}}</a></td>-->
              <td>{{ obj.title }}</td>
            </tr>
            <tr>
              <th style="width: 80px;">
                内容
              </th>
              <td v-html="obj.content" />
            </tr>
            <tr>
              <th style="width: 80px;">
                开始时间
              </th>
              <td>{{ beginTime }}</td>
            </tr>
            <tr>
              <th style="width: 80px;">
                结束时间
              </th>
              <td>{{ endTime }}</td>
            </tr>
            <tr>
              <th style="width: 80px;">
                创建时间
              </th>
              <td>{{ this.$dateformat(obj.ctime, "yyyy-mm-dd HH:MM") }}</td>
            </tr>
          </tbody>
        </table>
      </div>
    </el-dialog>
  </div>
</template>
<script>
/**
 * 系统消息表详情
 */
import { messageType } from '../../../api'
import global from '../../../api/config'
export default {
  data() {
    return {
      obj: {},
      beginTime: '/',
      endTime: '/',
      showModal: false
    }
  },
  methods: {
    _open(obj) {
      this.showModal = true
      this.obj = obj
      if (obj.beginTime) {
        this.beginTime = this.$dateformat(obj.beginTime, 'yyyy-mm-dd HH:MM')
      } else {
        this.beginTime = '/'
      }
      if (obj.endTime) {
        this.endTime = this.$dateformat(obj.endTime, 'yyyy-mm-dd HH:MM')
      } else {
        this.endTime = '/'
      }
    },
    _toLink: async function(msgType) {
      const result = await messageType.getLinkByType({ msgType: msgType })
      window.open(global.envURL + '/#' + result.link, '_blank')
    }
  }
}
</script>
