<template>
  <div>
    <el-row type="flex" justify="center">
      <el-col :span="5">
         <el-form ref="form" :model="form"  label-width="80px">
           <el-form-item :label="$t('read.form.note_title')" prop="note_title">
             <el-input v-model="form.note_title" :placeholder="$t('input_please', { keyword: this.$t('read.form.note_title') })"></el-input>
           </el-form-item>
           <el-form-item :label="$t('read.form.note_content')" prop="note_content">
             <el-input type="textarea" v-model="form.note_content" :placeholder="$t('input_please', { keyword: this.$t('read.form.note_content') })"></el-input>
           </el-form-item>
           <el-form-item class="center">
             <el-button>{{$t('button.query')}}</el-button>
           </el-form-item>
         </el-form>
      </el-col>
    </el-row>
     <el-table :data="tableData" border>
       <el-table-column align="center" prop="paper_name" :label="$t('note.table.paper_name')" />
       <el-table-column align="center" prop="original_text" :label="$t('note.table.original_text')" />
       <el-table-column align="center" prop="note_name" :label="$t('read.form.note_title')" />
       <el-table-column align="center" prop="note_content" :label="$t('read.form.note_content')" />
       <el-table-column align="center" :label="$t('action')" >
         <template slot-scope="scope" >
           <el-button>{{$t('button.edit')}}</el-button>
           <el-button type="danger" @click="del">{{$t('button.del')}}</el-button>
         </template>
       </el-table-column>
     </el-table>

    <div class="block center mt1">
      <el-pagination
        layout="prev, pager, next"
        :total="1000">
      </el-pagination>
    </div>
  </div>
</template>

<script lang="ts">
  import Vue from 'vue'

  export default Vue.extend({
    name: 'note',
    data(){
      return {
        tableData:[{
            note_name:'笔记',
            original_text:'注释原文',
            note_content:'笔记内容',
            paper_name: '《论文》'
        }],
        form:{
          note_name:'',
          note_content:''
        },
        rules:{
          note_title:[{
            required: true,
            message: this.$t('input_please', { keyword: this.$t('read.form.note_title') }),
            trigger: 'blur'
          }],
          note_content:[{
            required: true,
            message: this.$t('input_please', { keyword: this.$t('read.form.note_content') }),
            trigger: 'blur'
          }]
        }
      }
    },
    methods:{
      del(){
        this.$confirm(this.$t('note.tip.confirm_del').toString(),this.$t('tip').toString(),{
          confirmButtonText:this.$t('button.ok').toString(),
          cancelButtonText:this.$t('button.cancel').toString()
        })
      }
    }
  })
</script>
