fix(工作台): 修复工作台接口场景覆盖率&卡片刷新bug

This commit is contained in:
xinxin.wu 2024-11-20 19:39:21 +08:00 committed by Craftsman
parent 9735eb9f1c
commit 32414829ba
14 changed files with 166 additions and 25 deletions

View File

@ -239,9 +239,11 @@ export default defineComponent(
? [...filterOptions.value] ? [...filterOptions.value]
: filterOptions.value.map((e) => e[props.valueKey || 'value']); : filterOptions.value.map((e) => e[props.valueKey || 'value']);
emit('update:modelValue', innerValue.value); emit('update:modelValue', innerValue.value);
emit('change', innerValue.value);
} else { } else {
innerValue.value = []; innerValue.value = [];
emit('update:modelValue', []); emit('update:modelValue', []);
emit('change', []);
} }
} }

View File

@ -78,6 +78,7 @@
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
status?: boolean; status?: boolean;
cover?: ApiCoverageData; cover?: ApiCoverageData;
}>(); }>();
@ -211,7 +212,8 @@
const unCoverWithCase = const unCoverWithCase =
props.item.key === WorkCardEnum.API_CASE_COUNT ? unCoverWithApiCase : unCoverWithApiScenario; props.item.key === WorkCardEnum.API_CASE_COUNT ? unCoverWithApiCase : unCoverWithApiScenario;
const coverWithCase = WorkCardEnum.API_CASE_COUNT ? coverWithApiCase : coverWithApiScenario; const coverWithCase = props.item.key === WorkCardEnum.API_CASE_COUNT ? coverWithApiCase : coverWithApiScenario;
coverData.value = cloneDeep(initCoverRate); coverData.value = cloneDeep(initCoverRate);
coverData.value = [ coverData.value = [
{ {
@ -355,6 +357,15 @@
deep: true, deep: true,
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
initApiOrScenarioCount();
}
}
);
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -75,6 +75,7 @@
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -228,6 +229,15 @@
deep: true, deep: true,
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
initData();
}
}
);
</script> </script>
<style scoped></style> <style scoped></style>

View File

@ -65,6 +65,7 @@
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
projectIds: string[]; projectIds: string[];
status?: boolean; status?: boolean;
cover?: ApiCoverageData; cover?: ApiCoverageData;
@ -261,6 +262,15 @@
deep: true, deep: true,
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
initApiCount();
}
}
);
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -64,6 +64,7 @@
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -195,6 +196,15 @@
deep: true, deep: true,
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
initCaseCount();
}
}
);
</script> </script>
<style scoped lang="less"></style> <style scoped lang="less"></style>

View File

