Commit a2a01f2c by 胡鑫

不合格品处理增加审批流程发起 查看

parent 99dd1c39
...@@ -41,7 +41,7 @@ export async function exportDesign(id: string, mode: ErrorMessageMode = 'modal') ...@@ -41,7 +41,7 @@ export async function exportDesign(id: string, mode: ErrorMessageMode = 'modal')
/** /**
* @description: 查询Workflow分页列表 * @description: 查询Workflow分页列表
*/ */
export async function getDesignPage(params: WorkflowPageParams, mode: ErrorMessageMode = 'modal') { export async function getDesignPage(params: WorkflowPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<WorkflowPageResult>( return defHttp.get<WorkflowPageResult>(
{ {
url: Api.Page, url: Api.Page,
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
}; };
let res = await getDesignPage(params); let res = await getDesignPage(params);
page.total = res.total; page.total = res.total;
template.list = res.list; // template.list = res.list;
} catch (error) {} } catch (error) {}
} }
function submit() { function submit() {
......
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
try { try {
let res = await getDesignPage(searchParams); let res = await getDesignPage(searchParams);
data.pagination.total = res.total; data.pagination.total = res.total;
data.list = res.list; // data.list = res.list;
} catch (error) {} } catch (error) {}
} }
......
...@@ -60,17 +60,19 @@ ...@@ -60,17 +60,19 @@
} }
}); });
async function look() { async function look() {
if (props.processId) { showLoading.value = false;
showLoading.value = false;
visible.value = true; visible.value = true;
} else { // if (props.processId) {
showLoading.value = false; // showLoading.value = false;
notification.open({ // visible.value = true;
type: 'error', // } else {
message: t('查看'), // showLoading.value = false;
description: t('请选择一个流程进行查看'), // notification.open({
}); // type: 'error',
} // message: t('查看'),
// description: t('请选择一个流程进行查看'),
// });
// }
} }
function close() { function close() {
visible.value = false; visible.value = false;
......
...@@ -150,7 +150,7 @@ export const columns: BasicColumn[] = [ ...@@ -150,7 +150,7 @@ export const columns: BasicColumn[] = [
{ {
resizable: true, resizable: true,
dataIndex: 'lydjlx', dataIndex: 'lydjlx',
title: '来源单据', title: '来源单据111',
componentType: 'input', componentType: 'input',
fixed: false, fixed: false,
......
...@@ -28,11 +28,36 @@ ...@@ -28,11 +28,36 @@
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<div style="display: flex; align-items: center;">
<TableAction <!-- 其他按钮使用TableAction组件 -->
:actions="getLessActions(record)" <TableAction
:dropDownActions="getMoreActions(record)" :actions="getLessActions(record)"
/> :dropDownActions="getMoreActions(record)"
/>
<!-- 单独渲染流程按钮 -->
<template v-if="!record.taskId">
<a-button
type="text"
size="small"
style="margin-left: 8px;color: #1c8dff; "
@click="openFlowLaunchModal(record.id)"
>
<template #icon><Icon style="color: #1c8dff;" :icon="'ant-design:rocket-outlined'" /></template>
发起流程
</a-button>
</template>
<template v-else>
<a-button
type="text"
size="small"
style="margin-left: 8px;color: #1c8dff;"
@click="viewProcess(record)"
>
<template #icon><Icon style="color: #1c8dff;" :icon="'ant-design:eye-outlined'" /></template>
查看流程
</a-button>
</template>
</div>
</template> </template>
<template v-else-if="column.dataIndex && column?.listStyle"> <template v-else-if="column.dataIndex && column?.listStyle">
...@@ -84,13 +109,72 @@ ...@@ -84,13 +109,72 @@
@success="handleExportSuccess" @success="handleExportSuccess"
/> />
<!-- 流程发起对话框 -->
<a-modal
v-model:visible="visibleFlowLaunchModal"
title="流程模板列表"
width="80%"
:bodyStyle="{ height: '620px', padding: '0' }"
:footer="null"
@cancel="visibleFlowLaunchModal = false"
>
<a-spin :spinning="loading" tip="发起流程中..." style="min-height: 500px;">
<PageLayout
:title="'流程模板列表'"
:searchConfig="searchConfig"
@search="searchFlowTemplate"
@scroll-height="scrollHeight"
>
<template #search> </template>
<template #right>
<div v-if="flowLaunchData.list.length > 0" style="height: 550px;padding: 10px;" class="list-page-box relative">
<div
class="flex flex-wrap my-10px overflow-y-auto"
style="height: calc(100% - 62px); align-content: baseline"
>
<TemplateCard
v-for="(item, index) in flowLaunchData.list"
:key="index"
:item="item"
:width="'calc((100% - 39px) / 4)'"
@click="launchProcess(item.id)"
/>
</div>
<div class="page-box">
<a-pagination
v-model:current="flowLaunchData.pagination.current"
:total="flowLaunchData.pagination.total"
v-model:pageSize="flowLaunchData.pagination.pageSize"
:showSizeChanger="true"
:showQuickJumper="true"
:show-total="(total) => `共 ${total} 条数据`"
@change="handleFlowTemplatePageChange"
/></div>
</div>
<div v-else>
<EmptyBox />
</div>
</template>
</PageLayout>
</a-spin>
</a-modal>
<!-- 查看流程组件 -->
<LookProcess
v-if="visibleLookProcess"
:visible="visibleLookProcess"
:taskId="taskIdProcess"
@close="visibleLookProcess = false"
/>
</ResizePageWrapper> </ResizePageWrapper>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed,provide,Ref, onMounted,createVNode, import { ref, computed,provide,Ref, onMounted,createVNode, reactive
} from 'vue'; } from 'vue';
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
...@@ -132,16 +216,165 @@ ...@@ -132,16 +216,165 @@
import { moneyChineseData,camelCaseString, } from '/@/utils/event/design'; import { moneyChineseData,camelCaseString, } from '/@/utils/event/design';
import { FormSchema } from '/@/components/Form/src/types/form'; import { FormSchema } from '/@/components/Form/src/types/form';
import LookProcess from '/@/views/workflow/task/components/LookProcess.vue';
import TemplateCard from '/@bpmn/components/card/TemplateCard.vue';
import { EmptyBox } from '/@/components/ModalPanel/index';
import { getDesignPage } from '/@/api/workflow/design';
import { WorkflowPageModel } from '/@/api/workflow/model';
import { PageLayout } from '/@/components/ModalPanel';
import userTableScrollHeight from '/@/hooks/setting/userTableScrollHeight';
import { getAppEnvConfig } from '/@/utils/env';
import { getToken } from '/@/utils/auth';
const listSpliceNum = ref(3); //操作列最先展示几个
const listSpliceNum = ref(4); //操作列最先展示几个
const visibleFlowLaunchModal = ref(false);
const { scrollHeight } = userTableScrollHeight();
const fromId = ref('');
const loading = ref(false);
// 查看流程相关变量
const visibleLookProcess = ref(false);
const taskIdProcess = ref('');
const processIdProcess = ref('');
// 流程模板数据
const flowLaunchData = reactive({
list: [] as WorkflowPageModel[],
pagination: {
current: 1,
total: 0,
pageSize: 20,
},
});
// 搜索配置
const searchConfig = [
{
field: 'code',
label: '模板编码',
type: 'input',
},
{
field: 'name',
label: '模板名称',
type: 'input',
},
];
// 打开流程发起对话框
function openFlowLaunchModal(id) {
fromId.value = id;
visibleFlowLaunchModal.value = true;
// 初始化数据
flowLaunchData.pagination.current = 1;
flowLaunchData.pagination.total = 0;
getFlowTemplateList();
}
// 获取流程模板列表
async function getFlowTemplateList(params?: any) {
const searchParams = {
...{
limit: flowLaunchData.pagination.current,
size: flowLaunchData.pagination.pageSize,
},
...params,
...{ enabledMark: 1 }, // 流程发起list 需要隐藏 禁用的模板[enabledMark=1]
};
try {
let res = await getDesignPage(searchParams);
flowLaunchData.list = res.list;
flowLaunchData.pagination.total = res.total;
} catch (error) {
console.error('获取流程模板列表失败:', error);
}
}
// 搜索流程模板
function searchFlowTemplate(params: any) {
flowLaunchData.pagination.current = 1;
getFlowTemplateList(params);
}
// 分页变化
function handleFlowTemplatePageChange(page: number, pageSize: number) {
flowLaunchData.pagination.current = page;
flowLaunchData.pagination.pageSize = pageSize;
getFlowTemplateList();
}
// 发起流程
function launchProcess(schemaId: string) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认发起流程?',
okText: '确认',
cancelText: '取消',
onOk() {
// 开始加载
loading.value = true;
// 调用接口发起流程
fetch( getAppEnvConfig().VITE_GLOB_API_URL + '/zlgl/bhgpcl/launchProcess', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${getToken()}`
},
body: JSON.stringify({
type: 1,
schemaId: schemaId,
fromId: fromId.value
})
})
.then(response => response.json())
.then(data => {
// 结束加载
loading.value = false;
if (data.code == 0) {
notification.success({
message: '提示',
description: '流程发起成功!',
});
visibleFlowLaunchModal.value = false;
// 刷新不合格品列表数据
reload();
} else {
notification.error({
message: '提示',
description: data.msg || '流程发起失败',
});
}
})
.catch(error => {
// 结束加载
loading.value = false;
console.error('流程发起失败:', error);
notification.error({
message: '提示',
description: '流程发起失败,请稍后重试',
});
});
},
onCancel() {},
});
}
// 查看流程
function viewProcess(record) {
visibleLookProcess.value = true;
taskIdProcess.value = record.taskId;
}
...@@ -234,7 +467,7 @@ ...@@ -234,7 +467,7 @@
striped: false, striped: false,
actionColumn: { actionColumn: {
width: 195, width: 320,
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
slots: { customRender: 'action' }, slots: { customRender: 'action' },
...@@ -426,7 +659,7 @@ ...@@ -426,7 +659,7 @@
record.isCanEdit = true; record.isCanEdit = true;
actionsList.push({ actionsList.push({
...button, ...button,
auth: `bhgpcl:${button.code}`, auth: `bhgpcl:${button.code}`,
label: button?.name, label: button?.name,
color: button.code === 'delete' ? 'error' : undefined, color: button.code === 'delete' ? 'error' : undefined,
...@@ -435,7 +668,7 @@ ...@@ -435,7 +668,7 @@
} else { } else {
if (!['edit', 'delete'].includes(button.code)) { if (!['edit', 'delete'].includes(button.code)) {
actionsList.push({ actionsList.push({
auth: `bhgpcl:${button.code}`, auth: `bhgpcl:${button.code}`,
label: button?.name, label: button?.name,
onClick: btnEvent[button.code]?.bind(null, record), onClick: btnEvent[button.code]?.bind(null, record),
...@@ -443,6 +676,7 @@ ...@@ -443,6 +676,7 @@
} }
} }
}); });
return actionsList; return actionsList;
} }
...@@ -496,4 +730,26 @@ ...@@ -496,4 +730,26 @@
} }
} }
/* 流程模板列表样式 */
.list-page-box {
height: calc(100% - 62px);
}
.page-box {
height: 52px;
border-top: 1px solid rgb(238 238 238 / 93%);
text-align: right;
padding: 10px 16px;
background: #fff;
position: absolute;
right: 0;
bottom: 0;
left: 0;
border-radius: 16px;
}
.my-10px {
margin: 10px 0;
}
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment