Просмотр исходного кода

设置流程跳过条件,修改借款审批

余思翰 11 месяцев назад
Родитель
Сommit
b95c0d1bf5

+ 21
- 0
oa-back/ruoyi-flowable/src/main/java/com/ruoyi/flowable/listener/FlowSkipListener.java Просмотреть файл

1
+package com.ruoyi.flowable.listener;
2
+
3
+import org.flowable.engine.delegate.DelegateExecution;
4
+import org.flowable.engine.delegate.ExecutionListener;
5
+import org.springframework.stereotype.Component;
6
+
7
+/**
8
+ * 自动跳过流程任务监听
9
+ * @author cmc
10
+ * @date 2023-02-18
11
+ */
12
+
13
+@Component
14
+public class FlowSkipListener implements ExecutionListener {
15
+    @Override
16
+    public void notify(DelegateExecution execution) {
17
+        //通过设置流程变量_FLOWABLE_SKIP_EXPRESSION_ENABLED为true启动skipExpression属性,
18
+        //必须是true而非字符串"true",若不启动是不生效的
19
+        execution.setVariable("_FLOWABLE_SKIP_EXPRESSION_ENABLED",true);
20
+    }
21
+}

+ 2
- 2
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcBudgetMapper.xml Просмотреть файл

62
     <sql id="selectCmcBudgetVo">
62
     <sql id="selectCmcBudgetVo">
63
         select b.budget_id, b.project_id, p.project_number, p.project_name, b.staff_cost, b.car_cost, b.device_cost, b.fix_cost, b.settle_expense, b.out_expense, b.business_expense, b.tax_expense,
63
         select b.budget_id, b.project_id, p.project_number, p.project_name, b.staff_cost, b.car_cost, b.device_cost, b.fix_cost, b.settle_expense, b.out_expense, b.business_expense, b.tax_expense,
64
                b.rent_expense, b.other_expense, b.out_remark, b.business_remark, b.tax_remark, b.rent_remark, b.other_remark, b.direct_expense, b.total_budget, b.compiler,
64
                b.rent_expense, b.other_expense, b.out_remark, b.business_remark, b.tax_remark, b.rent_remark, b.other_remark, b.direct_expense, b.total_budget, b.compiler,
65
-               u.nick_name as compiler_nick_name, b.auditor, u1.nick_name as auditor_nick_name, b.appover, u2.nick_name as appover_nick_name, b.create_time, b.audit_time, b.approve_time,
65
+               u.nick_name as compiler_nick_name, b.auditor, u1.nick_name as auditor_nick_name, b.approver, u2.nick_name as approver_nick_name, b.create_time, b.audit_time, b.approve_time,
66
                b.audit_comment, b.approve_comment from cmc_budget as b
66
                b.audit_comment, b.approve_comment from cmc_budget as b
67
             left join sys_user as u on u.user_id = b.compiler
67
             left join sys_user as u on u.user_id = b.compiler
68
             left join sys_user as u1 on u1.user_id = b.auditor
68
             left join sys_user as u1 on u1.user_id = b.auditor
69
-            left join sys_user as u2 on u2.user_id = b.appover
69
+            left join sys_user as u2 on u2.user_id = b.approver
70
             left join cmc_project as p on b.project_id = p.project_id
70
             left join cmc_project as p on b.project_id = p.project_id
71
     </sql>
71
     </sql>
72
 
72
 

+ 7
- 3
oa-ui/src/main.js Просмотреть файл

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-01-03 09:23:11
3
  * @Date: 2024-01-03 09:23:11
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-07-08 10:58:08
5
+ * @LastEditTime: 2024-07-10 11:08:03
6
  */
6
  */
7
 import Vue from 'vue'
7
 import Vue from 'vue'
8
 
8
 
24
 import './permission' // permission control
24
 import './permission' // permission control
25
 import { getDicts } from "@/api/system/dict/data";
25
 import { getDicts } from "@/api/system/dict/data";
26
 import { getConfigKey } from "@/api/system/config";
26
 import { getConfigKey } from "@/api/system/config";
27
-import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, 
28
-  handleTree, getUserName, getFileName, reviewWord,getDeptName,getUserNames,getDeptNames } from "@/utils/ruoyi";
27
+import {
28
+  parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels,
29
+  handleTree, getUserName, getFileName, reviewWord, getDeptName, getUserNames, getDeptNames,
30
+  formatNumberWithWan
31
+} from "@/utils/ruoyi";
29
 // 标题组件
32
 // 标题组件
30
 import RowTitle from '@/components/RowTitle'
33
 import RowTitle from '@/components/RowTitle'
31
 
34
 
71
 Vue.prototype.getDeptName = getDeptName
