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

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

parent da66842c
Pipeline #57178 waiting for manual action with stages
......@@ -92,7 +92,7 @@
"@esri/calcite-colors": "6.0.3",
"@wisdom-cesium/cesium": "^1.0.78",
"@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",
"ace-builds": "^1.4.12",
"antd-img-crop": "^3.13.2",
......
......@@ -80,7 +80,7 @@ InitDataBaseContainer {
justify-content: flex-end;
}
.ant-checkbox-wrapper {
width: 269px;
width: 268px;
margin-bottom: 10px;
margin-left: 8px;
}
......
......@@ -17,8 +17,13 @@ import {
Image,
Select,
AutoComplete,
Cascader,
} 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 { get, PUBLISH_SERVICE } from '@/services';
import PreviewModal from './PreviewModal';
......@@ -33,12 +38,15 @@ const AddModal = props => {
const [im, setIm] = useState();
const [previewModal, setPreviewModal] = useState(false);
const [keepImgeUrl, setKeepImgeUrl] = useState('');
const [show, setShow] = useState(0);
const [optionslist, setOptionsList] = useState([]);
const { Option } = Select;
useEffect(() => {
console.log(keepSystemName);
if (visible) {
getMap();
if (type === 'edit') {
console.log(pickItem);
console.log(pickItem.AccountParam[0]);
......@@ -65,13 +73,18 @@ const AddModal = props => {
setIm(pickItem.iconUrl);
// }
} else {
form.setFieldsValue({ iconUrl: '' });
form.setFieldsValue({
iconUrl: '',
});
setImageUrl('');
setIm('');
}
} else {
setRadio(0);
form.setFieldsValue({ accountParamValue: '熊猫ticket', target: 0 });
form.setFieldsValue({
accountParamValue: '熊猫ticket',
target: 0,
});
}
} else {
setRadio('');
......@@ -81,6 +94,86 @@ const AddModal = props => {
form.resetFields();
}
}, [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 = () => {
form.validateFields().then(validate => {
......@@ -111,6 +204,7 @@ const AddModal = props => {
iconUrl: obj.iconUrl,
accountType: 'Panda',
target: obj.target,
coordinate: obj.coordinate,
})
.then(res => {
if (res.code === 0) {
......@@ -145,6 +239,7 @@ const AddModal = props => {
accountType: 'Panda',
target: obj.target,
clients: pickItem.clients,
coordinate: obj.coordinate,
})
.then(res => {
if (res.code === 0) {
......@@ -333,10 +428,6 @@ const AddModal = props => {
<Input allowClear style={{ width: '100%' }} placeholder="请输入名称" />
</Item>
)}
<Item label="副标题" name="subtitle" rules={[{ required: true, message: '请输入副标题' }]}>
<Input allowClear placeholder="建议使用英文" />
</Item>
<Item label="外网地址" name="internetAddress">
<AutoComplete placeholder="建议使用公网IP或域名" options={options} allowClear />
</Item>
......@@ -414,6 +505,33 @@ const AddModal = props => {
</Item>
</Col>
</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>
<PreviewModal
visible={previewModal}
......
/* eslint-disable prefer-template */
/* eslint-disable react/jsx-boolean-value */
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 {
AddIntegratedloginSetting,
GetIntegratedloginSetting,
......@@ -43,9 +56,40 @@ const Master = props => {
const [im, setIm] = useState();
const [previewModal, setPreviewModal] = useState(false);
const [keepImgeUrl, setKeepImgeUrl] = useState('');
const [options, setOptions] = useState([]);
const [radio, setRadio] = useState();
const [flag, setFlag] = useState(0);
useEffect(() => {
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 => {
if (res.code === 0) {
console.log(res.data);
......@@ -53,10 +97,19 @@ const Master = props => {
form.setFieldsValue({
logo: res.data.logo,
primaryColor: res.data.primaryColor,
displayMode: res.data.displayMode || '卡片',
// subtitle: res.data.subtitle,
title: aa[0],
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}`);
setIm(res.data.logo);
} else {
......@@ -70,6 +123,7 @@ const Master = props => {
setIm('');
setKeepImgeUrl('');
form.resetFields();
setFlag(0);
}
}, [visible]);
......@@ -88,8 +142,10 @@ const Master = props => {
AddIntegratedloginSetting({
logo: obj.logo,
primaryColor: obj.primaryColor,
// subtitle: obj.subtitle,
subtitle: obj.subtitle,
title: obj.title,
displayMode: obj.displayMode,
mapSettings: obj.mapSettings,
})
.then(res => {
if (res.code === 0) {
......@@ -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 (
<Modal
title="配置集成网站"
......@@ -226,18 +292,6 @@ const Master = props => {
</Item>
</Col>
</Row>
<Item
label="副标题"
name="subtitle"
rules={[
{
required: true,
message: '标题为必填项',
},
]}
>
<Input placeholder="请输入副标题" autoComplete="off" />
</Item>
<Row>
<Col span={10}>
<Item
......@@ -303,6 +357,40 @@ const Master = props => {
))}
</Select>
</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>
<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