update 难度系数占比统计图
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
:groupId="formData.userGroupId"
|
||||
v-model="formData.userId"
|
||||
:multiple="multipleItems.includes('user')"
|
||||
:needDefaultUser="needDefaultUser"
|
||||
@change="filterChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -178,6 +179,10 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
needDefaultUser: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update']);
|
||||
@@ -268,8 +273,11 @@ const getGroupList = async () => {
|
||||
|
||||
// 用户组改变
|
||||
const handleUserGroupChange = () => {
|
||||
// 如果默认要选择第一个用户,就等用户选完一起更新,这里就不需要触发了
|
||||
formData.value.userId = '';
|
||||
emit('update', formatEmitData());
|
||||
if (!props.needDefaultUser) {
|
||||
emit('update', formatEmitData());
|
||||
}
|
||||
};
|
||||
// 筛选条件改变
|
||||
const filterChange = debounce(() => {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { ref, watch, nextTick } from 'vue';
|
||||
import { userQueryGroupDetailApi } from '@/api/system/user';
|
||||
|
||||
interface Props {
|
||||
@@ -27,6 +27,7 @@ interface Props {
|
||||
disabled?: boolean;
|
||||
fitInputWidth?: boolean;
|
||||
groupId?: string;
|
||||
needDefaultUser?: boolean;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
@@ -35,6 +36,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
disabled: false,
|
||||
fitInputWidth: false,
|
||||
groupId: '',
|
||||
needDefaultUser: false,
|
||||
});
|
||||
const listData = ref<any>([]);
|
||||
const choseList = ref<any>([]);
|
||||
@@ -85,6 +87,20 @@ const getlistDataFun = () => {
|
||||
};
|
||||
});
|
||||
listData.value = build;
|
||||
if (props.needDefaultUser) {
|
||||
nextTick(() => {
|
||||
const defaultValue =
|
||||
listData.value.length > 0
|
||||
? props.multiple
|
||||
? [listData.value[0].value]
|
||||
: listData.value[0].value
|
||||
: props.multiple
|
||||
? []
|
||||
: '';
|
||||
choseList.value = defaultValue;
|
||||
changeFun();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ import performanceCompletion from './dataStatistics/performanceCompletion.vue';
|
||||
import projectTaskComplete from './dataStatistics/projectTaskComplete.vue';
|
||||
import reviewPassed from './dataStatistics/reviewPassed.vue';
|
||||
import dashboardSetting from '@/components/common/dashboardSetting/index.vue';
|
||||
// import userDifficultyRateChart from './dataStatistics/userDifficultyRateChart.vue'; // 难度系数占比
|
||||
import userDifficultyRateChart from './dataStatistics/userDifficultyRateChart.vue'; // 难度系数占比
|
||||
// import sceneRunStatistics from './dataStatistics/sceneRunStatistics.vue'; //场景算例统计
|
||||
// import userSceneCost from './dataStatistics/userSceneCost.vue'; // 人员场景成本
|
||||
|
||||
@@ -54,11 +54,11 @@ const baseList = [
|
||||
title: '用户组难度系数统计',
|
||||
component: userDifficultyCoefficientChart, // 用户组难度系数统计
|
||||
},
|
||||
// {
|
||||
// id: 'userDifficultyRate',
|
||||
// title: '难度系数占比',
|
||||
// component: userDifficultyRateChart, // 难度系数占比
|
||||
// },
|
||||
{
|
||||
id: 'userDifficultyRate',
|
||||
title: '难度系数占比',
|
||||
component: userDifficultyRateChart, // 难度系数占比
|
||||
},
|
||||
// {
|
||||
// id: 'userSceneCost',
|
||||
// title: '人员场景成本',
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
'finishTime',
|
||||
]"
|
||||
:nodata="nodata"
|
||||
:needDefaultUser="true"
|
||||
@update="updateStatistics"
|
||||
/>
|
||||
</template>
|
||||
@@ -52,9 +53,13 @@ const updateStatistics = async (formData: any) => {
|
||||
delete params.userId;
|
||||
const res: any = await getUserGroupDifficultyStatisticsApi(params);
|
||||
if (res && res.code === 200) {
|
||||
const difficultyCount: Record<any, number> = {};
|
||||
nodata.value = res.data.result.length === 0;
|
||||
res.data.result.forEach((item: any) => {
|
||||
// 这个兼容我.... 没数据返回的时候,有时候是对象,有时候是空数组。。。
|
||||
if (res.data?.length === 0) {
|
||||
nodata.value = true;
|
||||
return;
|
||||
}
|
||||
const difficultyCount: any = {};
|
||||
res.data.result?.forEach((item: any) => {
|
||||
// 遍历item.difficultyCount这个对象,将key和value分别存入difficultyCount对象中,如果key已经存在,则将value累加
|
||||
Object.keys(item.difficultyCount)
|
||||
.filter((key: string) => DIFFICULTY_COEFFICIENT.value.O.hasOwnProperty(Number(key)))
|
||||
@@ -73,6 +78,7 @@ const updateStatistics = async (formData: any) => {
|
||||
value: difficultyCount[key],
|
||||
};
|
||||
});
|
||||
nodata.value = seriesData.length === 0;
|
||||
const colorList = Object.keys(difficultyCount)
|
||||
.sort((a, b) => Number(a) - Number(b))
|
||||
.map((key: any) => getDifficultyLevelColor(Number(key)));
|
||||
|
||||
Reference in New Issue
Block a user