Skip to content

Commit d5ba2b0

Browse files
committed
use /fsm/xxx replace /leave/xxx
1 parent fb86c1c commit d5ba2b0

File tree

7 files changed

+93
-50
lines changed

7 files changed

+93
-50
lines changed

src/api/system/fsm.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ export const findFsmApproving = (params: any) =>
1414
params
1515
})
1616

17+
export const findFsmLogTrack = (params: any) =>
18+
request({
19+
url: '/fsm/log/track',
20+
method: 'get',
21+
params
22+
})
23+
1724
export const getFsmLogDetail = (params: any) =>
1825
request({
1926
url: '/fsm/submitter/detail',
@@ -35,6 +42,13 @@ export const approveFsm = (data: any) =>
3542
data
3643
})
3744

45+
export const cancelFsm = (data: any) =>
46+
request({
47+
url: '/fsm/cancel',
48+
method: 'patch',
49+
data
50+
})
51+
3852
export const createFsm = (data: any) =>
3953
request({
4054
url: '/fsm/create',

src/api/test/leaves.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ export const findLeave = (params: any) =>
77
params
88
})
99

10-
export const findLeaveApprovingTrack = (id: number) =>
11-
request({
12-
url: `/leave/approving/track/${id}`,
13-
method: 'get'
14-
})
15-
1610
export const createLeave = (data: any) =>
1711
request({
1812
url: '/leave/create',
@@ -27,24 +21,6 @@ export const updateLeave = (id: number, data: any) =>
2721
data
2822
})
2923

