|
@@ -44,8 +44,26 @@
|
|
:rows="4"
|
|
:rows="4"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ v-if="runningTask.signEnable"
|
|
|
|
+ label="签名"
|
|
|
|
+ prop="signPicUrl"
|
|
|
|
+ ref="approveSignFormRef"
|
|
|
|
+ >
|
|
|
|
+ <el-button @click="signRef.open()">点击签名</el-button>
|
|
|
|
+ <el-image
|
|
|
|
+ class="w-90px h-40px ml-5px"
|
|
|
|
+ v-if="approveReasonForm.signPicUrl"
|
|
|
|
+ :src="approveReasonForm.signPicUrl"
|
|
|
|
+ :preview-src-list="[approveReasonForm.signPicUrl]"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button :disabled="formLoading" type="success" @click="handleAudit(true, approveFormRef)">
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ :disabled="formLoading"
|
|
|
|
+ type="success"
|
|
|
|
+ @click="handleAudit(true, approveFormRef)"
|
|
|
|
+ >
|
|
{{ getButtonDisplayName(OperationButtonType.APPROVE) }}
|
|
{{ getButtonDisplayName(OperationButtonType.APPROVE) }}
|
|
</el-button>
|
|
</el-button>
|
|
<el-button @click="closePropover('approve', approveFormRef)"> 取消 </el-button>
|
|
<el-button @click="closePropover('approve', approveFormRef)"> 取消 </el-button>
|
|
@@ -86,7 +104,11 @@
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button :disabled="formLoading" type="danger" @click="handleAudit(false,rejectFormRef)">
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ :disabled="formLoading"
|
|
|
|
+ type="danger"
|
|
|
|
+ @click="handleAudit(false, rejectFormRef)"
|
|
|
|
+ >
|
|
{{ getButtonDisplayName(OperationButtonType.REJECT) }}
|
|
{{ getButtonDisplayName(OperationButtonType.REJECT) }}
|
|
</el-button>
|
|
</el-button>
|
|
<el-button @click="closePropover('reject', rejectFormRef)"> 取消 </el-button>
|
|
<el-button @click="closePropover('reject', rejectFormRef)"> 取消 </el-button>
|
|
@@ -471,6 +493,9 @@
|
|
<Icon :size="14" icon="ep:refresh" /> 再次提交
|
|
<Icon :size="14" icon="ep:refresh" /> 再次提交
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <!-- 签名弹窗 -->
|
|
|
|
+ <SignDialog ref="signRef" @success="handleSignFinish" />
|
|
</template>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { useUserStoreWithOut } from '@/store/modules/user'
|
|
import { useUserStoreWithOut } from '@/store/modules/user'
|
|
@@ -479,11 +504,13 @@ import * as TaskApi from '@/api/bpm/task'
|
|
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
|
|
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
|
|
import * as UserApi from '@/api/system/user'
|
|
import * as UserApi from '@/api/system/user'
|
|
import {
|
|
import {
|
|
- OperationButtonType,
|
|
|
|
- OPERATION_BUTTON_NAME
|
|
|
|
|
|
+ OPERATION_BUTTON_NAME,
|
|
|
|
+ OperationButtonType
|
|
} from '@/components/SimpleProcessDesignerV2/src/consts'
|
|
} from '@/components/SimpleProcessDesignerV2/src/consts'
|
|
-import { BpmProcessInstanceStatus, BpmModelFormType } from '@/utils/constants'
|
|
|
|
|
|
+import { BpmModelFormType, BpmProcessInstanceStatus } from '@/utils/constants'
|
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
|
|
+import SignDialog from './SignDialog.vue'
|
|
|
|
+
|
|
defineOptions({ name: 'ProcessInstanceBtnContainer' })
|
|
defineOptions({ name: 'ProcessInstanceBtnContainer' })
|
|
|
|
|
|
const router = useRouter() // 路由
|
|
const router = useRouter() // 路由
|
|
@@ -492,12 +519,12 @@ const message = useMessage() // 消息弹窗
|
|
const userId = useUserStoreWithOut().getUser.id // 当前登录的编号
|
|
const userId = useUserStoreWithOut().getUser.id // 当前登录的编号
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
|
|
|
|
-const props = defineProps< {
|
|
|
|
- processInstance: any, // 流程实例信息
|
|
|
|
- processDefinition: any, // 流程定义信息
|
|
|
|
- userOptions: UserApi.UserVO[],
|
|
|
|
- normalForm: any, // 流程表单 formCreate
|
|
|
|
- normalFormApi: any, // 流程表单 formCreate Api
|
|
|
|
|
|
+const props = defineProps<{
|
|
|
|
+ processInstance: any // 流程实例信息
|
|
|
|
+ processDefinition: any // 流程定义信息
|
|
|
|
+ userOptions: UserApi.UserVO[]
|
|
|
|
+ normalForm: any // 流程表单 formCreate
|
|
|
|
+ normalFormApi: any // 流程表单 formCreate Api
|
|
writableFields: string[] // 流程表单可以编辑的字段
|
|
writableFields: string[] // 流程表单可以编辑的字段
|
|
}>()
|
|
}>()
|
|
|
|
|
|
@@ -521,20 +548,29 @@ const approveForm = ref<any>({}) // 审批通过时,额外的补充信息
|
|
const approveFormFApi = ref<any>({}) // approveForms 的 fAPi
|
|
const approveFormFApi = ref<any>({}) // approveForms 的 fAPi
|
|
|
|
|
|
// 审批通过意见表单
|
|
// 审批通过意见表单
|
|
|
|
+const reasonRequire = ref()
|
|
const approveFormRef = ref<FormInstance>()
|
|
const approveFormRef = ref<FormInstance>()
|
|
|
|
+const signRef = ref()
|
|
|
|
+const approveSignFormRef = ref()
|
|
const approveReasonForm = reactive({
|
|
const approveReasonForm = reactive({
|
|
- reason: ''
|
|
|
|
|
|
+ reason: '',
|
|
|
|
+ signPicUrl: ''
|
|
})
|
|
})
|
|
-const approveReasonRule = reactive<FormRules<typeof approveReasonForm>>({
|
|
|
|
- reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
|
|
|
|
|
|
+const approveReasonRule = computed(() => {
|
|
|
|
+ return {
|
|
|
|
+ reason: [{ required: reasonRequire.value, message: '审批意见不能为空', trigger: 'blur' }],
|
|
|
|
+ signPicUrl: [{ required: true, message: '签名不能为空', trigger: 'change' }]
|
|
|
|
+ }
|
|
})
|
|
})
|
|
// 拒绝表单
|
|
// 拒绝表单
|
|
const rejectFormRef = ref<FormInstance>()
|
|
const rejectFormRef = ref<FormInstance>()
|
|
const rejectReasonForm = reactive({
|
|
const rejectReasonForm = reactive({
|
|
reason: ''
|
|
reason: ''
|
|
})
|
|
})
|
|
-const rejectReasonRule = reactive<FormRules<typeof rejectReasonForm>>({
|
|
|
|
- reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
|
|
|
|
|
|
+const rejectReasonRule = computed(() => {
|
|
|
|
+ return {
|
|
|
|
+ reason: [{ required: reasonRequire.value, message: '审批意见不能为空', trigger: 'blur' }]
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
|
|
// 抄送表单
|
|
// 抄送表单
|
|
@@ -555,7 +591,7 @@ const transferForm = reactive({
|
|
})
|
|
})
|
|
const transferFormRule = reactive<FormRules<typeof transferForm>>({
|
|
const transferFormRule = reactive<FormRules<typeof transferForm>>({
|
|
assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }],
|
|
assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }],
|
|
- reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
|
|
|
|
|
|
+ reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }]
|
|
})
|
|
})
|
|
|
|
|
|
// 委派表单
|
|
// 委派表单
|
|
@@ -566,7 +602,7 @@ const delegateForm = reactive({
|
|
})
|
|
})
|
|
const delegateFormRule = reactive<FormRules<typeof delegateForm>>({
|
|
const delegateFormRule = reactive<FormRules<typeof delegateForm>>({
|
|
delegateUserId: [{ required: true, message: '接收人不能为空', trigger: 'change' }],
|
|
delegateUserId: [{ required: true, message: '接收人不能为空', trigger: 'change' }],
|
|
- reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
|
|
|
|
|
|
+ reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }]
|
|
})
|
|
})
|
|
|
|
|
|
// 加签表单
|
|
// 加签表单
|
|
@@ -577,7 +613,7 @@ const addSignForm = reactive({
|
|
})
|
|
})
|
|
const addSignFormRule = reactive<FormRules<typeof addSignForm>>({
|
|
const addSignFormRule = reactive<FormRules<typeof addSignForm>>({
|
|
addSignUserIds: [{ required: true, message: '加签处理人不能为空', trigger: 'change' }],
|
|
addSignUserIds: [{ required: true, message: '加签处理人不能为空', trigger: 'change' }],
|
|
- reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
|
|
|
|
|
|
+ reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }]
|
|
})
|
|
})
|
|
|
|
|
|
// 减签表单
|
|
// 减签表单
|
|
@@ -588,7 +624,7 @@ const deleteSignForm = reactive({
|
|
})
|
|
})
|
|
const deleteSignFormRule = reactive<FormRules<typeof deleteSignForm>>({
|
|
const deleteSignFormRule = reactive<FormRules<typeof deleteSignForm>>({
|
|
deleteSignTaskId: [{ required: true, message: '减签人员不能为空', trigger: 'change' }],
|
|
deleteSignTaskId: [{ required: true, message: '减签人员不能为空', trigger: 'change' }],
|
|
- reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
|
|
|
|
|
|
+ reason: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }]
|
|
})
|
|
})
|
|
|
|
|
|
// 退回表单
|
|
// 退回表单
|
|
@@ -608,7 +644,7 @@ const cancelForm = reactive({
|
|
cancelReason: ''
|
|
cancelReason: ''
|
|
})
|
|
})
|
|
const cancelFormRule = reactive<FormRules<typeof cancelForm>>({
|
|
const cancelFormRule = reactive<FormRules<typeof cancelForm>>({
|
|
- cancelReason: [{ required: true, message: '取消理由不能为空', trigger: 'blur' }],
|
|
|
|
|
|
+ cancelReason: [{ required: true, message: '取消理由不能为空', trigger: 'blur' }]
|
|
})
|
|
})
|
|
|
|
|
|
/** 监听 approveFormFApis,实现它对应的 form-create 初始化后,隐藏掉对应的表单提交按钮 */
|
|
/** 监听 approveFormFApis,实现它对应的 form-create 初始化后,隐藏掉对应的表单提交按钮 */
|
|
@@ -627,11 +663,11 @@ watch(
|
|
const openPopover = async (type: string) => {
|
|
const openPopover = async (type: string) => {
|
|
if (type === 'approve') {
|
|
if (type === 'approve') {
|
|
// 校验流程表单
|
|
// 校验流程表单
|
|
- const valid = await validateNormalForm();
|
|
|
|
- if (!valid) {
|
|
|
|
|
|
+ const valid = await validateNormalForm()
|
|
|
|
+ if (!valid) {
|
|
message.warning('表单校验不通过,请先完善表单!!')
|
|
message.warning('表单校验不通过,请先完善表单!!')
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ return
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (type === 'return') {
|
|
if (type === 'return') {
|
|
// 获取退回节点
|
|
// 获取退回节点
|
|
@@ -652,7 +688,7 @@ const openPopover = async (type: string) => {
|
|
const closePropover = (type: string, formRef: FormInstance | undefined) => {
|
|
const closePropover = (type: string, formRef: FormInstance | undefined) => {
|
|
if (formRef) {
|
|
if (formRef) {
|
|
formRef.resetFields()
|
|
formRef.resetFields()
|
|
- }
|
|
|
|
|
|
+ }
|
|
popOverVisible.value[type] = false
|
|
popOverVisible.value[type] = false
|
|
}
|
|
}
|
|
|
|
|
|
@@ -664,14 +700,18 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
|
|
if (!formRef) return
|
|
if (!formRef) return
|
|
await formRef.validate()
|
|
await formRef.validate()
|
|
if (pass) {
|
|
if (pass) {
|
|
- // 获取修改的流程变量, 暂时只支持流程表单
|
|
|
|
- const variables = getUpdatedProcessInstanceVaiables();
|
|
|
|
|
|
+ // 获取修改的流程变量, 暂时只支持流程表单
|
|
|
|
+ const variables = getUpdatedProcessInstanceVariables()
|
|
// 审批通过数据
|
|
// 审批通过数据
|
|
const data = {
|
|
const data = {
|
|
id: runningTask.value.id,
|
|
id: runningTask.value.id,
|
|
reason: approveReasonForm.reason,
|
|
reason: approveReasonForm.reason,
|
|
variables // 审批通过, 把修改的字段值赋于流程实例变量
|
|
variables // 审批通过, 把修改的字段值赋于流程实例变量
|
|
}
|
|
}
|
|
|
|
+ // 签名
|
|
|
|
+ if (runningTask.value.signEnable) {
|
|
|
|
+ data.signPicUrl = approveReasonForm.signPicUrl
|
|
|
|
+ }
|
|
// 多表单处理,并且有额外的 approveForm 表单,需要校验 + 拼接到 data 表单里提交
|
|
// 多表单处理,并且有额外的 approveForm 表单,需要校验 + 拼接到 data 表单里提交
|
|
// TODO 芋艿 任务有多表单这里要如何处理,会和可编辑的字段冲突
|
|
// TODO 芋艿 任务有多表单这里要如何处理,会和可编辑的字段冲突
|
|
const formCreateApi = approveFormFApi.value
|
|
const formCreateApi = approveFormFApi.value
|
|
@@ -684,10 +724,10 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
|
|
popOverVisible.value.approve = false
|
|
popOverVisible.value.approve = false
|
|
message.success('审批通过成功')
|
|
message.success('审批通过成功')
|
|
} else {
|
|
} else {
|
|
- // 审批不通过数据
|
|
|
|
- const data = {
|
|
|
|
|
|
+ // 审批不通过数据
|
|
|
|
+ const data = {
|
|
id: runningTask.value.id,
|
|
id: runningTask.value.id,
|
|
- reason: rejectReasonForm.reason,
|
|
|
|
|
|
+ reason: rejectReasonForm.reason
|
|
}
|
|
}
|
|
await TaskApi.rejectTask(data)
|
|
await TaskApi.rejectTask(data)
|
|
popOverVisible.value.reject = false
|
|
popOverVisible.value.reject = false
|
|
@@ -713,7 +753,7 @@ const handleCopy = async () => {
|
|
const data = {
|
|
const data = {
|
|
id: runningTask.value.id,
|
|
id: runningTask.value.id,
|
|
reason: copyForm.copyReason,
|
|
reason: copyForm.copyReason,
|
|
- copyUserIds:copyForm.copyUserIds
|
|
|
|
|
|
+ copyUserIds: copyForm.copyUserIds
|
|
}
|
|
}
|
|
await TaskApi.copyTask(data)
|
|
await TaskApi.copyTask(data)
|
|
copyFormRef.value.resetFields()
|
|
copyFormRef.value.resetFields()
|
|
@@ -752,7 +792,6 @@ const handleTransfer = async () => {
|
|
const handleDelegate = async () => {
|
|
const handleDelegate = async () => {
|
|
formLoading.value = true
|
|
formLoading.value = true
|
|
try {
|
|
try {
|
|
-
|
|
|
|
// 1.1 校验表单
|
|
// 1.1 校验表单
|
|
if (!delegateFormRef.value) return
|
|
if (!delegateFormRef.value) return
|
|
await delegateFormRef.value.validate()
|
|
await delegateFormRef.value.validate()
|
|
@@ -932,6 +971,7 @@ const loadTodoTask = (task: any) => {
|
|
approveForm.value = {}
|
|
approveForm.value = {}
|
|
approveFormFApi.value = {}
|
|
approveFormFApi.value = {}
|
|
runningTask.value = task
|
|
runningTask.value = task
|
|
|
|
+ reasonRequire.value = task?.reasonRequire ?? false
|
|
// 处理 approve 表单.
|
|
// 处理 approve 表单.
|
|
if (task && task.formId && task.formConf) {
|
|
if (task && task.formId && task.formConf) {
|
|
const tempApproveForm = {}
|
|
const tempApproveForm = {}
|
|
@@ -949,23 +989,29 @@ const validateNormalForm = async () => {
|
|
try {
|
|
try {
|
|
await props.normalFormApi?.validate()
|
|
await props.normalFormApi?.validate()
|
|
} catch {
|
|
} catch {
|
|
- valid = false;
|
|
|
|
|
|
+ valid = false
|
|
}
|
|
}
|
|
- return valid;
|
|
|
|
|
|
+ return valid
|
|
} else {
|
|
} else {
|
|
- return true;
|
|
|
|
|
|
+ return true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
/** 从可以编辑的流程表单字段,获取需要修改的流程实例的变量 */
|
|
/** 从可以编辑的流程表单字段,获取需要修改的流程实例的变量 */
|
|
-const getUpdatedProcessInstanceVaiables = ()=> {
|
|
|
|
|
|
+const getUpdatedProcessInstanceVariables = () => {
|
|
const variables = {}
|
|
const variables = {}
|
|
- props.writableFields.forEach( (field) => {
|
|
|
|
- const fieldValue = props.normalFormApi.getValue(field)
|
|
|
|
- variables[field] = fieldValue;
|
|
|
|
|
|
+ props.writableFields.forEach((field) => {
|
|
|
|
+ variables[field] = props.normalFormApi.getValue(field)
|
|
})
|
|
})
|
|
return variables
|
|
return variables
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/** 处理签名完成 */
|
|
|
|
+const handleSignFinish = (url: string) => {
|
|
|
|
+ approveReasonForm.signPicUrl = url
|
|
|
|
+ approveSignFormRef.value.validate('change')
|
|
|
|
+}
|
|
|
|
+
|
|
defineExpose({ loadTodoTask })
|
|
defineExpose({ loadTodoTask })
|
|
</script>
|
|
</script>
|
|
|
|
|