<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-03-03 14:10:01
 * @Description:
-->
<template>
  <el-form
    :model="dataForm"
    :rules="dataRule"
    ref="dataForm"
    @keyup.enter.native="dataFormSubmit()"
    label-width="100px"
  >
    <el-form-item label="别名" prop="anotherName">
      <el-input v-model="dataForm.anotherName"clearable placeholder="别名"></el-input>
    </el-form-item>
    <el-form-item label="列标" prop="columnCode">
      <el-input v-model="dataForm.columnCode"clearable placeholder="列标"></el-input>
    </el-form-item>
    <el-form-item label="行标" prop="rowCode">
      <el-input v-model="dataForm.rowCode"clearable placeholder="行标"></el-input>
    </el-form-item>
    <el-form-item label="库位编码" prop="positionCode">
      <el-input v-model="dataForm.positionCode"clearable placeholder="库位编码"></el-input>
    </el-form-item>
    <el-form-item label="方向" prop="direction">
      <el-select v-model="dataForm.direction"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="isOccupy">
      <el-select v-model="dataForm.isOccupy"clearable placeholder="是否被占用">
        <el-option
          v-for="item in options1"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="区域名称" prop="regionName">
      <el-input v-model="dataForm.regionName"clearable placeholder="区域名称"></el-input>
    </el-form-item>
    <el-form-item label="顺序号" prop="sequence">
      <el-input v-model="dataForm.sequence"clearable placeholder="顺序号"></el-input>
    </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/mtWarehouseRank/",
        infoURL: "/code/mtWarehouseRank",
      },
      isGetCode: true,
      dataForm: {
        id: "",
        anotherName: "",
        positionCode: "",
        columnCode: "",
        rowCode: '',
        direction: "",
        isOccupy:"",
        regionName: "",
        sequence: "",
        remark: "",
      },
      options: [
        {
          value: "L",
          label: "左",
        },
        {
          value: "R",
          label: "右",
        },
      ],
      options1: [
        {
          value: 0,
          label: "可用",
        },
        {
          value: 1,
          label: "被占用",
        },
      ],
      dataRule: {
        anotherName: [{ required: true, message: "别名不能为空", trigger: "blur" }],
      },
    };
  },
  methods: {
    getCode() {
      this.$http
        .get("/code/mtWarehouseRank/getCode")
        .then(({ data: res }) => {
          this.dataForm.positionCode = res;
        })
        .catch(() => {});
    },
  },
};
</script>
