Commit 7907de55 authored by 皮倩雯's avatar 皮倩雯

fix: 'web配置登录模板参数管理'

parent b0493a0b
Pipeline #55492 waiting for manual action with stages
This diff was suppressed by a .gitattributes entry.
......@@ -31,6 +31,7 @@ import {
Image,
} from 'antd';
import AllImage from '@/assets/images/title/All.png';
import TreeImage from '@/assets/images/title/Tree.png';
import partImage from '@/assets/images/title/part.png';
import {
getField,
......@@ -250,7 +251,7 @@ const AddModal = props => {
console.log(obj.choose);
console.log(pep);
console.log(cho);
data[0].Config = pep ? `本人${cho ? '' : '.n'}` : `全部${cho ? '' : '.n'}`;
data[0].Config = pep ? `本人${cho ? '.n' : ''}` : `全部${cho ? '.n' : ''}`;
break;
case '业务选择器':
if (obj.fieldName.endsWith('.n')) {
......@@ -287,41 +288,45 @@ const AddModal = props => {
break;
case '选择器':
if (cse) {
let str = `${obj.farter}.${obj.farterData}`;
let str = cho
? `${obj.farter}.${obj.farterData}.n`
: `${obj.farter}.${obj.farterData}`;
data[0].Config = str;
} else {
data[0].Config = obj.Config ? obj.Config : '';
console.log(obj.Config);
let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
data[0].Config = str;
}
break;
case '人员选择器':
if (popeleShape == '分组模态') {
if (checkboxAllID1 == true) {
if (obj.ConfigName) {
let str = cho ? `全部ID.${obj.ConfigName}` : `全部ID.${obj.ConfigName}.n`;
let str = cho ? `全部ID.${obj.ConfigName}.n` : `全部ID.${obj.ConfigName}`;
data[0].Config = str;
} else {
let str = cho ? `全部ID` : `全部ID.n`;
let str = cho ? `全部ID.n` : `全部ID`;
data[0].Config = str;
}
} else {
if (obj.ConfigName) {
let str = cho ? `全部.${obj.ConfigName}` : `全部.${obj.ConfigName}.n`;
let str = cho ? `全部.${obj.ConfigName}.n` : `全部.${obj.ConfigName}`;
data[0].Config = str;
} else {
let str = cho ? `全部` : `全部.n`;
let str = cho ? `全部.n` : `全部`;
data[0].Config = str;
}
}
} else if (popeleShape == '下拉框') {
let str = cho ? `${obj.Config}` : `${obj.Config}.n`;
let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
console.log(str);
data[0].Config = str;
} else if (popeleShape == '树形模态') {
if (gl) {
let str = cho ? `tree.单选|非站点` : `tree.多选|非站点`;
let str = cho ? `tree.多选|站点` : `tree.单选|站点`;
data[0].Config = str;
} else {
let str = cho ? `tree.单选|站点` : `tree.多选|站点`;
let str = cho ? `tree.多选|非站点` : `tree.单选|非站点`;
data[0].Config = str;
}
}
......@@ -469,23 +474,23 @@ const AddModal = props => {
console.log(site[1]);
if (site[0] == '本人') {
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ pepole: true, choose: false });
setPep(true);
setCho(false);
} else {
form.setFieldsValue({ pepole: true, choose: true });
setPep(true);
setCho(true);
}
} else {
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ pepole: false, choose: false });
setPep(false);
form.setFieldsValue({ pepole: true, choose: false });
setPep(true);
setCho(false);
}
} else {
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ pepole: false, choose: true });
setPep(false);
setCho(true);
} else {
form.setFieldsValue({ pepole: false, choose: false });
setPep(false);
setCho(false);
}
}
break;
......@@ -579,7 +584,7 @@ const AddModal = props => {
let sele = res[0].data.root.Config.split('.');
console.log(sele[0]);
console.log(sele[1]);
if (sele[1]) {
if (sele[1] && sele[1] != 'n') {
form.setFieldsValue({
Association: true,
farter: sele[0],
......@@ -594,6 +599,13 @@ const AddModal = props => {
});
setCse(false);
}
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
break;
case '人员选择器':
let pepole = res[0].data.root.Config.split('.');
......@@ -619,11 +631,11 @@ const AddModal = props => {
});
}
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
setPopeleShape('分组模态');
} else if (pepole[0] == '全部ID') {
......@@ -647,11 +659,11 @@ const AddModal = props => {
});
}
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
setPopeleShape('分组模态');
} else if (pepole[0] == 'tree') {
......@@ -662,28 +674,16 @@ const AddModal = props => {
let tree = pepole[1].split('|');
if (tree[0] == '多选') {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: false,
});
setGl(false);
setCho(false);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: false,
choose: true,
});
setGl(true);
setCho(false);
}
setCho(true);
} else {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
......@@ -693,16 +693,28 @@ const AddModal = props => {
});
setGl(false);
setCho(true);
}
} else {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: true,
choose: false,
});
setGl(true);
setCho(true);
setCho(false);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: false,
});
setGl(false);
setCho(false);
}
}
setPopeleShape('树形模态');
......@@ -718,11 +730,11 @@ const AddModal = props => {
Config: pepole[0],
});
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
setPopeleShape('下拉框');
}
......@@ -1231,23 +1243,23 @@ const AddModal = props => {
console.log(site[1]);
if (site[0] == '本人') {
if (aa.Config.endsWith('.n')) {
form.setFieldsValue({ pepole: true, choose: false });
setPep(true);
setCho(false);
} else {
form.setFieldsValue({ pepole: true, choose: true });
setPep(true);
setCho(true);
}
} else {
if (aa.Config.endsWith('.n')) {
form.setFieldsValue({ pepole: false, choose: false });
setPep(false);
form.setFieldsValue({ pepole: true, choose: false });
setPep(true);
setCho(false);
}
} else {
if (aa.Config.endsWith('.n')) {
form.setFieldsValue({ pepole: false, choose: true });
setPep(false);
setCho(true);
} else {
form.setFieldsValue({ pepole: false, choose: false });
setPep(false);
setCho(false);
}
}
break;
......@@ -1296,7 +1308,7 @@ const AddModal = props => {
case '选择器':
console.log(aa.Config);
let sele = aa.Config.split('.');
if (sele[1]) {
if (sele[1] && sele[1] != 'n') {
form.setFieldsValue({
Association: true,
farter: sele[0],
......@@ -1311,6 +1323,13 @@ const AddModal = props => {
});
setCse(false);
}
if (aa.Config.endsWith('.n')) {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
break;
case '人员选择器':
let pepole = aa.Config.split('.');
......@@ -1336,11 +1355,11 @@ const AddModal = props => {
});
}
if (aa.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
setPopeleShape('分组模态');
} else if (pepole[0] == '全部ID') {
......@@ -1364,11 +1383,11 @@ const AddModal = props => {
});
}
if (aa.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
setPopeleShape('分组模态');
} else if (pepole[0] == 'tree') {
......@@ -1379,28 +1398,16 @@ const AddModal = props => {
let tree = pepole[1].split('|');
if (tree[0] == '多选') {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: false,
});
setGl(false);
setCho(false);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: false,
choose: true,
});
setGl(true);
setCho(false);
}
setCho(true);
} else {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
......@@ -1410,16 +1417,28 @@ const AddModal = props => {
});
setGl(false);
setCho(true);
}
} else {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: true,
choose: false,
});
setGl(true);
setCho(true);
setCho(false);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: false,
});
setGl(false);
setCho(false);
}
}
setPopeleShape('树形模态');
......@@ -1435,11 +1454,11 @@ const AddModal = props => {
Config: pepole[0],
});
if (aa.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
setPopeleShape('下拉框');
}
......@@ -1555,23 +1574,23 @@ const AddModal = props => {
console.log(site[1]);
if (site[0] == '本人') {
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ pepole: true, choose: false });
setPep(true);
setCho(false);
} else {
form.setFieldsValue({ pepole: true, choose: true });
setPep(true);
setCho(true);
}
} else {
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ pepole: false, choose: false });
setPep(false);
form.setFieldsValue({ pepole: true, choose: false });
setPep(true);
setCho(false);
}
} else {
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ pepole: false, choose: true });
setPep(false);
setCho(true);
} else {
form.setFieldsValue({ pepole: false, choose: false });
setPep(false);
setCho(false);
}
}
break;
......@@ -1638,7 +1657,7 @@ const AddModal = props => {
break;
case '选择器':
let sele = res[0].data.root.Config.split('.');
if (sele[1]) {
if (sele[1] && sele[1] != 'n') {
form.setFieldsValue({
Association: true,
farter: sele[0],
......@@ -1653,6 +1672,13 @@ const AddModal = props => {
});
setCse(false);
}
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
break;
case '人员选择器':
let pepole = res[0].data.root.Config.split('.');
......@@ -1678,11 +1704,11 @@ const AddModal = props => {
});
}
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
setPopeleShape('分组模态');
} else if (pepole[0] == '全部ID') {
......@@ -1706,11 +1732,11 @@ const AddModal = props => {
});
}
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
setPopeleShape('分组模态');
} else if (pepole[0] == 'tree') {
......@@ -1721,28 +1747,16 @@ const AddModal = props => {
let tree = pepole[1].split('|');
if (tree[0] == '多选') {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: false,
});
setGl(false);
setCho(false);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: false,
choose: true,
});
setGl(true);
setCho(false);
}
setCho(true);
} else {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
......@@ -1752,16 +1766,28 @@ const AddModal = props => {
});
setGl(false);
setCho(true);
}
} else {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: true,
choose: false,
});
setGl(true);
setCho(true);
setCho(false);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: false,
});
setGl(false);
setCho(false);
}
}
setPopeleShape('树形模态');
......@@ -1777,11 +1803,11 @@ const AddModal = props => {
Config: pepole[0],
});
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
} else {
form.setFieldsValue({ choose: false });
setCho(false);
}
setPopeleShape('下拉框');
}
......@@ -1859,7 +1885,7 @@ const AddModal = props => {
: `${obj.tableName}`;
break;
case '站点选择器':
data[0].Config = pep ? `本人${cho ? '' : '.n'}` : `全部${cho ? '' : '.n'}`;
data[0].Config = pep ? `本人${cho ? '.n' : ''}` : `全部${cho ? '.n' : ''}`;
break;
case '业务选择器':
if (obj.fieldName.endsWith('.n')) {
......@@ -1903,41 +1929,44 @@ const AddModal = props => {
break;
case '选择器':
if (cse) {
let str = `${obj.farter}.${obj.farterData}`;
let str = cho
? `${obj.farter}.${obj.farterData}.n`
: `${obj.farter}.${obj.farterData}`;
data[0].Config = str;
} else {
data[0].Config = obj.Config ? obj.Config : '';
let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
data[0].Config = str;
}
break;
case '人员选择器':
if (popeleShape == '分组模态') {
if (checkboxAllID1 == true) {
if (obj.ConfigName) {
let str = cho ? `全部ID.${obj.ConfigName}` : `全部ID.${obj.ConfigName}.n`;
let str = cho ? `全部ID.${obj.ConfigName}.n` : `全部ID.${obj.ConfigName}`;
data[0].Config = str;
} else {
let str = cho ? `全部ID` : `全部ID.n`;
let str = cho ? `全部ID.n` : `全部ID`;
data[0].Config = str;
}
} else {
if (obj.ConfigName) {
let str = cho ? `全部.${obj.ConfigName}` : `全部.${obj.ConfigName}.n`;
let str = cho ? `全部.${obj.ConfigName}.n` : `全部.${obj.ConfigName}`;
data[0].Config = str;
} else {
let str = cho ? `全部` : `全部.n`;
let str = cho ? `全部.n` : `全部`;
data[0].Config = str;
}
}
} else if (popeleShape == '下拉框') {
let str = cho ? `${obj.Config}` : `${obj.Config}.n`;
let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
console.log(str);
data[0].Config = str;
} else if (popeleShape == '树形模态') {
if (gl) {
let str = cho ? `tree.单选|非站点` : `tree.多选|非站点`;
let str = cho ? `tree.多选|站点` : `tree.单选|站点`;
data[0].Config = str;
} else {
let str = cho ? `tree.单选|站点` : `tree.多选|站点`;
let str = cho ? `tree.多选|非站点` : `tree.单选|非站点`;
data[0].Config = str;
}
}
......@@ -2000,7 +2029,7 @@ const AddModal = props => {
setCheckboxAllID1('');
setSynchronization(false);
setFlag(false);
setPopeleShape('下拉框');
setPopeleShape('');
setHide(true);
if (i == 1.14) {
console.log(valueData);
......@@ -2224,20 +2253,21 @@ const AddModal = props => {
};
const popeleShapeOnChange = e => {
form.setFieldsValue({ ConfigName: '', Config: '' });
console.log(e);
setPopeleShape(e.target.value);
let aa = form.getFieldsValue().ConfigName;
let bb = form.getFieldsValue().Config;
// let aa = form.getFieldsValue().ConfigName;
// let bb = form.getFieldsValue().Config;
if (e.target.value == '分组模态') {
if (bb || bb == '' || bb == undefined) {
form.setFieldsValue({ ConfigName: bb });
}
// if (bb || bb == '' || bb == undefined) {
// form.setFieldsValue({ ConfigName: bb });
// }
setHide(false);
setFlag(true);
} else if (e.target.value == '下拉框') {
if (aa || aa == '' || bb == undefined) {
form.setFieldsValue({ Config: aa });
}
// if (aa || aa == '' || bb == undefined) {
// form.setFieldsValue({ Config: aa });
// }
setHide(true);
setFlag(false);
setCheckboxAllID1(false);
......@@ -2564,11 +2594,12 @@ const AddModal = props => {
case '选择器':
return (
<>
<Item labelCol={{ span: 4 }} label="配置">
<div style={{ display: 'inline-block', marginRight: '10px' }}>
<Item
label="配置"
name="Association"
labelCol={{ span: 4 }}
// rules={[{ required: true, message: '请输入数据字典名称' }]}
style={{ marginBottom: '0' }}
>
<Checkbox
checked={cse}
......@@ -2578,6 +2609,23 @@ const AddModal = props => {
关联选择器
</Checkbox>
</Item>
</div>
<div style={{ display: 'inline-block', marginRight: '10px' }}>
<Item
name="choose"
labelCol={{ span: 4 }}
style={{ marginBottom: '0' }}
>
<Checkbox
checked={cho}
onChange={changeChoose}
style={{ marginBottom: '0' }}
>
多选
</Checkbox>
</Item>
</div>
</Item>
{cse ? (
<Row>
<Col span={12}>
......@@ -2603,7 +2651,7 @@ const AddModal = props => {
</Row>
) : (
<Item label="数据字典" name="Config" labelCol={{ span: 4 }}>
<TextArea allowClear placeholder="请输入数据字典名称" />
<Input allowClear placeholder="请输入数据字典名称" />
</Item>
)}
</>
......@@ -2659,7 +2707,7 @@ const AddModal = props => {
onChange={changeChoose}
style={{ marginBottom: '0' }}
>
</Checkbox>
</Item>
</div>
......@@ -2727,31 +2775,7 @@ const AddModal = props => {
case '人员选择器':
return (
<>
<Item
labelCol={{ span: 4 }}
label="展示形态"
name="PeShape"
// label={
// <div>
// <Tooltip
// title={
// <>
// <span>弹窗显示人员所属机构</span>
// <Image width={200} src={AllImage} />
// </>
// }
// >
// <InfoCircleOutlined
// style={{
// color: 'rgb(24 144 255)',
// marginRight: '5px',
// }}
// />
// </Tooltip>
// <span>人员选择器形态</span>
// </div>
// }
>
<Item labelCol={{ span: 4 }} label="交互方式" name="PeShape">
<div style={{ display: 'inline-block', marginRight: '10px' }}>
<Radio.Group
style={{ marginTop: '0.3rem' }}
......@@ -2759,35 +2783,50 @@ const AddModal = props => {
onChange={popeleShapeOnChange}
>
<Radio value="下拉框">下拉框</Radio>
<Radio value="分组模态">分组模态</Radio>
<Radio value="树形模态">树形模态</Radio>
<Radio value="分组模态">
{' '}
<Tooltip
title={
<>
<span>分组模态显示人员所属机构</span>
<Image width={200} src={AllImage} />
</>
}
>
<InfoCircleOutlined
style={{
color: 'rgb(24 144 255)',
marginRight: '5px',
marginTop: '-8px',
}}
/>
</Tooltip>
分组模态
</Radio>
<Radio value="树形模态">
<Tooltip
title={
<>
<span>树形模态显示部门树</span>
<Image width={200} src={TreeImage} />
</>
}
>
<InfoCircleOutlined
style={{
color: 'rgb(24 144 255)',
marginRight: '5px',
marginTop: '-8px',
}}
/>
</Tooltip>
树形模态
</Radio>
</Radio.Group>
</div>
</Item>
<Item
labelCol={{ span: 4 }}
// label={
// <div>
// <Tooltip
// title={
// <>
// <span>弹窗显示人员所属机构</span>
// <Image width={200} src={AllImage} />
// </>
// }
// >
// <InfoCircleOutlined
// style={{
// color: 'rgb(24 144 255)',
// marginRight: '5px',
// }}
// />
// </Tooltip>
// <span>配置</span>
// </div>
// }
label="配置"
>
<Item labelCol={{ span: 4 }} label="配置">
{/* <div style={{ display: 'inline-block', marginRight: '10px' }}>
<Item name="All1" style={{ marginBottom: '0' }}>
<Checkbox
......@@ -2806,11 +2845,11 @@ const AddModal = props => {
onChange={changeChoose}
style={{ marginBottom: '0' }}
>
</Checkbox>
</Item>
</div>
<div style={{ display: 'inline-block', marginRight: '10px' }}>
{/* <div style={{ display: 'inline-block', marginRight: '10px' }}>
<Item name="AllID1" style={{ marginBottom: '0' }}>
<Checkbox
checked={checkboxAllID1}
......@@ -2821,7 +2860,7 @@ const AddModal = props => {
ID存储
</Checkbox>
</Item>
</div>
</div> */}
</Item>
{(() => {
switch (flag) {
......@@ -2855,17 +2894,15 @@ const AddModal = props => {
case 1:
return (
<>
<Item label="过滤" name="Config" labelCol={{ span: 4 }}>
<Item name="guolv" style={{ marginBottom: '0' }}>
<Item label="过滤" name="guolv" labelCol={{ span: 4 }}>
<Checkbox
checked={gl}
onChange={changeGl}
style={{ marginBottom: '0' }}
>
站点
本人站点
</Checkbox>
</Item>
</Item>
</>
);
case false:
......@@ -2958,7 +2995,6 @@ const AddModal = props => {
case '城市选择器':
case '附件':
case '可预览附件':
case '可预览图片':
case '录音':
case '视频':
case '设备选择':
......
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) {
let parma = form
.getFieldValue('parmars')
?.map(item => `${item.key}=${item.value}`)
.join('&');
console.log(parma, 'parma');
if (parma) {
parmarCallBack(`${pageUrl.split('|')[0]}|${parma}`);
} else {
parmarCallBack(`${pageUrl.split('|')[0]}`);
}
}
});
};
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;
......@@ -22,6 +22,7 @@ import WebConfigForm from './webConfigForm';
import ColorLinear from './ColorLinear';
import Upload from '@/components/Upload';
import styles from './siteConfigDrawer.less';
import ParmarModal from './ParmarModal';
const { Option } = Select;
const plainOptions = ['搜索', '消息', '反馈'];
const defaultCheckedList = ['搜索', '消息', '反馈'];
......@@ -54,6 +55,8 @@ export default props => {
const [color, setColor] = useState('');
const CheckboxGroup = Checkbox.Group;
const [showAdvanced, setShowAdvanced] = useState(false); // 是否显示高级设置
const [showParmarModal, setShowParmarModal] = useState(false);
useEffect(() => {
onGetLoginPages();
console.log(isEdit);
......@@ -173,10 +176,20 @@ export default props => {
setColor(value);
form.setFieldsValue({ headerPrimaryColor: value });
};
const addParama = () => {
console.log(form.getFieldValue('loginTemplate'));
if (!form.getFieldValue('loginTemplate')) {
notification.error({ message: '提示', duration: 3, description: '请先选择登录模板' });
return;
}
setShowParmarModal(true);
};
return (
<Drawer
title={isEdit ? '查看/编辑网站配置' : '新增网站'}
width={500}
width={600}
onClose={onClose}
visible={visible}
destroyOnClose
......@@ -192,7 +205,7 @@ export default props => {
<Form
form={form}
labelCol={{ span: 5 }}
wrapperCol={{ span: 18 }}
wrapperCol={{ span: 19 }}
initialValues={{ remember: true }}
>
<Form.Item
......@@ -261,7 +274,9 @@ export default props => {
>
<Input autoComplete="off" disabled={isEdit} />
</Form.Item>
<Form.Item label="登录模板" name="loginTemplate">
<Row>
<Col span={20}>
<Form.Item label="登录模板" name="loginTemplate" labelCol={{ span: 6 }}>
<Select placeholder="请选择登录模板">
{loginPages.map(item => (
<Option value={item.value} key={item.value}>
......@@ -270,6 +285,13 @@ export default props => {
))}
</Select>
</Form.Item>
</Col>
<Col span={4}>
<Form.Item>
<Button onClick={addParama}>参数管理</Button>
</Form.Item>
</Col>
</Row>
<Divider orientation="left" style={{ borderTopColor: '#99bbe8' }}>
主页配置
</Divider>
......@@ -438,6 +460,15 @@ export default props => {
onSubumit={colorChange}
handleCancel={() => setDisplayColorPicker(false)}
/>
<ParmarModal
pageUrl={form.getFieldValue('loginTemplate')}
handleCancel={() => setShowParmarModal(false)}
visible={showParmarModal}
parmarCallBack={url => {
form.setFieldsValue({ loginTemplate: url });
setShowParmarModal(false);
}}
/>
</Drawer>
);
};
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