Commit bc7af539 authored by shaoan123's avatar shaoan123

更改消息平台界面

parent d2abfe48
Pipeline #32001 passed with stages
in 33 minutes 7 seconds
......@@ -8,7 +8,8 @@ import {
Select,
Popconfirm,
message,
Tooltip
Tooltip,
Spin
} from 'antd';
import { PlusCircleOutlined, EditTwoTone, DeleteOutlined, FundViewOutlined } from '@ant-design/icons';
import { useHistory } from 'react-router-dom';
......@@ -37,6 +38,7 @@ const ProjectManage = () => {
const [pageIndex, setPageIndex] = useState(0)
const [pageSize, setPageSize] = useState(10)
const [dataList, setDataList] = useState([])
const [treeLoading, setTreeLoading] = useState(false);
const columns = [
{
title: '方案名称',
......@@ -74,7 +76,7 @@ const ProjectManage = () => {
render: (text, record) => (
<Space>
<Tooltip title="测试">
<FundViewOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={() => {
<FundViewOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={() => {
TestDesc(record);
}} />
</Tooltip>
......@@ -98,7 +100,7 @@ const ProjectManage = () => {
}}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }}></DeleteOutlined>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }}></DeleteOutlined>
</Popconfirm>
</div>)
}
......@@ -213,8 +215,10 @@ const ProjectManage = () => {
}
useEffect(() => {
setTreeLoading(true)
GetMsgTypeList().then(
res => {
setTreeLoading(false)
if (res.code === 0) {
setMessageTypes(res.data)
}
......@@ -226,8 +230,10 @@ const ProjectManage = () => {
}, [flag])
const GetMessageList = (params) => {
setTreeLoading(true)
GetMessageConfigList(params).then(
res => {
setTreeLoading(false)
let mesList = []
if (res.code === 0) {
console.log('res.data.MessageConfigModels', res.data.MessageConfigModels);
......@@ -242,7 +248,7 @@ const ProjectManage = () => {
item: item
})
})
console.log('mesList', mesList);
setDataList(mesList)
}
}
......@@ -250,61 +256,63 @@ const ProjectManage = () => {
}
return (
<div className={styles.project_container}>
<div className={styles.operate_bar}>
<div className={styles.template_type}>
<div className={styles.title}>方案类型</div>
<Select placeholder="请选择方案类型!" defaultValue={currentType} style={{ width: "150px" }} onChange={onTypeChange}>
<Option value="全部">全部</Option>
<Option value="监控报警">监控报警</Option>
<Option value="工单办理">工单办理</Option>
<Option value="平台公告">平台公告</Option>
<Option value="定时推送">定时推送</Option>
</Select>
</div>
<div className={styles.template_type}>
<div className={styles.title}>方案名称</div>
<Select placeholder="请选择方案名称!" defaultValue={currentName} style={{ width: "150px" }} onChange={onNameChange}>
<Option value="全部">全部</Option>
{
messageTypes.map((item, idx) => {
return (
<Option key={idx} value={item.MsgType}>{item.MsgType}</Option>
)
})
}
</Select>
</div>
<div className={styles.fast_search}>
<div className={styles.title}>快速检索</div>
<Search
allowClear
placeholder={placeholder}
onSearch={handleSearch}
// onChange={handleChange}
enterButton
style={{ width: "300px" }}
/>
</div>
<Button type="primary" onClick={handleReset}>重置</Button>
<Spin tip="loading..." spinning={treeLoading}>
<div className={styles.operate_bar}>
<div className={styles.template_type}>
<div className={styles.title}>方案类型</div>
<Select placeholder="请选择方案类型!" defaultValue={currentType} style={{ width: "150px" }} onChange={onTypeChange}>
<Option value="全部">全部</Option>
<Option value="监控报警">监控报警</Option>
<Option value="工单办理">工单办理</Option>
<Option value="平台公告">平台公告</Option>
<Option value="定时推送">定时推送</Option>
</Select>
</div>
<div className={styles.template_type}>
<div className={styles.title}>方案名称</div>
<Select placeholder="请选择方案名称!" defaultValue={currentName} style={{ width: "150px" }} onChange={onNameChange}>
<Option value="全部">全部</Option>
{
messageTypes.map((item, idx) => {
return (
<Option key={idx} value={item.MsgType}>{item.MsgType}</Option>
)
})
}
</Select>
</div>
<div className={styles.fast_search}>
<div className={styles.title}>快速检索</div>
<Search
allowClear
placeholder={placeholder}
onSearch={handleSearch}
// onChange={handleChange}
enterButton
style={{ width: "300px" }}
/>
</div>
<Button type="primary" onClick={handleReset}>重置</Button>
<Button type="primary" style={{ marginLeft: "10px" }} icon={<PlusCircleOutlined />} onClick={onAddClick}>新增</Button>
<Button type="primary" style={{ marginLeft: "10px" }} icon={<PlusCircleOutlined />} onClick={onAddClick}>新增</Button>
</div>
<div className={styles.list_view}>
<Table columns={columns} dataSource={dataList} pagination={{ pageSize: '10' }} rowKey='ID' />
</div>
<EditModal
visible={visibleParams.editVisible}
template={currentTemplate}
onCancel={() => handleShowModal('editVisible', false)}
confirmModal={editModal}
/>
<EditModal
visible={visibleParams.addVisible}
template={{}}
onCancel={() => handleShowModal('addVisible', false)}
confirmModal={bddModal}
/>
</div>
<div className={styles.list_view}>
<Table columns={columns} dataSource={dataList} pagination={{ pageSize: '10' }} rowKey='ID' />
</div>
<EditModal
visible={visibleParams.editVisible}
template={currentTemplate}
onCancel={() => handleShowModal('editVisible', false)}
confirmModal={editModal}
/>
<EditModal
visible={visibleParams.addVisible}
template={{}}
onCancel={() => handleShowModal('addVisible', false)}
confirmModal={bddModal}
/>
</Spin>
</div>
)
}
......
......@@ -61,7 +61,7 @@ const DayOfWeekSelect = props => {
{
hours.map((item, idx) => {
return (
<Col span={4}>
<Col span={4} key={idx}>
<Checkbox value={item.value}>{item.name}</Checkbox>
</Col>
)
......
......@@ -81,7 +81,7 @@ const HourOfDaySelect = props => {
{
hours.map((item, idx) => {
return (
<Col span={4}>
<Col span={4} key={idx}>
<Checkbox value={item.value}>{item.name}</Checkbox>
</Col>
)
......
import React, { useEffect, useState } from 'react'
import SiteModal from '@/components/Modal/SiteModa';
import { Checkbox, Input, Button, Modal, Form, Radio, DatePicker, Switch, Select, message } from 'antd'
import { Checkbox, Input, Button, Card, InputNumber, Form, Radio, DatePicker, Switch, Select, message } from 'antd'
import HourOfDaySelect from './HourOfDaySelect'
import DayOfWeekSelect from './DayOfWeekSelect'
import styles from './VisibleIISAgentConfig.less'
import moment from 'moment'
import { tr } from 'voca';
import {EditOutlined } from '@ant-design/icons';
import { EditOutlined } from '@ant-design/icons';
const { Item } = Form;
const { TextArea } = Input;
let unitType = { Hour: '小时', Minute: '分钟', Second: '秒' }
const VisibleIISAgentConfig = props => {
const [loading, setLoading] = useState(false);
......@@ -23,10 +24,18 @@ const VisibleIISAgentConfig = props => {
const [isLoopShow, setIsLoopShow] = useState(false)
const [isDayLoopShow, setIsDayLoopShow] = useState(false)
const [isWeekLoopShow, setIsWeekLoopShow] = useState(false)
const [waitCheck, setWaitCheck] = useState(false)
const [isUse, setIsUse] = useState(true)
const [interval, setInterval] = useState(1)
const [loop_unit, setLoop_unit] = useState('Hour')
const [exeType, setExeType] = useState(true)
const [isType, setIsType] = useState( '重复执行')
const [isTypeValue, setIsTypeValue] = useState( 'BYLOOP')
const [form] = Form.useForm();
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
const { agentConfig, value, onIISAgentSubmit } = props
useEffect(() => {
console.log('agentConfig', agentConfig);
if (agentConfig) {
form.setFieldsValue({
is_enable: agentConfig.Enabled,
......@@ -46,20 +55,34 @@ const VisibleIISAgentConfig = props => {
reentrant: agentConfig.AllowReentrant,
enable_log: agentConfig.AllowLog,
})
setIsUse(agentConfig.Enabled)
changeLoopMode(agentConfig.LoopMode)
setReenCheck(agentConfig.AllowReentrant)
setPostCheck(agentConfig.UsePostState)
setLogCheck(agentConfig.AllowLog)
setInterval(agentConfig.Interval)
setLoop_unit(agentConfig.LoopUnit)
} else {
form.setFieldsValue({
type: '重复执行',
url_type: false,
loop_mode: 'BYLOOP'
})
setIsType('重复执行')
changeLoopMode('BYLOOP')
setIsUse(true)
setInterval(1)
setLoop_unit('Hour')
}
if(value){
if (value) {
form.setFieldsValue({
name: value
})
setSelectRole(props.value)
}
}, [props])
......@@ -76,24 +99,24 @@ const VisibleIISAgentConfig = props => {
CustomHeader: fv.request_header,
StartFrom: fv.start_time && fv.start_time.format(dateFormat),
EndAt: fv.end_time && fv.end_time.format(dateFormat),
MillisecondsTimeout: parseInt(fv.time_out) ,
MillisecondsTimeout: parseInt(fv.time_out),
LoopMode: fv.loop_mode,
LoopUnit: fv.loop_unit,
LoopUnit: loop_unit,
MonthOfYear: null,
WeekOfMonth: null,
DayOfWeek: fv.day_of_week && fv.day_of_week.toString(),
DayOfMonth: null,
HourOfDay: fv.hour_of_day && fv.hour_of_day.toString(),
Interval: fv.interval,
Interval: interval,
UsePostState: fv.post_state,
AllowReentrant: fv.reentrant,
AllowLog: fv.enable_log,
Enabled: fv.is_enable,
Enabled: isUse,
Timeout: parseInt(fv.time_out),
Absolute: true,
SiteInfo:null,
Name:fv.name,
Tolerate:null
SiteInfo: null,
Name: fv.name,
Tolerate: null
}
)
setPreviewVisible(false)
......@@ -128,13 +151,13 @@ const VisibleIISAgentConfig = props => {
}
const changeLoopMode = (value) => {
setIsTypeValue(value)
switch (value) {
case "ByOnce":
setIsEndTimeShow(false)
setIsLoopShow(true)
setIsWeekLoopShow(false)
setIsDayLoopShow(false)
break
case "BYLOOP":
setIsEndTimeShow(true)
......@@ -161,21 +184,42 @@ const VisibleIISAgentConfig = props => {
const onLoopModeChange = (e) => {
changeLoopMode(e.target.value)
}
const onChange = (value) => {
setIsUse(value)
}
const handleExe = (e) => {
let value = e.target.value
setIsType(value)
if (value === '执行一次') {
changeLoopMode('ByOnce')
setExeType(false)
} else {
setExeType(true)
}
}
const onWait = (e) => {
setWaitCheck(e)
}
const changeUnit = (e) => {
setLoop_unit(e)
}
const changeInterval = (e) => {
setInterval(e)
}
return (
<div className={styles.agent_container}>
<Input value={selectRole} disabled={true} />
<div className={styles.select_btn} onClick={handleClick}><EditOutlined style={{fontSize:'18px'}}/></div>
<div className={styles.select_btn} onClick={handleClick}><EditOutlined style={{ fontSize: '18px' }} /></div>
<SiteModal
{...props}
title="编辑定时任务"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 200, borderRadius: '20px' }}
style={{ top: 100, borderRadius: '20px' }}
width="800px"
destroyOnClose
cancelText="取消"
okText="确认"
forceRender
forceRender
visible={previewVisible}
onOk={() => handleOk()}
confirmLoading={loading}
......@@ -184,37 +228,36 @@ const VisibleIISAgentConfig = props => {
>
<div className={styles.IISAgent_container}>
<Form form={form} labelCol={{ span: 4 }}>
<Form form={form} labelCol={{ span: 4 }} wrapperCol={{ span: 18 }}>
<Item
label="计划名称"
name="name"
>
<Input placeholder="请输入计划名称" disabled={true} />
</Item>
<Item
label="是否开启"
name="is_enable"
>
<Select >
<Option value={true}>开启</Option>
<Option value={false}>关闭</Option>
</Select>
</Item>
<Item
label="路径类型"
name="url_type"
>
<Radio.Group >
<Radio value={false}>相对路径</Radio>
<Radio value={true}>绝对路径</Radio>
</Radio.Group>
</Item>
<Item
label="URL路径"
name="url_path"
>
<Input placeholder="请输入URL名称" />
<Item
label=""
name="url_type"
style={{ marginBottom: '0.2rem' }}
>
<Radio.Group >
<Radio value={false}>相对路径(便于配置迁移)</Radio>
<Radio value={true}>绝对路径(用于外链)</Radio>
</Radio.Group>
</Item>
<Item
label=""
name="url_path"
style={{ marginBottom: '0' }}
>
<TextArea rows={3} placeholder="请求头,选填" />
</Item>
</Item>
<Item
label="请求头"
name="request_header"
......@@ -222,49 +265,68 @@ const VisibleIISAgentConfig = props => {
<Input placeholder="请输入URL名称" />
</Item>
<Item
label="计划类型"
name="type"
>
<Radio.Group onChange={handleExe}>
<Radio.Button value="重复执行">重复执行</Radio.Button>
<Radio.Button value="执行一次">执行一次</Radio.Button>
</Radio.Group>
</Item>
{exeType && (<Item
label="执行方式"
name="loop_mode"
>
<Radio.Group onChange={onLoopModeChange}>
<Radio value={"ByOnce"}>一次</Radio>
<Radio value={"BYLOOP"}>循环</Radio>
<Radio value={"ByDay"}>每天</Radio>
<Radio value={"ByWeek"}>每周</Radio>
</Radio.Group>
</Item>
</Item>)}
<Item
label="开始时间"
name="start_time"
wrapperCol={{ span: 28 }}
style={{ marginBottom: '0' }}
>
<DatePicker showTime />
</Item>
{
isEndTimeShow && (
<div style={{ display: 'flex' }}>
<Item
label="结束时间"
name="end_time"
label=""
name="start_time"
style={{ marginRight: '1rem' }}
>
<DatePicker showTime />
</Item>
)
}
{
isEndTimeShow && (
<Item
label="结束时间"
name="end_time"
>
<DatePicker showTime />
</Item>
)
}
</div>
</Item>
{
isLoopShow && (
<div>
<Item
label="循环周期"
name="interval"
>
<Input placeholder="请输入循环周期" />
</Item>
<Item
label="循环单位"
name="loop_unit"
>
<Input placeholder="请输入循环单位" />
</Item>
</div>
isLoopShow && (isType === '重复执行') && (
<Card style={{ width: 600, margin: '0 0 1rem 3.6rem', height: '8rem' }}>
<div className={styles.loopShow}>
<span></span>
<InputNumber min={0} value={interval} style={{ margin: '0 0.5rem' }} onChange={changeInterval} placeholder="请输入循环周期" />
<Select value={loop_unit} onChange={changeUnit} style={{ width: '8rem', margin: '0 0.5rem' }} >
<Select.Option value="Hour">小时</Select.Option>
<Select.Option value="Minute">分钟</Select.Option>
<Select.Option value="Second"></Select.Option>
</Select>
<span> 执行一次</span>
</div>
</Card>
)
}
{
......@@ -288,28 +350,82 @@ const VisibleIISAgentConfig = props => {
)
}
<Item
label="超时时间"
name="time_out"
label="说明"
>
<Input />
<div style={{ color: '#909EB6FF', fontSize: '12px' }}>
{isType === '执行一次' && (<span>
{moment().subtract(-1, "days").format('YYYY-MM-DD 00:00:00')}执行一次
</span>)}
{isType === '重复执行' && isTypeValue !== 'BYLOOP' && (<span style={{ color: '#f00' }}>
{moment().format('YYYY-MM-DD 00:00:00')}开始
</span>)}
{isType === '重复执行' && isTypeValue === 'BYLOOP' && (<span style={{ color: '#909EB6FF' }}>
{moment().format('YYYY-MM-DD 00:00:00')}开始,每{interval}{unitType[loop_unit]}执行一次。
</span>)}
</div>
</Item>
<Item
label="POST状态"
name="post_state"
>
<Switch checkedChildren="开启" unCheckedChildren="关闭" onChange={onPostChange} checked={postCheck} />
</Item>
label="请求等待"
wrapperCol={{ span: 28 }}
style={{ marginBottom: '0' }}
> <div style={{ display: 'flex' }}>
<Item
name="wait"
style={{ marginRight: '2rem' }}
>
<Switch checkedChildren="开启" unCheckedChildren="关闭" onChange={onWait} checked={waitCheck} />
</Item>
{waitCheck && (<Item
label="超时时间"
name="time_out"
>
<div>
<InputNumber />
<span>(单位:秒)</span>
</div>
</Item>)}
</div></Item>
<Item
label="允许重入"
name="reentrant"
>
<Switch checkedChildren="开启" unCheckedChildren="关闭" onChange={onReenChange} disabled={isReentrant} checked={reenCheck} />
label="POST状态"
wrapperCol={{ span: 28 }}
style={{ marginBottom: '0' }}
> <div style={{ display: 'flex' }}>
<Item
name="post_state"
style={{ marginRight: '2rem' }}
>
<Switch checkedChildren="开启" unCheckedChildren="关闭" onChange={onPostChange} checked={postCheck} />
</Item>
<Item
label="允许重入"
name="reentrant"
>
<Switch checkedChildren="开启" unCheckedChildren="关闭" onChange={onReenChange} disabled={isReentrant} checked={reenCheck} />
</Item>
</div>
</Item>
<Item
label="开启日志"
name="enable_log"
>
<Switch checkedChildren="开启" unCheckedChildren="关闭" onChange={onLogChange} checked={logCheck} />
wrapperCol={{ span: 28 }}
> <div style={{ display: 'flex' }}>
<Item
name="enable_log"
style={{ marginRight: '2rem' }}
>
<Switch checkedChildren="开启" unCheckedChildren="关闭" onChange={onLogChange} checked={logCheck} />
</Item>
<Item
label="是否开启"
name="is_enable"
>
<Switch checkedChildren="开启" unCheckedChildren="关闭" checked={isUse} onChange={onChange} />
</Item>
</div>
</Item>
</Form>
......
......@@ -17,4 +17,9 @@
height: 500px;
}
.loopShow{
display: flex;
align-items: center;
margin-left: 3.6rem;
}
......@@ -330,7 +330,7 @@ const EditModal = props => {
<Item
label="模板"
name="app_template"
labelCol={{ span: 4 }}
labelCol={{ span: 3 }}
>
<Select style={{ width: '97%' }} disabled={!currentTrench.isAPPShow} >
{
......@@ -345,7 +345,7 @@ const EditModal = props => {
<Item
label="功能路径"
name="app_path"
labelCol={{ span: 4 }}
labelCol={{ span: 3 }}
>
<Input style={{ width: '97%' }} disabled={!currentTrench.isAPPShow} placeholder="请输入功能路径" />
</Item>
......@@ -405,7 +405,7 @@ const EditModal = props => {
<Item
label="模板"
name="web_template"
labelCol={{ span: 4 }}
labelCol={{ span: 3 }}
>
<Select style={{ width: '97%' }} disabled={!currentTrench.isWEBShow}>
{
......@@ -420,7 +420,7 @@ const EditModal = props => {
<Item
label="功能路径"
name="web_path"
labelCol={{ span: 4 }}
labelCol={{ span: 3 }}
>
<Input style={{ width: '97%' }} disabled={!currentTrench.isWEBShow} placeholder="请输入功能路径" />
</Item>
......
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