|
@@ -1,64 +1,152 @@
|
|
|
<script setup lang="ts">
|
|
|
defineOptions({
|
|
|
- name: "workerRank"
|
|
|
+ name: "AssessmentRank"
|
|
|
});
|
|
|
-import rankTableDraw from "@/components/rankTable/index.vue";
|
|
|
-import assessmentRank from "@/components/rankTable/assessmentRank.vue";
|
|
|
-import { getPersonDimensionChartsList, getChartsList } from "@/api/draw";
|
|
|
-import seachData from "./componements/seach.vue";
|
|
|
-import { ref, nextTick } from "vue";
|
|
|
|
|
|
-// tab逻辑
|
|
|
-const activeName = ref("0");
|
|
|
-const handleClick = (tab, event) => {
|
|
|
- console.log(tab, event);
|
|
|
-};
|
|
|
+import { ref, onMounted } from "vue";
|
|
|
+import { Search } from "@element-plus/icons-vue";
|
|
|
+import {
|
|
|
+ getAssessmentPageList,
|
|
|
+ getPageScoreInfoByAssessment
|
|
|
+} from "@/api/manage";
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
|
|
|
-const rankTableRef = ref();
|
|
|
-const seachParams = ref();
|
|
|
-const lengthData = ref();
|
|
|
-const getPersonDimensionChartsListApi = async () => {
|
|
|
- const { code, data } = await getChartsList({
|
|
|
- ...seachParams.value,
|
|
|
- type: 0
|
|
|
- });
|
|
|
+// 考核活动点击交互
|
|
|
+const activityList: any = ref([]);
|
|
|
+const activeActivity = ref(0);
|
|
|
+const handleActiveActivity = (item: any, index: number) => {
|
|
|
+ activeActivity.value = index;
|
|
|
+ getPageScoreInfoByAssessmentApi(item);
|
|
|
+};
|
|
|
|
|
|
- if (code == 200) {
|
|
|
- if (data.length > 0) {
|
|
|
- lengthData.value = data.length;
|
|
|
- setTimeout(() => {
|
|
|
- nextTick(() => {
|
|
|
- rankTableRef.value && rankTableRef.value.init(data, "科室", "姓名");
|
|
|
- });
|
|
|
- }, 500);
|
|
|
+// 考核活动数据
|
|
|
+const getAssessmentPageListApi = async (name = "") => {
|
|
|
+ const params: {
|
|
|
+ pageNumber: number;
|
|
|
+ pageSize: number;
|
|
|
+ assessment_type: number;
|
|
|
+ name?: string;
|
|
|
+ } = {
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 999999,
|
|
|
+ assessment_type: 0 // 0:员工,1:部门,2:医疗组,3:部门负责人
|
|
|
+ };
|
|
|
+ if (name) {
|
|
|
+ params.name = name;
|
|
|
+ }
|
|
|
+ const { code, msg, data } = await getAssessmentPageList(params);
|
|
|
+ if (code === 200) {
|
|
|
+ activityList.value = data.records || [];
|
|
|
+ if (activityList.value && activityList.value.length) {
|
|
|
+ handleActiveActivity(activityList.value[0], 0);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ ElMessage.error(msg);
|
|
|
}
|
|
|
-
|
|
|
- // console.log(res);
|
|
|
};
|
|
|
-const init = (item, type) => {
|
|
|
- seachParams.value = item;
|
|
|
- if (Number(type)) {
|
|
|
- getPersonDimensionChartsListApi();
|
|
|
+onMounted(() => {
|
|
|
+ getAssessmentPageListApi();
|
|
|
+});
|
|
|
+const handleSearch = () => {
|
|
|
+ getAssessmentPageListApi(searchKeyword.value);
|
|
|
+};
|
|
|
+
|
|
|
+// 右侧列表
|
|
|
+const searchKeyword = ref("");
|
|
|
+const averageScore = ref<number | string>(0);
|
|
|
+const tableData = ref<any>([]);
|
|
|
+const getPageScoreInfoByAssessmentApi = async (obj: any = {}) => {
|
|
|
+ const params = {
|
|
|
+ assessmentId: obj.id,
|
|
|
+ assessmentType: `${obj.assessmentType}`
|
|
|
+ };
|
|
|
+ const { code, msg, data = [] } = await getPageScoreInfoByAssessment(params);
|
|
|
+ if (code === 200) {
|
|
|
+ tableData.value = data;
|
|
|
+ if (tableData.value.length) {
|
|
|
+ let allCount = 0;
|
|
|
+ tableData.value.forEach(item => {
|
|
|
+ allCount += item.score ? Number(item.score) : 0;
|
|
|
+ });
|
|
|
+ let resultNum: number | string = allCount / tableData.value.length;
|
|
|
+ if (
|
|
|
+ resultNum.toString().split(".")[1] &&
|
|
|
+ resultNum.toString().split(".")[1].length > 3
|
|
|
+ ) {
|
|
|
+ resultNum = resultNum.toFixed(3);
|
|
|
+ }
|
|
|
+ averageScore.value = resultNum;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ElMessage.error(msg);
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <div class="w-full">
|
|
|
- <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
|
|
|
- <el-tab-pane label="科室维度" name="0">
|
|
|
- <div class="mb-2 flex gap-2 justify-between flex-wrap">
|
|
|
- <seachData @handClick="init" />
|
|
|
+ <div class="assessment-rank flex">
|
|
|
+ <div class="search-section mr-4">
|
|
|
+ <el-input
|
|
|
+ v-model="searchKeyword"
|
|
|
+ placeholder="考核活动名称"
|
|
|
+ class="w-64"
|
|
|
+ :suffix-icon="Search"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleSearch"
|
|
|
+ />
|
|
|
+ <div class="search-section-list">
|
|
|
+ <p
|
|
|
+ v-for="(item, index) in activityList"
|
|
|
+ :key="item.id"
|
|
|
+ class="mt-4 cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap"
|
|
|
+ :style="{ color: activeActivity === index ? '#0052d9' : '#333' }"
|
|
|
+ @click="handleActiveActivity(item, index)"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-card class="w-full">
|
|
|
+ <template #header>
|
|
|
+ <div class="flex justify-between items-center">
|
|
|
+ <span class="text-base font-medium">平均得分: </span>
|
|
|
+ <span>{{ averageScore }}</span>
|
|
|
</div>
|
|
|
- <rankTableDraw v-if="lengthData > 0" ref="rankTableRef" />
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="指标维度" name="1">
|
|
|
- <div class="mb-2 flex gap-2 justify-between flex-wrap">
|
|
|
- <seachData @handClick="init" />
|
|
|
- </div>
|
|
|
- <assessmentRank ref="rankTableRef2" />
|
|
|
- </el-tab-pane>
|
|
|
- </el-tabs>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <el-table :data="tableData" style="width: 100%" border>
|
|
|
+ <el-table-column type="index" label="排名" width="80" align="center" />
|
|
|
+ <el-table-column prop="templateName" label="考核模板" min-width="200" />
|
|
|
+ <el-table-column prop="deptName" label="科室" min-width="150" />
|
|
|
+ <el-table-column prop="userName" label="员工" min-width="150" />
|
|
|
+ <el-table-column
|
|
|
+ prop="score"
|
|
|
+ label="实际得分"
|
|
|
+ width="120"
|
|
|
+ align="right"
|
|
|
+ />
|
|
|
+ </el-table>
|
|
|
+ </el-card>
|
|
|
</div>
|
|
|
</template>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.assessment-rank {
|
|
|
+ padding: 20px 0;
|
|
|
+}
|
|
|
+
|
|
|
+.search-section {
|
|
|
+ flex-shrink: 0;
|
|
|
+ width: 200px;
|
|
|
+
|
|
|
+ .search-section-list {
|
|
|
+ height: calc(100vh - 250px);
|
|
|
+ margin-top: 20px;
|
|
|
+ overflow: auto;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-card__header) {
|
|
|
+ padding: 15px 20px;
|
|
|
+}
|
|
|
+</style>
|