Commit f1251d2b authored by 张烨's avatar 张烨
parents 1d09a3e8 9685d053
......@@ -14,6 +14,7 @@ import { Chart, Interval, Tooltip, Axis } from 'bizcharts';
import { DataSet } from '@antv/data-set';
import moment from 'moment';
import { post, PUBLISH_SERVICE } from '@/services/index';
import styles from './index.less';
const ServiceLog = () => {
const [loading, setLoading] = useState(false); // 源数据
......@@ -138,72 +139,76 @@ const ServiceLog = () => {
return (
<>
<Row style={{ padding: '10px', background: 'white' }}>
<Col span={24}>
<span style={{ lineHeight: 2 }}>时间:</span>
<DatePicker
showTime
format="YYYY-MM-DD HH:mm:ss"
placeholder="起始时间"
value={startTime}
onChange={changeStartTime}
allowClear={false}
/>
<SwapRightOutlined style={{ lineHeight: 2 }} />
<DatePicker
showTime
format="YYYY-MM-DD HH:mm:ss"
placeholder="结束时间"
value={endTime}
onChange={changeEndTime}
style={{ marginRight: '10px' }}
allowClear={false}
/>
<Button onClick={() => setTime(1)}>1小时</Button>
<Button onClick={() => setTime(6)}>6小时</Button>
<Button onClick={() => setTime(12)}>12小时</Button>
<Button onClick={() => setTime(24)}>1</Button>
<Button onClick={() => setTime(24 * 7)}>1</Button>
</Col>
</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>
<div className={styles.serviceLog}>
<Row className={styles.head}>
<Col span={24}>
<span style={{ lineHeight: 2 }}>时间:</span>
<DatePicker
showTime
format="YYYY-MM-DD HH:mm:ss"
placeholder="起始时间"
value={startTime}
onChange={changeStartTime}
allowClear={false}
/>
<SwapRightOutlined style={{ lineHeight: 2 }} />
<DatePicker
showTime
format="YYYY-MM-DD HH:mm:ss"
placeholder="结束时间"
value={endTime}
onChange={changeEndTime}
style={{ marginRight: '10px' }}
allowClear={false}
/>
<Button onClick={() => setTime(1)}>1小时</Button>
<Button onClick={() => setTime(6)}>6小时</Button>
<Button onClick={() => setTime(12)}>12小时</Button>
<Button onClick={() => setTime(24)}>1</Button>
<Button onClick={() => setTime(24 * 7)}>1</Button>
</Col>
</Row>
<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,
}}
/>
</Spin>
<Spin spinning={loading} tip="loading">
<Row className={styles.chart}>
<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>
</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 @@
background: white;
}
.table{
height:calc(100vh - 452px);
overflow: auto;
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 - 500px);
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: 2px 0px;
padding:6px 10px;
}
}
margin: 1px 0;
padding:8px;
padding-right: 20px;
}
}
}
\ No newline at end of file
......@@ -10,17 +10,27 @@
background: white;
}
.table{
height:calc(100vh - 452px);
overflow: auto;
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 - 500px);
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: 2px 0px;
padding:6px 10px;
}
}
margin: 1px 0;
padding:8px;
padding-right: 20px;
}
}
}
\ No newline at end of file
import React, { useState, useEffect } from 'react';
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';
const { Item } = Form;
const { Option } = Select;
const SiteConfig = props => {
const { miniTitle, submitCallback } = props;
const { miniTitle, submitCallback, subType, addCallback } = props;
console.log(subType, 'ubType');
const [config, setConfig] = useState(''); // 网站配置信息
const [loginList, setLoginList] = useState([
{ text: '默认界面', value: 'default' },
......@@ -58,32 +63,63 @@ const SiteConfig = props => {
setLoading(true);
const obj = { ...form.getFieldsValue() };
let params = { ...obj, mode: 'single', client: 'miniapp' };
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');
if (subType === 'add') {
addWebsite(params, {
headers: {
'content-type':
'application/x-www-form-urlencggoded;charset=UTF-8',
},
})
.catch(err => {
setLoading(false);
});
.then(res => {
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 => {
>
<Input placeholder="请输入系统图标名称" allowClear />
</Item> */}
<Item label="系统图标预览:" name="shortcutIcon">
<Item
label="系统图标:"
name="shortcutIcon"
rules={[
{
required: true,
message: '请选择系统图标',
},
]}
>
<PicturesWall />
</Item>
......@@ -176,7 +221,7 @@ const SiteConfig = props => {
))}
</Select>
</Item>
<Item label="开启云登陆:" name="cloudLogin">
<Item label="开启云登陆:" name="cloudLogin" initialValue={false}>
<Radio.Group onChange={radioChange}>
<Radio value></Radio>
<Radio value={false}></Radio>
......
import React, { useState, useEffect } from 'react';
import { Card, Tabs } from 'antd';
import React, { useState, useEffect, useMemo } from 'react';
import { Card, Tabs, Button, Popconfirm, notification, Spin } from 'antd';
import ProCard from '@ant-design/pro-card';
import PageContainer from '@/components/BasePageContainer';
import {
miniAppSiteTree,
getMiniAppModuleTree,
deleteWebsite,
} from '@/services/mobileConfig/api';
import SiteConfig from './SiteConfig';
import MenuConfig from './menuconfig/MenuConfig';
......@@ -13,6 +14,10 @@ const MobileConfigPage = props => {
const [activeKey, setActiveKey] = useState('0'); // tabs活动页
const [miniTitle, setMiniTitle] = useState('');
const [flag, setFlag] = useState(1);
const [showConfig, setShowConfig] = useState(true);
const [loading, setLoading] = useState(false);
const [position, setPosition] = useState([]);
const [subType, setSubType] = useState('');
useEffect(() => {
// miniAppSiteTree({
// userMode: 'admin',
......@@ -21,18 +26,30 @@ const MobileConfigPage = props => {
// _dc: new Date().getTime(),
// node: -2,
// })
setLoading(true);
getMiniAppModuleTree({
userMode: 'admin',
}).then(res => {
setLoading(false);
console.log(res, 'res');
if (res.code === 0) {
const { data } = res;
const title = data[0].children[0].text || '熊猫掌天下小程序';
setMiniTitle(title);
if (data[0].children.length > 0) {
const title = data[0].children[0].text || '熊猫掌天下小程序';
setShowConfig(true);
setMiniTitle(title);
setPosition(['right']);
} else {
setPosition(['left']);
setShowConfig(false);
}
} else {
setShowConfig(false);
}
console.log(res);
});
}, [flag]);
useEffect(() => {
// getMiniAppModuleTree({
// userMode: 'super',
......@@ -46,13 +63,87 @@ const MobileConfigPage = props => {
};
const submitCallback = () => {
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 = [
{
title: '网站配置',
key: '0',
component: (
<SiteConfig miniTitle={miniTitle} submitCallback={submitCallback} />
<SiteConfig
miniTitle={miniTitle}
submitCallback={submitCallback}
subType={subType}
addCallback={addCallback}
/>
),
},
{
......@@ -64,14 +155,32 @@ const MobileConfigPage = props => {
return (
<PageContainer>
<ProCard>
<Tabs activeKey={activeKey} type="card" onChange={handleChange}>
{tabArr?.length > 0 &&
tabArr.map(item => (
<TabPane tab={item.title} key={item.key}>
{activeKey === item.key && item.component}
<Spin tip="loading..." spinning={loading}>
<Tabs
activeKey={activeKey}
type="card"
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>
))}
</Tabs>
)}
</Tabs>
</Spin>
</ProCard>
</PageContainer>
);
......
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import { Form, Input, Button, Row, Col } from 'antd';
import styles from './addForm.less';
import PicturesWall from '@/components/Upload/index';
import CheckList from './checkBox';
import checkStyles from './checkBox';
const { Item } = Form;
const AddForm = props => {
const { submitCallback, nodeType, nodeObj, addType, submitLoading } = props;
const {
submitCallback,
nodeType,
nodeObj,
addType,
submitLoading,
valueCallback,
addList,
} = props;
const [form] = Form.useForm();
const [otherForm] = Form.useForm();
console.log(nodeObj, 'nodeObj');
......@@ -27,6 +37,7 @@ const AddForm = props => {
const finish = () => {
submit();
};
useEffect(() => {}, [nodeObj, addType]);
return (
<div>
{(addType === 1 || addType === 2) && (
......@@ -186,6 +197,11 @@ const AddForm = props => {
<Item label="功能参数" name="funParam">
<Input />
</Item>
{/* <CheckList
nodeType={addType}
valueCallback={valueCallback}
addList={addList}
/> */}
<Item wrapperCol={{ offset: 5 }} style={{ marginTop: '40px' }}>
<Button type="primary" htmlType="submit" loading={submitLoading}>
提交
......
......@@ -2,12 +2,10 @@ import React, { useState, useEffect } from 'react';
import { Checkbox, Empty } from 'antd';
import styles from './checkBox.less';
const CheckList = props => {
const { info, valueCallback, nodeType } = props;
const { info = {}, valueCallback = () => {}, nodeType = '', addList } = props;
console.log(info, 'info');
const [list, setList] = useState([]);
const [checkList, setCheckList] = useState([]);
const [flag, setFlag] = useState(false);
const a = 'a';
const [addRoleList, setAddRoleList] = useState([]);
useEffect(() => {
if (info.pageUrl) {
let arr = [...info.relatedRoleList];
......@@ -17,21 +15,15 @@ const CheckList = props => {
arr2.push(item.relatedRoleCode);
}
});
console.log(arr2, 'arr2');
setCheckList(arr2);
setList(arr);
setFlag(true);
}
return () => {
setFlag(false);
setCheckList([]);
};
}, [info]);
useEffect(() => {
if (addList && addList.length > 0) {
setAddRoleList([...addList]);
}
}, [addList]);
const handleSelect = (e, val) => {
console.log(e.target, 'e', val);
let arr = [];
list.forEach(item => {
if (item.relatedRoleCode === val) {
item.related = e.target.checked;
......@@ -40,6 +32,15 @@ const CheckList = props => {
setList([...list]);
valueCallback(list);
};
const handleRoleSelect = (e, val) => {
addRoleList.forEach(item => {
if (item.roleCode === val) {
item.related = e.target.checked;
}
});
setAddRoleList([...addRoleList]);
valueCallback(addRoleList);
};
return (
<div>
{nodeType === 3 || nodeType === 4 ? (
......@@ -64,6 +65,25 @@ const CheckList = props => {
) : (
<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>
);
};
......
......@@ -3,6 +3,7 @@
padding: 10px;
margin-top: 10px;
flex-wrap: wrap;
border: 1px solid gray;
}
.check{
flex-shrink: 0;
......
......@@ -180,7 +180,6 @@ const EditForm = props => {
},
]}
>
{/* {otherForm.getFieldsValue().offlineImgUrl && <PicturesWall />} */}
<PicturesWall />
</Item>
)}
......
......@@ -2,8 +2,6 @@ import React, { useEffect, useState } from 'react';
import {
message,
notification,
Popconfirm,
Form,
Tree,
Tooltip,
Modal,
......@@ -18,7 +16,6 @@ import {
FileOutlined,
DeleteTwoTone,
} from '@ant-design/icons';
import PicturesWall from '@/components/Upload/index';
import classnames from 'classnames';
import {
miniAppSiteTree,
......@@ -27,6 +24,7 @@ import {
getMenuInfo,
deleteMenu,
editMenu,
getRoleListPlain,
} from '@/services/mobileConfig/api';
import styles from './miniMenu.less';
import AddForm from './AddForm';
......@@ -35,7 +33,7 @@ import CheckList from './checkBox';
const MiniMenu = props => {
const [flag, setFlag] = useState(1); // 刷新标志
const [treeFlage, setTreeFlag] = useState(true);
const [treeFlag, setTreeFlag] = useState(true);
const [treeData, setTreeData] = useState([]); // 树的数据
const [loading, setLoading] = useState(false); // 加载
const [menuID, setMenuID] = useState(''); // 选中的树ID
......@@ -45,18 +43,28 @@ const MiniMenu = props => {
const [addVisible, setAddVisible] = useState(false); // 新增弹窗
const [addTwoVisible, setAddTwoVisible] = useState(false); // 编辑弹窗
const [delVisible, setDelVisible] = useState(false); // 删除弹窗
const [addFlag, setAddFlag] = useState('root'); // 设置新增标志
const [nodeObj, setNodeObj] = useState({});
const [addType, setAddType] = useState(''); // 添加下级类型
const [modalTitle, setModalTitle] = useState('');
const [roleList, setRoleList] = useState([]); // 复选框选中的值
const [modalLoading, setModalLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const [addList, setAddList] = useState([]);
// 获取菜单树
useEffect(() => {
updateTrees();
}, [flag]);
useEffect(() => {
getRoleListPlain({
subSystemValue: 'miniapp',
_dc: Date.now(),
_version: 9999,
}).then(res => {
if (res.success) {
setAddList(res.list);
}
});
}, [flag]);
// 获取菜单信息
useEffect(() => {
getInfo();
......@@ -84,7 +92,7 @@ const MiniMenu = props => {
setTreeData(result);
console.log(result);
// 第一次加载,默认选择第一个组织
// if (treeFlage) {
// if (treeFlag) {
// handleSelect([result[0].menuID], false);
// setTreeFlag(false);
// }
......@@ -111,17 +119,17 @@ const MiniMenu = props => {
<div>{obj.text}</div>
<div className={styles.tip}>
{obj.menuType === 'MiniAppMenuGroup' && (
<Tooltip title="新增菜单组" className={styles.fs}>
<Tooltip title="新增菜单组" className={styles.fsize}>
<FolderAddTwoTone onClick={() => addMenuGroupTip(obj)} />
</Tooltip>
)}
{obj.menuType === 'MiniAppMenuGroupTwo' && (
<Tooltip title="新增功能菜单" className={styles.fs}>
<Tooltip title="新增功能菜单" className={styles.fsize}>
<FileAddTwoTone onClick={() => addMenuTip(obj)} />
</Tooltip>
)}
<Tooltip title="删除菜单" className={styles.fs}>
<Tooltip title="删除菜单" className={styles.fsize}>
<DeleteTwoTone onClick={() => deleteMenuTip(obj)} />
</Tooltip>
</div>
......@@ -131,10 +139,10 @@ const MiniMenu = props => {
icon:
obj.menuType !== 'MiniAppMenuThree' &&
obj.menuType !== 'MiniAppMenu' ? (
<FolderFilled />
) : (
<FileOutlined />
),
<FolderFilled />
) : (
<FileOutlined />
),
menuType: obj.menuType,
children: hasChild ? obj.children.map(i => mapTree(i)) : [],
};
......@@ -253,7 +261,7 @@ const MiniMenu = props => {
};
const rootAddGroup = () => {
setNodeObj('');
setNodeType(1);
// setNodeType(1);
setModalTitle('最上级列表');
setAddType(1);
setAddVisible(true);
......@@ -268,15 +276,18 @@ const MiniMenu = props => {
const rootAdd = () => {
setModalTitle('最上级列表');
setNodeObj('');
setNodeType(3);
// setNodeType(3);
setAddType(3);
setAddTwoVisible(true);
};
// 新增提交的回调
const submitCallback = (prop, item) => {
setSubmitLoading(true);
console.log(prop, item);
let obj = { ...prop };
// if (addType === 3 || addType === 4) {
// obj.relatedRoleList = String(roleList) || '';
// }
console.log(obj);
const parentID = item.menuID ? item.menuID : -1;
addMenu({
_dc: Date.now(),
......@@ -303,7 +314,6 @@ const MiniMenu = props => {
duration: 10,
});
}
console.log(res, 'resadd');
})
.catch(err => {
setSubmitLoading(false);
......@@ -350,7 +360,8 @@ const MiniMenu = props => {
});
};
const valueCallback = val => {
console.log(val);
console.log(val, 'val');
// relatedRoleCode
let arr = [...val];
let arr2 = [];
arr.map(item => {
......@@ -420,9 +431,6 @@ const MiniMenu = props => {
cancelText="取消"
okText="确认"
onCancel={() => setAddVisible(false)}
onConfirm={() => {
submitCallback();
}}
>
<AddForm
nodeType={nodeType}
......@@ -430,12 +438,19 @@ const MiniMenu = props => {
addType={addType}
submitCallback={submitCallback}
submitLoading={submitLoading}
valueCallback={valueCallback}
addList={addList}
/>
</Modal>
<Modal
visible={addTwoVisible}
title={`在${modalTitle}下新增功能菜单`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
bodyStyle={{
width: '100%',
minHeight: '100px',
maxHeight: '700px',
overflowY: 'scroll',
}}
style={{ top: 80 }}
width="600px"
destroyOnClose
......@@ -449,7 +464,9 @@ const MiniMenu = props => {
nodeType={nodeType}
nodeObj={nodeObj}
addType={addType}
addList={addList}
submitCallback={submitCallback}
valueCallback={valueCallback}
/>
</Modal>
<Modal
......
......@@ -65,7 +65,7 @@
width: 100%;
}
}
.fs{
.fsize{
font-size: 18px;
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 @@
.ant-dropdown-menu-item > .anticon:first-child {
vertical-align: 0.15em !important;
}
.ant-table-tbody{
.ant-table-row:hover>td{
background: #aed8fa !important;
}
}
}
.redText{
color: red;
......
......@@ -3,7 +3,7 @@
max-height: calc(100vh - 74px);
// overflow-y: scroll;
overflow: auto;
width: 260px;
width: 300px;
left: 0;
top: 0;
margin-right: 10px;
......
......@@ -2,7 +2,7 @@
min-height: calc(100vh - 75px);
max-height: calc(100vh - 75px);
overflow: auto;
width: 260px;
width: 300px;
left: 0;
top: 0;
margin-right: 10px;
......
......@@ -22,6 +22,7 @@ import CurrentSolution from '@/pages/database/CurrentSolution';
import UserManage from '../pages/userCenter/UserManage';
import RoleManage from '@/pages/userCenter/roleManage/RoleManage';
import SiteManage from '../pages/userCenter/siteManage/SiteManage';
import Dictionary from '../pages/platformCenter/dictionary';
import ServiceLog from '../pages/log/serviceLog';
import LoginLog from '../pages/log/loginLog';
import OmsLog from '../pages/log/omsLog';
......@@ -194,7 +195,7 @@ export default {
{
path: '/platformCenter/dictionary',
name: '数据字典',
component: Welcome,
component: Dictionary,
},
],
},
......
......@@ -81,6 +81,23 @@ export const editMenu = params =>
get('/Cityinterface/rest/services/OMS.svc/MiniApp_EditMenu', params);
// 删除菜单
export const 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