Commit 80345082 authored by shaoan123's avatar shaoan123

修改消息平台模块

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