<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <pos-table-type-in-goods
      ref="realForm"
      @ok="submitCallback"
      :disabled="disableSubmit"
      :posTableTypeId="posTableTypeId"
    ></pos-table-type-in-goods>
  </j-modal>
</template>

<script>
import posTableTypeInGoods from "./posTableTypeInGoods";
export default {
  name: "PosThaliInGoodsModal",
  components: {
    posTableTypeInGoods,
  },
  props: {
    posTableTypeId: {
      type: String,
    },
  },
  data() {
    return {
      title: "",
      width: 800,
      visible: false,
      disableSubmit: false,
    };
  },
  methods: {
    add() {
      this.visible = true;
      this.$nextTick(() => {
        this.$refs.realForm.add();
      });
    },
    edit(record) {
      console.log('posTableTypeId2',this.posTableTypeId)
      this.visible = true;
      this.$nextTick(() => {
        this.$refs.realForm.edit(record);
      });
    },
    close() {
      this.$emit("close");
      this.visible = false;
    },
    handleOk() {
      this.$refs.realForm.submitForm();
    },
    submitCallback() {
      this.$emit("ok");
      this.visible = false;
    },
    handleCancel() {
      this.close();
    },
  },
};
</script>