Pārlūkot izejas kodu

网页端:修改绩效审批,新增绩效打印

余思翰 1 dienu atpakaļ
vecāks
revīzija
9f6e252e0d

+ 96
- 144
oa-ui/src/views/flowable/form/components/print/performancePrint.vue Parādīt failu

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-09-29 17:20:07
3
  * @Date: 2024-09-29 17:20:07
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-09-30 14:51:58
5
+ * @LastEditTime: 2025-06-06 16:27:32
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div>
8
   <div>
9
     <div id="printPerformance">
9
     <div id="printPerformance">
10
-      <table border="1" class="text-center">
10
+      <h2 class="text-center title">绩效统计表</h2>
11
+      <table border="1">
11
         <tr>
12
         <tr>
12
-          <td colspan="7" class="header text-center">
13
-            {{ getDeptName(deptId) }}{{ year }}年{{ month }}月预发绩效表
14
-          </td>
13
+          <td :colspan="1" class="fontbold">上报人</td>
14
+          <td :colspan="4">{{ getUserName(form.reporter) }}</td>
15
+          <td :colspan="1" class="fontbold">上报部门</td>
16
+          <td :colspan="3">{{ getDeptName(form.reportDept) }}</td>
15
         </tr>
17
         </tr>
16
-        <tr class="double-border">
17
-          <td>上报人</td>
18
-          <td>{{ getUserName(form.reporter) }}</td>
19
-          <td>
20
-            上报部门
21
-          </td>
22
-          <td>
23
-            {{ getDeptName(deptId) }}
24
-          </td>
25
-          <td>
26
-            上报时间
27
-          </td>
28
-          <td>
29
-            {{ form.reportTime }}
30
-          </td>
18
+        <tr>
19
+          <td :colspan="1" class="fontbold">上报时间</td>
20
+          <td :colspan="8">{{ form.reportTime }}</td>
31
         </tr>
21
         </tr>
32
         <tr>
22
         <tr>
33
-          <td>序号</td>
34
-          <td>部门</td>
35
-          <td>统计月份</td>
36
-          <td>姓名</td>
37
-          <td>预发绩效(元)</td>
38
-          <td>备注</td>
23
+          <td :colspan="9" class="fontbold">绩效明细</td>
39
         </tr>
24
         </tr>
40
-        <tr v-for="wage, index in wagesList" :key="index">
41
-          <td>
42
-            {{ index + 1 }}
43
-          </td>
44
-          <td>
45
-            {{ getDeptName(wage.deptId) }}
46
-          </td>
47
-          <td>
48
-            {{ (wage.payMonth).slice(0, 7) }}
49
-          </td>
50
-          <td>
51
-            {{ getUserName(wage.userId) }}
52
-          </td>
53
-          <td>
54
-            {{ wage.performanceSalary }}
55
-          </td>
56
-          <td>
57
-            {{ wage.remark }}
25
+        <tr>
26
+          <td :colspan="9">
27
+            <table border="1" style="width:100%;">
28
+              <tr>
29
+                <td style="width:50px;">序号</td>
30
+                <td>姓名</td>
31
+                <td>部门</td>
32
+                <td>生产绩效</td>
33
+                <td>管理绩效</td>
34
+                <td>总绩效</td>
35
+                <td>统计月份</td>
36
+              </tr>
37
+              <tr v-for="(item, index) in performanceTableData" :key="index">
38
+                <td>{{ index + 1 }}</td>
39
+                <td>{{ item.nickName }}</td>
40
+                <td>{{ item.dept.deptName }}</td>
41
+                <td style="text-align: right;">{{ item.producePerformance }}</td>
42
+                <td style="text-align: right;">{{ item.managePerformance }}</td>
43
+                <td style="text-align: right;">{{ (item.producePerformance + item.managePerformance).toFixed(2) }}</td>
44
+                <td>{{ parseTime(item.performanceMonth, '{y}-{m}') }}</td>
45
+              </tr>
46
+              <tr v-if="!performanceTableData || performanceTableData.length === 0">
47
+                <td colspan="7">无</td>
48
+              </tr>
49
+              <tr>
50
+                <td colspan="3">总计</td>
51
+                <td style="text-align: right;">
52
+                  {{ performanceTableData.reduce((acc, curr) => acc + Number(curr.producePerformance), 0).toFixed(2) }}
53
+                </td>
54
+                <td style="text-align: right;">
55
+                  {{ performanceTableData.reduce((acc, curr) => acc + Number(curr.managePerformance), 0).toFixed(2) }}
56
+                </td>
57
+                <td style="text-align: right;">
58
+                  {{ performanceTableData.reduce((acc, curr) => acc + Number(curr.producePerformance) + Number(curr.managePerformance), 0).toFixed(2) }}
59
+                </td>
60
+              </tr>
61
+            </table>
58
           </td>
62
           </td>
59
         </tr>
