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;
}
......
......@@ -46,7 +46,6 @@ import styles from './DatabaseInitialization.less';
import styles1 from '../InitDataBase/InitDataBase.less';
const CheckboxGroup = Checkbox.Group;
const { Option } = Select;
const formLables = {
ip: '服务器地址',
userName: '用户名称',
......@@ -72,13 +71,11 @@ const DatabaseInitialization = props => {
const [keepDb, setKeepDb] = useState([]);
const [keepProduct, setKeepProduct] = useState([]);
const scroll = useRef(null);
const [flag, setFlag] = useState(0);
const [data, setData] = useState([]);
const [title, setTitle] = useState([]);
const [keepCode, setKeepCode] = useState([]);
const [keepData, setKeepData] = useState([]);
const [code, setCode] = useState('');
const [checkboxFlag, setCheckboxFlag] = useState(0);
const [keepValue, setKeepValue] = useState([]);
const [value, setValue] = useState([]);
......@@ -95,23 +92,24 @@ const DatabaseInitialization = props => {
const [lastColor, setLastColor] = useState('gray');
const [totalProduct, setTotalProduct] = useState('');
const [simpleProduct, setSimpleProduct] = useState('');
const [loads, setLoads] = useState(true);
const [show, setShow] = useState('hidden');
const [keepInline, setKeepInline] = useState([]);
const [ifInline, setIfInline] = useState('hidden');
const [result, setResult] = useState('');
// 获取数据库配置信息
useEffect(() => {
setCardLoading(true);
getProductList();
// form.setFieldsValue({ ip: '127.0.0.1', password: 'sa', userName: 'sa' });
GetDb();
}, []);
const getProductList = () => {
GetProductList().then(res => {
setCardLoading(false);
if (res.code === 0) {
console.log(res.data);
GetDb(res.data);
setKeepData(res.data);
let arr = formateArrDataA(res.data, 'productName');
let aa = Object.keys(arr);
......@@ -194,7 +192,6 @@ const DatabaseInitialization = props => {
doInitLog();
}, 600);
} else {
setLoads(false);
setInitLoading(false);
setShow('visible');
if (time) {
......@@ -257,7 +254,7 @@ const DatabaseInitialization = props => {
deleteInitDBLogNew();
};
const GetDb = () => {
const GetDb = kk => {
GetDbProduct().then(res => {
if (res.code === 0) {
if (res.data.DbInfo.ip == '127.0.0.1' || !res.data.DbInfo.ip) {
......@@ -266,7 +263,7 @@ const DatabaseInitialization = props => {
setIfInline('visible');
}
setKeepInline(res.data.DbInfo);
if (res.data.Project[0]) {
if (res.data.Project && res.data.Project.length > 0) {
setkeepNumber(res.data.Project[0].license);
setkeepMsg(res.data.Project[0].projectName);
setkeepNa(res.data.Project[0].applicantName);
......@@ -277,49 +274,50 @@ const DatabaseInitialization = props => {
setkeepNa('');
setkeepCo('');
}
if (!res.data.IsAuthorize) {
form.setFieldsValue(res.data.DbInfo);
}
// 有License的情况下首次进入展示数据
if (res.data.IsAuthorize) {
if (res.data.Product) {
let aa = [];
res.data.Product.map(i => {
aa.push(i.name);
});
if (res.data.IsAuthorize) {
setCheckboxFlag(1);
} else {
setCheckboxFlag(0);
}
if (aa.length > 0) {
let dd = [];
aa.map(i => {
keepData.map(j => {
if (j.name === i) {
dd.push(j);
}
});
// if (res.data.IsAuthorize) {
if (res.data.Product) {
let aa = [];
res.data.Product.map(i => {
aa.push(i.name);
});
if (res.data.IsAuthorize) {
setCheckboxFlag(1);
} else {
setCheckboxFlag(0);
}
if (aa.length > 0) {
let dd = [];
aa.map(i => {
kk.map(j => {
if (j.name === i) {
dd.push(j);
}
});
let Arr = Array.from(new Set(dd));
let arr = formateArrDataA(Arr, 'productName');
let a = Object.keys(arr);
a.map(i => {
let list = [];
arr[i].map(j => {
list.push(j.name);
});
arr[i] = list;
});
let Arr = Array.from(new Set(dd));
let arr = formateArrDataA(Arr, 'productName');
let a = Object.keys(arr);
a.map(i => {
let list = [];
arr[i].map(j => {
list.push(j.name);
});
setProduct(arr);
setKeepValue(arr);
}
let newArr = Array.from(new Set(aa));
setKeepProduct(newArr);
setKeepCode(newArr);
setValue(newArr);
arr[i] = list;
});
setProduct(arr);
setKeepValue(arr);
}
setDbExists(res.data.DBExists);
setKeepDb(res.data);
let newArr = Array.from(new Set(aa));
setKeepProduct(newArr);
setKeepCode(newArr);
setValue(newArr);
}
setDbExists(res.data.DBExists);
setKeepDb(res.data);
// if (res.data.DBExists) {
// setCheckboxFlag(1);
......@@ -360,7 +358,7 @@ const DatabaseInitialization = props => {
let obj = form.getFieldsValue();
GetDbProduct({ ...obj }).then(res => {
if (res.code === 0) {
if (res.data.Project[0]) {
if (res.data.Project && res.data.Project.length > 0) {
setkeepNumber(res.data.Project[0].license);
setkeepMsg(res.data.Project[0].projectName);
setkeepNa(res.data.Project[0].applicantName);
......@@ -423,12 +421,13 @@ const DatabaseInitialization = props => {
});
};
const onOK = (arr, code) => {
initDatabasePro(arr, code);
const onOK = arr => {
console.log(1213);
initDatabasePro(arr);
};
// 数据库初始化
const initDatabasePro = (e, j) => {
const initDatabasePro = e => {
let productSetting = e;
let obj = form.getFieldsValue();
// 数据库存在调用编辑接口否则调用新增接口
......@@ -485,10 +484,10 @@ const DatabaseInitialization = props => {
description: '数据库初始化成功',
});
setDbExists(true);
setkeepNumber('');
setkeepNa('');
setkeepMsg('');
setkeepCo('');
setkeepNumber('已使用');
// setkeepNa('');
// setkeepMsg('');
// setkeepCo('');
setTotalProduct(res.data.productPackageSumCount);
setSimpleProduct(res.data.productPackageCount);
} else {
......@@ -514,12 +513,12 @@ const DatabaseInitialization = props => {
setTotalProduct('');
setKeepValue([]);
setProduct([]);
// setValue([]);
// setKeepProduct([]);
onCheck();
};
const onChange1 = (e, item) => {
console.log(value);
console.log(keepProduct);
console.log(e);
console.log(item);
console.log(product);
......@@ -534,30 +533,27 @@ const DatabaseInitialization = props => {
let arr = product[item].find(i => e.indexOf(i) == -1);
let bb = keepProduct.indexOf(arr);
// 已经被初始化的产品不允许取消勾选
if (arr && bb != -1) {
console.log(arr);
} else {
console.log(keepValue);
let aa = keepValue;
aa[item] = e;
let a = Object.keys(aa);
let list = [];
a.map(i => {
aa[i].map(j => {
list.push(j);
});
// if (arr && bb != -1) {
// console.log(arr);
// } else {
let aa = keepValue;
aa[item] = e;
let a = Object.keys(aa);
let list = [];
a.map(i => {
aa[i].map(j => {
list.push(j);
});
setKeepValue(aa);
console.log(list);
setValue(list);
}
});
console.log(aa);
setKeepValue(aa);
console.log(list);
setValue(list);
// }
} else {
console.log(keepValue);
let aa = keepValue;
aa[item] = e;
console.log(aa);
let a = Object.keys(aa);
console.log(a);
let list = [];
a.map(i => {
aa[i].map(j => {
......@@ -565,16 +561,12 @@ const DatabaseInitialization = props => {
});
});
console.log(aa);
setKeepValue(aa);
console.log(list);
setKeepValue(aa);
setValue(list);
}
};
useEffect(() => {
console.log(value);
}, [value]);
const onCheck = () => {
let obj = form.getFieldsValue();
GetDbChange();
......@@ -586,36 +578,40 @@ const DatabaseInitialization = props => {
// 数据库不存在
if (res.data === false) {
setbeforeColor('green');
setResult('通过');
// 有授权码
if (keepNumber) {
setCheckboxFlag(1);
// setDbExists(false);
setMsg('');
notification.success({
message: '提示',
duration: 3,
description: '已检测到License,需初始化数据库',
});
// notification.success({
// message: '提示',
// duration: 3,
// description: '已检测到License,需初始化数据库',
// });
} else {
setCheckboxFlag(0);
// setDbExists(false);
setMsg('');
notification.warning({
message: '提示',
duration: 3,
description: '未检测到License,自主选择产品进行数据库初始化',
});
// notification.warning({
// message: '提示',
// duration: 3,
// description: '未检测到License,自主选择产品进行数据库初始化',
// });
}
setValue([]);
setKeepProduct([]);
console.log(value);
} else {
setbeforeColor('red');
setResult('未通过 :当前数据库已存在不可初始化');
setCheckboxFlag(1);
setMsg('当前数据库已存在不可初始化');
notification.error({
message: '提示',
duration: 3,
description: '当前数据库已存在不可初始化',
});
// notification.error({
// message: '提示',
// duration: 3,
// description: '当前数据库已存在不可初始化',
// });
}
} else {
setMsg(res.msg);
......@@ -635,17 +631,19 @@ const DatabaseInitialization = props => {
if (res.code === 0) {
if (res.data === true) {
setbeforeColor('red');
setResult('未通过 :当前数据库已存在不可初始化 ');
GetDbChange();
deleteInitDBLogNew();
setCheckboxFlag(1);
setMsg('当前数据库已存在不可初始化');
notification.error({
message: '提示',
duration: 3,
description: '当前数据库已存在不可初始化',
});
// notification.error({
// message: '提示',
// duration: 3,
// description: '当前数据库已存在不可初始化',
// });
} else {
setbeforeColor('green');
setResult('通过');
// setDbExists(false);
setMsg('');
if (checkboxFlag == 0 && value.length == 0) {
......@@ -675,7 +673,7 @@ const DatabaseInitialization = props => {
}
});
}
onOK(arr, code);
onOK(arr);
}
}
} else {
......@@ -696,12 +694,18 @@ const DatabaseInitialization = props => {
useEffect(() => {
if (!initVisible) {
setLoads(true);
setShow('hidden');
}
}, [initVisible]);
const wirthValue = () => {
setResult('');
setbeforeColor('gray');
setfirstColor('gray');
setsecordColor('gray');
setLastColor('gray');
setSimpleProduct('');
setTotalProduct('');
form.setFieldsValue(keepInline);
};
......@@ -737,6 +741,9 @@ const DatabaseInitialization = props => {
setfirstColor('gray');
setsecordColor('gray');
setLastColor('gray');
setSimpleProduct('');
setTotalProduct('');
setResult('');
return Promise.resolve();
},
},
......@@ -757,6 +764,9 @@ const DatabaseInitialization = props => {
setfirstColor('gray');
setsecordColor('gray');
setLastColor('gray');
setSimpleProduct('');
setTotalProduct('');
setResult('');
return Promise.resolve();
},
},
......@@ -778,6 +788,9 @@ const DatabaseInitialization = props => {
setfirstColor('gray');
setsecordColor('gray');
setLastColor('gray');
setSimpleProduct('');
setTotalProduct('');
setResult('');
return Promise.resolve();
},
},
......@@ -802,6 +815,9 @@ const DatabaseInitialization = props => {
setfirstColor('gray');
setsecordColor('gray');
setLastColor('gray');
setSimpleProduct('');
setTotalProduct('');
setResult('');
return Promise.resolve();
},
},
......@@ -811,17 +827,19 @@ const DatabaseInitialization = props => {
</Form.Item>
</Form>
<div style={{ float: 'right' }}>
<Button
{/* <Button
style={{ marginRight: '20px', visibility: ifInline }}
onClick={wirthValue}
>
当前数据库
</Button>
<Button onClick={save}>环境检查</Button>
</Button> */}
<Button onClick={save}>初始化检查</Button>
</div>
<div style={{ marginTop: '100px', transform: 'scal(1.5)' }}>
<Timeline>
<Timeline.Item color={beforeColor}>环境检查通过</Timeline.Item>
<Timeline.Item color={beforeColor}>
初始化检查<span style={{ color: 'rgb(24 144 255)' }}>{result}</span>
</Timeline.Item>
<Timeline.Item color={firstColor}>数据库初始化完成</Timeline.Item>
<Timeline.Item color={secordColor}>
<p>产品授权打开已初始化的产品</p>
......
......@@ -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