74
 Vue.prototype.getDeptName = getDeptName
72
 Vue.prototype.getFileName = getFileName
75
 Vue.prototype.getFileName = getFileName
73
 Vue.prototype.reviewWord = reviewWord
76
 Vue.prototype.reviewWord = reviewWord
77
+Vue.prototype.formatNumberWithWan = formatNumberWithWan
74
 // 全局组件挂载
78
 // 全局组件挂载
75
 Vue.component('DictTag', DictTag)
79
 Vue.component('DictTag', DictTag)
76
 Vue.component('Pagination', Pagination)
80
 Vue.component('Pagination', Pagination)

+ 32
- 0
oa-ui/src/utils/ruoyi.js Просмотреть файл

232
   return data.type !== 'application/json'
232
   return data.type !== 'application/json'
233
 }
233
 }
234
 
234
 
235
+// ——————————————————————————————————————CMC封装方法————————————————————————————————————————————————————
235
 export function setArray(arr) {
236
 export function setArray(arr) {
236
   if (arr != [] && arr != undefined) {
237
   if (arr != [] && arr != undefined) {
237
     let datalist = [...new Set(arr)];
238
     let datalist = [...new Set(arr)];
307
       url: url
308
       url: url
308
     }
309
     }
309
   })
310
   })
311
+}
312
+
313
+export function formatNumberWithWan(num) {
314
+  const fraction = ['角', '分'];
315
+  const digit = [
316
+    '零', '壹', '贰', '叁', '肆',
317
+    '伍', '陆', '柒', '捌', '玖'
318
+  ];
319
+  const unit = [
320
+    ['元', '万', '亿'],
321
+    ['', '拾', '佰', '仟']
322
+  ];
323
+  let head = num < 0 ? '欠' : '';
324
+  num = Math.abs(num);
325
+
326
+  let s = '';
327
+  for (let i = 0; i < fraction.length; i++) {
328
+    s += (digit[Math.floor(num * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
329
+  }
330
+  s = s || '整';
331
+  num = Math.floor(num);
332
+
333
+  for (let i = 0; i < unit[0].length && num > 0; i++) {
334
+    let p = '';
335
+    for (let j = 0; j < unit[1].length && num > 0; j++) {
336
+      p = digit[num % 10] + unit[1][j] + p;
337
+      num = Math.floor(num / 10);
338
+    }
339
+    s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
340
+  }
341
+  return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整');
310
 }
342
 }

+ 4
- 4
oa-ui/src/views/flowable/form/business/contractForm.vue Просмотреть файл

1
 <!--
1
 <!--
2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-05-10 15:31:57
3
  * @Date: 2024-05-10 15:31:57
4
- * @LastEditors: wrh
5
- * @LastEditTime: 2024-07-09 13:44:30
4
+ * @LastEditors: Please set LastEditors
5
+ * @LastEditTime: 2024-07-09 17:42:01
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div class="app-container">
8
   <div class="app-container">
90
             </div>
90
             </div>
91
           </el-form-item>
91
           </el-form-item>
92
           <el-form-item label="合同计划工作量:">
92
           <el-form-item label="合同计划工作量:">
93
-            <table border="1">
93
+            <table border="1" style="width:100%">
94
               <tr>
94
               <tr>
95
                 <td style="width: 50px;">序号</td>
95
                 <td style="width: 50px;">序号</td>
96
                 <td style="width:180px">工作内容</td>
96
                 <td style="width:180px">工作内容</td>
143
               :disabled="taskName != '合同拟稿'"></el-button>
143
               :disabled="taskName != '合同拟稿'"></el-button>
144
           </el-form-item>
144
           </el-form-item>
145
           <el-form-item label="合同回款计划:">
145
           <el-form-item label="合同回款计划:">
146
-            <table border="1">
146
+            <table border="1" style="width:100%">
147
               <tr>
147
               <tr>
148
                 <td style="width: 50px;">序号</td>
148
                 <td style="width: 50px;">序号</td>
149
                 <td style="width: 250px;">回款条件</td>
149
                 <td style="width: 250px;">回款条件</td>

+ 133
- 164
oa-ui/src/views/flowable/form/finance/borrowForm.vue Просмотреть файл

4
       <el-col :span="flowDisabled ? 18 : 24" :xs="24">
4
       <el-col :span="flowDisabled ? 18 : 24" :xs="24">
5
         <h2 class="text-center">借款申请</h2>
5
         <h2 class="text-center">借款申请</h2>
6
         <el-divider></el-divider>
6
         <el-divider></el-divider>
7
-        <el-form ref="form" :model="form" :rules="rules" label-width="125px">
7
+        <el-form ref="form" :model="form" :rules="rules" label-width="150px">
8
           <el-row :gutter="20">
8
           <el-row :gutter="20">
9
             <el-col :span="6" :xs="24">
9
             <el-col :span="6" :xs="24">
10
               <el-form-item label="申请人" prop="user.nickName">
10
               <el-form-item label="申请人" prop="user.nickName">
44
                 :value="item.projectId">
44
                 :value="item.projectId">
45
               </el-option>
45
               </el-option>
46
             </el-select> -->
46
             </el-select> -->
47
-            <el-descriptions border v-if="isSelect" style="margin-top: 10px;" :column="1">
47
+            <el-descriptions border v-if="isSelect" style="margin-top: .125rem;" :column="1">
48
               <el-descriptions-item label="项目编号" label-class-name="my-label">{{ chooseProject.projectNumber
48
               <el-descriptions-item label="项目编号" label-class-name="my-label">{{ chooseProject.projectNumber
49
-              }}</el-descriptions-item>
49
+                }}</el-descriptions-item>
50
               <el-descriptions-item label="项目名称" label-class-name="my-label">{{ chooseProject.projectName
50
               <el-descriptions-item label="项目名称" label-class-name="my-label">{{ chooseProject.projectName
51
-              }}</el-descriptions-item>
51
+                }}</el-descriptions-item>
52
               <el-descriptions-item label="项目负责人" label-class-name="my-label">{{ chooseProject.projectLeaderUser ?
52
               <el-descriptions-item label="项目负责人" label-class-name="my-label">{{ chooseProject.projectLeaderUser ?
53
-                chooseProject.projectLeaderUser.nickName : ''
54
-              }}</el-descriptions-item>
53
+    chooseProject.projectLeaderUser.nickName : ''
54
+                }}</el-descriptions-item>
55
               <el-descriptions-item label="承担部门" label-class-name="my-label">
55
               <el-descriptions-item label="承担部门" label-class-name="my-label">
56
                 <el-tag size="small">{{ chooseProject.undertakingDeptName }}</el-tag>
56
                 <el-tag size="small">{{ chooseProject.undertakingDeptName }}</el-tag>
57
               </el-descriptions-item>
57
               </el-descriptions-item>
58
               <el-descriptions-item label="项目类型" label-class-name="my-label">{{ chooseProject.projectType
58
               <el-descriptions-item label="项目类型" label-class-name="my-label">{{ chooseProject.projectType
59
-              }}</el-descriptions-item>
59
+                }}</el-descriptions-item>
60
             </el-descriptions>
60
             </el-descriptions>
61
           </el-form-item>
61
           </el-form-item>
62
           <el-form-item label="借款明细">
62
           <el-form-item label="借款明细">
111
               :disabled="taskName != '借款申请'"></el-button>
111
               :disabled="taskName != '借款申请'"></el-button>
112
           </el-form-item>
112
           </el-form-item>
113
           <el-form-item label="预算金额" v-if="isSelect">
113
           <el-form-item label="预算金额" v-if="isSelect">
114
-            <el-tag>{{ totalBudget.toFixed(2) }}</el-tag>
114
+            <el-tag>{{ totalBudget.toFixed(2) }}(大写:{{ formatNumberWithWan(totalBudget) }})</el-tag>
115
           </el-form-item>
115
           </el-form-item>
116
           <el-form-item label="已申请借款" v-if="isSelect">
116
           <el-form-item label="已申请借款" v-if="isSelect">
117
-            <el-tag type="warning">{{ hasBorrow.toFixed(2) }}</el-tag>
117
+            <el-tag type="danger">{{ hasBorrow.toFixed(2) }}(大写:{{ formatNumberWithWan(hasBorrow) }})</el-tag>
118
           </el-form-item>
118
           </el-form-item>
119
           <el-form-item label="可用借款" v-if="isSelect">
119
           <el-form-item label="可用借款" v-if="isSelect">
120
-            <el-tag type="success">{{ (totalBudget - hasBorrow).toFixed(2) }}</el-tag>
120
+            <el-tag type="success">{{ (totalBudget - hasBorrow).toFixed(2) }}(大写:{{ formatNumberWithWan((totalBudget -
121
+    hasBorrow)) }})</el-tag>
121
           </el-form-item>
122
           </el-form-item>
122
           <el-row :gutter="20">
123
           <el-row :gutter="20">
123
             <el-col :span="8" :xs="24">
124
             <el-col :span="8" :xs="24">
124
               <el-form-item label="申请金额" prop="applyAmount">
125
               <el-form-item label="申请金额" prop="applyAmount">
125
-                <el-input v-model="form.applyAmount" placeholder="请输入申请金额" :disabled="taskName != '借款申请'" />
126
+                <el-input v-model="form.applyAmount" placeholder="请输入申请金额" :disabled="taskName != '借款申请'"
127
+                  @blur="VerificationAmount" />
128
+                <span style="color:#E74C3C">超过预算额</span>
126
               </el-form-item>
129
               </el-form-item>
127
             </el-col>
130
             </el-col>
128
             <el-col :span="8" :xs="24">
131
             <el-col :span="8" :xs="24">
154
           <!-- 非党工团审核 -->
157
           <!-- 非党工团审核 -->
155
           <div v-if="form.borrowUsage == 0 || form.borrowUsage == 1">
158
           <div v-if="form.borrowUsage == 0 || form.borrowUsage == 1">
156
             <el-form-item label="部门负责人意见" prop="deptComment">
159
             <el-form-item label="部门负责人意见" prop="deptComment">
157
-              <el-input type="textarea" v-model="form.deptComment" placeholder="请输入部门负责人意见" :disabled="taskName != '部门审核'"
158
-                :autosize="{ minRows: 4 }" />
160
+              <el-input type="textarea" v-model="form.deptComment" placeholder="请输入部门负责人意见"
161
+                :disabled="taskName != '部门审核'" :autosize="{ minRows: 4 }" />
159
             </el-form-item>
162
             </el-form-item>
160
             <el-row>
163
             <el-row>
161
               <el-col :span="6" :xs="24" :offset="12">
164
               <el-col :span="6" :xs="24" :offset="12">
169
                 </el-form-item>
172
                 </el-form-item>
170
               </el-col>
173
               </el-col>
171
             </el-row>
174
             </el-row>
172
-            <!-- <el-form-item label="项目部校核意见" prop="xmComment" v-if="form.borrowUsage == '0'">
173
-              <el-input type="textarea" v-model="form.xmComment" placeholder="请输入项目部校核意见"
174
-                :disabled="taskName != '项目部审核'" :autosize="{ minRows: 4 }" />
175
-            </el-form-item>
176
-            <el-row v-if="form.borrowUsage == '0'">
177
-              <el-col :span="6" :xs="24" :offset="12">
178
-                <el-form-item label="签名:" label-width="120px" v-if="showFormItem('项目部审核')">
179
-                  <span class="auditor"> {{ form.xmUser ? form.xmUser.nickName : xmUser }} </span>
180
-                </el-form-item>
181
-              </el-col>
182
-              <el-col :span="6">
183
-                <el-form-item label="日期:" label-width="120px" v-if="showFormItem('项目部审核')">
184
-                  <span> {{ form.xmTime ? form.xmTime : xmTime }} </span>
185
-                </el-form-item>
186
-              </el-col>
187
-            </el-row> -->
188
             <el-form-item label="分管领导审核意见" prop="managerComment">
175
             <el-form-item label="分管领导审核意见" prop="managerComment">
189
               <el-input type="textarea" v-model="form.managerComment" placeholder="请输入分管领导审核意见"
176
               <el-input type="textarea" v-model="form.managerComment" placeholder="请输入分管领导审核意见"
190
                 :disabled="taskName != '分管审核'" :autosize="{ minRows: 4 }" />
177
                 :disabled="taskName != '分管审核'" :autosize="{ minRows: 4 }" />
202
               </el-col>
189
               </el-col>
203
             </el-row>
190
             </el-row>
204
             <el-form-item label="总经理审批意见" prop="zjlComment">
191
             <el-form-item label="总经理审批意见" prop="zjlComment">
205
-              <el-input type="textarea" v-model="form.zjlComment" placeholder="请输入总经理审批意见" :disabled="taskName != '总经理审核'"
206
-                :autosize="{ minRows: 4 }" />
192
+              <el-input type="textarea" v-model="form.zjlComment" placeholder="请输入总经理审批意见"
193
+                :disabled="taskName != '总经理审核'" :autosize="{ minRows: 4 }" />
207
             </el-form-item>
194
             </el-form-item>
208
             <el-row>
195
             <el-row>
209
               <el-col :span="6" :xs="24" :offset="12">
196
               <el-col :span="6" :xs="24" :offset="12">
218
               </el-col>
205
               </el-col>
219
             </el-row>
206
             </el-row>
220
             <el-form-item label="董事长批准意见" prop="dszComment">
207
             <el-form-item label="董事长批准意见" prop="dszComment">
221
-              <el-input type="textarea" v-model="form.dszComment" placeholder="请输入董事长批准意见" :disabled="taskName != '董事长批准'"
222
-                :autosize="{ minRows: 4 }" />
208
+              <el-input type="textarea" v-model="form.dszComment" placeholder="请输入董事长批准意见"
209
+                :disabled="taskName != '董事长批准'" :autosize="{ minRows: 4 }" />
223
             </el-form-item>
210
             </el-form-item>
224
             <el-row>
211
             <el-row>
225
               <el-col :span="6" :xs="24" :offset="12">
212
               <el-col :span="6" :xs="24" :offset="12">
281
             </el-col>
268
             </el-col>
282
             <el-col :span="6">
269
             <el-col :span="6">
283
               <el-form-item label="支付日期:" prop="lendTime" v-if="showFormItem('财务处理')">
270
               <el-form-item label="支付日期:" prop="lendTime" v-if="showFormItem('财务处理')">
284
-                <el-date-picker style="width:140px;" v-model="form.lendTime" value-format="yyyy-MM-dd" type="date"
271
+                <el-date-picker style="width:1.75rem;" v-model="form.lendTime" value-format="yyyy-MM-dd" type="date"
285
                   placeholder="选择日期" :disabled="taskName != '财务处理'">
272
                   placeholder="选择日期" :disabled="taskName != '财务处理'">
286
                 </el-date-picker>
273
                 </el-date-picker>
287
               </el-form-item>
274
               </el-form-item>
311
 import { parseTime } from "@/utils/ruoyi";
298
 import { parseTime } from "@/utils/ruoyi";
312
 import { getUsersDeptLeader, getUsersDeptLeaderByDept, getUsersViceDeptLeaderByDept, getUsersManageLeaderByDept } from '@/api/system/post.js'
299
 import { getUsersDeptLeader, getUsersDeptLeaderByDept, getUsersViceDeptLeaderByDept, getUsersManageLeaderByDept } from '@/api/system/post.js'
313
 import { listBorrow, getBorrow, delBorrow, addBorrow, updateBorrow } from "@/api/oa/borrow/borrow";
300
 import { listBorrow, getBorrow, delBorrow, addBorrow, updateBorrow } from "@/api/oa/borrow/borrow";
314
-import { listBorrowDetail, addBorrowDetail, updateBorrowDetail } from "@/api/oa/borrow/borrowDetail";
301
+import { listBorrowDetail, addBorrowDetail, updateBorrowDetail, delBorrowDetail } from "@/api/oa/borrow/borrowDetail";
315
 import { listProject, getProject } from "@/api/oa/project/project";
302
 import { listProject, getProject } from "@/api/oa/project/project";
316
 import { getUserByPost } from "@/api/system/post";
303
 import { getUserByPost } from "@/api/system/post";
317
 import flow from '@/views/flowable/task/todo/detail/flow'
304
 import flow from '@/views/flowable/task/todo/detail/flow'
399
       formTotal: 0,
386
       formTotal: 0,
400
       flowData: {},
387
       flowData: {},
401
       isProject: true,
388
       isProject: true,
402
-      exceed: false,
389
+      exceed: false, //是否超预算
403
       deptId: undefined,
390
       deptId: undefined,
404
       dgtLabel: '工会审核意见',
391
       dgtLabel: '工会审核意见',
405
       totalBudget: 0,
392
       totalBudget: 0,
415
       this.managerUser = this.$store.getters.name;
402
       this.managerUser = this.$store.getters.name;
416
       this.managerTime = parseTime(new Date(), '{y}-{m}-{d}')
403
       this.managerTime = parseTime(new Date(), '{y}-{m}-{d}')
417
     }
404
     }