63
         </tr>
60
         <tr>
64
         <tr>
61
-          <td colspan="4"><b>合计</b></td>
62
-          <td><b>{{ total }}</b></td>
63
-          <td></td>
65
+          <td :colspan="1" class="fontbold">绩效说明</td>
66
+          <td :colspan="8" style="white-space: pre-wrap;">{{ form.remark }}</td>
64
         </tr>
67
         </tr>
65
         <tr>
68
         <tr>
66
           <td :colspan="1" class="fontbold">分管审核意见</td>
69
           <td :colspan="1" class="fontbold">分管审核意见</td>
67
           <td :colspan="3">{{ form.managerComment }}</td>
70
           <td :colspan="3">{{ form.managerComment }}</td>
68
-          <td :colspan="1" style="text-align:left;min-width:120px;">
69
-            签名:<span class="auditor">{{ getUserName(form.managerUserId) }}</span>
70
-          </td>
71
-          <td :colspan="2" style="text-align:left;width:240px;">日期:{{ form.managerTime }}</td>
71
+          <td :colspan="1" class="fontbold">签名</td>
72
+          <td :colspan="2"><span class="auditor">{{ form.managerUser ? form.managerUser.nickName : '' }}</span></td>
73
+          <td :colspan="1" style="min-width:90px;">{{ form.managerTime }}</td>
72
         </tr>
74
         </tr>
73
         <tr>
75
         <tr>
74
           <td :colspan="1" class="fontbold">总经理审批意见</td>
76
           <td :colspan="1" class="fontbold">总经理审批意见</td>
75
           <td :colspan="3">{{ form.zjlComment }}</td>
77
           <td :colspan="3">{{ form.zjlComment }}</td>
76
-          <td :colspan="1" style="text-align:left;min-width:120px;">
77
-            签名:<span class="auditor">{{ getUserName(form.zjlUserId) }}</span>
78
-          </td>
79
-          <td :colspan="2" style="text-align:left;width:240px;">日期:{{ form.zjlTime }}</td>
78
+          <td :colspan="1" class="fontbold">签名</td>
79
+          <td :colspan="2"><span class="auditor">{{ form.zjlUser ? form.zjlUser.nickName : '' }}</span></td>
80
+          <td :colspan="1" style="min-width:90px;">{{ form.zjlTime }}</td>
80
         </tr>
81
         </tr>
81
       </table>
82
       </table>
82
     </div>
83
     </div>
88
 </template>
89
 </template>
89
 
90
 
90
 <script>
91
 <script>
91
-import { listPerformance, getPerformance, addPerformance, updatePerformance, delPerformance } from "@/api/oa/performance/performance"
92
-import { listWage, getWage, addWage, updateWage, delWage } from "@/api/oa/wage/wage"
93
-import { listUser, getUser } from '@/api/system/user'
92
+import { parseTime } from "@/utils/ruoyi";
93
+
94
 export default {
94
 export default {
95
+  name: 'PerformancePrint',
95
   props: {
96
   props: {
96
-    formId: {
97
-      type: String,
97
+    form: {
98
+      type: Object,
99
+      required: true
100
+    },
101
+    performanceTableData: {
102
+      type: Array,
103
+      default: () => []
98
     }
104
     }
99
   },
105
   },
100
   data() {
106
   data() {
101
     return {
107
     return {
102
-      form: {},
103
-      deptId: undefined,
104
-      month: new Date().getMonth() + 1,
105
-      year: new Date().getFullYear(),
106
-      wagesList: [],
107
-      total: 0,
108
       print: {
108
       print: {
109
         id: 'printPerformance',
109
         id: 'printPerformance',
110
-        popTitle: '绩效审批表', // 打印配置页上方标题
111
-        extraHead: '', //最上方的头部文字,附加在head标签上的额外标签,使用逗号分隔
112
-        preview: false, // 是否启动预览模式,默认是false(开启预览模式,可以先预览后打印)
113
-        previewTitle: '', // 打印预览的标题(开启预览模式后出现),
114
-        previewPrintBtnLabel: '', // 打印预览的标题的下方按钮文本,点击可进入打印(开启预览模式后出现)
115
-        zIndex: '', // 预览的窗口的z-index,默认是 20002(此值要高一些,这涉及到预览模式是否显示在最上面)
116
-        previewBeforeOpenCallback() { }, //预览窗口打开之前的callback(开启预览模式调用)
117
-        previewOpenCallback() { }, // 预览窗口打开之后的callback(开启预览模式调用)
118
-        beforeOpenCallback() { }, // 开启打印前的回调事件
119
-        openCallback() { }, // 调用打印之后的回调事件
120
-        closeCallback() { }, //关闭打印的回调事件(无法确定点击的是确认还是取消)
110
+        popTitle: '绩效统计表打印',
111
+        extraHead: '',
112
+        preview: false,
113
+        previewTitle: '',
114
+        previewPrintBtnLabel: '',
115
+        zIndex: '',
116
+        previewBeforeOpenCallback() { },
117
+        previewOpenCallback() { },
118
+        beforeOpenCallback() { },
119
+        openCallback() { },
120
+        closeCallback() { },
121
         url: '',
121
         url: '',
122
         standard: '',
122
         standard: '',
123
         extraCss: ''
123
         extraCss: ''
124
       }
124
       }
125
     }
125
     }
126
   },
126
   },
127
-  created() {
128
-    this.initForm();
129
-    this.initWages();
130
-  },
131
   methods: {
127
   methods: {
132
-    initForm() {
133
-      getPerformance(this.formId).then(res => {
134
-        if (res.data) {
135
-          this.form = res.data;
136
-          this.deptId = res.data.reportDept
137
-        }
138
-      })
128
+    getUserName(userId) {
129
+      const user = this.$store.state.user.userList.find(item => item.userId === userId)
130
+      return user ? user.nickName : ''
139
     },
131
     },
140
-    initWages() {
141
-      const params = { pageSize: 999, performanceId: this.formId };
142
-      listWage(params).then(async res => {
143
-        for (let w of res.rows) {
144
-          let userData = await getUser(w.userId);
145
-          w.deptId = userData.data.deptId;
146
-        }
147
-        this.wagesList = res.rows;
148
-        this.getTotal();
149
-      })
132
+    getDeptName(deptId) {
133
+      const dept = this.$store.state.user.deptList.find(item => item.deptId === deptId)
134
+      return dept ? dept.deptName : ''
150
     },
135
     },
151
-    getTotal() {
152
-      this.total = this.wagesList.reduce((accumulator, currentValue) => {
153
-        return accumulator + currentValue.performanceSalary;
154
-      }, 0);
136
+    getFileName(name) {
137
+      if (name) {
138
+        let arr = name.split('/')
139
+        return arr[arr.length - 1]
140
+      }
141
+      return ''
155
     },
142
     },
156
-  },
143
+    parseTime
144
+  }
157
 }
145
 }
