Commit c05d100b authored by 张烨's avatar 张烨

merge: fxi conflict

parents a04ec4e0 3c0d42a8
...@@ -15,6 +15,7 @@ import { ...@@ -15,6 +15,7 @@ import {
import { PageContainer } from '@ant-design/pro-layout'; import { PageContainer } from '@ant-design/pro-layout';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { get, post } from '../../services'; import { get, post } from '../../services';
import { setTableSQLDirName, deleteConn } from '@/services/database/api'
import styles from './InitDataBase.less'; import styles from './InitDataBase.less';
const { Option } = Select; const { Option } = Select;
...@@ -38,6 +39,8 @@ const InitDataBase = props => { ...@@ -38,6 +39,8 @@ const InitDataBase = props => {
const [upData, setUpData] = useState(1); // 列表刷新标记 const [upData, setUpData] = useState(1); // 列表刷新标记
const [option, setOption] = useState([]); // 下拉列表数据 const [option, setOption] = useState([]); // 下拉列表数据
const [desc, setDesc] = useState(''); // 修改描述 const [desc, setDesc] = useState(''); // 修改描述
const [allSqlDir, setAllSqulDir] = useState([]) //修改产品方案
const [defaultSqlDir, setDefaultSqlDir] = useState('') //修改产品方案默认值
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
console.log(window.location.host); console.log(window.location.host);
// 获取数据库链接记录 // 获取数据库链接记录
...@@ -77,6 +80,8 @@ const InitDataBase = props => { ...@@ -77,6 +80,8 @@ const InitDataBase = props => {
}); });
form.setFieldsValue(obj); form.setFieldsValue(obj);
setDbForm(val => ({ ...val, ...obj })); setDbForm(val => ({ ...val, ...obj }));
setAllSqulDir(res.allSqlDir)
setDefaultSqlDir(res.tableSQLDirName)
} }
}) })
.catch(err => { .catch(err => {
...@@ -203,6 +208,30 @@ const InitDataBase = props => { ...@@ -203,6 +208,30 @@ const InitDataBase = props => {
}); });
form.setFieldsValue(obj); form.setFieldsValue(obj);
}; };
// 产品方案选择框回调
const handleSelect = (value) =>{
setTableSQLDirName({
dirName:value,
_version:9999,
_dc:new Date().getTime()
}).then(res =>{
if(res.success){
notification.success({
message: '提示',
duration: 3,
description: `已切换初始化脚本为:${value}`,
});
}else{
notification.error({
message: '提示',
duration: 3,
description: res.message,
});
}
}).catch(err =>{
console.error(err)
})
}
// 展示修改描述 // 展示修改描述
const changeDesc = () => { const changeDesc = () => {
setModalVisible(true); setModalVisible(true);
...@@ -236,6 +265,34 @@ const InitDataBase = props => { ...@@ -236,6 +265,34 @@ const InitDataBase = props => {
setModalVisible(false); setModalVisible(false);
}); });
}; };
//删除数据库连接记录
const delConn = (value)=>{
setTableLoading(true)
const { key='' } =value
deleteConn({
rowIndex:key,
_version:9999,
_dc:new Date().getTime()
}).then(res =>{
setTableLoading(false)
if(res.success){
setUpData(upData + 1);
notification.success({
message:'提示',
duration:3,
description:'操作成功'
})
}else{
notification.error({
message:'提示',
duration:3,
description:res.message
})
}
}).catch(err => {
setTableLoading(false)
console.error(err)})
}
const columns = [ const columns = [
{ {
title: '服务器名或IP地址', title: '服务器名或IP地址',
...@@ -280,11 +337,12 @@ const InitDataBase = props => { ...@@ -280,11 +337,12 @@ const InitDataBase = props => {
}, },
{ {
title: '删除', title: '删除',
dataIndex: 'name', dataIndex: 'del',
key: 'name', key: 'del',
render: (text,record) => (
render: () => ( <Button size="small" danger
<Button size="small" danger> onClick={() => delConn(record)}
>
删除 删除
</Button> </Button>
), ),
...@@ -360,7 +418,20 @@ const InitDataBase = props => { ...@@ -360,7 +418,20 @@ const InitDataBase = props => {
> >
数据库初始化 数据库初始化
</Button> </Button>
<span>{dbForm.inUse}</span> {defaultSqlDir && <Select
placeholder='请选择解决方案'
style={
{width:'200px'}
}
defaultValue={defaultSqlDir}
onChange = { (e)=>{ handleSelect(e)}}
>
{allSqlDir && allSqlDir.map( (item, index) => {
console.log(defaultSqlDir)
return <Option value={item} key={index}> {item} </Option>
}) }
</Select>}
{/* <span>{dbForm.inUse}</span> */}
</Space> </Space>
</div> </div>
</Form.Item> </Form.Item>
...@@ -389,19 +460,20 @@ const InitDataBase = props => { ...@@ -389,19 +460,20 @@ const InitDataBase = props => {
maskClosable maskClosable
onOk={() => modalOkCallback()} onOk={() => modalOkCallback()}
onCancel={() => setModalVisible(false)} onCancel={() => setModalVisible(false)}
width="1000px" width="800px"
bodyStyle={{ bodyStyle={{
minHeight: '100px', minHeight: '100px',
}} }}
cancelText="取消" cancelText="取消"
okText="确认修改" okText="确认修改"
destroyOnClose destroyOnClose={true}
> >
<Row> <Row>
<Col span={1} className={styles.decsBox}> <Col span={2} className={styles.decsBox}>
描述: 描述:
</Col> </Col>
<Col span={11}> <Col span={22}>
<Input <Input
placeholder="请输入描述" placeholder="请输入描述"
onChange={value => { onChange={value => {
......
This diff is collapsed.
...@@ -41,7 +41,7 @@ const DelModal = (props) =>{ ...@@ -41,7 +41,7 @@ const DelModal = (props) =>{
return( return(
<SiteModal {...props} title='删除站点' <SiteModal {...props} title='删除站点'
bodyStyle ={{width:"100%",minHeight:"50px",}} bodyStyle ={{width:"100%",minHeight:"50px",}}
style= {{top:'500px'}} style= {{top:200}}
width="400px" width="400px"
destroyOnClose={true} destroyOnClose={true}
cancelText='取消' cancelText='取消'
......
import { get, post } from '@/services/index';
// 修改产品解决方案
export const setTableSQLDirName = params =>
get('/Cityinterface/rest/services/OMS.svc/S_SetTableSQLDirName', params);
// 删除数据库连接记录
export const deleteConn = params =>
get('/Cityinterface/rest/services/OMS.svc/S_DeleteConn', params);
This diff is collapsed.
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