<!-- 获取验证字段 -->
<template>
  <GlobalWindow
    :title="title"
    v-model:visible="visible"
    :confirm-working="isWorking"
    width="750px"
    @confirm="confirm"
  >
    <el-form :model="form" ref="form" :rules="rules" @submit.prevent>
      <el-form-item label="标签名" prop="name" required>
        <el-input
          v-model="form.name"
          placeholder="请输入标签名"
          v-trim
          maxlength="50"
        />
      </el-form-item>
    </el-form>
  </GlobalWindow>
</template>

<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'

export default {
  name: 'OperaArticleTagWindow',
  extends: BaseOpera,
  components: {
    GlobalWindow
  },
  data () {
    return {
      // 表单数据
      form: {
        id: null,
        name: ''
      },
      // 验证规则
      rules: {
        name: [
          { required: true, message: '请输入标签名' }
        ]
      }
    }
  },
  async created () {
    this.config({
      api: await import('@/api/cms/article.tag'),
      'field.id': 'id'
    })
  }
}
</script>