158
 </script>
146
 </script>
159
 
147
 
160
 <style lang="scss" scoped>
148
 <style lang="scss" scoped>
161
 table {
149
 table {
162
-  /*边框*/
163
-  /* border: 1px solid black; */
164
   width: 90%;
150
   width: 90%;
165
-  // text-align: center;
151
+  text-align: left;
166
   border-collapse: collapse;
152
   border-collapse: collapse;
167
   margin: 0 auto;
153
   margin: 0 auto;
154
+  border: 1px solid #a5abb0;
168
 
155
 
169
-  /*设置背景颜色*/
170
-  /* background-color: #bfa; */
171
   td {
156
   td {
172
-    padding: 5px;
173
-    // line-height: 30px;
157
+    padding: 15px;
174
   }
158
   }
175
 }
159
 }
176
 
160
 
177
-.header {
178
-  font-family: '黑体';
179
-  font-size: 16px;
180
-  font-weight: bold;
181
-  line-height: 30px;
182
-}
183
-
184
-.bg {
185
-  background-color: #eee;
186
-  -webkit-print-color-adjust: exact;
187
-}
188
-
189
 .title {
161
 .title {
190
   font-family: '黑体';
162
   font-family: '黑体';
191
   font-size: 20px;
163
   font-size: 20px;
195
 
167
 
196
 .fontbold {
168
 .fontbold {
197
   font-weight: bold;
169
   font-weight: bold;
198
-  min-width: 150px;
170
+  min-width: 100px;
199
   text-align: center;
171
   text-align: center;
200
 }
172
 }
201
 
173
 
202
-.conment-width {
203
-  // max-width: 200px;
204
-}
205
-
206
-
207
 @page {
174
 @page {
208
   size: auto;
175
   size: auto;
209
-  /* 去除页脚 */
210
   margin-bottom: 0;
176
   margin-bottom: 0;
211
-  // 横向A4
212
-  // size:A4 landscape;
213
 }
177
 }
214
 
178
 
215
 @media print {
179
 @media print {
216
-  #print table {
180
+  #printPerformance table {
217
     width: 100%;
181
     width: 100%;
218
   }
182
   }
219
 }
183
 }
220
-
221
-.double-border {
222
-  // border-top: 3px double black;
223
-  /* 双横线 */
224
-  border-bottom: 3px double black;
225
-  /* 双横线 */
226
-}
227
-
228
-.empty-row {
229
-  height: 9px;
230
-  /* 设置行高 */
231
-}
232
 </style>
184
 </style>

+ 289
- 23
oa-ui/src/views/flowable/form/performance/performanceForm.vue Parādīt failu

1
 <template>
1
 <template>
2
   <div class="app-container">
2
   <div class="app-container">
3
     <el-row :gutter="20">
