Explorar o código

Merge branch 'personnelPerformance' into dev

huoyi hai 1 mes
pai
achega
a1bb652412

+ 45 - 14
src/views/performanceManage/monthlyAssess/index.vue

@@ -12,8 +12,8 @@
12 12
     <!-- 查询条件 -->
13 13
     <div class="filter-container">
14 14
       <el-form :model="queryParams" ref="queryFormRef" :inline="true" class="search-form">
15
-        <el-form-item label="姓名" prop="name">
16
-          <el-input v-model="queryParams.name" placeholder="请输入姓名" clearable style="width: 200px" />
15
+        <el-form-item label="姓名" prop="userName">
16
+          <el-input v-model="queryParams.userName" placeholder="请输入姓名" clearable style="width: 200px" />
17 17
         </el-form-item>
18 18
 
19 19
         <el-form-item label="考核月份" prop="assessmentMonth">
@@ -21,6 +21,28 @@
21 21
             value-format="YYYY-MM" style="width: 200px" />
22 22
         </el-form-item>
23 23
 
24
+        <template v-if="currentTab === 'non-cadre'">
25
+          <el-form-item label="岗位" prop="post">
26
+            <el-select v-model="queryParams.post" placeholder="请选择岗位" clearable style="width: 200px">
27
+              <el-option v-for="item in post" :key="item.value" :label="item.label" :value="item.value" />
28
+            </el-select>
29
+          </el-form-item>
30
+
31
+          <el-form-item label="考核组" prop="assessmentTeam">
32
+            <el-select v-model="queryParams.assessmentTeam" placeholder="请选择考核组" clearable style="width: 200px">
33
+              <el-option v-for="item in assessment_team" :key="item.value" :label="item.label" :value="item.value" />
34
+            </el-select>
35
+          </el-form-item>
36
+
37
+          <el-form-item label="考核结果" prop="assessmentResult">
38
+            <el-input v-model="queryParams.assessmentResult" placeholder="请输入考核结果" clearable style="width: 200px" />
39
+          </el-form-item>
40
+
41
+          <el-form-item label="豁免" prop="exemption">
42
+            <el-input v-model="queryParams.exemption" placeholder="请输入豁免" clearable style="width: 200px" />
43
+          </el-form-item>
44
+        </template>
45
+
24 46
         <el-form-item>
25 47
           <el-button type="primary" icon="Search" @click="handleQuery">查询</el-button>
26 48
           <el-button icon="Refresh" @click="resetQuery">重置</el-button>
@@ -39,7 +61,7 @@
39 61
       <div v-else class="left-buttons"></div>
40 62
 
41 63
       <div class="right-buttons">
42
-        <el-button type="primary" @click="generateMonthlyAssessment">生成本月考核表</el-button>
64
+        <el-button type="primary" :disabled="!queryParams.assessmentMonth" @click="generateMonthlyAssessment">生成本月考核表</el-button>
43 65
       </div>
44 66
     </div>
45 67
 
@@ -171,9 +193,9 @@
171 193
 
172 194
     <!-- 编辑/新增弹窗 -->
173 195
     <el-dialog :title="dialog.title" v-model="dialog.visible" width="80%" :close-on-click-modal="false"
174
-      destroy-on-close>
196
+      destroy-on-close >
175 197
       <!-- 非干部表单 -->
176
-      <el-form v-if="dialog.type === 'non-cadre'" :model="nonCadreForm" ref="formRef" :rules="nonCadreRules"
198
+      <el-form v-loading="dialog.loading" v-if="dialog.type === 'non-cadre'" :model="nonCadreForm" ref="formRef" :rules="nonCadreRules"
177 199
         label-width="380px" class="form-container">
178 200
         <!-- 第一部分:基础信息 -->
179 201
         <el-row :gutter="20">
