feat(缺陷管理): 同步缺陷

This commit is contained in:
RubyLiu 2023-11-29 19:25:08 +08:00 committed by rubylliu
parent 1d353048ed
commit 42b1bcc60d
5 changed files with 65 additions and 10 deletions

View File

@ -10,7 +10,7 @@ const GE = { label: 'advanceFilter.operator.ge', value: 'ge' };
const LT = { label: 'advanceFilter.operator.lt', value: 'lt' }; const LT = { label: 'advanceFilter.operator.lt', value: 'lt' };
const LE = { label: 'advanceFilter.operator.le', value: 'le' }; const LE = { label: 'advanceFilter.operator.le', value: 'le' };
const EQUAL = { label: 'advanceFilter.operator.equal', value: 'equal' }; const EQUAL = { label: 'advanceFilter.operator.equal', value: 'equal' };
const NOT_EQUAL = { label: 'advanceFilter.operator.notEqual', value: 'notEqual' }; const NOT_EQUAL = { label: 'advanceFilter.operator.notEqual', value: 'not_equal' };
const BETWEEN = { label: 'advanceFilter.operator.between', value: 'between' }; const BETWEEN = { label: 'advanceFilter.operator.between', value: 'between' };
export const OPERATOR_MAP = { export const OPERATOR_MAP = {
@ -19,3 +19,5 @@ export const OPERATOR_MAP = {
date: [GT, GE, LT, LE, EQUAL, NOT_EQUAL, BETWEEN], date: [GT, GE, LT, LE, EQUAL, NOT_EQUAL, BETWEEN],
array: [IN, NOT_IN], array: [IN, NOT_IN],
}; };
export const timeSelectOptions = [GE, LE];

View File

@ -26,12 +26,51 @@
<template #empty> </template> <template #empty> </template>
</MsBaseTable> </MsBaseTable>
</MsCard> </MsCard>
<a-modal
v-model:visible="syncVisible"
title-align="start"
class="ms-modal-form ms-modal-small"
:ok-text="t('bugManagement.sync')"
unmount-on-close
@cancel="handleSyncCancel()"
>
<template #title>
<div class="flex flex-row items-center gap-[4px]">
<div class="medium text-[var(--color-text-1)]">{{ t('bugManagement.syncBug') }} </div>
<a-tooltip position="top">
<template #content>
<div>{{ t('bugManagement.syncBugTipRowOne') }}</div>
<div>{{ t('bugManagement.syncBugTipRowTwo') }}</div>
</template>
<MsIcon class="text-[var(--color-text-4)]" type="icon-icon-maybe_outlined" />
</a-tooltip>
</div>
</template>
<div
class="flex flex-row items-center gap-[8px] rounded-[4px] border-[1px] border-[rgb(var(--primary-5))] bg-[rgb(var(--primary-1))] px-[16px] py-[12px]"
>
<icon-exclamation-circle-fill class="text-[rgb(var(--primary-5))]" />
<div>{{ t('bugManagement.bugAutoSync', { name: '每天00:00:00' }) }}</div>
</div>
<div class="mb-[8px] mt-[16px]">{{ t('bugManagement.syncTime') }}</div>
<div class="flex flex-row gap-[8px]">
<a-select v-model="syncObject.operator" class="w-[120px]">
<a-option
v-for="option in timeSelectOptions"
:key="option.label"
:label="t(option.label)"
:value="option.value"
/>
</a-select>
<a-date-picker v-model="syncObject.time" show-time class="w-[304px]" />
</div>
</a-modal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import { MsAdvanceFilter } from '@/components/pure/ms-advance-filter'; import { MsAdvanceFilter, timeSelectOptions } from '@/components/pure/ms-advance-filter';
import { FilterFormItem, FilterType } from '@/components/pure/ms-advance-filter/type'; import { FilterFormItem, FilterType } from '@/components/pure/ms-advance-filter/type';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import MsCard from '@/components/pure/ms-card/index.vue'; import MsCard from '@/components/pure/ms-card/index.vue';
@ -39,14 +78,13 @@
import { MsTableColumn } from '@/components/pure/ms-table/type'; import { MsTableColumn } from '@/components/pure/ms-table/type';
import useTable from '@/components/pure/ms-table/useTable'; import useTable from '@/components/pure/ms-table/useTable';
import { getBugList } from '@/api/modules/bug-management';
import { updateOrAddProjectUserGroup } from '@/api/modules/project-management/usergroup'; import { updateOrAddProjectUserGroup } from '@/api/modules/project-management/usergroup';
import { postProjectTableByOrg } from '@/api/modules/setting/organizationAndProject';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import router from '@/router'; import router from '@/router';
import { useAppStore, useTableStore } from '@/store'; import { useAppStore, useTableStore } from '@/store';
import { BugListItem } from '@/models/bug-management'; import { BugListItem } from '@/models/bug-management';
import { OrgProjectTableItem } from '@/models/setting/system/orgAndProject';
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum'; import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
const { t } = useI18n(); const { t } = useI18n();
@ -56,6 +94,14 @@
const projectId = computed(() => appStore.currentProjectId); const projectId = computed(() => appStore.currentProjectId);
const filterVisible = ref(false); const filterVisible = ref(false);
const filterRowCount = ref(0); const filterRowCount = ref(0);
const syncVisible = ref(false);
const syncObject = reactive({
time: '',
operator: '',
});
const handleSyncCancel = () => {
syncVisible.value = false;
};
const filterConfigList = reactive<FilterFormItem[]>([ const filterConfigList = reactive<FilterFormItem[]>([
{ {
title: 'bugManagement.ID', title: 'bugManagement.ID',
@ -165,7 +211,7 @@
]; ];
await tableStore.initColumn(TableKeyEnum.BUG_MANAGEMENT, columns, 'drawer'); await tableStore.initColumn(TableKeyEnum.BUG_MANAGEMENT, columns, 'drawer');
const handleNameChange = async (record: OrgProjectTableItem) => { const handleNameChange = async (record: BugListItem) => {
try { try {
await updateOrAddProjectUserGroup(record); await updateOrAddProjectUserGroup(record);
Message.success(t('common.updateSuccess')); Message.success(t('common.updateSuccess'));
@ -176,7 +222,7 @@
}; };
const { propsRes, propsEvent, loadList, setKeyword, setLoadListParams, setProps } = useTable( const { propsRes, propsEvent, loadList, setKeyword, setLoadListParams, setProps } = useTable(
postProjectTableByOrg, getBugList,
{ {
tableKey: TableKeyEnum.BUG_MANAGEMENT, tableKey: TableKeyEnum.BUG_MANAGEMENT,
selectable: false, selectable: false,
@ -204,8 +250,7 @@
}); });
}; };
const handleSync = () => { const handleSync = () => {
// eslint-disable-next-line no-console syncVisible.value = true;
console.log('sync');
}; };
const handleCopy = (record: BugListItem) => { const handleCopy = (record: BugListItem) => {

View File

@ -17,6 +17,11 @@ export default {
updateUser: '更新人', updateUser: '更新人',
createTime: '创建时间', createTime: '创建时间',
updateTime: '更新时间', updateTime: '更新时间',
sync: '同步',
syncBugTipRowOne: '将第三方的缺陷同步到缺陷管理中,',
syncBugTipRowTwo: '新增缺陷和更新已有的缺陷?',
bugAutoSync: '系统 {name} 自动同步',
syncTime: '同步时间',
edit: { edit: {
defaultSystemTemplate: '默认为系统模板', defaultSystemTemplate: '默认为系统模板',
content: '缺陷内容', content: '缺陷内容',

View File

@ -181,7 +181,7 @@
await fApi.value?.submit(async (formData: FormData) => { await fApi.value?.submit(async (formData: FormData) => {
try { try {
okLoading.value = true; okLoading.value = true;
await postSaveDefectSync({ ...form, BUG_PLATFORM_CONFIG: formData }, currentProjectId.value); await postSaveDefectSync({ ...form, BUG_PLATFORM_CONFIG: JSON.stringify(formData) }, currentProjectId.value);
Message.success(t('common.createSuccess')); Message.success(t('common.createSuccess'));
handleCancel(true); handleCancel(true);
} catch (error) { } catch (error) {

View File

@ -129,7 +129,10 @@
await fApi.value?.submit(async (formData: FormData) => { await fApi.value?.submit(async (formData: FormData) => {
try { try {
okLoading.value = true; okLoading.value = true;
await postSaveRelatedCase({ ...form, DEMAND_PLATFORM_CONFIG: formData }, currentProjectId.value); await postSaveRelatedCase(
{ ...form, DEMAND_PLATFORM_CONFIG: JSON.stringify(formData) },
currentProjectId.value
);
Message.success(t('common.createSuccess')); Message.success(t('common.createSuccess'));
handleCancel(true); handleCancel(true);
} catch (error) { } catch (error) {