综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

borrow.vue 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-02-20 10:20:22
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-05-29 10:15:51
  6. -->
  7. <template>
  8. <view class="form-container">
  9. <!-- 表单标题 -->
  10. <view class="form-title">
  11. <text class="title-text">借款审批</text>
  12. <view class="title-line"></view>
  13. </view>
  14. <!-- 表单内容 -->
  15. <uni-forms ref="form" :modelValue="form" :rules="rules" label-position="top" label-width="150" class="custom-form">
  16. <flow-note :taskForm="taskForm"></flow-note>
  17. <!-- 当前节点 -->
  18. <uni-forms-item label="当前节点" class="form-item" v-if="taskName">
  19. <uni-tag :inverted="true" type="primary" :text="taskName"></uni-tag>
  20. </uni-forms-item>
  21. <!-- 流程发起人 -->
  22. <uni-forms-item label="填报人" class="form-item">
  23. <b style="font-size:30rpx;">{{ applierUserName }}</b>
  24. </uni-forms-item>
  25. <!-- 填报日期 -->
  26. <uni-forms-item label="填报日期" class="form-item">
  27. <text>{{ form.applyDate }}</text>
  28. </uni-forms-item>
  29. <!-- 借款类型 -->
  30. <uni-forms-item label="借款类型" required class="form-item" name="borrowUsage">
  31. <uni-data-checkbox v-model="form.borrowUsage" :localdata="borrowUsageOptions" :disabled="taskName != '借款申请'"
  32. @change="hanldeChangeType"></uni-data-checkbox>
  33. </uni-forms-item>
  34. <!-- 借款事由 -->
  35. <uni-forms-item label="借款事由" required class="form-item" name="applyReason" v-if="form.borrowUsage != 0">
  36. <uv-textarea v-model="form.applyReason" placeholder="请输入借款事由" :disabled="taskName != '借款申请'"></uv-textarea>
  37. </uni-forms-item>
  38. <!-- 选择项目 -->
  39. <uni-forms-item label="选择项目" required class="form-item" v-if="form.borrowUsage == 0" name="projectId">
  40. <u-button type="primary" @click="openProject = true" v-if="taskName == '借款申请'">+ 选择项目</u-button>
  41. <ProjectPicker :visible.sync="openProject" :selected.sync="selectedProject" @confirm="handleConfirm" />
  42. <ProjectInfo :project="projectObj"></ProjectInfo>
  43. </uni-forms-item>
  44. <!-- 借款明细 -->
  45. <uni-forms-item label="借款明细" required class="form-item">
  46. <BorrowDetail :borrowId="form.borrowId" :taskName="taskName" :borrowUsage="form.borrowUsage" @getApplyAmount="setApplyAmount"
  47. @getManagerAmount="setManagerAmount"></BorrowDetail>
  48. </uni-forms-item>
  49. <!-- 最大借款金额限制 -->
  50. <uni-forms-item label="最大借款金额" class="form-item" v-if="form.borrowUsage == '0'">
  51. <view class="amount-text">¥ {{ siteExpenses.toFixed(2) }}</view>
  52. </uni-forms-item>
  53. <uni-forms-item label="已申请借款" class="form-item" v-if="form.borrowUsage == '0'">
  54. <view class="amount-text">¥ {{ hasBorrow.toFixed(2) }}</view>
  55. </uni-forms-item>
  56. <uni-forms-item label="可用借款" class="form-item" v-if="form.borrowUsage == '0'">
  57. <view class="amount-text">¥ {{ (siteExpenses - hasBorrow).toFixed(2) }}</view>
  58. </uni-forms-item>
  59. <uni-forms-item label="申请金额" required class="form-item">
  60. <view class="amount-text">¥ {{ (this.form.applyAmount ? this.form.applyAmount : 0).toFixed(2) }}</view>
  61. <view class="warning-text" v-if="exceed && form.borrowUsage == '0'">
  62. 超过预算金额:¥ {{ getMoreAmount('0') }}
  63. </view>
  64. </uni-forms-item>
  65. <uni-forms-item label="校准金额" required class="form-item"
  66. v-if="taskName != '借款申请' && taskName != '部门审核' && taskName != '党工团审核'">
  67. <view class="amount-text">¥ {{ (this.form.managerAmount ? this.form.managerAmount : 0).toFixed(2) }}</view>
  68. <view class="warning-text" v-if="exceed && form.borrowUsage == '0'">
  69. 超过预算金额:¥ {{ getMoreAmount('1') }}
  70. </view>
  71. </uni-forms-item>
  72. <!-- 申请人说明 -->
  73. <uni-forms-item label="申请人说明" required class="form-item" name="remark">
  74. <uv-textarea v-model="form.remark" placeholder="请输入申请人说明" :disabled="taskName != '借款申请'"></uv-textarea>
  75. </uni-forms-item>
  76. <!-- 附件上传 -->
  77. <uni-forms-item label="附件上传" class="form-item" name="borrowDocument">
  78. <file-upload :fileType="'借款/申请附件'" :showBtn="taskName == '借款申请'" :fileName="form.borrowDocument"
  79. @deleteFile="form.borrowDocument = ''" @success="uploadSuccess"></file-upload>
  80. </uni-forms-item>
  81. <view v-if="form.borrowUsage == '0' || form.borrowUsage == '1'">
  82. <!-- 部门审核 -->
  83. <uni-forms-item label="部门负责人意见" required class="form-item" v-if="taskName != '借款申请'" name="deptComment">
  84. <uv-textarea v-model="form.deptComment" placeholder="请输入部门负责人意见" :disabled="taskName != '部门审核'"></uv-textarea>
  85. <auditor :name="form.deptUser ? form.deptUser.nickName : ''" :time="form.deptTime"></auditor>
  86. </uni-forms-item>
  87. <!-- 分管审核 -->
  88. <uni-forms-item label="分管领导审核意见" required class="form-item" v-if="taskName != '借款申请'" name="managerComment">
  89. <uv-textarea v-model="form.managerComment" placeholder="请输入分管领导审核意见"
  90. :disabled="taskName != '分管审核'"></uv-textarea>
  91. <auditor :name="form.managerUser ? form.managerUser.nickName : ''" :time="form.managerTime"></auditor>
  92. </uni-forms-item>
  93. <!-- 总经理审核 -->
  94. <uni-forms-item label="总经理审核意见" required class="form-item" v-if="taskName != '借款申请'" name="zjlComment">
  95. <uv-textarea v-model="form.zjlComment" placeholder="请输入总经理审核意见" :disabled="taskName != '总经理审核'"></uv-textarea>
  96. <auditor :name="form.zjlUser ? form.zjlUser.nickName : ''" :time="form.zjlTime"></auditor>
  97. </uni-forms-item>
  98. </view>
  99. <!-- 党工团审核 -->
  100. <view v-if="form.borrowUsage != '0' && form.borrowUsage != '1'">
  101. <uni-forms-item :label="dgtLabel" required class="form-item" v-if="taskName != '借款申请'" name="unionComment">
  102. <uv-textarea v-model="form.unionComment" placeholder="请输入审核意见" :disabled="taskName != '党工团审核'"></uv-textarea>
  103. <auditor :name="form.unionUser ? form.unionUser.nickName : ''" :time="form.unionTime"></auditor>
  104. </uni-forms-item>
  105. </view>
  106. <!-- 财务处理 -->
  107. <uni-forms-item label="财务部支付备注" class="form-item" v-if="taskName != '借款申请'" name="cwComment">
  108. <uv-textarea v-model="form.cwComment" placeholder="请输入财务部支付备注" :disabled="taskName != '财务处理'"></uv-textarea>
  109. </uni-forms-item>
  110. <uni-forms-item label="支付时间" required class="form-item" v-if="taskName != '借款申请'" name="lendTime">
  111. <uni-datetime-picker type="date" :clear-icon="false" v-model="form.lendTime" :disabled="taskName != '财务处理'" />
  112. <auditor :name="form.cwUser ? form.cwUser.nickName : ''" :time="form.lendTime"></auditor>
  113. </uni-forms-item>
  114. <!-- 操作栏 -->
  115. <view class="form-button" v-if="taskName">
  116. <u-button type="warning" size="normal" @click="saves" style="margin-right: 10px" v-if="taskName">保存</u-button>
  117. <u-button type="error" size="normal" style="margin-right: 10px" @click="$refs.returnPopup.open()"
  118. v-if="taskName != '借款申请'">退回</u-button>
  119. <u-button type="primary" size="normal" @click="submit">{{ taskName == '借款申请' ? '提交申请' : '提交审核' }}</u-button>
  120. </view>
  121. </uni-forms>
  122. <!-- 退回弹窗 -->
  123. <uni-popup ref="returnPopup" background-color="#fff">
  124. <return-popup @cancel="$refs.returnPopup.close()" :taskForm="taskForm" :comment="commentByRole()"
  125. @goBack="goHome"></return-popup>
  126. </uni-popup>
  127. </view>
  128. </template>
  129. <script>
  130. import { parseTime } from "@/utils/common.js"
  131. import { listBudget } from "@/api/oa/budget/budget";
  132. import ProjectInfo from '@/pages/components/ProjectInfo.vue';
  133. import { complete, getNextFlowNode } from "@/api/flowable/todo";
  134. import ProjectPicker from '@/pages/components/ProjectPicker.vue';
  135. import { listProject, getProject } from "@/api/oa/project/project";
  136. import { listSite, delSite } from "@/api/oa/budget/budgetSite.js";
  137. import { listBorrow, getBorrow, delBorrow, addBorrow, updateBorrow } from "@/api/oa/borrow/borrow";
  138. import { getUserByPost, getUsersDeptLeader, getUsersDeptLeaderByDept, getUsersViceDeptLeaderByDept, getUsersManageLeaderByDept } from '@/api/system/post.js'
  139. import BorrowDetail from './borrowDetail.vue';
  140. import FlowNote from '@/pages/components/flowNote.vue';
  141. import ReturnPopup from '@/pages/components/returnPopup.vue';
  142. import FileUpload from '@/pages/components/fileUpload.vue';
  143. import Auditor from "@/pages/components/auditor.vue";
  144. export default {
  145. components: {
  146. ProjectPicker,
  147. ProjectInfo,
  148. BorrowDetail,
  149. FlowNote,
  150. ReturnPopup,
  151. FileUpload,
  152. Auditor
  153. },
  154. props: {
  155. taskForm: Object,
  156. taskName: String, // 当前节点
  157. startUserName: String, // 流程发起人
  158. },
  159. created() {
  160. this.form.borrowId = this.taskForm.formId;
  161. this.deptId = this.$store.getters.deptId;
  162. this.applierUserName = this.startUserName;
  163. this.initForm();
  164. this.initRules();
  165. uni.setNavigationBarTitle({
  166. title: '借款审批'
  167. });
  168. },
  169. watch: {
  170. form: {
  171. handler(newVal) {
  172. this.initRules();
  173. },
  174. deep: true // 启用深度监测
  175. }
  176. },
  177. data() {
  178. return {
  179. applierUserName: '',
  180. form: {
  181. submitTime: '',
  182. borrowUsage: '0',
  183. applyAmount: 0,
  184. managerAmount: 0,
  185. remark: '',
  186. applyDate: ''
  187. },
  188. rules: {},
  189. borrowUsageOptions: [{
  190. text: '项目借款',
  191. value: '0',
  192. disable: false
  193. }, {
  194. text: '非项目借款',
  195. value: '1',
  196. disable: false
  197. }, {
  198. text: '工会借款',
  199. value: '2',
  200. disable: false
  201. }, {
  202. text: '党委借款',
  203. value: '3',
  204. disable: false
  205. }, {
  206. text: '团委借款',
  207. value: '4',
  208. disable: false
  209. }
  210. ],
  211. openProject: false,
  212. selectedProject: null, //选中的项目
  213. projectObj: {}, //项目信息的项目
  214. formTotal: 0,
  215. siteExpenses: 0, //预结算额
  216. exceed: false, //是否超预算
  217. need: true, //是否需要分管审批
  218. hasBorrow: 0, //已申请借款
  219. deptId: undefined,
  220. returnBack: false,
  221. dgtLabel: '工会审核意见',
  222. }
  223. },
  224. methods: {
  225. initRules() {
  226. this.rules = {
  227. // 借款类型验证(必填)
  228. borrowUsage: {
  229. rules: [{
  230. required: true,
  231. errorMessage: '请选择借款类型'
  232. }]
  233. },
  234. // 借款事由验证(当 borrowUsage != 0 时必填)
  235. applyReason: {
  236. rules: [{
  237. required: this.form.borrowUsage != '0', // 动态控制必填
  238. errorMessage: '请输入借款事由'
  239. }]
  240. },
  241. // 项目选择验证(当 borrowUsage == 0 时必填)
  242. projectId: {
  243. rules: [{
  244. required: this.form.borrowUsage == '0', // 动态控制必填
  245. errorMessage: '请选择项目'
  246. }]
  247. },
  248. // 申请人说明验证(必填)
  249. remark: {
  250. rules: [{
  251. required: true,
  252. errorMessage: '请输入申请人说明'
  253. }]
  254. },
  255. // 部门意见验证(仅在部门审核步骤必填)
  256. deptComment: {
  257. rules: [{
  258. required: this.taskName === '部门审核',
  259. errorMessage: '请输入部门意见'
  260. }]
  261. },
  262. // 分管意见验证(仅在分管审核步骤必填)
  263. managerComment: {
  264. rules: [{
  265. required: this.taskName === '分管审核',
  266. errorMessage: '请输入分管意见'
  267. }]
  268. },
  269. // 总经理意见验证(仅在总经理审核步骤必填)
  270. zjlComment: {
  271. rules: [{
  272. required: this.taskName === '总经理审核',
  273. errorMessage: '请输入总经理意见'
  274. }]
  275. },
  276. lendTime: {
  277. rules: [{
  278. required: this.taskName === '财务处理',
  279. errorMessage: '请选择支付时间'
  280. }]
  281. }
  282. }
  283. },
  284. async initForm() {
  285. getBorrow(this.taskForm.formId).then(async res => {
  286. if (res.data) {
  287. this.formTotal = 1;
  288. this.form = res.data;
  289. if (this.form.applyDept == 104) //董事长分管的综合事务部,跳过分管审批
  290. this.need = false;
  291. if (!this.applierUserName) {
  292. this.applierUserName = this.form.applierUser.nickName;
  293. }
  294. this.hanldeChangeType();
  295. if (this.form.projectId) {
  296. getProject(this.form.projectId).then(res => {
  297. if (res.data) {
  298. this.selectedProject = res.data;
  299. this.projectObj = res.data;
  300. }
  301. })
  302. await this.getMaxExpense();
  303. }
  304. } else {
  305. this.formTotal = 0;
  306. this.form.applier = this.$store.getters.userId;
  307. this.form.applyDate = parseTime(new Date(), "{y}-{m}-{d}");
  308. }
  309. })
  310. },
  311. async getMaxExpense() {
  312. let budgetData = await listBudget({ projectId: this.form.projectId })
  313. if (budgetData.total == 1) {
  314. let budget = budgetData.rows[0];
  315. let siteRes = await listSite({ budgetId: budget.budgetId });
  316. let maxExpense = siteRes.rows.reduce((sum, site) => sum + (Number(site.amount) || 0), 0);
  317. this.siteExpenses = maxExpense
  318. } else {
  319. this.siteExpenses = 0
  320. }
  321. if (this.form.borrowUsage == '0') {
  322. if ((this.siteExpenses - this.form.applyAmount) < 0) {
  323. this.exceed = true;
  324. } else {
  325. this.exceed = false;
  326. }
  327. } else {
  328. this.exceed = false;
  329. }
  330. let borrow = await listBorrow({ projectId: this.form.projectId })
  331. if (borrow.total != 0) {
  332. let borrowList = borrow.rows;
  333. let hasBorrow = 0;
  334. borrowList = borrowList.filter(item => item.borrowId != this.taskForm.formId)
  335. borrowList.forEach(element => {
  336. if (element.managerAmount) {
  337. hasBorrow = hasBorrow + element.managerAmount
  338. }
  339. if (!element.managerAmount && element.applyAmount) {
  340. hasBorrow = hasBorrow + element.applyAmount
  341. }
  342. });
  343. this.hasBorrow = hasBorrow
  344. }
  345. this.getMoreAmount();
  346. },
  347. hanldeChangeType() {
  348. if (this.form.borrowUsage == '2') {
  349. this.dgtLabel = '工会审核意见'
  350. } else if (this.form.borrowUsage == '3') {
  351. this.dgtLabel = '党委审核意见'
  352. } else {
  353. this.dgtLabel = '团委审核意见'
  354. }
  355. },
  356. // 计算超过预算的金额
  357. getMoreAmount(type) {
  358. let result;
  359. if (type == '0') {
  360. result = this.form.applyAmount - (this.siteExpenses - this.hasBorrow);
  361. } else {
  362. result = this.form.managerAmount - (this.siteExpenses - this.hasBorrow);
  363. }
  364. return result.toFixed(2)
  365. },
  366. setApplyAmount(val) {
  367. this.form.applyAmount = val
  368. },
  369. setManagerAmount(val) {
  370. this.form.managerAmount = val
  371. },
  372. handleConfirm(project) {
  373. this.selectedProject = project;
  374. this.projectObj = project;
  375. this.form.projectId = project.projectId;
  376. this.getMaxExpense();
  377. },
  378. // 保存
  379. async saves() {
  380. if (this.formTotal == 0) {
  381. this.form.borrowId = this.taskForm.formId;
  382. await addBorrow(this.form)
  383. this.initForm();
  384. } else {
  385. // 更新借款审批表
  386. await updateBorrow(this.form);
  387. }
  388. this.$modal.msgSuccess('保存成功');
  389. },
  390. submit() {
  391. // 显示确认提交对话框
  392. uni.showModal({
  393. title: '提示',
  394. content: '确认提交吗?',
  395. success: (res) => {
  396. if (!res.confirm) {
  397. return;
  398. }
  399. // 继续执行后续代码
  400. this.handleSubmit();
  401. }
  402. });
  403. },
  404. // 处理提交逻辑
  405. handleSubmit() {
  406. this.$refs.form.validate().then(async res => {
  407. if (this.formTotal != 0) {
  408. // 定义审核节点配置
  409. const auditConfig = {
  410. '部门审核': {
  411. userIdField: 'deptUserId',
  412. timeField: 'deptTime'
  413. },
  414. '分管审核': {
  415. userIdField: 'managerUserId',
  416. timeField: 'managerTime'
  417. },
  418. '总经理审核': {
  419. userIdField: 'zjlUserId',
  420. timeField: 'zjlTime'
  421. },
  422. '董事长批准': {
  423. userIdField: 'dszUserId',
  424. timeField: 'dszTime'
  425. },
  426. '党工团审核': {
  427. userIdField: 'unionUserId',
  428. timeField: 'unionTime'
  429. },
  430. '财务处理': {
  431. userIdField: 'cwUserId',
  432. timeField: 'lendTime'
  433. }
  434. }
  435. // 根据当前节点更新审核信息
  436. const currentConfig = auditConfig[this.taskName]
  437. if (currentConfig) {
  438. const currentUserId = this.$store.getters.userId
  439. const currentTime = parseTime(new Date(), '{y}-{m}-{d}')
  440. // 设置审核人和审核时间
  441. this.form[currentConfig.userIdField] = currentUserId
  442. this.form[currentConfig.timeField] = currentTime
  443. }
  444. // 更新借款申请
  445. await updateBorrow(this.form);
  446. const params = { taskId: this.taskForm.taskId };
  447. getNextFlowNode(params).then(async res => {
  448. // 处理不同的流程节点
  449. if (this.taskName == '借款申请') {
  450. // 处理借款申请节点
  451. await this.borrowApprovalFun();
  452. } else if (this.taskName == '部门审核') {
  453. this.taskForm.variables.need = this.need;
  454. if (this.need) {
  455. // 得到分管领导根据部门
  456. const res = await getUsersManageLeaderByDept({ deptId: this.form.applyDept });
  457. let userIds = [];
  458. if (res.data) {
  459. res.data.forEach(item => {
  460. userIds.push(item.userId)
  461. })
  462. }
  463. this.taskForm.variables.approvalList = userIds;
  464. this.handleComplete(this.taskForm);
  465. }
  466. else {
  467. const res = await getUsersManageLeaderByDept({ deptId: this.form.applyDept });
  468. let userIds = [];
  469. if (res.data) {
  470. res.data.forEach(item => {
  471. userIds.push(item.userId)
  472. })
  473. }
  474. this.taskForm.variables.approvalList = userIds;
  475. const response = await getUserByPost({ postName: '总经理' });
  476. this.taskForm.variables.approval = response.data[0].userId;
  477. this.handleComplete(this.taskForm);
  478. }
  479. } else if (this.taskName == '分管审核') {
  480. // 得到总经理
  481. const res = await getUserByPost({ postName: '总经理' });
  482. this.taskForm.variables.approval = res.data[0].userId;
  483. this.handleComplete(this.taskForm);
  484. } else if (this.taskName == '总经理审核') {
  485. this.exceed = false;
  486. this.taskForm.variables.exceed = this.exceed;
  487. if (!this.exceed) {
  488. this.submitFD(); // 提交给财务部门
  489. } else {
  490. const res = await getUserByPost({ postName: '董事长' });
  491. this.taskForm.variables.approval = res.data[0].userId;
  492. this.handleComplete(this.taskForm);
  493. }
  494. } else if (this.taskName == '董事长批准' || this.taskName == '党工团审核') {
  495. this.submitFD(); // 提交给财务部门
  496. } else if (this.taskName == '财务处理') {
  497. uni.showModal({
  498. title: '提示',
  499. content: '最后一个节点,提交将结束流程,是否提交?',
  500. success: (res) => {
  501. if (res.confirm) {
  502. this.handleComplete(this.taskForm);
  503. }
  504. }
  505. });
  506. }
  507. })
  508. }
  509. }).catch(err => {
  510. console.log('表单错误信息:', err);
  511. })
  512. },
  513. // 处理任务完成
  514. handleComplete(taskForm) {
  515. complete(taskForm).then(response => {
  516. this.$modal.msgSuccess(response.msg);
  517. this.goHome();
  518. })
  519. },
  520. // 借款申请提交方法
  521. async borrowApprovalFun() {
  522. let userId;
  523. if (this.form.borrowUsage == '2' || this.form.borrowUsage == '3' || this.form.borrowUsage == '4') {
  524. this.deptId = 0;
  525. }
  526. // 如果是党工团申请 deptId == 0 为党工团申请
  527. if (this.deptId === 0) {
  528. // 2为工会、3为党委
  529. if (this.form.borrowUsage == 2 || this.form.borrowUsage == 3) {
  530. const res = await getUserByPost({ postName: '党总支书记' });
  531. userId = res.data[0].userId;
  532. } else {
  533. const res = await getUserByPost({ postName: '团支部书记' });
  534. userId = res.data[0].userId;
  535. }
  536. this.taskForm.variables.dept = this.deptId;
  537. this.taskForm.variables.approval = userId;
  538. this.handleComplete(this.taskForm);
  539. }
  540. else if (this.deptId == 102) { //如果是经营管理层申请,走总经理审批
  541. this.form.managerAmount = this.form.applyAmount;
  542. await updateBorrow(this.form);
  543. const res = await getUserByPost({ postName: '总经理' });
  544. this.taskForm.variables.dept = this.deptId;
  545. this.taskForm.variables.approval = res.data[0].userId;
  546. this.handleComplete(this.taskForm);
  547. } else if (this.deptId == 101) { //如果是董事会申请,走董事长批准
  548. const res = await getUserByPost({ postName: '董事长' });
  549. this.taskForm.variables.dept = this.deptId;
  550. this.taskForm.variables.approval = res.data[0].userId;
  551. this.taskForm.variables.exceed = true;
  552. this.handleComplete(this.taskForm);
  553. } else { //普通员工申请项目借款
  554. const res = await getUsersDeptLeader({ userId: this.$store.getters.userId });
  555. let userId = res.data.userId;
  556. this.taskForm.variables.approval = userId;
  557. this.taskForm.variables.dept = this.deptId;
  558. this.handleComplete(this.taskForm);
  559. }
  560. },
  561. // 提交给财务部审核
  562. async submitFD() {
  563. let approvalList = [];
  564. const res = await getUsersDeptLeaderByDept({ deptId: 106 });
  565. approvalList.push(res.data.userId);
  566. const res1 = await getUsersViceDeptLeaderByDept({ deptId: 106 });
  567. approvalList.push(res1.data.userId);
  568. this.taskForm.variables.approvalList = approvalList;
  569. this.handleComplete(this.taskForm);
  570. },
  571. commentByRole() {
  572. if (this.taskName == '部门审核') {
  573. return this.form.deptComment
  574. } else if (this.taskName == '分管审核') {
  575. return this.form.managerComment
  576. } else if (this.taskName == '总经理审核') {
  577. return this.form.zjlComment
  578. } else if (this.taskName == '董事长批准') {
  579. return this.form.dszComment
  580. } else if (this.taskName == '党工团审核') {
  581. return this.form.unionComment
  582. } else if (this.taskName == '财务处理') {
  583. return this.form.cwComment
  584. }
  585. },
  586. goHome() {
  587. uni.switchTab({
  588. url: '/pages/message/index'
  589. })
  590. },
  591. uploadSuccess(fileName) {
  592. this.form.borrowDocument = fileName
  593. updateBorrow(this.form)
  594. }
  595. },
  596. }
  597. </script>
  598. <style lang="scss" scoped>
  599. .amount-text {
  600. font-size: 16px;
  601. font-weight: bold;
  602. color: #333;
  603. text-align: right;
  604. }
  605. .warning-text {
  606. font-size: 14px;
  607. color: #ff0000;
  608. margin-top: 5px;
  609. text-align: right;
  610. }
  611. .form-button {
  612. display: flex;
  613. }
  614. .example-body {
  615. padding: 10px;
  616. background-color: #fff;
  617. }
  618. </style>