From df3902e7eae5dd38a2d47aa63e5f27131f701db9 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 20 四月 2026 13:49:14 +0800
Subject: [PATCH] 绩效管理模块调整

---
 src/views/performance/class/index.vue |  200 +++++++++++++++++--------------------------------
 1 files changed, 70 insertions(+), 130 deletions(-)

diff --git a/src/views/performance/class/index.vue b/src/views/performance/class/index.vue
index ca34134..c48d607 100644
--- a/src/views/performance/class/index.vue
+++ b/src/views/performance/class/index.vue
@@ -41,8 +41,7 @@
             浜哄憳鍚嶇О
             <span style="color:#ff4949">(浜哄憳鏁伴噺:{{list.length}})</span>
           </div>
-          <div class="content-user" :class="{ hoverType: currentUserIndex == index }" v-for="(item, index) in list"
-            :key="'e' + index" v-on:mouseenter="onMouseEnter(index)" v-on:mouseleave="currentUserIndex = null">
+          <div class="content-user" v-for="(item, index) in list">
             <div class="user-pic">
               {{ item.userName ? item.userName.charAt(0) : "" }}
             </div>
@@ -55,13 +54,7 @@
                 ">
                 {{ item.userName }}
               </p>
-              <p style="color: #999999;font-size: 12px;transform: scale(0.8) translateX(-20px);white-space: nowrap;width: 150px;margin: 0;">
-                <span>鏃�:{{ item.monthlyAttendance.morningShift}},</span>
-                <span>涓�:{{ item.monthlyAttendance.swingShift}},</span>
-                <span>澶�:{{ item.monthlyAttendance.nightShift}},</span>
-                <span>浼�:{{ item.monthlyAttendance.holidayShift}},</span>
-                <span>鍋�:{{ item.monthlyAttendance.leaveShift}},</span>
-                <span>宸�:0</span>
+              <p style="color: #999999;font-size: 12px;transform: scale(0.8) translateX(-20px);white-space: nowrap;width: 150px;margin: 0;" v-text="item.monthlyAttendanceStr">
               </p>
               <p style="margin-top: 4px; margin: 0">
                 <span style="
@@ -69,7 +62,7 @@
                     font-size: 12px;
                     display: inline-block;
                     transform: scale(0.8) translateX(-10px);
-                  ">鍚堣鍑哄嫟: </span><span style="font-size: 16px; color: #ff4902">{{item.monthlyAttendance.morningShift+item.monthlyAttendance.swingShift+item.monthlyAttendance.nightShift}}澶�</span>
+                  ">鍚堣鍑哄嫟: </span><span style="font-size: 16px; color: #ff4902">{{item.monthlyAttendance.totalCount}}澶�</span>
               </p>
             </div>
           </div>
@@ -86,8 +79,7 @@
                 </p>
               </div>
             </div>
-            <div class="content-body" v-for="(item, index) in list" :key="'c' + index"
-              v-on:mouseenter="onMouseEnter(index)" v-on:mouseleave="currentUserIndex = null">
+            <div class="content-body" v-for="(item, index) in list" :key="'c' + index">
               <div class="content-body-item" v-for="(m, i) in item.list" :key="'d' + i"
                 :class="{ hoverType: currentUserIndex == index }">
                 <el-dropdown trigger="click" placement="bottom" @command="(e) => handleCommand(e, m)"
@@ -115,8 +107,8 @@
             浜哄憳鍚嶇О
             <span style="color:#ff4949">(浜哄憳鏁伴噺:{{yearList.length}})</span>
           </div>
-          <div class="content-user" :class="{ hoverType: currentUserIndex == index }" v-for="(item, index) in yearList"
-            :key="'e' + index" v-on:mouseenter="onMouseEnter(index)" v-on:mouseleave="currentUserIndex = null">
+          <div class="content-user" v-for="(item, index) in yearList"
+            :key="'e' + index">
             <div class="user-pic">
               {{ item.userName ? item.userName.charAt(0) : "" }}
             </div>
@@ -129,21 +121,14 @@
                 ">
                 {{ item.userName }}
               </p>