3
     <el-row :gutter="20">
4
+      <div class="mb20" v-if="showAlter">
5
+        <el-alert title="任务被退回,请修改后重新提交" type="error" :closable="false">
6
+          <return-comment :taskForm="taskForm" @isReturn="isReturn"></return-comment>
7
+        </el-alert>
8
+      </div>
4
       <h2 style="text-align: center;">绩效审批表</h2>
9
       <h2 style="text-align: center;">绩效审批表</h2>
5
-      <el-form ref="form" :model="form" :rules="rules" :disabled="taskName == ''">
10
+      <el-form ref="form" :model="form" :rules="rules">
6
         <el-row :gutter="20">
11
         <el-row :gutter="20">
7
           <el-col :span="7" :xs="24">
12
           <el-col :span="7" :xs="24">
8
             <el-form-item label="上报人:" prop="reporter" label-width="100px">
13
             <el-form-item label="上报人:" prop="reporter" label-width="100px">
20
             </el-form-item>
25
             </el-form-item>
21
           </el-col>
26
           </el-col>
22
         </el-row>
27
         </el-row>
23
-        <div>
28
+        <div v-if="taskName == '绩效上报'">
24
           <el-button type="primary" size="small" icon="el-icon-upload" @click="upload.open = true">上传绩效表</el-button>
29
           <el-button type="primary" size="small" icon="el-icon-upload" @click="upload.open = true">上传绩效表</el-button>
25
           <div
30
           <div
26
             style="background-color: #f0f9eb; border: 1px solid #c2e7b0; padding: 10px; border-radius: 5px;margin-top: 10px;">
31
             style="background-color: #f0f9eb; border: 1px solid #c2e7b0; padding: 10px; border-radius: 5px;margin-top: 10px;">
123
         </el-table>
128
         </el-table>
124
         <pagination v-show="outerTotal > 0" :total="outerTotal" :page.sync="outerParams.pageNum"
129
         <pagination v-show="outerTotal > 0" :total="outerTotal" :page.sync="outerParams.pageNum"
125
           :limit.sync="outerParams.pageSize" @pagination="getOuterTableData" />
130
           :limit.sync="outerParams.pageSize" @pagination="getOuterTableData" />
126
-        <div class="table-title">绩效统计表</div>
127
-        <el-table :data="performanceTableData" style="width: 100%">
128
-          <el-table-column prop="nickName" label="姓名" />
131
+        <div class="table-title">
132
+          绩效统计表
133
+          <el-button type="success" size="small" icon="el-icon-printer" @click="printPerformanceTable"
134
+            style="margin-left: 20px;">
135
+            打印
136
+          </el-button>
137
+        </div>
138
+        <el-table :data="groupedPerformanceData" style="width: 100%" class="mb20" row-class-name="table-row-class">
139
+          <el-table-column type="index" label="序号" width="50">
140
+            <template slot-scope="scope">
141
+              <span v-if="!scope.row.isSummary">{{ scope.$index + 1 }}</span>
142
+            </template>
143
+          </el-table-column>
144
+          <el-table-column prop="nickName" label="姓名">
145
+            <template slot-scope="scope">
146
+              <span v-if="!scope.row.isSummary">{{ scope.row.nickName }}</span>
147
+              <span v-else class="summary-text">{{ scope.row['dept.deptName'] }}部门总计</span>
148
+            </template>
149
+          </el-table-column>
129
           <el-table-column prop="dept.deptName" label="部门" />
150
           <el-table-column prop="dept.deptName" label="部门" />
130
-          <el-table-column prop="producePerformance" label="生产绩效" />
131
-          <el-table-column prop="managePerformance" label="管理绩效" />
151
+          <el-table-column prop="producePerformance" label="生产绩效" sortable>
152
+            <template slot-scope="scope">
153
+              <span :class="{ 'summary-text': scope.row.isSummary }">
154
+                {{ scope.row.isSummary ? Number(scope.row.producePerformance).toFixed(2) : scope.row.producePerformance }}
155
+              </span>
156
+            </template>
157
+          </el-table-column>
158
+          <el-table-column prop="managePerformance" label="管理绩效" sortable>
159
+            <template slot-scope="scope">
160
+              <span :class="{ 'summary-text': scope.row.isSummary }">
161
+                {{ scope.row.isSummary ? Number(scope.row.managePerformance).toFixed(2) : scope.row.managePerformance }}
162
+              </span>
163
+            </template>
164
+          </el-table-column>
165
+          <el-table-column label="总绩效" width="100" sortable>
166
+            <template slot-scope="scope">
167
+              <span :class="{ 'summary-text': scope.row.isSummary }">
168
+                {{ (Number(scope.row.producePerformance) + Number(scope.row.managePerformance)).toFixed(2) }}
169
+              </span>
170
+            </template>
171
+          </el-table-column>
132
           <el-table-column prop="performanceMonth" label="统计月份">
