<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-03-03 15:54:29
 * @Description:
-->
<template>
  <el-form
    :model="dataForm"
    :rules="dataRule"
    ref="dataForm"
    @keyup.enter.native="dataFormSubmit()"
    label-width="100px"
  >
    <el-form-item label="任务编码" prop="taskDetCode">
      <el-input v-model="dataForm.taskDetCode" clearable placeholder="任务编码"></el-input>
    </el-form-item>
    <el-form-item label="批次号" prop="dateNum">
      <el-input v-model="dataForm.dateNum" clearable placeholder="批次号"></el-input>
    </el-form-item>
    <el-form-item label="数量" prop="num">
      <el-input v-model="dataForm.num" clearable placeholder="数量"></el-input>
    </el-form-item>
    <el-form-item label="单位" prop="unit">
      <el-input v-model="dataForm.unit" clearable placeholder="单位"></el-input>
    </el-form-item>
    <el-form-item label="起点" prop="startPosition">
      <el-input v-model="dataForm.startPosition" clearable placeholder="起点"></el-input>
    </el-form-item>
    <el-form-item label="终点" prop="targetPosition">
      <el-input v-model="dataForm.targetPosition" 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="taskType">
      <el-select v-model="dataForm.taskType" 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="isHeight">
      <el-select v-model="dataForm.isHeight" clearable placeholder="是否超高">
        <el-option
          v-for="item in options2"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="是否超重" prop="isWeight">
      <el-select v-model="dataForm.isWeight" clearable placeholder="是否超重">
        <el-option
          v-for="item in options3"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="具体型号" prop="specModel">
      <el-input v-model="dataForm.specModel" clearable placeholder="具体型号"></el-input>
    </el-form-item>
    <el-form-item label="备注" prop="remarks">
      <el-input v-model="dataForm.remarks" 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/mtTaskInfoDet/",
        infoURL: "/code/mtTaskInfoDet",
      },
      isGetCode: true,
      dataForm: {
        id: "",
        taskDetCode: "",
        taskType: "",
        num: "",
        startPosition: "",
        targetPosition: "",
        dateNum: "",
        specModel: "",
        status: "",
        unit: "",
        remarks: "",
      },
      options1: [
        {
          value: 0,
          label: "出库",
        },
        {
          value: 1,
          label: "入库",
        },
        {
          value: 2,
          label: "移库",
        },
      ],
      options: [
        {
          value: 0,
          label: "接收数据",
        },
        {
          value: 1,
          label: "数据接收中",
        },
        {
          value: 2,
          label: "数据接收完成",
        },
        {
          value: 4,
          label: "等待接收数据",
        },
      ],
      options2: [
        {
          value: "0",
          label: "不超高",
        },
        {
          value: "1",
          label: "超高",
        },
      ],
      options3: [
        {
          value: "0",
          label: "不超重",
        },
        {
          value: "1",
          label: "超重",
        },
      ],
      dataRule: {
        taskDetCode: [{ required: true, message: "产品名称不能为空", trigger: "blur" }],
      },
    };
  },
  methods: {
    getCode() {
      this.$http
        .get("/code/mtTaskInfoDet/getCode")
        .then(({ data: res }) => {
          this.dataForm.taskDetCode = res;
        })
        .catch(() => {});
    },
  },
};
</script>
