<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-03-03 14:56:23
 * @Description:
-->
<template>
  <el-form
    :model="dataForm"
    :rules="dataRule"
    ref="dataForm"
    @keyup.enter.native="dataFormSubmit()"
    label-width="100px"
  >
    <el-form-item label="任务编码" prop="taskCode">
      <el-input v-model="dataForm.taskCode"clearable placeholder="任务编码"></el-input>
    </el-form-item>
    <el-form-item label="产品编码" prop="prodectCode">
      <el-input v-model="dataForm.prodectCode"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="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="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/mtTaskInfo/",
        infoURL: "/code/mtTaskInfo",
      },
      isGetCode: true,
      dataForm: {
        id: "",
        taskCode: "",
        taskType: "",
        num: "",
        prodectCode: "",
        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: "等待接收数据",
        },
      ],
      dataRule: {
        taskCode: [{ required: true, message: "产品名称不能为空", trigger: "blur" }],
      },
    };
  },
  methods: {
    getCode() {
      this.$http
        .get("/code/mtTaskInfo/getCode")
        .then(({ data: res }) => {
          this.dataForm.taskCode = res;
        })
        .catch(() => {});
    },
  },
};
</script>