172
           <el-table-column prop="performanceMonth" label="统计月份">
133
             <template slot-scope="scope">
173
             <template slot-scope="scope">
134
-              {{ parseTime(scope.row.performanceMonth, '{y}-{m}') }}
174
+              <span v-if="!scope.row.isSummary">{{ parseTime(scope.row.performanceMonth, '{y}-{m}') }}</span>
135
             </template>
175
             </template>
136
           </el-table-column>
176
           </el-table-column>
137
         </el-table>
177
         </el-table>
138
-        <el-form-item label="附件上传:" prop="document" label-width="100px">
139
-          <FileUpload v-if="!form.document" ref="orz" :limit="1" :isShowTip="false"
178
+
179
+
180
+        <el-form-item label="附件上传:" prop="document" label-width="130px">
181
+          <FileUpload v-if="taskName == '绩效上报' && !form.document" ref="orz" :limit="1" :isShowTip="false"
140
             :filePathName="'绩效审批/' + parseTime(new Date(), '{y}-{m}-{d}-{h}-{i}-{s}')"
182
             :filePathName="'绩效审批/' + parseTime(new Date(), '{y}-{m}-{d}-{h}-{i}-{s}')"
141
             :fileType="['doc', 'docx', 'xls', 'xlsx', 'pdf', 'rar', 'zip']" @input="setDocument">
183
             :fileType="['doc', 'docx', 'xls', 'xlsx', 'pdf', 'rar', 'zip']" @input="setDocument">
142
           </FileUpload>
184
           </FileUpload>
150
             </el-link>
192
             </el-link>
151
             <span class="el-icon-delete del-file" @click="deleteDoc" v-if="taskName == '绩效上报'">删除文件</span>
193
             <span class="el-icon-delete del-file" @click="deleteDoc" v-if="taskName == '绩效上报'">删除文件</span>
152
           </div>
194
           </div>
195
+          <div v-else>
196
+            暂无附件
197
+          </div>
153
         </el-form-item>
198
         </el-form-item>
154
-        <el-form-item label="绩效说明:" prop="remark" label-width="100px">
155
-          <el-input type="textarea" v-model="form.remark" :autosize="{ minRows: 4 }" />
199
+        <el-form-item label="绩效说明:" prop="remark" label-width="130px">
200
+          <el-input :disabled="taskName != '绩效上报'" type="textarea" v-model="form.remark" :autosize="{ minRows: 4 }" />
201
+        </el-form-item>
202
+        <el-form-item label="分管审核意见:" prop="managerComment" label-width="130px">
203
+          <el-input type="textarea" v-model="form.managerComment" :autosize="{ minRows: 4 }"
204
+            :disabled="taskName != '分管审核'"></el-input>
205
+          <div class="sign mt10" v-if="form.managerUserId">
206
+            <div class="mr20">签名:<span class="auditor">{{ getUserName(form.managerUserId) }}</span>
207
+            </div>
208
+            <div class="ml20"><span>审核时间:{{ form.managerTime }}</span></div>
209
+          </div>
210
+        </el-form-item>
211
+        <el-form-item label="总经理审批意见:" prop="zjlComment" label-width="130px">
212
+          <el-input type="textarea" v-model="form.zjlComment" :autosize="{ minRows: 4 }"
213
+            :disabled="taskName != '总经理审批'"></el-input>
214
+          <div class="sign mt10" v-if="form.zjlUserId">
215
+            <div class="mr20">签名:<span class="auditor">{{ getUserName(form.zjlUserId) }}</span>
216
+            </div>
217
+            <div class="ml20"><span>审核时间:{{ form.zjlTime }}</span></div>
218
+          </div>
219
+        </el-form-item>
220
+        <el-form-item label="人事制单:" label-width="130px" v-if="taskName == '人事制单'">
221
+          <el-button type="success" icon="el-icon-printer" @click="printPerformanceTable">打印</el-button>
156
         </el-form-item>
222
         </el-form-item>
157
       </el-form>
223
       </el-form>
158
       <el-row style="text-align: center;" v-if="taskName != ''">
224
       <el-row style="text-align: center;" v-if="taskName != ''">
159
         <el-button type="danger" @click="returnOpen = true" v-show="taskName != '绩效上报'">退 回</el-button>
225
         <el-button type="danger" @click="returnOpen = true" v-show="taskName != '绩效上报'">退 回</el-button>
160
         <el-button type="warning" @click="saves()">保存</el-button>
226
         <el-button type="warning" @click="saves()">保存</el-button>
161
-        <el-button type="primary" @click="completeApply()">提交</el-button>
227
+        <el-button type="primary" @click="completeApply()">{{ taskName == '绩效上报' ? '提交绩效表' : '完成审批' }}</el-button>
162
       </el-row>
228
       </el-row>
163
     </el-row>
229
     </el-row>