-              <p style="color: #999999;font-size: 12px;transform: scale(0.8) translateX(-20px);white-space: nowrap;width: 150px;margin: 0;">
-                <span>鏃�:{{ item.sidebarAnnualAttendance.morningShift}},</span>
-                <span>涓�:{{ item.sidebarAnnualAttendance.swingShift}},</span>
-                <span>澶�:{{ item.sidebarAnnualAttendance.nightShift}},</span>
-                <span>浼�:{{ item.sidebarAnnualAttendance.holidayShift}},</span>
-                <span>鍋�:{{ item.sidebarAnnualAttendance.leaveShift}},</span>
-                <span>宸�:0</span>
-              </p>
+              <p style="color: #999999;font-size: 12px;transform: scale(0.8) translateX(-20px);white-space: nowrap;width: 150px;margin: 0;" v-text="item.sidebarAnnualAttendanceStr"></p>
               <p style="margin-top: 4px; margin: 0">
                 <span style="
                     color: #999999;
                     font-size: 12px;
                     display: inline-block;
                     transform: scale(0.8) translateX(-10px);
-                  ">鍚堣鍑哄嫟: </span><span style="font-size: 16px; color: #ff4902">{{item.sidebarAnnualAttendance.morningShift+item.sidebarAnnualAttendance.swingShift+item.sidebarAnnualAttendance.nightShift}}澶�</span>
+                  ">鍚堣鍑哄嫟: </span><span style="font-size: 16px; color: #ff4902">{{item.sidebarAnnualAttendance.totalCount}}澶�</span>
               </p>
             </div>
           </div>
@@ -158,21 +143,15 @@
                   <span class="month">{{ item }}鏈�</span>
                 </div>
               </div>
