<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-04-10 14:14:37
 * @Description:
-->
<template>
    <el-form
      :model="dataForm"
      :rules="dataRule"
      ref="dataForm"
      @keyup.enter.native="dataFormSubmit()"
      label-width="80px"
    >
      <el-form-item label="编码" prop="code">
        <el-input v-model="dataForm.code" placeholder="编码"></el-input>
      </el-form-item>
      <el-form-item label="名称" prop="name">
        <el-input v-model="dataForm.name" placeholder="名称"></el-input>
      </el-form-item>
      <el-form-item label="描述" prop="descs">
        <el-input v-model="dataForm.descs" placeholder="描述"></el-input>
      </el-form-item>
      <el-form-item label="联系地址" prop="address">
        <el-input
          v-model="dataForm.address"
          placeholder="联系地址"
        ></el-input>
      </el-form-item>
      <el-form-item label="类型" prop="type">
        <el-radio-group v-model="dataForm.type">
          <el-radio label="1">内部工厂</el-radio>
          <el-radio label="2">供应商</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="供应商" v-show="false" prop="supplier">
        <el-select
          v-model="dataForm.supplier"
          filterable
          placeholder="请选择供应商"
        >
          <el-option
            v-for="item in supplierArr"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          >
          </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/factory/',
          infoURL: '/basic/factory'
      },
      dataForm: {
        id: '',
        code: '',
        name: '',
        address: '',
        type: 0,
        supplier: '',
        descs: ''
      },
      supplierArr: [],
      dataRule: {
        code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
        name: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
      }
    }
  },
  methods: {
  }
}
</script>
