<template>
  <MegaDrawer
    :title="$t(title)"
    :visible.sync="drawer"
    width="520"
    @close="drawerClose"
  >
    <template slot="main">
      <a-form-model
        ref="menuForm"
        layout="vertical"
        :model="menuForm"
        :rules="menuFormRules"
      >
        <a-form-model-item :label="$t('CORPORATION_CODE')" prop="orgCode">
          <a-input v-model="menuForm.orgCode" />
        </a-form-model-item>
        <a-form-model-item :label="$t('CORPORATION_NAME')" prop="orgName">
          <a-input v-model="menuForm.orgName" :placeholder="$t('PLACEENTER')" />
        </a-form-model-item>
        <a-form-model-item
          :label="$t('CORPORATION_NAME_FULL')"
          prop="orgNameFull"
        >
          <a-input
            v-model="menuForm.orgNameFull"
            :placeholder="$t('PLACEENTER')"
          />
        </a-form-model-item>
        <a-form-model-item :label="$t('EXTERNAL_CODE')" prop="extCode">
          <a-input
            v-model="menuForm.extCode"
            allow-clear
            :placeholder="$t('PLACEENTER')"
          />
        </a-form-model-item>
        <a-form-model-item
          :label="$t('WECHAT_CORPAGENT_ID')"
          prop="wechatCorpAgentId"
        >
          <a-input v-model="menuForm.wechatCorpAgentId" />
        </a-form-model-item>
        <a-form-model-item :label="$t('WECHAT_CORP_ID')" prop="wechatCorpId">
          <a-input
            v-model="menuForm.wechatCorpId"
            :placeholder="$t('PLACEENTER')"
          />
        </a-form-model-item>
        <a-form-model-item
          :label="$t('WECHAT_CORP_SECRET')"
          prop="wechatCorpSecret"
        >
          <a-input
            v-model="menuForm.wechatCorpSecret"
            :placeholder="$t('PLACEENTER')"
          />
        </a-form-model-item>
        <a-form-model-item :label="$t('REMARK')" prop="remark">
          <a-input v-model="menuForm.remark" type="textarea" />
        </a-form-model-item>
      </a-form-model>
    </template>
    <footer slot="footer">
      <div class="drawer_btns">
        <a-button type="primary" @click="confirm">
          <Icon type="icon-cur-save_1" :size="18" /> {{ $t("SAVE") }}
        </a-button>
        <a-button @click="cancel">
          <Icon type="icon-dir-f-rollback" :size="18" /> {{ $t("CANCEL") }}
        </a-button>
      </div>
    </footer>
  </MegaDrawer>
</template>

<script>
import { Drawer as MegaDrawer, Icon } from "@mega-design/ui-vue";

export default {
  name: "CorDrawer",
  components: {
    MegaDrawer,
    Icon,
  },
  props: {
    menuForm: {
      type: Object,
      default: null,
    },
    menuFormRules: {
      type: Object,
      default: null,
    },
    drawer: {
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: "",
    },
    cancel: {
      type: Function,
      default: () => {},
    },
    confirm: {
      type: Function,
      default: () => {},
    },
    drawerClose: {
      type: Function,
      default: () => {},
    },
  },
  methods: {},
};
</script>
