<template>
  <div>
    <a-modal
      width="800px"
      title="批号调整"
      :visible="value"
      :confirm-loading="confirmLoading"
      @ok="handleOkreplenishment"
      @cancel="handleCancel"
    >
      <p-grid-form
        ref="formTarget"
        :span="8"
        :label-col="{ span: 8 }"
        :items="deitalFormItems"
        @submit="hanlderSubmit"
      ></p-grid-form>
    </a-modal>
  </div>
</template>

<script>
import { deitalFormItems } from '../config/outerCheck'
import { handleShowProductionDate } from '../script/lineHandleLogic'
import { postbatchAdjust } from '../api'

export default {
  components: {},
  data() {
    return {
      deitalFormItems: deitalFormItems(this),
      confirmLoading: false,
      Visible: false,
      Fdata: {},
      formTargetData: {}
    }
  },
  props: {
    formData: {
      type: Object,
      default() {
        return {}
      }
    },
    value: {
      type: Boolean,
      default: false
    }
  },
  created() {},
  mounted() {},
  computed: {},
  watch: {
    formData: {
      handler(val) {
        if (val) {
          this.formTargetData = val
          // this.$nextTick(() => {
          //   this.$refs.formTarget.form.setFieldsValue(val)
          // })
        }
      },
      deep: true
      // immediate: true
    }
  },
  methods: {
    filterData(date) {
      let batcharr = date.split('')
      let batchProductionShowNew = batcharr.filter(item => {
        return item != '-'
      })
      let batchdata = batchProductionShowNew.join('')
      return batchdata
    },
    resetFields() {
      this.$refs.formTarget.form.resetFields()
    },
    hanlderSubmit(event, form) {
      event.preventDefault()
      this.$refs.formTarget.form.validateFields((error, values) => {
        if (!error) {
        }
      })
    },
    handleOkreplenishment() {
      this.$refs.formTarget.form.validateFields((error, values) => {
        if (!error) {
          this.$emit('save',values)
        }
      })
    },
    handleCancel() {
      this.$emit('handleCancel')
    }
  }
}
</script>

<style></style>