418
-    // if (this.taskName == '项目部审核') {
419
-    //   this.xmUser = this.$store.getters.name;
420
-    //   this.xmTime = parseTime(new Date(), '{y}-{m}-{d}')
421
-    // }
422
     if (this.taskName == '总经理审核') {
405
     if (this.taskName == '总经理审核') {
423
       this.zjlUser = this.$store.getters.name;
406
       this.zjlUser = this.$store.getters.name;
424
       this.zjlTime = parseTime(new Date(), '{y}-{m}-{d}')
407
       this.zjlTime = parseTime(new Date(), '{y}-{m}-{d}')
602
     },
585
     },
603
     /** 提交按钮 */
586
     /** 提交按钮 */
604
     submitForm() {
587
     submitForm() {
605
-      if (this.isSelect) {
606
-        if (this.form.applyAmount > (this.totalBudget - this.hasBorrow)) {
607
-          this.$message.error('申请金额不允许超过可用借款!请重新填写')
608
-          return
609
-        }
610
-      }
611
       this.$refs["form"].validate(valid => {
588
       this.$refs["form"].validate(valid => {
612
         if (valid) {
589
         if (valid) {
613
           if (this.formTotal != 0) {
590
           if (this.formTotal != 0) {
614
-            for (let detail of this.detailList) {
615
-              updateBorrowDetail(detail);
591
+            if (this.isProject) {
592
+              if ((this.totalBudget - this.form.applyAmount) < 0) {
593
+                this.exceed = true;
594
+                this.$set(this.taskForm.variables, "exceed", true);
595
+              } else {
596
+                this.$set(this.taskForm.variables, "exceed", false);
597
+              }
616
             }
598
             }
617
-            updateBorrow(this.form).then(response => {
618
-            });
599
+            // 更新借款明细项
600
+            delBorrowDetail(this.taskForm.formId).then(res => {
601
+              this.detailList.forEach(detail => {
602
+                detail.borrowId = this.taskForm.formId;
603
+                addBorrowDetail(detail)
604
+              })
605
+            })
606
+            // 更新借款审批表
607
+            updateBorrow(this.form);
619
             const params = { taskId: this.taskForm.taskId };
608
             const params = { taskId: this.taskForm.taskId };
620
             getNextFlowNode(params).then(res => {
609
             getNextFlowNode(params).then(res => {
621
-              if (this.taskName == '部门审核') {
622
-                // if (this.isProject) {
623
-                //   getUsersDeptLeaderByDept({ deptId: 107 }).then(res => {
624
-                //     let userId = res.data.userId;
625
-                //     this.$set(this.taskForm.variables, "approval", userId);
626
-                //     this.$set(this.taskForm.variables, "isProject", this.isProject);
627
-                //     complete(this.taskForm).then(response => {
628
-                //       this.$modal.msgSuccess(response.msg);
629
-                //       this.$emit('goBack')
630
-                //     });
631
-                //   });
632
-                // } else {
610
+              if (this.taskName == '借款申请') {
611
+                this.borrowAprrovalFun();
612
+              } else if (this.taskName == '部门审核') {
633
                 getUsersManageLeaderByDept({ deptId: this.form.applyDept }).then(res => {
613
                 getUsersManageLeaderByDept({ deptId: this.form.applyDept }).then(res => {
634
-                  let userId = res.data[0].userId;
635
-                  this.$set(this.taskForm.variables, "approval", userId);
636
-                  // this.$set(this.taskForm.variables, "isProject", this.isProject);
637
-                  complete(this.taskForm).then(response => {
638
-                    this.$modal.msgSuccess(response.msg);
639
-                    this.$emit('goBack')
640
-                  });
614
+                  let userIds = [];
615
+                  if (res.data) {
616
+                    res.data.forEach(item => {
617
+                      userIds.push(item.userId)
618
+                    })
619
+                  }
620
+                  this.$set(this.taskForm.variables, "approvalList", userIds);
621
+                  this.handleComplete(this.taskForm);
641
                 })
622
                 })
642
               }
623
               }
643
-
644
-              // }
645
-              // else if (this.taskName == '项目部审核') {
646
-              //   getUsersManageLeaderByDept({ deptId: this.form.applyDept }).then(res => {
647
-              //     let userId = res.data[0].userId;
648
-              //     this.$set(this.taskForm.variables, "approval", userId);
649
-              //     complete(this.taskForm).then(response => {
650
-              //       this.$modal.msgSuccess(response.msg);
651
-              //       this.$emit('goBack')
652
-              //     });
653
-              //   });
654
-              // }
655
               else if (this.taskName == '分管审核') {
624
               else if (this.taskName == '分管审核') {
656
                 getUserByPost({ postName: '总经理' }).then(res => {
625
                 getUserByPost({ postName: '总经理' }).then(res => {
657
                   this.$set(this.taskForm.variables, "approval", res.data[0].userId);
626
                   this.$set(this.taskForm.variables, "approval", res.data[0].userId);
658
-                  complete(this.taskForm).then(response => {
659
-                    this.$modal.msgSuccess(response.msg);
660
-                    this.$emit('goBack')
661
-                  });
627
+                  this.handleComplete(this.taskForm);
662
                 })
628
                 })
663
               }
629
               }
664
               else if (this.taskName == '总经理审核') {
630
               else if (this.taskName == '总经理审核') {
665
-                if (!this.exceed) {
666
-                  let approvalList = [];
667
-                  getUsersDeptLeaderByDept({ deptId: 106 }).then(res => {
668
-                    approvalList.push(res.data.userId);
669
-                    getUsersViceDeptLeaderByDept({ deptId: 106 }).then(res1 => {
670
-                      approvalList.push(res1.data.userId);
671
-                      this.$set(this.taskForm.variables, "approvalList", approvalList);
672
-                      complete(this.taskForm).then(response => {
673
-                        this.$modal.msgSuccess(response.msg);
674
-                        this.$emit('goBack')
675
-                      })
676
-                    })
677
-                  });
631
+                if (!this.exceed) { //没有超预算
632
+                  this.submitFD(); //提交到财务部审核
678
                 }
633
                 }
679
                 else {
634
                 else {
680
                   getUserByPost({ postName: '董事长' }).then(res => {
635
                   getUserByPost({ postName: '董事长' }).then(res => {
681
                     this.$set(this.taskForm.variables, "approval", res.data[0].userId);
636
                     this.$set(this.taskForm.variables, "approval", res.data[0].userId);
682
-                    complete(this.taskForm).then(response => {
683
-                      this.$modal.msgSuccess(response.msg);
684
-                      this.$emit('goBack')
685
-                    });
637
+                    this.handleComplete(this.taskForm);
686
                   })
638
                   })
687
                 }
639
                 }
688
               }
640
               }
689
               else if (this.taskName == '董事长批准') {
641
               else if (this.taskName == '董事长批准') {
690
-                let approvalList = [];
691
-                getUsersDeptLeaderByDept({ deptId: 106 }).then(res => {
692
-                  approvalList.push(res.data.userId);
693
-                  getUsersViceDeptLeaderByDept({ deptId: 106 }).then(res1 => {
694
-                    approvalList.push(res1.data.userId);
695
-                    this.$set(this.taskForm.variables, "approvalList", approvalList);
696
-                    complete(this.taskForm).then(response => {
697
-                      this.$modal.msgSuccess(response.msg);
698
-                      this.$emit('goBack')
699
-                    })
700
-                  })
701
-                });
642
+                this.submitFD(); //提交到财务部审核
702
               }
643
               }
703
               else if (this.taskName == '党工团审核') {
644
               else if (this.taskName == '党工团审核') {
704
-                let approvalList = [];
705
-                getUsersDeptLeaderByDept({ deptId: 106 }).then(res => {
706
-                  approvalList.push(res.data.userId);
707
-                  getUsersViceDeptLeaderByDept({ deptId: 106 }).then(res1 => {
708
-                    approvalList.push(res1.data.userId);
709
-                    this.$set(this.taskForm.variables, "approvalList", approvalList);
710
-                    complete(this.taskForm).then(response => {
711
-                      this.$modal.msgSuccess(response.msg);
712
-                      this.$emit('goBack')
713
-                    })
714
-                  })
715
-                });
645
+                this.submitFD(); //提交到财务部审核
716
               }
646
               }
717
               else if (this.taskName == '财务处理') {
647
               else if (this.taskName == '财务处理') {
718
-                complete(this.taskForm).then(response => {
719
-                  this.$modal.msgSuccess(response.msg);
720
-                  this.$emit('goBack')
721
-                });
648
+                this.handleComplete(this.taskForm);
722
               }
649
               }
723
             })
650
             })
724
           } else {
651
           } else {
731
               this.$modal.msgSuccess("新增成功");
658
               this.$modal.msgSuccess("新增成功");
732
             });
659
             });
733
             const params = { taskId: this.taskForm.taskId };
660
             const params = { taskId: this.taskForm.taskId };
661
+            // 提交到下一个流程
734
             getNextFlowNode(params).then(res => {
662
             getNextFlowNode(params).then(res => {
735
-              let userId;
736
-              if (this.deptId == 0) {
737
-                if (this.form.borrowUsage == 2 || this.form.borrowUsage == 3) {
738
-                  userId = this.publicData.partySecretary
739
-                } else {
740
-                  userId = this.publicData.leagueSecretary
741
-                }
742
-                this.$set(this.taskForm.variables, "dept", this.deptId);
743
-                this.$set(this.taskForm.variables, "approval", userId);
744
-                complete(this.taskForm).then(response => {
745
-                  this.$modal.msgSuccess(response.msg);
746
-                  this.$emit('goBack')
747
-                });
748
-              } else {
749
-                if (this.deptId == 105)
750
-                  getDeptLeaders({ userId: this.form.drafter }).then(res => {
751
-                    this.$set(this.taskForm.variables, "approval", res.data[1].userId);
752
-                    complete(this.taskForm).then(response => {
753
-                      this.$modal.msgSuccess(response.msg);
754
-                      this.$emit('goBack')
755
-                    });
756
-                  })
757
-                else
758
-                  getUsersDeptLeader({ userId: this.$store.getters.userId }).then(res => {
759
-                    let userId = res.data.userId;
760
-                    this.$set(this.taskForm.variables, "approval", userId);
761
-                    this.$set(this.taskForm.variables, "dept", this.deptId);
762
-                    complete(this.taskForm).then(response => {
763
-                      this.$modal.msgSuccess(response.msg);
764
-                      this.$emit('goBack')
765
-                    });
766
-                  })
767
-              }
663
+              this.borrowAprrovalFun();
768
 
664
 
769
             })
665
             })
770
           }
666
           }
771
         }
667
         }
772
       });
