Commit fd923672 authored by 邓超's avatar 邓超

feat: 修改数据库初始化界面,替换web页面配置跟app配置接口,修复遇到的问题

parent c4788d3e
Pipeline #33626 passed with stages
in 33 minutes 13 seconds
import React, { useState, useEffect } from 'react';
import { Radio } from 'antd';
import styles from './index.less';
const RadioBox = props => {
const {
radioTitle,
radioOptions,
currentVal,
currentIndex,
callBack,
} = props;
useEffect(() => {}, []);
// 选择时通过回调函数传回要改变数据的索引跟选中的值
const onChange = e => {
callBack(currentIndex, e.target.value);
};
return (
<div className={styles.radioBox}>
<div className={styles.radioTitle}>{radioTitle}:</div>
<div className={styles.radioContent}>
<Radio.Group onChange={onChange} value={currentVal}>
{radioOptions.map((item, num) => (
<Radio value={item.version} key={num} className={styles.radio}>
{item.functionName + item.version}
</Radio>
))}
</Radio.Group>
</div>
</div>
);
};
export default RadioBox;
.radioBox {
display: flex;
justify-content: flex-start;
margin-bottom: 20px;
.radioTitle {
width: 100px;
}
.radioContent {
width: 760px;
.radio {
margin-bottom: 10px;
}
}
}
...@@ -13,8 +13,11 @@ import { ...@@ -13,8 +13,11 @@ import {
Col, Col,
Popconfirm, Popconfirm,
Spin, Spin,
Tabs,
Radio,
} from 'antd'; } from 'antd';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import RadioBox from '@/components/RadioGroup';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { import {
setTableSQLDirName, setTableSQLDirName,
...@@ -28,9 +31,13 @@ import { ...@@ -28,9 +31,13 @@ import {
updateConnDescNew, updateConnDescNew,
deleteInitDBLogNew, deleteInitDBLogNew,
connectionTest, connectionTest,
GetProductList, // 获取产品列表
GetDbProduct, // 获取产品方案配置
InitAddDataBase, // 数据库初始化
} from '@/services/database/api'; } from '@/services/database/api';
import styles from './InitDataBase.less'; import styles from './InitDataBase.less';
const { TabPane } = Tabs;
const { Option } = Select; const { Option } = Select;
const formLables = { const formLables = {
ip: '服务器名或IP地址', ip: '服务器名或IP地址',
...@@ -55,12 +62,18 @@ const InitDataBase = props => { ...@@ -55,12 +62,18 @@ const InitDataBase = props => {
const [desc, setDesc] = useState(''); // 修改描述 const [desc, setDesc] = useState(''); // 修改描述
const [allSqlDir, setAllSqulDir] = useState([]); // 修改产品方案 const [allSqlDir, setAllSqulDir] = useState([]); // 修改产品方案
const [defaultSqlDir, setDefaultSqlDir] = useState(''); // 修改产品方案默认值 const [defaultSqlDir, setDefaultSqlDir] = useState(''); // 修改产品方案默认值
const [modalVisible, setModalVisible] = useState(false); // 修改秒速弹窗 const [modalVisible, setModalVisible] = useState({
describeVisible: false, // 描述弹窗
versionVisible: false, // 检查版本弹窗
initVisible: false, // 初始化选择产品弹窗
}); // 修改弹窗
const [initVisible, setInitVisible] = useState(false); // 数据库初始化弹窗 const [initVisible, setInitVisible] = useState(false); // 数据库初始化弹窗
const [initContent, setInitContent] = useState(''); // 数据库初始化内容 const [initContent, setInitContent] = useState(''); // 数据库初始化内容
const [cardLoading, setCardLoading] = useState(false); // 初始化card Loading const [cardLoading, setCardLoading] = useState(false); // 初始化card Loading
const [finish, setFinish] = useState(false); const [finish, setFinish] = useState(false);
const [initLoading, setInitLoading] = useState(false); const [initLoading, setInitLoading] = useState(false);
const [initList, setInitList] = useState([]); // 数据库初始化产品数据
const [dbExists, setDbExists] = useState(false); // 数据库是否存在
const scroll = useRef(null); const scroll = useRef(null);
// 获取数据库配置信息 // 获取数据库配置信息
...@@ -71,7 +84,7 @@ const InitDataBase = props => { ...@@ -71,7 +84,7 @@ const InitDataBase = props => {
getDataBaseConfigNew().then(resnew => { getDataBaseConfigNew().then(resnew => {
setCardLoading(false); setCardLoading(false);
let res = resnew.data; let res = resnew.data;
if (resnew.code == 0) { if (resnew.code === 0) {
const { inUse } = res; const { inUse } = res;
let obj = {}; let obj = {};
...@@ -97,13 +110,17 @@ const InitDataBase = props => { ...@@ -97,13 +110,17 @@ const InitDataBase = props => {
} }
}; };
}, []); }, []);
// 弹出模态框
const handleShowModal = (key, value) => {
setModalVisible({ ...modalVisible, [key]: value });
};
// 获取数据库连接记录 // 获取数据库连接记录
const getConnRecordData = () => { const getConnRecordData = () => {
setTableLoading(true); setTableLoading(true);
getConnRecordNew() getConnRecordNew()
.then(resnew => { .then(resnew => {
setTableLoading(false); setTableLoading(false);
if (resnew.code == 0) { if (resnew.code === 0) {
let res = resnew.data; let res = resnew.data;
let arr = res.map((item, index) => { let arr = res.map((item, index) => {
item.key = index; item.key = index;
...@@ -122,7 +139,7 @@ const InitDataBase = props => { ...@@ -122,7 +139,7 @@ const InitDataBase = props => {
setInitLoading(true); setInitLoading(true);
getInitDBLogNew() getInitDBLogNew()
.then(res => { .then(res => {
if (res.code == 0) { if (res.code === 0) {
if (res.data.content) { if (res.data.content) {
setInitLoading(false); setInitLoading(false);
let arr = []; let arr = [];
...@@ -200,7 +217,7 @@ const InitDataBase = props => { ...@@ -200,7 +217,7 @@ const InitDataBase = props => {
}) })
.then(resnew => { .then(resnew => {
setCardLoading(false); setCardLoading(false);
if (resnew.code == 0) { if (resnew.code === 0) {
// setUpData(upData + 1); // setUpData(upData + 1);
getConnRecordData(); getConnRecordData();
notification.success({ notification.success({
...@@ -301,7 +318,7 @@ const InitDataBase = props => { ...@@ -301,7 +318,7 @@ const InitDataBase = props => {
dirName: val, dirName: val,
}) })
.then(res => { .then(res => {
if (res.code == 0) { if (res.code === 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -322,7 +339,7 @@ const InitDataBase = props => { ...@@ -322,7 +339,7 @@ const InitDataBase = props => {
// 展示修改描述 // 展示修改描述
const changeDesc = val => { const changeDesc = val => {
setDesc(val); setDesc(val);
setModalVisible(true); handleShowModal('describeVisible', true);
}; };
const descChange = e => { const descChange = e => {
const { value } = e.target; const { value } = e.target;
...@@ -343,23 +360,6 @@ const InitDataBase = props => { ...@@ -343,23 +360,6 @@ const InitDataBase = props => {
const modalOkCallback = () => { const modalOkCallback = () => {
const obj = form.getFieldsValue(); const obj = form.getFieldsValue();
// 更新描述 // 更新描述
// updateConnDesc({
// _version: 9999,
// _dc: new Date().getTime(),
// ip: obj.ip,
// dbName: obj.dbName,
// userName: obj.userName,
// password: obj.password,
// desc,
// })
// .then(res => {
// setModalVisible(false);
// setUpData(upData + 1);
// })
// .catch(err => {
// console.error(err);
// setModalVisible(false);
// });
updateConnDescNew({ updateConnDescNew({
ip: obj.ip, ip: obj.ip,
dbName: obj.dbName, dbName: obj.dbName,
...@@ -368,13 +368,13 @@ const InitDataBase = props => { ...@@ -368,13 +368,13 @@ const InitDataBase = props => {
desc, desc,
}) })
.then(res => { .then(res => {
setModalVisible(false); handleShowModal('describeVisible', false);
// setUpData(upData + 1); // setUpData(upData + 1);
getConnRecordData(); getConnRecordData();
}) })
.catch(err => { .catch(err => {
console.error(err); console.error(err);
setModalVisible(false); handleShowModal('describeVisible', false);
}); });
}; };
// 删除数据库连接记录 // 删除数据库连接记录
...@@ -407,6 +407,177 @@ const InitDataBase = props => { ...@@ -407,6 +407,177 @@ const InitDataBase = props => {
console.error(err); console.error(err);
}); });
}; };
// 获取数据库初始化回显列表
const getInitList = () => {
setInitList([]);
handleShowModal('initVisible', true);
setInitLoading(true);
let obj = form.getFieldsValue();
let req1 = GetProductList();
let req2 = GetDbProduct({ ...obj });
Promise.all([req1, req2])
.then(res => {
if (res[1].code !== 0 || res[0].code !== 0) {
setInitLoading(false);
notification.error({
message: '提示',
duration: 3,
description: '连接失败',
});
return;
}
setDbExists(res[1].DBExists);
let fileList = res[0].data ? res[0].data : [];
let dataList = res[1].data.Product ? res[1].data.Product : [];
// 没有库或者dataList为[]直接用fileList作为回显
if (!res[1].data.DBExists || dataList.length === 0) {
setInitList(fileList);
setInitLoading(false);
return;
}
let mapList = new Map();
// 通过map给数据库中中的节点中的key的值当作key,checkVersion当作value进行存储
dataList.forEach(element => {
// 存入一级目录是否有选中项的key
mapList.set(element.key, element.check);
element.modularSolutions.forEach(item => {
// 存入二级目录对应的选中的checkVersion跟check
mapList.set(item.key, {
checkVersion: item.checkVersion,
check: item.check,
});
item.functionrSolutions.forEach(val => {
// 存入三级目录对应的选中的checkVersion跟check
mapList.set(val.key, val.isCheck);
});
});
});
fileList.forEach(element => {
// 根据key来获取第一级目录tab的check
let tabKey = mapList.get(element.key);
element.check = tabKey === undefined ? null : tabKey;
element.modularSolutions.forEach(item => {
let mapCheckVersion = mapList.get(item.key);
// 根据key值去匹配对应的checkVersion
item.checkVersion =
mapCheckVersion.checkVersion === undefined
? null
: mapCheckVersion.checkVersion;
// 根据key值去匹配对应的二级目录的check
item.check =
mapCheckVersion.check === undefined
? null
: mapCheckVersion.check;
item.functionrSolutions.forEach(val => {
// 根据三级目录对应的选中key匹配isCheck
let isCheck = mapList.get(val.key);
val.isCheck = isCheck === undefined ? null : isCheck;
});
});
});
console.log(fileList);
setInitList(fileList);
setInitLoading(false);
})
.catch(() => {
notification.error({
message: '提示',
duration: 3,
description: '连接失败',
});
setInitLoading(false);
});
};
// 初始化产品列表渲染
const renderInitListItem = (tabItem, index) => (
<TabPane tab={tabItem.productName} key={index}>
<div className={styles.tabContainer}>
{tabItem.modularSolutions.map((item, num) => (
<React.Fragment key={item.key}>
{item.functionrSolutions.length > 0 ? (
<RadioBox
radioTitle={item.modularName}
radioOptions={item.functionrSolutions}
currentVal={item.checkVersion}
currentIndex={{ tabIndex: index, radioIndex: num }}
callBack={radioChange}
/>
) : null}
</React.Fragment>
))}
</div>
</TabPane>
);
// 单选选后的回调,改变数据
const radioChange = (index, value) => {
setInitList(val => {
const list = JSON.parse(JSON.stringify(val));
// 修改一级菜单的check字段
list[index.tabIndex].check = true;
// 修改二级菜单的check字段
list[index.tabIndex].modularSolutions[index.radioIndex].check = true;
// 修改选中的checkVersion值
list[index.tabIndex].modularSolutions[
index.radioIndex
].checkVersion = value;
// 修改单选isCheck字段
list[index.tabIndex].modularSolutions[
index.radioIndex
].functionrSolutions.forEach(item => {
if (item.version === value) {
item.isCheck = true;
} else {
item.isCheck = false;
}
});
return list;
});
};
const initDatabasePro = () => {
// handleShowModal('versionVisible', true);
let productSetting = initList;
let obj = form.getFieldsValue();
console.log({ ...obj, productSetting });
// 数据库存在调用编辑接口否则调用新增接口
setInitLoading(true);
if (dbExists) {
InitAddDataBase({ ...obj, productSetting }).then(res => {
setInitLoading(false);
if (res.code === 0) {
notification.success({
message: '提示',
duration: 3,
description: '操作成功',
});
handleShowModal('initVisible', false);
} else {
notification.error({
message: '提示',
duration: 15,
description: res.msg,
});
}
});
return;
}
InitAddDataBase({ ...obj, productSetting }).then(res => {
setInitLoading(false);
if (res.code === 0) {
notification.success({
message: '提示',
duration: 3,
description: '操作成功',
});
handleShowModal('initVisible', false);
} else {
notification.error({
message: '提示',
duration: 15,
description: res.msg,
});
}
});
};
const columns = [ const columns = [
{ {
title: '服务器名或IP地址', title: '服务器名或IP地址',
...@@ -547,17 +718,19 @@ const InitDataBase = props => { ...@@ -547,17 +718,19 @@ const InitDataBase = props => {
</Button> </Button>
</Space> </Space>
<Space> <Space>
<Popconfirm {/* <Popconfirm
title="是否执行数据库初始化" title="是否执行数据库初始化"
okText="确认" okText="确认"
cancelText="取消" cancelText="取消"
onConfirm={() => { onConfirm={() => {
initClick(); initClick();
}} }}
> > */}
<Button type="primary">数据库初始化</Button> <Button type="primary" onClick={() => getInitList()}>
</Popconfirm> 数据库初始化
{defaultSqlDir && ( </Button>
{/* </Popconfirm> */}
{/* {defaultSqlDir && (
<Select <Select
placeholder="请选择解决方案" placeholder="请选择解决方案"
style={{ width: '200px' }} style={{ width: '200px' }}
...@@ -578,7 +751,7 @@ const InitDataBase = props => { ...@@ -578,7 +751,7 @@ const InitDataBase = props => {
); );
})} })}
</Select> </Select>
)} )} */}
</Space> </Space>
</Space> </Space>
</div> </div>
...@@ -653,9 +826,9 @@ const InitDataBase = props => { ...@@ -653,9 +826,9 @@ const InitDataBase = props => {
<Modal <Modal
title="修改链接描述" title="修改链接描述"
visible={modalVisible} visible={modalVisible.describeVisible}
onOk={() => modalOkCallback()} onOk={() => modalOkCallback()}
onCancel={() => setModalVisible(false)} onCancel={() => handleShowModal('describeVisible', false)}
width="800px" width="800px"
bodyStyle={{ bodyStyle={{
minHeight: '100px', minHeight: '100px',
...@@ -681,6 +854,51 @@ const InitDataBase = props => { ...@@ -681,6 +854,51 @@ const InitDataBase = props => {
</Col> </Col>
</Row> </Row>
</Modal> </Modal>
{/* 检查版本弹窗 */}
<Modal
title="版本检查"
visible={modalVisible.versionVisible}
onOk={() => modalOkCallback()}
onCancel={() => handleShowModal('versionVisible', false)}
>
<p>当前版本运行正常</p>
</Modal>
{/* 初始化选择产品弹窗 */}
<Modal
title="初始化"
maskClosable={false}
visible={modalVisible.initVisible}
onCancel={() => handleShowModal('initVisible', false)}
footer={[
<Button
key="back"
onClick={() => handleShowModal('initVisible', false)}
>
取消
</Button>,
<Popconfirm
placement="topLeft"
title="是否确认初始化"
onConfirm={initDatabasePro}
okText="确认"
key="submit"
cancelText="取消"
>
<Button type="primary" loading={initLoading}>
确认
</Button>
</Popconfirm>,
]}
width={900}
>
<Spin spinning={initLoading}>
<div className={styles.cardContainer}>
<Tabs defaultActiveKey="1" type="card" tabBarGutter={-1}>
{initList.map((item, index) => renderInitListItem(item, index))}
</Tabs>
</div>
</Spin>
</Modal>
</PageContainer> </PageContainer>
</> </>
); );
......
.tableTitle{ .tableTitle {
font-size: 16px; font-size: 16px;
} }
.mgTop20{ .mgTop20 {
margin-top: 20px !important; margin-top: 20px !important;
} }
.tCenter{ .tCenter {
text-align: center; text-align: center;
} }
.decsBox{ .decsBox {
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
} }
.btnBox { .btnBox {
display: flex !important; display: flex !important;
justify-content: space-between; justify-content: space-between;
} }
\ No newline at end of file .ant-modal-header {
height: 70px;
}
.cardContainer {
margin-top: 10px;
border: 1px solid #ecf0fa;
border-top: none;
.ant-tabs-nav {
background-color: #f4f6fc;
.ant-tabs-tab {
background-color: transparent;
border: none;
border-top: 2px solid transparent;
box-sizing: content-box;
}
.ant-tabs-tab-active {
border: none;
background-color: #fff;
border-top: 2px solid #1685ff;
}
}
.tabContainer {
padding-left: 20px;
box-sizing: border-box;
}
}
...@@ -50,7 +50,7 @@ const SiteConfig = props => { ...@@ -50,7 +50,7 @@ const SiteConfig = props => {
let obj = {}; let obj = {};
let arr = Object.keys(form.getFieldsValue()); let arr = Object.keys(form.getFieldsValue());
arr.map(k => { arr.map(k => {
obj[k] = res[k]; obj[k] = res.data[k];
}); });
form.setFieldsValue(obj); form.setFieldsValue(obj);
}) })
...@@ -67,14 +67,10 @@ const SiteConfig = props => { ...@@ -67,14 +67,10 @@ const SiteConfig = props => {
setLoading(true); setLoading(true);
const obj = { ...form.getFieldsValue() }; const obj = { ...form.getFieldsValue() };
let params = { ...obj, mode: 'single', client: clientName }; let params = { ...obj, mode: 'single', client: clientName };
editWebsite(params, { editWebsite(params)
headers: {
'content-type': 'application/x-www-form-urlencggoded;charset=UTF-8',
},
})
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.success) { if (res.code === 0) {
submitCallback(obj.title); submitCallback(obj.title);
notification.success({ notification.success({
message: '提示', message: '提示',
......
...@@ -43,14 +43,10 @@ const AddConfig = props => { ...@@ -43,14 +43,10 @@ const AddConfig = props => {
setLoading(true); setLoading(true);
const obj = { ...form.getFieldsValue() }; const obj = { ...form.getFieldsValue() };
let params = { ...obj, mode: 'single' }; let params = { ...obj, mode: 'single' };
addWebsite(params, { addWebsite(params)
headers: {
'content-type': 'application/x-www-form-urlencggoded;charset=UTF-8',
},
})
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.code===0) { if (res.code === 0) {
addCallback(params.title); addCallback(params.title);
notification.success({ notification.success({
message: '提示', message: '提示',
......
...@@ -141,7 +141,7 @@ const MobileConfigPage = props => { ...@@ -141,7 +141,7 @@ const MobileConfigPage = props => {
}) })
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.success) { if (res.code === 0) {
setMiniTitle(''); setMiniTitle('');
setTimeout(() => { setTimeout(() => {
setFlag(flag + 1); setFlag(flag + 1);
......
...@@ -303,7 +303,7 @@ const MiniMenu = props => { ...@@ -303,7 +303,7 @@ const MiniMenu = props => {
}) })
.then(res => { .then(res => {
setSubmitLoading(false); setSubmitLoading(false);
if (res.success) { if (res.code === 0) {
setAddVisible(false); setAddVisible(false);
setAddTwoVisible(false); setAddTwoVisible(false);
setFlag(flag + 1); setFlag(flag + 1);
......
...@@ -476,20 +476,13 @@ const SiteManage = () => { ...@@ -476,20 +476,13 @@ const SiteManage = () => {
}; };
const handleCommit = results => { const handleCommit = results => {
setBtnLoading(true); setBtnLoading(true);
setMenuToRole( setMenuToRole({
qs.stringify({ roleID: Number(roleID),
roleID, menuIdList: String(results.flat()),
menuNameList: String(results.flat()), })
}),
{
headers: {
'content-type': 'application/x-www-form-urlencggoded;charset=UTF-8',
},
},
)
.then(res => { .then(res => {
setBtnLoading(false); setBtnLoading(false);
if (res.msg === 'Ok') { if (res.code === 0) {
setValueList([...results.flat()]); setValueList([...results.flat()]);
notification.success({ notification.success({
message: '提示', message: '提示',
......
...@@ -18,7 +18,7 @@ const EditModal = props => { ...@@ -18,7 +18,7 @@ const EditModal = props => {
editStation({ editStation({
stationName: res.stationName, stationName: res.stationName,
description: res.description, description: res.description,
stationID: stationObj, stationID: stationObj.id,
}) })
.then(res => { .then(res => {
setLoading(false); setLoading(false);
......
...@@ -70,6 +70,7 @@ const SiteManageV2 = () => { ...@@ -70,6 +70,7 @@ const SiteManageV2 = () => {
const [treeState, setTreeState] = useState(true); // 树第一次加载 const [treeState, setTreeState] = useState(true); // 树第一次加载
const [treeLoading, setTreeLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false);
const [currentStation, setCurrentStation] = useState(''); // 当前选中站点 const [currentStation, setCurrentStation] = useState(''); // 当前选中站点
const [currentStationMsg, setCurrentStationMsg] = useState({}); //当前编辑节点信息
const [currentStationOperate, setCurrentStationOperate] = useState(false) const [currentStationOperate, setCurrentStationOperate] = useState(false)
const [flag, setFlag] = useState(1);//操作标致触发界面刷新 const [flag, setFlag] = useState(1);//操作标致触发界面刷新
const [dataList, setdataList] = useState([]);//当前站点对应的分页用户列表 const [dataList, setdataList] = useState([]);//当前站点对应的分页用户列表
...@@ -131,7 +132,10 @@ const SiteManageV2 = () => { ...@@ -131,7 +132,10 @@ const SiteManageV2 = () => {
//编辑当前站点 //编辑当前站点
const editorSite = (e, recode) => { const editorSite = (e, recode) => {
e.stopPropagation(); e.stopPropagation();
setCurrentStation(recode.id); // console.log(recode);
// 保存编辑回显信息
setCurrentStationMsg(recode);
// setCurrentStation(recode.id);
handleShowModal('editVisible', true); handleShowModal('editVisible', true);
} }
// 重新渲染树 // 重新渲染树
...@@ -422,15 +426,10 @@ const SiteManageV2 = () => { ...@@ -422,15 +426,10 @@ const SiteManageV2 = () => {
description: '请至少选择选择一个用户!', description: '请至少选择选择一个用户!',
}); });
chooseUserToStation( chooseUserToStation(
qs.stringify({ {
userList: String(result.flat()), userList: String(result.flat()),
stationID: currentStation, stationID: currentStation,
}), }
{
headers: {
'content-type': 'application/x-www-form-urlencggoded;charset=UTF-8',
},
},
) )
.then(res => { .then(res => {
handleShowModal('btnLoading', false); handleShowModal('btnLoading', false);
...@@ -537,7 +536,7 @@ const SiteManageV2 = () => { ...@@ -537,7 +536,7 @@ const SiteManageV2 = () => {
/> />
<EditModal <EditModal
visible={visibleParams.editVisible} visible={visibleParams.editVisible}
stationObj={currentStation} stationObj={currentStationMsg}
onCancel={() => handleShowModal('editVisible', false)} onCancel={() => handleShowModal('editVisible', false)}
confirmModal={editModal} confirmModal={editModal}
/> />
......
...@@ -96,6 +96,7 @@ const AddForm = props => { ...@@ -96,6 +96,7 @@ const AddForm = props => {
rules={[ rules={[
{ {
required: true, required: true,
// pattern: /^[^\s]*$/,
message: '请输入功能路径', message: '请输入功能路径',
}, },
]} ]}
......
...@@ -263,10 +263,11 @@ const MiniMenu = props => { ...@@ -263,10 +263,11 @@ const MiniMenu = props => {
}; };
// 新增提交的回调 // 新增提交的回调
const submitCallback = (prop, item) => { const submitCallback = (prop, item) => {
console.log(subSystemValue, 'subSystemValue');
setSubmitLoading(true); setSubmitLoading(true);
let baseUrl = handleGeturl(prop.imageUrl); let baseUrl = handleGeturl(prop.imageUrl);
let obj = { ...prop, baseUrl }; let obj = { ...prop, baseUrl };
const parentID = item.menuID ? item.menuID : -1; const parentID = item.menuID ? Number(item.menuID) : -1;
addWebMenu({ addWebMenu({
_dc: Date.now(), _dc: Date.now(),
parentID, parentID,
...@@ -307,7 +308,7 @@ const MiniMenu = props => { ...@@ -307,7 +308,7 @@ const MiniMenu = props => {
obj.relatedRoleList = String(roleList) || ''; obj.relatedRoleList = String(roleList) || '';
editWebMenu({ editWebMenu({
_dc: Date.now(), _dc: Date.now(),
menuID, menuID: Number(menuID),
// subSystemValue, // subSystemValue,
...obj, ...obj,
}) })
...@@ -339,12 +340,12 @@ const MiniMenu = props => { ...@@ -339,12 +340,12 @@ const MiniMenu = props => {
// 新接口改为editWebMenu 原来为pEditWebMenu // 新接口改为editWebMenu 原来为pEditWebMenu
editWebMenu({ editWebMenu({
_dc: Date.now(), _dc: Date.now(),
menuID, menuID: Number(menuID),
// subSystemValue, // subSystemValue,
...obj, ...obj,
product: null, product: null,
baseUrl: null, baseUrl: null,
hideInMenu: null, hideInMenu: false,
}) })
.then(res => { .then(res => {
setLoading(false); setLoading(false);
......
...@@ -203,3 +203,13 @@ export const AddUserAuthSetting = params => ...@@ -203,3 +203,13 @@ export const AddUserAuthSetting = params =>
get(`${PUBLISH_SERVICE}/WebSite/AddUserAuthSetting`, params); get(`${PUBLISH_SERVICE}/WebSite/AddUserAuthSetting`, params);
export const GetUserAuthSet = params => export const GetUserAuthSet = params =>
get(`${PUBLISH_SERVICE}/WebSite/GetUserAuthSet`, params); get(`${PUBLISH_SERVICE}/WebSite/GetUserAuthSet`, params);
// 获取产品列表
export const GetProductList = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetProductList`, params);
// 获取产品方案配置
export const GetDbProduct = params =>
post(`${PUBLISH_SERVICE}/DBManager/GetDbProduct`, params);
// 数据库初始化
export const InitAddDataBase = params =>
post(`${PUBLISH_SERVICE}/DBManager/InitAddDataBase`, params);
...@@ -13,7 +13,7 @@ export const miniAppSiteTree = params => ...@@ -13,7 +13,7 @@ export const miniAppSiteTree = params =>
* title:'名称' * title:'名称'
*/ */
export const getWebsite = params => export const getWebsite = params =>
get(`${CITY_SERVICE}/OMS.svc/MiniApp_GetWebsite`, params); get(`${PUBLISH_SERVICE}/WebSite/MiniApp_GetWebsite`, params);
/** /**
* *
* @param {*} params * @param {*} params
...@@ -29,10 +29,10 @@ export const getWebsite = params => ...@@ -29,10 +29,10 @@ export const getWebsite = params =>
"cloudLogin":false "cloudLogin":false
*/ */
export const editWebsite = (params, options) => { export const editWebsite = (params, options) => {
let strParams = JSON.stringify(params); let strParams = params;
let qsParams = qs.stringify({ config: strParams }); let qsParams = strParams;
return post( return post(
`${CITY_SERVICE}/OMS.svc/MiniApp_EditWebsite?_version=9999`, `${PUBLISH_SERVICE}/WebSite/MiniApp_EditWebsite?_version=9999`,
qsParams, qsParams,
options, options,
); );
...@@ -65,7 +65,7 @@ export const getMiniAppModuleTree = params => ...@@ -65,7 +65,7 @@ export const getMiniAppModuleTree = params =>
} }
*/ */
export const addMenu = params => export const addMenu = params =>
get(`${CITY_SERVICE}/OMS.svc/MiniApp_AddMenu`, params); post(`${PUBLISH_SERVICE}/WebSite/MiniApp_AddMenu`, params);
// 获取菜单详情 // 获取菜单详情
/** /**
...@@ -90,14 +90,14 @@ export const getRoleListPlain = params => ...@@ -90,14 +90,14 @@ export const getRoleListPlain = params =>
// 删除小程序 // 删除小程序
export const deleteWebsite = params => export const deleteWebsite = params =>
get(`${CITY_SERVICE}/OMS.svc/MiniApp_DeleteWebsite`, params); get(`${PUBLISH_SERVICE}/WebSite/MiniApp_DeleteWebsite`, params);
// 新增小程序 // 新增小程序
export const addWebsite = (params, options) => { export const addWebsite = (params, options) => {
let strParams = JSON.stringify(params); // let strParams = JSON.stringify(params);
let qsParams = qs.stringify({ config: strParams }); // let qsParams = qs.stringify({ config: strParams });
return post( return post(
`${CITY_SERVICE}/OMS.svc/MiniApp_AddWebsite?_version=9999`, `${PUBLISH_SERVICE}/WebSite/MiniApp_AddWebsite?_version=9999`,
qsParams, params,
options, options,
); );
}; };
......
...@@ -75,12 +75,14 @@ export const addWebMenu = param => { ...@@ -75,12 +75,14 @@ export const addWebMenu = param => {
const defaultConfig = { pageUrl: '' }; const defaultConfig = { pageUrl: '' };
// eslint-disable-next-line no-return-assign // eslint-disable-next-line no-return-assign
Object.keys(param).forEach(k => (defaultConfig[k] = param[k])); Object.keys(param).forEach(k => (defaultConfig[k] = param[k]));
return get(`${PUBLISH_SERVICE}/WebSite/AddMenu?_version=9999`, defaultConfig); return post(
`${PUBLISH_SERVICE}/WebSite/AddMenu?_version=9999`,
defaultConfig,
);
}; };
export const editWebMenu = param => export const editWebMenu = param =>
// get(`${CITY_SERVICE}/OMS.svc/W4_EditMenu?_version=9999`, param); post(`${PUBLISH_SERVICE}/WebSite/EditMenu?_version=9999`, param);
get(`${PUBLISH_SERVICE}/WebSite/EditMenu?_version=9999`, param);
export const pEditWebMenu = param => export const pEditWebMenu = param =>
get(`${CITY_SERVICE}/OMS.svc/P_EditMenu?_version=9999`, param); get(`${CITY_SERVICE}/OMS.svc/P_EditMenu?_version=9999`, 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