-              <div class="content-body" v-for="(item, index) in yearList" :key="'c' + index"
-                v-on:mouseenter="onMouseEnter(index)" v-on:mouseleave="currentUserIndex = null" :style="`display: grid;
+              <div class="content-body" v-for="(item, index) in yearList" :key="'c' + index" :style="`display: grid;
               grid-template-columns: repeat(${monthList.length}, 1fr);`">
-                <div class="content-body-item" v-for="(m, i) in item.monthlyAttendance" :key="'d' + i"
+                <div class="content-body-item" v-for="(m, i) in item.monthlyAttendances" :key="'d' + i"
                   :class="{ hoverType: currentUserIndex == index }">
                   <p style="color: rgb(153, 153, 153); font-size: 12px">
-                    鍚堣鍑哄嫟锛�<span style="font-size: 14px; color: #000">{{m.morningShift+m.swingShift+m.nightShift}}</span>
+                    鍚堣鍑哄嫟锛�<span style="font-size: 14px; color: #000">{{m.monthlyAttendance.totalCount}}</span>
                   </p>
                   <p style="color: rgb(153, 153, 153); font-size: 12px">
-                    <span>鏃�:{{ m.morningShift}},</span>
-                    <span>涓�:{{ m.swingShift}},</span>
-                    <span>澶�:{{ m.nightShift}},</span>
-                    <span>浼�:{{ m.holidayShift}},</span>
-                    <span>鍋�:{{ m.leaveShift}},</span>
-                    <span>宸�:0</span>
+                    <span>{{m.monthlyAttendanceStr}}</span>
                   </p>
                 </div>
               </div>
@@ -265,9 +244,26 @@
           <span style="color: red; margin-right: 4px">*</span>浜哄憳鍚嶇О锛�
         </div>
         <div class="search_input" style="width: calc(100% - 90px)">
-          <el-select v-model="schedulingQuery.userId" placeholder="璇烽�夋嫨" style="width: 100%" multiple clearable
-            collapse-tags>
-            <el-option v-for="item in personList" :key="item.id" :label="item.name" :value="item.id">
+          <el-select v-model="schedulingQuery.userIdList" popper-class="select-with-all" placeholder="璇烽�夋嫨" style="width: 100%" multiple collapse-tags clearable>
+            <template slot="prefix">
+              <el-button
+                type="text"
+                size="mini"
+                @click="handleSelectAll"
+                style="margin: 4px 0;"
+              >
+                {{ isAllSelected ? '鍙栨秷鍏ㄩ��' : '鍏ㄩ��' }}
+              </el-button>
+              <el-divider style="margin: 5px 0;" />
+            </template>
+            <el-option
+              v-for="item in personList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            >
+              <span style="float: left">{{ item.name }}</span>
+              <span style="float: right; color: #8492a6; font-size: 13px">{{ item.account }}</span>
             </el-option>
           </el-select>
         </div>
@@ -304,10 +300,12 @@
   exportFile,
   obtainItemParameterList,
   update,
-  selectUserCondition,
   editAnnotationText,
   delAnnotationText
 } from "@/api/performance/class";
+import {selectUserListByPerformance} from '@/api/system/user'
+import {getWorkMonth} from "@/utils/date";
+import {transformExcel} from '@/utils/file'
 export default {
   name: 'Class',
   data() {
@@ -316,8 +314,7 @@
         userName: "",
         laboratory: "",
         year: new Date(),
-        month: new Date().getMonth() + 1,
-        // month:''
+        month: getWorkMonth().month()+1,
       },
       monthOptions: [
         {
@@ -378,7 +375,7 @@
       loading: false,
       schedulingQuery: {
         week: "",
-        userId: null,
+        userIdList: [],
         shift: "",
       },
       list: [],
@@ -399,6 +396,11 @@
       menuY: 0,
       selectedTarget: null,
     };
+  },
+  computed:{
+    isAllSelected() {
+      return this.schedulingQuery.userIdList.length === this.personList.length && this.personList.length > 0;
+    },
   },
   watch: {
 
@@ -423,6 +425,14 @@
     document.removeEventListener('click', this.handleClickOutside)
   },
   methods: {
+    handleSelectAll() {
+      if (this.isAllSelected) {
+        this.schedulingQuery.userIdList = [];
+      } else {
+        // 鍙�変腑鍙敤閫夐」鐨剉alue
+        this.schedulingQuery.userIdList = this.personList.map(item => item.id);
+      }
+    },
     handleContextMenu(target,e) {
       // 闃绘娴忚鍣ㄩ粯璁ゅ彸閿彍鍗�
       e.preventDefault()
@@ -526,40 +536,6 @@
         this.initYear();
       }
     },
-    transFromNumber(num) {
-      let changeNum = [
-        "闆�",
-        "涓�",
-        "浜�",
-        "涓�",
-        "鍥�",
-        "浜�",
-        "鍏�",
-        "涓�",
-        "鍏�",
-        "涔�",
-      ]; //changeNum[0] = "闆�"
-      let unit = ["", "鍗�", "鐧�", "鍗�", "涓�"];
-      num = parseInt(num);
-      let getWan = (temp) => {
-        let strArr = temp.toString().split("").reverse();
-        let newNum = "";
-        for (var i = 0; i < strArr.length; i++) {
-          newNum =
-            (i == 0 && strArr[i] == 0
-              ? ""
-              : i > 0 && strArr[i] == 0 && strArr[i - 1] == 0
-                ? ""
-                : changeNum[strArr[i]] + (strArr[i] == 0 ? unit[0] : unit[i])) +
-            newNum;
-        }
-        return newNum;
-      };
-      let overWan = Math.floor(num / 10000);
-      let noWan = num % 10000;
-      if (noWan.toString().length < 4) noWan = "0" + noWan;
-      return overWan ? getWan(overWan) + "涓�" + getWan(noWan) : getWan(num);
-    },
     init() {
       this.pageLoading = true;
       let year = this.query.year.getFullYear();
@@ -574,16 +550,6 @@
       }).then((res) => {
         this.pageLoading = false;
         this.list = res.data.page
-        // this.list = res.data.page.map((item) => {
-        //   for (let key in item.monthlyAttendance) {
-        //     let type = this.getDayByDic(key);
-        //     if (type != undefined || type != null) {
-        //       item[`day${type}`] = item.monthlyAttendance[key];
-        //     }
-        //   }
-        //   return item;
-        // });
-        console.log(this.list)
         let headerList = res.data.headerList;
         this.weeks = [];
         headerList.forEach((item) => {
@@ -610,9 +576,6 @@
         this.yearList = res.data
       });
     },
-    onMouseEnter(index) {
-      this.currentUserIndex = index;
-    },
     confirmScheduling() {
       if (!this.schedulingQuery.week) {
         this.$message.error("璇烽�夋嫨鍛ㄦ");
@@ -626,8 +589,8 @@
         getYearAndMonthAndDays(new Date(time + 24 * 60 * 60 * 1000 * 5)) +
         " 00:00:00";
       if (
-        !this.schedulingQuery.userId ||
-        this.schedulingQuery.userId.length == 0
+        !this.schedulingQuery.userIdList ||
+        this.schedulingQuery.userIdList.length == 0
       ) {
         this.$message.error("璇烽�夋嫨浜哄憳");
         return;
@@ -640,7 +603,7 @@
       add({
         startWeek,
         endWeek,
-        userId: this.schedulingQuery.userId.join(","),
+        userIdList: this.schedulingQuery.userIdList,
         shift: this.schedulingQuery.shift,
       })
         .then((res) => {
@@ -649,7 +612,7 @@
           this.schedulingVisible = false;
           this.schedulingQuery = {
             week: "",
-            userId: null,
+            userIdList: [],
             shift: "",
           };
           this.refresh();
@@ -761,21 +724,18 @@
         time,
         userName: this.query.userName,
         laboratory: this.query.laboratory,
-        isMonth: this.query.month ? true : false,
+        isMonth: !!this.query.month,
       })
         .then((res) => {
-          this.$message.success("涓嬭浇鎴愬姛");
           this.downLoading = false;
-          const blob = new Blob([res], {
-            type: "application/force-download",
-          });
-          let fileName = "";
+          let fileName = "涓ぉ鑰愪笣璐ㄩ噺閮�";
           if (this.query.month) {
-            fileName = year + "-" + this.query.month + " 鐝淇℃伅";
+            fileName += this.query.month + "鏈堢彮娆′俊鎭�";
           } else {
-            fileName = year + " 鐝姹囨��";
+            fileName += year + "骞寸彮娆℃眹鎬�";
           }
-          this.$download.saveAs(blob, fileName + ".xlsx");
+          transformExcel(res, fileName + ".xlsx");
+          this.$message.success("瀵煎嚭鎴愬姛");
         })
         .catch((err) => {
           this.downLoading = false;
@@ -787,29 +747,16 @@
       });
     },
     obtainItemParameterList() {
-      if (this.PROJECT == "妫�娴嬩腑蹇�") {
-        this.laboratory = [
-          {
-            label: "閫氫俊浜у搧瀹為獙瀹�",
-            value: "閫氫俊浜у搧瀹為獙瀹�",
-          },
-          {
-            label: "鐢靛姏浜у搧瀹為獙瀹�",
-            value: "鐢靛姏浜у搧瀹為獙瀹�",
-          },
-        ];
-      } else {
-        obtainItemParameterList().then((res) => {
-          let data = [];
-          res.data.forEach((a) => {
-            data.push({
-              label: a.laboratoryName,
-              value: a.id,
-            });
+      obtainItemParameterList().then((res) => {
+        let data = [];
+        res.data.forEach((a) => {
+          data.push({
+            label: a.laboratoryName,
+            value: a.id,
           });
-          this.laboratory = data;
         });
-      }
+        this.laboratory = data;
+      });
     },
     handleCommand(e, m) {
       if (e != m.shift) {
@@ -823,16 +770,9 @@
       }
     },
     getUsers() {
-      selectUserCondition({ type: 1 }).then((res) => {
-        let arr = res.data;
-        this.personList = arr;
+      selectUserListByPerformance().then((res) => {
+        this.personList = res.data;
       });
-    },
-    getDayByDic(e) {
-      let obj = this.classType.find((m) => m.dictLabel == e);
-      if (obj) {
-        return obj.dictValue;
-      }
     },
     getShiftByDic(e) {
       let obj = this.classType.find((m) => m.dictValue == e);

--
Gitblit v1.9.3