Commit c52c507d authored by 皮倩雯's avatar 皮倩雯

fix: '事件权限必填验证'

parent 5f0c9a9c
Pipeline #65474 passed with stages
...@@ -535,10 +535,11 @@ const AddModal = props => { ...@@ -535,10 +535,11 @@ const AddModal = props => {
obj.ReportFromMobile = ''; obj.ReportFromMobile = '';
obj.ReportFromWeb = ''; obj.ReportFromWeb = '';
} }
if ((obj.Roles == '' || obj.Roles == undefined) && obj.Reportable != '否') { if ((obj.Roles == '' || obj.Roles == undefined) && obj.CreateMode === '0') {
console.log(obj.CreateMode)
notification.warning({ notification.warning({
message: '提示', message: '提示',
description: '当允许客户端上报时,须填写事件权限', description: '事件权限必填',
}); });
} else { } else {
if (type == 'edit') { if (type == 'edit') {
...@@ -1544,7 +1545,22 @@ const AddModal = props => { ...@@ -1544,7 +1545,22 @@ const AddModal = props => {
</Item> </Item>
</Col> </Col>
<Col span={24}> <Col span={24}>
<Item label="上报方式" name="CreateMode" labelCol={{ span: 5 }}> <Item
label={
<div style={{ display: 'flex', alignItems: 'center' }}>
<Tooltip title="选择仅上报时,事件权限必填">
<InfoCircleOutlined
style={{
color: '#1890ff',
}}
/>
</Tooltip>
<span>上报方式</span>
</div>
}
name="CreateMode"
labelCol={{ span: 5 }}
>
<Radio.Group onChange={onChange2} value={value} defaultValue={chee}> <Radio.Group onChange={onChange2} value={value} defaultValue={chee}>
<Radio value={1}>立即发起(工单模型)</Radio> <Radio value={1}>立即发起(工单模型)</Radio>
<Radio value={0}>仅上报(事件模型)</Radio> <Radio value={0}>仅上报(事件模型)</Radio>
......
import React, { useEffect } from 'react'; import React, { useEffect, useState } from 'react';
import { getFlowNodeExtendPage, operateFlowNodeExtendPage } from '@/services/flow/flow'; import { getFlowNodeExtendPage, operateFlowNodeExtendPage } from '@/services/flow/flow';
import { Form, Modal, Input, notification } from 'antd'; import { Form, Modal, Input, notification, Button } from 'antd';
import ParmarModal from './ParmarModal';
const ProcessConfig = props => { const ProcessConfig = props => {
const { onSubumit, handleCancel, visible, msg, flowNodeId, modalType, title } = props; const { onSubumit, handleCancel, visible, msg, flowNodeId, modalType, title } = props;
const [showParmarModal, setShowParmarModal] = useState(false);
const [form] = Form.useForm(); const [form] = Form.useForm();
useEffect(() => { useEffect(() => {
form.resetFields(); form.resetFields();
...@@ -28,7 +31,6 @@ const ProcessConfig = props => { ...@@ -28,7 +31,6 @@ const ProcessConfig = props => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
let obj = {}; let obj = {};
console.log(modalType);
if (modalType === 'add') { if (modalType === 'add') {
obj = validate; obj = validate;
} else { } else {
...@@ -61,6 +63,12 @@ const ProcessConfig = props => { ...@@ -61,6 +63,12 @@ const ProcessConfig = props => {
} }
}); });
}; };
// 添加功能路劲参数
const addParama = () => {
console.log(form.getFieldValue('WebParam'));
setShowParmarModal(true);
};
return ( return (
<Modal <Modal
title="流程节点辅助视图配置" title="流程节点辅助视图配置"
...@@ -86,7 +94,12 @@ const ProcessConfig = props => { ...@@ -86,7 +94,12 @@ const ProcessConfig = props => {
<Input placeholder="请输入前端视图" /> <Input placeholder="请输入前端视图" />
</Form.Item> </Form.Item>
<Form.Item label="视图参数" name="WebParam"> <Form.Item label="视图参数" name="WebParam">
<Input placeholder="请输入视图参数" /> <div style={{ display: 'flex' }}>
<Form.Item name="WebParam" style={{ marginBottom: 0, width: '100%' }}>
<Input placeholder="请输入视图参数" style={{ width: '100%' }} />
</Form.Item>
<Button onClick={addParama}>参数管理</Button>
</div>
</Form.Item> </Form.Item>
<Form.Item label="手持标签" name="MobileLabel"> <Form.Item label="手持标签" name="MobileLabel">
<Input placeholder="请输入手持标签" /> <Input placeholder="请输入手持标签" />
...@@ -98,6 +111,15 @@ const ProcessConfig = props => { ...@@ -98,6 +111,15 @@ const ProcessConfig = props => {
<Input placeholder="请输入手持参数" /> <Input placeholder="请输入手持参数" />
</Form.Item> </Form.Item>
</Form> </Form>
<ParmarModal
pageUrl={form.getFieldsValue().WebParam}
handleCancel={() => setShowParmarModal(false)}
visible={showParmarModal}
parmarCallBack={url => {
form.setFieldsValue({ WebParam: url });
setShowParmarModal(false);
}}
/>
</Modal> </Modal>
); );
}; };
......
import React, { useEffect } from 'react';
import { Modal, Form, Button, Input, Space } from 'antd';
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
const ParmarModal = props => {
const { pageUrl, visible, handleCancel, parmarCallBack } = props;
const [form] = Form.useForm();
useEffect(() => {
if (visible) {
// 给url通过字符串分割成表单需要的数据形式
console.log(pageUrl);
if (pageUrl) {
if (pageUrl.indexOf('[') !== -1) {
form.setFieldsValue({ parmars: JSON.parse(pageUrl) });
}
}
} else {
// 关闭弹窗清除表单数据
form.resetFields();
}
}, [visible]);
// 保存
const onFinish = () => {
form.validateFields().then(validate => {
if (validate) {
let parma = form.getFieldsValue().parmars;
console.log(parma, 'parma');
if (parma) {
parmarCallBack(JSON.stringify(parma));
} else {
parmarCallBack();
}
}
});
};
return (
<div>
<Modal
title="参数配置"
visible={visible}
onOk={onFinish}
onCancel={handleCancel}
maskClosable={false}
destroyOnClose
centered
>
<div style={{ maxHeight: '400px', overflowY: 'scroll', marginBottom: '10px' }}>
<Form name="form" form={form} labelCol={{ span: 7 }}>
<Form.List name="parmars">
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, fieldKey, ...restField }) => (
<Space
key={key}
style={{ display: 'flex', marginBottom: '5px', justifyContent: 'center' }}
align="baseline"
>
<Form.Item
{...restField}
style={{ marginBottom: '5px' }}
name={[name, 'webParamKey']}
fieldKey={[fieldKey, 'key']}
validateTrigger={['onChange', 'onBlur']}
rules={[
{ required: true, message: '请填写参数名' },
{
validator: () => {
// 验证参数名不能重复
const allKey = form
.getFieldsValue()
.parmars.map(item => (item ? item.webParamKey : ''));
const repeatKey = new Set(allKey);
if (repeatKey.size !== allKey.length) {
return Promise.reject(new Error('参数名重复'));
}
return Promise.resolve();
},
},
]}
>
<Input placeholder="请填写参数名" />
</Form.Item>
<Form.Item
{...restField}
style={{ marginBottom: '5px' }}
name={[name, 'webParamValue']}
fieldKey={[fieldKey, 'value']}
rules={[{ required: true, message: '请填写参数' }]}
>
<Input placeholder="请填写参数" />
</Form.Item>
<MinusCircleOutlined
onClick={() => remove(name)}
style={{ marginLeft: '10px', fontSize: '20px' }}
/>
</Space>
))}
<Form.Item>
<Button
style={{ width: '375px', marginLeft: '30px' }}
type="dashed"
onClick={() => add()}
block
icon={<PlusOutlined />}
>
添加参数
</Button>
</Form.Item>
</>
)}
</Form.List>
</Form>
</div>
</Modal>
</div>
);
};
export default ParmarModal;
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