Commit 48a09804 authored by 邓超's avatar 邓超

fix: 优化外部字段展示,web配置添加动态添加参数模块,重构台账管理台账配置界面

parent 6de1043a
Pipeline #41966 passed with stages
in 8 minutes 10 seconds
......@@ -6,18 +6,12 @@ import styles from './ItemCard.less';
const tip = 'loading...';
export const getId = item =>
item.userID || item.roleID || item.stationID || item.id;
export const getId = item => item.userID || item.roleID || item.stationID || item.id;
export const checkIsGroup = node =>
['widgetGroup'].includes(node?.type || node) && node.children?.length > 0;
// 递归遍历节点的方法
export const checkChildrenByCondition = (
item,
fn,
withGroup = true,
method = 'every',
) => {
export const checkChildrenByCondition = (item, fn, withGroup = true, method = 'every') => {
if (!checkIsGroup(item)) {
return fn(item);
}
......@@ -75,8 +69,7 @@ const ListCard = props => {
const getAllID = item => {
let result = [];
const haveChildren =
Array.isArray(item.children) && item.children.length > 0;
const haveChildren = Array.isArray(item.children) && item.children.length > 0;
// 统一使用 getId
result.push(getId(item));
if (haveChildren) {
......
......@@ -30,8 +30,7 @@ const DraggableBodyRow = ({
return {
isOver: monitor.isOver(),
canDrop: monitor.canDrop(),
dropClassName:
dragIndex < index ? 'drop-over-downward' : 'drop-over-upward',
dropClassName: dragIndex < index ? 'drop-over-downward' : 'drop-over-upward',
};
},
drop: item => {
......
......@@ -37,11 +37,7 @@ const PictureWallProvider = props => {
useEffect(() => {
update();
}, []);
return (
<UploadContext.Provider value={{ imgBed, update }}>
{children}
</UploadContext.Provider>
);
return <UploadContext.Provider value={{ imgBed, update }}>{children}</UploadContext.Provider>;
};
export { UploadContext as default, PictureWallProvider };
......@@ -442,7 +442,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
onOk={this.handleModalOk}
className={styles.modal}
>
<Search onSearch={onSearch} />
{/* <Search onSearch={onSearch} /> */}
<Tabs defaultActiveKey={imgBed[0]?.moduleName} tabPosition="left" style={{ height: 520 }}>
{imgBed.map((item, i) => {
if (item.moduleName == picType || item.moduleName == 'CityTemp') {
......
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, 'pageUrl');
let parma = pageUrl
.split('?')[1]
?.split('&')
?.map(item => ({ key: item.split('=')[0], value: item.split('=')[1] }));
form.setFieldsValue({ parmars: parma });
} else {
// 关闭弹窗清除表单数据
form.resetFields();
}
}, [visible]);
// 保存
const onFinish = () => {
form.validateFields().then(validate => {
if (validate) {
let parma = form
.getFieldValue('parmars')
.map(item => `${item.key}=${item.value}`)
.join('&');
console.log(parma, 'parma');
parmarCallBack(`${pageUrl.split('?')[0]}?${parma}`);
}
});
};
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: 8, justifyContent: 'center' }}
align="baseline"
>
<Form.Item
{...restField}
name={[name, 'key']}
fieldKey={[fieldKey, 'key']}
validateTrigger={['onChange', 'onBlur']}
rules={[
{ required: true, message: '请填写参数名' },
{
validator: () => {
// 验证参数名不能重复
const allKey = form
.getFieldsValue()
.parmars.map(item => (item ? item.key : ''));
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}
name={[name, 'value']}
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;
import React, { useState, useEffect } from 'react';
import { Form, Input, Button, Row, Col } from 'antd';
import { Form, Input, Button, Row, Col, notification } from 'antd';
import classnames from 'classnames';
import styles from './addForm.less';
import PicturesWall from '@/components/Upload/index';
import ParmarModal from './ParmarModal';
import CheckList from './checkBox';
const { Item } = Form;
......@@ -10,6 +11,7 @@ const EditForm = props => {
const { submitCallback, nodeType, info, valueCallback = () => {} } = props;
const [form] = Form.useForm();
const [otherForm] = Form.useForm();
const [showParmarModal, setShowParmarModal] = useState(false);
const layout = {
layout: 'horizontal',
labelCol: { span: 2, offset: 0 },
......@@ -57,6 +59,15 @@ const EditForm = props => {
const onFinish = () => {
submit();
};
// 添加功能路劲参数
const addParama = () => {
console.log(otherForm.getFieldValue('pageUrl'));
if (!otherForm.getFieldValue('pageUrl')) {
notification.error({ message: '提示', duration: 3, description: '请先填写功能路径' });
return;
}
setShowParmarModal(true);
};
return (
<div className={classnames({ [styles.divbox]: true })}>
{(nodeType === 1 || nodeType === 2) && (
......@@ -190,8 +201,8 @@ const EditForm = props => {
</Item>
)}
<Item
label="功能路径"
name="pageUrl"
label="功能路径"
rules={[
{
required: true,
......@@ -199,7 +210,12 @@ const EditForm = props => {
},
]}
>
<Input />
<div style={{ display: 'flex' }}>
<Item name="pageUrl" style={{ marginBottom: 0, width: '100%' }}>
<Input placeholder="请输入功能路径" />
</Item>
<Button onClick={addParama}>添加参数</Button>
</div>
</Item>
<Item label="功能参数" name="funParam">
<Input />
......@@ -216,6 +232,15 @@ const EditForm = props => {
</Item>
</Form>
)}
<ParmarModal
pageUrl={otherForm.getFieldValue('pageUrl')}
handleCancel={() => setShowParmarModal(false)}
visible={showParmarModal}
parmarCallBack={url => {
otherForm.setFieldsValue({ pageUrl: url });
setShowParmarModal(false);
}}
/>
</div>
);
};
......
import React, { useEffect, useState } from 'react';
import { useHistory } from 'react-router-dom';
import { reloadFlows, removeFlowExtend } from '@/services/platform/flow';
import {
Card,
Space,
Table,
Popconfirm,
Spin,
Tooltip,
notification,
message,
Button,
} from 'antd';
import { Card, Space, Table, Popconfirm, Spin, Tooltip, notification, message, Button } from 'antd';
import {
RightOutlined,
DoubleLeftOutlined,
......@@ -136,9 +126,7 @@ const Flow = () => {
dataIndex: 'extendWebPage',
align: 'center',
render: text => (
<span style={{ color: text === '(默认)' ? 'grey' : '000000D9' }}>
{text}
</span>
<span style={{ color: text === '(默认)' ? 'grey' : '000000D9' }}>{text}</span>
),
},
{
......@@ -146,9 +134,7 @@ const Flow = () => {
dataIndex: 'extendMobilePage',
align: 'center',
render: text => (
<span style={{ color: text === '(默认)' ? 'grey' : '000000D9' }}>
{text}
</span>
<span style={{ color: text === '(默认)' ? 'grey' : '000000D9' }}>{text}</span>
),
},
{
......@@ -156,20 +142,14 @@ const Flow = () => {
dataIndex: 'extendPageCount',
align: 'center',
width: 80,
render: text => (
<span style={{ color: text === '(无)' ? 'grey' : '000000D9' }}>
{text}
</span>
),
render: text => <span style={{ color: text === '(无)' ? 'grey' : '000000D9' }}>{text}</span>,
},
{
title: '流程结束后',
dataIndex: 'flowEndBehavior',
align: 'center',
render: text => (
<span style={{ color: text === '(不做处理)' ? 'grey' : '000000D9' }}>
{text}
</span>
<span style={{ color: text === '(不做处理)' ? 'grey' : '000000D9' }}>{text}</span>
),
},
{
......@@ -182,19 +162,13 @@ const Flow = () => {
title: '异常节点',
dataIndex: 'errorNodes',
align: 'center',
render: text => (
<span style={{ color: text === '(无)' ? 'grey' : 'red' }}>{text}</span>
),
render: text => <span style={{ color: text === '(无)' ? 'grey' : 'red' }}>{text}</span>,
},
{
title: '接口配置',
dataIndex: 'interfaceConfig',
align: 'center',
render: text => (
<span style={{ color: text === '(无)' ? 'grey' : '000000D9' }}>
{text}
</span>
),
render: text => <span style={{ color: text === '(无)' ? 'grey' : '000000D9' }}>{text}</span>,
},
{
title: '操作',
......@@ -235,9 +209,7 @@ const Flow = () => {
okText="是"
cancelText="否"
>
<DeleteOutlined
style={{ fontSize: '16px', color: '#e86060' }}
/>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
</Space>
......@@ -260,9 +232,7 @@ const Flow = () => {
<span className={styles.processTitle}>流程列表</span>
<hr className={styles.splitLine} />
{/* 流程列表 */}
<div
style={{ overflowY: 'scroll', height: 'calc(100vh - 150px)' }}
>
<div style={{ overflowY: 'scroll', height: 'calc(100vh - 150px)' }}>
{processData.length > 0 &&
processData.map((item, index) => (
<div
......@@ -322,8 +292,7 @@ const Flow = () => {
},
})}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 10,
showQuickJumper: true,
......
import React, { useEffect, useState } from 'react';
import { useHistory } from 'react-router-dom';
import {
reloadFlowNodes,
removeFlowNodeExtend,
} from '@/services/platform/flow';
import {
Space,
Table,
Popconfirm,
Tooltip,
notification,
message,
Button,
Spin,
} from 'antd';
import {
RollbackOutlined,
EditTwoTone,
ControlOutlined,
DeleteOutlined,
} from '@ant-design/icons';
import { reloadFlowNodes, removeFlowNodeExtend } from '@/services/platform/flow';
import { Space, Table, Popconfirm, Tooltip, notification, message, Button, Spin } from 'antd';
import { RollbackOutlined, EditTwoTone, ControlOutlined, DeleteOutlined } from '@ant-design/icons';
import PageContainer from '@/components/BasePageContainer';
import NodeEdit from './flowNodeComponents/NodeEdit';
import AuxiliaryView from './flowNodeComponents/AuxiliaryView';
......@@ -135,18 +118,14 @@ const FlowNode = () => {
dataIndex: 'extendHandover',
align: 'center',
width: 80,
render: (text, record) => (
<span style={{ color: textStyleOne(text, record) }}>{text}</span>
),
render: (text, record) => <span style={{ color: textStyleOne(text, record) }}>{text}</span>,
},
{
title: '节点类型',
dataIndex: 'extendNodeType',
align: 'center',
width: 80,
render: (text, record) => (
<span style={{ color: textStyleOne(text, record) }}>{text}</span>
),
render: (text, record) => <span style={{ color: textStyleOne(text, record) }}>{text}</span>,
},
{
title: '工单主表',
......@@ -168,9 +147,7 @@ const FlowNode = () => {
align: 'center',
width: 80,
render: (text, record) => (
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>
{text}
</span>
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>{text}</span>
),
},
{
......@@ -179,11 +156,17 @@ const FlowNode = () => {
align: 'center',
width: 80,
render: (text, record) => (
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>
{text}
</span>
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>{text}</span>
),
},
{
title: '外部字段',
dataIndex: 'outFields',
key: 'outFields',
align: 'center',
width: 100,
render: text => <span style={{ color: Number(text) > 0 ? 'red' : '' }}>{text}</span>,
},
{
title: '补正',
......@@ -191,9 +174,7 @@ const FlowNode = () => {
align: 'center',
width: 80,
render: (text, record) => (
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>
{text}
</span>
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>{text}</span>
),
},
{
......@@ -202,9 +183,7 @@ const FlowNode = () => {
align: 'center',
width: 80,
render: (text, record) => (
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>
{text}
</span>
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>{text}</span>
),
},
{
......@@ -213,9 +192,7 @@ const FlowNode = () => {
align: 'center',
width: 80,
render: (text, record) => (
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>
{text}
</span>
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>{text}</span>
),
},
{
......@@ -224,9 +201,7 @@ const FlowNode = () => {
align: 'center',
width: 80,
render: (text, record) => (
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>
{text}
</span>
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>{text}</span>
),
},
{
......@@ -235,9 +210,7 @@ const FlowNode = () => {
align: 'center',
width: 80,
render: (text, record) => (
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>
{text}
</span>
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>{text}</span>
),
},
{
......@@ -278,9 +251,7 @@ const FlowNode = () => {
okText="是"
cancelText="否"
>
<DeleteOutlined
style={{ fontSize: '16px', color: '#e86060' }}
/>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
</Space>
......@@ -359,6 +330,13 @@ const FlowNode = () => {
align: 'center',
width: 80,
},
{
title: '外部字段',
dataIndex: 'outFields',
key: 'outFields',
align: 'center',
width: 100,
},
{
title: '补正',
align: 'center',
......
import React, { useEffect, useState } from 'react';
import {
reloadFlowNodeExtendPages,
removeFlowNodeExtendPage,
} from '@/services/platform/flow';
import { reloadFlowNodeExtendPages, removeFlowNodeExtendPage } from '@/services/platform/flow';
import {
Table,
Modal,
......@@ -168,9 +165,7 @@ const AuxiliaryView = props => {
okText="是"
cancelText="否"
>
<DeleteOutlined
style={{ fontSize: '16px', color: '#e86060' }}
/>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
</Space>
......@@ -214,8 +209,7 @@ const AuxiliaryView = props => {
},
})}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 10,
showQuickJumper: true,
......
......@@ -19,8 +19,9 @@ import {
message,
Drawer,
Space,
Tooltip,
} from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { PlusOutlined, InfoCircleOutlined } from '@ant-design/icons';
import Fieldselection from './nodeEditComponents/Fieldselection';
import styles from '../flowNode.less';
const { Option } = Select;
......@@ -37,7 +38,6 @@ const NodeEdit = props => {
const [filedData, setFiledData] = useState([]); // 已选字段列表
const [form] = Form.useForm();
useEffect(() => {
form.resetFields();
if (visible) {
// 获取表单回显
getFormData();
......@@ -47,6 +47,8 @@ const NodeEdit = props => {
getTableName();
// 获取反馈类型
getFeedbackName();
} else {
form.resetFields();
}
}, [visible]);
// 获取表单回显
......@@ -136,9 +138,7 @@ const NodeEdit = props => {
}
checkList.forEach(element => {
// 当前得模块是否有当前字段
let indeterminate = element.plainOptions.some(
checkName => checkName === item,
);
let indeterminate = element.plainOptions.some(checkName => checkName === item);
// 处理已选中的字段
if (indeterminate) {
element.defaultCheckedList.push(item);
......@@ -152,9 +152,7 @@ const NodeEdit = props => {
element.indeterminate = false;
}
// 处理是否全选字段
if (
element.defaultCheckedList.length === element.plainOptions.length
) {
if (element.defaultCheckedList.length === element.plainOptions.length) {
element.checkAll = true;
} else {
element.checkAll = false;
......@@ -233,6 +231,7 @@ const NodeEdit = props => {
title="流程节点配置"
width="500px"
onClose={handleCancel}
destroyOnClose
visible={visible}
footer={
<Space>
......@@ -267,11 +266,7 @@ const NodeEdit = props => {
<Option value="办理关单">办理关单</Option>
</Select>
</Form.Item>
<Form.Item
name="EditableLater"
valuePropName="checked"
style={{ marginBottom: 0 }}
>
<Form.Item name="EditableLater" valuePropName="checked" style={{ marginBottom: 0 }}>
<Checkbox>允许补正(事后修改)</Checkbox>
</Form.Item>
<div style={{ display: 'flex' }}>
......@@ -309,17 +304,13 @@ const NodeEdit = props => {
<Option value="移交上报人">移交上报人</Option>
</Select>
</Form.Item>
<Form.Item label="平级移交" name="Transferable" initialValue="0">
<Form.Item label="平级移交" name="Transferable">
<Radio.Group>
<Radio value="0"></Radio>
<Radio value="1"></Radio>
</Radio.Group>
</Form.Item>
<Form.Item
label="显示事件信息"
name="EventsInformation"
initialValue="0"
>
<Form.Item label="显示事件信息" name="EventsInformation">
<Radio.Group>
<Radio value="0"></Radio>
<Radio value="1"></Radio>
......@@ -334,7 +325,20 @@ const NodeEdit = props => {
))}
</Select>
</Form.Item>
<Form.Item label="字段编辑">
<Form.Item
label={
<div className={styles.formData_label}>
{form.getFieldValue('OutFields') > 0 ? (
<Tooltip title={`外部字段${form.getFieldValue('OutFields')}个`}>
<InfoCircleOutlined style={{ color: 'red', padding: '0.2rem 0.2rem 0 0' }} />
</Tooltip>
) : (
''
)}
<span>字段编辑</span>
</div>
}
>
<div className={styles.filedListItem}>
<Form.Item name="Fields" style={{ marginBottom: 0, width: '100%' }}>
<Input placeholder="请选编辑字段" allowClear />
......@@ -348,12 +352,22 @@ const NodeEdit = props => {
/>
</div>
</Form.Item>
<Form.Item label="查看字段">
<Form.Item
label={
<div className={styles.formData_label}>
{form.getFieldValue('OutSearchFields') > 0 ? (
<Tooltip title={`外部字段${form.getFieldValue('OutSearchFields')}个`}>
<InfoCircleOutlined style={{ color: 'red', padding: '0.2rem 0.2rem 0 0' }} />
</Tooltip>
) : (
''
)}
<span>查看字段</span>
</div>
}
>
<div className={styles.filedListItem}>
<Form.Item
name="SeeFields"
style={{ marginBottom: 0, width: '100%' }}
>
<Form.Item name="SeeFields" style={{ marginBottom: 0, width: '100%' }}>
<Input placeholder="请选择查看字段(工程模型)" allowClear />
</Form.Item>
<Button
......
......@@ -105,8 +105,7 @@ const Fieldselection = props => {
chooseList[index].defaultCheckedList = list;
chooseList[index].indeterminate =
!!list.length && list.length < chooseList[index].plainOptions.length;
chooseList[index].checkAll =
list.length === chooseList[index].plainOptions.length;
chooseList[index].checkAll = list.length === chooseList[index].plainOptions.length;
return chooseList;
});
};
......@@ -114,9 +113,7 @@ const Fieldselection = props => {
const onCheckAllChange = (e, index) => {
setCheckList(value => {
const chooseList = JSON.parse(JSON.stringify(value));
chooseList[index].defaultCheckedList = e.target.checked
? chooseList[index].plainOptions
: [];
chooseList[index].defaultCheckedList = e.target.checked ? chooseList[index].plainOptions : [];
chooseList[index].indeterminate = false;
chooseList[index].checkAll = e.target.checked;
return chooseList;
......
......@@ -196,6 +196,14 @@ const incident = () => {
/>
),
},
{
title: '外部字段',
dataIndex: 'outFields',
key: 'outFields',
align: 'center',
width: 100,
render: text => <span style={{ color: Number(text) > 0 ? 'red' : '' }}>{text}</span>,
},
{
title: '上报方式',
dataIndex: 'createMode',
......@@ -210,10 +218,7 @@ const incident = () => {
render: record => (
<Space size="middle">
<Tooltip title="编辑事件类型">
<EditTwoTone
onClick={() => editEventType(record)}
style={{ fontSize: '16px' }}
/>
<EditTwoTone onClick={() => editEventType(record)} style={{ fontSize: '16px' }} />
</Tooltip>
<Tooltip title="删除事件类型">
<Popconfirm
......@@ -558,8 +563,7 @@ const incident = () => {
dataSource={tableData[pickItem]}
scroll={{ y: 'calc(100vh - 155px)', x: 'max-content' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20,
showQuickJumper: true,
......
/* eslint-disable camelcase */
import React, { useState, useEffect } from 'react';
import { Form, Input, Select, Tooltip, Button, notification, Drawer, Space } from 'antd';
import { PlusOutlined, InfoCircleOutlined } from '@ant-design/icons';
import { LoadEventFields } from '@/services/platform/bs';
import {
GetCM_Ledger_LoadLedgerTable,
GetCMLedger_QueryLedgers,
GetCMLedger_OperateLedger,
} from '@/services/standingBook/api';
import ChangeAdd from './changeAdd';
const { Option } = Select;
const { TextArea } = Input;
const BookConfig = props => {
const { callBackSubmit, type, formObj, visible, tableData, onCancel, maxLength } = props;
const [standingTable, setStandingTable] = useState([]);
const [isVisible, setIsVisible] = useState(false); // 弹窗
const [pickItem, setPickItem] = useState(''); // 选择的字段
const [Order, setOrder] = useState(''); // 当前编辑序号
const [filed, setFiled] = useState({}); // 传给子组件列表数据
const [checkedList, setCheckedList] = useState([]);
const [allFileds, setAllFileds] = useState([]); // 当前表所有的字段
const [form] = Form.useForm();
const layout = {
layout: 'horizontal',
labelCol: {
span: 5,
},
wrapperCol: {
span: 19,
},
};
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
let obj =
type === 'add'
? { ...validate, Order: maxLength }
: { ...validate, Order, ID: formObj.ID };
GetCMLedger_OperateLedger(obj)
.then(res => {
if (res.code === 0) {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: type === 'add' ? '新增成功' : '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
.catch(() => {
notification.error({
message: '提示',
duration: 3,
description: '网络异常请稍后再试',
});
});
}
});
};
useEffect(() => {
if (visible) {
// 获取台账表
getTableData();
if (type === 'edit') {
GetCMLedger_QueryLedgers({ ledgerId: formObj.ID }).then(res => {
if (res.code === 0) {
form.setFieldsValue(res.data.root);
setOrder(res.data.root.Order);
changTable(res.data.root.TableName);
}
});
}
} else {
setFiled({});
form.resetFields();
form.setFieldsValue({ AccountType: '台账' });
}
}, [visible]);
// 获取台账表
const getTableData = () => {
GetCM_Ledger_LoadLedgerTable().then(res => {
if (res.code === 0) {
setStandingTable(res.data.root);
}
});
};
// 切换表后数据处理为对应格式
const changTable = value => {
LoadEventFields({ eventTableName: value, distinctFields: '' }).then(res => {
if (res.data.root) {
let fileMap = new Map();
let initList = [];
// 处理为子组件需要的格式
res.data.root.forEach(item => {
initList.push(item.fieldName);
if (fileMap.has(item.group)) {
let list = [...fileMap.get(item.group)];
list.push(item.fieldName);
fileMap.set(item.group, list);
} else {
fileMap.set(item.group, [item.fieldName]);
}
});
// 给Map格式转为对象
fileMap = Object.fromEntries(fileMap.entries());
// 处理外部字段
Object.keys(form.getFieldsValue()).forEach(key => {
saveOutFieldsLength(key, initList);
});
setAllFileds(initList);
setFiled(fileMap);
}
});
};
// 保存外部字段个数
const saveOutFieldsLength = (key, initList) => {
switch (key) {
case 'Fields':
form.setFieldsValue({ outListFileds: dealExternal(key, initList) });
break;
case 'SearchFields':
form.setFieldsValue({ outSearchFields: dealExternal(key, initList) });
break;
case 'AddFields':
form.setFieldsValue({ outAddFields: dealExternal(key, initList) });
break;
case 'EditFields':
form.setFieldsValue({ outEditFields: dealExternal(key, initList) });
break;
case 'WebFields':
form.setFieldsValue({ outWebFields: dealExternal(key, initList) });
break;
case 'MobileFields':
form.setFieldsValue({ outMobileFields: dealExternal(key, initList) });
break;
default:
break;
}
};
// 选择字段回调函数
const onOK = prop => {
setIsVisible(false);
let obj = {};
obj[prop.pickItem] = prop.str;
form.setFieldsValue(obj);
saveOutFieldsLength(prop.pickItem, allFileds);
};
// 处理外部字段
const dealExternal = (fileds, list) => {
let isExternal;
let externalLength = 0;
if (form.getFieldValue(fileds)) {
form
.getFieldValue(fileds)
.split(',')
.forEach(item => {
isExternal = list.some(val => val === item);
if (!isExternal && item !== '') {
// eslint-disable-next-line no-plusplus
externalLength++;
}
});
}
return externalLength;
};
// 勾选字段
const pickFiled = fileds => {
if (!form.getFieldValue('TableName')) {
notification.error({ message: '提示', duration: 3, description: '请选择台账表' });
return;
}
// 添加外部字段
if (type === 'edit') {
let fil = { ...filed };
fil['外部字段'] = [];
let isExternal;
form
.getFieldValue(fileds)
.split(',')
.forEach(item => {
isExternal = allFileds.some(val => val === item);
if (!isExternal && item !== '') {
fil['外部字段'].push(item);
}
});
if (fil['外部字段'].length === 0) {
delete fil['外部字段'];
}
setFiled(fil);
setCheckedList(form.getFieldValue(fileds).split(','));
}
setPickItem(fileds);
setIsVisible(true);
};
// 搜索框监听
const onSearch = value => {
if (value) {
form.setFieldsValue({ Type: value });
}
};
return (
<Drawer
title={`${type === 'add' ? '台账配置' : '台账编辑'}`}
width="500px"
visible={visible}
onClose={onCancel}
destroyOnClose
footer={
<Space>
<Button onClick={onCancel}>取消</Button>
<Button onClick={onSubmit} type="primary">
确定
</Button>
</Space>
}
>
<Form form={form} {...layout}>
<Item label="分组" name="Type" rules={[{ required: true, message: '请选择分组' }]}>
<Select
showSearch
filterOption={false}
onSearch={onSearch}
placeholder="请输入分组名称"
allowClear
>
{tableData.map((item, index) => (
<Option value={item} key={index}>
{item}
</Option>
))}
</Select>
</Item>
<Item label="台账类型" name="AccountType">
<Select placeholder="请选择台账类型">
<Option value="台账">台账</Option>
<Option value="反馈">反馈</Option>
<Option value="设备">设备</Option>
</Select>
</Item>
<Item label="台账名称" name="Name" rules={[{ required: true, message: '请输入台账名称' }]}>
<Input placeholder="台账名称不可重复" allowClear />
</Item>
<Item label="台账表" name="TableName" rules={[{ required: true, message: '请选择台账表' }]}>
<Select placeholder="" optionFilterProp="children" onChange={changTable}>
{standingTable.map((item, index) => (
<Option key={index} value={item.value}>
{item.text}
</Option>
))}
</Select>
</Item>
<Item
label={
<>
{form.getFieldValue('outListFileds') > 0 ? (
<Tooltip title={`外部字段${form.getFieldValue('outListFileds')}个`}>
<InfoCircleOutlined style={{ color: 'red', margin: '2px 3px 0 3px' }} />
</Tooltip>
) : (
''
)}
<span>台账字段</span>
</>
}
name="Fields"
>
<div style={{ display: 'flex' }}>
<Form.Item name="Fields" style={{ marginBottom: 0, width: '100%' }}>
<TextArea placeholder="前端详情查看字段" allowClear />
</Form.Item>
<Button
type="dashed"
style={{ height: '54px', width: '50px', marginLeft: '10px' }}
icon={<PlusOutlined />}
onClick={() => {
pickFiled('Fields');
}}
/>
</div>
</Item>
<Item
label={
<>
{form.getFieldValue('outSearchFields') > 0 ? (
<Tooltip title={`外部字段${form.getFieldValue('outSearchFields')}个`}>
<InfoCircleOutlined style={{ color: 'red', margin: '2px 3px 0 3px' }} />
</Tooltip>
) : (
''
)}
<span>检索字段</span>
</>
}
name="SearchFields"
>
<div style={{ display: 'flex' }}>
<Form.Item name="SearchFields" style={{ marginBottom: 0, width: '100%' }}>
<TextArea placeholder="前端列表检索字段" allowClear />
</Form.Item>
<Button
type="dashed"
style={{ height: '54px', width: '50px', marginLeft: '10px' }}
icon={<PlusOutlined />}
onClick={() => {
pickFiled('SearchFields');
}}
/>
</div>
</Item>
<Item
label={
<>
{form.getFieldValue('outAddFields') > 0 ? (
<Tooltip title={`外部字段${form.getFieldValue('outAddFields')}个`}>
<InfoCircleOutlined style={{ color: 'red', margin: '2px 3px 0 3px' }} />
</Tooltip>
) : (
''
)}
<span>添加字段</span>
</>
}
name="AddFields"
>
<div style={{ display: 'flex' }}>
<Form.Item name="AddFields" style={{ marginBottom: 0, width: '100%' }}>
<TextArea placeholder="前端数据添加字段" allowClear />
</Form.Item>
<Button
type="dashed"
style={{ height: '54px', width: '50px', marginLeft: '10px' }}
icon={<PlusOutlined />}
onClick={() => {
pickFiled('AddFields');
}}
/>
</div>
</Item>
<Item
label={
<>
{form.getFieldValue('outEditFields') > 0 ? (
<Tooltip title={`外部字段${form.getFieldValue('outEditFields')}个`}>
<InfoCircleOutlined style={{ color: 'red', margin: '2px 3px 0 3px' }} />
</Tooltip>
) : (
''
)}
<span>编辑字段</span>
</>
}
name="EditFields"
>
<div style={{ display: 'flex' }}>
<Form.Item name="EditFields" style={{ marginBottom: 0, width: '100%' }}>
<TextArea placeholder="前端可编辑字段" allowClear />
</Form.Item>
<Button
type="dashed"
style={{ height: '54px', width: '50px', marginLeft: '10px' }}
icon={<PlusOutlined />}
onClick={() => {
pickFiled('EditFields');
}}
/>
</div>
</Item>
<Item
label={
<>
{form.getFieldValue('outWebFields') > 0 ? (
<Tooltip title={`外部字段${form.getFieldValue('outWebFields')}个`}>
<InfoCircleOutlined style={{ color: 'red', margin: '2px 3px 0 3px' }} />
</Tooltip>
) : (
''
)}
<span>前端字段</span>
</>
}
name="WebFields"
>
<div style={{ display: 'flex' }}>
<Form.Item name="WebFields" style={{ marginBottom: 0, width: '100%' }}>
<TextArea placeholder="前端列表展示字段" allowClear />
</Form.Item>
<Button
type="dashed"
style={{ height: '54px', width: '50px', marginLeft: '10px' }}
icon={<PlusOutlined />}
onClick={() => {
pickFiled('WebFields');
}}
/>
</div>
</Item>
<Item
label={
<>
{form.getFieldValue('outMobileFields') > 0 ? (
<Tooltip title={`外部字段${form.getFieldValue('outMobileFields')}个`}>
<InfoCircleOutlined style={{ color: 'red', margin: '2px 3px 0 3px' }} />
</Tooltip>
) : (
''
)}
<span>手持字段</span>
</>
}
name="MobileFields"
>
<div style={{ display: 'flex' }}>
<Form.Item name="MobileFields" style={{ marginBottom: 0, width: '100%' }}>
<TextArea placeholder="手持展示字段" allowClear />
</Form.Item>
<Button
type="dashed"
style={{ height: '54px', width: '50px', marginLeft: '10px' }}
icon={<PlusOutlined />}
onClick={() => {
pickFiled('MobileFields');
}}
/>
</div>
</Item>
<Item label="接口配置" name="Interface">
<Input placeholder="服务项目dll库" allowClear />
</Item>
</Form>
<ChangeAdd
visible={isVisible}
onCancel={() => setIsVisible(false)}
callBackSubmit={onOK}
newCheckedList={checkedList}
filed={filed}
pickItem={pickItem}
formObj={formObj}
/>
</Drawer>
);
};
export default BookConfig;
......@@ -19,15 +19,7 @@ const AddModal = props => {
});
return ref.current;
};
const {
callBackSubmit = () => {},
isType,
pickItem,
visible,
filed,
characterValue,
newCheckedList,
} = props;
const { callBackSubmit, pickItem, visible, filed, newCheckedList } = props;
const [loading, setLoading] = useState(false);
const [value, setValue] = useState('');
const [checkValue, setCheckValue] = useState([]);
......@@ -47,8 +39,7 @@ const AddModal = props => {
setCheckedList(checkedListArr);
const indeterminateArr = [...indeterminate];
const checkAllArr = [...checkAll];
indeterminateArr[index] =
!!list.length && list.length < filed[title].length;
indeterminateArr[index] = !!list.length && list.length < filed[title].length;
checkAllArr[index] = list.length === filed[title].length;
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
......@@ -132,6 +123,7 @@ const AddModal = props => {
dataIndex: 'name',
width: 150,
key: 'name',
ellipsis: true,
},
];
useEffect(() => {
......@@ -149,8 +141,7 @@ const AddModal = props => {
}
});
indeterminateArr.push(
!!checkArr[index].length &&
checkArr[index].length < filed[item].length,
!!checkArr[index].length && checkArr[index].length < filed[item].length,
);
checkAllArr.push(checkArr[index].length === filed[item].length);
});
......@@ -184,7 +175,7 @@ const AddModal = props => {
};
return (
<Modal
title={isType === 'rule' ? '选择验证规则' : '字段集选择'}
title="字段集选择"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '10px' }}
width="750px"
......@@ -201,10 +192,7 @@ const AddModal = props => {
>
{visible && (
<div className={styles.listCard}>
<div
className={styles.cardItem}
style={{ borderRight: '1px solid #99bbe8' }}
>
<div className={styles.cardItem} style={{ borderRight: '1px solid #99bbe8' }}>
<Divider
orientation="left"
style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}
......
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
import React, { useState, useEffect } from 'react';
import {
Form,
Modal,
Input,
Select,
Tooltip,
Button,
notification,
Image,
Menu,
Dropdown,
Drawer,
Space,
} from 'antd';
import {
PlusOutlined,
InfoCircleOutlined,
DownOutlined,
} from '@ant-design/icons';
import { LoadEventFields } from '@/services/platform/bs';
import add from '@/assets/images/thumbnail/add.jpg';
import editor from '@/assets/images/thumbnail/editor.jpg';
import hand from '@/assets/images/thumbnail/hand.png';
import search from '@/assets/images/thumbnail/search.jpg';
import taizhang from '@/assets/images/thumbnail/taizhang.jpg';
import web from '@/assets/images/thumbnail/web.jpg';
import {
GetCM_Ledger_LoadLedgerTable,
GetCMLedger_QueryLedgers,
GetCMLedger_OperateLedger,
} from '@/services/standingBook/api';
import styles from './standingBook.less';
import ChangeAdd from './changeAdd';
import { orderBy } from 'lodash';
const { Option } = Select;
const { TextArea } = Input;
const AddModal = props => {
const {
callBackSubmit = () => {},
type,
formObj,
visible,
tableData,
maxLength,
onCancel,
} = props;
const [standingTable, setStandingTable] = useState([]);
const [inputValue, setInputVaule] = useState({
Fields: '',
EditFields: '',
AddFields: '',
MobileFields: '',
SearchFields: '',
WebFields: '',
});
const [isVisible, setIsVisible] = useState(false); // 弹窗
const [loading, setLoading] = useState(false);
const [pickItem, setPickItem] = useState('');
const [filed, setFiled] = useState({}); // 传给子组件列表数据
const [types, setTypes] = useState(''); // 弹窗类型
const [Order, setOrder] = useState(''); // 弹窗类型
const [checkedList, setCheckedList] = useState([]);
const [Type, setType] = useState('');
const [characterValue, setCharacterValue] = useState('');
const [standingType, setStandingType] = useState(['台账', '反馈', '设备']);
const [allFileds, setAllFileds] = useState([]); // 当前表所有的字段
const [form] = Form.useForm();
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
console.log(obj, 'obj');
console.log(inputValue, 'inputValue');
const {
AddFields,
EditFields,
Fields,
MobileFields,
SearchFields,
WebFields,
} = inputValue;
let fieldsObj = {
AddFields,
EditFields,
Fields,
MobileFields,
SearchFields,
WebFields,
};
let data =
type == 'add'
? { ...obj, ...inputValue, Order: maxLength }
: { ...obj, Order, ...fieldsObj, ID: formObj.ID };
GetCMLedger_OperateLedger(data)
.then(res => {
setLoading(false);
if (res.msg === '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: type == 'add' ? '新增成功' : '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
.catch(err => {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
setLoading(false);
});
}
});
};
const onFinish = value => {};
useEffect(() => {
getTableData();
if (type === 'edit') {
GetCMLedger_QueryLedgers({ ledgerId: formObj.ID }).then(res => {
res.data.root && form.setFieldsValue({ ...res.data.root });
setInputVaule({ ...res.data.root });
setOrder(res.data.root.Order);
setType(res.data.root.Type);
changTable(res.data.root.TableName);
});
} else if (type === 'add') {
setInputVaule({
Fields: '',
EditFields: '',
AddFields: '',
MobileFields: '',
SearchFields: '',
WebFields: '',
});
setFiled({});
form.resetFields();
form.setFieldsValue({ AccountType: '台账' });
}
}, [visible]);
const layout = {
layout: 'horizontal',
labelCol: {
span: 5,
},
wrapperCol: {
span: 19,
},
};
const getTableData = () => {
setType('');
GetCM_Ledger_LoadLedgerTable().then(res => {
if (res.msg === 'Ok') {
setStandingTable(res.data.root);
}
});
};
const changTable = value => {
LoadEventFields({ eventTableName: value, distinctFields: '' }).then(res => {
if (res.data.root && res.data.root.length) {
setFiled(formateArrDataA(res.data.root, 'group'));
}
});
};
const formateArrDataA = (initialArr, name) => {
// 判定传参是否符合规则
if (!(initialArr instanceof Array)) {
return '请传入正确格式的数组';
}
if (!name) {
return '请传入对象属性';
}
// 先获取一下这个数组中有多少个"name"
let nameArr = [];
let allFile = [];
for (let i in initialArr) {
allFile.push(initialArr[i].fieldName);
if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
nameArr.push(initialArr[i][`${name}`]);
}
}
// 保存所有的字段用来比较是否有外部字段
setAllFileds(allFile);
// 新建一个包含多个list的结果对象
let tempObj = {};
// 根据不同的"name"生成多个数组
console.log(initialArr);
for (let k in nameArr) {
for (let j in initialArr) {
if (initialArr[j][`${name}`] == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || [];
tempObj[nameArr[k]].push(initialArr[j]);
}
}
}
console.log(tempObj);
for (let key in tempObj) {
let arr = [];
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.fieldName);
});
}
return tempObj;
};
const onOK = prop => {
setIsVisible(false);
let inputText = { ...inputValue };
inputText[prop.pickItem] = prop.str;
setCheckedList(prop.checkedList);
setInputVaule(inputText);
};
const pickFiled = fileds => {
// 添加外部字段
let fil = { ...filed };
fil['外部字段'] = [];
let isExternal;
inputValue[fileds].split(',').forEach(item => {
isExternal = allFileds.some(val => val === item);
if (!isExternal && item !== '') {
fil['外部字段'].push(item);
}
});
if (fil['外部字段'].length === 0) {
delete fil['外部字段'];
}
setFiled(fil);
setTypes('add');
setCharacterValue(inputValue[fileds]);
setCheckedList(inputValue[fileds].split(','));
setPickItem(fileds);
setIsVisible(true);
};
const changeText = (e, type) => {
let inputText = { ...inputValue };
inputText[type] = e.target.value;
console.log(inputText, '32555');
setInputVaule(inputText);
};
const inputType = e => {
e.persist();
console.log(e.target.value, 'value');
setType(e.target.value);
form.setFieldsValue({ Type: e.target.value });
};
return (
<Drawer
title={`${type === 'add' ? '台账配置' : '台账编辑'}`}
width="500px"
visible={visible}
onClose={onCancel}
footer={
<Space>
<Button onClick={onCancel}>取消</Button>
<Button onClick={onSubmit} type="primary">
确定
</Button>
</Space>
}
>
{visible && (
<div className={styles.formData}>
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="分组"
name="Type"
rules={[{ required: true, message: '请选择分组' }]}
>
<div>
<Input
className="ue-editable-select-input"
onChange={e => inputType(e)}
value={Type}
/>
<Dropdown
placement="bottomRight"
style={{ width: '20rem' }}
overlay={
<Menu>
{tableData.length
? tableData.map((item, index) => {
return (
<Menu.Item
onClick={() => {
setType(item);
form.setFieldsValue({ Type: item });
}}
style={{ width: '26.6rem' }}
key={index}
>
{item}
</Menu.Item>
);
})
: ''}
</Menu>
}
>
<div
className={styles.linkDrowp}
onClick={e => e.preventDefault()}
>
<DownOutlined
style={{ fontSize: '12px', color: 'rgba(0, 0, 0, 0.25)' }}
/>
</div>
</Dropdown>
{/* {tableData.length ? tableData.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''} */}
</div>
</Item>
<Item label="台账类型" name="AccountType">
<Select placeholder="选择台账类型">
{standingType.length
? standingType.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
<Item
label="台账名称"
name="Name"
rules={[{ required: true, message: '请输入台账名称' }]}
>
<Input placeholder="台账名称不可重复" allowClear />
</Item>
<Item
label="台账表"
name="TableName"
rules={[{ required: true, message: '请选择台账表' }]}
>
<Select
placeholder=""
optionFilterProp="children"
onChange={changTable}
>
{standingTable.length
? standingTable.map((item, index) => {
return (
<Option key={index} value={item.value}>
{item.text}
</Option>
);
})
: ''}
</Select>
</Item>
<Item
label={
<div className={styles.formData_label}>
<Tooltip title={<Image width={200} src={taizhang} />}>
<InfoCircleOutlined
style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }}
/>
</Tooltip>
<span>台账字段</span>{' '}
</div>
}
name="Fields"
>
<div className={styles.filed_listItem}>
<TextArea
placeholder="前端详情查看字段"
onChange={e => changeText(e, 'Fields')}
value={inputValue.Fields}
allowClear
/>
<Button
type="dashed"
onClick={() => pickFiled('Fields')}
icon={<PlusOutlined />}
style={{
marginLeft: '0.5rem',
height: '100%',
width: '3.5rem',
}}
/>
</div>
</Item>
<Item
label={
<div className={styles.formData_label}>
{' '}
<Tooltip title={<Image width={200} src={search} />}>
<InfoCircleOutlined
style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }}
/>
</Tooltip>
<span>检索字段</span>{' '}
</div>
}
name="SearchFields"
>
<div className={styles.filed_listItem}>
<TextArea
placeholder="前端列表检索字段"
onChange={e => changeText(e, 'SearchFields')}
value={inputValue.SearchFields}
allowClear
/>
<Button
type="dashed"
onClick={() => pickFiled('SearchFields')}
icon={<PlusOutlined />}
style={{
marginLeft: '0.5rem',
height: '100%',
width: '3.5rem',
}}
/>
</div>
</Item>
<Item
label={
<div className={styles.formData_label}>
{' '}
<Tooltip title={<Image width={200} src={add} />}>
<InfoCircleOutlined
style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }}
/>
</Tooltip>
<span>添加字段</span>{' '}
</div>
}
name="AddFields"
>
<div className={styles.filed_listItem}>
<TextArea
placeholder="前端数据添加字段"
onChange={e => changeText(e, 'AddFields')}
value={inputValue.AddFields}
allowClear
/>
<Button
type="dashed"
onClick={() => pickFiled('AddFields')}
icon={<PlusOutlined />}
style={{
marginLeft: '0.5rem',
height: '100%',
width: '3.5rem',
}}
/>
</div>
</Item>
<Item
label={
<div className={styles.formData_label}>
<Tooltip title={<Image width={200} src={editor} />}>
<InfoCircleOutlined
style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }}
/>
</Tooltip>
<span>编辑字段</span>{' '}
</div>
}
name="EditFields"
>
<div className={styles.filed_listItem}>
<TextArea
placeholder="前端可编辑字段"
onChange={e => changeText(e, 'EditFields')}
value={inputValue.EditFields}
allowClear
/>
<Button
type="dashed"
onClick={() => pickFiled('EditFields')}
icon={<PlusOutlined />}
style={{
marginLeft: '0.5rem',
height: '100%',
width: '3.5rem',
}}
/>
</div>
</Item>
<Item
label={
<div className={styles.formData_label}>
<Tooltip title={<Image width={200} src={web} />}>
<InfoCircleOutlined
style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }}
/>
</Tooltip>
<span>前端字段</span>{' '}
</div>
}
name="WebFields"
>
<div className={styles.filed_listItem}>
<TextArea
placeholder="前端列表展示字段"
onChange={e => changeText(e, 'WebFields')}
value={inputValue.WebFields}
allowClear
/>
<Button
type="dashed"
onClick={() => pickFiled('WebFields')}
icon={<PlusOutlined />}
style={{
marginLeft: '0.5rem',
height: '100%',
width: '3.5rem',
}}
/>
</div>
</Item>
<Item
label={
<div className={styles.formData_label}>
<Tooltip title={<Image width={100} src={hand} />}>
<InfoCircleOutlined
style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }}
/>
</Tooltip>
<span>手持字段</span>{' '}
</div>
}
name="MobileFields"
>
<div className={styles.filed_listItem}>
<TextArea
placeholder="手持展示字段"
onChange={e => changeText(e, 'MobileFields')}
value={inputValue.MobileFields}
allowClear
/>
<Button
type="dashed"
onClick={() => pickFiled('MobileFields')}
icon={<PlusOutlined />}
style={{
marginLeft: '0.5rem',
height: '100%',
width: '3.5rem',
}}
/>
</div>
</Item>
<Item label="接口配置" name="Interface">
{/* <div className={styles.filed_listItem}> */}
<TextArea placeholder="服务项目dll库" allowClear />
{/* </div> */}
</Item>
</Form>
<ChangeAdd
visible={isVisible}
onCancel={() => setIsVisible(false)}
callBackSubmit={onOK}
newCheckedList={checkedList}
isType={types}
filed={filed}
pickItem={pickItem}
characterValue={characterValue}
formObj={formObj}
/>
</div>
)}
</Drawer>
);
};
export default AddModal;
import React, { useState, useEffect } from 'react';
import {
Form,
Card,
Space,
Table,
Popconfirm,
Spin,
Tooltip,
notification,
} from 'antd';
import { Form, Card, Space, Table, Popconfirm, Spin, Tooltip, notification } from 'antd';
import {
DoubleLeftOutlined,
......@@ -20,11 +11,8 @@ import {
} from '@ant-design/icons';
import classnames from 'classnames';
import PageContainer from '@/components/BasePageContainer';
import {
GetCM_Ledger_LoadLedgers,
CM_Ledger_RmoveLedger,
} from '@/services/standingBook/api';
import AddModal from './editorModal';
import { GetCM_Ledger_LoadLedgers, CM_Ledger_RmoveLedger } from '@/services/standingBook/api';
import AddModal from './BookConfig';
import styles from './standingBook.less';
const standingBook = props => {
const [allData, setAllData] = useState([]);
......@@ -110,6 +98,14 @@ const standingBook = props => {
align: 'center',
width: 100,
},
{
title: '外部字段',
dataIndex: 'outFields',
key: 'outFields',
align: 'center',
width: 100,
render: text => <span style={{ color: Number(text) > 0 ? 'red' : '' }}>{text}</span>,
},
{
title: '操作',
ellipsis: true,
......@@ -117,10 +113,7 @@ const standingBook = props => {
render: (text, record) => (
<Space>
<Tooltip title="编辑此表">
<EditTwoTone
onClick={() => editor(record)}
style={{ fontSize: '16px' }}
/>
<EditTwoTone onClick={() => editor(record)} style={{ fontSize: '16px' }} />
</Tooltip>
<Tooltip title="删除此表">
......@@ -281,8 +274,8 @@ const standingBook = props => {
onClick={e => setPickItem(item)}
key={index}
>
{item}{allData[item] ? allData[item].length : ''}
{item === pickItem ? <RightOutlined /> : ''}{' '}
{item}{allData[item] ? allData[item].length : ''}
{item === pickItem ? <RightOutlined /> : ''}
</div>
);
})}
......@@ -331,8 +324,7 @@ const standingBook = props => {
scroll={{ x: 'max-content', y: 'calc(100vh - 150px)' }}
// scroll={{ x: 'max-content' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20,
showQuickJumper: true,
......
......@@ -4,16 +4,7 @@ import WebConfigForm from './webConfigForm';
import { postEditWebConfig } from '@/services/webConfig/api';
export default props => {
const {
visible,
onClose,
config,
hasIntegerate,
isEdit,
onOk,
submitting,
productList,
} = props;
const { visible, onClose, config, hasIntegerate, isEdit, onOk, submitting, productList } = props;
return (
<Drawer
......
import BaseForm from '@/components/BaseForm';
import React, { useEffect, useState } from 'react';
import {
getLoginPage,
getMapCofigs,
getWebThemes,
getProductList,
} from '@/services/webConfig/api';
import { getLoginPage, getMapCofigs, getWebThemes, getProductList } from '@/services/webConfig/api';
import { Row, Col } from 'antd';
import { getDefaultGetWebconfig, singleStyleData, webMode } from '../utils';
......
......@@ -38,8 +38,7 @@ const WebConfigPage = props => {
const [configFiles, setConfigFiles] = useState([]);
const [productList, setProductList] = useState([]); // 产品列表
const hasIntegerate = () =>
webs.some(w => w.id.startsWith(webMode.integration));
const hasIntegerate = () => webs.some(w => w.id.startsWith(webMode.integration));
useEffect(() => {
let canceled = { cancel: false };
......@@ -141,9 +140,7 @@ const WebConfigPage = props => {
const handleDeleteWeb = (webToOperate, closeModal) => {
// eslint-disable-next-line prefer-destructuring
const client = webToOperate?.id?.split(
webToOperate.id.startsWith(webMode.single)
? webMode.single
: webMode.integration,
webToOperate.id.startsWith(webMode.single) ? webMode.single : webMode.integration,
)[1];
if (client) {
deleteWebsite(client)
......@@ -191,9 +188,7 @@ const WebConfigPage = props => {
content: (
<span>
删除网站{' '}
<span style={{ fontWeight: 800, color: '#1890ff' }}>
{webToOperate.text}
</span>{' '}
<span style={{ fontWeight: 800, color: '#1890ff' }}>{webToOperate.text}</span>{' '}
后将无法恢复, 确认删除?
</span>
),
......@@ -221,21 +216,12 @@ const WebConfigPage = props => {
if (isSite) {
url = val;
} else {
url = localStorage.getItem('pd2-baseUrl')
? localStorage.getItem('pd2-baseUrl') + val
: val;
url = localStorage.getItem('pd2-baseUrl') ? localStorage.getItem('pd2-baseUrl') + val : val;
}
return url;
};
const handleSubmit = val => {
let {
bannerLogo,
logo,
shortcutIcon,
baseBannerUrl,
baseIconUrl,
baseLogoUrl,
} = val;
let { bannerLogo, logo, shortcutIcon, baseBannerUrl, baseIconUrl, baseLogoUrl } = val;
baseBannerUrl = handleGeturl(bannerLogo);
baseIconUrl = handleGeturl(shortcutIcon);
baseLogoUrl = handleGeturl(logo);
......@@ -318,9 +304,7 @@ const WebConfigPage = props => {
<EditTwoTone /> 查看/编辑网站配置
</span>
<MenuConfig
menu={tabPaneItem?.children.find(
w => w.menuType === 'Web4MenuRoot',
)}
menu={tabPaneItem?.children.find(w => w.menuType === 'Web4MenuRoot')}
onUpdate={handleUpdateOnMenuChange}
configFiles={configFiles}
updateMenuTree={updateMenuTree}
......
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通过字符串分割成表单需要的数据形式
let parma = pageUrl
.split('|')[1]
?.split('&')
?.map(item => ({ key: item.split('=')[0], value: item.split('=')[1] }));
form.setFieldsValue({ parmars: parma });
} else {
// 关闭弹窗清除表单数据
form.resetFields();
}
}, [visible]);
// 保存
const onFinish = () => {
form.validateFields().then(validate => {
if (validate) {
console.log(validate, 'validate');
let parma = form
.getFieldValue('parmars')
.map(item => `${item.key}=${item.value}`)
.join('&');
console.log(parma, 'parma');
parmarCallBack(`${pageUrl.split('|')[0]}|${parma}`);
}
});
};
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: 8, justifyContent: 'center' }}
align="baseline"
>
<Form.Item
{...restField}
name={[name, 'key']}
fieldKey={[fieldKey, 'key']}
validateTrigger={['onChange', 'onBlur']}
rules={[
{ required: true, message: '请填写参数名' },
{
validator: () => {
// 验证参数名不能重复
const allKey = form
.getFieldsValue()
.parmars.map(item => (item ? item.key : ''));
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}
name={[name, 'value']}
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;
import React, { useState, useEffect } from 'react';
import { Form, Input, Button, Row, Col, Select, Radio, Checkbox } from 'antd';
import {
Form,
Input,
Button,
Row,
Col,
Select,
Radio,
Checkbox,
message,
notification,
} from 'antd';
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
import styles from './addForm.less';
import PicturesWall from '@/components/Upload/index';
import EditeConfigWrapper from './editConfigFileWrapper';
import CheckList from './checkBox';
import ParmarModal from './ParmarModal';
const { Item } = Form;
const { Option } = Select;
......@@ -18,10 +31,11 @@ const EditForm = props => {
} = props;
const [form] = Form.useForm();
const [otherForm] = Form.useForm();
const [showParmarModal, setShowParmarModal] = useState(false);
const layout = {
layout: 'horizontal',
labelCol: { span: 2 },
wrapperCol: { span: 21, offset: 0 },
labelCol: { span: 3 },
wrapperCol: { span: 21 },
};
// 回显表单
useEffect(() => {
......@@ -47,6 +61,15 @@ const EditForm = props => {
const onFinish = val => {
submit();
};
// 添加功能路劲参数
const addParama = () => {
console.log(form.getFieldValue('pageUrl'));
if (!form.getFieldValue('pageUrl')) {
notification.error({ message: '提示', duration: 3, description: '请先填写功能路径' });
return;
}
setShowParmarModal(true);
};
const radioChange = e => {};
return (
<div style={{ marginTop: '10px' }}>
......@@ -97,8 +120,8 @@ const EditForm = props => {
</Radio.Group>
</Item>
<Item
label="功能路径"
name="pageUrl"
label="功能路径"
rules={[
{
required: true,
......@@ -106,7 +129,12 @@ const EditForm = props => {
},
]}
>
<Input placeholder="请输入功能路径" />
<div style={{ display: 'flex' }}>
<Item name="pageUrl" style={{ marginBottom: 0, width: '100%' }}>
<Input placeholder="请输入功能路径" />
</Item>
<Button onClick={addParama}>添加参数</Button>
</div>
</Item>
<Item label="配置文件" name="config">
<EditeConfigWrapper>
......@@ -114,8 +142,7 @@ const EditForm = props => {
allowClear
showSearch
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >=
0
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
{configFiles.map(c => (
......@@ -126,11 +153,7 @@ const EditForm = props => {
</Select>
</EditeConfigWrapper>
</Item>
<CheckList
info={info}
nodeType={nodeType}
valueCallback={valueCallback}
/>
<CheckList info={info} nodeType={nodeType} valueCallback={valueCallback} />
<Item wrapperCol={{ offset: 10 }} style={{ marginTop: '20px' }}>
<Button type="primary" htmlType="submit">
提交
......@@ -175,6 +198,15 @@ const EditForm = props => {
</Item>
</Form>
)}
<ParmarModal
pageUrl={form.getFieldValue('pageUrl')}
handleCancel={() => setShowParmarModal(false)}
visible={showParmarModal}
parmarCallBack={url => {
form.setFieldsValue({ pageUrl: url });
setShowParmarModal(false);
}}
/>
</div>
);
};
......
......@@ -29,15 +29,7 @@ import {
} from '@/services/webConfig/api';
const MiniMenu = props => {
const {
menu,
configFiles,
subSystemValue,
updateMenuTree,
userMode,
webid,
productList,
} = props;
const { menu, configFiles, subSystemValue, updateMenuTree, userMode, webid, productList } = props;
const [flag, setFlag] = useState(1); // 刷新标志
const [loading, setLoading] = useState(false); // 加载
const [menuID, setMenuID] = useState(''); // 选中的树ID
......@@ -109,8 +101,7 @@ const MiniMenu = props => {
</div>
),
key: obj.menuID,
icon:
obj.menuType === 'Web4MenuGroup' ? <FolderFilled /> : <FileOutlined />,
icon: obj.menuType === 'Web4MenuGroup' ? <FolderFilled /> : <FileOutlined />,
menuType: obj.menuType,
children: hasChild ? obj.children.map(i => mapTree(i)) : [],
};
......@@ -244,9 +235,7 @@ const MiniMenu = props => {
if (isSite) {
url = val;
} else {
url = localStorage.getItem('pd2-baseUrl')
? localStorage.getItem('pd2-baseUrl') + val
: val;
url = localStorage.getItem('pd2-baseUrl') ? localStorage.getItem('pd2-baseUrl') + val : val;
}
return url;
};
......@@ -398,9 +387,7 @@ const MiniMenu = props => {
.filter(item => item.id === 'Web4SingleStation')
.map(r => r.children.filter(i => i.id === webid))
.flat(2);
let arr2 =
arr[0].children.find(item => item.text === '菜单管理').children ||
[];
let arr2 = arr[0].children.find(item => item.text === '菜单管理').children || [];
setMenuList(arr2 || []);
}
})
......@@ -413,8 +400,7 @@ const MiniMenu = props => {
const dropKey = infos.node.key;
const dragKey = infos.dragNode.key;
const dropPos = infos.node.pos.split('-');
const dropPosition =
infos.dropPosition - Number(dropPos[dropPos.length - 1]);
const dropPosition = infos.dropPosition - Number(dropPos[dropPos.length - 1]);
const data = [...menuList];
// 找到拖拽的元素
......@@ -632,10 +618,7 @@ const MiniMenu = props => {
valueCallback={valueCallback}
/>
) : (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="当前未选中菜单"
/>
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="当前未选中菜单" />
)}
</div>
<ImportOrExport
......
......@@ -180,9 +180,11 @@ export const getDefaultGetWebconfig = ({
formType: ITEM_TYPE.SELECT,
placeholder: '请选择产品类型',
options: products.map(t => ({
value: t.ProductName,
value: t.PackageName,
key: t.PackageName,
title: t.ProductName,
label: t.ProductName,
children: t.ProductName,
key: t.ID,
})),
onDropdownVisibleChange: onGetProduct,
showSearch: false,
......@@ -354,8 +356,7 @@ export const getDefaultGetWebconfig = ({
};
if (initialValues) {
Object.keys(config).forEach(k => {
config[k].initialValue =
typeof initialValues[k] !== 'undefined' ? initialValues[k] : '';
config[k].initialValue = typeof initialValues[k] !== 'undefined' ? initialValues[k] : '';
// if (k === 'alarmWays') {
// config[k].initialValue = config[k].initialValue.split(',');
// }
......
......@@ -263,8 +263,7 @@ export default {
{
path: '/platformCenter/emq',
name: '宿主管理',
url:
'/web4/?widget=product/oms/MqttConfig/MqttConfig.js|hideMap=true',
url: '/web4/?widget=product/oms/MqttConfig/MqttConfig.js|hideMap=true',
component: HostManager,
},
......
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