668
       });
773
     },
669
     },
670
+    handleComplete(taskForm) {
671
+      complete(taskForm).then(response => {
672
+        this.$modal.msgSuccess(response.msg);
673
+        this.$emit('goBack');
674
+      })
675
+    },
676
+    // 借款申请提交方法
677
+    borrowAprrovalFun() {
678
+      let userId;
679
+      // 如果是党工团申请 deptId == 0 为党工团申请
680
+      if (this.deptId == 0) {
681
+        // 2为工会、3为党委
682
+        if (this.form.borrowUsage == 2 || this.form.borrowUsage == 3) {
683
+          userId = this.publicData.partySecretary
684
+        } else {
685
+          userId = this.publicData.leagueSecretary
686
+        }
687
+        this.$set(this.taskForm.variables, "dept", this.deptId);
688
+        this.$set(this.taskForm.variables, "approval", userId);
689
+        this.handleComplete(this.taskForm);
690
+      } else if (this.deptId == 102) { //如果是经营管理层申请,走总经理审批
691
+        getUserByPost({ postName: '总经理' }).then(res => {
692
+          this.$set(this.taskForm.variables, "dept", this.deptId);
693
+          this.$set(this.taskForm.variables, "approval", res.data[0].userId);
694
+          this.handleComplete(this.taskForm);
695
+        })
696
+      } else if (this.deptId == 101) {//如果是董事会申请,走董事长批准
697
+        getUserByPost({ postName: '董事长' }).then(res => {
698
+          this.$set(this.taskForm.variables, "dept", this.deptId);
699
+          this.$set(this.taskForm.variables, "approval", res.data[0].userId);
700
+          this.handleComplete(this.taskForm);
701
+        })
702
+      }
703
+      else { //普通员工申请项目借款
704
+        getUsersDeptLeader({ userId: this.$store.getters.userId }).then(res => {
705
+          let userId = res.data.userId;
706
+          this.$set(this.taskForm.variables, "approval", userId);
707
+          this.$set(this.taskForm.variables, "dept", this.deptId);
708
+          this.handleComplete(this.taskForm);
709
+        })
710
+      }
711
+    },
712
+    // 提交给财务部审核
713
+    submitFD() {
714
+      let approvalList = [];
715
+      getUsersDeptLeaderByDept({ deptId: 106 }).then(res => {
716
+        approvalList.push(res.data.userId);
717
+        getUsersViceDeptLeaderByDept({ deptId: 106 }).then(res1 => {
718
+          approvalList.push(res1.data.userId);
719
+          this.$set(this.taskForm.variables, "approvalList", approvalList);
720
+          this.handleComplete(this.taskForm);
721
+        })
722
+      });
723
+    },
774
     showFormItem(name) {
724
     showFormItem(name) {
775
       let isShow = false;
725
       let isShow = false;
776
       if (name == '借款申请')
726
       if (name == '借款申请')
820
         sum = sum + Number(user[name1]);
770
         sum = sum + Number(user[name1]);
821
       }
771
       }
