<template>
  <div>
    <el-form ref="templateForm" label-width="120px" class="blocklist-form">
      <el-form-item label="模板：" prop="template" class="template">
        <el-input type="text" v-model="dataModel.template" class="w300">
          <el-button @click="onClick" slot="append">浏览...</el-button>
        </el-input>
      </el-form-item>
    </el-form>
    <template-dialog :title="templateSelect.title" :show.sync="templateSelect.show" :siteID="templateSelect.siteID" :type="templateSelect.type"
      :value="templateSelect.value" :platformID="templateSelect.platformID" :defaultChecked.sync="templateSelect.defaultChecked"
      @callback="selectedTemplate"></template-dialog>
  </div>
</template>

<script>
import templateSelectDialog from '../../contentcore/templateSelectDialog.vue'
export default {
  components: {
    'template-dialog': templateSelectDialog
  },
  props: {
    dataModel: {
      type: Object,
      default: _ => ({})
    }
  },
  data() {
    return {

      templateSelect: {
        title: '选择模板文件',
        show: false,
        siteID: '',
        type: 'Block',
        value: '',
        platformID: '',
        defaultChecked: ''
      }
    }
  },
  methods: {
    selectedTemplate(template) {
      this.dataModel.template = template
    },
    onClick() {
      this.templateSelect.show = true
      this.templateSelect.defaultChecked = this.dataModel.template
    }
  },
  created() {}
}
</script>

<style scoped>
.w300 {
  width: 300px;
}
</style>
