diff --git a/src/api/bpm/task/index.ts b/src/api/bpm/task/index.ts
index f3cda9f..f5bf3f9 100644
--- a/src/api/bpm/task/index.ts
+++ b/src/api/bpm/task/index.ts
@@ -34,6 +34,19 @@ export const getTaskListByProcessInstanceId = async (processInstanceId: string)
export const getTaskListByReturn = async (id: string) => {
return await request.get({ url: '/bpm/task/list-by-return', params: { id } })
}
+//得到当前处理人
+export const getTaskAssignee = async (taskId: string) => {
+ return await request.get({ url: '/bpm/task/getTaskAssignee', params: { taskId } })
+}
+//得到当前任务id列表
+export const getTaskIdsForProcessInstance = async (processinstanceId: string) => {
+ return await request.get({ url: '/bpm/task/getTaskIdsForProcessInstance', params: { processinstanceId } })
+}
+
+//得到当前处理人
+export const getTaskConfigFromBpmn = async (taskId: string,itemStr:string) => {
+ return await request.get({ url: '/bpm/task/getTaskConfigFromBpmn', params: { taskId,itemStr } })
+}
// 回退
export const returnTask = async (data: any) => {
diff --git a/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json b/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
index 1ed6e92..6ff5e62 100644
--- a/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
+++ b/src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
@@ -170,7 +170,12 @@
"type": "String"
},
{
- "name": "formType",
+ "name": "itemType",
+ "isAttr": true,
+ "type": "String"
+ },
+ {
+ "name": "itemContent",
"isAttr": true,
"type": "String"
},
diff --git a/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue b/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue
index ea3ccbc..4369969 100644
--- a/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue
@@ -90,7 +90,7 @@ import FlowCondition from './flow-condition/FlowCondition.vue'
import SignalAndMassage from './signal-message/SignalAndMessage.vue'
import ElementListeners from './listeners/ElementListeners.vue'
import ElementProperties from './properties/ElementProperties.vue'
-// import ElementForm from './form/ElementForm.vue'
+// import ElementForm from './form/ElementForm2.vue'
import UserTaskListeners from './listeners/UserTaskListeners.vue'
// 切换tab自动刷新实现 begin+++++++++++++
export type TabRefresh = {
diff --git a/src/components/bpmnProcessDesigner/package/penal/PropertiesPanelbk.vue b/src/components/bpmnProcessDesigner/package/penal/PropertiesPanelbk.vue
index 86a1cf7..0d57945 100644
--- a/src/components/bpmnProcessDesigner/package/penal/PropertiesPanelbk.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/PropertiesPanelbk.vue
@@ -66,7 +66,7 @@ import FlowCondition from './flow-condition/FlowCondition.vue'
import SignalAndMassage from './signal-message/SignalAndMessage.vue'
import ElementListeners from './listeners/ElementListeners.vue'
import ElementProperties from './properties/ElementProperties.vue'
-// import ElementForm from './form/ElementForm.vue'
+// import ElementForm from './form/ElementForm2.vue'
import UserTaskListeners from './listeners/UserTaskListeners.vue'
defineOptions({ name: 'MyPropertiesPanel' })
diff --git a/src/components/bpmnProcessDesigner/package/penal/form/ElementForm.vue b/src/components/bpmnProcessDesigner/package/penal/form/ElementForm.vue
index 33f0bc0..a84a0b4 100644
--- a/src/components/bpmnProcessDesigner/package/penal/form/ElementForm.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/form/ElementForm.vue
@@ -2,231 +2,35 @@
-
-
-
-
-
-
-
+
+
+
+
+ {{ dict.label }}
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/bpmnProcessDesigner/package/penal/form/ElementFormbk.vue b/src/components/bpmnProcessDesigner/package/penal/form/ElementFormbk.vue
new file mode 100644
index 0000000..33f0bc0
--- /dev/null
+++ b/src/components/bpmnProcessDesigner/package/penal/form/ElementFormbk.vue
@@ -0,0 +1,478 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue b/src/components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue
index 494b3d9..d056f93 100644
--- a/src/components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/properties/ElementProperties.vue
@@ -92,6 +92,7 @@ const resetAttributesList = () => {
(pre, current) => pre.concat(current.values),
[]
)
+ console.log(JSON.stringify(bpmnElementPropertyList.value ?? []),"bpmnElementPropertyList.value ?? []")
// 复制 显示
elementPropertyList.value = JSON.parse(JSON.stringify(bpmnElementPropertyList.value ?? []))
}
diff --git a/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue b/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
index eb45fc4..ca94d50 100644
--- a/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
+++ b/src/components/bpmnProcessDesigner/package/penal/task/task-components/UserTask.vue
@@ -32,7 +32,6 @@
{{ dict.label }}
-
{
if (!businessObject) {
return
}
+
if (businessObject.candidateStrategy != undefined) {
userTaskForm.value.candidateStrategy = parseInt(businessObject.candidateStrategy) as any
} else {
diff --git a/src/utils/dict.ts b/src/utils/dict.ts
index 9ed54ea..de7d960 100644
--- a/src/utils/dict.ts
+++ b/src/utils/dict.ts
@@ -176,7 +176,7 @@ export enum DICT_TYPE {
BPM_PROCESS_LISTENER_TYPE = 'bpm_process_listener_type',
BPM_PROCESS_LISTENER_VALUE_TYPE = 'bpm_process_listener_value_type',
BPM_TASK_CANDIDATE_RANGE = 'bpm_task_candidate_range',
- OA_PROJECT_TYPE ='oa_project_type',
+ BPM_TASK_FORM_ITEM_TYPE ='bpm_task_form_item_type',
// ========== PAY 模块 ==========
PAY_CHANNEL_CODE = 'pay_channel_code', // 支付渠道编码类型
PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态
diff --git a/src/views/Home/qjgl/QjglDetail.vue b/src/views/Home/qjgl/QjglDetail.vue
index 5367c40..cff6faf 100644
--- a/src/views/Home/qjgl/QjglDetail.vue
+++ b/src/views/Home/qjgl/QjglDetail.vue
@@ -11,12 +11,12 @@
-
+
-
+
@@ -24,17 +24,17 @@
-
+
-
+
@@ -45,14 +45,15 @@
type="datetime"
value-format="x"
placeholder="选择结束时间"
- disabled
+ :disabled="!isEditable('startTime')"
+
/>
-
+
-
+
-
+
@@ -83,8 +84,9 @@ import { QjglApi, QjglVO } from '@/api/home/qjgl'
import { propTypes } from '@/utils/propTypes'
import {getUserProfile, ProfileVO} from "@/api/system/user/profile";
import {DeptVO, getDept} from "@/api/system/dept";
-import * as DefinitionApi from '@/api/bpm/definition'
-import * as UserApi from '@/api/system/user'
+import * as TaskApi from '@/api/bpm/task'
+import { getAccessToken } from '@/utils/auth'
+import {useUserStore} from "@/store/modules/user";
/** 请假管理 表单 */
defineOptions({ name: 'QjglDetail' })
@@ -128,39 +130,12 @@ const deptInfo = ref({} as DeptVO )
const formRef = ref() // 表单 Ref
const { query } = useRoute() // 查询参数
const queryId = query.id as unknown as number // 从 URL 传递过来的 id 编号
-/** 打开弹窗 */
-// const open = async (type: string, id?: number) => {
-// dialogVisible.value = true
-// dialogTitle.value = t('action.' + type)
-// formType.value = type
-// resetForm()
-// // 修改时,设置数据
-// if (id) {
-// formLoading.value = true
-// try {
-// formData.value = await QjglApi.getQjgl(id)
-// } finally {
-// formLoading.value = false
-// }
-// }
-// }
-// defineExpose({ open }) // 提供 open 方法,用于打开弹窗
+// pch begin
+const startUserSelectTasks = ref([]) // 发起人需要选择审批人的用户任务列表
+const userId = useUserStore().getUser.id // 当前登录的编号
+//pch end
const getUserInfo = async () => {
const users = await getUserProfile()
- // if ( formData.value.deptId == '' ){
- // userInfo.value = users
- // formData.value.deptId= users.dept.id
- //
- // deptInfo.value = {} as DeptVO
- // }else{
- // const dept = await getDept(formData.value.deptId)
- // deptInfo.value = dept
- // userInfo.value = {} as ProfileVO
- // }
- // if (formData.value.userName == ''){
- // const users = await getUserProfile()
- // formData.value.userName= users.nickname
- // }
if (formData.value.deptId == ''||formData.value.deptId == undefined){
formData.value.deptId= users.dept.id
@@ -180,30 +155,27 @@ const getUserInfo = async () => {
}
}
+const editableFields = ref([])
+const isEditable = (field) => {
+ return editableFields.value.includes(field); // 如果字段在 editableFields 中,则返回 true
+}
/** 提交表单 */
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
-const submitForm = async () => {
+const updatetForm = async () => {
// 校验表单
await formRef.value.validate()
// 提交请求
formLoading.value = true
try {
const data = formData.value as unknown as QjglVO
- if (formType.value === 'create') {
- await QjglApi.createQjgl(data)
- message.success(t('common.createSuccess'))
- } else {
- await QjglApi.updateQjgl(data)
- message.success(t('common.updateSuccess'))
- }
- dialogVisible.value = false
+ await QjglApi.updateQjgl(data)
// 发送操作成功的事件
- emit('success')
+ //emit('success')
} finally {
formLoading.value = false
}
}
-
+defineExpose({updatetForm})
/** 重置表单 */
const resetForm = () => {
formData.value = {
@@ -223,17 +195,53 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
+const itemControl = async () => {
+ // console.log(userId,"userId")
+ // console.log(queryId,"queryId")
+ let flag = false
+ let itemType = ""
+ let itemContent = ""
+ if (queryId.length > 33 ) { //流程中打开表单
+ const taskids = await TaskApi.getTaskIdsForProcessInstance( queryId ) //通过流程实例id得到待办任务列表
+ const token = getAccessToken()
+ for (const taskid of taskids) {
+ // 在 for...of 中可以使用 await
+ const assignee = await TaskApi.getTaskAssignee(taskid); //通过待办任务id得到审批人
+ //console.log(assignee, "assignee");
+ if ( assignee == userId ) {
+ flag = true
+ itemType = await TaskApi.getTaskConfigFromBpmn( taskid ,"itemType")
+ //console.log(itemType,"itemType")
+ if ( itemType == "1") {
+ itemContent = await TaskApi.getTaskConfigFromBpmn( taskid ,"itemContent")
+ }
+ }
+ }
+ if ( flag ) { //当然用户是审批人
+ if ( itemType == "1") { //表单字段0:禁用,1:允许
+ //editableFields.value.push("userName")
+ const parsedObject = JSON.parse(itemContent);
+ Object.entries(parsedObject).forEach(([key, value]) => {
+ editableFields.value.push( key )
+ //console.log(key);
+ });
+ }
+
+ }
+ }
+}
onMounted(async () => {
const id = props.id || queryId
if (id) {
formLoading.value = true
try {
formData.value = await QjglApi.getQjgl(id)
+ await itemControl()
+ // TaskApi.getTaskAssignee()
} finally {
formLoading.value = false
}
}
- //await getUserInfo()
- // await getKnowtypeTree()
+
})
diff --git a/src/views/bpm/processInstance/detail/index.vue b/src/views/bpm/processInstance/detail/index.vue
index fe7eb0a..2456a9d 100644
--- a/src/views/bpm/processInstance/detail/index.vue
+++ b/src/views/bpm/processInstance/detail/index.vue
@@ -18,7 +18,7 @@
-
+
@@ -253,12 +253,13 @@ watch(
deep: true
}
)
-
+const businessForm = ref()
/** 处理审批通过和不通过的操作 */
const handleAudit = async (task, pass) => {
// 1.1 获得对应表单
const index = runningTasks.value.indexOf(task)
const auditFormRef = proxy.$refs['form' + index][0]
+
// 1.2 校验表单
const elForm = unref(auditFormRef)
if (!elForm) return
@@ -271,6 +272,7 @@ const handleAudit = async (task, pass) => {
reason: auditForms.value[index].reason,
copyUserIds: auditForms.value[index].copyUserIds
}
+
if (pass) {
// 审批通过,并且有额外的 approveForm 表单,需要校验 + 拼接到 data 表单里提交
const formCreateApi = approveFormFApis.value[index]
@@ -279,6 +281,10 @@ const handleAudit = async (task, pass) => {
data.variables = approveForms.value[index].value
}
+ if (businessForm.value && businessForm.value.updatetForm) {
+ businessForm.value.updatetForm() // 调用异步组件的提交方法
+ }
+
await TaskApi.approveTask(data)
message.success('审批通过成功')
} else {
@@ -286,7 +292,7 @@ const handleAudit = async (task, pass) => {
message.success('审批不通过成功')
}
// 2.2 加载最新数据
- getDetail()
+ //getDetail()
delView(unref(currentRoute))
back()
}
@@ -370,6 +376,8 @@ const getProcessInstance = async () => {
if ( formCreatePath ) {
const formCustomViewPaht = await FormProcessMappingApi.getFormCustomViewPath( formCreatePath )
if ( formCustomViewPaht ) {
+ console.log(formCustomViewPaht,"formCustomViewPaht")
+ console.log(registerComponent(formCustomViewPaht),"registerComponent(formCustomViewPaht)")
BusinessFormComponent.value = registerComponent(formCustomViewPaht)
}
}
@@ -459,6 +467,7 @@ const loadRunningTask = (tasks) => {
approveForms.value.push({}) // 占位,避免为空
}
})
+ console.log(runningTasks,"runningTasks")
}
/** 初始化 */