Commit 7484aee6 authored by 皮倩雯's avatar 皮倩雯

fix: '集成登录新增地区配置,数据库初始化优化'

parent da66842c
Pipeline #57178 waiting for manual action with stages
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
"@esri/calcite-colors": "6.0.3", "@esri/calcite-colors": "6.0.3",
"@wisdom-cesium/cesium": "^1.0.78", "@wisdom-cesium/cesium": "^1.0.78",
"@wisdom-map/amap": "1.1.0-beta.35", "@wisdom-map/amap": "1.1.0-beta.35",
"@wisdom-map/arcgismap": "1.4.0-14", "@wisdom-map/arcgismap": "1.4.0-19",
"@wisdom-map/basemap": "1.1.0-3", "@wisdom-map/basemap": "1.1.0-3",
"ace-builds": "^1.4.12", "ace-builds": "^1.4.12",
"antd-img-crop": "^3.13.2", "antd-img-crop": "^3.13.2",
......
...@@ -80,7 +80,7 @@ InitDataBaseContainer { ...@@ -80,7 +80,7 @@ InitDataBaseContainer {
justify-content: flex-end; justify-content: flex-end;
} }
.ant-checkbox-wrapper { .ant-checkbox-wrapper {
width: 269px; width: 268px;
margin-bottom: 10px; margin-bottom: 10px;
margin-left: 8px; margin-left: 8px;
} }
......
...@@ -17,8 +17,13 @@ import { ...@@ -17,8 +17,13 @@ import {
Image, Image,
Select, Select,
AutoComplete, AutoComplete,
Cascader,
} from 'antd'; } from 'antd';
import { AddIntegratedLogin, EditIntegratedLogin } from '@/services/integratedLogin/api'; import {
AddIntegratedLogin,
EditIntegratedLogin,
GetIntegratedloginSetting,
} from '@/services/integratedLogin/api';
import { PlusOutlined, LoadingOutlined } from '@ant-design/icons'; import { PlusOutlined, LoadingOutlined } from '@ant-design/icons';
import { get, PUBLISH_SERVICE } from '@/services'; import { get, PUBLISH_SERVICE } from '@/services';
import PreviewModal from './PreviewModal'; import PreviewModal from './PreviewModal';
...@@ -33,12 +38,15 @@ const AddModal = props => { ...@@ -33,12 +38,15 @@ const AddModal = props => {
const [im, setIm] = useState(); const [im, setIm] = useState();
const [previewModal, setPreviewModal] = useState(false); const [previewModal, setPreviewModal] = useState(false);
const [keepImgeUrl, setKeepImgeUrl] = useState(''); const [keepImgeUrl, setKeepImgeUrl] = useState('');
const [show, setShow] = useState(0);
const [optionslist, setOptionsList] = useState([]);
const { Option } = Select; const { Option } = Select;
useEffect(() => { useEffect(() => {
console.log(keepSystemName); console.log(keepSystemName);
if (visible) { if (visible) {
getMap();
if (type === 'edit') { if (type === 'edit') {
console.log(pickItem); console.log(pickItem);
console.log(pickItem.AccountParam[0]); console.log(pickItem.AccountParam[0]);
...@@ -65,13 +73,18 @@ const AddModal = props => { ...@@ -65,13 +73,18 @@ const AddModal = props => {
setIm(pickItem.iconUrl); setIm(pickItem.iconUrl);
// } // }
} else { } else {
form.setFieldsValue({ iconUrl: '' }); form.setFieldsValue({
iconUrl: '',
});
setImageUrl(''); setImageUrl('');
setIm(''); setIm('');
} }
} else { } else {
setRadio(0); setRadio(0);
form.setFieldsValue({ accountParamValue: '熊猫ticket', target: 0 }); form.setFieldsValue({
accountParamValue: '熊猫ticket',
target: 0,
});
} }
} else { } else {
setRadio(''); setRadio('');
...@@ -81,6 +94,86 @@ const AddModal = props => { ...@@ -81,6 +94,86 @@ const AddModal = props => {
form.resetFields(); form.resetFields();
} }
}, [visible]); }, [visible]);
const getMap = () => {
GetIntegratedloginSetting().then(res => {
console.log(res.data);
if (res.data.displayMode == '地图') {
console.log(res.data.mapSettings);
let list = [];
let listSecord = [];
res.data.mapSettings.map(i => {
list.push(i[0]);
if (i[1]) {
listSecord.push(i[1]);
}
});
console.log(list);
console.log(listSecord);
setShow(1);
// 获取城市选择器列表
window.AMap.plugin('AMap.DistrictSearch', () => {
let districtSearch = new AMap.DistrictSearch({
// 关键字对应的行政区级别,country表示国家
level: 'country',
// 显示下级行政区级数,1表示返回下一级行政区
subdistrict: 3,
});
// 搜索所有省/直辖市信息
districtSearch.search('中国', (status, result) => {
// 查询成功时,result即为对应的行政区信息
console.log(result, '行政区划信息');
result.districtList[0].districtList.push({
adcode: '100000',
name: '中华人民共和国',
center: { pos: [11330151.428933946, 4386623.239690046] },
});
console.log(result.districtList[0].districtList);
let data = [];
result.districtList[0].districtList.map(i => {
let aa = `${i.center.lng},${i.center.lat}`;
i.lastpos = aa;
if (list.indexOf(i.adcode) != -1) {
data.push(i);
}
if (i.districtList) {
i.districtList.map(j => {
let bb = `${j.center.lng},${j.center.lat}`;
j.lastpos = bb;
if (list.indexOf(j.adcode) != -1) {
data.push(j);
}
if (j.districtList) {
j.districtList.map(k => {
let cc = `${k.center.lng},${k.center.lat}`;
k.lastpos = cc;
});
}
});
}
});
data.map(i => {
let aa = [];
i.districtList.map(j => {
if (listSecord.indexOf(j.adcode) != -1) {
aa.push(j);
i.districtList = aa;
}
});
});
console.log(result.districtList[0].districtList);
setOptionsList(data);
form.setFieldsValue({ coordinate: pickItem.Coordinate });
});
});
} else {
setShow(0);
}
});
};
// 提交 // 提交
const onSubmit = () => { const onSubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
...@@ -111,6 +204,7 @@ const AddModal = props => { ...@@ -111,6 +204,7 @@ const AddModal = props => {
iconUrl: obj.iconUrl, iconUrl: obj.iconUrl,
accountType: 'Panda', accountType: 'Panda',
target: obj.target, target: obj.target,
coordinate: obj.coordinate,
}) })
.then(res => { .then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -145,6 +239,7 @@ const AddModal = props => { ...@@ -145,6 +239,7 @@ const AddModal = props => {
accountType: 'Panda', accountType: 'Panda',
target: obj.target, target: obj.target,
clients: pickItem.clients, clients: pickItem.clients,
coordinate: obj.coordinate,
}) })
.then(res => { .then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -333,10 +428,6 @@ const AddModal = props => { ...@@ -333,10 +428,6 @@ const AddModal = props => {
<Input allowClear style={{ width: '100%' }} placeholder="请输入名称" /> <Input allowClear style={{ width: '100%' }} placeholder="请输入名称" />
</Item> </Item>
)} )}
<Item label="副标题" name="subtitle" rules={[{ required: true, message: '请输入副标题' }]}>
<Input allowClear placeholder="建议使用英文" />
</Item>
<Item label="外网地址" name="internetAddress"> <Item label="外网地址" name="internetAddress">
<AutoComplete placeholder="建议使用公网IP或域名" options={options} allowClear /> <AutoComplete placeholder="建议使用公网IP或域名" options={options} allowClear />
</Item> </Item>
...@@ -414,6 +505,33 @@ const AddModal = props => { ...@@ -414,6 +505,33 @@ const AddModal = props => {
</Item> </Item>
</Col> </Col>
</Row> </Row>
{show == 1 ? (
<Item
label="地区选择"
name="coordinate"
rules={[
{
required: true,
message: '地区选择为必填项',
},
]}
>
<Cascader
fieldNames={{
label: 'name',
value: 'lastpos',
children: 'districtList',
}}
showSearch
options={optionslist}
placeholder="请选择行政区"
changeOnSelect
allowClear={false}
/>
</Item>
) : (
<></>
)}
</Form> </Form>
<PreviewModal <PreviewModal
visible={previewModal} visible={previewModal}
......
/* eslint-disable prefer-template */ /* eslint-disable prefer-template */
/* eslint-disable react/jsx-boolean-value */ /* eslint-disable react/jsx-boolean-value */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, notification, Button, message, Upload, Select, Col, Row } from 'antd'; import {
Form,
Modal,
Input,
notification,
Button,
message,
Upload,
Select,
Col,
Row,
Cascader,
Radio,
} from 'antd';
import { import {
AddIntegratedloginSetting, AddIntegratedloginSetting,
GetIntegratedloginSetting, GetIntegratedloginSetting,
...@@ -43,9 +56,40 @@ const Master = props => { ...@@ -43,9 +56,40 @@ const Master = props => {
const [im, setIm] = useState(); const [im, setIm] = useState();
const [previewModal, setPreviewModal] = useState(false); const [previewModal, setPreviewModal] = useState(false);
const [keepImgeUrl, setKeepImgeUrl] = useState(''); const [keepImgeUrl, setKeepImgeUrl] = useState('');
const [options, setOptions] = useState([]);
const [radio, setRadio] = useState();
const [flag, setFlag] = useState(0);
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
// 获取城市选择器列表
window.AMap.plugin('AMap.DistrictSearch', () => {
let districtSearch = new AMap.DistrictSearch({
// 关键字对应的行政区级别,country表示国家
level: 'country',
// 显示下级行政区级数,1表示返回下一级行政区
subdistrict: 3,
});
// 搜索所有省/直辖市信息
districtSearch.search('中国', (status, result) => {
// 查询成功时,result即为对应的行政区信息
console.log(result, '行政区划信息');
result.districtList[0].districtList.push({ adcode: '100000', name: '中华人民共和国' });
console.log(result.districtList[0].districtList);
result.districtList[0].districtList.map(i => {
if (i.districtList) {
i.districtList.map(j => {
if (j.districtList) {
delete j.districtList;
}
});
}
});
console.log(result.districtList[0].districtList);
setOptions(result.districtList[0].districtList);
});
});
GetIntegratedloginSetting().then(res => { GetIntegratedloginSetting().then(res => {
if (res.code === 0) { if (res.code === 0) {
console.log(res.data); console.log(res.data);
...@@ -53,10 +97,19 @@ const Master = props => { ...@@ -53,10 +97,19 @@ const Master = props => {
form.setFieldsValue({ form.setFieldsValue({
logo: res.data.logo, logo: res.data.logo,
primaryColor: res.data.primaryColor, primaryColor: res.data.primaryColor,
displayMode: res.data.displayMode || '卡片',
// subtitle: res.data.subtitle, // subtitle: res.data.subtitle,
title: aa[0], title: aa[0],
titlebr: aa[1], titlebr: aa[1],
mapSettings: res.data.mapSettings,
}); });
if (res.data.displayMode == '卡片') {
setFlag(0);
} else {
setFlag(1);
}
let data = res.data.displayMode || '卡片';
setRadio(data);
setImageUrl(window.location.origin + `/${res.data.logo}`); setImageUrl(window.location.origin + `/${res.data.logo}`);
setIm(res.data.logo); setIm(res.data.logo);
} else { } else {
...@@ -70,6 +123,7 @@ const Master = props => { ...@@ -70,6 +123,7 @@ const Master = props => {
setIm(''); setIm('');
setKeepImgeUrl(''); setKeepImgeUrl('');
form.resetFields(); form.resetFields();
setFlag(0);
} }
}, [visible]); }, [visible]);
...@@ -88,8 +142,10 @@ const Master = props => { ...@@ -88,8 +142,10 @@ const Master = props => {
AddIntegratedloginSetting({ AddIntegratedloginSetting({
logo: obj.logo, logo: obj.logo,
primaryColor: obj.primaryColor, primaryColor: obj.primaryColor,
// subtitle: obj.subtitle, subtitle: obj.subtitle,
title: obj.title, title: obj.title,
displayMode: obj.displayMode,
mapSettings: obj.mapSettings,
}) })
.then(res => { .then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -185,6 +241,16 @@ const Master = props => { ...@@ -185,6 +241,16 @@ const Master = props => {
} }
}; };
const onChange = e => {
console.log(e);
setRadio(e.target.value);
if (e.target.value == '地图') {
setFlag(1);
} else {
setFlag(0);
}
};
return ( return (
<Modal <Modal
title="配置集成网站" title="配置集成网站"
...@@ -226,18 +292,6 @@ const Master = props => { ...@@ -226,18 +292,6 @@ const Master = props => {
</Item> </Item>
</Col> </Col>
</Row> </Row>
<Item
label="副标题"
name="subtitle"
rules={[
{
required: true,
message: '标题为必填项',
},
]}
>
<Input placeholder="请输入副标题" autoComplete="off" />
</Item>
<Row> <Row>
<Col span={10}> <Col span={10}>
<Item <Item
...@@ -303,6 +357,40 @@ const Master = props => { ...@@ -303,6 +357,40 @@ const Master = props => {
))} ))}
</Select> </Select>
</Item> </Item>
<Item label="展示方式" name="displayMode">
<Radio.Group onChange={onChange} value={radio}>
<Radio value="卡片">卡片</Radio>
<Radio value="地图">地图</Radio>
</Radio.Group>
</Item>
{flag == 1 ? (
<Item
label="地区选择"
name="mapSettings"
rules={[
{
required: true,
message: '地区选择为必填项',
},
]}
>
<Cascader
fieldNames={{
label: 'name',
value: 'adcode',
children: 'districtList',
}}
multiple
showSearch
options={options}
placeholder="请选择行政区"
changeOnSelect
allowClear={false}
/>
</Item>
) : (
<></>
)}
</Form> </Form>
<PreviewModal <PreviewModal
visible={previewModal} visible={previewModal}
......
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