<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-03-03 10:53:27
 * @Description:
-->
<template>
  <el-form
    :model="dataForm"
    :rules="dataRule"
    ref="dataForm"
    @keyup.enter.native="dataFormSubmit()"
    label-width="80px"
  >
    <el-form-item label="名称" prop="name">
      <el-input v-model="dataForm.name"clearable placeholder="名称"></el-input>
    </el-form-item>
    <el-form-item label="别名" prop="alias">
      <el-input v-model="dataForm.alias"clearable placeholder="别名"></el-input>
    </el-form-item>
    <el-form-item label="英语名称" prop="en">
      <el-input v-model="dataForm.en"clearable placeholder="英语名称"></el-input>
    </el-form-item>
    <el-form-item label="编码" prop="code">
      <el-input v-model="dataForm.code"clearable placeholder="编码"></el-input>
    </el-form-item>
    <el-form-item label="状态" prop="status">
      <el-select v-model="dataForm.status"clearable placeholder="请选择状态">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="备注" prop="description">
      <el-input v-model="dataForm.description"clearable placeholder="备注"></el-input>
    </el-form-item>
  </el-form>
</template>

<script>
import basicAdd from "@/mixins/basic-add";
export default {
  mixins: [basicAdd],
  data() {
    return {
      urlOptions: {
        submitURL: "/code/mtEquipmentInfo/",
        infoURL: "/code/mtEquipmentInfo",
      },
      isGetCode: true,
      dataForm: {
        id: "",
        name: "",
        code: "",
        alias: "",
        status: "",
        alias: "",
        description: "",
      },
      options: [
        {
          value: "0",
          label: "初始化",
        },
        {
          value: "1",
          label: "损坏",
        },
        {
          value: "2",
          label: "工作中",
        },
      ],
      dataRule: {
        name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
      },
    };
  },
  methods: {
    getCode() {
      this.$http
        .get("/code/mtEquipmentInfo/getCode")
        .then(({ data: res }) => {
          this.dataForm.code = res;
        })
        .catch(() => {});
    },
  },
};
</script>