@@ -596,8 +618,12 @@ watch(() => currentTab.value, () => {
596 618
 const queryParams = reactive({
597 619
   pageNum: 1,
598 620
   pageSize: 10,
599
-  name: '',
600
-  assessmentMonth: ''
621
+  userName: '',
622
+  assessmentMonth: '',
623
+  post: '',
624
+  assessmentTeam: '',
625
+  assessmentResult: '',
626
+  exemption: ''
601 627
 })
602 628
 
603 629
 const currentMonthDefault = `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}`
@@ -840,7 +866,8 @@ function findIndicatorById(tree, targetId) {
840 866
 const dialog = reactive({
841 867
   visible: false,
842 868
   title: '',
843
-  type: 'non-cadre'
869
+  type: 'non-cadre',
870
+  loading: false
844 871
 })
845 872
 
846 873
 // 详情模态框
@@ -886,11 +913,14 @@ const nonCadreRules = {
886 913
 
887 914
 
888 915
 async function loadUserList(month) {
916
+  dialog.loading = true
889 917
   try {
890 918
     const res = await listUserPerformance({ month })
891 919
     userList.value = res.data || []
892 920
   } catch (error) {
893 921
     console.error('获取员工列表失败:', error)
922
+  } finally {
923
+    dialog.loading = false
894 924
   }
895 925
 }
896 926
 
@@ -1240,22 +1270,23 @@ const handleExport = async () => {
1240 1270
 const generateMonthlyAssessment = async () => {
1241 1271
   try {
1242 1272
     const tabText = currentTab.value === 'non-cadre' ? '非干部' : '干部'
1243
-    ElMessageBox.confirm(`是否生成本月${tabText}考核数据?`, '提示', {
1273
+    ElMessageBox.confirm(`是否生成${queryParams.assessmentMonth}考核数据?`, '提示', {
1244 1274
       confirmButtonText: '确定',
1245 1275
       cancelButtonText: '取消',
1246 1276
       type: 'warning'
1247 1277
     }).then(async () => {
1248 1278
       loading.value = true
1249
-      const now = new Date()
1250
-      const currentMonth = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, '0')}`
1279
+      const queryMonth = queryParams.assessmentMonth.replace('-', '')
1280
+      const queryYear = parseInt(queryMonth.substring(0, 4))
1281
+      const queryMonthNum = parseInt(queryMonth.substring(4, 6))
1251 1282
 
1252 1283
       if (currentTab.value === 'non-cadre') {
1253
-        const res = await generateNonCadreAssessment({ month: currentMonth })
1284
+        const res = await generateNonCadreAssessment({ month: queryMonth })
1254 1285
         ElMessage.success('生成成功')
1255 1286
       } else {
1256 1287
         const params = {
1257
-          year: now.getFullYear(),
1258
-          month: now.getMonth() + 1
1288
+          year: queryYear,
1289
+          month: queryMonthNum
1259 1290
         }
1260 1291
         const res = await generateCadreAssessment(params)
1261 1292
         ElMessage.success('生成成功')

+ 27 - 26
src/views/performanceManage/monthlyAssessSum/index.vue

@@ -147,27 +147,26 @@
147 147
           <!-- 左边表格 -->
148 148
           <div class="table-section">
149 149
             <el-table :data="item.tableData" border style="width: 100%;">
150
-              <el-table-column prop="brigade" label="大队" align="center" min-width="100" />
151
-              <el-table-column prop="assessmentGroup" label="考核组" align="center" min-width="100" />
152
-              <el-table-column prop="groupCount" label="考核组人数" align="center" min-width="120" />
153
-              <el-table-column prop="calculatedImprovement" label="测算待改进人数" align="center" min-width="140" />
154
-              <el-table-column prop="improvementCount" label="待改进人数" align="center" min-width="120" />
155
-              <el-table-column prop="exemption1" label="豁免" align="center" min-width="80" />
156
-              <el-table-column prop="actualImprovement" label="实际待改进人数" align="center" min-width="140" />
157
-              <el-table-column prop="unqualifiedCount" label="不称职人数" align="center" min-width="120" />
158
-              <el-table-column prop="exemption2" label="豁免" align="center" min-width="80" />
159
-              <el-table-column prop="actualUnqualified" label="实际不称职人数" align="center" min-width="140" />
150
+              <el-table-column prop="assessmentTeam" label="考核组" align="center" min-width="100" />
151
+              <el-table-column prop="assessmentTeamCount" label="考核组人数" align="center" min-width="120" />
152
+              <el-table-column prop="estimatedImprovementCount" label="测算待改进人数" align="center" min-width="140" />
153
+              <el-table-column prop="improvementTotalCount" label="待改进人数" align="center" min-width="120" />
154
+              <el-table-column prop="improvementExemptedCount" label="豁免" align="center" min-width="80" />
155
+              <el-table-column prop="actualImprovementCount" label="实际待改进人数" align="center" min-width="140" />
156
+              <el-table-column prop="incompetentTotalCount" label="不称职人数" align="center" min-width="120" />
157
+              <el-table-column prop="incompetentExemptedCount" label="豁免" align="center" min-width="80" />
158
+              <el-table-column prop="actualIncompetentCount" label="实际不称职人数" align="center" min-width="140" />
160 159
             </el-table>
161 160
           </div>
162 161
 
163 162
           <!-- 右边柱状图和饼状图 -->
164 163
           <div class="chart-section">
165 164
             <div class="bar-chart-container">
166
-              <div class="chart-title">考核分数分布</div>
165
+              <div class="chart-title">{{ item.title }}考核人数与待改进情况</div>
167 166
               <div :ref="el => setTraversalChartRef(el, `barChart_${index}`)" class="bar-chart"></div>
168 167
             </div>
169 168
             <div class="pie-chart-container">
170
-              <div class="pie-chart-title">岗位分布</div>
169
+              <div class="pie-chart-title">{{ item.title }}考核人数占比</div>
171 170
               <div :ref="el => setTraversalChartRef(el, `pieChart3_${index}`)" class="pie-chart"></div>
172 171
             </div>
173 172
           </div>
@@ -314,7 +313,7 @@ const initCharts = () => {
314 313
         tooltip: { trigger: 'item' },
315 314
         series: [{
316 315
           type: 'pie',
317
-          radius: '70%',
316
+          radius: '50%',
318 317
           data: [
319 318
             { value: 120, name: '一队' },
320 319
             { value: 150, name: '二队' },
@@ -331,7 +330,7 @@ const initCharts = () => {
331 330
         tooltip: { trigger: 'item' },
332 331
         series: [{
333 332
           type: 'pie',
334
-          radius: '70%',
333
+          radius: '50%',
335 334
           data: [
336 335
             { value: 45, name: '优秀' },
337 336
             { value: 280, name: '合格' },
@@ -348,7 +347,7 @@ const initCharts = () => {
348 347
         tooltip: { trigger: 'item' },
349 348
         series: [{
350 349
           type: 'pie',
351
-          radius: '70%',
350
+          radius: '50%',
352 351
           data: [
353 352
             { value: 150, name: '安检员' },
354 353
             { value: 120, name: '设备操作员' },
@@ -366,7 +365,7 @@ const initCharts = () => {
366 365
         tooltip: { trigger: 'item' },
367 366
         series: [{
368 367
           type: 'pie',
369
-          radius: '70%',
368
+          radius: '50%',
370 369
           data: [
371 370
             { value: 35, name: '优秀' },
372 371
             { value: 320, name: '合格' },
@@ -491,11 +490,11 @@ const getList = async () => {
491 490
       }
492 491
       return formatted
493 492
     }
494
-    
493
+
495 494
     // 获取大队列表
496 495
     const brigadeListRes = await listDept()
497 496
     const brigadeList = (brigadeListRes.data || []).filter(item => item.deptType === 'BRIGADE' && item.isFunctionalDept == 0)
498
-    
497
+
499 498
     // 其他接口调用
500 499
     const formattedQueryParams = formatParams(queryParams)
501 500
     const results = await Promise.allSettled([
@@ -522,23 +521,23 @@ const getList = async () => {
522 521
         getBrigadeImprovementDistribution(brigadeParams),
523 522
         getBrigadeIncompetentDistribution(brigadeParams)
524 523
       ])
525
-      
524
+
526 525
       const [deptTeamStatRes, brigadeImproveRes, brigadeIncompRes] = brigadeResults
527
-      
526
+
528 527
       const statisticsData = deptTeamStatRes.status === 'fulfilled' ? (deptTeamStatRes.value.data || []) : []
529 528
       const brigadeImproveData = brigadeImproveRes.status === 'fulfilled' ? (brigadeImproveRes.value.data || []) : []
530 529
       const brigadeIncompData = brigadeIncompRes.status === 'fulfilled' ? (brigadeIncompRes.value.data || []) : []
531
-      
530
+
532 531
       // 解析表格数据
533 532
       let tableData = []
534 533
       if (statisticsData.length > 0 && statisticsData[0].assessmentTeams) {
535 534
         tableData = statisticsData[0].assessmentTeams
536 535
       }
537
-      
536
+
538 537
       // 计算总计用于标题
539 538
       const totalImprovement = tableData.reduce((sum, item) => sum + (item.actualImprovementCount || 0), 0)
540 539
       const totalIncompetent = tableData.reduce((sum, item) => sum + (item.actualIncompetentCount || 0), 0)
541
-      
540
+
542 541
       return {
543 542
         title: brigade.deptName,
544 543
         deptId: brigade.deptId,
@@ -550,8 +549,10 @@ const getList = async () => {
550 549
       }
551 550
     })
552 551
 
553
-    traversalData1.value = await Promise.all(brigadeDataPromises.filter(item => item.tableData?.length > 0 || item.improveData?.length > 0 || item.incompData?.length > 0))
554
-
552
+    traversalData1.value = await Promise.all(brigadeDataPromises)
553
+    traversalData1.value = traversalData1.value.filter(item => item.tableData?.length > 0 || item.improveData?.length > 0 || item.incompData?.length > 0)
554
+    console.log(traversalData1.value)
555
+    // debugger
555 556
     if (scoreDistRes.status === 'fulfilled' && scoreDistRes.value.data) {
556 557
       const data = scoreDistRes.value.data
557 558
       if (overallBarChartInstance && Array.isArray(data)) {
@@ -704,7 +705,7 @@ const getList = async () => {
704 705
           pieData: deptPieData.map(p => ({ name: p.assessmentTeam, value: p.count }))
705 706
         }
706 707
       })
707
-
708
+    
708 709
       nextTick(() => {
709 710
         traversalData2.value.forEach((item, index) => {
710 711
           const chartKey = `barChart_${index}`