822
       this.form[name2] = sum.toFixed(2);
772
       this.form[name2] = sum.toFixed(2);
773
+      this.VerificationAmount();
823
     },
774
     },
824
     getBorrowPath(val) {
775
     getBorrowPath(val) {
825
       let arr = val.split('/upload')
776
       let arr = val.split('/upload')
855
         }
806
         }
856
       }
807
       }
857
     },
808
     },
809
+    // 验证金额
810
+    VerificationAmount() {
811
+      if (this.isSelect) {
812
+        if (this.form.applyAmount > (this.totalBudget - this.hasBorrow)) {
813
+          this.$confirm('借款总额已经超过项目预算,将走《超预算或预算外支付(报销)》流程', '提示', {
814
+            confirmButtonText: '确定',
815
+            type: 'warning'
816
+          }).then(() => {
817
+            this.exceed = true;
818
+            this.$set(this.taskForm.variables, "exceed", true);
819
+            return
820
+          })
821
+        } else {
822
+          this.exceed = false;
823
+          this.$set(this.taskForm.variables, "exceed", false);
824
+        }
825
+      }
826
+    },
858
   }
827
   }
859
 };
828
 };
860
 </script>
829
 </script>
867
   border-collapse: collapse;
836
   border-collapse: collapse;
868
 
837
 
869
   td {
838
   td {
870
-    padding: 5px;
839
+    padding: .0625rem;
871
   }
840
   }
872
 }
841
 }
873
 </style>
842
 </style>

Загрузка…
Отмена
Сохранить