Commit f1251d2b authored by 张烨's avatar 张烨
parents 1d09a3e8 9685d053
...@@ -14,6 +14,7 @@ import { Chart, Interval, Tooltip, Axis } from 'bizcharts'; ...@@ -14,6 +14,7 @@ import { Chart, Interval, Tooltip, Axis } from 'bizcharts';
import { DataSet } from '@antv/data-set'; import { DataSet } from '@antv/data-set';
import moment from 'moment'; import moment from 'moment';
import { post, PUBLISH_SERVICE } from '@/services/index'; import { post, PUBLISH_SERVICE } from '@/services/index';
import styles from './index.less';
const ServiceLog = () => { const ServiceLog = () => {
const [loading, setLoading] = useState(false); // 源数据 const [loading, setLoading] = useState(false); // 源数据
...@@ -138,72 +139,76 @@ const ServiceLog = () => { ...@@ -138,72 +139,76 @@ const ServiceLog = () => {
return ( return (
<> <>
<Row style={{ padding: '10px', background: 'white' }}> <div className={styles.serviceLog}>
<Col span={24}> <Row className={styles.head}>
<span style={{ lineHeight: 2 }}>时间:</span> <Col span={24}>
<DatePicker <span style={{ lineHeight: 2 }}>时间:</span>
showTime <DatePicker
format="YYYY-MM-DD HH:mm:ss" showTime
placeholder="起始时间" format="YYYY-MM-DD HH:mm:ss"
value={startTime} placeholder="起始时间"
onChange={changeStartTime} value={startTime}
allowClear={false} onChange={changeStartTime}
/> allowClear={false}
<SwapRightOutlined style={{ lineHeight: 2 }} /> />
<DatePicker <SwapRightOutlined style={{ lineHeight: 2 }} />
showTime <DatePicker
format="YYYY-MM-DD HH:mm:ss" showTime
placeholder="结束时间" format="YYYY-MM-DD HH:mm:ss"
value={endTime} placeholder="结束时间"
onChange={changeEndTime} value={endTime}
style={{ marginRight: '10px' }} onChange={changeEndTime}
allowClear={false} style={{ marginRight: '10px' }}
/> allowClear={false}
<Button onClick={() => setTime(1)}>1小时</Button> />
<Button onClick={() => setTime(6)}>6小时</Button> <Button onClick={() => setTime(1)}>1小时</Button>
<Button onClick={() => setTime(12)}>12小时</Button> <Button onClick={() => setTime(6)}>6小时</Button>
<Button onClick={() => setTime(24)}>1</Button> <Button onClick={() => setTime(12)}>12小时</Button>
<Button onClick={() => setTime(24 * 7)}>1</Button> <Button onClick={() => setTime(24)}>1</Button>
</Col> <Button onClick={() => setTime(24 * 7)}>1</Button>
</Row>
<Spin spinning={loading} tip="loading">
<Row style={{ padding: '10px', background: 'white' }}>
<Col span={12}>
<Chart
height={316}
width={400}
autoFit
data={IPCount}
interactions={['active-region']}
padding="auto"
>
<Axis
name="IP"
label="null"
title={{ offset: 20, position: 'end' }}
/>
<Axis name="计数" title />
<Interval position="IP*计数" />
<Tooltip shared />
</Chart>
</Col> </Col>
</Row> </Row>
<Table <Spin spinning={loading} tip="loading">
size="small" <Row className={styles.chart}>
bordered <Col span={12}>
columns={columns} <Chart
dataSource={data0} height={316}
scroll={{ x: 'max-content' }} width={400}
pagination={{ autoFit
showTotal: (total, range) => data={IPCount}
`第${range[0]}-${range[1]} 条/共 ${total} 条`, interactions={['active-region']}
pageSizeOptions: [10, 20, 50, 100], padding="auto"
defaultPageSize: 10, >
showQuickJumper: true, <Axis
showSizeChanger: true, name="IP"
}} label="null"
/> title={{ offset: 20, position: 'end' }}
</Spin> />
<Axis name="计数" title />
<Interval position="IP*计数" />
<Tooltip shared />
</Chart>
</Col>
</Row>
<div className={styles.table}>
<Table
size="small"
bordered
columns={columns}
dataSource={data0}
scroll={{ x: 'max-content' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 10,
showQuickJumper: true,
showSizeChanger: true,
}}
/>
</div>
</Spin>
</div>
</> </>
); );
}; };
......
.serviceLog{
.head{
padding: 10px;
background: white;
margin-bottom: 2px;
min-width: 1030px;
}
.chart{
padding: 16px;
background: white;
}
.table{
border-top: 1px solid #f0eded;
// overflow: auto;//不要这个,pagination否则无法固定底部
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-table-content{
height:calc(100vh - 518px);
border-right: white;
overflow: auto !important;
}
.ant-pagination{
z-index: 999;
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-right: 12px;
background: white;
margin: 1px 0;
padding:8px;
padding-right: 20px;
}
}
}
\ No newline at end of file
...@@ -10,17 +10,27 @@ ...@@ -10,17 +10,27 @@
background: white; background: white;
} }
.table{ .table{
height:calc(100vh - 452px); border-top: 1px solid #f0eded;
overflow: auto; // overflow: auto;//不要这个,pagination否则无法固定底部
.ant-table-thead tr th{ .ant-table-thead tr th{
font-weight: 600; font-weight: 600;
color:rgba(0,0,0,0.85); color:rgba(0,0,0,0.85);
} }
.ant-table-content{
height:calc(100vh - 500px);
border-right: white;
overflow: auto !important;
}
.ant-pagination{ .ant-pagination{
z-index: 999; z-index: 999;
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-right: 12px;
background: white; background: white;
margin: 2px 0px; margin: 1px 0;
padding:6px 10px; padding:8px;
} padding-right: 20px;
} }
}
} }
\ No newline at end of file
...@@ -10,17 +10,27 @@ ...@@ -10,17 +10,27 @@
background: white; background: white;
} }
.table{ .table{
height:calc(100vh - 452px); border-top: 1px solid #f0eded;
overflow: auto; // overflow: auto;//不要这个,pagination否则无法固定底部
.ant-table-thead tr th{ .ant-table-thead tr th{
font-weight: 600; font-weight: 600;
color:rgba(0,0,0,0.85); color:rgba(0,0,0,0.85);
} }
.ant-table-content{
height:calc(100vh - 500px);
border-right: white;
overflow: auto !important;
}
.ant-pagination{ .ant-pagination{
z-index: 999; z-index: 999;
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-right: 12px;
background: white; background: white;
margin: 2px 0px; margin: 1px 0;
padding:6px 10px; padding:8px;
} padding-right: 20px;
} }
}
} }
\ No newline at end of file
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Select, Input, Button, Radio, notification, Spin } from 'antd'; import { Form, Select, Input, Button, Radio, notification, Spin } from 'antd';
import { editWebsite, getWebsite } from '@/services/mobileConfig/api'; import {
editWebsite,
getWebsite,
addWebsite,
} from '@/services/mobileConfig/api';
import PicturesWall from '@/components/Upload/index'; import PicturesWall from '@/components/Upload/index';
const { Item } = Form; const { Item } = Form;
const { Option } = Select; const { Option } = Select;
const SiteConfig = props => { const SiteConfig = props => {
const { miniTitle, submitCallback } = props; const { miniTitle, submitCallback, subType, addCallback } = props;
console.log(subType, 'ubType');
const [config, setConfig] = useState(''); // 网站配置信息 const [config, setConfig] = useState(''); // 网站配置信息
const [loginList, setLoginList] = useState([ const [loginList, setLoginList] = useState([
{ text: '默认界面', value: 'default' }, { text: '默认界面', value: 'default' },
...@@ -58,32 +63,63 @@ const SiteConfig = props => { ...@@ -58,32 +63,63 @@ const SiteConfig = props => {
setLoading(true); setLoading(true);
const obj = { ...form.getFieldsValue() }; const obj = { ...form.getFieldsValue() };
let params = { ...obj, mode: 'single', client: 'miniapp' }; let params = { ...obj, mode: 'single', client: 'miniapp' };
editWebsite(params, { if (subType === 'add') {
headers: { addWebsite(params, {
'content-type': 'application/x-www-form-urlencggoded;charset=UTF-8', headers: {
}, 'content-type':
}) 'application/x-www-form-urlencggoded;charset=UTF-8',
.then(res => { },
setLoading(false);
if (res.success) {
submitCallback();
notification.success({
message: '提示',
duration: 3,
description: '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.message || '编辑失败',
});
}
console.log(res, 'res');
}) })
.catch(err => { .then(res => {
setLoading(false); setLoading(false);
}); if (res.success) {
addCallback(params.title);
notification.success({
message: '提示',
duration: 3,
description: '新增成功',
});
} else {
notification.error({
message: '提示',
duration: 10,
description: res.message || '新增失败',
});
}
console.log(res, 'res');
})
.catch(err => {
setLoading(false);
});
} else {
editWebsite(params, {
headers: {
'content-type':
'application/x-www-form-urlencggoded;charset=UTF-8',
},
})
.then(res => {
setLoading(false);
if (res.success) {
submitCallback();
notification.success({
message: '提示',
duration: 3,
description: '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.message || '编辑失败',
});
}
console.log(res, 'res');
})
.catch(err => {
setLoading(false);
});
}
} }
}); });
}; };
...@@ -115,7 +151,16 @@ const SiteConfig = props => { ...@@ -115,7 +151,16 @@ const SiteConfig = props => {
> >
<Input placeholder="请输入系统图标名称" allowClear /> <Input placeholder="请输入系统图标名称" allowClear />
</Item> */} </Item> */}
<Item label="系统图标预览:" name="shortcutIcon"> <Item
label="系统图标:"
name="shortcutIcon"
rules={[
{
required: true,
message: '请选择系统图标',
},
]}
>
<PicturesWall /> <PicturesWall />
</Item> </Item>
...@@ -176,7 +221,7 @@ const SiteConfig = props => { ...@@ -176,7 +221,7 @@ const SiteConfig = props => {
))} ))}
</Select> </Select>
</Item> </Item>
<Item label="开启云登陆:" name="cloudLogin"> <Item label="开启云登陆:" name="cloudLogin" initialValue={false}>
<Radio.Group onChange={radioChange}> <Radio.Group onChange={radioChange}>
<Radio value></Radio> <Radio value></Radio>
<Radio value={false}></Radio> <Radio value={false}></Radio>
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, useMemo } from 'react';
import { Card, Tabs } from 'antd'; import { Card, Tabs, Button, Popconfirm, notification, Spin } from 'antd';
import ProCard from '@ant-design/pro-card'; import ProCard from '@ant-design/pro-card';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import { import {
miniAppSiteTree, miniAppSiteTree,
getMiniAppModuleTree, getMiniAppModuleTree,
deleteWebsite,
} from '@/services/mobileConfig/api'; } from '@/services/mobileConfig/api';
import SiteConfig from './SiteConfig'; import SiteConfig from './SiteConfig';
import MenuConfig from './menuconfig/MenuConfig'; import MenuConfig from './menuconfig/MenuConfig';
...@@ -13,6 +14,10 @@ const MobileConfigPage = props => { ...@@ -13,6 +14,10 @@ const MobileConfigPage = props => {
const [activeKey, setActiveKey] = useState('0'); // tabs活动页 const [activeKey, setActiveKey] = useState('0'); // tabs活动页
const [miniTitle, setMiniTitle] = useState(''); const [miniTitle, setMiniTitle] = useState('');
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
const [showConfig, setShowConfig] = useState(true);
const [loading, setLoading] = useState(false);
const [position, setPosition] = useState([]);
const [subType, setSubType] = useState('');
useEffect(() => { useEffect(() => {
// miniAppSiteTree({ // miniAppSiteTree({
// userMode: 'admin', // userMode: 'admin',
...@@ -21,18 +26,30 @@ const MobileConfigPage = props => { ...@@ -21,18 +26,30 @@ const MobileConfigPage = props => {
// _dc: new Date().getTime(), // _dc: new Date().getTime(),
// node: -2, // node: -2,
// }) // })
setLoading(true);
getMiniAppModuleTree({ getMiniAppModuleTree({
userMode: 'admin', userMode: 'admin',
}).then(res => { }).then(res => {
setLoading(false);
console.log(res, 'res'); console.log(res, 'res');
if (res.code === 0) { if (res.code === 0) {
const { data } = res; const { data } = res;
const title = data[0].children[0].text || '熊猫掌天下小程序'; if (data[0].children.length > 0) {
setMiniTitle(title); const title = data[0].children[0].text || '熊猫掌天下小程序';
setShowConfig(true);
setMiniTitle(title);
setPosition(['right']);
} else {
setPosition(['left']);
setShowConfig(false);
}
} else {
setShowConfig(false);
} }
console.log(res); console.log(res);
}); });
}, [flag]); }, [flag]);
useEffect(() => { useEffect(() => {
// getMiniAppModuleTree({ // getMiniAppModuleTree({
// userMode: 'super', // userMode: 'super',
...@@ -46,13 +63,87 @@ const MobileConfigPage = props => { ...@@ -46,13 +63,87 @@ const MobileConfigPage = props => {
}; };
const submitCallback = () => { const submitCallback = () => {
setFlag(flag + 1); setFlag(flag + 1);
setSubType('');
};
const addCallback = val => {
console.log(val);
setSubType('');
setMiniTitle(val);
setPosition(['right']);
};
// 删除小程序
const delMini = () => {
setLoading(true);
deleteWebsite({
client: 'miniapp',
_version: 9999,
_dc: Date.now(),
})
.then(res => {
setLoading(false);
if (res.success) {
setFlag(flag + 1);
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
} else {
notification.success({
message: '提示',
duration: 3,
description: res.message || '删除失败',
});
}
})
.catch(() => {
setLoading(false);
});
};
const addMini = () => {
setShowConfig(true);
setSubType('add');
}; };
const options = {
left: (
<Button type="primary" onClick={addMini}>
新增小程序
</Button>
),
right: (
<Popconfirm
title="是否删除小程序网站,及相关联的角色和菜单"
okText="确认"
cancelText="取消"
placement="left"
onConfirm={delMini}
>
<Button type="primary" danger>
删除小程序
</Button>
</Popconfirm>
),
};
const slot = useMemo(() => {
if (position.length === 0) return null;
return position.reduce((acc, direction) => {
console.log(acc, direction);
return { ...acc, [direction]: options[direction] };
}, {});
}, [position]);
const tabArr = [ const tabArr = [
{ {
title: '网站配置', title: '网站配置',
key: '0', key: '0',
component: ( component: (
<SiteConfig miniTitle={miniTitle} submitCallback={submitCallback} /> <SiteConfig
miniTitle={miniTitle}
submitCallback={submitCallback}
subType={subType}
addCallback={addCallback}
/>
), ),
}, },
{ {
...@@ -64,14 +155,32 @@ const MobileConfigPage = props => { ...@@ -64,14 +155,32 @@ const MobileConfigPage = props => {
return ( return (
<PageContainer> <PageContainer>
<ProCard> <ProCard>
<Tabs activeKey={activeKey} type="card" onChange={handleChange}> <Spin tip="loading..." spinning={loading}>
{tabArr?.length > 0 && <Tabs
tabArr.map(item => ( activeKey={activeKey}
<TabPane tab={item.title} key={item.key}> type="card"
{activeKey === item.key && item.component} onChange={handleChange}
tabBarExtraContent={slot}
>
{/* {showConfig &&
tabArr?.length > 0 &&
tabArr.map(item => (
<TabPane tab={item.title} key={item.key}>
{activeKey === item.key && item.component}
</TabPane>
))} */}
{showConfig && (
<TabPane tab={tabArr[0].title} key={tabArr[0].key}>
{activeKey === tabArr[0].key && tabArr[0].component}
</TabPane>
)}
{showConfig && subType !== 'add' && (
<TabPane tab={tabArr[1].title} key={tabArr[1].key}>
{activeKey === tabArr[1].key && tabArr[1].component}
</TabPane> </TabPane>
))} )}
</Tabs> </Tabs>
</Spin>
</ProCard> </ProCard>
</PageContainer> </PageContainer>
); );
......
import React, { useState } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Input, Button, Row, Col } from 'antd'; import { Form, Input, Button, Row, Col } from 'antd';
import styles from './addForm.less'; import styles from './addForm.less';
import PicturesWall from '@/components/Upload/index'; import PicturesWall from '@/components/Upload/index';
import CheckList from './checkBox';
import checkStyles from './checkBox';
const { Item } = Form; const { Item } = Form;
const AddForm = props => { const AddForm = props => {
const { submitCallback, nodeType, nodeObj, addType, submitLoading } = props; const {
submitCallback,
nodeType,
nodeObj,
addType,
submitLoading,
valueCallback,
addList,
} = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
const [otherForm] = Form.useForm(); const [otherForm] = Form.useForm();
console.log(nodeObj, 'nodeObj'); console.log(nodeObj, 'nodeObj');
...@@ -27,6 +37,7 @@ const AddForm = props => { ...@@ -27,6 +37,7 @@ const AddForm = props => {
const finish = () => { const finish = () => {
submit(); submit();
}; };
useEffect(() => {}, [nodeObj, addType]);
return ( return (
<div> <div>
{(addType === 1 || addType === 2) && ( {(addType === 1 || addType === 2) && (
...@@ -186,6 +197,11 @@ const AddForm = props => { ...@@ -186,6 +197,11 @@ const AddForm = props => {
<Item label="功能参数" name="funParam"> <Item label="功能参数" name="funParam">
<Input /> <Input />
</Item> </Item>
{/* <CheckList
nodeType={addType}
valueCallback={valueCallback}
addList={addList}
/> */}
<Item wrapperCol={{ offset: 5 }} style={{ marginTop: '40px' }}> <Item wrapperCol={{ offset: 5 }} style={{ marginTop: '40px' }}>
<Button type="primary" htmlType="submit" loading={submitLoading}> <Button type="primary" htmlType="submit" loading={submitLoading}>
提交 提交
......
...@@ -2,12 +2,10 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,12 +2,10 @@ import React, { useState, useEffect } from 'react';
import { Checkbox, Empty } from 'antd'; import { Checkbox, Empty } from 'antd';
import styles from './checkBox.less'; import styles from './checkBox.less';
const CheckList = props => { const CheckList = props => {
const { info, valueCallback, nodeType } = props; const { info = {}, valueCallback = () => {}, nodeType = '', addList } = props;
console.log(info, 'info'); console.log(info, 'info');
const [list, setList] = useState([]); const [list, setList] = useState([]);
const [checkList, setCheckList] = useState([]); const [addRoleList, setAddRoleList] = useState([]);
const [flag, setFlag] = useState(false);
const a = 'a';
useEffect(() => { useEffect(() => {
if (info.pageUrl) { if (info.pageUrl) {
let arr = [...info.relatedRoleList]; let arr = [...info.relatedRoleList];
...@@ -17,21 +15,15 @@ const CheckList = props => { ...@@ -17,21 +15,15 @@ const CheckList = props => {
arr2.push(item.relatedRoleCode); arr2.push(item.relatedRoleCode);
} }
}); });
console.log(arr2, 'arr2');
setCheckList(arr2);
setList(arr); setList(arr);
setFlag(true);
} }
return () => {
setFlag(false);
setCheckList([]);
};
}, [info]); }, [info]);
useEffect(() => {
if (addList && addList.length > 0) {
setAddRoleList([...addList]);
}
}, [addList]);
const handleSelect = (e, val) => { const handleSelect = (e, val) => {
console.log(e.target, 'e', val);
let arr = [];
list.forEach(item => { list.forEach(item => {
if (item.relatedRoleCode === val) { if (item.relatedRoleCode === val) {
item.related = e.target.checked; item.related = e.target.checked;
...@@ -40,6 +32,15 @@ const CheckList = props => { ...@@ -40,6 +32,15 @@ const CheckList = props => {
setList([...list]); setList([...list]);
valueCallback(list); valueCallback(list);
}; };
const handleRoleSelect = (e, val) => {
addRoleList.forEach(item => {
if (item.roleCode === val) {
item.related = e.target.checked;
}
});
setAddRoleList([...addRoleList]);
valueCallback(addRoleList);
};
return ( return (
<div> <div>
{nodeType === 3 || nodeType === 4 ? ( {nodeType === 3 || nodeType === 4 ? (
...@@ -64,6 +65,25 @@ const CheckList = props => { ...@@ -64,6 +65,25 @@ const CheckList = props => {
) : ( ) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)} )}
{/* {
<div className={styles.box}>
{addRoleList &&
addRoleList.length > 0 &&
addRoleList.map(item => (
<div key={item.roleCode} className={styles.check}>
<Checkbox
checked={item.related}
onChange={e => {
handleRoleSelect(e, item.roleCode);
}}
>
{item.roleName}
</Checkbox>
</div>
))}
</div>
} */}
</div> </div>
); );
}; };
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
padding: 10px; padding: 10px;
margin-top: 10px; margin-top: 10px;
flex-wrap: wrap; flex-wrap: wrap;
border: 1px solid gray;
} }
.check{ .check{
flex-shrink: 0; flex-shrink: 0;
......
...@@ -180,7 +180,6 @@ const EditForm = props => { ...@@ -180,7 +180,6 @@ const EditForm = props => {
}, },
]} ]}
> >
{/* {otherForm.getFieldsValue().offlineImgUrl && <PicturesWall />} */}
<PicturesWall /> <PicturesWall />
</Item> </Item>
)} )}
......
...@@ -2,8 +2,6 @@ import React, { useEffect, useState } from 'react'; ...@@ -2,8 +2,6 @@ import React, { useEffect, useState } from 'react';
import { import {
message, message,
notification, notification,
Popconfirm,
Form,
Tree, Tree,
Tooltip, Tooltip,
Modal, Modal,
...@@ -18,7 +16,6 @@ import { ...@@ -18,7 +16,6 @@ import {
FileOutlined, FileOutlined,
DeleteTwoTone, DeleteTwoTone,
} from '@ant-design/icons'; } from '@ant-design/icons';
import PicturesWall from '@/components/Upload/index';
import classnames from 'classnames'; import classnames from 'classnames';
import { import {
miniAppSiteTree, miniAppSiteTree,
...@@ -27,6 +24,7 @@ import { ...@@ -27,6 +24,7 @@ import {
getMenuInfo, getMenuInfo,
deleteMenu, deleteMenu,
editMenu, editMenu,
getRoleListPlain,
} from '@/services/mobileConfig/api'; } from '@/services/mobileConfig/api';
import styles from './miniMenu.less'; import styles from './miniMenu.less';
import AddForm from './AddForm'; import AddForm from './AddForm';
...@@ -35,7 +33,7 @@ import CheckList from './checkBox'; ...@@ -35,7 +33,7 @@ import CheckList from './checkBox';
const MiniMenu = props => { const MiniMenu = props => {
const [flag, setFlag] = useState(1); // 刷新标志 const [flag, setFlag] = useState(1); // 刷新标志
const [treeFlage, setTreeFlag] = useState(true); const [treeFlag, setTreeFlag] = useState(true);
const [treeData, setTreeData] = useState([]); // 树的数据 const [treeData, setTreeData] = useState([]); // 树的数据
const [loading, setLoading] = useState(false); // 加载 const [loading, setLoading] = useState(false); // 加载
const [menuID, setMenuID] = useState(''); // 选中的树ID const [menuID, setMenuID] = useState(''); // 选中的树ID
...@@ -45,18 +43,28 @@ const MiniMenu = props => { ...@@ -45,18 +43,28 @@ const MiniMenu = props => {
const [addVisible, setAddVisible] = useState(false); // 新增弹窗 const [addVisible, setAddVisible] = useState(false); // 新增弹窗
const [addTwoVisible, setAddTwoVisible] = useState(false); // 编辑弹窗 const [addTwoVisible, setAddTwoVisible] = useState(false); // 编辑弹窗
const [delVisible, setDelVisible] = useState(false); // 删除弹窗 const [delVisible, setDelVisible] = useState(false); // 删除弹窗
const [addFlag, setAddFlag] = useState('root'); // 设置新增标志
const [nodeObj, setNodeObj] = useState({}); const [nodeObj, setNodeObj] = useState({});
const [addType, setAddType] = useState(''); // 添加下级类型 const [addType, setAddType] = useState(''); // 添加下级类型
const [modalTitle, setModalTitle] = useState(''); const [modalTitle, setModalTitle] = useState('');
const [roleList, setRoleList] = useState([]); // 复选框选中的值 const [roleList, setRoleList] = useState([]); // 复选框选中的值
const [modalLoading, setModalLoading] = useState(false); const [modalLoading, setModalLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false); const [submitLoading, setSubmitLoading] = useState(false);
const [addList, setAddList] = useState([]);
// 获取菜单树 // 获取菜单树
useEffect(() => { useEffect(() => {
updateTrees(); updateTrees();
}, [flag]); }, [flag]);
useEffect(() => {
getRoleListPlain({
subSystemValue: 'miniapp',
_dc: Date.now(),
_version: 9999,
}).then(res => {
if (res.success) {
setAddList(res.list);
}
});
}, [flag]);
// 获取菜单信息 // 获取菜单信息
useEffect(() => { useEffect(() => {
getInfo(); getInfo();
...@@ -84,7 +92,7 @@ const MiniMenu = props => { ...@@ -84,7 +92,7 @@ const MiniMenu = props => {
setTreeData(result); setTreeData(result);
console.log(result); console.log(result);
// 第一次加载,默认选择第一个组织 // 第一次加载,默认选择第一个组织
// if (treeFlage) { // if (treeFlag) {
// handleSelect([result[0].menuID], false); // handleSelect([result[0].menuID], false);
// setTreeFlag(false); // setTreeFlag(false);
// } // }
...@@ -111,17 +119,17 @@ const MiniMenu = props => { ...@@ -111,17 +119,17 @@ const MiniMenu = props => {
<div>{obj.text}</div> <div>{obj.text}</div>
<div className={styles.tip}> <div className={styles.tip}>
{obj.menuType === 'MiniAppMenuGroup' && ( {obj.menuType === 'MiniAppMenuGroup' && (
<Tooltip title="新增菜单组" className={styles.fs}> <Tooltip title="新增菜单组" className={styles.fsize}>
<FolderAddTwoTone onClick={() => addMenuGroupTip(obj)} /> <FolderAddTwoTone onClick={() => addMenuGroupTip(obj)} />
</Tooltip> </Tooltip>
)} )}
{obj.menuType === 'MiniAppMenuGroupTwo' && ( {obj.menuType === 'MiniAppMenuGroupTwo' && (
<Tooltip title="新增功能菜单" className={styles.fs}> <Tooltip title="新增功能菜单" className={styles.fsize}>
<FileAddTwoTone onClick={() => addMenuTip(obj)} /> <FileAddTwoTone onClick={() => addMenuTip(obj)} />
</Tooltip> </Tooltip>
)} )}
<Tooltip title="删除菜单" className={styles.fs}> <Tooltip title="删除菜单" className={styles.fsize}>
<DeleteTwoTone onClick={() => deleteMenuTip(obj)} /> <DeleteTwoTone onClick={() => deleteMenuTip(obj)} />
</Tooltip> </Tooltip>
</div> </div>
...@@ -131,10 +139,10 @@ const MiniMenu = props => { ...@@ -131,10 +139,10 @@ const MiniMenu = props => {
icon: icon:
obj.menuType !== 'MiniAppMenuThree' && obj.menuType !== 'MiniAppMenuThree' &&
obj.menuType !== 'MiniAppMenu' ? ( obj.menuType !== 'MiniAppMenu' ? (
<FolderFilled /> <FolderFilled />
) : ( ) : (
<FileOutlined /> <FileOutlined />
), ),
menuType: obj.menuType, menuType: obj.menuType,
children: hasChild ? obj.children.map(i => mapTree(i)) : [], children: hasChild ? obj.children.map(i => mapTree(i)) : [],
}; };
...@@ -253,7 +261,7 @@ const MiniMenu = props => { ...@@ -253,7 +261,7 @@ const MiniMenu = props => {
}; };
const rootAddGroup = () => { const rootAddGroup = () => {
setNodeObj(''); setNodeObj('');
setNodeType(1); // setNodeType(1);
setModalTitle('最上级列表'); setModalTitle('最上级列表');
setAddType(1); setAddType(1);
setAddVisible(true); setAddVisible(true);
...@@ -268,15 +276,18 @@ const MiniMenu = props => { ...@@ -268,15 +276,18 @@ const MiniMenu = props => {
const rootAdd = () => { const rootAdd = () => {
setModalTitle('最上级列表'); setModalTitle('最上级列表');
setNodeObj(''); setNodeObj('');
setNodeType(3); // setNodeType(3);
setAddType(3); setAddType(3);
setAddTwoVisible(true); setAddTwoVisible(true);
}; };
// 新增提交的回调 // 新增提交的回调
const submitCallback = (prop, item) => { const submitCallback = (prop, item) => {
setSubmitLoading(true); setSubmitLoading(true);
console.log(prop, item);
let obj = { ...prop }; let obj = { ...prop };
// if (addType === 3 || addType === 4) {
// obj.relatedRoleList = String(roleList) || '';
// }
console.log(obj);
const parentID = item.menuID ? item.menuID : -1; const parentID = item.menuID ? item.menuID : -1;
addMenu({ addMenu({
_dc: Date.now(), _dc: Date.now(),
...@@ -303,7 +314,6 @@ const MiniMenu = props => { ...@@ -303,7 +314,6 @@ const MiniMenu = props => {
duration: 10, duration: 10,
}); });
} }
console.log(res, 'resadd');
}) })
.catch(err => { .catch(err => {
setSubmitLoading(false); setSubmitLoading(false);
...@@ -350,7 +360,8 @@ const MiniMenu = props => { ...@@ -350,7 +360,8 @@ const MiniMenu = props => {
}); });
}; };
const valueCallback = val => { const valueCallback = val => {
console.log(val); console.log(val, 'val');
// relatedRoleCode
let arr = [...val]; let arr = [...val];
let arr2 = []; let arr2 = [];
arr.map(item => { arr.map(item => {
...@@ -420,9 +431,6 @@ const MiniMenu = props => { ...@@ -420,9 +431,6 @@ const MiniMenu = props => {
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
onCancel={() => setAddVisible(false)} onCancel={() => setAddVisible(false)}
onConfirm={() => {
submitCallback();
}}
> >
<AddForm <AddForm
nodeType={nodeType} nodeType={nodeType}
...@@ -430,12 +438,19 @@ const MiniMenu = props => { ...@@ -430,12 +438,19 @@ const MiniMenu = props => {
addType={addType} addType={addType}
submitCallback={submitCallback} submitCallback={submitCallback}
submitLoading={submitLoading} submitLoading={submitLoading}
valueCallback={valueCallback}
addList={addList}
/> />
</Modal> </Modal>
<Modal <Modal
visible={addTwoVisible} visible={addTwoVisible}
title={`在${modalTitle}下新增功能菜单`} title={`在${modalTitle}下新增功能菜单`}
bodyStyle={{ width: '100%', minHeight: '100px' }} bodyStyle={{
width: '100%',
minHeight: '100px',
maxHeight: '700px',
overflowY: 'scroll',
}}
style={{ top: 80 }} style={{ top: 80 }}
width="600px" width="600px"
destroyOnClose destroyOnClose
...@@ -449,7 +464,9 @@ const MiniMenu = props => { ...@@ -449,7 +464,9 @@ const MiniMenu = props => {
nodeType={nodeType} nodeType={nodeType}
nodeObj={nodeObj} nodeObj={nodeObj}
addType={addType} addType={addType}
addList={addList}
submitCallback={submitCallback} submitCallback={submitCallback}
valueCallback={valueCallback}
/> />
</Modal> </Modal>
<Modal <Modal
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
width: 100%; width: 100%;
} }
} }
.fs{ .fsize{
font-size: 18px; font-size: 18px;
margin-left: 10px; margin-left: 10px;
} }
......
import React, { useState, useEffect } from 'react';
import {
Table,
Spin,
Modal,
Form,
Input,
Space,
Button,
Popconfirm,
notification,
message,
} from 'antd';
import { get } from '@/services/index';
import styles from './AppDic.less';
const AppDic = () => {
const [loading, setLoading] = useState(false);
const [addVisible, setAddVisible] = useState(false);
const [editVisible, setEditVisible] = useState(false);
const [data, setData] = useState([]); // 表数据
const [select, setSelect] = useState({}); // 当前选中条目,修改/删除时设置
const [addForm] = Form.useForm();
const [editForm] = Form.useForm();
const columns = [
{
title: '名称',
dataIndex: 'Label',
key: 'Label',
},
{
title: '键名',
dataIndex: 'Key',
key: 'Key',
},
{
title: '值',
dataIndex: 'Value',
key: 'Value',
},
{
title: '描述',
dataIndex: 'Description',
key: 'Description',
render: record => {
if (!record) {
return '-';
}
return record;
},
},
{
title: '操作',
key: 'action',
width: 200,
render: record => (
<Space>
<Button
type="primary"
size="small"
onClick={() => {
setSelect(record);
setEditVisible(true);
editForm.setFieldsValue({
label: record.Label,
key: record.Key,
value: record.Value,
description: record.Description,
});
}}
>
修改
</Button>
<Popconfirm
title="是否删除该数据?"
okText="确认"
cancelText="取消"
onConfirm={submitDelete}
>
<Button
size="small"
danger
onClick={() => {
setSelect(record);
}}
>
删除
</Button>
</Popconfirm>
</Space>
),
},
];
useEffect(() => {
getData('-1');
}, []);
const getData = () => {
setLoading(true);
get(`/Cityinterface/rest/services/OMS.svc/M_GetKeyValue`, {
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
if (res) {
if (res.length > 0) {
res.map(item => {
item.key = item.id;
return item;
});
}
setData(res);
} else {
notification.error({
message: '获取失败',
description: res.message,
});
}
setLoading(false);
})
.catch(err => {
setLoading(false);
message.error(err);
});
};
// 提交-添加
const submitAdd = () => {
const label = addForm.getFieldValue('label');
const key = addForm.getFieldValue('key');
const value = addForm.getFieldValue('value');
const description = addForm.getFieldValue('description');
if (label && key && value) {
get(`/Cityinterface/rest/services/OMS.svc/M_AddKeyValue`, {
_version: 9999,
_dc: new Date().getTime(),
label,
key,
value,
desc: description,
})
.then(res => {
if (res.success) {
setAddVisible(false);
getData();
notification.success({
message: '提交成功',
});
} else {
notification.error({
message: '提交失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
} else {
notification.error({
message: '提交失败',
description: '名称/键名/值不能为空',
});
}
};
// 提交-重置
const submitReset = () => {
get(`/Cityinterface/rest/services/OMS.svc/M_ResetKeyValue`, {
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
if (res.success) {
getData();
notification.success({
message: '重置成功',
});
} else {
notification.error({
message: '重置失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
};
// 提交-编辑
const submitEdit = () => {
const label = editForm.getFieldValue('label');
const key = editForm.getFieldValue('key');
const value = editForm.getFieldValue('value');
const description = editForm.getFieldValue('description');
if (label && key && value) {
get(`/Cityinterface/rest/services/OMS.svc/M_EditKeyValue`, {
_version: 9999,
_dc: new Date().getTime(),
id: select.id,
label,
key,
value,
desc: description,
})
.then(res => {
if (res.success) {
setEditVisible(false);
getData();
notification.success({
message: '提交成功',
});
} else {
notification.error({
message: '提交失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
} else {
notification.error({
message: '提交失败',
description: '名称/键名/值不能为空',
});
}
};
const submitDelete = () => {
get(`/Cityinterface/rest/services/OMS.svc/M_DeleteKeyValue`, {
_version: 9999,
_dc: new Date().getTime(),
key: select.Key,
})
.then(res => {
if (res.success) {
getData(select.parentID);
notification.success({
message: '删除成功',
});
} else {
notification.error({
message: '删除失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
};
return (
<div className={styles.AppDic}>
<Spin spinning={loading} tip="loading...">
<div
style={{
marginBottom: '10px',
fontSize: '16px',
height: 'calc(100vh-200px)',
}}
>
<span style={{ padding: '0 10px' }}>数据字典</span>
<Button
style={{ marginLeft: '10px' }}
type="primary"
size="small"
onClick={() => {
setAddVisible(true);
addForm.resetFields();
}}
>
添加
</Button>
<Popconfirm
title="是否重置默认配置?"
okText="确认"
cancelText="取消"
onConfirm={submitReset}
>
<Button size="small" danger style={{ marginLeft: '10px' }}>
重置
</Button>
</Popconfirm>
</div>
<Table
size="small"
bordered
columns={columns}
dataSource={data}
scroll={{ x: 'max-content' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20,
showQuickJumper: true,
showSizeChanger: true,
}}
/>
</Spin>
{/* 添加 */}
<Modal
title="添加数据字典"
visible={addVisible}
onOk={submitAdd}
onCancel={() => {
setAddVisible(false);
}}
okText="确认"
cancelText="取消"
>
<Form form={addForm} labelCol={{ span: 3 }}>
<Form.Item
name="label"
label="名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入名称" />
</Form.Item>
<Form.Item
name="key"
label="键名"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入键名" />
</Form.Item>
<Form.Item
name="value"
label="值"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入值" />
</Form.Item>
<Form.Item name="description" label="描述">
<Input placeholder="请输入相关描述" />
</Form.Item>
</Form>
</Modal>
{/* 修改 */}
<Modal
title="修改数据字典"
visible={editVisible}
onOk={submitEdit}
onCancel={() => {
setEditVisible(false);
}}
okText="确认"
cancelText="取消"
>
<Form form={editForm} labelCol={{ span: 3 }}>
<Form.Item
name="label"
label="名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入名称" />
</Form.Item>
<Form.Item name="key" label="键名">
<Input placeholder="请输入键名" />
</Form.Item>
<Form.Item
name="value"
label="值"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入值" />
</Form.Item>
<Form.Item name="description" label="描述">
<Input placeholder="请输入相关描述" />
</Form.Item>
</Form>
</Modal>
</div>
);
};
export default AppDic;
.AppDic{
overflow: auto;
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-pagination{
z-index: 999;
background: white;
margin: 2px 0px;
padding:6px 10px;
}
.ant-table-tbody{
.clickRowStyle{
background: #cfe7fd;
}
.clickRowStyle:hover>td{
background: #aed8fa;
}
}
.ant-card-body{
padding: 10px !important;
}
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-table-content{
height:calc(100vh - 258px);
border-right: white;
overflow: auto !important;
}
.ant-pagination{
z-index: 999;
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-right: 12px;
background: white;
margin: 1px 0;
padding:8px;
padding-right: 20px;
}
}
\ No newline at end of file
This diff is collapsed.
.WebDic{
overflow: auto;
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-pagination{
z-index: 999;
background: white;
margin: 2px 0px;
padding:6px 10px;
}
.ant-table-tbody{
.clickRowStyle{
background: #cfe7fd;
}
.clickRowStyle:hover>td{
background: #aed8fa;
}
}
.ant-card-body{
padding: 10px !important;
}
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-table-content{
height:calc(100vh - 488px);
border-right: white;
overflow: auto !important;
}
.ant-pagination{
z-index: 999;
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-right: 12px;
background: white;
margin: 1px 0;
padding:8px;
padding-right: 20px;
}
}
\ No newline at end of file
import React from 'react';
import { Tabs, Card } from 'antd';
import PageContainer from '@/components/BasePageContainer';
import WebDic from './WebDic';
import AppDic from './AppDic';
// import VersionPublish from './VersionPublish';
const dictionary = () => {
const { TabPane } = Tabs;
return (
<PageContainer>
<Card>
<Tabs defaultActiveKey="1" type="card">
<TabPane tab="web数据字典" key="1">
<WebDic />
</TabPane>
<TabPane tab="app数据字典" key="2" type="card">
<AppDic />
</TabPane>
</Tabs>
</Card>
</PageContainer>
);
};
export default dictionary;
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
.ant-dropdown-menu-item > .anticon:first-child { .ant-dropdown-menu-item > .anticon:first-child {
vertical-align: 0.15em !important; vertical-align: 0.15em !important;
} }
.ant-table-tbody{
.ant-table-row:hover>td{
background: #aed8fa !important;
}
}
} }
.redText{ .redText{
color: red; color: red;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
max-height: calc(100vh - 74px); max-height: calc(100vh - 74px);
// overflow-y: scroll; // overflow-y: scroll;
overflow: auto; overflow: auto;
width: 260px; width: 300px;
left: 0; left: 0;
top: 0; top: 0;
margin-right: 10px; margin-right: 10px;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
min-height: calc(100vh - 75px); min-height: calc(100vh - 75px);
max-height: calc(100vh - 75px); max-height: calc(100vh - 75px);
overflow: auto; overflow: auto;
width: 260px; width: 300px;
left: 0; left: 0;
top: 0; top: 0;
margin-right: 10px; margin-right: 10px;
......
...@@ -22,6 +22,7 @@ import CurrentSolution from '@/pages/database/CurrentSolution'; ...@@ -22,6 +22,7 @@ import CurrentSolution from '@/pages/database/CurrentSolution';
import UserManage from '../pages/userCenter/UserManage'; import UserManage from '../pages/userCenter/UserManage';
import RoleManage from '@/pages/userCenter/roleManage/RoleManage'; import RoleManage from '@/pages/userCenter/roleManage/RoleManage';
import SiteManage from '../pages/userCenter/siteManage/SiteManage'; import SiteManage from '../pages/userCenter/siteManage/SiteManage';
import Dictionary from '../pages/platformCenter/dictionary';
import ServiceLog from '../pages/log/serviceLog'; import ServiceLog from '../pages/log/serviceLog';
import LoginLog from '../pages/log/loginLog'; import LoginLog from '../pages/log/loginLog';
import OmsLog from '../pages/log/omsLog'; import OmsLog from '../pages/log/omsLog';
...@@ -194,7 +195,7 @@ export default { ...@@ -194,7 +195,7 @@ export default {
{ {
path: '/platformCenter/dictionary', path: '/platformCenter/dictionary',
name: '数据字典', name: '数据字典',
component: Welcome, component: Dictionary,
}, },
], ],
}, },
......
...@@ -81,6 +81,23 @@ export const editMenu = params => ...@@ -81,6 +81,23 @@ export const editMenu = params =>
get('/Cityinterface/rest/services/OMS.svc/MiniApp_EditMenu', params); get('/Cityinterface/rest/services/OMS.svc/MiniApp_EditMenu', params);
// 删除菜单 // 删除菜单
export const deleteMenu = params => export const deleteMenu = params =>
get('/Cityinterface/rest/services/OMS.svc/MiniApp_DeleteMenu', params); get('/Cityinterface/rest/services/OMS.svc/MiniApp_DeleteMenu', params);
// 获取角色列表
export const getRoleListPlain = params =>
get('/Cityinterface/rest/services/OMS.svc/P_GetRoleListPlain', params);
// 删除小程序
export const deleteWebsite = params =>
get('/Cityinterface/rest/services/OMS.svc/MiniApp_DeleteWebsite', params);
// 新增小程序
export const addWebsite = (params, options) => {
let strParams = JSON.stringify(params);
let qsParams = qs.stringify({ config: strParams });
return post(
'/Cityinterface/rest/services/OMS.svc/MiniApp_AddWebsite?_version=9999',
qsParams,
options,
);
};
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