164
     <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
230
     <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
200
         <el-button type="primary" @click="submitEdit">确定</el-button>
266
         <el-button type="primary" @click="submitEdit">确定</el-button>
201
       </div>
267
       </div>
202
     </el-dialog>
268
     </el-dialog>
269
+    <el-dialog title="打印绩效统计表" :visible.sync="printDialogVisible" width="800px" append-to-body>
270
+      <performance-print :form="form" :performanceTableData="performanceTableData"
271
+        @cancel="printDialogVisible = false" />
272
+    </el-dialog>
273
+    <el-dialog title="退回" :visible.sync="returnOpen" width="40%" append-to-body>
274
+      <return-btn :taskForm="taskForm" @goBack="$emit('goBack')" @saves="" @cancel="returnOpen = false"></return-btn>
275
+    </el-dialog>
203
   </div>
276
   </div>
204
 </template>
277
 </template>
205
 
278
 
208
 import { complete, rejectTask, returnList, returnTask, getNextFlowNode, delegate, flowTaskForm, } from "@/api/flowable/todo";
281
 import { complete, rejectTask, returnList, returnTask, getNextFlowNode, delegate, flowTaskForm, } from "@/api/flowable/todo";
209
 import { listPerformance, getPerformance, addPerformance, updatePerformance, delPerformance } from "@/api/oa/performance/performance"
282
 import { listPerformance, getPerformance, addPerformance, updatePerformance, delPerformance } from "@/api/oa/performance/performance"
210
 import { listPerformanceStaff, getPerformanceStaff, updatePerformanceStaff, getMonthPerformanceList } from "@/api/oa/performance/performanceStaff";
283
 import { listPerformanceStaff, getPerformanceStaff, updatePerformanceStaff, getMonthPerformanceList } from "@/api/oa/performance/performanceStaff";
284
+import { getUsersDeptLeaderByDept, getUsersManageLeaderByDept, getUserByPost } from '@/api/system/post'
211
 import { listProject } from "@/api/oa/project/project";
285
 import { listProject } from "@/api/oa/project/project";
286
+import { getUserByRole } from "@/api/system/role";
212
 import { getToken } from "@/utils/auth";
287
 import { getToken } from "@/utils/auth";
288
+import PerformancePrint from '../components/print/performancePrint.vue';
289
+import returnBtn from '@/views/flowable/form/components/flowBtn/returnBtn.vue';
290
+import ReturnComment from '@/views/flowable/form/components/flowBtn/returnComment.vue';
213
 
291
 
