feat(缺陷管理): 分享缺陷

This commit is contained in:
RubyLiu 2024-02-06 15:37:37 +08:00 committed by Craftsman
parent fd13deefc8
commit 4a30fb7436
4 changed files with 33 additions and 5 deletions

View File

@ -158,7 +158,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import { debounce } from 'lodash-es'; import { debounce } from 'lodash-es';
@ -194,6 +194,7 @@
import { RouteEnum } from '@/enums/routeEnum'; import { RouteEnum } from '@/enums/routeEnum';
const router = useRouter(); const router = useRouter();
const route = useRoute();
const detailDrawerRef = ref<InstanceType<typeof MsDetailDrawer>>(); const detailDrawerRef = ref<InstanceType<typeof MsDetailDrawer>>();
const wrapperRef = ref(); const wrapperRef = ref();
const { isFullScreen, toggleFullScreen } = useFullScreen(wrapperRef); const { isFullScreen, toggleFullScreen } = useFullScreen(wrapperRef);
@ -290,7 +291,26 @@
const shareLoading = ref<boolean>(false); const shareLoading = ref<boolean>(false);
function shareHandler() { function shareHandler() {
const { origin } = window.location;
const url = `${origin}/#${route.path}?id=${detailInfo.value.id}&projectId=${appStore.currentProjectId}&organizationId=${appStore.currentOrgId}`;
if (navigator.clipboard) {
navigator.clipboard.writeText(url).then(
() => {
Message.info(t('bugManagement.detail.shareTip')); Message.info(t('bugManagement.detail.shareTip'));
},
(e) => {
Message.error(e);
}
);
} else {
const input = document.createElement('input');
input.value = url;
document.body.appendChild(input);
input.select();
document.execCommand('copy');
document.body.removeChild(input);
Message.info(t('bugManagement.detail.shareTip'));
}
} }
const followLoading = ref<boolean>(false); const followLoading = ref<boolean>(false);

View File

@ -527,7 +527,6 @@
}); });
} else { } else {
Message.success(t('common.createSuccess')); Message.success(t('common.createSuccess'));
if (isContinue) { if (isContinue) {
// //
const { templateId } = form.value; const { templateId } = form.value;
@ -550,10 +549,12 @@
}); });
return; return;
} }
debugger;
router.push({ router.push({
name: BugManagementRouteEnum.BUG_MANAGEMENT_CREATE_SUCCESS, name: BugManagementRouteEnum.BUG_MANAGEMENT_CREATE_SUCCESS,
query: { query: {
id: res.id, ...route.query,
id: res.data.id,
}, },
}); });
} }

View File

@ -125,6 +125,7 @@
</template> </template>
<script lang="ts" async setup> <script lang="ts" async setup>
import { useRoute } from 'vue-router';
import { Message, TableData } from '@arco-design/web-vue'; import { Message, TableData } from '@arco-design/web-vue';
import { MsAdvanceFilter, timeSelectOptions } from '@/components/pure/ms-advance-filter'; import { MsAdvanceFilter, timeSelectOptions } from '@/components/pure/ms-advance-filter';
@ -185,6 +186,7 @@
const licenseStore = useLicenseStore(); const licenseStore = useLicenseStore();
const isXpack = computed(() => licenseStore.hasLicense()); const isXpack = computed(() => licenseStore.hasLicense());
const { openDeleteModal } = useModal(); const { openDeleteModal } = useModal();
const route = useRoute();
// //
const customFields = ref<BugEditCustomField[]>([]); const customFields = ref<BugEditCustomField[]>([]);
// //
@ -579,8 +581,12 @@
onMounted(() => { onMounted(() => {
setLoadListParams({ projectId: projectId.value }); setLoadListParams({ projectId: projectId.value });
fetchData();
setExportOptionData(); setExportOptionData();
fetchData();
if (route.query.id) {
//
handleShowDetail(route.query.id as string, 0);
}
}); });
</script> </script>

View File

@ -68,6 +68,7 @@ export default {
detail: '详情', detail: '详情',
case: '用例', case: '用例',
comment: '评论', comment: '评论',
shareTip: '分享链接已复制到剪贴板',
deleteTitle: '确认删除 {name} 吗?', deleteTitle: '确认删除 {name} 吗?',
deleteContent: '删除后MeterSphere 创建的缺陷进入回收站;第三方平台同步的缺陷将不做回收', deleteContent: '删除后MeterSphere 创建的缺陷进入回收站;第三方平台同步的缺陷将不做回收',
}, },