From 6b8101d9e2d6ca9d449a4087fbf065c6c31eec98 Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期一, 29 九月 2025 09:20:45 +0800 Subject: [PATCH] feat: 短信 --- src/views/EnterpriseManage/EnterpriseManageList.vue | 120 ++++++++---------------------------------------------------- 1 files changed, 16 insertions(+), 104 deletions(-) diff --git a/src/views/EnterpriseManage/EnterpriseManageList.vue b/src/views/EnterpriseManage/EnterpriseManageList.vue index c708c86..9df9afe 100644 --- a/src/views/EnterpriseManage/EnterpriseManageList.vue +++ b/src/views/EnterpriseManage/EnterpriseManageList.vue @@ -1,5 +1,5 @@ <template> - <LoadingLayout :loading="state.loading"> + <LoadingLayout :loading="isInitialLoading"> <AppContainer> <ProTableQueryFilterBar @on-reset="reset"> <template #query> @@ -9,7 +9,6 @@ :value-enum="IsConfiguredText" buttonStyle showAllBtn - @change="getList()" /> </QueryFilterItem> <QueryFilterItem> @@ -18,7 +17,6 @@ style="width: 300px" placeholder="浼佷笟鍚嶇О/娉曚汉/鑱旂郴浜�" @on-click-search="getList" - @keyup.enter="getList()" > </SearchInput> </QueryFilterItem> @@ -49,9 +47,9 @@ LoadingLayout, AppContainer, QueryFilterItem, - useTable, useFormDialog, FieldRadio, + useTableV2, } from '@bole-core/components'; import { useAccess, useGlobalEventContext } from '@/hooks'; import { EnterpriseConfigureType, IsConfiguredText } from '@/constants'; @@ -85,27 +83,15 @@ const router = useRouter(); -const BaseState = { - loading: true, -}; - -const state = reactive({ ...BaseState }); - -const { invalidateQueries } = useEnabledElectronSignSettings(); - -onMounted(async () => { - await getList(); - state.loading = false; -}); - const { getDataSource: getList, proTableProps, paginationState, extraParamState, reset, -} = useTable( - async ({ pageIndex, pageSize }, extraParamState) => { + isInitialLoading, +} = useTableV2( + async ({ pageIndex, pageSize, isInitialLoading }, extraParamState) => { try { let params: API.GetEnterprisesQuery = { pageModel: { @@ -118,7 +104,7 @@ }; let res = await enterpriseServices.getEnterprises(params, { - showLoading: !state.loading, + showLoading: !isInitialLoading, }); return res; } catch (error) { @@ -139,100 +125,26 @@ } ); -async function getEnterpriseElectronSignSetting(id: string) { - try { - return await enterpriseServices.getEnterpriseElectronSignSetting({ id: id }); - } catch (error) {} +function openDialog(row?: API.GetEnterprisesQueryResultItem) { + handleEdit({ + id: row.id, + enterpriseConfigureType: EnterpriseConfigureType.Bank, + }); } -async function getEnterpriseSmsSetting(id: string) { - try { - return await enterpriseServices.getEnterpriseSmsSetting({ id: id }); - } catch (error) {} -} - -async function openDialog(row?: API.GetEnterprisesQueryResultItem) { - if (row) { - let electronSignSetting = await getEnterpriseElectronSignSetting(row.id); - let smsSetting = await getEnterpriseSmsSetting(row.id); - handleEdit({ - id: row.id, - enterpriseConfigureType: EnterpriseConfigureType.Electronic, - electronSignAccesses: electronSignSetting.electronSignAccesses, - smsAccess: smsSetting.smsAccess, - smsCost: smsSetting.smsCost, - }); - } else { - handleAdd({ - enterpriseConfigureType: EnterpriseConfigureType.Electronic, - }); - } -} - -const { dialogProps, handleAdd, handleEdit, editForm, dialogState } = useFormDialog({ +const { dialogProps, handleEdit, dialogState } = useFormDialog({ onConfirm: handleAddOrEdit, defaultFormParams: { id: '', - enterpriseConfigureType: EnterpriseConfigureType.Electronic, - electronSignAccesses: [] as EnumElectronSignAccess[], - smsAccess: '' as any as EnumSmsAccess, - smsCost: 0, + enterpriseConfigureType: EnterpriseConfigureType.Bank, }, }); async function handleAddOrEdit() { try { - let res; - // if (type === EnterpriseConfigureType.Bank) { - // res = await createOrEditFlexEnterpriseBankSetting(); - // } - if (editForm.enterpriseConfigureType === EnterpriseConfigureType.Electronic) { - res = await createOrEditFlexEnterpriseSignSetting(); - } - if (editForm.enterpriseConfigureType === EnterpriseConfigureType.ShortMessage) { - res = await createOrEditFlexEnterpriseMessageSetting(); - } - if (res) { - Message.successMessage('鎿嶄綔鎴愬姛'); - getList(paginationState.pageIndex); - dialogState.dialogVisible = false; - } - } catch (error) {} -} - -// async function createOrEditFlexEnterpriseBankSetting() { -// try { -// let params: API.CreateOrEditFlexEnterpriseBankInput = { -// id: editForm.id, -// openBank: editForm.openBank, -// openBranchBank: editForm.openBranchBank, -// bankAccount: editForm.bankAccount, -// verifyStatus: editForm.verifyStatus, -// flexEnterpirseId: editForm.flexEnterpirseId, -// }; -// return await flexEnterpriseServices.createOrEditFlexEnterpriseBankSetting(params); -// } catch (error) {} -// } - -async function createOrEditFlexEnterpriseSignSetting() { - try { - let params: API.SetEnterpriseElectronSignSettingCommand = { - id: editForm.id, - electronSignAccesses: editForm.electronSignAccesses, - }; - let res = await enterpriseServices.setEnterpriseElectronSignSetting(params); - invalidateQueries(); - return res; - } catch (error) {} -} -async function createOrEditFlexEnterpriseMessageSetting() { - try { - let params: API.SetEnterpriseSmsSettingCommand = { - id: editForm.id, - smsAccess: editForm.smsAccess, - smsCost: editForm.smsCost, - }; - return await enterpriseServices.setEnterpriseSmsSetting(params); + Message.successMessage('鎿嶄綔鎴愬姛'); + getList(paginationState.pageIndex); + dialogState.dialogVisible = false; } catch (error) {} } -- Gitblit v1.9.1