wupengfei
6 天以前 a4bb5626dcf18a1893792eeeca75e9139c744ad0
src/views/EnterpriseManage/components/WeChatPayWalletBankBranchsSelect.vue
New file
@@ -0,0 +1,72 @@
<template>
  <ProFormPaginationSelect
    v-model="bank_branch_id"
    :proTableProps="proTableProps"
    enum-label-key="bank_branch_name"
    enum-value-key="bank_branch_id"
  >
  </ProFormPaginationSelect>
</template>
<script setup lang="ts">
import { useTable } from '@bole-core/components';
import * as enterpriseWalletServices from '@/services/api/enterpriseWallet';
defineOptions({
  name: 'WeChatPayWalletBankBranchsSelect',
});
type Props = {
  bank_alias_code: string;
  city_code: number;
  need_bank_branch: boolean;
};
const props = withDefaults(defineProps<Props>(), {});
const bank_branch_id = defineModel<string>('bank_branch_id');
watch(
  [toRef(props, 'bank_alias_code'), toRef(props, 'city_code'), toRef(props, 'need_bank_branch')],
  ([bank_alias_code, city_code, need_bank_branch]) => {
    bank_branch_id.value = '';
    if (need_bank_branch) {
      getList();
    }
  }
);
const {
  getDataSource: getList,
  proTableProps,
  paginationState,
  extraParamState,
  reset,
} = useTable(
  async ({ pageIndex, pageSize }, extraParamState) => {
    try {
      let params: API.GetEnterpriseWeChatPayWalletBankBranchesQuery = {
        pageModel: {
          rows: pageSize,
          page: pageIndex,
        },
        bank_alias_code: props.bank_alias_code,
        city_code: props.city_code,
      };
      let res = await enterpriseWalletServices.getEnterpriseWeChatPayWalletBankBranches(params, {
        showLoading: true,
      });
      return res;
    } catch (error) {
      console.log('error: ', error);
    }
  },
  {
    defaultExtraParams: {
      keywords: '',
    },
    queryKey: ['enterpriseWalletServices/getEnterpriseWeChatPayWalletBankBranches'],
  }
);
</script>