<!--
  @description: 查看短信配置详情
  @Modifier: 苏志刚
  @routerPath:
  @date: 2020/08/18-16:50
-->
<template>
  <el-dialog
    v-dialogDrag
    :visible.sync="dialogData.dialog"
    :close-on-click-modal="false"
    :title="title"
    width="700px"
    custom-class="el-dialog__body-p0"
    top="calc((100vh - 611px) / 2)"
  >
    <section class="main" style="margin:10px">
      <table class="tableData">
        <tr>
          <td>使用状态</td>
          <td>
            <span
              v-for="(item, index) in useStatusList"
              v-if="formData.useStatus === item.typecode"
              :key="index"
            >{{ item.typename }}</span>
          </td>
          <td>分类</td>
          <td>
            <span
              v-for="(item, index) in categoryList"
              v-if="formData.category === item.typecode"
              :key="index"
            >{{ item.typename }}</span>
          </td>
        </tr>
        <tr>
          <td>通道组编号</td>
          <td>{{ formData.accessKey }}</td>
          <td>短信签名</td>
          <td>{{ formData.signName }}</td>
        </tr>
        <tr>
          <td>资源编号</td>
          <td colspan="3">
            {{ formData.smsCode }}
          </td>
        </tr>
        <tr>
          <td>资源地址</td>
          <td colspan="3">
            {{ formData.resourceAddress }}
          </td>
        </tr>
        <tr>
          <td>接口密匙</td>
          <td colspan="3">
            {{ formData.secretKey }}
          </td>
        </tr>
        <tr>
          <td>模板ID</td>
          <td colspan="3">
            {{ formData.template }}
          </td>
        </tr>
        <tr>
          <td>备注</td>
          <td colspan="3">
            {{ formData.remark }}
          </td>
        </tr>
      </table>
    </section>
  </el-dialog>
</template>

<script>
/* 公共参数mixin*/
import { procurementSmsMaintainGrounpMixins } from '../mixins/procurementSmsMaintainGrounpMixins'
/* 接口 */
import { querySmsConfigById } from '@/api/procurement/procurementCommonTools.js'
export default {
  name: 'SmsDetailDialog',
  mixins: [procurementSmsMaintainGrounpMixins],
  props: {
    // 弹框展示状态
    dialogData: {
      type: Object,
      default: function() {

      }
    }
  },
  data() {
    return {
      title: '查看短信配置详情', // 弹框标题
      formData: {
        id: '', // 主键id
        useStatus: '00', // 使用状态 00停用；01启用
        remark: '', // 备注
        accessKey: '', // 通道组编号
        category: '00', // 分类 配置字典表 00启瑞云 01阿里云 02七牛云 03腾讯云 04云片 （目前只对接了启瑞云）
        resourceAddress: '', // 资源地址
        secretKey: '', // 接口密匙
        signName: '', // 短信签名
        smsCode: '', // 资源编号
        template: '' // 模板ID(启瑞云这里是短信内容发送信息)
      }
    }
  },
  mounted() {
    this.getTemplateLibraryById(this.dialogData.detailObj)
  },
  methods: {
    // 获取详情
    getTemplateLibraryById(detailObj) {
      querySmsConfigById(detailObj).then(res => {
        if (res.header.ret === '0') {
          this.formData = { ...res.data }
        }
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