30-
export const confirmLeave = (id: number) =>
31-
request({
32-
url: `/leave/confirm/${id}`,
33-
method: 'patch'
34-
})
35-
36-
export const resubmitLeave = (id: number) =>
37-
request({
38-
url: `/leave/resubmit/${id}`,
39-
method: 'patch'
40-
})
41-
42-
export const cancelLeave = (id: number) =>
43-
request({
44-
url: `/leave/cancel/${id}`,
45-
method: 'patch'
46-
})
47-
4824
export const batchDeleteLeave = (ids: string) =>
4925
request({
5026
url: '/leave/delete/batch',

src/views/login/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export default class extends Vue {
157157
158158
private checkCapslock(e: KeyboardEvent) {
159159
const { key } = e
160-
this.capsTooltip = key !== null && key.length === 1 && (key >= 'A' && key <= 'Z')
160+
this.capsTooltip = key && key.length === 1 && (key >= 'A' && key <= 'Z')
161161
}
162162
163163
private showPwd() {

src/views/system/fsm.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ export default class extends Vue {
762762
const oldRow = JSON.parse(JSON.stringify(row))
763763
// 弹窗表单赋值
764764
this.updateDialog.form.id = row.id
765+
this.updateDialog.form.category = row.category
765766
this.updateDialog.form.name = row.name
766767
this.updateDialog.form.submitterName = row.submitterName
767768
this.updateDialog.form.submitterEditFields = []
@@ -844,7 +845,7 @@ export default class extends Vue {
844845
845846
this.updateDialog.form.levels = levels
846847
// 记录旧数据
847-
this.updateDialog.oldData = JSON.parse(JSON.stringify(await this.encodeData(oldRow)))
848+
this.updateDialog.oldData = JSON.parse(JSON.stringify(this.encodeData(oldRow)))
848849
// 修改类型
849850
this.updateDialog.type = 1
850851
// 修改标题

src/views/system/role.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@
320320
import { Component, Vue } from 'vue-property-decorator'
321321
import Pagination from '@/components/Pagination/index.vue'
322322
import { Form, Tree } from 'element-ui'
323-
import { batchDeleteRole, createRole, findRole, updateRole, updateRoleApis, updateRoleMenus } from '@/api/system/roles'
324-
import { findApiGroupByCategoryByRoleId } from '@/api/system/apis'
325-
import { findMenuByRoleId } from '@/api/system/menus'
323+
import { batchDeleteRole, createRole, findRole, updateRole } from '@/api/system/roles'
324+
import { findApiGroupByCategoryByRoleId, updateApiByRoleId } from '@/api/system/apis'
325+
import { findMenuByRoleId, updateMenuByRoleId } from '@/api/system/menus'
326326
import { diffArrUpdate, diffObjUpdate } from '@/utils/diff'
327327
import { UserModule } from '@/store/modules/user'
328328
import { IdempotenceModule } from '@/store/modules/idempotence'
@@ -537,7 +537,7 @@ export default class extends Vue {
537537
}
538538
try {
539539
this.roleDialog.loading = true
540-
await updateRoleMenus(this.roleDialog.roleId, diff)
540+
await updateMenuByRoleId(this.roleDialog.roleId, diff)
541541
} finally {
542542
this.roleDialog.loading = false
543543
}
@@ -567,7 +567,7 @@ export default class extends Vue {
567567
}
568568
try {
569569
this.roleDialog.loading = true
570-
await updateRoleApis(this.roleDialog.roleId, diff)
570+
await updateApiByRoleId(this.roleDialog.roleId, diff)
571571
} finally {
572572
this.roleDialog.loading = false
573573
}

src/views/test/approving.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,28 @@
105105
>
106106
<template slot-scope="scope">
107107
<el-button
108+
v-if="scope.row.resubmit === 1"
109+
type="success"
110+
@click="handleApproval(scope.row, 2)"
111+
>
112+
重新提交
113+
</el-button>
114+
<el-button
115+
v-if="scope.row.confirm === 1"
116+
type="success"
117+
@click="handleApproval(scope.row, 3)"
118+
>
119+
确认
120+
</el-button>
121+
<el-button
122+
v-if="scope.row.resubmit === 0 && scope.row.confirm === 0"
108123
type="primary"
109124
@click="handleApproval(scope.row, 0)"
110125
>
111126
通过
112127
</el-button>
113128
<el-button
129+
v-if="scope.row.resubmit === 0 && scope.row.confirm === 0 && scope.row.refuse === 1"
114130
type="danger"
115131
@click="handleApproval(scope.row, 1)"
116132
>
@@ -281,6 +297,9 @@ export default class extends Vue {
281297
category: '',
282298
submitterUser: {},
283299
submitterRole: {},
300+
resubmit: 0,
301+
confirm: 0,
302+
refuse: 0,
284303
logDetail: []
285304
}
286305
}
@@ -355,6 +374,16 @@ export default class extends Vue {
355374
// 弹窗表单赋值
356375
this.approvalDialog.form.uuid = row.uuid
357376
this.approvalDialog.form.category = row.category
377+
if (type === 2 || type === 3) {
378+
// 重新提交/确认
379+
await approveFsm({
380+
uuid: row.uuid,
381+
category: row.category,
382+
approved: 1
383+
})
384+
this.getData()
385+
return
386+
}
358387
// 修改分类
359388
this.approvalDialog.type = type
360389
// 修改标题

src/views/test/leave.vue

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
<el-button
116116
type="primary"
117117
:loading="table.approvalLoading"
118-
@click="handleApproval(scope.row)"
118+
@click="handleLogTrack(scope.row)"
119119
>
120120
审批日志
121121
</el-button>
@@ -273,16 +273,10 @@
273273
import { Component, Vue } from 'vue-property-decorator'
274274
import Pagination from '@/components/Pagination/index.vue'
275275
import { Form } from 'element-ui'
276-
import {
277-
batchDeleteLeave,
278-
cancelLeave,
279-
createLeave,
280-
findLeaveApprovingTrack,
281-
findLeave,
282-
updateLeave, confirmLeave, resubmitLeave
283-
} from '@/api/test/leaves'
276+
import { batchDeleteLeave, createLeave, findLeave, updateLeave } from '@/api/test/leaves'
284277
import { diffObjUpdate } from '@/utils/diff'
285278
import { IdempotenceModule } from '@/store/modules/idempotence'
279+
import { approveFsm, cancelFsm, findFsmLogTrack } from '@/api/system/fsm'
286280
287281
@Component({
288282
// 组件名称首字母需大写, 否则会报警告
@@ -295,6 +289,8 @@ export default class extends Vue {
295289
private readonly defaultConfig: any = {
296290
pageNum: 1,
297291
pageSize: 5,
292+
// 默认状态机分类, 需要和后端保持一致, 也可以动态从数据字典查询
293+
category: 1,
298294
status: [{
299295
name: 0,
300296
label: '已提交',
@@ -502,11 +498,17 @@ export default class extends Vue {
502498
this.updateDialog.visible = true
503499
}
504500
505-
private async handleApproval(row: any) {
501+
private async handleLogTrack(row: any) {
506502
this.table.approvalLoading = true
507-
this.approvalDialog.title = ''
508503
try {
509-
const { data } = await findLeaveApprovingTrack(row.id)
504+
console.log({
505+
category: this.defaultConfig.category,
506+
uuid: row.fsmUuid
507+
})
508+
const { data } = await findFsmLogTrack({
509+
category: this.defaultConfig.category,
510+
uuid: row.fsmUuid
511+
})
510512
this.approvalDialog.stepsActive = data.length - 1
511513
const logs: any [] = []
512514
for (let i = 0, len = data.length; i < len; i++) {
@@ -520,6 +522,14 @@ export default class extends Vue {
520522
} else if (i < len - 1 || item.status > 0) {
521523
let status = 'success'
522524
let description = item.updatedAt
525+
let opinion = item.opinion
526+
if (item.opinion === '' && item.status !== 3 && item.end === 0 && item.confirm === 0) {
527+
opinion = '通过'
528+
}
529+
let title = item.name
530+
if (opinion !== '') {
531+
title = item.name + '[审批意见: ' + opinion + ']'
532+
}
523533
if (item.status === 2) {
524534
status = 'error'
525535
if (item.opinion !== '') {
@@ -531,18 +541,18 @@ export default class extends Vue {
531541
status = 'finish'
532542
}
533543
logs.push({
534-
title: item.name,
544+
title,
535545
description,
536546
status
537547
})
538548
} else {
539-
if (item.resubmit) {
549+
if (item.resubmit === 1) {
540550
logs.push({
541551
title: '待重新提交',
542552
description: '请编辑后重新提交~',
543553
status: 'wait'
544554
})
545-
} else if (item.confirm) {
555+
} else if (item.confirm === 1) {
546556
logs.push({
547557
title: '待确认',
548558
description: '请点击确认~',
@@ -599,13 +609,23 @@ export default class extends Vue {
599609
type: 'warning'
600610
})
601611
.then(async() => {
602-
await confirmLeave(row.id)
612+
await approveFsm({
613+
category: this.defaultConfig.category,
614+
uuid: row.fsmUuid,
615+
// 确认相当于一次审批通过
616+
approved: 1
617+
})
603618
this.getData()
604619
})
605620
}
606621
607622
private async handleResubmit(row: any) {
608-
await resubmitLeave(row.id)
623+
await approveFsm({
624+
category: this.defaultConfig.category,
625+
uuid: row.fsmUuid,
626+
// 重新提交相当于一次审批通过
627+
approved: 1
628+
})
609629
this.getData()
610630
}
611631
@@ -617,7 +637,10 @@ export default class extends Vue {
617637
type: 'warning'
618638
})
619639
.then(async() => {
620-
await cancelLeave(row.id)
640+
await cancelFsm({
641+
category: this.defaultConfig.category,
642+
uuids: [row.fsmUuid]
643+
})
621644
this.getData()
622645
})
623646
}
@@ -721,7 +744,7 @@ export default class extends Vue {
721744
margin-bottom: 15px;
722745
}
723746
.el-steps {
724-
width: 50%;
747+
width: 70%;
725748
margin: 0 auto;
726749
}
727750
}

0 commit comments

Comments
 (0)