-
-
+ @for (item of deviceFlows; track $index) {
+
-
-
+ }
+
+
diff --git a/web-admin-app/src/app/pages/flow/flow-main/flow-main.component.ts b/web-admin-app/src/app/pages/flow/flow-main/flow-main.component.ts
index 359f3be..394501e 100644
--- a/web-admin-app/src/app/pages/flow/flow-main/flow-main.component.ts
+++ b/web-admin-app/src/app/pages/flow/flow-main/flow-main.component.ts
@@ -47,10 +47,23 @@ export class FlowMainComponent implements OnInit {
assetFlows: NzSafeAny[] = []
+ deviceFlows: NzSafeAny[] = []
+
loading = false
+ assetcounter: any = {
+ count: 0,
+ increase: 0,
+ todo: 0,
+ }
+ devicecounter: any = {
+ count: 0,
+ increase: 0,
+ todo: 0,
+ }
ngOnInit(): void {
this.loading = true
+ this.getCounter()
this.api
.getFlowForms({})
.pipe(
@@ -59,15 +72,32 @@ export class FlowMainComponent implements OnInit {
}),
)
.subscribe((res) => {
- this.assetFlows = res.body.map((i: NzSafeAny) => {
- return {
- ...i,
- enabled: Boolean(comsMap[i.formKey as keyof typeof comsMap]),
+ res.body.forEach((i: NzSafeAny) => {
+ const enabled = Boolean(comsMap[i.formKey as keyof typeof comsMap])
+ const formType = (i.formKey as string).split('_').splice(-1)[0]
+ console.log('formType', formType)
+ const item = { ...i, enabled, formType }
+ if (i.type === '设备流程') {
+ this.deviceFlows.push(item)
+ } else {
+ this.assetFlows.push(item)
}
})
})
}
+ getCounter() {
+ this.api.getFlowHomeData().subscribe((res) => {
+ res.body?.forEach((i: NzSafeAny) => {
+ if (i.type === '设备流程') {
+ this.devicecounter = i
+ } else {
+ this.assetFlows = i
+ }
+ })
+ })
+ }
+
onStart(model: NzSafeAny) {
this.modal.create({
nzTitle: '开始流程',
@@ -83,6 +113,7 @@ export class FlowMainComponent implements OnInit {
if (vals) {
const res = await lastValueFrom(this.api.startFlow(vals, model.formKey))
this.msg.success(res.desc)
+ this.getCounter()
return true
}
return false
@@ -116,7 +147,7 @@ export class FlowMainComponent implements OnInit {
const res = await lastValueFrom(this.api.createTask({ ...vals, jobType: type }))
this.msg.success(res.desc)
}
-
+ this.getCounter()
return true
}
return false
diff --git a/web-admin-app/src/app/pages/flow/flow-management/flow-management.component.html b/web-admin-app/src/app/pages/flow/flow-management/flow-management.component.html
index a98afbc..2ca4f6e 100644
--- a/web-admin-app/src/app/pages/flow/flow-management/flow-management.component.html
+++ b/web-admin-app/src/app/pages/flow/flow-management/flow-management.component.html
@@ -1 +1,47 @@
-
flow-management works!
+
+
+
+
+ @switch (key) {
+ @case ('checkRequire') {
+ {{ data ? '是' : '否' }}
+ }
+ @case ('status') {
+ @if (data === 0) {
+
+ } @else {
+
+ }
+ }
+ @case ('autoAssign') {
+ @if (row.type !== '资管流程') {
+
+
+
+ } @else {
+ /
+ }
+ }
+ @default {
+ {{ data }}
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web-admin-app/src/app/pages/flow/flow-management/flow-management.component.ts b/web-admin-app/src/app/pages/flow/flow-management/flow-management.component.ts
index 495f135..6d30b62 100644
--- a/web-admin-app/src/app/pages/flow/flow-management/flow-management.component.ts
+++ b/web-admin-app/src/app/pages/flow/flow-management/flow-management.component.ts
@@ -1,12 +1,187 @@
-import { Component } from '@angular/core';
+import { Component, TemplateRef, ViewChild } from '@angular/core'
+import { FormControl, FormGroup } from '@angular/forms'
+
+import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table'
+import { ApiService } from 'app/services'
+import { SharedModule } from 'app/shared/shared.module'
+
+import { lastValueFrom, map, of } from 'rxjs'
+import { NzSafeAny } from 'ng-zorro-antd/core/types'
+import { NzModalService } from 'ng-zorro-antd/modal'
+import { NzMessageService } from 'ng-zorro-antd/message'
+import { FormValidators } from 'app/utils'
+import { SelectUserByOrgComponent } from 'app/components'
+import { MAX_PAGE_SIZE, taskTypeTitle } from 'app/constants'
+import { FlowFormV2Component } from 'app/components/flow-form-v2/flow-form-v2.component'
@Component({
- selector: 'app-flow-management',
- standalone: true,
- imports: [],
- templateUrl: './flow-management.component.html',
- styleUrl: './flow-management.component.less'
+ selector: 'app-flow-form',
+ standalone: true,
+ imports: [SharedModule, SelectUserByOrgComponent],
+ templateUrl: './flow-management.component.html',
+ styleUrl: './flow-management.component.less',
})
export class FlowManagementComponent {
+ constructor(
+ private api: ApiService,
+ private modal: NzModalService,
+ private msg: NzMessageService,
+ ) {}
+
+ @ViewChild('createFormTpl') createFormTpl!: TemplateRef<{}>
+
+ createForm = new FormGroup({
+ formId: new FormControl(''),
+ userId: new FormControl
([], [FormValidators.required('请选择')]),
+ })
+
+ table = new TableOption(this.fetchData.bind(this))
+
+ ngOnInit(): void {
+ this.table
+ // .setConfig({
+ // selectable: true,
+ // rowKey: 'id',
+ // })
+ .setColumn([
+ { key: 'formId', title: '主键', width: '100px', visible: true },
+ { key: 'formKey', title: '标识', width: '250px', visible: true },
+ { key: 'name', title: '名称', visible: true },
+ { key: 'deployId', title: '流程ID', width: '100px', visible: true },
+ { key: 'type', title: '流程分类', visible: true },
+ { key: 'status', title: '流程状态', visible: true },
+ { key: 'checkRequire', title: '验收要求', visible: true },
+ { key: 'autoAssign', title: '自动指派', visible: true },
+ // { key: '_assignee', title: '审批人', visible: true },
+ // { key: 'createTime', title: '创建时间', visible: true },
+ ])
+ .setRowOperate([
+ { title: '编辑', onClick: this.onEdit.bind(this) },
+ {
+ title: '禁用',
+ onClick: this.onStop.bind(this),
+ visible(v) {
+ return v.status === 0
+ },
+ },
+ {
+ title: '启用',
+ onClick: this.onStop.bind(this),
+ visible(v) {
+ return v.status === 1
+ },
+ },
+ ])
+ }
+
+ updateAutoAssign(d: any) {
+ this.modal.confirm({
+ nzTitle: '警告',
+ nzContent: `是否要${d.autoAssign ? '关闭' : '开启'}自动指派?`,
+ nzOkText: '确定',
+ nzCancelText: '取消',
+ nzOnOk: async () => {
+ const res = await lastValueFrom(
+ this.api.flowFormUpdate({
+ ...d,
+ autoAssign: !d.autoAssign,
+ }),
+ )
+ this.msg.success(res.desc)
+ this.table.ref.reload()
+ },
+ })
+ }
+ fetchData(p: {}, q: AnyObject) {
+ return this.api.getFlowForms({ ...p, ...q }).pipe(
+ map((r) => {
+ return {
+ body: {
+ rows: r.body,
+ total: r.body.length,
+ },
+ }
+ }),
+ )
+ }
+
+ onEdit(d: NzSafeAny) {
+ const nzTitle = '编辑' + d.type
+ this.modal.create({
+ nzTitle,
+ nzContent: FlowFormV2Component,
+ nzWrapClassName: 'modal-lg',
+ nzWidth: '80vw',
+
+ nzData: {
+ value: d,
+ preview: false,
+ type: d.type,
+ },
+ nzOnOk: async (e: NzSafeAny) => {
+ const vals = e.getValues()
+ console.log('vals', vals)
+ if (vals) {
+ const res = await lastValueFrom(this.api.flowFormUpdate({ ...d, ...vals }))
+ this.msg.success(res.desc)
+ this.table.ref.reload()
+ return true
+ }
+ return false
+ },
+ nzOnCancel: () => {
+ console.log('Cancel')
+ },
+ })
+ }
+
+ onStop(d: NzSafeAny) {
+ this.modal.confirm({
+ nzTitle: '警告',
+ nzContent: `是否要${d.status ? '启用' : '禁用'}流程?`,
+
+ nzOnOk: async () => {
+ const res = await lastValueFrom(
+ this.api.flowFormUpdate({
+ ...d,
+ status: d.status === 1 ? 0 : 1,
+ }),
+ )
+ this.msg.success(res.desc)
+ this.table.ref.reload()
+ },
+ })
+ }
+ onSetApprover(data?: NzSafeAny) {
+ if (data) {
+ this.createForm.patchValue({
+ formId: data.formId,
+ userId: data._assignee.userId ? [data._assignee.userId] : [],
+ })
+ }
+ this.modal.create({
+ nzTitle: '设置审批人',
+ nzContent: this.createFormTpl,
+ nzOnOk: async () => {
+ if (FormValidators.validateFormGroup(this.createForm)) {
+ const vals = this.createForm.value
+ const res = await lastValueFrom(
+ this.api.setFlowFormsAssignee({
+ ...vals,
+ userId: vals.userId?.[0],
+ }),
+ )
+ this.msg.success(res.desc)
+ this.table.ref.reload()
+ this.createForm.reset()
+ return true
+ }
+ return false
+ },
+ nzOnCancel: () => {
+ this.createForm.reset()
+ },
+ })
+ }
}
diff --git a/web-admin-app/src/app/pages/flow/flow-my-apply/flow-my-apply.component.html b/web-admin-app/src/app/pages/flow/flow-my-apply/flow-my-apply.component.html
index 2a60d57..c2380bf 100644
--- a/web-admin-app/src/app/pages/flow/flow-my-apply/flow-my-apply.component.html
+++ b/web-admin-app/src/app/pages/flow/flow-my-apply/flow-my-apply.component.html
@@ -12,7 +12,7 @@
{{ data.userName }}
}
@case ('procVars') {
- {{ data?.title }}
+ {{ data?.title ?? data?.name ?? '-' }}
}
@case ('status') {
diff --git a/web-admin-app/src/app/pages/flow/flow-my-apply/flow-my-apply.component.ts b/web-admin-app/src/app/pages/flow/flow-my-apply/flow-my-apply.component.ts
index e569fe9..262d00c 100644
--- a/web-admin-app/src/app/pages/flow/flow-my-apply/flow-my-apply.component.ts
+++ b/web-admin-app/src/app/pages/flow/flow-my-apply/flow-my-apply.component.ts
@@ -12,7 +12,7 @@ import { NzMessageService } from 'ng-zorro-antd/message'
import { FormValidators } from 'app/utils'
import { AssetEmployeeApplyComponent } from 'app/components'
import { comsMap } from '../flow-main/flow-main.component'
-import { FLOW_STATUS } from 'app/constants'
+import { FLOW_STATUS, flowIntStatus } from 'app/constants'
@Component({
selector: 'app-flow-my-apply',
@@ -41,7 +41,7 @@ export class FlowMyApplyComponent {
name: new FormControl(''),
})
- FLOW_STATUS = FLOW_STATUS
+ FLOW_STATUS = flowIntStatus
ngOnInit(): void {
this.table
// .setConfig({
diff --git a/web-admin-app/src/app/pages/flow/flow-my-finished/flow-my-finished.component.html b/web-admin-app/src/app/pages/flow/flow-my-finished/flow-my-finished.component.html
index baf0c28..c2380bf 100644
--- a/web-admin-app/src/app/pages/flow/flow-my-finished/flow-my-finished.component.html
+++ b/web-admin-app/src/app/pages/flow/flow-my-finished/flow-my-finished.component.html
@@ -12,7 +12,7 @@
{{ data.userName }}
}
@case ('procVars') {
- {{ data.title }}
+ {{ data?.title ?? data?.name ?? '-' }}
}
@case ('status') {
diff --git a/web-admin-app/src/app/pages/flow/flow-my-finished/flow-my-finished.component.ts b/web-admin-app/src/app/pages/flow/flow-my-finished/flow-my-finished.component.ts
index f10a9eb..6be7ba3 100644
--- a/web-admin-app/src/app/pages/flow/flow-my-finished/flow-my-finished.component.ts
+++ b/web-admin-app/src/app/pages/flow/flow-my-finished/flow-my-finished.component.ts
@@ -11,7 +11,7 @@ import { NzModalService } from 'ng-zorro-antd/modal'
import { NzMessageService } from 'ng-zorro-antd/message'
import { FormValidators } from 'app/utils'
import { comsMap } from '../flow-main/flow-main.component'
-import { FLOW_STATUS } from 'app/constants'
+import { FLOW_STATUS, flowIntStatus } from 'app/constants'
@Component({
selector: 'app-flow-my-finished',
@@ -40,7 +40,7 @@ export class FlowMyFinishedComponent {
name: new FormControl(''),
})
- FLOW_STATUS = FLOW_STATUS
+ FLOW_STATUS = flowIntStatus
ngOnInit(): void {
this.table
diff --git a/web-admin-app/src/app/pages/flow/flow-my-todo/flow-my-todo.component.html b/web-admin-app/src/app/pages/flow/flow-my-todo/flow-my-todo.component.html
index bb2bc26..69a4e8b 100644
--- a/web-admin-app/src/app/pages/flow/flow-my-todo/flow-my-todo.component.html
+++ b/web-admin-app/src/app/pages/flow/flow-my-todo/flow-my-todo.component.html
@@ -12,7 +12,7 @@
{{ data.userName }}
}
@case ('procVars') {
- {{ data.title }}
+ {{ data?.title ?? data?.name ?? '-' }}
}
@case ('status') {
diff --git a/web-admin-app/src/app/pages/flow/flow-my-todo/flow-my-todo.component.ts b/web-admin-app/src/app/pages/flow/flow-my-todo/flow-my-todo.component.ts
index acf4ab0..a51af71 100644
--- a/web-admin-app/src/app/pages/flow/flow-my-todo/flow-my-todo.component.ts
+++ b/web-admin-app/src/app/pages/flow/flow-my-todo/flow-my-todo.component.ts
@@ -11,7 +11,7 @@ import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'
import { NzMessageService } from 'ng-zorro-antd/message'
import { FormValidators } from 'app/utils'
import { comsMap } from '../flow-main/flow-main.component'
-import { FLOW_STATUS } from 'app/constants'
+import { FLOW_STATUS, flowIntStatus } from 'app/constants'
@Component({
selector: 'app-flow-my-todo',
@@ -44,7 +44,7 @@ export class FlowMyTodoComponent {
name: new FormControl(''),
})
- FLOW_STATUS = FLOW_STATUS
+ FLOW_STATUS = flowIntStatus
ngOnInit(): void {
this.table
// .setConfig({
diff --git a/web-admin-app/src/app/pages/msg/flow-msg/flow-msg.component.ts b/web-admin-app/src/app/pages/msg/flow-msg/flow-msg.component.ts
index d944139..d2d9c12 100644
--- a/web-admin-app/src/app/pages/msg/flow-msg/flow-msg.component.ts
+++ b/web-admin-app/src/app/pages/msg/flow-msg/flow-msg.component.ts
@@ -29,9 +29,9 @@ export class FlowMsgComponent {
@ViewChild('createFormTpl') createFormTpl!: TemplateRef<{}>
queryForm = new FormGroup({
- logContent: new FormControl(''),
- logType: new FormControl(''),
- createTime: new FormControl(''),
+ logContent: new FormControl(null),
+ logType: new FormControl(null),
+ createTime: new FormControl(null),
})
table = new TableOption(this.fetchData.bind(this))
@@ -52,6 +52,6 @@ export class FlowMsgComponent {
}
fetchData(p: {}, q: AnyObject) {
- return this.api.getAlarmMsg({ ...p, ...q })
+ return this.api.getFlowMsg({ ...p, ...q })
}
}
diff --git a/web-admin-app/src/app/services/api.service.ts b/web-admin-app/src/app/services/api.service.ts
index b4c7095..05fee66 100644
--- a/web-admin-app/src/app/services/api.service.ts
+++ b/web-admin-app/src/app/services/api.service.ts
@@ -584,11 +584,16 @@ export class ApiService {
return this.http.post(`/api/flowable/task/revokeProcess`, data)
}
rejectProcessFlow(data: {}) {
+ // 驳回
return this.http.post(`/api/flowable/task/reject`, data)
}
completeProcessFlow(data: {}) {
+ // 通过
return this.http.post(`/api/flowable/task/complete`, data)
}
+ handleTaskAssetItem(data: {}, id: string) {
+ return this.http.post(`/api/v2/flowable/device/update/${id}`, { variables: data })
+ }
cancelFlow(data: {}) {
return this.http.post(`/api/flowable/task/stopProcess`, data)
}
@@ -661,8 +666,17 @@ export class ApiService {
getPlanPage(data: {}) {
return this.http.post(`/api/v2/plan/list`, data)
}
- savePlan(data: {}) {
- return this.http.post(`/api/v2/plan/add`, data)
+ savePlan(data: NzSafeAny) {
+ if (Utils.isEmpty(data.jobId)) {
+ return this.http.post(`/api/v2/plan/add`, data)
+ }
+ return this.http.post('/api/v2/plan/update', data)
+ }
+ deletePlan(data: {}) {
+ return this.http.post(`/api/v2/plan/delete`, data)
+ }
+ changePlanStatus(data: {}) {
+ return this.http.post(`/api/v2/plan/changeStatus`, data)
}
createRapairTask(data: {}) {
return this.http.post(`/api/v2/flowable/device/start/repair`, data)
@@ -670,6 +684,12 @@ export class ApiService {
createTask(data: {}) {
return this.http.post(`/api/v2/flowable/device/start`, data)
}
+ takeTask(data: {}) {
+ return this.http.post(`/api/flowable/task/claim`, data)
+ }
+ assignTask(data: {}) {
+ return this.http.post(`/api/flowable/task/assignTask`, data)
+ }
getSysLog(data: {}) {
return this.http.post('/api/v2/sysLog/list', data)
@@ -677,4 +697,16 @@ export class ApiService {
getAlarmMsg(data: {}) {
return this.http.post('/api/v2/alarm/list', data)
}
+ getFlowMsg(data: {}) {
+ return this.http.post('/api/flowable/task/todoListMSG ', data)
+ }
+ getCalendarData(data: {}) {
+ return this.http.post('/api/flFormItem/calendar', data)
+ }
+ getFlowHomeData() {
+ return this.http.post('/api/flFormItem/home', null)
+ }
+ flowFormUpdate(d: {}) {
+ return this.http.post('/api/flForm/update', d)
+ }
}
diff --git a/web-admin-app/src/styles.less b/web-admin-app/src/styles.less
index a7c3553..a2e02c6 100644
--- a/web-admin-app/src/styles.less
+++ b/web-admin-app/src/styles.less
@@ -45,6 +45,7 @@ body {
}
+
::-webkit-scrollbar {
width: 8px;
height: 8px;
@@ -72,7 +73,8 @@ body {
// }
}
- .modal-lg-container {
+ .modal-lg-container,
+ .ant-modal-body {
height: 70vh;
overflow: auto;
}