review:代码审查

This commit is contained in:
smallNorthLee 2025-02-25 22:42:46 +08:00
parent 59528284ca
commit 303bbbdd7f
3 changed files with 46 additions and 65 deletions

View File

@ -36,8 +36,16 @@
:rule="approveForm.rule"
/>
</el-card>
<el-form-item :label="`${nodeTypeName}意见`" prop="reason">
<el-input
v-model="approveReasonForm.reason"
:placeholder="`请输入${nodeTypeName}意见`"
type="textarea"
:rows="4"
/>
</el-form-item>
<el-form-item
label="选择审批人"
label="选择下一个节点的审批人"
prop="selectApproveUser"
v-if="dialogVisibleSelectApproveUser"
>
@ -48,14 +56,6 @@
@select-user-confirm="selectUserConfirm"
/>
</el-form-item>
<el-form-item :label="`${nodeTypeName}意见`" prop="reason">
<el-input
v-model="approveReasonForm.reason"
:placeholder="`请输入${nodeTypeName}意见`"
type="textarea"
:rows="4"
/>
</el-form-item>
<el-form-item
v-if="runningTask.signEnable"
label="签名"
@ -695,30 +695,7 @@ const openPopover = async (type: string) => {
message.warning('表单校验不通过,请先完善表单!!')
return
}
// ,
const variables = getUpdatedProcessInstanceVariables()
const param = {
processInstanceId: props.processInstance.id,
processVariablesStr: JSON.stringify(variables)
}
//
const res = await ProcessInstanceApi.getApprovalDetail(param)
//id
const activityId = res.todoTask?.taskDefinitionKey
if (res.activityNodes && res.activityNodes.length > 0) {
//
const currentNodeIndex = res.activityNodes.findIndex((node) => node.id === activityId)
const nextNode = res.activityNodes[currentNodeIndex + 1]
if (
nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
!nextNode.tasks &&
nextNode.candidateUsers?.length === 0
) {
//
activityNodes.value = [nextNode]
dialogVisibleSelectApproveUser.value = true
}
}
initNextTaskSelectAssigneeFormField()
}
if (type === 'return') {
// 退
@ -744,6 +721,33 @@ const closePropover = (type: string, formRef: FormInstance | undefined) => {
dialogVisibleSelectApproveUser.value = false
}
/** // 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人 */
const initNextTaskSelectAssigneeFormField = async () => {
// ,
const variables = getUpdatedProcessInstanceVariables()
const param = {
processInstanceId: props.processInstance.id,
processVariablesStr: JSON.stringify(variables)
}
const res = await ProcessInstanceApi.getApprovalDetail(param)
//id
const activityId = res.todoTask?.taskDefinitionKey
if (res.activityNodes && res.activityNodes.length > 0) {
//
const currentNodeIndex = res.activityNodes.findIndex((node) => node.id === activityId)
const nextNode = res.activityNodes[currentNodeIndex + 1]
if (
nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
!nextNode.tasks &&
nextNode.candidateUsers?.length === 0
) {
//
activityNodes.value = [nextNode]
dialogVisibleSelectApproveUser.value = true
}
}
}
/** 处理审批通过和不通过的操作 */
const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) => {
formLoading.value = true
@ -764,33 +768,10 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
dialogVisibleSelectApproveUser.value &&
Object.keys(approveReasonForm.selectApproveUser).length === 0
) {
message.warning('审批人不能为空!')
message.warning('下一个节点的审批人不能为空!')
return
}
// ,
const variables = getUpdatedProcessInstanceVariables()
const param = {
processInstanceId: props.processInstance.id,
processVariablesStr: JSON.stringify(variables)
}
//
const res = await ProcessInstanceApi.getApprovalDetail(param)
//id
const activityId = res.todoTask?.taskDefinitionKey
if (res.activityNodes && res.activityNodes.length > 0) {
//
const currentNodeIndex = res.activityNodes.findIndex((node) => node.id === activityId)
const nextNode = res.activityNodes[currentNodeIndex + 1]
if (
nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
!nextNode.tasks &&
nextNode.candidateUsers?.length === 0
) {
//
activityNodes.value = [nextNode]
dialogVisibleSelectApproveUser.value = true
}
}
//
const data = {
id: runningTask.value.id,

View File

@ -48,7 +48,7 @@ watch(
finishedActivityIds,
finishedSequenceFlowActivityIds
)
simpleModel.value = newModelView.simpleModel == null ? {} : newModelView.simpleModel
simpleModel.value = newModelView.simpleModel ? newModelView.simpleModel : {}
}
}
)

View File

@ -178,21 +178,21 @@ const writableFields: Array<string> = [] // 表单可以编辑的字段
/** 获得详情 */
const getDetail = () => {
const param = {
processInstanceId: props.id,
activityId: props.activityId,
taskId: props.taskId
}
getApprovalDetail(param)
getApprovalDetail()
getProcessModelView()
}
/** 加载流程实例 */
const BusinessFormComponent = ref<any>(null) //
/** 获取审批详情 */
const getApprovalDetail = async (param?: any) => {
const getApprovalDetail = async () => {
processInstanceLoading.value = true
try {
const param = {
processInstanceId: props.id,
activityId: props.activityId,
taskId: props.taskId
}
const data = await ProcessInstanceApi.getApprovalDetail(param)
if (!data) {
message.error('查询不到审批详情信息!')