feat(系统设置): 修改公共组件弹窗
This commit is contained in:
parent
223a02fc61
commit
a0e42bd530
|
@ -1,6 +1,7 @@
|
||||||
import { Modal } from '@arco-design/web-vue';
|
import { Modal } from '@arco-design/web-vue';
|
||||||
import type { ModalConfig } from '@arco-design/web-vue';
|
import type { ModalConfig } from '@arco-design/web-vue';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
export type ModalType = 'info' | 'success' | 'warning' | 'error';
|
export type ModalType = 'info' | 'success' | 'warning' | 'error';
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ export interface ModalOptions extends ModalConfig {
|
||||||
mode?: ModalMode;
|
mode?: ModalMode;
|
||||||
type: ModalType;
|
type: ModalType;
|
||||||
size?: ModalSize;
|
size?: ModalSize;
|
||||||
|
onBeforeOk: () => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteModalOptions extends ModalConfig {
|
export interface DeleteModalOptions extends ModalConfig {
|
||||||
|
@ -20,6 +22,7 @@ export interface DeleteModalOptions extends ModalConfig {
|
||||||
}
|
}
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
export default function useModal() {
|
export default function useModal() {
|
||||||
|
const enableLoading = ref<boolean>(false);
|
||||||
return {
|
return {
|
||||||
openModal: (options: ModalOptions) =>
|
openModal: (options: ModalOptions) =>
|
||||||
// error 使用 warning的感叹号图标
|
// error 使用 warning的感叹号图标
|
||||||
|
@ -30,9 +33,21 @@ export default function useModal() {
|
||||||
},
|
},
|
||||||
cancelButtonProps: {
|
cancelButtonProps: {
|
||||||
type: options.mode === 'weak' ? 'text' : 'secondary',
|
type: options.mode === 'weak' ? 'text' : 'secondary',
|
||||||
|
disabled: enableLoading.value,
|
||||||
},
|
},
|
||||||
simple: false,
|
simple: false,
|
||||||
|
okLoading: enableLoading.value,
|
||||||
...options,
|
...options,
|
||||||
|
onBeforeOk: (done: (closed: boolean) => void) => {
|
||||||
|
enableLoading.value = true;
|
||||||
|
options?.onBeforeOk().finally(() => {
|
||||||
|
enableLoading.value = false;
|
||||||
|
done(true);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onBeforeCancel: () => {
|
||||||
|
return !enableLoading.value;
|
||||||
|
},
|
||||||
titleAlign: 'start',
|
titleAlign: 'start',
|
||||||
modalClass: `ms-usemodal ms-usemodal-${options.mode || 'default'} ms-usemodal-${
|
modalClass: `ms-usemodal ms-usemodal-${options.mode || 'default'} ms-usemodal-${
|
||||||
options.size || 'small'
|
options.size || 'small'
|
||||||
|
|
|
@ -101,16 +101,12 @@
|
||||||
</template>
|
</template>
|
||||||
<template #action="{ record }">
|
<template #action="{ record }">
|
||||||
<MsButton @click="addOrEditMember('edit', record)">{{ t('organization.member.edit') }}</MsButton>
|
<MsButton @click="addOrEditMember('edit', record)">{{ t('organization.member.edit') }}</MsButton>
|
||||||
<MsPopConfirm
|
<MsRemoveButton
|
||||||
type="error"
|
|
||||||
position="br"
|
position="br"
|
||||||
:ok-text="t('organization.member.remove')"
|
|
||||||
:title="t('organization.member.deleteMemberTip', { name: characterLimit(record.name) })"
|
:title="t('organization.member.deleteMemberTip', { name: characterLimit(record.name) })"
|
||||||
:sub-title-tip="t('organization.member.subTitle')"
|
:sub-title-tip="t('organization.member.subTitle')"
|
||||||
@confirm="deleteMember(record)"
|
@ok="deleteMember(record)"
|
||||||
>
|
/>
|
||||||
<MsButton>{{ t('organization.member.remove') }}</MsButton>
|
|
||||||
</MsPopConfirm>
|
|
||||||
</template>
|
</template>
|
||||||
</ms-base-table>
|
</ms-base-table>
|
||||||
</MsCard>
|
</MsCard>
|
||||||
|
@ -143,7 +139,7 @@
|
||||||
import useTable from '@/components/pure/ms-table/useTable';
|
import useTable from '@/components/pure/ms-table/useTable';
|
||||||
import AddMemberModal from './components/addMemberModal.vue';
|
import AddMemberModal from './components/addMemberModal.vue';
|
||||||
import MsCard from '@/components/pure/ms-card/index.vue';
|
import MsCard from '@/components/pure/ms-card/index.vue';
|
||||||
import MsPopConfirm from '@/components/pure/ms-popconfirm/index.vue';
|
import MsRemoveButton from '@/components/bussiness/ms-remove-button/MsRemoveButton.vue';
|
||||||
import {
|
import {
|
||||||
getMemberList,
|
getMemberList,
|
||||||
deleteMemberReq,
|
deleteMemberReq,
|
||||||
|
@ -232,7 +228,7 @@
|
||||||
};
|
};
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(getMemberList, {
|
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(getMemberList, {
|
||||||
tableKey: TableKeyEnum.ORGANNATIONMEMBER,
|
tableKey: TableKeyEnum.ORGANNATIONMEMBER,
|
||||||
scroll: { x: 1200 },
|
scroll: { x: 1600 },
|
||||||
selectable: true,
|
selectable: true,
|
||||||
});
|
});
|
||||||
const keyword = ref('');
|
const keyword = ref('');
|
||||||
|
|
Loading…
Reference in New Issue