提交 fd7edf9b authored 作者: kxjia's avatar kxjia

问题管理工作流

上级 000b6ae6
...@@ -198,3 +198,9 @@ export function getNodesByTableName(tableName) { ...@@ -198,3 +198,9 @@ export function getNodesByTableName(tableName) {
}) })
} }
export function addMyTaskFlow(data) {
return defHttp.post({
url: '//my/myTaskFlow/add',
data: data
})
}
...@@ -11,6 +11,8 @@ enum Api { ...@@ -11,6 +11,8 @@ enum Api {
deleteBatch = '/problem/stProblemCheckArchive/deleteBatch', deleteBatch = '/problem/stProblemCheckArchive/deleteBatch',
importExcel = '/problem/stProblemCheckArchive/importExcel', importExcel = '/problem/stProblemCheckArchive/importExcel',
exportXls = '/problem/stProblemCheckArchive/exportXls', exportXls = '/problem/stProblemCheckArchive/exportXls',
} }
/** /**
* 导出api * 导出api
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle> <template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined">添加问题</a-button> <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined">添加问题</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay> <template #overlay>
<a-menu> <a-menu>
...@@ -168,16 +167,24 @@ ...@@ -168,16 +167,24 @@
} }
async function handleFlow(record: Recordable) { async function handleFlow(record: Recordable) {
record['deployId'] = props.nextFlowNode.deployId emit("sendWorkFlow",record)
record['bmpNodeId'] = props.nextFlowNode.id }
record['bpmStatus'] = 2
async function handleUpdate(dataId) {
let record = {
bmpNodeId: props.nextFlowNode.id,
deployId: props.nextFlowNode.deployId,
bpmStatus: 2,
id:dataId
}
await saveOrUpdate(record,true).then(res => { await saveOrUpdate(record,true).then(res => {
handleSuccess(record) handleSuccess(null);
}) })
emit("sendWorkFlow",record)
} }
defineExpose({
handleUpdate,
})
</script> </script>
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
该节点未配置表单 该节点未配置表单
</div> </div>
</a-tab-pane> </a-tab-pane>
<template #tabBarExtraContent>
<a-button type="primary">查看流程图</a-button>
</template>
</a-tabs> </a-tabs>
<WorkFlowFormDrawer <WorkFlowFormDrawer
v-model:visible="drawerVisible" v-model:visible="drawerVisible"
...@@ -60,10 +63,12 @@ ...@@ -60,10 +63,12 @@
<script lang="ts" name="problem-stProblemCheck" setup> <script lang="ts" name="problem-stProblemCheck" setup>
import { ref, nextTick, onMounted, defineAsyncComponent, h } from 'vue'; import { ref, nextTick, onMounted, defineAsyncComponent, h } from 'vue';
import { getNodesByTableName } from '/@/components/Process/api/definition'; import { getNodesByTableName } from '/@/components/Process/api/definition';
import { definitionStart, definitionStartByDeployId } from "/@/components/Process/api/definition"; import { definitionStart, definitionStartByDeployId,addMyTaskFlow } from "/@/components/Process/api/definition";
import WorkFlowFormDrawer from '/@/views/common/WorkFlowFormDrawer.vue'; import WorkFlowFormDrawer from '/@/views/common/WorkFlowFormDrawer.vue';
import TaskAssigneeDrawer from '/@/views/common/TaskAssigneeDrawer.vue' import TaskAssigneeDrawer from '/@/views/common/TaskAssigneeDrawer.vue'
const formTableName = "st_problem_check";
const workflowNodes = ref<any[]>([]); const workflowNodes = ref<any[]>([]);
const activeTab = ref(1); const activeTab = ref(1);
const dataId = ref(''); const dataId = ref('');
...@@ -171,12 +176,30 @@ ...@@ -171,12 +176,30 @@
const handleDefinitionStart = async (data) => { const handleDefinitionStart = async (data) => {
const formData = { dataId:data.id, dataName: 'id' }; const formData = { dataId:data.id, dataName: 'id' };
const startResRaw = await definitionStartByDeployId( const deployId = currentNode.value.deployId || '';
currentNode.value?.deployId || '', const startResRaw = await definitionStartByDeployId(deployId, formData);
alert(JSON.stringify(startResRaw))
); let myTaskFlow = {}
if (startResRaw?.data?.id) { if (startResRaw?.procInsId) {
dataId.value = startResRaw.data.id; myTaskFlow["taskId"] = startResRaw.taskId;
myTaskFlow["deployId"] = startResRaw.deployId;
myTaskFlow["procInsId"] = startResRaw.instanceId;
myTaskFlow["executionId"] = startResRaw.executionId;
myTaskFlow["procDefId"] = startResRaw.procInsId;
myTaskFlow["targetId"] = data.id;
myTaskFlow["taskDefinitionKey"] = currentNode.value.id;
myTaskFlow["formTableName"] = formTableName;
const attributes = currentNode.value?.attributes || {}
const userTypes = attributes.userType || [];
if (userTypes.length > 0) {
userType.value = userTypes[0].value || '';
if(userType.value==="role"){
myTaskFlow["roleid"] = currentNode.value.assignee;
} else {
myTaskFlow["uid"] = currentNode.value.assignee;
}
}
await addMyTaskFlow(myTaskFlow);
} }
} }
...@@ -207,7 +230,7 @@ ...@@ -207,7 +230,7 @@
procDefId?: string; procDefId?: string;
formData?: Record<string, any>; formData?: Record<string, any>;
}) => { }) => {
console.log('打开多表单抽屉:', params);
if (params.nodeIndex !== undefined) { if (params.nodeIndex !== undefined) {
currentMultiFormIndex.value = params.nodeIndex; currentMultiFormIndex.value = params.nodeIndex;
} else { } else {
...@@ -276,7 +299,6 @@ ...@@ -276,7 +299,6 @@
} }
function handlSendSuccess(dataId: any) { function handlSendSuccess(dataId: any) {
const currentFormComponent = getCurrentFormComponent(); const currentFormComponent = getCurrentFormComponent();
if (currentFormComponent && typeof currentFormComponent.handleUpdate === 'function') { if (currentFormComponent && typeof currentFormComponent.handleUpdate === 'function') {
currentFormComponent.handleUpdate(dataId); currentFormComponent.handleUpdate(dataId);
...@@ -298,8 +320,10 @@ ...@@ -298,8 +320,10 @@
onMounted(async () => { onMounted(async () => {
await nextTick(); await nextTick();
try { try {
const nodes = await getNodesByTableName("st_problem_check"); const nodes = await getNodesByTableName(formTableName);
workflowNodes.value = nodes; workflowNodes.value = nodes;
console.log('获取到的节点:', workflowNodes.value);
workflowNodes.value.forEach((node, index) => { workflowNodes.value.forEach((node, index) => {
console.log(`节点${index + 1}:`, node.name, 'formListUrl:', node.formListUrl); console.log(`节点${index + 1}:`, node.name, 'formListUrl:', node.formListUrl);
}); });
......
...@@ -65,8 +65,8 @@ ...@@ -65,8 +65,8 @@
emit("callback",record) emit("callback",record)
} }
function handleSendNext(record: Recordable) { async function handleSendNext(record: Recordable) {
emit("sendWorkFlow",record) emit("sendWorkFlow",record)
} }
function handleSuccess() { function handleSuccess() {
...@@ -87,10 +87,14 @@ ...@@ -87,10 +87,14 @@
} }
async function handleUpdate(dataId) { async function handleUpdate(dataId) {
await saveOrUpdate({ //alert(dataId)
let record = {
bmpNodeId: props.nextFlowNode.id, bmpNodeId: props.nextFlowNode.id,
id:dataId, deployId: props.nextFlowNode.deployId,
},true).then(res => { bpmStatus: 2,
id:dataId
}
await saveOrUpdate(record,true).then(res => {
handleSuccess(); handleSuccess();
}) })
} }
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
let data = getFieldsValue(); let data = getFieldsValue();
let params = Object.assign({}, formData, data); let params = Object.assign({}, formData, data);
await saveOrUpdate(params, true); await saveOrUpdate(params, true);
alert(1)
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论