214
 export default {
292
 export default {
293
+  components: {
294
+    PerformancePrint, returnBtn, ReturnComment
295
+  },
215
   props: {
296
   props: {
216
     taskName: {
297
     taskName: {
217
       type: String,
298
       type: String,
227
       baseUrl: process.env.VUE_APP_BASE_API,
308
       baseUrl: process.env.VUE_APP_BASE_API,
228
       flowData: {},
309
       flowData: {},
229
       form: {},
310
       form: {},
230
-      rules: {},
231
-      showAlter: false,
311
+      rules: {
312
+        managerComment: [
313
+          { required: this.taskName == '分管审核', message: '请填写分管领导意见', trigger: 'blur' }
314
+        ],
315
+        zjlComment: [
316
+          { required: this.taskName == '总经理审批', message: '请填写总经理审批意见', trigger: 'blur' }
317
+        ]
318
+      },
319
+      printDialogVisible: false,
232
       upload: {
320
       upload: {
233
         open: false,
321
         open: false,
234
         title: "上传绩效表",
322
         title: "上传绩效表",
262
       editRow: {},
350
       editRow: {},
263
       editType: '', // 'inner' or 'outer'
351
       editType: '', // 'inner' or 'outer'
264
       formTotal: 0,
352
       formTotal: 0,
353
+      returnOpen: false,
354
+      showAlter: true,
355
+      groupedPerformanceData: [],
265
     }
356
     }
266
   },
357
   },
267
   created() {
358
   created() {
268
     this.initForm();
359
     this.initForm();
269
   },
360
   },
270
   methods: {
361
   methods: {
271
-    initForm() {
362
+    async initForm() {
272
       const formId = this.taskForm.formId;
363
       const formId = this.taskForm.formId;
273
       if (this.taskName == '绩效上报') {
364
       if (this.taskName == '绩效上报') {
274
         this.form.reporter = this.$store.getters.userId;
365
         this.form.reporter = this.$store.getters.userId;
275
         this.form.reportDept = this.$store.getters.deptId;
366
         this.form.reportDept = this.$store.getters.deptId;
276
         this.form.reportTime = parseTime(new Date(), "{y}-{m}-{d}")
367
         this.form.reportTime = parseTime(new Date(), "{y}-{m}-{d}")
277
       }
368
       }
278
-      getPerformance(formId).then(res => {
279
-        if (res.data) {
280
-          this.formTotal = 1
281
-          this.form = res.data;
282
-        }
283
-      })
369
+      let res = await getPerformance(formId)
370
+      if (res.data) {
371
+        this.formTotal = 1
372
+        this.form = res.data;
373
+      }
284
       this.getInnerTableData();
374
       this.getInnerTableData();
285
       this.getOuterTableData();
375
       this.getOuterTableData();
286
       this.getTotalPerformance();
376
       this.getTotalPerformance();
319
         deptId = this.form.reportDept;
409
         deptId = this.form.reportDept;
320
       }
410
       }
321
       getMonthPerformanceList({ performanceId: this.taskForm.formId, deptId: deptId }).then(res => {
411
       getMonthPerformanceList({ performanceId: this.taskForm.formId, deptId: deptId }).then(res => {
322
-        console.log(res);
323
         this.performanceTableData = res.data;
412
         this.performanceTableData = res.data;
413
+        this.processGroupedData();
324
       })
414
       })
325
     },
415
     },
416
+    processGroupedData() {
417
+      // 按部门分组
418
+      const groupedByDept = {};
419
+      this.performanceTableData.forEach(item => {
420
+        const deptName = item.dept?.deptName || '未分配部门';
421
+        if (!groupedByDept[deptName]) {
422
+          groupedByDept[deptName] = [];
423
+        }
424
+        groupedByDept[deptName].push(item);
425
+      });
426
+
427
+      // 转换为数组并添加部门汇总行
428
+      this.groupedPerformanceData = [];
429
+      Object.entries(groupedByDept).forEach(([deptName, items]) => {
430
+        // 添加部门数据行
431
+        this.groupedPerformanceData.push(...items);
432
+        
433
+        // 计算部门汇总
434
+        const deptSummary = {
435
+          isSummary: true,
436
+          'dept.deptName': deptName,
437
+          producePerformance: items.reduce((sum, item) => sum + (Number(item.producePerformance) || 0), 0),
438
+          managePerformance: items.reduce((sum, item) => sum + (Number(item.managePerformance) || 0), 0)
439
+        };
440
+        this.groupedPerformanceData.push(deptSummary);
441
+      });
442
+    },
443
+    getSummaries(param) {
444
+      const { columns, data } = param;
445
+      const sums = [];
446
+      columns.forEach((column, index) => {
447
+        if (index === 0) {
448
+          sums[index] = '总计';
449
+          return;
450
+        }
451
+        if (index === 1 || index === 2) {
452
+          sums[index] = '';
453
+          return;
454
+        }
455
+        if (index === 5) { // 总计列
456
+          const produceSum = data.reduce((sum, row) => sum + (Number(row.producePerformance) || 0), 0);
457
+          const manageSum = data.reduce((sum, row) => sum + (Number(row.managePerformance) || 0), 0);
458
+          sums[index] = (produceSum + manageSum).toFixed(2);
459
+          return;
460
+        }
461
+        if (index === 6) { // 统计月份列
462
+          sums[index] = '';
463
+          return;
464
+        }
465
+        const values = data.map(item => Number(item[column.property]));
466
+        if (!values.every(value => isNaN(value))) {
467
+          sums[index] = values.reduce((prev, curr) => {
468
+            const value = Number(curr);
469
+            if (!isNaN(value)) {
470
+              return prev + curr;
471
+            } else {
472
+              return prev;
473
+            }
474
+          }, 0).toFixed(2);
475
+        } else {
476
+          sums[index] = '';
477
+        }
478
+      });
479
+      return sums;
480
+    },
326
     remoteMethod(val) {
481
     remoteMethod(val) {
327
       let params = {
482
       let params = {
328
         pageNum: 1,
483
         pageNum: 1,
367
       this.$refs["uploadRef"].clearFiles();
522
       this.$refs["uploadRef"].clearFiles();
368
       this.getInnerTableData();
523
       this.getInnerTableData();
369
       this.getOuterTableData();
524
       this.getOuterTableData();
525
+      this.getTotalPerformance();
370
     },
526
     },
371
     /* Excel上传提交按钮 */
527
     /* Excel上传提交按钮 */
372
     submitUpload() {
528
     submitUpload() {
409
     },
565
     },
410
     async saves() {
566
     async saves() {
411
       if (this.formTotal != 0) {
567
       if (this.formTotal != 0) {
568
+        if (this.taskName == '分管审核') {
569
+          this.form.managerUserId = this.$store.getters.userId;
570
+          this.form.managerTime = this.parseTime(new Date(), '{y}-{m}-{d}');
571
+        } else if (this.taskName == '总经理审批') {
572
+          this.form.zjlUserId = this.$store.getters.userId;
573
+          this.form.zjlTime = this.parseTime(new Date(), '{y}-{m}-{d}');
574
+        }
412
         await updatePerformance(this.form)
575
         await updatePerformance(this.form)
413
       } else {
576
       } else {
414
         this.form.performanceId = this.taskForm.formId;
577
         this.form.performanceId = this.taskForm.formId;
417
       }
580
       }
418
       this.$message.success('保存成功')
581
       this.$message.success('保存成功')
419
     },
582
     },
583
+    completeApply() {
584
+      let msg;
585
+      if (this.taskName == '人事制单') {
586
+        msg = '最后一个节点,提交将结束流程,是否提交?'
587
+      } else {
588
+        msg = '是否提交到下一个流程?'
589
+      }
590
+      this.$modal.confirm(msg).then(res => {
591
+        this.$refs['form'].validate(valid => {
592
+          if (valid) {
593
+            this.saves();
594
+            getNextFlowNode({ taskId: this.taskForm.taskId }).then(async () => {
595
+              if (this.taskName == '绩效上报') {
596
+                let result = await getUsersManageLeaderByDept({ deptId: this.form.reportDept });
597
+                const managerList = result.data.map(element => element.userId);
598
+                this.$set(this.taskForm.variables, "approvalList", managerList);
599
+                this.successComplete();
600
+              } else if (this.taskName == '分管审核') {
601
+                let result = await getUserByPost({ postName: '总经理' })
602
+                this.$set(this.taskForm.variables, "approval", result.data[0].userId);
603
+                this.successComplete();
604
+              } else if (this.taskName == '总经理审批') {
605
+                let result = await getUserByRole({ roleId: 3 })
606
+                this.$set(this.taskForm.variables, "approvalList", result.data);
607
+                this.successComplete();
608
+              } else if (this.taskName == '人事制单') {
609
+                this.$modal.confirm('最后一个节点,提交将结束流程,是否提交?').then(res => {
610
+                  this.successComplete();
611
+                })
612
+              }
613
+            })
614
+          } else {
615
+            scrollTo(0, 600)
616
+          }
617
+        })
618
+      })
619
+    },
620
+    successComplete() {
621
+      complete(this.taskForm).then(response => {
622
+        this.$modal.msgSuccess(response.msg);
623
+        this.$emit('goBack')
624
+      })
625
+    },
420
     setDocument(val) {
626
     setDocument(val) {
421
       let arr = val.split('/upload')
627
       let arr = val.split('/upload')
422
       this.$set(this.form, 'document', arr[1])
628
       this.$set(this.form, 'document', arr[1])
424
         this.$set(this.form, 'document', "")
630
         this.$set(this.form, 'document', "")
425
       }
631
       }
426
     },
632
     },
633
+    deleteDoc() {
634
+      this.$set(this.form, 'document', '')
635
+    },
636
+    isReturn(val) {
637
+      this.showAlter = val
638
+    },
639
+    printPerformanceTable() {
640
+      this.printDialogVisible = true;
641
+    },
427
   }
642
   }
428
 }
643
 }
