fix(系统设置): 删除项目提醒加入撤销按钮&bug修改

This commit is contained in:
RubyLiu 2024-02-02 18:27:04 +08:00 committed by 刘瑞斌
parent 3aa5e50732
commit afd1704284
12 changed files with 170 additions and 92 deletions

View File

@ -17,7 +17,7 @@
<div class="radius-box"></div>
</div>
<div class="title">
<span>{{ t('common.noProject') }}</span>
<span>{{ props.isProject ? t('common.noProject') : t('common.noResource') }}</span>
</div>
<slot></slot>
</div>
@ -39,6 +39,9 @@
const pageConfig = ref({ ...appStore.pageConfig });
const { t } = useI18n();
const props = defineProps<{
isProject?: boolean;
}>();
</script>
<style lang="less" scoped>
@ -80,6 +83,8 @@
}
}
.title {
display: flex;
justify-content: center;
font-size: 16px;
color: var(--color-text-1);
.user {

View File

@ -35,6 +35,8 @@ export default {
'common.saveSuccess': 'Save success',
'common.saveFailed': 'Save failed',
'common.confirmEnable': 'Confirm enable',
'common.confirmEnd': 'Confirm end',
'common.confirmStart': 'Confirm start',
'common.confirmDisable': 'Confirm disable',
'common.confirmClose': 'Confirm close',
'common.enableSuccess': 'Enable success',

View File

@ -39,6 +39,8 @@ export default {
'common.confirmEnable': '确认启用',
'common.confirmDisable': '确认禁用',
'common.confirmClose': '确认关闭',
'common.confirmEnd': '确认结束',
'common.confirmStart': '确认开启',
'common.enableSuccess': '启用成功',
'common.disableSuccess': '禁用成功',
'common.enableFailed': '启用失败',

View File

@ -1,5 +1,5 @@
<template>
<single-logo-layout is-project>
<NoPermissionLayoutVue is-project>
<div class="mt-[24px] flex items-center justify-center">
<a-select class="w-[280px]" allow-search @change="selectProject">
<template #arrow-icon>
@ -20,14 +20,14 @@
</template>
</a-select>
</div>
</single-logo-layout>
</NoPermissionLayoutVue>
</template>
<script lang="ts" setup>
import { onBeforeMount, Ref, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import SingleLogoLayout from '@/layout/single-logo-layout.vue';
import NoPermissionLayoutVue from '@/layout/no-permission-layout.vue';
import { getProjectList, switchProject } from '@/api/modules/project-management/project';
import { useI18n } from '@/hooks/useI18n';

View File

@ -1,7 +1,7 @@
<template>
<single-logo-layout />
<NoPermissionLayoutVue />
</template>
<script lang="ts" setup>
import SingleLogoLayout from '@/layout/single-logo-layout.vue';
import NoPermissionLayoutVue from '@/layout/no-permission-layout.vue';
</script>

View File

@ -122,6 +122,10 @@
import type { FormInstance, ValidatedError } from '@arco-design/web-vue';
defineOptions({
name: 'OrgAddProjectModal',
});
const { t } = useI18n();
const props = defineProps<{
visible: boolean;
@ -225,7 +229,7 @@
}
try {
loading.value = true;
await createOrUpdateProjectByOrg({ id: props.currentProject?.id, ...form });
await createOrUpdateProjectByOrg({ id: isEdit.value ? props.currentProject?.id : '', ...form });
Message.success(
isEdit.value ? t('system.project.updateProjectSuccess') : t('system.project.createProjectSuccess')
);

View File

@ -44,18 +44,18 @@ export default {
'system.organization.revokeDeleteToolTip': '该组织将与 30 天后自动删除',
'system.organization.createOrganizationSuccess': '创建组织成功',
'system.organization.enableTitle': '开启组织',
'system.organization.endTitle': '关闭组织',
'system.organization.endTitle': '结束组织',
'system.organization.enableContent': '开启后的组织展示在组织切换列表',
'system.organization.endContent': '关闭后的组织不展示在组织切换列表',
'system.organization.endContent': '结束后的组织不展示在组织切换列表',
'system.organization.updateOrganization': '更新组织',
'system.organization.updateOrganizationSuccess': '更新组织成功',
'system.organization.createProject': '创建项目',
'system.organization.subordinateOrg': '所属组织',
'system.project.revokeDeleteTitle': '确认撤销删除 {name} 这个项目吗?',
'system.project.enableTitle': '开启项目',
'system.project.endTitle': '关闭项目',
'system.project.endTitle': '结束项目',
'system.project.enableContent': '开启后的项目展示在项目切换列表',
'system.project.endContent': '关闭后的项目不展示在项目切换列表',
'system.project.endContent': '结束后的项目不展示在项目切换列表',
'system.project.projectNamePlaceholder': '请输入项目名称,不可与其他项目名称重复',
'system.project.updateProject': '更新项目',
'system.project.createProject': '创建项目',
@ -65,7 +65,7 @@ export default {
'system.project.projectAdminPlaceholder': '默认选择创建项目人为项目管理员',
'system.project.moduleSetting': '启用模块',
'system.project.projectNameRequired': '项目名称不能为空',
'system.project.createTip': '项目后,将展示在项目切换列表',
'system.project.createTip': '项目启后,将展示在项目切换列表',
'system.project.affiliatedOrgRequired': '所属组织不能为空',
'system.project.createProjectSuccess': '创建项目成功',
'system.project.updateProjectSuccess': '更新项目成功',

View File

@ -256,33 +256,10 @@
addProjectVisible.value = true;
};
const handleDelete = (record: TableData) => {
openDeleteModal({
title: t('system.organization.deleteName', { name: characterLimit(record.name) }),
content: t('system.organization.deleteTip'),
onBeforeOk: async () => {
try {
await deleteProjectByOrg(record.id);
Message.success(t('common.deleteSuccess'));
fetchData();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
});
};
const handleMoreAction = (tag: ActionsItem, record: TableData) => {
if (tag.eventTag === 'delete') {
handleDelete(record);
}
};
const handleEnableOrDisableProject = async (record: any, isEnable = true) => {
const title = isEnable ? t('system.project.enableTitle') : t('system.project.endTitle');
const content = isEnable ? t('system.project.enableContent') : t('system.project.endContent');
const okText = isEnable ? t('common.confirmEnable') : t('common.confirmClose');
const okText = isEnable ? t('common.confirmStart') : t('common.confirmEnd');
openModal({
type: 'error',
cancelText: t('common.cancel'),
@ -365,6 +342,49 @@
hideCancel: false,
});
};
const handleDelete = (record: TableData) => {
openDeleteModal({
title: t('system.organization.deleteName', { name: characterLimit(record.name) }),
content: t('system.organization.deleteTip'),
onBeforeOk: async () => {
try {
await deleteProjectByOrg(record.id);
Message.success({
content: () =>
h('span', [
h('span', t('common.deleteSuccess')),
h(
'span',
{
directives: [
{
name: 'permission',
value: ['ORG_PROJECT:READ+RECOVER'],
},
],
class: 'ml-[8px] cursor-pointer text-[rgb(var(--primary-5))]',
onClick() {
handleRevokeDelete(record);
},
},
t('common.revoke')
),
]),
});
fetchData();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
});
};
const handleMoreAction = (tag: ActionsItem, record: TableData) => {
if (tag.eventTag === 'delete') {
handleDelete(record);
}
};
onMounted(() => {
setLoadListParams({ organizationId: currentOrgId.value });

View File

@ -133,6 +133,10 @@
currentProject?: CreateOrUpdateSystemProjectParams;
}>();
defineOptions({
name: 'SystemAddProjectModal',
});
const formRef = ref<FormInstance>();
const loading = ref(false);
@ -209,7 +213,7 @@
}
try {
loading.value = true;
await createOrUpdateProject({ id: props.currentProject?.id, ...form });
await createOrUpdateProject({ id: isEdit.value ? props.currentProject?.id : '', ...form });
Message.success(
isEdit.value ? t('system.project.updateProjectSuccess') : t('system.project.createProjectSuccess')
);

View File

@ -249,33 +249,10 @@
},
];
const handleDelete = (record: TableData) => {
openDeleteModal({
title: t('system.organization.deleteName', { name: characterLimit(record.name) }),
content: t('system.organization.deleteTip'),
onBeforeOk: async () => {
try {
await deleteOrg(record.id);
Message.success(t('common.deleteSuccess'));
fetchData();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
});
};
const handleMoreAction = (tag: ActionsItem, record: TableData) => {
if (tag.eventTag === 'delete') {
handleDelete(record);
}
};
const handleEnableOrDisableOrg = async (record: any, isEnable = true) => {
const title = isEnable ? t('system.organization.enableTitle') : t('system.organization.endTitle');
const content = isEnable ? t('system.organization.enableContent') : t('system.organization.endContent');
const okText = isEnable ? t('common.confirmEnable') : t('common.confirmClose');
const okText = isEnable ? t('common.confirmStart') : t('common.confirmEnd');
openModal({
type: 'info',
cancelText: t('common.cancel'),
@ -358,6 +335,50 @@
}
};
const handleDelete = (record: TableData) => {
openDeleteModal({
title: t('system.organization.deleteName', { name: characterLimit(record.name) }),
content: t('system.organization.deleteTip'),
onBeforeOk: async () => {
try {
await deleteOrg(record.id);
Message.success({
content: () =>
h('span', [
h('span', t('common.deleteSuccess')),
h(
'span',
{
directives: [
{
name: 'permission',
value: ['SYSTEM_ORGANIZATION_PROJECT:READ+RECOVER'],
},
],
class: 'ml-[8px] cursor-pointer text-[rgb(var(--primary-5))]',
onClick() {
handleRevokeDelete(record);
},
},
t('common.revoke')
),
]),
});
fetchData();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
});
};
const handleMoreAction = (tag: ActionsItem, record: TableData) => {
if (tag.eventTag === 'delete') {
handleDelete(record);
}
};
defineExpose({
fetchData,
});

View File

@ -240,33 +240,10 @@
},
];
const handleDelete = (record: TableData) => {
openDeleteModal({
title: t('system.project.deleteName', { name: characterLimit(record.name) }),
content: t('system.project.deleteTip'),
onBeforeOk: async () => {
try {
await deleteProject(record.id);
Message.success(t('common.deleteSuccess'));
fetchData();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
});
};
const handleMoreAction = (tag: ActionsItem, record: TableData) => {
if (tag.eventTag === 'delete') {
handleDelete(record);
}
};
const handleEnableOrDisableProject = async (record: any, isEnable = true) => {
const title = isEnable ? t('system.project.enableTitle') : t('system.project.endTitle');
const content = isEnable ? t('system.project.enableContent') : t('system.project.endContent');
const okText = isEnable ? t('common.confirmEnable') : t('common.confirmClose');
const okText = isEnable ? t('common.confirmStart') : t('common.confirmEnd');
openModal({
type: 'info',
cancelText: t('common.cancel'),
@ -349,6 +326,49 @@
hideCancel: false,
});
};
const handleDelete = (record: TableData) => {
openDeleteModal({
title: t('system.project.deleteName', { name: characterLimit(record.name) }),
content: t('system.project.deleteTip'),
onBeforeOk: async () => {
try {
await deleteProject(record.id);
Message.success({
content: () =>
h('span', [
h('span', t('common.deleteSuccess')),
h(
'span',
{
directives: [
{
name: 'permission',
value: ['SYSTEM_ORGANIZATION_PROJECT:READ+RECOVER'],
},
],
class: 'ml-[8px] cursor-pointer text-[rgb(var(--primary-5))]',
onClick() {
handleRevokeDelete(record);
},
},
t('common.revoke')
),
]),
});
fetchData();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
});
};
const handleMoreAction = (tag: ActionsItem, record: TableData) => {
if (tag.eventTag === 'delete') {
handleDelete(record);
}
};
defineExpose({
fetchData,
});

View File

@ -43,10 +43,10 @@ export default {
'system.organization.deleteTip': '删除组织同时将该组织下的项目数据一起删除,请谨慎操作!',
'system.organization.revokeDeleteToolTip': '该组织将与 {count} 天后自动删除',
'system.organization.createOrganizationSuccess': '创建组织成功',
'system.organization.enableTitle': '启组织',
'system.organization.endTitle': '关闭组织',
'system.organization.enableTitle': '组织',
'system.organization.endTitle': '结束组织',
'system.organization.enableContent': '开启后的组织展示在组织切换列表',
'system.organization.endContent': '关闭后的组织不展示在组织切换列表',
'system.organization.endContent': '结束后的组织不展示在组织切换列表',
'system.organization.updateOrganization': '更新组织',
'system.organization.updateOrganizationSuccess': '更新组织成功',
'system.organization.createProject': '创建项目',
@ -54,9 +54,9 @@ export default {
'system.organization.searchIndexPlaceholder': '通过ID或名称搜索',
'system.organization.searchUserPlaceholder': '通过名称/邮箱/手机搜索',
'system.project.enableTitle': '开启项目',
'system.project.endTitle': '关闭项目',
'system.project.endTitle': '结束项目',
'system.project.enableContent': '开启后的项目展示在项目切换列表',
'system.project.endContent': '关闭后的项目不展示在项目切换列表',
'system.project.endContent': '结束后的项目不展示在项目切换列表',
'system.project.projectNamePlaceholder': '请输入项目名称,不可与其他项目名称重复',
'system.project.updateProject': '更新项目',
'system.project.createProject': '创建项目',
@ -66,11 +66,11 @@ export default {
'system.project.projectAdminPlaceholder': '默认选择创建项目人为项目管理员',
'system.project.moduleSetting': '开启模块',
'system.project.projectNameRequired': '项目名称不能为空',
'system.project.createTip': '项目后,将展示在项目切换列表',
'system.project.createTip': '项目启后,将展示在项目切换列表',
'system.project.affiliatedOrgRequired': '所属组织不能为空',
'system.project.revokeDeleteToolTip': '该项目将于 {count} 天后自动删除',
'system.project.removeTip': '移除后,将失去项目权限',
'system.organization.projectIsDisabled': '项目已结束,可在 项目列表 启',
'system.organization.projectIsDisabled': '项目已结束,可在 项目列表 ',
'system.project.deleteName': '确认删除 {name} 这个项目吗?',
'system.project.deleteTip': '删除后,系统会在 30天 后执行删除项目 (含项目下所有业务数据),请谨慎操作!',
'system.project.searchPlaceholder': '通过ID或项目名称搜索',