@ -61,6 +61,7 @@
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -100,7 +101,7 @@
const caseReviewCountOptions = ref<Record<string, any>>({}); const caseReviewCountOptions = ref<Record<string, any>>({});
const hasPermission = ref<boolean>(false); const hasPermission = ref<boolean>(false);
async function initApiCount() { async function initReviewCount() {
const { startTime, endTime, dayNumber } = timeForm.value; const { startTime, endTime, dayNumber } = timeForm.value;
const params = { const params = {
current: 1, current: 1,
@ -134,13 +135,13 @@
function changeProject() { function changeProject() {
nextTick(() => { nextTick(() => {
initApiCount(); initReviewCount();
emit('change'); emit('change');
}); });
} }
onMounted(() => { onMounted(() => {
initApiCount(); initReviewCount();
}); });
watch( watch(
@ -166,13 +167,22 @@
() => timeForm.value, () => timeForm.value,
(val) => { (val) => {
if (val) { if (val) {
initApiCount(); initReviewCount();
} }
}, },
{ {
deep: true, deep: true,
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
initReviewCount();
}
}
);
</script> </script>
<style scoped lang="less"></style> <style scoped lang="less"></style>

View File

@ -73,6 +73,7 @@
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -208,6 +209,15 @@
deep: true, deep: true,
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
initCount();
}
}
);
</script> </script>
<style scoped lang="less"></style> <style scoped lang="less"></style>

View File

@ -62,6 +62,7 @@
const appStore = useAppStore(); const appStore = useAppStore();
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -232,6 +233,16 @@
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
getMemberOptions();
getDefectMemberDetail();
}
}
);
onMounted(() => { onMounted(() => {
getMemberOptions(); getMemberOptions();
getDefectMemberDetail(); getDefectMemberDetail();

View File

@ -67,6 +67,7 @@
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -170,6 +171,7 @@
itemStyle: { itemStyle: {
borderRadius: [2, 2, 0, 0], // borderRadius: [2, 2, 0, 0], //
}, },
z: 10,
data: countData, data: countData,
barMinHeight: ((optionData: Record<string, any>[]) => { barMinHeight: ((optionData: Record<string, any>[]) => {
optionData.forEach((itemValue: any, index: number) => { optionData.forEach((itemValue: any, index: number) => {
@ -217,13 +219,15 @@
console.log(error); console.log(error);
} }
} }
const isInit = ref(true);
function changeProject() { function changeProject() {
if (isInit.value) {
isInit.value = false;
return;
}
nextTick(() => { nextTick(() => {
if (innerProjectIds.value.length && innerProjectIds.value.length !== appStore.projectList.length) {
initOverViewDetail(); initOverViewDetail();
emit('change'); emit('change');
}
}); });
} }
@ -234,12 +238,6 @@
watch( watch(
() => innerProjectIds.value, () => innerProjectIds.value,
(val) => { (val) => {
if (val.length === appStore.projectList.length || val.length === 0) {
nextTick(() => {
initOverViewDetail();
emit('change');
});
}
innerSelectAll.value = val.length === appStore.projectList.length; innerSelectAll.value = val.length === appStore.projectList.length;
} }
); );
@ -255,6 +253,15 @@
deep: true, deep: true,
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
initOverViewDetail();
}
}
);
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -29,7 +29,7 @@
:prefix="t('workbench.homePage.staff')" :prefix="t('workbench.homePage.staff')"
:multiple="true" :multiple="true"
:has-all-select="true" :has-all-select="true"
:default-all-select="!innerHandleUsers.length" :default-all-select="innerSelectAll"
@change="changeMember" @change="changeMember"
> >
</MsSelect> </MsSelect>
@ -65,6 +65,7 @@
const appStore = useAppStore(); const appStore = useAppStore();
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -170,6 +171,7 @@
} }
} }
const innerSelectAll = ref<boolean>(false);
async function getMemberOptions() { async function getMemberOptions() {
const [newProjectId] = innerProjectIds.value; const [newProjectId] = innerProjectIds.value;
const res = await workProjectMemberOptions(newProjectId); const res = await workProjectMemberOptions(newProjectId);
@ -177,6 +179,7 @@
label: e.name, label: e.name,
value: e.id, value: e.id,
})); }));
innerSelectAll.value = memberIds.value.length === memberOptions.value.length;
} }
function changeProject() { function changeProject() {
@ -242,6 +245,18 @@
getMemberOptions(); getMemberOptions();
} }
}); });
watch(
() => props.refreshKey,
(val) => {
if (val) {
initOverViewMemberDetail();
if (props.item.projectIds.length) {
getMemberOptions();
}
}
}
);
</script> </script>
<style scoped lang="less"></style> <style scoped lang="less"></style>

View File

@ -57,6 +57,7 @@
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -166,6 +167,15 @@
deep: true, deep: true,
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
getRelatedCaseCount();
}
}
);
</script> </script>
<style scoped lang="less"></style> <style scoped lang="less"></style>

View File

@ -68,6 +68,7 @@
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -288,6 +289,15 @@
deep: true, deep: true,
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
initTestPlanCount();
}
}
);
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -114,6 +114,7 @@
const props = defineProps<{ const props = defineProps<{
item: SelectedCardItem; item: SelectedCardItem;
refreshKey: number;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -254,6 +255,15 @@
deep: true, deep: true,
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
initData();
}
}
);
</script> </script>
<style scoped></style> <style scoped></style>

View File

