Commit 6ff768cb authored by 彭俊龙's avatar 彭俊龙

feat:新增自动化工单配置

parent 48ef909b
Pipeline #96372 failed with stages
......@@ -23,7 +23,7 @@ import styles from './index.less';
import CardCheck from './CardCheck';
const PeopleSelector = props => {
const { confirmModal, onCancel, visible, onSubumit, userIds, roleIds, env } = props;
const { confirmModal, onCancel, visible, onSubumit, userIds, roleIds, env, caseMode } = props;
console.log('props', props)
const [allList, setAllist] = useState([]); // 用于展示得数据
const [checkListRoles, setCheckListRoles] = useState([]); // 选中得数据集合
......@@ -551,7 +551,8 @@ const PeopleSelector = props => {
>
角色
</div>
<div
{ !caseMode &&
<div
className={classnames({
[styles.people]: true,
[styles.peoplePick]: type === '环境变量',
......@@ -564,6 +565,8 @@ const PeopleSelector = props => {
>
环境变量
</div>
}
<Input.Search
value={searchName}
placeholder={type === '人员' ? '请输入部门或用户' : '请输入角色'}
......@@ -579,7 +582,8 @@ const PeopleSelector = props => {
<div className={styles.checkList}>
<div className={styles.person} />人员
<div className={styles.role} />角色
<div className={styles.env} />环境变量
{ !caseMode && <><div className={styles.env} />环境变量</>}
</div>
</div>
<div className={styles.content}>
......
import React, { useState, useEffect, useRef } from 'react';
import {
Space,
DatePicker,
Radio,
Input,
Button,
Table,
Modal,
Row,
Col,
Select,
InputNumber,
Checkbox,
Pagination,
message,
Tag
} from 'antd';
import {
GetFlowAutoSchemeLogs
} from '@/services/flow/flow';
import 'moment/dist/locale/zh-cn';
import locale from 'antd/es/date-picker/locale/zh_CN';
import moment from 'moment/moment';
import style from './index.less'
const { RangePicker } = DatePicker;
const { Search } = Input;
const ExcuteLog = props => {
const { onClose, visible, id } = props
const [loadding, setloadding] = useState(false)
const [dataSource, setDataSource] = useState([])
const [total, setTotal] = useState(0)
const [params, setParams] = useState({
id: id || null,
startTime: '',
endTime: '',
result: '',
info: '',
pageIndex: 1,
pageSize: 20
})
const columns = [
{
title: '流程名称',
dataIndex: 'FlowName',
align: 'center',
key: 'FlowName',
width: 150,
},
{
title: '工单编号',
align: 'center',
dataIndex: 'CaseNo',
key: 'CaseNo',
width: 150,
},
{
title: '自动办理节点',
align: 'center',
dataIndex: 'NodeName',
width: 250,
key: 'NodeName',
},
{
title: '下一节点办理人',
align: 'center',
dataIndex: 'NextNodeUserName',
width: 250,
key: 'NextNodeUserName',
},
{
title: '执行结果',
align: 'center',
dataIndex: 'ExecutionResult',
width: 100,
key: 'ExecutionResult',
render: (text, record, i) =>{
return <Tag color={text === '正常'? 'success' : 'error'}>{text}</Tag>
}
},
{
title: '失败原因',
align: 'center',
dataIndex: 'ErrorMsg',
width: 150,
key: 'ErrorMsg',
},
{
title: '触发时间',
align: 'center',
dataIndex: 'ExecutionTime',
width: 150,
key: 'ExecutionTime',
},
];
useEffect(()=> {
if(id && visible){
getData({ ...params, id})
}
}, [visible, params])
const getData = async (params)=>{
setloadding(true)
const { msg, code, data } = await GetFlowAutoSchemeLogs(params)
if(code === 0){
setTotal(data.TotalCount)
setDataSource(data.list || [])
}else{
message.error(msg)
}
setloadding(false)
}
const handleChange = (e, type) =>{
if (type === 'date') {
if (e) {
const dates = e.map(v => v.format('YYYY-MM-DD HH:mm:ss'));
setParams({ ...params, startTime: dates[0], endTime: dates[1] });
} else {
setParams({ ...params, startTime: '', endTime: '' });
}
} else if (type == 'text') {
setParams({ ...params, info: e || '' });
} else if (type == 'status') {
setParams({ ...params, result: e.target.value });
}
}
return (
<Modal
width={1300}
maskClosable={false}
centered
bodyStyle={{ height: '70vh', width: '100%', overflow: 'auto' }}
title={`查看执行日志`}
visible={visible || false}
onCancel={onClose}
destroyOnClose
footer={null}
>
<div className={style.content}>
<div className={style.header}>
<Space size={'middle'}>
<span>触发时间:</span>
<RangePicker showTime locale={locale} onChange={e => handleChange(e, 'date')} />
<span>执行结果:</span>
<Radio.Group defaultValue={''} onChange={e => handleChange(e, 'status')}>
<Radio.Button value={''}>全部</Radio.Button>
<Radio.Button value={'正常'}>正常</Radio.Button>
<Radio.Button value={'失败'}>失败</Radio.Button>
</Radio.Group>
<span>模糊查询:</span>
<Search
placeholder="请输入工单编号、流程名称查询"
onSearch={e => handleChange(e, 'text')}
style={{ width: '300px' }}
allowClear
/>
</Space>
</div>
<div className={style.tableContent}>
<Table
columns={columns}
loading={loadding}
bordered
dataSource={dataSource}
scroll={{ x: '100%', y: 450 }}
pagination={false}
/>
<div className={style.footer}>
<Pagination
showTotal= {(total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`}
pageSizeOptions= {[10, 20, 50, 100]}
total= {total}
pageSize= {params.pageSize}
current= {params.pageIndex}
showQuickJumper= {true}
showSizeChanger= {true}
onChange= {(pageindex, pageSize)=> {
setParams({
...params,
pageIndex: pageindex,
pageSize: pageSize
})
console.log(pageindex, pageSize)
}}
>
</Pagination>
</div>
</div>
</div>
</Modal>)
}
export default ExcuteLog
\ No newline at end of file
.content{
height: 100%;
.header{
width: 100%;
height: 60px;
background-color: white;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0px 20px;
}
.tableContent{
width: 100%;
height: calc(100% - 70px);
background-color: white;
margin-top: 10px;
.footer{
position: absolute;
bottom: 10px;
right: 10px;
}
}
.linkFont{
color: #1890ff;
&:hover{
cursor: pointer;
}
&.danger{
color: red
}
}
}
\ No newline at end of file
This diff is collapsed.
.content{
height: 100%;
.header{
width: 100%;
height: 60px;
background-color: white;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0px 20px;
}
.tableContent{
width: 100%;
height: calc(100% - 70px);
background-color: white;
margin-top: 10px;
position: relative;
.footer{
position: absolute;
bottom: 10px;
right: 10px;
}
}
.linkFont{
color: #1890ff;
&:hover{
cursor: pointer;
}
&.danger{
color: red
}
}
}
\ No newline at end of file
......@@ -46,6 +46,7 @@ const AddModal = props => {
const [isDayLoopShow, setIsDayLoopShow] = useState(false);
const [isWeekLoopShow, setIsWeekLoopShow] = useState(false);
const [waitCheck, setWaitCheck] = useState(false);
const [isPostRequest, setIsPostRequest] = useState(false);
const [isUse, setIsUse] = useState(false);
const [interval, setInterval] = useState(1);
const [loop_unit, setLoop_unit] = useState('Hour');
......@@ -74,6 +75,7 @@ const AddModal = props => {
is_enable: !record.Enabled,
url_type: record.Absolute ? true : false,
url_path: record.Url,
requestBody: record.requestBody,
request_header: record.CustomHeader,
plan_type: record.LoopMode,
start_time: record.StartFrom ? moment(record.StartFrom, dateFormat) : startTime,
......@@ -106,6 +108,7 @@ const AddModal = props => {
setInterval(record.Interval);
setLoop_unit(record.LoopUnit);
setWaitCheck(record.UseTimeout || false);
setIsPostRequest(record.isPostRequest || false);
setTime_out((record.Timeout !== -1 && record.Timeout / 1000) || 30);
if (record.Timeout !== -1) {
setWaitCheck(true);
......@@ -167,6 +170,7 @@ const AddModal = props => {
}
let data = {
Url: fv.url_path,
RequestBody: fv.requestBody,
CustomHeader: fv.request_header || '',
StartFrom: fv.start_time && fv.start_time.format(dateFormat),
EndAt: fv.end_time && fv.end_time.format(dateFormat),
......@@ -188,6 +192,7 @@ const AddModal = props => {
Name: fv.name,
Tolerate: null,
UseTimeout: waitCheck,
IsPostRequest: isPostRequest
};
time_out ? (data.MillisecondsTimeout = parseInt(time_out)) : -1;
if (!waitCheck) {
......@@ -329,6 +334,12 @@ const AddModal = props => {
const onWait = e => {
setWaitCheck(e);
};
const onPost = e => {
setIsPostRequest(e);
};
const changeUnit = e => {
setLoop_unit(e);
};
......@@ -386,7 +397,17 @@ const AddModal = props => {
<TextArea rows={3} placeholder="请输入URL名称" />
</Item>
</Item>
<Item label="定义请求体" name="requestBody" style={{ marginBottom: '0' }}>
<TextArea rows={3} placeholder="请输入定义请求体" />
</Item>
<Item label="是否使用post" name="isPostRequest" style={{ marginRight: '0.5rem' }}>
<Switch
checkedChildren="是"
unCheckedChildren="否"
onChange={onPost}
checked={isPostRequest}
/>
</Item>
<Item label="请求头" name="request_header">
<Input placeholder="请求头,选填" />
</Item>
......
......@@ -19,11 +19,12 @@ import { GetIISAgentSite, QueryIISAgentCalllog } from '@/services/scheduledTasks
const { RangePicker } = DatePicker;
const LookModal = props => {
const { visible, onCancel, keepTableList } = props;
const { visible, onCancel, keepTableList, planName } = props;
const [form] = Form.useForm(null);
const [currentTime, setCurrentTime] = useState('昨天');
const [siteData, setSiteData] = useState([]);
const [tableData, setTableData] = useState([]);
const [selectValue, setSelectValue] = useState(null)
const tableList = useRef({
pageSize: 20,
pageIndex: 1,
......@@ -43,6 +44,11 @@ const LookModal = props => {
const fixedVariable = useRef(['昨天', '今天', '上周', '本周', '本月', '上月', '自定义']);
useEffect(() => {
console.log(planName, 'wqeqweqwewq')
if(planName){
setSelectValue(planName)
tableList.current.jobName = planName
}
if (visible) {
getSiteList();
getLogList();
......@@ -287,11 +293,13 @@ const LookModal = props => {
};
const planChange = e => {
setSelectValue(e)
tableList.current.jobName = e;
getLogList();
};
const stateChange = e => {
tableList.current.state = e;
getLogList();
};
......@@ -315,6 +323,7 @@ const LookModal = props => {
))}
</Radio.Group>
{currentTime === '自定义' ? <RangePicker showToday onChange={timeChange} /> : ''}
{ !planName &&
<div className={styles.select}>
<span>站点名称:</span>
<Select
......@@ -325,12 +334,13 @@ const LookModal = props => {
>
{siteData && siteData.map(v => <Select.Option value={v}>{v}</Select.Option>)}
</Select>
</div>
</div>}
<div className={styles.select}>
<span>计划名称:</span>
<Select
style={{ width: '155px' }}
allowClear
value={selectValue}
placeholder="请选择任务性质"
onChange={e => planChange(e)}
>
......
......@@ -150,6 +150,7 @@ const IncidentView = asyncComponent(() =>
import('@/pages/bsmanager/workOrder/incident/incidentView'),
);
const Flow = asyncComponent(() => import('@/pages/bsmanager/workOrder/workFlow/flow'));
const AutoCase = asyncComponent(() => import('@/pages/bsmanager/workOrder/autoCase'));
const FlowNode = asyncComponent(() =>
import('@/pages/bsmanager/workOrder/workFlow/flowNode/flowNode'),
);
......@@ -373,6 +374,11 @@ export default {
name: '流程审查',
component: Flow,
},
{
path: '/biz/workflow/autoCase',
name: '自动化工单',
component: AutoCase,
},
],
},
{
......
......@@ -122,3 +122,31 @@ export const UpdateFlowNodeOrder = query => get(`${PUBLISH_SERVICE}/WorkOrderCen
export const GetAllDeviceDetails = query => get(`${PANDAWORKFLOW}/DevicePatrol/GetAllDeviceDetails`, query);
//查询流程自动化方案分页数据
export const GetFlowAutoConfigPageData = query => get(`${PUBLISH_SERVICE}/WorkFlow/GetFlowAutoConfigPageData`, query);
//新增或者修改流程自动化方案
export const AddOrEditFlowAutoConfig = query => post(`${PUBLISH_SERVICE}/WorkFlow/AddOrEditFlowAutoConfig`, query);
//获取条件触发模式下流程节点
export const GetScheduledConfigFlowNode = query => get(`${PUBLISH_SERVICE}/WorkFlow/GetScheduledConfigFlowNode`, query);
//获取定时触发模式下流程节点
export const GetConditionConfigFlowNode = query => get(`${PUBLISH_SERVICE}/WorkFlow/GetConditionConfigFlowNode`, query);
//删除流程自动化方案
export const DeleteFlowAutoConfig = query => get(`${PUBLISH_SERVICE}/WorkFlow/DeleteFlowAutoConfig`, query);
//启用/禁用流程自动化方案
export const EnableDisableFlowAutoConfig = query => get(`${PUBLISH_SERVICE}/WorkFlow/EnableDisableFlowAutoConfig`, query);
//获取流程自动配置详情
export const GetFlowAutoConfigDetail = query => get(`${PUBLISH_SERVICE}/WorkFlow/GetFlowAutoConfigDetail`, query);
//获取流程自动化方案日志
export const GetFlowAutoSchemeLogs = query => get(`${PUBLISH_SERVICE}/WorkFlow/GetFlowAutoSchemeLogs`, query);
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