Commit 80345082 authored by shaoan123's avatar shaoan123

修改消息平台模块

parent 4b453311
Pipeline #32512 skipped with stages
...@@ -304,7 +304,6 @@ const ProjectManage = () => { ...@@ -304,7 +304,6 @@ const ProjectManage = () => {
/> />
</div> </div>
<Button type="primary" onClick={handleReset}>重置</Button> <Button type="primary" onClick={handleReset}>重置</Button>
<Button type="primary" style={{ marginLeft: "10px" }} icon={<PlusCircleOutlined />} onClick={onAddClick}><span style={{ marginTop: "-3px" }}>新增</span></Button> <Button type="primary" style={{ marginLeft: "10px" }} icon={<PlusCircleOutlined />} onClick={onAddClick}><span style={{ marginTop: "-3px" }}>新增</span></Button>
</div> </div>
......
...@@ -40,12 +40,11 @@ const VisibleIISAgentConfig = props => { ...@@ -40,12 +40,11 @@ const VisibleIISAgentConfig = props => {
const dateFormat = 'YYYY-MM-DD HH:mm:ss'; const dateFormat = 'YYYY-MM-DD HH:mm:ss';
const { agentConfig, value, onIISAgentSubmit } = props const { agentConfig, value, onIISAgentSubmit } = props
useEffect(() => { useEffect(() => {
console.log('agentConfig', agentConfig);
if (agentConfig) { if (agentConfig) {
let startTime = agentConfig.LoopMode === 'ByOnce' ? moment(new Date(new Date().toLocaleDateString()), 'YYYY-MM-DD 00:00:00').add(1, 'days') : moment(new Date(new Date().toLocaleDateString()), 'YYYY-MM-DD 00:00:00') let startTime = agentConfig.LoopMode === 'ByOnce' ? moment(new Date(new Date().toLocaleDateString()), 'YYYY-MM-DD 00:00:00').add(1, 'days') : moment(new Date(new Date().toLocaleDateString()), 'YYYY-MM-DD 00:00:00')
form.setFieldsValue({ form.setFieldsValue({
is_enable: agentConfig.Enabled, is_enable: agentConfig.Enabled,
url_type: agentConfig.Absolute ? false : true, url_type: agentConfig.Absolute ? true : false,
url_path: agentConfig.Url, url_path: agentConfig.Url,
request_header: agentConfig.CustomHeader, request_header: agentConfig.CustomHeader,
plan_type: agentConfig.LoopMode, plan_type: agentConfig.LoopMode,
...@@ -108,23 +107,20 @@ const VisibleIISAgentConfig = props => { ...@@ -108,23 +107,20 @@ const VisibleIISAgentConfig = props => {
setInterval(1) setInterval(1)
setLoop_unit('Hour') setLoop_unit('Hour')
} }
}, [agentConfig])
useEffect(() => {
if (value) { if (value) {
form.setFieldsValue({ form.setFieldsValue({
name: value name: value
}) })
setSelectRole(props.value) setSelectRole(props.value)
} }
}, [props]) }, [props])
const handleCancel = () => { const handleCancel = () => {
setPreviewVisible(false) setPreviewVisible(false)
} }
const handleOk = () => { const handleOk = async () => {
let fv = form.getFieldValue() let fv = form.getFieldValue()
if ((fv.loop_mode === 'ByDay' && !selectValues.length) || (fv.loop_mode === 'ByWeek' && !weekData.length)) { if ((fv.loop_mode === 'ByDay' && !selectValues.length) || (fv.loop_mode === 'ByWeek' && !weekData.length)) {
message.warning('请选择计划执行日') message.warning('请选择计划执行日')
...@@ -135,7 +131,7 @@ const VisibleIISAgentConfig = props => { ...@@ -135,7 +131,7 @@ const VisibleIISAgentConfig = props => {
CustomHeader: fv.request_header || '', CustomHeader: fv.request_header || '',
StartFrom: fv.start_time && fv.start_time.format(dateFormat), StartFrom: fv.start_time && fv.start_time.format(dateFormat),
EndAt: fv.end_time && fv.end_time.format(dateFormat), EndAt: fv.end_time && fv.end_time.format(dateFormat),
LoopMode: fv.loop_mode, LoopMode: fv.loop_mode === 'ByOnce' ? 'BYLOOP' : fv.loop_mode,
LoopUnit: loop_unit, LoopUnit: loop_unit,
MonthOfYear: null, MonthOfYear: null,
WeekOfMonth: null, WeekOfMonth: null,
...@@ -148,17 +144,18 @@ const VisibleIISAgentConfig = props => { ...@@ -148,17 +144,18 @@ const VisibleIISAgentConfig = props => {
AllowLog: fv.enable_log, AllowLog: fv.enable_log,
Enabled: isUse, Enabled: isUse,
Timeout: fv.time_out ? parseInt(fv.time_out) : 30, Timeout: fv.time_out ? parseInt(fv.time_out) : 30,
Absolute: true, Absolute: fv.url_type,
SiteInfo: null, SiteInfo: null,
Name: fv.name, Name: fv.name,
Tolerate: null, Tolerate: null,
UseTimeout: waitCheck UseTimeout: waitCheck
} }
fv.time_out ? data.MillisecondsTimeout = parseInt(fv.time_out) : '' fv.time_out ? data.MillisecondsTimeout = parseInt(fv.time_out) : ''
onIISAgentSubmit && onIISAgentSubmit( setPreviewVisible(false)
await onIISAgentSubmit && onIISAgentSubmit(
data data
) )
setPreviewVisible(false)
} }
const handleClick = () => { const handleClick = () => {
if (value) { if (value) {
...@@ -233,18 +230,22 @@ const VisibleIISAgentConfig = props => { ...@@ -233,18 +230,22 @@ const VisibleIISAgentConfig = props => {
setIsUse(value) setIsUse(value)
} }
const handleExe = (e) => { const handleExe = (e) => {
let obj = form.getFieldValue()
let value = e.target.value let value = e.target.value
setIsType(value) setIsType(value)
if (value === '执行一次') { if (value === '执行一次') {
changeLoopMode('ByOnce') changeLoopMode('ByOnce')
setLoop_unit('Second')
form.setFieldsValue({ form.setFieldsValue({
loop_mode: 'ByOnce', loop_mode: 'ByOnce',
hour_of_day: '', hour_of_day: '',
day_of_week: '' day_of_week: '',
end_time: obj.start_time
}) })
if (!agentConfig) { if (!agentConfig) {
form.setFieldsValue({ form.setFieldsValue({
start_time: moment(new Date(new Date().toLocaleDateString()), 'YYYY-MM-DD 00:00:00').add(1, 'days') start_time: moment(new Date(new Date().toLocaleDateString()), 'YYYY-MM-DD 00:00:00').add(1, 'days'),
end_time: moment(new Date(new Date().toLocaleDateString()), 'YYYY-MM-DD 00:00:00').add(1, 'days')
}) })
setExeTime(moment().add(1, 'days').format('YYYY-MM-DD 00:00:00')) setExeTime(moment().add(1, 'days').format('YYYY-MM-DD 00:00:00'))
} }
...@@ -253,7 +254,8 @@ const VisibleIISAgentConfig = props => { ...@@ -253,7 +254,8 @@ const VisibleIISAgentConfig = props => {
changeLoopMode('BYLOOP') changeLoopMode('BYLOOP')
setExeType(true) setExeType(true)
form.setFieldsValue({ form.setFieldsValue({
loop_mode: 'BYLOOP' loop_mode: 'BYLOOP',
end_time: ''
}) })
if (!agentConfig) { if (!agentConfig) {
form.setFieldsValue({ form.setFieldsValue({
...@@ -279,6 +281,12 @@ const VisibleIISAgentConfig = props => { ...@@ -279,6 +281,12 @@ const VisibleIISAgentConfig = props => {
} }
const changeStartTime = (e) => { const changeStartTime = (e) => {
setExeTime(moment(e).format('YYYY-MM-DD HH:mm:ss')) setExeTime(moment(e).format('YYYY-MM-DD HH:mm:ss'))
let obj = form.getFieldValue()
if (obj.loop_mode === 'ByOnce')
setLoop_unit('Second')
form.setFieldsValue({
end_time: moment(e).format('YYYY-MM-DD HH:mm:ss')
})
} }
const changeDay = (data) => { const changeDay = (data) => {
console.log('data', data); console.log('data', data);
...@@ -305,7 +313,6 @@ const VisibleIISAgentConfig = props => { ...@@ -305,7 +313,6 @@ const VisibleIISAgentConfig = props => {
visible={previewVisible} visible={previewVisible}
onOk={() => handleOk()} onOk={() => handleOk()}
confirmLoading={loading} confirmLoading={loading}
visible={previewVisible}
onCancel={handleCancel} onCancel={handleCancel}
> >
......
...@@ -21,7 +21,6 @@ const AddModal = props => { ...@@ -21,7 +21,6 @@ const AddModal = props => {
} }
useEffect(() => { useEffect(() => {
if (option) { if (option) {
console.log('option',option);
setTemplateName(option.filter(item => item.Type === '公众号')) setTemplateName(option.filter(item => item.Type === '公众号'))
form.setFieldsValue({ form.setFieldsValue({
type: '公众号' type: '公众号'
...@@ -151,7 +150,7 @@ const AddModal = props => { ...@@ -151,7 +150,7 @@ const AddModal = props => {
<Item <Item
label="模板参数" label="模板参数"
labelCol={{ span: 6 }}
name="params" name="params"
rules={[ rules={[
{ {
...@@ -160,11 +159,12 @@ const AddModal = props => { ...@@ -160,11 +159,12 @@ const AddModal = props => {
}, },
]} ]}
> >
<TextArea rows={4} placeholder="first|Second|Third|Four" /> <TextArea rows={4} style={{width:'96%'}} placeholder="first|Second|Third|Four" />
</Item> </Item>
<Item <Item
label="参数说明" label="参数说明"
name="desc" name="desc"
labelCol={{ span: 6 }}
rules={[ rules={[
{ {
required: true, required: true,
...@@ -172,11 +172,12 @@ const AddModal = props => { ...@@ -172,11 +172,12 @@ const AddModal = props => {
}, },
]} ]}
> >
<TextArea rows={4} placeholder="first: 标题信息|Second: 展示内容|Third: 时间|Four: 备注信息" /> <TextArea style={{width:'96%'}} rows={4} placeholder="first: 标题信息|Second: 展示内容|Third: 时间|Four: 备注信息" />
</Item> </Item>
<Item <Item
label="参数解析" label="参数解析"
name="analysis_params" name="analysis_params"
labelCol={{ span: 6 }}
rules={[ rules={[
{ {
required: true, required: true,
...@@ -184,7 +185,7 @@ const AddModal = props => { ...@@ -184,7 +185,7 @@ const AddModal = props => {
}, },
]} ]}
> >
<TextArea rows={4} placeholder="param1|param2|param3|param4" /> <TextArea rows={4} style={{width:'96%'}} placeholder="param1|param2|param3|param4" />
</Item> </Item>
</Form> </Form>
</div> </div>
......
...@@ -9,6 +9,7 @@ const EditModal = props => { ...@@ -9,6 +9,7 @@ const EditModal = props => {
const { option } = props; const { option } = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
const [templateName, setTemplateName] = useState([]);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const onSubmit = () => { const onSubmit = () => {
form.submit() form.submit()
...@@ -30,6 +31,9 @@ const EditModal = props => { ...@@ -30,6 +31,9 @@ const EditModal = props => {
desc: props.template.desc, desc: props.template.desc,
analysis_params: props.template.analysis_params, analysis_params: props.template.analysis_params,
}) })
if (option) {
setTemplateName(option.filter(item => item.Type === props.template.type))
}
}, [props.template]) }, [props.template])
const layout = { const layout = {
...@@ -42,13 +46,17 @@ const EditModal = props => { ...@@ -42,13 +46,17 @@ const EditModal = props => {
}, },
}; };
const onChange = value => { const onChangeType = (value) => {
const { length } = value; console.log(option.filter(item => item.Type === value),'123');
setTemplateName(option.filter(item => item.Type === value))
}
const onChange = (value, option) => {
form.setFieldsValue({ form.setFieldsValue({
dbName: value[length - 1], third_id: option.code
}); })
}; // setTemplateName(option.filter(item => item.Type === value))
};
return ( return (
<SiteModal <SiteModal
{...props} {...props}
...@@ -90,7 +98,7 @@ const EditModal = props => { ...@@ -90,7 +98,7 @@ const EditModal = props => {
}, },
]} ]}
> >
<Select> <Select onChange={(value) => onChangeType(value)}>
<Select.Option value="公众号">公众号</Select.Option> <Select.Option value="公众号">公众号</Select.Option>
<Select.Option value="短信">短信</Select.Option> <Select.Option value="短信">短信</Select.Option>
</Select> </Select>
...@@ -112,17 +120,13 @@ const EditModal = props => { ...@@ -112,17 +120,13 @@ const EditModal = props => {
{/* <Input placeholder="请输入模板名称" /> */} {/* <Input placeholder="请输入模板名称" /> */}
<Select <Select
placeholder="请选择模板名称" placeholder="请选择模板名称"
// onFocus={() => { onChange={(value, option) => onChange(value, option)}
// selectFocus();
// }}
onChange={e => {
onChange(e);
}}
> >
{option && {templateName &&
option.length > 0 && templateName.length > 0 &&
option.map((item, index) => ( templateName.map((item, index) => (
<Option value={item.Name} key={item.Name + index}> <Option value={item.Name} key={item.Name + index} code={item.Code}>
{item.Name} {item.Name}
</Option> </Option>
))} ))}
...@@ -154,7 +158,7 @@ const EditModal = props => { ...@@ -154,7 +158,7 @@ const EditModal = props => {
<Item <Item
label="模板参数" label="模板参数"
name="params" name="params"
labelCol="{span:10}" labelCol={{ span: 3 }}
style={{ marginLeft: '1.4rem' }} style={{ marginLeft: '1.4rem' }}
rules={[ rules={[
{ {
...@@ -176,7 +180,7 @@ const EditModal = props => { ...@@ -176,7 +180,7 @@ const EditModal = props => {
<Col span={23}> <Col span={23}>
<Item <Item
label="参数说明" label="参数说明"
labelCol="{span:10}" labelCol={{ span: 3 }}
style={{ marginLeft: '1.4rem' }} style={{ marginLeft: '1.4rem' }}
name="desc" name="desc"
rules={[ rules={[
...@@ -199,7 +203,7 @@ const EditModal = props => { ...@@ -199,7 +203,7 @@ const EditModal = props => {
<Col span={23}> <Col span={23}>
<Item <Item
label="参数解析" label="参数解析"
labelCol="{span:10}" labelCol={{ span: 3 }}
style={{ marginLeft: '1.4rem' }} style={{ marginLeft: '1.4rem' }}
name="analysis_params" name="analysis_params"
rules={[ rules={[
......
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