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