<template>
  <el-dialog
    title="新建盘点"
    :center="true"
    align="left"
    top="18vh"
    width="600px"
    @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)"
    append-to-body
  >
    <el-card style="margin-top: -20px">
      <add-edit
        v-if="showModelThis"
        :id="id"
        @closeModel="closeModel"
        :sitem="{}"
        @refresh="refresh"
      />
    </el-card>
  </el-dialog>
</template>
   <script>
import addEdit from "./components/addEdit.vue";
export default {
  name: "addModel",
  props: ["showModel", "id"],
  components: {
    addEdit,
  },
  data() {
    return {
      formId: "",
      loading: false,
      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>

   <style lang="scss" scoped>
.check {
}
</style>
   