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.map((e) => e[props.valueKey || 'value']);
emit('update:modelValue', innerValue.value);
emit('change', innerValue.value);
} else {
innerValue.value = [];
emit('update:modelValue', []);
emit('change', []);
}
}

View File

@ -78,6 +78,7 @@
const props = defineProps<{
item: SelectedCardItem;
refreshKey: number;
status?: boolean;
cover?: ApiCoverageData;
}>();
@ -211,7 +212,8 @@
const unCoverWithCase =
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 = [
{
@ -355,6 +357,15 @@
deep: true,
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
initApiOrScenarioCount();
}
}
);
</script>
<style scoped lang="less">

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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