Browse Source

feat:新增流程节点

master
常旭 6 months ago
parent
commit
26a091e412
10 changed files with 280 additions and 15 deletions
  1. 2
      README.md
  2. 10
      public/servers.json
  3. 1
      src/components/Tabs-KSHLCJD/README.md
  4. 224
      src/components/Tabs-KSHLCJD/index.js
  5. 6
      src/global.jsx
  6. 8
      src/models/doing.js
  7. 18
      src/pages/DoingCases/TableList/index.jsx
  8. 8
      src/pages/DoingCases/index.jsx
  9. 10
      src/pages/ZBSX/TableList/index.jsx
  10. 8
      src/services/doing.js

2
README.md

@ -55,3 +55,5 @@ npm test
## More
You can view full document on our [official website](https://pro.ant.design). And welcome any feedback in our [github](https://github.com/ant-design/ant-design-pro).

10
public/servers.json

@ -1,7 +1,7 @@
{
"API_URL": "http://localhost:8080/api/v4",
"SYS_MAN_URL": "http://localhost:8080/api",
"LOGIN_URL": "http://localhost:8080",
"PARENT_URL": "http://localhost:8080",
"moduleFactory": "http://localhost:8080/api/v4/sys/self"
"API_URL": "http://172.29.223.62:82/api/v4",
"SYS_MAN_URL": "http:/172.29.223.62:82/api",
"LOGIN_URL": "http:/172.29.223.62:82",
"PARENT_URL": "http://172.29.223.62:82",
"moduleFactory": "http://172.29.223.62:82/api/v4/sys/self"
}

1
src/components/Tabs-KSHLCJD/README.md

@ -0,0 +1 @@
在办事项--查看流程节点--可视化流程节点

224
src/components/Tabs-KSHLCJD/index.js

@ -0,0 +1,224 @@
import React, { useState, useEffect } from 'react';
import { Modal, Timeline, Steps, Card, Tag, Descriptions, Button } from 'antd';
import { connect } from 'umi';
import moment from 'moment';
const { Step } = Steps;
const KSHLCJD = (props) => {
const { id, sysToken, hideModal, visible } = props;
const [loading, setLoading] = useState(false);
const [flowData, setFlowData] = useState(null);
const [currentStep, setCurrentStep] = useState(0);
// 模拟流程数据 - 实际应该从接口获取
const mockFlowData = [
{
id: 1,
step: 1,
name: '预警生成',
status: 'finish',
time: '2024-01-01 09:00:00',
operator: '系统自动',
remark: '系统自动检测到问题并生成预警'
},
{
id: 2,
step: 2,
name: '受理派发',
status: 'finish',
time: '2024-01-01 10:30:00',
operator: '张三',
remark: '受理员接收并派发到处理部门'
},
{
id: 3,
step: 3,
name: '核查办理',
status: 'process',
time: '2024-01-02 14:20:00',
operator: '李四',
remark: '正在核查处理中'
},
{
id: 4,
step: 4,
name: '审批审核',
status: 'wait',
time: '',
operator: '',
remark: '待审核'
},
{
id: 5,
step: 5,
name: '办结归档',
status: 'wait',
time: '',
operator: '',
remark: '待归档'
}
];
useEffect(() => {
if (id) {
fetchFlowData();
}
}, [id]);
// 获取流程数据
const fetchFlowData = async () => {
setLoading(true);
try {
// 这里应该调用实际的API
// const response = await props.dispatch({
// type: 'doing/fetchFlowData',
// payload: { id, sysToken }
// });
// 暂时使用模拟数据
setTimeout(() => {
setFlowData(mockFlowData);
// 计算当前步骤(根据status)
const current = mockFlowData.findIndex(item => item.status === 'process');
setCurrentStep(current >= 0 ? current : mockFlowData.length - 1);
setLoading(false);
}, 500);
} catch (error) {
setLoading(false);
}
};
// 渲染步骤状态图标
const renderStepStatus = (status) => {
const statusConfig = {
finish: { color: 'green', text: '已完成' },
process: { color: 'blue', text: '进行中' },
wait: { color: 'gray', text: '待处理' },
error: { color: 'red', text: '异常' }
};
const config = statusConfig[status] || statusConfig.wait;
return <Tag color={config.color}>{config.text}</Tag>;
};
// 渲染Timeline视图
const renderTimelineView = () => {
return (
<Timeline mode="left" style={{ marginTop: 20 }}>
{flowData?.map((item) => (
<Timeline.Item
key={item.id}
label={item.time || '待处理'}
color={
item.status === 'finish' ? 'green' :
item.status === 'process' ? 'blue' :
item.status === 'error' ? 'red' : 'gray'
}
>
<Card size="small">
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<h4 style={{ margin: 0 }}>步骤{item.step}: {item.name}</h4>
<p style={{ margin: '5px 0' }}>{item.remark}</p>
{item.operator && <p style={{ margin: 0, color: '#666' }}>操作人: {item.operator}</p>}
</div>
<div>
{renderStepStatus(item.status)}
</div>
</div>
</Card>
</Timeline.Item>
))}
</Timeline>
);
};
// 渲染Steps视图
const renderStepsView = () => {
return (
<Steps current={currentStep} style={{ margin: '40px 0' }}>
{flowData?.map((item) => (
<Step
key={item.id}
title={item.name}
description={
<div>
<div>{item.time || '待处理'}</div>
<div>{item.operator || ''}</div>
{item.remark && <div style={{ color: '#666' }}>{item.remark}</div>}
</div>
}
status={item.status}
/>
))}
</Steps>
);
};
// 渲染流程统计信息
const renderStatistics = () => {
if (!flowData) return null;
const finished = flowData.filter(item => item.status === 'finish').length;
const processing = flowData.filter(item => item.status === 'process').length;
const waiting = flowData.filter(item => item.status === 'wait').length;
return (
<Descriptions bordered size="small" column={3} style={{ marginBottom: 20 }}>
<Descriptions.Item label="总步骤数">{flowData.length}</Descriptions.Item>
<Descriptions.Item label="已完成">{finished}</Descriptions.Item>
<Descriptions.Item label="进行中">{processing}</Descriptions.Item>
<Descriptions.Item label="待处理">{waiting}</Descriptions.Item>
<Descriptions.Item label="当前进度">{Math.round((finished / flowData.length) * 100)}%</Descriptions.Item>
<Descriptions.Item label="预计剩余时间">2</Descriptions.Item>
</Descriptions>
);
};
return (
<Modal
title="可视化流程节点"
visible={visible !== undefined ? visible : true}
onCancel={() => hideModal(false)}
footer={[
<Button key="close" onClick={() => hideModal(false)}>
关闭
</Button>,
<Button
key="refresh"
type="primary"
loading={loading}
onClick={fetchFlowData}
>
刷新
</Button>
]}
width={800}
maskClosable={false}
>
<div style={{ maxHeight: '60vh', overflow: 'auto' }}>
{renderStatistics()}
<div style={{ margin: '20px 0' }}>
<h4>流程进度图</h4>
{renderStepsView()}
</div>
<div style={{ margin: '20px 0' }}>
<h4>流程时间线</h4>
{renderTimelineView()}
</div>
{/* 如果流程有附件,可以展示在这里 */}
<Card title="流程附件" size="small" style={{ marginTop: 20 }}>
<p>暂无附件</p>
</Card>
</div>
</Modal>
);
};
export default connect()(KSHLCJD);

6
src/global.jsx

@ -6,12 +6,6 @@ import defaultSettings from '../config/defaultSettings';
const { pwa } = defaultSettings;
const isHttps = document.location.protocol === 'https:'; // if pwa is true
// debugger;
// document.cookie = "sessionId=undefined;";
// document.cookie = "JSESSIONID=090bb5cb-1850-43ab-a79a-f80d157e62a5;";
// document.cookie = "JSESSIONID=d0db1b68-5db1-4951-8648-a799d8fe028c;";
// document.cookie = "JSESSIONID=118c94ee-44c0-4c17-b909-ab6e749552f8;";
// document.cookie = "tokenId=63f2c2479300f41797118ee653816f9b;";
if (pwa) {
// Notify user if offline now

8
src/models/doing.js

@ -38,6 +38,7 @@ import {
querySaveCC,
queryCcjg,
queryDownloadFile,
ceshi
} from '@/services/doing';
const Model = {
@ -321,6 +322,13 @@ const Model = {
}
return false;
},
*fetchCeshi({ payload }, { call }) {
const response = yield call(ceshi, payload);
if (response && response.resCode === 0) {
return response;
}
return false;
}
},
reducers: {
changeSetting(state, { payload }) {

18
src/pages/DoingCases/TableList/index.jsx

@ -15,6 +15,7 @@ import SLGZ from '@/components/Tabs-SLGZ';
import BJSP from '@/components/Tabs-BJSP';
import BJSQ from '@/components/Tabs-BJSQ';
import BJGZ from '@/components/Tabs-BJGZ';
import KSHLCJD from '@/components/Tabs-KSHLCJD';
import { getDicsName } from '@/utils/utils';
import { AJZT, BLFS, UserLevel } from '@/utils/constants';
import { getHGIcons, ExampleBar, getTimeLine } from '@/components/MyIcons';
@ -205,6 +206,15 @@ const TableList = (props) => {
重新审批
</Button>
);
const bjbbhlcjd =(
<Button
key='bjbbhlcjd'
type="link"
onClick={() => setNowModal(<KSHLCJD id={id} sysToken={sysToken} hideModal={hideModal} />)}
>
可视化流程节点
</Button>
);
// debugger;
if (record.ck === 1) allBtns.push(ck);
if (record.slpf === 1) allBtns.push(slpf);
@ -216,6 +226,7 @@ const TableList = (props) => {
if (record.bjdspsp === 1) allBtns.push(bjdspsp);
if (record.bjbbhcxsq === 1) allBtns.push(bjbbhcxsq);
if (record.bjbbhcxsp === 1) allBtns.push(bjbbhcxsp);
if (record.bjbbhlcjd === 1) allBtns.push(bjbbhlcjd);
// all.forEach(item => {
// if (record[item] === 1) {
// console.log('ppsp',[item.toUpperCase()])
@ -353,7 +364,6 @@ const TableList = (props) => {
getList(msg);
}
}, [msg]);
//
const onSearch = (params) => {
setSearchParams({ ...searchParams, ...params, page: 1 });
@ -489,6 +499,12 @@ const mapDispatchToProps = (dispatch) => ({
},
setRefresh(params) {
return dispatch({ type: 'doing/setRefresh', payload: params });
},
fetchCeshi(params) {
return dispatch({
type: 'doing/fetchCeshi',
payload: params
});
}
});
export default connect(mapStateToProps, mapDispatchToProps)(TableList);

8
src/pages/DoingCases/index.jsx

@ -12,6 +12,12 @@ import { secondTabName } from '@/utils/utils';
const { TabPane } = Tabs
/**
* Doing组件
* 用于处理不同级别部级省级市级平台的展示和切换
* 根据用户位置和权限动态显示对应平台内容
*/
// props
const Doing = (props) => {
const { user, isLocationInBu,locationType } = props;
// console.log(isLocationInBu);
@ -85,7 +91,7 @@ const Doing = (props) => {
return (
<ProvinceSelect
onSelectProvince={onSelectProvince}
sysToken={isLocationInBu ? selectdProvince : ''}
sysToken={isLocationInBu ? selectdProvince : ''}
/>
)
}else{

10
src/pages/ZBSX/TableList/index.jsx

@ -354,6 +354,11 @@ const TableList = (props) => {
}
}, [msg]);
useEffect(() => {
// fetchCeshi
props.fetchCeshi({ /* 这里传入需要的参数 */ });
}, []); //
//
const onSearch = (params) => {
setSearchParams({ ...searchParams, ...params, page: 1 });
@ -489,6 +494,9 @@ const mapDispatchToProps = (dispatch) => ({
},
setRefresh(params) {
return dispatch({ type: 'doing/setRefresh', payload: params });
}
},
fetchCeshi(params) {
return dispatch({ type: 'doing/fetchCeshi', payload: params });
},
});
export default connect(mapStateToProps, mapDispatchToProps)(TableList);

8
src/services/doing.js

@ -21,7 +21,7 @@ export async function queryDoneList({ params, sysToken }) {
export async function queryCategoryList({ params, sysToken, isNotGateway }) {
const { API_URL } = getUrl();
const url = !isNotGateway ? `${API_URL}${gateway(sysToken)}/zxzd` : `${API_URL}/zxzd/${sysToken}`;
const url = !isNotGateway ? `${API_URL}${gateway(sysToken)}/zxzd` : `${API_URL}/zxzd/${sysToken}`;
return request(url, {
method: 'GET',
data: params,
@ -306,3 +306,9 @@ export async function queryDownloadFile({ params, sysToken }) {
// method: 'GET',
// });
}
export async function ceshi({ params, sysToken }) {
return request("https://a-140000000000-0925.sxgadsj.gat/tactics-model-web/core/self",{
method: 'GET',
})
}
Loading…
Cancel
Save