Commit 309ad5e4 authored by 皮倩雯's avatar 皮倩雯

数据库初始化追加

parent cae1fb8c
Pipeline #59232 passed with stages
...@@ -476,7 +476,7 @@ const AddModal = props => { ...@@ -476,7 +476,7 @@ const AddModal = props => {
const [reportValue, setReportValue] = useState(); // 保存上报字段外部字段 const [reportValue, setReportValue] = useState(); // 保存上报字段外部字段
const [displayValue, setDisplayValue] = useState(); // 保存显示字段外部字段 const [displayValue, setDisplayValue] = useState(); // 保存显示字段外部字段
const [editableValue, setEditableValue] = useState(); // 保存编辑字段外部字段 const [editableValue, setEditableValue] = useState(); // 保存编辑字段外部字段
const [transitValue, setTransitValue] = useState(); // 保存转单字段外部字段 const [displayColumns, setDisplayColumns] = useState(); // 保存显示列字段外部字段
const [relatedEventValue, setRelatedEventValue] = useState(); // 保存关联字段外部字段 const [relatedEventValue, setRelatedEventValue] = useState(); // 保存关联字段外部字段
const [groupName, setGroupName] = useState('角色'); const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色', '部门', '站点']); const [chooseGroupName, setChooseGroupName] = useState(['角色', '部门', '站点']);
...@@ -563,8 +563,8 @@ const AddModal = props => { ...@@ -563,8 +563,8 @@ const AddModal = props => {
setFlag(0); setFlag(0);
} }
if (type == 'add') { if (type == 'add') {
if (obj.TransitFields == undefined) { if (obj.DisplayColumns == undefined) {
obj.TransitFields = ''; obj.DisplayColumns = '';
} }
if (obj.Roles == undefined) { if (obj.Roles == undefined) {
obj.Roles = ''; obj.Roles = '';
...@@ -669,8 +669,8 @@ const AddModal = props => { ...@@ -669,8 +669,8 @@ const AddModal = props => {
} else { } else {
setEditableIsShow('none'); setEditableIsShow('none');
} }
setTransitValue(res.data.root.outTransitFields); setDisplayColumns(res.data.root.outDisplayColumns);
if (res.data.root.outTransitFields != 0) { if (res.data.root.outDisplayColumns != 0) {
setTransitIsShow('inline'); setTransitIsShow('inline');
} else { } else {
setTransitIsShow('none'); setTransitIsShow('none');
...@@ -882,11 +882,11 @@ const AddModal = props => { ...@@ -882,11 +882,11 @@ const AddModal = props => {
setEditableIsShow('none'); setEditableIsShow('none');
} }
}; };
// 转单字段外部字段 // 显示列字段外部字段
const ExternalTransitField = e => { const ExternalTransitField = e => {
if (form.getFieldValue().TransitFields) { if (form.getFieldValue().DisplayColumns) {
let pp = formateArrDataA(e, 'group'); let pp = formateArrDataA(e, 'group');
let ab = form.getFieldValue().TransitFields.split(','); let ab = form.getFieldValue().DisplayColumns.split(',');
let arr = Object.keys(pp); let arr = Object.keys(pp);
let b = []; let b = [];
let a = []; let a = [];
...@@ -904,7 +904,7 @@ const AddModal = props => { ...@@ -904,7 +904,7 @@ const AddModal = props => {
} }
} }
}); });
setTransitValue(a.length); setDisplayColumns(a.length);
if (a.length != 0) { if (a.length != 0) {
setTransitIsShow('inline'); setTransitIsShow('inline');
} else { } else {
...@@ -1123,8 +1123,8 @@ const AddModal = props => { ...@@ -1123,8 +1123,8 @@ const AddModal = props => {
setEditableIsShow('none'); setEditableIsShow('none');
} }
} }
if (prop.pickItem == 'TransitFields') { if (prop.pickItem == 'DisplayColumns') {
setTransitValue(prop.valueArr.length); setDisplayColumns(prop.valueArr.length);
if (prop.valueArr.length != 0) { if (prop.valueArr.length != 0) {
setTransitIsShow('inline'); setTransitIsShow('inline');
} else { } else {
...@@ -1706,11 +1706,11 @@ const AddModal = props => { ...@@ -1706,11 +1706,11 @@ const AddModal = props => {
</div> </div>
</Item> </Item>
</Col> </Col>
{/* <Col span={24}> <Col span={24}>
<Item <Item
label={ label={
<div> <div>
<Tooltip title={`存在${transitValue}个外部字段`}> <Tooltip title={`存在${displayColumns}个外部字段`}>
<InfoCircleOutlined <InfoCircleOutlined
style={{ style={{
color: 'red', color: 'red',
...@@ -1719,25 +1719,25 @@ const AddModal = props => { ...@@ -1719,25 +1719,25 @@ const AddModal = props => {
}} }}
/> />
</Tooltip> </Tooltip>
<span>转单字段</span> <span>显示列字段</span>
</div> </div>
} }
name="TransitFields" name="DisplayColumns"
labelCol={{ span: 5 }} labelCol={{ span: 5 }}
> >
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Form.Item name="TransitFields" style={{ marginBottom: 0, width: '100%' }}> <Form.Item name="DisplayColumns" style={{ marginBottom: 0, width: '100%' }}>
<Input placeholder="请选择转单字段" allowClear /> <Input placeholder="请选择显示列字段" allowClear />
</Form.Item> </Form.Item>
<Button <Button
type="dashed" type="dashed"
onClick={() => pickFiled('TransitFields')} onClick={() => pickFiled('DisplayColumns')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />} icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '10px', width: '70px' }} style={{ marginLeft: '10px', width: '70px' }}
/> />
</div> </div>
</Item> </Item>
</Col> */} </Col>
<Col span={24}> <Col span={24}>
<Item label="事件权限" name="Roles" labelCol={{ span: 5 }}> <Item label="事件权限" name="Roles" labelCol={{ span: 5 }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
......
/* eslint-disable guard-for-in */ /* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */ /* eslint-disable no-restricted-syntax */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button, Space, notification, Modal, Popconfirm, Empty, Spin } from 'antd'; import { Button, Space, notification, Modal, Popconfirm, Empty, Spin, Tooltip } from 'antd';
import { BarcodeOutlined, UserOutlined, CalendarOutlined } from '@ant-design/icons';
import styles from './DatabaseInitialization.less'; import styles from './DatabaseInitialization.less';
import { GetLicenseDifference, InitEditDataBase, GetProductList } from '@/services/database/api'; import { GetLicenseDifference, InitEditDataBase, GetProductList } from '@/services/database/api';
const AppendModal = props => { const AppendModal = props => {
const { callBackSubmit = () => {}, visible, onCancel, value } = props; const { callBackSubmit = () => {}, visible, onCancel, value, keepHistroy } = props;
const [data, setData] = useState([]); const [data, setData] = useState([]);
const [allLength, setAllLength] = useState(''); const [allLength, setAllLength] = useState('');
const [flag, setFlag] = useState(); const [flag, setFlag] = useState();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [code, setCode] = useState('');
const [project, setProject] = useState('');
const [name, setName] = useState('');
const [number, setNumber] = useState('');
const [much, setMuch] = useState([]);
const [code1, setCode1] = useState('');
const [project1, setProject1] = useState('');
const [name1, setName1] = useState('');
const [number1, setNumber1] = useState('');
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
getProduct(); getProduct();
console.log(value); console.log(value);
console.log(keepHistroy);
let aa = [];
keepHistroy.map((i, j) => {
if (i.license != '已使用' && j != keepHistroy.length - 1) {
aa.push(i);
}
});
if (aa.length > 0) {
let a = [];
let b = [];
let c = [];
aa.map(k => {
a.push(k.license);
b.push(k.projectName);
c.push(`${k.applicantName}${k.jobNumber})`);
});
setCode1(a.toString());
setProject1(b.toString());
setName1(c.toString());
}
setMuch(aa);
setCode(keepHistroy[keepHistroy.length - 1].license);
setProject(keepHistroy[keepHistroy.length - 1].projectName);
setName(keepHistroy[keepHistroy.length - 1].applicantName);
setNumber(keepHistroy[keepHistroy.length - 1].jobNumber);
} else { } else {
setData([]); setData([]);
setFlag(); setFlag();
...@@ -99,7 +134,7 @@ const AppendModal = props => { ...@@ -99,7 +134,7 @@ const AppendModal = props => {
return ( return (
<Modal <Modal
title="产品追加" title="产品追加"
width="800px" width="1000px"
visible={visible} visible={visible}
onCancel={onCancel} onCancel={onCancel}
destroyOnClose destroyOnClose
...@@ -134,10 +169,69 @@ const AppendModal = props => { ...@@ -134,10 +169,69 @@ const AppendModal = props => {
) : ( ) : (
<> <>
{allLength > 0 && ( {allLength > 0 && (
<div style={{ marginBottom: '26px' }}> <div
<strong> style={{
追加产品列表(共<span style={{ color: 'rgb(24 144 255)' }}>{allLength}</span>个) height: '50px',
</strong> display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: '15px',
}}
>
{much.length > 0 ? (
<Tooltip title={code1}>
<div style={{ display: 'inline-block', backgroundColor: 'aliceblue' }}>
<BarcodeOutlined style={{ color: 'rgb(227 168 96)', marginRight: '5px' }} />
授权码:
{code ? <>{code}</> : <span>--</span>}
<span>...</span>
</div>
</Tooltip>
) : (
<div style={{ display: 'inline-block', backgroundColor: 'aliceblue' }}>
<BarcodeOutlined style={{ color: 'rgb(227 168 96)', marginRight: '5px' }} />
授权码:
{code ? <>{code}</> : <span>--</span>}
</div>
)}
{much.length > 0 ? (
<Tooltip title={project1}>
<div style={{ display: 'inline-block', backgroundColor: 'aliceblue' }}>
<CalendarOutlined style={{ color: '#8466cb', marginRight: '5px' }} />
项目名:{project ? <>{project}</> : '--'}
<span>...</span>
</div>
</Tooltip>
) : (
<div style={{ display: 'inline-block', backgroundColor: 'aliceblue' }}>
<CalendarOutlined style={{ color: '#8466cb', marginRight: '5px' }} />
项目名:{project ? <>{project}</> : '--'}
</div>
)}
{much.length > 0 ? (
<Tooltip title={name1}>
<div style={{ display: 'inline-block', backgroundColor: 'aliceblue' }}>
<UserOutlined style={{ color: 'green', marginRight: '5px' }} />
授权人:{name ? <>{name}</> : '-'}
{number ? <>{number}</> : '-'}
{much.length > 0 ? <span>...</span> : <></>}
</div>
</Tooltip>
) : (
<div style={{ display: 'inline-block', backgroundColor: 'aliceblue' }}>
<UserOutlined style={{ color: 'green', marginRight: '5px' }} />
授权人:{name ? <>{name}</> : '-'}
{number ? <>{number}</> : '-'}
</div>
)}
<div style={{ display: 'inline-block', backgroundColor: 'aliceblue' }}>
<div style={{ float: 'right' }}>
<strong>
追加产品列表(共<span style={{ color: 'rgb(24 144 255)' }}>{allLength}</span>
个)
</strong>
</div>
</div>
</div> </div>
)} )}
{data && {data &&
......
...@@ -20,6 +20,7 @@ import { ...@@ -20,6 +20,7 @@ import {
Popconfirm, Popconfirm,
Timeline, Timeline,
Tooltip, Tooltip,
Table,
} from 'antd'; } from 'antd';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
...@@ -32,6 +33,7 @@ import { ...@@ -32,6 +33,7 @@ import {
CheckDatabaseIsExist, CheckDatabaseIsExist,
NewInitAddDataBase, NewInitAddDataBase,
InitEditDataBase, InitEditDataBase,
getDataBaseConfigNew,
} from '@/services/database/api'; } from '@/services/database/api';
import { import {
CloseCircleOutlined, CloseCircleOutlined,
...@@ -41,6 +43,10 @@ import { ...@@ -41,6 +43,10 @@ import {
BarcodeOutlined, BarcodeOutlined,
UserOutlined, UserOutlined,
CalendarOutlined, CalendarOutlined,
CheckOutlined,
MinusSquareOutlined,
PlusOutlined,
EyeOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import styles from './DatabaseInitialization.less'; import styles from './DatabaseInitialization.less';
import styles1 from '../InitDataBase/InitDataBase.less'; import styles1 from '../InitDataBase/InitDataBase.less';
...@@ -70,6 +76,7 @@ const DatabaseInitialization = props => { ...@@ -70,6 +76,7 @@ const DatabaseInitialization = props => {
const [initLoading, setInitLoading] = useState(false); const [initLoading, setInitLoading] = useState(false);
const [keepDb, setKeepDb] = useState([]); const [keepDb, setKeepDb] = useState([]);
const [keepProduct, setKeepProduct] = useState([]); const [keepProduct, setKeepProduct] = useState([]);
const [keepStatus, setKeepStatus] = useState([]);
const scroll = useRef(null); const scroll = useRef(null);
const [data, setData] = useState([]); const [data, setData] = useState([]);
...@@ -100,6 +107,7 @@ const DatabaseInitialization = props => { ...@@ -100,6 +107,7 @@ const DatabaseInitialization = props => {
const [dataResult, setDataResult] = useState(''); const [dataResult, setDataResult] = useState('');
const [productResult, setProductResult] = useState(''); const [productResult, setProductResult] = useState('');
const [keepInitContent, setKeepInitContent] = useState(''); const [keepInitContent, setKeepInitContent] = useState('');
const [keepInitContentDetail, setKeepInitContentDetail] = useState('');
const [keepinitVisible, setKeepInitVisible] = useState(false); const [keepinitVisible, setKeepInitVisible] = useState(false);
const [password, setPassword] = useState(false); const [password, setPassword] = useState(false);
const [isAuthorize, setIsAuthorize] = useState(false); const [isAuthorize, setIsAuthorize] = useState(false);
...@@ -109,6 +117,9 @@ const DatabaseInitialization = props => { ...@@ -109,6 +117,9 @@ const DatabaseInitialization = props => {
const [appendVisible, setAppendVisible] = useState(false); const [appendVisible, setAppendVisible] = useState(false);
const [append, setAppend] = useState('不需要追加'); const [append, setAppend] = useState('不需要追加');
const [dataValue, setDataValue] = useState(); const [dataValue, setDataValue] = useState();
const [keepHistroy, setKeepHistroy] = useState([]);
const [historyVisible, setHistoryVisible] = useState(false);
const [keepInitDetailVisible, setKeepInitDetailVisible] = useState(false);
// 获取数据库配置信息 // 获取数据库配置信息
useEffect(() => { useEffect(() => {
...@@ -244,6 +255,7 @@ const DatabaseInitialization = props => { ...@@ -244,6 +255,7 @@ const DatabaseInitialization = props => {
); );
console.log(arr); console.log(arr);
setInitContentdetail(arr); setInitContentdetail(arr);
setKeepInitContentDetail(arr);
setShowDetali(true); setShowDetali(true);
scroll.current.scrollTop = scroll.current.scrollHeight; scroll.current.scrollTop = scroll.current.scrollHeight;
} }
...@@ -270,7 +282,7 @@ const DatabaseInitialization = props => { ...@@ -270,7 +282,7 @@ const DatabaseInitialization = props => {
setInitContent(''); setInitContent('');
setInitContentdetail(''); setInitContentdetail('');
setFinish(false); setFinish(false);
deleteInitDBLogNew(); // deleteInitDBLogNew();
setShowDetali(false); setShowDetali(false);
}; };
...@@ -280,107 +292,116 @@ const DatabaseInitialization = props => { ...@@ -280,107 +292,116 @@ const DatabaseInitialization = props => {
// setInitContent(''); // setInitContent('');
// setInitContentdetail(''); // setInitContentdetail('');
setFinish(false); setFinish(false);
deleteInitDBLogNew(); // deleteInitDBLogNew();
setShowDetali(false); setShowDetali(false);
}; };
const GetDb = kk => { const GetDb = kk => {
console.log(121212); getDataBaseConfigNew().then(resdata => {
GetDbProduct().then(res => { console.log(resdata.data);
if (res.code === 0) { GetDbProduct({
if (res.data.DbInfo.ip == '127.0.0.1' || !res.data.DbInfo.ip) { ip: resdata.data.ip,
setIfInline('hidden'); dbName: resdata.data.dbName,
} else { userName: resdata.data.userName,
setIfInline('visible'); password: resdata.data.password,
} }).then(res => {
setKeepInline(res.data.DbInfo); if (res.code === 0) {
if (res.data.Project && res.data.Project.length > 0) { if (res.data.DbInfo.ip == '127.0.0.1' || !res.data.DbInfo.ip) {
setkeepNumber(res.data.Project[0].license); setIfInline('hidden');
setkeepMsg(res.data.Project[0].projectName); } else {
setkeepNa(res.data.Project[0].applicantName); setIfInline('visible');
setkeepCo(res.data.Project[0].jobNumber); }
} else { setKeepInline(res.data.DbInfo);
setkeepNumber(''); if (res.data.Project && res.data.Project.length > 0) {
setkeepMsg(''); setKeepHistroy(res.data.Project);
setkeepNa(''); setkeepNumber(res.data.Project[res.data.Project.length - 1].license);
setkeepCo(''); setkeepMsg(res.data.Project[res.data.Project.length - 1].projectName);
} setkeepNa(res.data.Project[res.data.Project.length - 1].applicantName);
setkeepCo(res.data.Project[res.data.Project.length - 1].jobNumber);
} else {
setKeepHistroy([]);
// setKeepProductData('');
setkeepNumber('');
setkeepMsg('');
setkeepNa('');
setkeepCo('');
}
form.setFieldsValue(res.data.DbInfo); // form.setFieldsValue(res.data.DbInfo);
GetDbChangeFirst(kk); form.setFieldsValue({
// 有License的情况下首次进入展示数据 ip: resdata.data.ip,
// if (res.data.IsAuthorize) { dbName: resdata.data.dbName,
if (res.data.Product) { userName: resdata.data.userName,
let aa = []; password: resdata.data.password,
res.data.Product.map(i => {
aa.push(i.name);
}); });
if (aa.length > 0) { GetDbChangeFirst(kk);
let dd = []; // 有License的情况下首次进入展示数据
aa.map(i => { // if (res.data.IsAuthorize) {
kk.map(j => { if (res.data.Product) {
if (j.name === i) { let aa = [];
dd.push(j); let gg = [];
} res.data.Product.map(i => {
}); if (i.status == 1) {
gg.push(i.name);
}
aa.push(i.name);
}); });
let Arr = Array.from(new Set(dd)); if (aa.length > 0) {
let arr = formateArrDataA(Arr, 'productName'); let dd = [];
let a = Object.keys(arr); aa.map(i => {
a.map(i => { kk.map(j => {
let list = []; if (j.name === i) {
arr[i].map(j => { dd.push(j);
list.push(j.name); }
});
}); });
arr[i] = list; let Arr = Array.from(new Set(dd));
}); let arr = formateArrDataA(Arr, 'productName');
setProduct(arr); let a = Object.keys(arr);
setKeepValue(arr); a.map(i => {
let list = [];
arr[i].map(j => {
list.push(j.name);
});
arr[i] = list;
});
setProduct(arr);
setKeepValue(arr);
}
let newArr = Array.from(new Set(aa));
console.log(newArr);
setKeepStatus(gg);
setKeepProduct(newArr);
setKeepCode(newArr);
setValue(newArr);
} }
let newArr = Array.from(new Set(aa)); setKeepDb(res.data);
console.log(newArr); setIsAuthorize(res.data.IsAuthorize);
setKeepProduct(newArr); if (res.data.IsAuthorize) {
setKeepCode(newArr); setMsg('');
setValue(newArr);
}
setKeepDb(res.data);
setIsAuthorize(res.data.IsAuthorize);
if (res.data.IsAuthorize) {
setMsg('');
// if (res.data.IsAppend) {
// setMsg('当前环境需要追加产品');
// setAppend('');
// } else {
// setMsg('');
// setAppend('没有追加的产品');
// }
} else {
// if (res.data.IsAppend) {
// setbeforeColor('green');
// setResult('检测到License,当前环境需要追加产品');
// setMsg('检测到License,当前环境需要追加产品');
// setAppend('');
// setAppendVisible(true);
// } else {
// setAppend('没有追加的产品');
if (res.data.Project && res.data.Project[0]) {
setbeforeColor('red');
setResult('检测到License已被使用');
setMsg('检测到License已被使用');
} else { } else {
setbeforeColor('red'); if (
setResult('未检测到License'); res.data.Project &&
setMsg('未检测到License'); res.data.Project[0] &&
res.data.Project[res.data.Project.length - 1] == '已使用'
) {
setbeforeColor('red');
setResult('检测到License已被使用');
setMsg('检测到License已被使用');
} else {
setbeforeColor('red');
setResult('未检测到License');
setMsg('未检测到License');
}
} }
// } } else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
} }
} else { });
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
}); });
}; };
...@@ -390,47 +411,18 @@ const DatabaseInitialization = props => { ...@@ -390,47 +411,18 @@ const DatabaseInitialization = props => {
GetDbProduct({ ...obj }).then(res => { GetDbProduct({ ...obj }).then(res => {
setCardLoading(false); setCardLoading(false);
if (res.code === 0) { if (res.code === 0) {
if (res.data.Product) {
let aa = [];
res.data.Product.map(i => {
aa.push(i.name);
});
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;
});
setProduct(arr);
setKeepValue(arr);
}
let newArr = Array.from(new Set(aa));
console.log(newArr);
setKeepProduct(newArr);
setKeepCode(newArr);
setValue(newArr);
}
if (res.data.IsAuthorize) { if (res.data.IsAuthorize) {
if (kk) { if (kk) {
findCheck(res.data.IsAppend); findCheck1(res.data.IsAppend);
} else { } else {
onCheckLaster(res.data.IsAppend); onCheckLaster(res.data.IsAppend);
} }
} else { } else {
if (res.data.Project && res.data.Project[0]) { if (
res.data.Project &&
res.data.Project[0] &&
res.data.Project[res.data.Project.length - 1] == '已使用'
) {
setbeforeColor('red'); setbeforeColor('red');
setResult('检测到License已被使用'); setResult('检测到License已被使用');
setMsg('检测到License已被使用'); setMsg('检测到License已被使用');
...@@ -440,6 +432,20 @@ const DatabaseInitialization = props => { ...@@ -440,6 +432,20 @@ const DatabaseInitialization = props => {
setMsg('未检测到License'); setMsg('未检测到License');
} }
} }
if (res.data.Project && res.data.Project.length > 0) {
setKeepHistroy(res.data.Project);
setkeepNumber(res.data.Project[res.data.Project.length - 1].license);
setkeepMsg(res.data.Project[res.data.Project.length - 1].projectName);
setkeepNa(res.data.Project[res.data.Project.length - 1].applicantName);
setkeepCo(res.data.Project[res.data.Project.length - 1].jobNumber);
} else {
// setKeepProductData('');
setKeepHistroy([]);
setkeepNumber('');
setkeepMsg('');
setkeepNa('');
setkeepCo('');
}
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
...@@ -452,7 +458,6 @@ const DatabaseInitialization = props => { ...@@ -452,7 +458,6 @@ const DatabaseInitialization = props => {
const GetDbChange = e => { const GetDbChange = e => {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
console.log(2222);
GetDbProduct({ ...obj }).then(res => { GetDbProduct({ ...obj }).then(res => {
setCardLoading(false); setCardLoading(false);
if (res.code === 0) { if (res.code === 0) {
...@@ -464,7 +469,11 @@ const DatabaseInitialization = props => { ...@@ -464,7 +469,11 @@ const DatabaseInitialization = props => {
onCheckLaster(res.data.IsAppend); onCheckLaster(res.data.IsAppend);
} }
} else { } else {
if (res.data.Project && res.data.Project[0]) { if (
res.data.Project &&
res.data.Project[0] &&
res.data.Project[res.data.Project.length - 1] == '已使用'
) {
setbeforeColor('red'); setbeforeColor('red');
setResult('检测到License已被使用'); setResult('检测到License已被使用');
setMsg('检测到License已被使用'); setMsg('检测到License已被使用');
...@@ -475,11 +484,14 @@ const DatabaseInitialization = props => { ...@@ -475,11 +484,14 @@ const DatabaseInitialization = props => {
} }
} }
if (res.data.Project && res.data.Project.length > 0) { if (res.data.Project && res.data.Project.length > 0) {
setkeepNumber(res.data.Project[0].license); setKeepHistroy(res.data.Project);
setkeepMsg(res.data.Project[0].projectName); setkeepNumber(res.data.Project[res.data.Project.length - 1].license);
setkeepNa(res.data.Project[0].applicantName); setkeepMsg(res.data.Project[res.data.Project.length - 1].projectName);
setkeepCo(res.data.Project[0].jobNumber); setkeepNa(res.data.Project[res.data.Project.length - 1].applicantName);
setkeepCo(res.data.Project[res.data.Project.length - 1].jobNumber);
} else { } else {
// setKeepProductData('');
setKeepHistroy([]);
setkeepNumber(''); setkeepNumber('');
setkeepMsg(''); setkeepMsg('');
setkeepNa(''); setkeepNa('');
...@@ -487,7 +499,11 @@ const DatabaseInitialization = props => { ...@@ -487,7 +499,11 @@ const DatabaseInitialization = props => {
} }
if (res.data.Product) { if (res.data.Product) {
let aa = []; let aa = [];
let gg = [];
res.data.Product.map(i => { res.data.Product.map(i => {
if (i.status == 1) {
gg.push(i.name);
}
aa.push(i.name); aa.push(i.name);
}); });
if (aa.length > 0) { if (aa.length > 0) {
...@@ -517,15 +533,16 @@ const DatabaseInitialization = props => { ...@@ -517,15 +533,16 @@ const DatabaseInitialization = props => {
// 当前数据库已存在和上一个已存在数据库值重新赋值 // 当前数据库已存在和上一个已存在数据库值重新赋值
if (newArr.length > 0) { if (newArr.length > 0) {
setKeepProduct(newArr); setKeepProduct(newArr);
setKeepStatus(gg);
setKeepCode(newArr); setKeepCode(newArr);
setValue(newArr); setValue(newArr);
} else { } else {
setKeepProduct([]); setKeepProduct([]);
setKeepStatus([]);
setKeepCode([]); setKeepCode([]);
setValue([]); setValue([]);
} }
if (res.data.Product.length == 0) { if (res.data.Product.length == 0) {
console.log(1212);
setKeepValue([]); setKeepValue([]);
} }
} }
...@@ -543,13 +560,16 @@ const DatabaseInitialization = props => { ...@@ -543,13 +560,16 @@ const DatabaseInitialization = props => {
const GetDbChangeAppend = () => { const GetDbChangeAppend = () => {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
console.log(5555);
GetDbProduct({ ...obj }).then(res => { GetDbProduct({ ...obj }).then(res => {
setCardLoading(false); setCardLoading(false);
if (res.code === 0) { if (res.code === 0) {
if (res.data.Product) { if (res.data.Product) {
let aa = []; let aa = [];
let gg = [];
res.data.Product.map(i => { res.data.Product.map(i => {
if (i.status == 1) {
gg.push(i.name);
}
aa.push(i.name); aa.push(i.name);
}); });
if (aa.length > 0) { if (aa.length > 0) {
...@@ -578,10 +598,12 @@ const DatabaseInitialization = props => { ...@@ -578,10 +598,12 @@ const DatabaseInitialization = props => {
// 当前数据库已存在和上一个已存在数据库值重新赋值 // 当前数据库已存在和上一个已存在数据库值重新赋值
if (newArr.length > 0) { if (newArr.length > 0) {
setKeepProduct(newArr); setKeepProduct(newArr);
setKeepStatus(gg);
setKeepCode(newArr); setKeepCode(newArr);
setValue(newArr); setValue(newArr);
} else { } else {
setKeepProduct([]); setKeepProduct([]);
setKeepStatus([]);
setKeepCode([]); setKeepCode([]);
setValue([]); setValue([]);
} }
...@@ -589,6 +611,11 @@ const DatabaseInitialization = props => { ...@@ -589,6 +611,11 @@ const DatabaseInitialization = props => {
setKeepValue([]); setKeepValue([]);
} }
} }
if (res.data.Project && res.data.Project.length > 0) {
setKeepHistroy(res.data.Project);
} else {
setKeepHistroy([]);
}
setKeepDb(res.data); setKeepDb(res.data);
setIsAuthorize(res.data.IsAuthorize); setIsAuthorize(res.data.IsAuthorize);
} else { } else {
...@@ -615,9 +642,10 @@ const DatabaseInitialization = props => { ...@@ -615,9 +642,10 @@ const DatabaseInitialization = props => {
doInitLog(); doInitLog();
NewInitAddDataBase({ ...obj, productSetting }).then(res => { NewInitAddDataBase({ ...obj, productSetting }).then(res => {
if (res.code === 0) { if (res.code === 0) {
if (value.length > 0) { // if (value.length > 0) {
setKeepProduct(value); // setKeepProduct(value);
} // }
GetDbChangeAppend();
setMsg('检测到License已被使用'); setMsg('检测到License已被使用');
setfirstColor('green'); setfirstColor('green');
...@@ -674,6 +702,7 @@ const DatabaseInitialization = props => { ...@@ -674,6 +702,7 @@ const DatabaseInitialization = props => {
// if (value.length > 0) { // if (value.length > 0) {
// setKeepProduct(value); // setKeepProduct(value);
// } // }
GetDbChangeAppend();
setMsg('检测到License已被使用'); setMsg('检测到License已被使用');
setfirstColor('green'); setfirstColor('green');
setDataResult('成功'); setDataResult('成功');
...@@ -806,7 +835,7 @@ const DatabaseInitialization = props => { ...@@ -806,7 +835,7 @@ const DatabaseInitialization = props => {
} }
}); });
deleteInitDBLogNew(); // deleteInitDBLogNew();
} else { } else {
setbeforeColor('red'); setbeforeColor('red');
setResult('请输入完整数据库信息'); setResult('请输入完整数据库信息');
...@@ -904,7 +933,7 @@ const DatabaseInitialization = props => { ...@@ -904,7 +933,7 @@ const DatabaseInitialization = props => {
setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! '); setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! ');
setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!'); setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
setAppend('无需追加'); setAppend('无需追加');
deleteInitDBLogNew(); // deleteInitDBLogNew();
} }
} else { } else {
setPassword(true); setPassword(true);
...@@ -931,12 +960,57 @@ const DatabaseInitialization = props => { ...@@ -931,12 +960,57 @@ const DatabaseInitialization = props => {
}); });
}; };
const findCheck1 = aa => {
let obj = form.getFieldsValue();
CheckDatabaseIsExist({ ...obj }).then(res => {
setCardLoading(false);
if (res.code === 0) {
setDataValue(form.getFieldsValue());
if (res.data === true) {
if (aa) {
setbeforeColor('green');
setResult('检测到License,当前环境需要追加产品');
setMsg('检测到License,当前环境需要追加产品');
setAppend('');
setAppendVisible(true);
setDataValue(form.getFieldsValue());
} else {
setbeforeColor('red');
setPassword(false);
setResult('无法追加,该数据库为非授权初始化数据库,请直接升级数据库! ');
setMsg('无法追加,该数据库为非授权初始化数据库,请直接升级数据库!');
setAppend('无需追加');
// deleteInitDBLogNew();
}
} else {
setPassword(true);
setbeforeColor('green');
setResult('通过');
setMsg('');
setAppend('无需追加');
let arr = [];
keepData.map(i => {
if (keepCode.indexOf(i.name) != -1) {
arr.push(i);
}
});
}
} else {
setbeforeColor('red');
setResult(`${res.msg}`);
setMsg(res.msg);
}
});
};
const save = () => { const save = () => {
flagChange(); flagChange();
}; };
useEffect(() => { useEffect(() => {
if (!initVisible) { if (!initVisible && !initVisibledetail) {
setShow('hidden'); setShow('hidden');
} }
}, [initVisible]); }, [initVisible]);
...@@ -971,8 +1045,66 @@ const DatabaseInitialization = props => { ...@@ -971,8 +1045,66 @@ const DatabaseInitialization = props => {
const onOk = () => { const onOk = () => {
setAppendVisible(false); setAppendVisible(false);
initDatabaseProAppend(); initDatabaseProAppend();
GetDbChangeAppend(); // GetDbChangeAppend();
};
const onHistory = () => {
setHistoryVisible(true);
}; };
const columns = [
{
title: '授权码',
dataIndex: 'license',
key: 'license',
// width: 100,
// fixed: 'left',
},
{
title: '项目名',
dataIndex: 'projectName',
key: 'projectName',
// width: 100,
},
{
title: '授权人',
dataIndex: 'applicantName',
key: 'applicantName',
// width: 150,
},
{
title: '使用时间',
dataIndex: 'createTime',
key: 'createTime',
// width: 150,
},
{
title: '部署产品',
dataIndex: 'productSolutions',
key: 'productSolutions',
render: text => {
console.log(text);
let aa = [];
if (text) {
text.map(i => {
aa.push(i.productName);
});
return (
<Tooltip title={aa.toString()} arrowPointAtCenter placement="rightTop">
<span>{text.length}</span>
</Tooltip>
);
}
},
},
];
useEffect(() => {
if (!initVisibledetail && !initVisible) {
deleteInitDBLogNew();
}
}, [initVisibledetail, initVisible]);
return ( return (
<> <>
<PageContainer className={styles.InitDataBaseContainer}> <PageContainer className={styles.InitDataBaseContainer}>
...@@ -1292,6 +1424,16 @@ const DatabaseInitialization = props => { ...@@ -1292,6 +1424,16 @@ const DatabaseInitialization = props => {
}} }}
> >
<div style={{ display: 'inline-block', backgroundColor: 'aliceblue' }}> <div style={{ display: 'inline-block', backgroundColor: 'aliceblue' }}>
{keepHistroy.length > 0 ? (
<Tooltip title="查看数据库授权记录">
<EyeOutlined
style={{ color: 'rgb(24 144 255)', marginRight: '5px' }}
onClick={onHistory}
/>
</Tooltip>
) : (
<></>
)}
<BarcodeOutlined style={{ color: 'rgb(227 168 96)', marginRight: '5px' }} /> <BarcodeOutlined style={{ color: 'rgb(227 168 96)', marginRight: '5px' }} />
授权码: 授权码:
{keepNumber ? ( {keepNumber ? (
...@@ -1341,12 +1483,53 @@ const DatabaseInitialization = props => { ...@@ -1341,12 +1483,53 @@ const DatabaseInitialization = props => {
{data[item] && {data[item] &&
data[item].map((i, j) => { data[item].map((i, j) => {
if (keepProduct.indexOf(i) != -1) { if (keepProduct.indexOf(i) != -1) {
return <Checkbox checked>{i}</Checkbox>; if (keepStatus.indexOf(i) != -1) {
return (
<span
style={{
width: '250px',
marginLeft: '24px',
display: 'inline-block',
marginBottom: '20px',
}}
>
<CheckOutlined style={{ color: 'green', marginRight: '5px' }} />
{i}
</span>
);
} else {
return (
<span
style={{
width: '250px',
marginLeft: '24px',
display: 'inline-block',
marginBottom: '20px',
}}
>
<PlusOutlined
style={{ color: '#96cdf9', marginRight: '5px' }}
/>
{i}
</span>
);
}
} else { } else {
return ( return (
<Checkbox checked={false} disabled> <span
style={{
width: '250px',
marginLeft: '24px',
display: 'inline-block',
marginBottom: '20px',
color: '#c3c3c3',
}}
>
{/* <MinusSquareOutlined
style={{ color: 'gray', marginTop: '-6px', marginRight: '5px' }}
/> */}
{i} {i}
</Checkbox> </span>
); );
} }
})} })}
...@@ -1369,7 +1552,7 @@ const DatabaseInitialization = props => { ...@@ -1369,7 +1552,7 @@ const DatabaseInitialization = props => {
cancelText="取消" cancelText="取消"
onConfirm={() => { onConfirm={() => {
Submit(); Submit();
deleteInitDBLogNew(); // deleteInitDBLogNew();
}} }}
> >
<Button type="primary" disabled={msg != ''}> <Button type="primary" disabled={msg != ''}>
...@@ -1391,7 +1574,7 @@ const DatabaseInitialization = props => { ...@@ -1391,7 +1574,7 @@ const DatabaseInitialization = props => {
setInitVisible(false); setInitVisible(false);
setInitContent(''); setInitContent('');
setInitContentdetail(''); setInitContentdetail('');
deleteInitDBLogNew(); // deleteInitDBLogNew();
}} }}
width={800} width={800}
maskClosable={false} maskClosable={false}
...@@ -1428,18 +1611,25 @@ const DatabaseInitialization = props => { ...@@ -1428,18 +1611,25 @@ const DatabaseInitialization = props => {
marginRight: ' -24px', marginRight: ' -24px',
}} }}
> >
<span>{initContent}</span> <Spin
<div style={{ height: '40px' }}> spinning={initLoading}
<div style={{ position: 'relative' }}> tip="loading..."
<Spin style={{ width: '100%', marginTop: '40px' }}
>
<span>{initContent}</span>
<div style={{ height: '40px' }}>
<div style={{ position: 'relative' }}>
{/* {initLoading ? <span>加载中...</span> : <></>} */}
{/* <Spin
spinning={initLoading} spinning={initLoading}
tip="loading..." tip="loading..."
style={{ width: '100%', marginTop: '40px' }} style={{ width: '100%', marginTop: '40px' }}
/> /> */}
</div>
</div> </div>
</div> {/* <br />
{/* <br />
{showDetali ? <span>{initContentdetail}</span> : <></>} */} {showDetali ? <span>{initContentdetail}</span> : <></>} */}
</Spin>
</div> </div>
</Modal> </Modal>
<Modal <Modal
...@@ -1455,6 +1645,14 @@ const DatabaseInitialization = props => { ...@@ -1455,6 +1645,14 @@ const DatabaseInitialization = props => {
height: '500px', height: '500px',
}} }}
footer={[ footer={[
<Button
onClick={() => {
setKeepInitDetailVisible(true);
setKeepInitVisible(false);
}}
>
查看详细日志
</Button>,
<Button <Button
onClick={() => { onClick={() => {
setKeepInitVisible(false); setKeepInitVisible(false);
...@@ -1477,6 +1675,49 @@ const DatabaseInitialization = props => { ...@@ -1477,6 +1675,49 @@ const DatabaseInitialization = props => {
{keepInitContent} {keepInitContent}
</div> </div>
</Modal> </Modal>
<Modal
title="详细日志信息"
visible={keepInitDetailVisible}
onCancel={() => {
setKeepInitDetailVisible(false);
}}
width={800}
maskClosable={false}
bodyStyle={{
height: '500px',
}}
footer={[
<Button
onClick={() => {
setKeepInitDetailVisible(false);
setKeepInitVisible(true);
}}
>
查看日志
</Button>,
<Button
onClick={() => {
setKeepInitDetailVisible(false);
}}
key="back"
type="primary"
>
关闭窗口
</Button>,
]}
>
<div
ref={scroll}
style={{
maxHeight: '470px',
overflowY: 'auto',
marginRight: ' -24px',
}}
>
{keepInitContentDetail}
</div>
</Modal>
<AppendModal <AppendModal
visible={appendVisible} visible={appendVisible}
onCancel={() => { onCancel={() => {
...@@ -1484,7 +1725,40 @@ const DatabaseInitialization = props => { ...@@ -1484,7 +1725,40 @@ const DatabaseInitialization = props => {
}} }}
value={dataValue} value={dataValue}
callBackSubmit={onOk} callBackSubmit={onOk}
keepHistroy={keepHistroy}
/> />
<Modal
title="数据库授权记录"
visible={historyVisible}
onCancel={() => {
setHistoryVisible(false);
}}
width={1000}
bodyStyle={{
height: '500px',
overflowY: 'scroll',
}}
footer={[
<Button
onClick={() => {
setHistoryVisible(false);
}}
key="back"
>
关闭
</Button>,
]}
>
<Table
size="small"
rowKey={record => record.userID}
bordered
columns={columns}
dataSource={keepHistroy}
pagination={false}
scroll={{ x: 'max-content' }}
/>
</Modal>
<Modal <Modal
title="初始化数据库详细日志" title="初始化数据库详细日志"
visible={initVisibledetail} visible={initVisibledetail}
...@@ -1499,6 +1773,14 @@ const DatabaseInitialization = props => { ...@@ -1499,6 +1773,14 @@ const DatabaseInitialization = props => {
// overflowY: 'auto', // overflowY: 'auto',
}} }}
footer={[ footer={[
<Button
onClick={() => {
setInitVisible(true);
setinitVisibledetail(false);
}}
>
查看初始化日志
</Button>,
<Button <Button
onClick={() => { onClick={() => {
handleClickdetail(); handleClickdetail();
......
...@@ -28,9 +28,9 @@ import { ...@@ -28,9 +28,9 @@ import {
import { EnvironmentOutlined } from '@ant-design/icons'; import { EnvironmentOutlined } from '@ant-design/icons';
import classnames from 'classnames'; import classnames from 'classnames';
import { GetWebSiteConfig } from '@/services/gis/gis'; import { GetWebSiteConfig } from '@/services/gis/gis';
import { SetServiceConfig } from '@/services/webConfig/api'; import { SetServiceConfig, GetSpriteSheet } from '@/services/webConfig/api';
import styles from './index.less';
import { ContinuousLegend } from '@antv/g2/lib/dependents'; import { ContinuousLegend } from '@antv/g2/lib/dependents';
import styles from './index.less';
const { Option } = Select; const { Option } = Select;
const defaultMap = { const defaultMap = {
basemaps: [ basemaps: [
...@@ -153,6 +153,9 @@ const Map = props => { ...@@ -153,6 +153,9 @@ const Map = props => {
const [color, setColor] = useState(''); const [color, setColor] = useState('');
useEffect(() => { useEffect(() => {
// GetSpriteSheet().then(res => {
// console.log(123);
// });
GetWebSiteConfig({ client: 'sandbox' }).then(res => { GetWebSiteConfig({ client: 'sandbox' }).then(res => {
let setttings = {}; let setttings = {};
if (res.data.length === 0) { if (res.data.length === 0) {
......
...@@ -308,3 +308,5 @@ export const DragSingleWebsite = param => ...@@ -308,3 +308,5 @@ export const DragSingleWebsite = param =>
export const UpdateSchemPipeNetwork = param => export const UpdateSchemPipeNetwork = param =>
get(`${PANDA_GIS}/MapLayer/UpdateSchemPipeNetwork`, param); get(`${PANDA_GIS}/MapLayer/UpdateSchemPipeNetwork`, param);
export const GetSpriteSheet = param => get(`${PANDA_GIS}/MultiMedia/GetSpriteSheet`, param);
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