<template>
  <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
    <el-form-item label="公司名称" prop="name">
      <el-input v-model="formData.name" placeholder="请输入公司名称" :readonly="isReadOnly" clearable :style="{width: '100%'}"></el-input>
    </el-form-item>
    <el-form-item label="资质名称" prop="qual_name">
      <el-input v-model="formData.qual_name" placeholder="请输入资质名称" :readonly="isReadOnly" clearable :style="{width: '100%'}"></el-input>
    </el-form-item>
    <el-form-item label="资质等级" prop="qual_level">
      <el-input v-model="formData.qual_level" placeholder="请输入资质等级" :readonly="isReadOnly" clearable :style="{width: '100%'}"></el-input>
    </el-form-item>
    <el-form-item label="有效期" prop="qual_validity">
        <el-date-picker type="datetime" v-model="formData.qual_validity" format="yyyy-MM-dd HH:mm:ss"
          value-format="yyyy-MM-dd HH:mm:ss" :style="{width: '100%'}" placeholder="请选择有效期" clearable>
        </el-date-picker>
    </el-form-item>
    <el-form-item label="资质范围" prop="qual_scope">
      <el-input v-model="formData.qual_scope" placeholder="请输入资质范围" :readonly="isReadOnly" clearable :style="{width: '100%'}">
      </el-input>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
    inheritAttrs: false,
    components: {},
    props: {
      data: {
        type: Object
      },
      isReadOnly: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {
        formData: {
          name: undefined,
          qual_name: undefined,
          qual_level: undefined,
          qual_validity: null,
          qual_scope: undefined,
        },
        rules: {
          name: [{
            required: true,
            message: '请输入公司名称',
            trigger: 'blur'
          }],
          qual_name: [{
            required: true,
            message: '请输入资质名称',
            trigger: 'blur'
          }],
          qual_level: [{
            required: true,
            message: '请输入资质等级',
            trigger: 'blur'
          }],
          qual_validity: [{
            required: true,
            message: '请选择有效期',
            trigger: 'change'
          }],
          qual_scope: [{
            required: true,
            message: '请输入资质范围',
            trigger: 'blur'
          }],
        },
      }
    },
    computed: {},
    watch: {},
    created() {},
    mounted() {
        if (this.data) this.formData = this.data;
    },
    methods: {}
}
</script>

<style>
</style>
