<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-06-27 10:12:13
 * @Description:
-->
<template>
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px">
      <el-form-item :label="$t('module.basicData.code')" prop="code">
        <el-input v-model="dataForm.code" :placeholder="$t('placeholder.first')+$t('module.basicData.code')"></el-input>
      </el-form-item>
      <el-form-item :label="$t('module.basicData.name')" prop="name">
        <el-input v-model="dataForm.name" :placeholder="$t('placeholder.first')+$t('module.basicData.name')"></el-input>
      </el-form-item>
      <el-form-item :label="$t('module.basicData.measureType')" prop="type">
        <el-select
          v-model="dataForm.type"
          filterable
          :placeholder="$t('placeholder.second')+$t('module.basicData.measureType')"
        >
          <el-option
            v-for="item in typeArr"
            :key="item.value"
            :label="item.name"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('module.basicData.parentType')" prop="parentType">
        <el-select
          v-model="dataForm.parentType"
          filterable
          :placeholder="$t('placeholder.second')+$t('module.basicData.parentType')"
        >
          <el-option
            v-for="item in parentTypeArr"
            :key="item.value"
            :label="item.name"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
    </el-form>
</template>

<script>
import basicAdd from '@/mixins/basic-add'
export default {
  mixins: [basicAdd],
  data() {
    return {
      urlOptions: {
          submitURL: '/basic/measureTool/',
          infoURL: '/basic/measureTool'
      },
        dataForm: {
          id: '',
          code: '',
          name: '',
          type: '',
          parentType: ''
        },
        parentTypeArr: [],
        typeArr: [
          {
            name: '计数',
            value: '2'
          },
          {
            name: '计量',
            value: '1'
          }
        ],
        parentType: [],
        dataRule: {
          code: [
            { required: true, message: '编码不能为空', trigger: 'blur' }
          ],
          name: [
            { required: true, message: '名称不能为空', trigger: 'blur' }
          ],
          type: [
            { required: true, message: '测量类型不能为空', trigger: 'change' }
          ]
        }
      }
    },
    methods: {
    }
  }
</script>
