Skip to content

Commit 303bbbd

Browse files
committed
review:代码审查
1 parent 5952828 commit 303bbbd

File tree

3 files changed

+46
-65
lines changed

3 files changed

+46
-65
lines changed

src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue

Lines changed: 38 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,16 @@
3636
:rule="approveForm.rule"
3737
/>
3838
</el-card>
39+
<el-form-item :label="`${nodeTypeName}意见`" prop="reason">
40+
<el-input
41+
v-model="approveReasonForm.reason"
42+
:placeholder="`请输入${nodeTypeName}意见`"
43+
type="textarea"
44+
:rows="4"
45+
/>
46+
</el-form-item>
3947
<el-form-item
40-
label="选择审批人"
48+
label="选择下一个节点的审批人"
4149
prop="selectApproveUser"
4250
v-if="dialogVisibleSelectApproveUser"
4351
>
@@ -48,14 +56,6 @@
4856
@select-user-confirm="selectUserConfirm"
4957
/>
5058
</el-form-item>
51-
<el-form-item :label="`${nodeTypeName}意见`" prop="reason">
52-
<el-input
53-
v-model="approveReasonForm.reason"
54-
:placeholder="`请输入${nodeTypeName}意见`"
55-
type="textarea"
56-
:rows="4"
57-
/>
58-
</el-form-item>
5959
<el-form-item
6060
v-if="runningTask.signEnable"
6161
label="签名"
@@ -695,30 +695,7 @@ const openPopover = async (type: string) => {
695695
message.warning('表单校验不通过,请先完善表单!!')
696696
return
697697
}
698-
// 获取修改的流程变量, 暂时只支持流程表单
699-
const variables = getUpdatedProcessInstanceVariables()
700-
const param = {
701-
processInstanceId: props.processInstance.id,
702-
processVariablesStr: JSON.stringify(variables)
703-
}
704-
// 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人
705-
const res = await ProcessInstanceApi.getApprovalDetail(param)
706-
//当前待审批节点id
707-
const activityId = res.todoTask?.taskDefinitionKey
708-
if (res.activityNodes && res.activityNodes.length > 0) {
709-
// 找到当前节点的索引
710-
const currentNodeIndex = res.activityNodes.findIndex((node) => node.id === activityId)
711-
const nextNode = res.activityNodes[currentNodeIndex + 1]
712-
if (
713-
nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
714-
!nextNode.tasks &&
715-
nextNode.candidateUsers?.length === 0
716-
) {
717-
// 自选审批人,则弹出选择审批人弹窗
718-
activityNodes.value = [nextNode]
719-
dialogVisibleSelectApproveUser.value = true
720-
}
721-
}
698+
initNextTaskSelectAssigneeFormField()
722699
}
723700
if (type === 'return') {
724701
// 获取退回节点
@@ -744,6 +721,33 @@ const closePropover = (type: string, formRef: FormInstance | undefined) => {
744721
dialogVisibleSelectApproveUser.value = false
745722
}
746723
724+
/** // 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */
725+
const initNextTaskSelectAssigneeFormField = async () => {
726+
// 获取修改的流程变量, 暂时只支持流程表单
727+
const variables = getUpdatedProcessInstanceVariables()
728+
const param = {
729+
processInstanceId: props.processInstance.id,
730+
processVariablesStr: JSON.stringify(variables)
731+
}
732+
const res = await ProcessInstanceApi.getApprovalDetail(param)
733+
//当前待审批节点id
734+
const activityId = res.todoTask?.taskDefinitionKey
735+
if (res.activityNodes && res.activityNodes.length > 0) {
736+
// 找到当前节点的索引
737+
const currentNodeIndex = res.activityNodes.findIndex((node) => node.id === activityId)
738+
const nextNode = res.activityNodes[currentNodeIndex + 1]
739+
if (
740+
nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
741+
!nextNode.tasks &&
742+
nextNode.candidateUsers?.length === 0
743+
) {
744+
// 自选审批人,则弹出选择审批人弹窗
745+
activityNodes.value = [nextNode]
746+
dialogVisibleSelectApproveUser.value = true
747+
}
748+
}
749+
}
750+
747751
/** 处理审批通过和不通过的操作 */
748752
const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) => {
749753
formLoading.value = true
@@ -764,33 +768,10 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
764768
dialogVisibleSelectApproveUser.value &&
765769
Object.keys(approveReasonForm.selectApproveUser).length === 0
766770
) {
767-
message.warning('审批人不能为空!')
771+
message.warning('下一个节点的审批人不能为空!')
768772
return
769773
}
770-
// 获取修改的流程变量, 暂时只支持流程表单
771774
const variables = getUpdatedProcessInstanceVariables()
772-
const param = {
773-
processInstanceId: props.processInstance.id,
774-
processVariablesStr: JSON.stringify(variables)
775-
}
776-
// 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人
777-
const res = await ProcessInstanceApi.getApprovalDetail(param)
778-
//当前待审批节点id
779-
const activityId = res.todoTask?.taskDefinitionKey
780-
if (res.activityNodes && res.activityNodes.length > 0) {
781-
// 找到当前节点的索引
782-
const currentNodeIndex = res.activityNodes.findIndex((node) => node.id === activityId)
783-
const nextNode = res.activityNodes[currentNodeIndex + 1]
784-
if (
785-
nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
786-
!nextNode.tasks &&
787-
nextNode.candidateUsers?.length === 0
788-
) {
789-
// 自选审批人,则弹出选择审批人弹窗
790-
activityNodes.value = [nextNode]
791-
dialogVisibleSelectApproveUser.value = true
792-
}
793-
}
794775
// 审批通过数据
795776
const data = {
796777
id: runningTask.value.id,

src/views/bpm/processInstance/detail/ProcessInstanceSimpleViewer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ watch(
4848
finishedActivityIds,
4949
finishedSequenceFlowActivityIds
5050
)
51-
simpleModel.value = newModelView.simpleModel == null ? {} : newModelView.simpleModel
51+
simpleModel.value = newModelView.simpleModel ? newModelView.simpleModel : {}
5252
}
5353
}
5454
)

src/views/bpm/processInstance/detail/index.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,21 +178,21 @@ const writableFields: Array<string> = [] // 表单可以编辑的字段
178178
179179
/** 获得详情 */
180180
const getDetail = () => {
181-
const param = {
182-
processInstanceId: props.id,
183-
activityId: props.activityId,
184-
taskId: props.taskId
185-
}
186-
getApprovalDetail(param)
181+
getApprovalDetail()
187182
getProcessModelView()
188183
}
189184
190185
/** 加载流程实例 */
191186
const BusinessFormComponent = ref<any>(null) // 异步组件
192187
/** 获取审批详情 */
193-
const getApprovalDetail = async (param?: any) => {
188+
const getApprovalDetail = async () => {
194189
processInstanceLoading.value = true
195190
try {
191+
const param = {
192+
processInstanceId: props.id,
193+
activityId: props.activityId,
194+
taskId: props.taskId
195+
}
196196
const data = await ProcessInstanceApi.getApprovalDetail(param)
197197
if (!data) {
198198
message.error('查询不到审批详情信息!')

0 commit comments

Comments
 (0)