<!--
 * @Author: zwq
 * @Date: 2021-07-19 15:18:30
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-07-26 10:54:06
 * @Description:
-->
<template>
  <el-row :gutter="10">
    <el-form
      ref="dataForm"
      :model="dataForm"
      :rules="rules"
      size="medium"
      label-width="130px"
      style="margin:30px"
      label-position="left"
    >
      <el-col :span="6">
        <el-form-item label="grade" prop="grade">
          <el-input v-model="dataForm.grade" placeholder="grade" clearable :style="{width: '100%'}" />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item :label="$t('module.orderManage.erpToMes.mfoCode')" prop="mfoCode">
          <el-input v-model="dataForm.mfoCode" :placeholder="$t('module.orderManage.erpToMes.mfoCode')" clearable :style="{width: '100%'}" />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item :label="$t('module.orderManage.erpToMes.packagingBoxId')" prop="packagingBoxId">
          <el-input
            v-model="dataForm.packagingBoxId"
            oninput="value=value.replace(/[^\d]/g,'')"
            :placeholder="$t('module.orderManage.erpToMes.packagingBoxId')"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item :label="$t('module.orderManage.erpToMes.reportTime')" prop="reportTime">
          <el-date-picker
            v-model="dataForm.reportTime"
            :style="{width: '100%'}"
            :placeholder="$t('module.orderManage.erpToMes.reportTime')"
            clearable
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="totlePower" prop="totlePower">
          <el-input
            v-model="dataForm.totlePower"
            placeholder="totlePower"
            oninput="value=value.replace(/[^\d]/g,'')"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId1" prop="substrateId1">
          <el-input
            v-model="dataForm.substrateId1"
            placeholder="substrateId1"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId2" prop="substrateId2">
          <el-input
            v-model="dataForm.substrateId2"
            placeholder="substrateId2"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId3" prop="substrateId3">
          <el-input
            v-model="dataForm.substrateId3"
            placeholder="substrateId3"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId4" prop="substrateId4">
          <el-input
            v-model="dataForm.substrateId4"
            placeholder="substrateId4"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId5" prop="substrateId5">
          <el-input
            v-model="dataForm.substrateId5"
            placeholder="substrateId5"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId6" prop="substrateId6">
          <el-input
            v-model="dataForm.substrateId6"
            placeholder="substrateId6"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId7" prop="substrateId7">
          <el-input
            v-model="dataForm.substrateId7"
            placeholder="substrateId7"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId8" prop="substrateId8">
          <el-input
            v-model="dataForm.substrateId8"
            placeholder="substrateId8"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId9" prop="substrateId9">
          <el-input
            v-model="dataForm.substrateId9"
            placeholder="substrateId9"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId10" prop="substrateId10">
          <el-input
            v-model="dataForm.substrateId10"
            placeholder="substrateId10"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId11" prop="substrateId11">
          <el-input
            v-model="dataForm.substrateId11"
            placeholder="substrateId11"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId12" prop="substrateId12">
          <el-input
            v-model="dataForm.substrateId12"
            placeholder="substrateId12"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId13" prop="substrateId13">
          <el-input
            v-model="dataForm.substrateId13"
            placeholder="substrateId13"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId14" prop="substrateId14">
          <el-input
            v-model="dataForm.substrateId14"
            placeholder="substrateId14"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId15" prop="substrateId15">
          <el-input
            v-model="dataForm.substrateId15"
            placeholder="substrateId15"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId16" prop="substrateId16">
          <el-input
            v-model="dataForm.substrateId16"
            placeholder="substrateId16"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId17" prop="substrateId17">
          <el-input
            v-model="dataForm.substrateId17"
            placeholder="substrateId17"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId18" prop="substrateId18">
          <el-input
            v-model="dataForm.substrateId18"
            placeholder="substrateId18"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId19" prop="substrateId19">
          <el-input
            v-model="dataForm.substrateId19"
            placeholder="substrateId19"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="substrateId20" prop="substrateId20">
          <el-input
            v-model="dataForm.substrateId20"
            placeholder="substrateId20"
            clearable
            :style="{width: '100%'}"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label-width="0" prop="">
          <el-button type="primary" size="medium" @click="submit"> 提交 </el-button>
        </el-form-item>
      </el-col>
    </el-form>
  </el-row>
</template>

<script>
import { mesToErpAdd } from '@/api/orderManage/erpToMes'

export default {
  components: {},
  props: [],
  data() {
    return {
      dataForm: {
        grade: undefined,
        mfoCode: undefined,
        packagingBoxId: undefined,
        reportTime: undefined,
        totlePower: undefined,
        substrateId1: undefined,
        substrateId2: undefined,
        substrateId3: undefined,
        substrateId4: undefined,
        substrateId5: undefined,
        substrateId6: undefined,
        substrateId7: undefined,
        substrateId8: undefined,
        substrateId9: undefined,
        substrateId10: undefined,
        substrateId11: undefined,
        substrateId12: undefined,
        substrateId13: undefined,
        substrateId14: undefined,
        substrateId15: undefined,
        substrateId16: undefined,
        substrateId17: undefined,
        substrateId18: undefined,
        substrateId19: undefined,
        substrateId20: undefined
      },
      rules: {
        grade: [],
        mfoCode: [],
        packagingBoxId: [],
        reportTime: [],
        totlePower: [],
        substrateId1: []
      }
    }
  },
  computed: {},
  watch: {},
  created() {
    this.init()
  },
  mounted() {},
  methods: {
    init() {
      this.$nextTick(() => {
        this.$refs['dataForm'].resetFields()
      })
    },
    submit() {
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          mesToErpAdd(this.dataForm).then(res => {
            this.$message({
              message: this.$t('module.basicData.visual.success'),
              type: 'success',
              duration: 1500,
              onClose: () => {
                this.init()
              }
            })
          })
        }
      })
    }
  }
}
</script>
