<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-03-03 14:14:51
 * @Description:
-->
<template>
  <el-form
    :model="dataForm"
    :rules="dataRule"
    ref="dataForm"
    @keyup.enter.native="dataFormSubmit()"
    label-width="80px"
  >
    <el-form-item label="区域名称" prop="regionName">
      <el-input v-model="dataForm.regionName"clearable placeholder="区域名称"></el-input>
    </el-form-item>
    <el-form-item label="区域编码" prop="regionCode">
      <el-input v-model="dataForm.regionCode"clearable placeholder="区域编码"></el-input>
    </el-form-item>
    <el-form-item label="区域类型" prop="regionType">
      <el-select v-model="dataForm.regionType"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="remark">
      <el-input v-model="dataForm.remark"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/mtWarehouseRegion/",
        infoURL: "/code/mtWarehouseRegion",
      },
      isGetCode: true,
      dataForm: {
        id: "",
        regionName: "",
        regionCode: "",
        regionType: "",
        remark: "",
      },
      options: [
        {
          value: "0",
          label: "普通库位",
        },
        {
          value: "1",
          label: "高库位",
        },
        {
          value: "2",
          label: "扩展库位",
        },
      ],
      dataRule: {
        regionName: [{ required: true, message: "区域名称不能为空", trigger: "blur" }],
      },
    };
  },
  methods: {
    getCode() {
      this.$http
        .get("/code/mtWarehouseRegion/getCode")
        .then(({ data: res }) => {
          this.dataForm.regionCode = res;
        })
        .catch(() => {});
    },
  },
};
</script>
