<template>
  <el-form label-width="100px" >
    <el-table :data="templateTableData" ref="templateTable" @row-click="templateTableClick">
      <el-table-column property="fileName" label="文件" show-overflow-tooltip min-width="50%">
        <template slot-scope="scope">
          <el-radio v-model="radio" :label="scope.row.fileName" style="font-weight:normal">
            <i class="fa fa-text-height" style="color:#FFC125"></i>
            &nbsp;{{scope.row.fileName}}
          </el-radio>
        </template>
      </el-table-column>
      <el-table-column property="name" label="名称" show-overflow-tooltip min-width="20%"></el-table-column>
      <el-table-column property="modifyTime" label="最后修改时间" show-overflow-tooltip min-width="30%"></el-table-column>
    </el-table>
  </el-form>
</template>
<script>
export default {
  data() {
    return {
      item: {},
      radio: '',
      templateTableData: []
    }
  },
  methods: {
    getCode() {
      return `<cms:include file="${this.radio.replace(/^template\//, '')}">{ZCMS:<z:lang id="Contentcore.Template.IncludeFile">文件包含</z:lang>}</cms:include>`
    },
    templateTableClick(row) {
      this.item = row
      this.radio = row.fileName
    },
    async init() {
      let res = await axios.get('/ui/template/bindselectgrid', {params: {type: 'Block'}})
      this.templateTableData = res.data.status === 1 ? res.data.data : this.templateTableData
    }
  },
  async created() {
  }
}
</script>
