<template>
  <el-dialog
    :title="title"
    :center="true"
    align="left"
    top="5vh"
    width="1040px"
    @close="showModelThis = false"
    :close-on-click-modal="false"
    :visible.sync="showModelThis"
    v-loading="loading"
    element-loading-text="拼命加载中"
    element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(0, 0, 0, 0.8)"
  >
    <el-row :gutter="10" style="margin-top: -20px">
      <el-col :span="24">
        <add-form v-if="showModelThis" :id="id" @closeModel="closeModel"  :sitem="{}"   @refresh="refresh" />
      </el-col>
    </el-row>
  </el-dialog>
</template>
   <script>
// import asyncRequest from "@/apis/service/stock/allot";
import resToken from "@/mixins/resToken";
import AddForm from "./components/addForm"; //新建表单
export default {
  name: "allot",
  props: ["showModel", "id",  "sitem"],
  mixins: [resToken],
  components: {
    AddForm,
  },
  data() {
    return {
      // showGoodsModel: false, //打开商品弹窗
      isDisabled: true,
      isDisabledIn: true,
      loading: false,
      title: "新建调拨申请",
      showModelThis: this.showModel,
    };
  },
  watch: {
    showModel: function (val) {
      this.showModelThis = val;
    },
    showModelThis(val) {
      if (!val) {
        this.$emit("cancel");
      }
    },
  },
  methods: {
    closeModel() {
      console.log("closeModel!!");
      this.showModelThis = false;
    },
    refresh(e) {
      this.showModelThis = e;
      this.$emit("refresh", true);
    },
  },
};
</script>
   