@ -59,6 +59,7 @@
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
v-model:selectAll="item.selectAll" v-model:selectAll="item.selectAll"
:item="item" :item="item"
:refresh-key="refreshKey"
@change="changeHandler" @change="changeHandler"
/> />
<OverviewMember <OverviewMember
@ -66,30 +67,35 @@
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
v-model:handleUsers="item.handleUsers" v-model:handleUsers="item.handleUsers"
:item="item" :item="item"
:refresh-key="refreshKey"
@change="changeHandler" @change="changeHandler"
/> />
<CaseCount <CaseCount
v-else-if="item.key === WorkCardEnum.CASE_COUNT" v-else-if="item.key === WorkCardEnum.CASE_COUNT"
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
:item="item" :item="item"
:refresh-key="refreshKey"
@change="changeHandler" @change="changeHandler"
/> />
<RelatedCaseCount <RelatedCaseCount
v-else-if="item.key === WorkCardEnum.ASSOCIATE_CASE_COUNT" v-else-if="item.key === WorkCardEnum.ASSOCIATE_CASE_COUNT"
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
:item="item" :item="item"
:refresh-key="refreshKey"
@change="changeHandler" @change="changeHandler"
/> />
<CaseReviewedCount <CaseReviewedCount
v-else-if="item.key === WorkCardEnum.REVIEW_CASE_COUNT" v-else-if="item.key === WorkCardEnum.REVIEW_CASE_COUNT"
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
:item="item" :item="item"
:refresh-key="refreshKey"
@change="changeHandler" @change="changeHandler"
/> />
<WaitReviewList <WaitReviewList
v-else-if="item.key === WorkCardEnum.REVIEWING_BY_ME" v-else-if="item.key === WorkCardEnum.REVIEWING_BY_ME"
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
:item="item" :item="item"
:refresh-key="refreshKey"
@change="changeHandler" @change="changeHandler"
/> />
<ApiAndScenarioCase <ApiAndScenarioCase
@ -97,6 +103,7 @@
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
:type="item.key" :type="item.key"
:item="item" :item="item"
:refresh-key="refreshKey"
:status="projectLoadingStatus[item.projectIds[0]]" :status="projectLoadingStatus[item.projectIds[0]]"
:cover="requestResults[item.projectIds[0]]" :cover="requestResults[item.projectIds[0]]"
@change="changeHandler" @change="changeHandler"
@ -105,6 +112,7 @@
v-else-if="item.key === WorkCardEnum.API_CHANGE" v-else-if="item.key === WorkCardEnum.API_CHANGE"
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
:item="item" :item="item"
:refresh-key="refreshKey"
@change="changeHandler" @change="changeHandler"
/> />
<DefectMemberBar <DefectMemberBar
@ -112,6 +120,7 @@
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
v-model:handleUsers="item.handleUsers" v-model:handleUsers="item.handleUsers"
:item="item" :item="item"
:refresh-key="refreshKey"
@change="changeHandler" @change="changeHandler"
/> />
<DefectCount <DefectCount
@ -119,6 +128,7 @@
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
:item="item" :item="item"
:type="item.key" :type="item.key"
:refresh-key="refreshKey"
@change="changeHandler" @change="changeHandler"
/> />
<ApiCount <ApiCount
@ -126,6 +136,7 @@
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
:status="projectLoadingStatus[item.projectIds[0]]" :status="projectLoadingStatus[item.projectIds[0]]"
:item="item" :item="item"
:refresh-key="refreshKey"
:cover="requestResults[item.projectIds[0]]" :cover="requestResults[item.projectIds[0]]"
@change="changeHandler" @change="changeHandler"
/> />
@ -133,6 +144,7 @@
v-else-if="item.key === WorkCardEnum.TEST_PLAN_COUNT" v-else-if="item.key === WorkCardEnum.TEST_PLAN_COUNT"
v-model:projectIds="item.projectIds" v-model:projectIds="item.projectIds"
:item="item" :item="item"
:refresh-key="refreshKey"
@change="changeHandler" @change="changeHandler"
/> />
</div> </div>
@ -306,9 +318,12 @@
} }
} }
const refreshKey = ref<number>(0);
// //
async function handleRefresh() { async function handleRefresh() {
initDefaultList(); initDefaultList();
refreshKey.value = Date.now();
} }
onMounted(() => { onMounted(() => {