429
 </script>
644
 </script>
430
 
645
 
431
 <style lang="scss" scoped>
646
 <style lang="scss" scoped>
647
+@import "@/assets/styles/element-reset.scss";
648
+
432
 .table-title {
649
 .table-title {
433
   font-size: 18px;
650
   font-size: 18px;
434
   font-weight: 700;
651
   font-weight: 700;
446
 .table-search-bar {
663
 .table-search-bar {
447
   margin-bottom: 10px;
664
   margin-bottom: 10px;
448
 }
665
 }
666
+
667
+.sign {
668
+  display: flex;
669
+  justify-content: flex-end;
670
+  align-items: center;
671
+  padding-right: 80px;
672
+  line-height: 30px;
673
+  /* 如果需要垂直居中 */
674
+}
675
+
676
+:deep(.table-row-class) {
677
+  &.summary-row {
678
+    background-color: #f0f9eb;
679
+    color: #67c23a;
680
+    font-weight: bold;
681
+    
682
+    td {
683
+      background-color: #f0f9eb !important;
684
+      border-bottom: 2px solid #67c23a;
685
+    }
686
+  }
687
+}
688
+
689
+:deep(.el-table__row) {
690
+  &.summary-row {
691
+    background-color: #f0f9eb;
692
+    
693
+    td {
694
+      background-color: #f0f9eb !important;
695
+      color: #67c23a;
696
+      font-weight: bold;
697
+      border-bottom: 2px solid #67c23a;
698
+    }
699
+  }
700
+}
701
+
702
+.summary-text {
703
+  font-weight: bold;
704
+  font-size: 15px;
705
+}
706
+
707
+:deep(.el-table__row.summary-row) {
708
+  background-color: #f0f9eb;
709
+  
710
+  td {
711
+    background-color: #f0f9eb !important;
712
+    border-bottom: 2px solid #67c23a;
713
+  }
714
+}
449
 </style>
715
 </style>

Notiek ielāde…
Atcelt
Saglabāt