/*
|
* @Company: hugeInfo
|
* @Author: ldh
|
* @Date: 2022-07-13 15:51:50
|
* @LastEditTime: 2022-11-28 10:51:30
|
* @LastEditors: ldh
|
* @Version: 1.0.0
|
* @Description: 工作流模板管理
|
*/
|
import React, { useState, useEffect } from 'react';
|
import { useNavigate, useLocation, useSearchParams } from 'react-router-dom';
|
import { Button, Form, Space, Typography } from 'antd';
|
import { PlusOutlined } from '@ant-design/icons';
|
import Page from '../../../components/Page';
|
import TableView from '../../../components/TableView';
|
import TableSearch from '../../../components/TableSearch';
|
import * as $$ from '../../../utils/utility';
|
|
// 获取工作流模板数据
|
function getWorkflowTempApi(submitData) {
|
return $$.ax.request({ url: '', type: 'get', data: submitData, service: '' });
|
}
|
|
const { Link } = Typography;
|
|
const WorkflowTemplate = () => {
|
const location = useLocation();
|
|
const navigate = useNavigate();
|
|
const [searchParams] = useSearchParams();
|
|
const [form] = Form.useForm();
|
|
// 搜索
|
const [search, setSearch] = useState({ page: 1, size: 10 });
|
|
// 数据
|
const [data, setData] = useState({});
|
|
const columns = [
|
{ title: '流程模板类型', dataIndex: 'xxx1' },
|
{ title: '流程模板名称', dataIndex: 'xxx2' },
|
{ title: '流程步骤', dataIndex: 'xxx3' },
|
{ title: '流程模板描述', dataIndex: 'xxx4' },
|
{ title: '生效状态', dataIndex: 'xxx5', width: 85, render: (text) => <div className={`public-tag public-tag-tagBlue`}>启用中</div> },
|
{ title: '更新时间', dataIndex: 'xxx6' },
|
{ title: '更新人', dataIndex: 'xxx7' },
|
{ title: '适用用户', dataIndex: 'xxx8' },
|
{
|
title: '操作',
|
dataIndex: 'action',
|
width: 210,
|
render: (_, record) => (
|
<Space size="middle">
|
<Link>启用</Link>
|
<Link onClick={() => handleJump('change', record)}>修改</Link>
|
<Link>配置节点</Link>
|
<Link onClick={() => handleDel(record)}>删除</Link>
|
</Space>
|
),
|
},
|
];
|
|
// 新建,修改,查看跳转
|
function handleJump(editType, record) {
|
$$.setSessionStorage(location.pathname, {
|
search,
|
tableActive: null,
|
});
|
navigate(`/mediate/workflowTemplate/workflowTemplateEdit?editType=${editType}&back=${location.pathname}`, { state: { aa: 11 } });
|
}
|
|
// 删除模板
|
function handleDel(record) {
|
$$.modalInfo({ title: '工作流模板删除确认', content: `确定删除「婚姻纠纷通用调解流程」吗?`, cancelText: '我再想想', okText: '确定删除' });
|
}
|
|
// 搜索 or 重置
|
function handleSearch(type, data) {
|
if (type === 'recovery') {
|
// 案件详情返回时恢复跳转前查询
|
let obj = Object.assign({}, data.search);
|
form.setFieldsValue(obj);
|
getWorkflowTemp(obj);
|
return;
|
}
|
if (type === 'reset') {
|
form.resetFields();
|
getWorkflowTemp({ page: 1, size: 10 });
|
return;
|
}
|
if (type === 'search') {
|
let values = form.getFieldsValue();
|
getWorkflowTemp({ ...search, ...values, page: 1 });
|
return;
|
}
|
if (type === 'changePage') {
|
getWorkflowTemp({ ...search, page: data[0], size: data[1] });
|
}
|
}
|
|
// 获取数据
|
async function getWorkflowTemp(submitData, tableActive) {
|
global.setSpinning(true);
|
const res = await getWorkflowTempApi(submitData);
|
global.setSpinning(false);
|
if (res.type) {
|
setData({ total: res.data?.totalElements, tableData: res.data?.content || [], tableActive });
|
}
|
}
|
|
return (
|
<Page pageHead={{ title: '工作流模板管理', subtitle: '为平台内调解及司法确认涉及的工作流制作相关模板' }}>
|
<div className="workflowTemplate">
|
<div className="pageSearch">
|
<TableSearch
|
labelLength={6}
|
form={form}
|
itemData={[
|
{ type: 'Input', name: 'xxx1', label: '流程模板名称' },
|
{
|
type: 'Select',
|
name: 'xxx2',
|
label: '流程模板类型',
|
selectdata: [
|
{ label: '纠纷调解', value: '1' },
|
{ label: '司法确认', value: '2' },
|
],
|
},
|
{
|
type: 'Select',
|
name: 'xxx3',
|
label: '生效状态',
|
selectdata: [
|
{ label: '启用', value: '1' },
|
{ label: '停用', value: '2' },
|
],
|
},
|
{
|
type: 'Select',
|
name: 'xxx4',
|
label: '适用客户',
|
selectdata: [],
|
placeholder: '选择使用流程模板的客户名称',
|
},
|
]}
|
handleReset={() => handleSearch('reset')}
|
handleSearch={() => handleSearch('search')}
|
/>
|
</div>
|
<div className="pageTable">
|
<TableView
|
showHeader
|
title="查询结果"
|
buttonAction={[
|
<Button type="primary" icon={<PlusOutlined />} onClick={() => handleJump('add')}>
|
新建流程模板
|
</Button>,
|
]}
|
columns={columns}
|
dataSource={data.tableData || [{}]}
|
rowClassName={(record, index) => (record.id === data.tableActive ? 'tableRowActive' : '')}
|
pagination={{
|
current: search.page,
|
pageSize: search.size,
|
total: data.total,
|
onChange: (page, pageSize) => handleSearch('changePage', [page, pageSize]),
|
}}
|
/>
|
</div>
|
</div>
|
</Page>
|
);
|
};
|
|
export default WorkflowTemplate;
|