Commit 5de6c68c authored by 张烨's avatar 张烨
parents 7c3020e3 edd75859
......@@ -82,6 +82,7 @@
"babel-core": "7.0.0-bridge.0"
},
"dependencies": {
"@ant-design/pro-card": "^1.4.6",
"@babel/plugin-proposal-optional-chaining": "^7.12.1",
"@babel/polyfill": "7.4.3",
"@babel/preset-typescript": "^7.12.1",
......
This diff was suppressed by a .gitattributes entry.
import React, { useState, useEffect } from 'react';
import { Checkbox } from 'antd';
import styles from './itemCard.less';
const CheckGroup = Checkbox.Group;
const ListCardItem = props => {
const { getValueCallback, itemid, userList, OUName, searchWord } = props;
const [indeterminate, setIndeterminate] = useState(false);
const [allChecked, setAllChecked] = useState(false); // 全选状态
const [checkList, setCheckList] = useState([]); // 复选框列表选中的值
const [defaultList, setDefaultList] = useState([]); // 默认的选项
const [submitArr, setSubmitArr] = useState([]); // 提交的数组
// const submitArr = [];
useEffect(() => {
let arr = [];
userList.map((item, index) => {
let obj = { ...item };
obj.label = (
<span
className={
searchWord && obj.userName.includes(searchWord)
? styles.isSearch
: ''
}
>
{obj.userName || obj.roleName || obj.stationName}
</span>
);
obj.value = obj.userID || obj.roleID || obj.stationID;
arr.push(obj);
});
setDefaultList(arr);
}, [searchWord]);
useEffect(() => {
let arr2 = [];
userList.map((item, index) => {
if (item.isChecked) {
arr2.push(item.userID || item.roleID || item.stationID);
}
});
// eslint-disable-next-line no-unused-expressions
getValueCallback && getValueCallback(arr2, itemid);
const all = userList.every(u => u.isChecked);
setIndeterminate(!all && userList.some(u => u.isChecked));
setAllChecked(all);
setCheckList(arr2);
}, [userList]);
const handleAllChecked = e => {
const { checked } = e.target;
setAllChecked(checked);
let arr = [];
if (checked) {
arr = defaultList.map(item => item.value);
}
setIndeterminate(false);
setCheckList(arr);
// eslint-disable-next-line no-unused-expressions
getValueCallback && getValueCallback(arr, itemid);
};
const handleChecked = e => {
setCheckList(e);
setAllChecked(e.length === defaultList.length);
setIndeterminate(!!e.length && e.length < defaultList.length);
getValueCallback(e, itemid);
};
if (defaultList.length === 0) {
return null;
}
return (
<>
<div className={`${styles.divBox}`}>
<div className={styles.topCheckbox}>
<Checkbox
indeterminate={indeterminate}
checked={allChecked}
onChange={e => {
handleAllChecked(e);
}}
>
{OUName}
</Checkbox>
</div>
<div style={{ width: '100%' }} className={styles.checkdiv}>
{defaultList && defaultList.length > 0 && (
<CheckGroup
className={styles.check}
onChange={e => {
handleChecked(e);
}}
value={checkList}
options={defaultList}
/>
)}
</div>
</div>
</>
);
};
export default ListCardItem;
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Spin, Button } from 'antd';
import ListCardItem from './ItemCard';
import { get, post } from '@/services';
import { orgTest } from '@/services/orgnazation/api';
const tip = 'loading...';
const ListCard = props => {
const { ouid, searchWord, valueCallback, onCommit = () => {} } = props;
const [valueList, setValueList] = useState({});
const [dataList, setdataList] = useState([]);
const [loading, setLoading] = useState(true);
const getValueCallback = useCallback((value, index) => {
valueList[index] = value;
setValueList({ ...valueList });
valueCallback({ ...valueList });
}, []);
useEffect(() => {
setLoading(true);
const defaultConfig = {
optionsList: [],
title: '默认组',
id: '',
};
// /Cityinterface/rest/services/OMS.svc/U_GetUserListForBatchOper
get('/Cityinterface/rest/services/OMS.svc/P_GetUserByStation', {
// OUID:ouid||'',
stationID: ouid || '',
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
setLoading(false);
const list = [];
// eslint-disable-next-line no-unused-expressions
res &&
res.forEach(item => {
list.push({ ...defaultConfig, ...item });
});
setdataList(list);
})
.catch(err => {
console.error(err);
setLoading(false);
});
}, [ouid]);
return (
<div>
{loading ? (
<Spin
size="large"
spinning={loading}
tip={tip}
style={{
position: 'absolute',
top: '30%',
left: '0',
right: '0',
bottom: '0',
}}
/>
) : (
dataList &&
dataList.length > 0 &&
dataList.map((item, index) => (
<ListCardItem
{...item}
itemid={index}
key={`item${index}key`}
getValueCallback={getValueCallback}
searchWord={searchWord}
{...props}
/>
))
)}
{true && !loading && dataList && (
<Button
type="primary"
onClick={() => onCommit()}
style={{ marginTop: '20px' }}
>
提交
</Button>
)}
</div>
);
};
export default ListCard;
.divBox {
display: flex;
flex-wrap: wrap;
border: 1px solid #b5b8c8;
margin-top: 20px;
min-height: 50px;
.topCheckbox{
height: 20px;
background-color: #fff;
margin: -10px 0 0 20px;
}
.checkdiv {
display: flex;
margin-left: 20px;
justify-content: space-between;
}
}
.isSearch{
color: red;
background-color: yellow;
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
<!-- Allow installing the app to the homescreen -->
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="./favicon.ico" />
<title>运维管理平台</title>
</head>
......
......@@ -22,6 +22,7 @@ import {
deleteConn,
initDBv4,
getInitDBLog,
connectionTest,
} from '@/services/database/api';
import styles from './InitDataBase.less';
......
......@@ -31,7 +31,7 @@ const dataArr = [
];
const DatabaseConnectConfig = props => {
const [flag, setFlag] = useState(false);
const [active, setActive] = useState('3');
const [active, setActive] = useState('0');
const handleChange = e => {
console.log(e);
......
......@@ -102,6 +102,10 @@ const MongDBTable = props => {
setVisible(false);
setFlag(flag + 1);
};
// 文件迁移确认
const handleConfirm = () => {
console.log('aaaa');
};
const columns = [
{
title: '标签',
......@@ -187,6 +191,31 @@ const MongDBTable = props => {
>
添加MongDB数据库连接
</Button>,
<Popconfirm
title={
<div>
<p>
是否将confcenter、citytemp、buffile、log文件内容迁移至
Mongodb数据库中(会覆盖重名文件)?
</p>
<p>(连接配置取标签mongodb)</p>
</div>
}
cancelText="取消"
okText="确认"
onConfirm={handleConfirm}
placement="rightTop"
>
<Button
style={{
color: '#fff',
background: '#e6a23c',
borderColor: '#f5dab1',
}}
>
文件迁移
</Button>
</Popconfirm>,
]}
/>
<AddModal
......
import React, { useState, useEffect } from 'react';
import {
Form,
Select,
Input,
Button,
Row,
Col,
Radio,
notification,
} from 'antd';
import { Form, Select, Input, Button, Radio, notification } from 'antd';
import { editWebsite, getWebsite } from '@/services/mobileConfig/api';
import PicturesWall from '@/components/Upload/index';
const { Item } = Form;
const { Option } = Select;
const SiteConfig = props => {
const { submitCallback } = props;
const { miniTitle } = props;
const [config, setConfig] = useState(''); // 网站配置信息
const [loginList, setLoginList] = useState([
{ text: '默认界面', value: 'default' },
......@@ -33,12 +24,14 @@ const SiteConfig = props => {
labelCol: { span: 3 },
wrapperCol: { span: 14 },
};
useEffect(() => {
if (!miniTitle) {
return;
}
getWebsite({
_version: 9999,
_dc: Date.now(),
title: '熊猫掌天下小程序',
title: miniTitle,
}).then(res => {
let obj = { ...form.getFieldsValue() };
let arr = Object.keys({ ...form.getFieldsValue() });
......@@ -47,7 +40,7 @@ const SiteConfig = props => {
});
form.setFieldsValue(obj);
});
}, []);
}, [miniTitle]);
// 单选值改变
const radioChange = e => {};
// 提交选择
......@@ -67,7 +60,6 @@ const SiteConfig = props => {
duration: 3,
description: '编辑成功',
});
submitCallback();
} else {
notification.error({
message: '提示',
......@@ -108,8 +100,6 @@ const SiteConfig = props => {
<Input placeholder="请输入系统图标名称" allowClear />
</Item>
{/* <Button type="primary">按路径选择</Button> */}
<Item label="系统图标预览:">
<PicturesWall maxLen={3} />
</Item>
......@@ -171,7 +161,7 @@ const SiteConfig = props => {
</Select>
</Item>
<Item label="开启云登陆:" name="cloudLogin">
<Radio.Group onChange={radioChange} defaultValue={false}>
<Radio.Group onChange={radioChange}>
<Radio value></Radio>
<Radio value={false}></Radio>
</Radio.Group>
......
import React, { useState, useEffect } from 'react';
import { Card, Tabs } from 'antd';
import ProCard from '@ant-design/pro-card';
import { PageContainer } from '@ant-design/pro-layout';
import { miniAppSiteTree } from '@/services/mobileConfig/api';
import SiteConfig from './SiteConfig';
import MenuConfig from './menuconfig/MenuConfig';
const { TabPane } = Tabs;
const MobileConfigPage = props => {
const [activeKey, setActiveKey] = useState('0'); // tabs活动页
const [activeKey, setActiveKey] = useState('1'); // tabs活动页
const [miniTitle, setMiniTitle] = useState('');
const [flag, setFlag] = useState(1);
useEffect(() => {
miniAppSiteTree({
......@@ -15,6 +18,10 @@ const MobileConfigPage = props => {
_dc: new Date().getTime(),
node: -2,
}).then(res => {
if (res) {
const title = res[0].children[0].text || '熊猫掌天下小程序';
setMiniTitle(title);
}
console.log(res);
});
}, [flag]);
......@@ -22,21 +29,30 @@ const MobileConfigPage = props => {
const handleChange = key => {
setActiveKey(key);
};
const submitCallback = val => {
setFlag(flag + 1);
};
const tabArr = [
{
title: '网站配置',
key: '0',
component: <SiteConfig miniTitle={miniTitle} />,
},
{
title: '菜单管理',
key: '1',
component: <MenuConfig />,
},
];
return (
<PageContainer>
<Card>
<ProCard>
<Tabs activeKey={activeKey} type="card" onChange={handleChange}>
<TabPane tab="网站配置" key="0">
<SiteConfig submitCallback={submitCallback} />
</TabPane>
<TabPane tab="菜单管理" key="1">
<div>菜单管理</div>
{tabArr?.length > 0 &&
tabArr.map(item => (
<TabPane tab={item.title} key={item.key}>
{activeKey === item.key && item.component}
</TabPane>
))}
</Tabs>
</Card>
</ProCard>
</PageContainer>
);
};
......
import React, { useState } from 'react';
import { Form, Input } from 'antd';
const { Item } = Form;
const AddForm = props => {
const {} = props;
const [form] = Form.useForm();
const layout = {
layout: '',
};
return (
<Form form={form} {...layout}>
<Item label="分组名称">
<Input />
</Item>
<Item label="分组别名">
<Input />
</Item>
<Item label="在线图标">
<Input />
</Item>
<Item label="离线图标">
<Input />
</Item>
<Item label="功能参数">
<Input />
</Item>
</Form>
);
};
export default AddForm;
import React, { useState, useEffect } from 'react';
import ProCard from '@ant-design/pro-card';
import AddForm from './AddForm';
const MenuConfig = props => {
const [flag, setFlag] = useState(1);
return (
<ProCard split="vertical">
<ProCard colSpan="400px">
<div style={{ height: '60px', backgroundColor: 'red' }}> a</div>
</ProCard>
<ProCard>
<AddForm />
</ProCard>
</ProCard>
);
};
export default MenuConfig;
......@@ -9,6 +9,7 @@ import {
import ListCard from '@/pages/orgnazation/ListCard';
import qs from 'qs';
import styles from '@/pages/userCenter/roleManage/RoleManage.less';
import { version } from 'less';
import AddModal from './AddModal';
import DelModal from './DelModal';
import EditModal from './EditModal';
......
......@@ -85,7 +85,6 @@ const EditModal = props => {
>
<Input placeholder="请输入站点名称" />
</Item>
<Item label="站点类别">all</Item>
<Item label="站点描述" name="description">
<Input placeholder="请输入站点描述" />
</Item>
......
import { get, post } from '@/services/index';
/**
* @数据库初始化
*/
/**
* 数据库测试连接
* @param {*} params
* {
* ip:'',
* dbName:'',
* userName:'',
* password:'',
* }
*/
export const connectionTest = params =>
get('/DBManager/ConnectionTest', params);
// 数据库初始化
export const initDBv4 = params =>
get('/Cityinterface/rest/services/OMS.svc/S_InitDBv4', params);
......
......@@ -21,3 +21,7 @@ export const chooseUserToStation = (params, options) =>
params,
options,
);
// 获取所有角色信息
export const getUserRelationList = params =>
get('Cityinterface/rest/services/OMS.svc/W4_GetUserRelationList', params);
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