Commit fa85fdea authored by 涂伟's avatar 涂伟
parents c2f12f37 debfd17b
Pipeline #71259 passed with stages
......@@ -93,7 +93,7 @@
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-react": "^1.0.6",
"@wisdom-cesium/cesium": "1.1.12",
"@wisdom-cesium/krpano": "^1.0.29-45",
"@wisdom-cesium/krpano": "^1.0.29-52",
"@wisdom-map/amap": "1.1.0-beta.45",
"@wisdom-map/arcgismap": "1.4.0-147",
"@wisdom-map/basemap": "1.1.0-24",
......@@ -122,7 +122,7 @@
"js-calendar-converter": "0.0.4",
"lodash": "4.17.11",
"minimist": "1.2.0",
"panda-xform": "^4.0.3",
"panda-xform": "4.0.5",
"prop-types": "15.7.2",
"quill": "^1.3.7",
"rc-tween-one": "^3.0.6",
......
/*
* @Description:
* @Author: leizhe
* @Date: 2022-01-13 10:47:32
* @LastEditTime: 2022-04-19 14:49:15
* @LastEditors: leizhe
*/
/* eslint-disable array-callback-return */
/* eslint-disable no-plusplus */
import React, { useState, useEffect } from 'react';
import { Modal, notification } from 'antd';
import Sortable from 'sortablejs';
import styles from './SortModal.less';
import DragTable from '@/components/DragTable/DragTable';
import { SortScheme } from '@/services/webConfig/api';
const SortModal = props => {
const { callBackSubmit = () => {}, title, visible, onCancel, sortData } = props;
const [orderTable, setOrderTable] = useState([]);
const [flowIDs, setFlowIDs] = useState([]);
const onSumbit = () => {
SortScheme({ sortName: flowIDs.toString() }).then(res => {
if (res.code === '0') {
callBackSubmit();
onCancel();
notification.success({
message: '提示',
duration: 3,
description: '调整成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
};
// 根据orderTable值改变flowIDs
useEffect(() => {
let ids = [];
orderTable.map(item => {
ids.push(item.schemename);
});
setFlowIDs(ids);
}, [orderTable]);
useEffect(() => {
if (visible) {
setOrderTable(sortData);
}
}, [visible]);
// 拖拽回调函数
const dragCallBack = data => {
if (data) {
setOrderTable(data);
}
};
const columns = [
{
title: '字段名',
dataIndex: 'schemename',
width: 150,
key: 'schemename',
},
];
return (
<Modal
title={title}
visible={visible}
onCancel={onCancel}
onOk={onSumbit}
okText="确认"
cancelText="取消"
>
<div
className={styles.cardContent}
style={{ width: '26rem', marginLeft: '24px', maxHeight: '400px', overflow: 'auto' }}
>
<div className={styles.doctorTable}>
<DragTable
bordered
style={{ marginBottom: '10px' }}
rowKey={record => record.id}
columns={columns}
dataSource={orderTable}
showHeader={false}
pagination={false}
size="small"
dragCallBack={dragCallBack}
ItemTypes="flowOrder"
/>
</div>
</div>
</Modal>
);
};
export default SortModal;
.cardContent {
height: 30rem;
overflow-y: scroll;
overflow-x: scroll;
width: 100%;
}
.doctorTable {
margin-bottom: 16px;
}
\ No newline at end of file
......@@ -8,10 +8,13 @@
/* eslint-disable indent */
import { Button, Spin, Empty } from 'antd';
import React, { useState, useEffect } from 'react';
import { OrderedListOutlined } from '@ant-design/icons';
import styles from '../SchemeConfig.less';
import { GetMaplayerByTerminalType, GettMaplayer } from '@/services/webConfig/api';
import AddModal from './AddModal';
import Cards from './components/card';
import SortModal from './SortModal';
const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [tileData, setTileData] = useState([]); // 页面初始化数据
......@@ -22,6 +25,7 @@ const VectorData = props => {
const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({});
const [keepData, setKeepData] = useState([]);
const [sortVisible, setSortVisible] = useState(false);
const onSubmit = prop => {
setVisible(false);
......@@ -36,7 +40,6 @@ const VectorData = props => {
setVisible(true);
};
useEffect(() => {
console.log(1212);
renderTile();
}, [flag]);
......@@ -53,13 +56,10 @@ const VectorData = props => {
if (res.code == '0') {
let arr = [];
res.data.general.baseMap.layers.map(i => {
console.log(i);
arr.push(i.servicename);
});
console.log(arr);
setKeepData(arr);
let list = [];
console.log(resdata.data);
resdata.data.map((j, index) => {
let data = [];
let aa = [];
......@@ -71,23 +71,17 @@ const VectorData = props => {
}
});
list.push(j.schemename);
console.log(aa);
console.log(data);
let bb = aa.concat(data);
console.log(bb);
let i = bb.indexOf(j.baseMap[j.defaultBaseMap]);
resdata.data[index].defaultOldBaseMap = j.baseMap;
resdata.data[index].baseMap = bb;
resdata.data[index].defaultBaseMap = i;
});
console.log(list);
setNameData(list);
console.log(resdata.data);
setTileData(resdata.data);
}
});
} else {
console.log(3456);
setTreeLoading(false);
}
});
......@@ -95,9 +89,30 @@ const VectorData = props => {
useEffect(() => {
setCardFlag(true);
}, [tileData]);
const onOK = () => {
setFlag(flag + 1);
};
const handleSort = () => {
setSortVisible(true);
};
return (
<>
<div className={styles.tileBtn}>
<Button
icon={<OrderedListOutlined className={styles.icon} />}
onClick={() => {
handleSort();
}}
style={{
verticalAlign: 'middle',
marginRight: '10px',
}}
>
排序
</Button>
<Button
type="primary"
onClick={() => {
......@@ -143,6 +158,13 @@ const VectorData = props => {
keepData={keepData}
nameData={nameData}
/>
<SortModal
title="调整顺序"
visible={sortVisible}
sortData={tileData}
onCancel={() => setSortVisible(false)}
callBackSubmit={onOK}
/>
</div>
</Spin>
</div>
......
import React, { useState, useEffect } from 'react';
import { Modal, Form, Select, Input, Checkbox } from 'antd';
import lodash from 'lodash';
import styles from './HomeConfigModal.less';
import { GetRoleGroups } from '@/services/webConfig/api';
const { Option } = Select;
const HomeConfigModal = props => {
const { handleCancel, productList, visible, onFinish, currentPageConfig, client } = props;
const [form] = Form.useForm();
const [checkList, setCheckList] = useState(null);
useEffect(() => {
if (visible) {
form.setFieldsValue(currentPageConfig);
getCheckList();
} else {
setCheckList(null);
form.resetFields();
}
}, [visible]);
// 保存配置
const onSubmit = () => {
let roleName = [];
let roleId = [];
const getArr = arr => {
arr.roleGroups.forEach(item => {
if (item.roleGroups) {
getArr(item);
} else if (item.isCheck) {
roleName.push(item.roleName);
roleId.push(item.roleId);
}
});
};
getArr(checkList);
console.log(checkList, { ...form.getFieldsValue(), roleName, roleId });
onFinish({
...form.getFieldsValue(),
roleName: roleName.join(','),
roleId,
keyIndex: currentPageConfig.keyIndex,
});
handleCancel();
};
const getCheckList = () => {
console.log(client, 'client');
if (!client) {
return;
}
GetRoleGroups({ client }).then(res => {
if (res.code === 0) {
let childList = [];
let defaultList = [];
const chekMap = new Set(currentPageConfig.roleId);
res.data.forEach(item => {
if (item.groupName !== '默认') {
let checks = [];
item.roleGroups.forEach(ele => {
if (chekMap.has(ele.roleId)) {
checks.push(ele);
}
});
if (checks.length === item.roleGroups.length) {
item.indeterminate = false;
item.isCheck = true;
} else if (checks.length === 0) {
item.indeterminate = false;
item.isCheck = false;
} else {
item.indeterminate = true;
item.isCheck = false;
}
childList.push(item);
} else {
defaultList = item.roleGroups;
}
});
console.log(chekMap, currentPageConfig, 'chekMap');
let list = {
groupName: '关联角色',
isCheck: false,
roleGroups: [...defaultList, ...childList].map((item, index) => {
let obj = {
groupName: item.groupName,
isCheck: item.isCheck,
indeterminate: item.indeterminate,
index: [index],
roleGroups: item.roleGroups?.map((ele, i) => ({
...ele,
isCheck: chekMap.has(ele.roleId),
index: [index, i],
})),
};
let ojbChild = { ...item, isCheck: chekMap.has(item.roleId), index: [index] };
return item.roleGroups ? obj : ojbChild;
}),
};
console.log(list, 'list');
setCheckList(list);
}
});
};
// 多选
const changeAll = (e, item) => {
console.log(item, 'itemasjdf');
let list = lodash.cloneDeep(checkList);
let current = item.index
? item.index.reduce((acc, cur) => (acc.roleGroups ? acc.roleGroups[cur] : acc), list)
: list;
console.log(current);
current.isCheck = e.target.checked;
checkAll(e.target.checked, current.roleGroups);
current.indeterminate = false;
setCheckList(list);
};
const checkAll = (checked, list) => {
list.forEach(item => {
if (item.roleGroups) {
checkAll(checked, item.roleGroups);
}
item.isCheck = checked;
});
};
const onChange = (e, item) => {
let list = lodash.cloneDeep(checkList);
console.log(item.index, list, 'asfd');
let current = item.index.reduce(
(acc, cur) => (acc.roleGroups ? acc.roleGroups[cur] : acc),
list,
);
console.log(current, 'current');
current.isCheck = e.target.checked;
let parentIndex = [...item.index];
parentIndex.pop();
let allCurrent = parentIndex.reduce(
(acc, cur) => (acc.roleGroups ? acc.roleGroups[cur] : acc),
list,
);
console.log(allCurrent, 'allCurrent');
let num = allCurrent?.roleGroups?.filter(ele => ele.isCheck).length;
if (num === allCurrent.roleGroups.length) {
allCurrent.indeterminate = false;
allCurrent.isCheck = true;
} else if (num === 0) {
allCurrent.indeterminate = false;
allCurrent.isCheck = false;
} else {
allCurrent.indeterminate = true;
}
setCheckList(list);
};
const checkRender = list => {
console.log(list, 'fasldfjaslkdjf');
let num = list?.roleGroups?.filter(ele => ele.isCheck || ele.indeterminate).length;
return (
<>
<div className={styles.checkList}>
{list?.groupName && (
<div className={styles.title}>
<Checkbox
onChange={e => changeAll(e, list)}
checked={num === list?.roleGroups.length}
indeterminate={num > 0 && num < list?.roleGroups.length}
>
{list?.groupName}
</Checkbox>
</div>
)}
{list?.roleGroups.map(item => {
return (
<>
{item.roleGroups ? (
checkRender(item)
) : (
<Checkbox
onChange={e => onChange(e, item)}
style={{ width: '150px', marginLeft: '0px', marginBottom: '10px' }}
checked={item.isCheck}
>
{item.roleName}
</Checkbox>
)}
</>
);
})}
</div>
</>
);
};
return (
<Modal
width={800}
title="主页配置"
visible={visible}
onCancel={handleCancel}
maskClosable={false}
onOk={onSubmit}
destroyOnClose
>
<div className={styles.content}>
<Form
form={form}
labelCol={{ span: 3 }}
wrapperCol={{ span: 21 }}
initialValues={{ remember: true }}
>
<Form.Item label="产品类型" name="productType">
<Select placeholder="请选择主页产品类型">
{productList.map(item => (
<Option value={item.PackageName} key={item.PackageName}>
{`${item.ProductName}(${item.PackageName})`}
</Option>
))}
</Select>
</Form.Item>
<Form.Item label="主页Url" name="homePage">
<Input placeholder="请输入主页路径" autoComplete="off" />
</Form.Item>
</Form>
<div className={styles.roleCheck}>{checkRender(checkList)}</div>
</div>
</Modal>
);
};
export default HomeConfigModal;
.content {
max-height: 600px;
overflow-y: scroll
}
.checkList {
display: flex;
flex-wrap: wrap;
width: 100%;
border: 1px solid #c2cdfd;
padding: 20px 15px 10px 15px;
position: relative;
margin-top: 15px;
align-items: center;
// margin-bottom: 10px;
border-radius: 5px;
.title {
position: absolute;
top: -12px;
background-color: #fff;
}
}
\ No newline at end of file
import React, { useState, useRef, forwardRef, useImperativeHandle, useEffect } from 'react';
import DragTable from '@/components/DragTable/DragTable';
import { Button, Space, Tooltip } from 'antd';
import { DeleteOutlined } from '@ant-design/icons';
import lodash from 'lodash';
import HomeConfigModal from './HomeConfigModal';
import styles from './HomePageConfigs.less';
const HomePageConfigs = (props, ref) => {
const { productList, client, roleHomePages } = props;
const [orderTable, setOrderTable] = useState([]);
const [visible, setVisible] = useState(false);
const [modalType, setModalType] = useState();
const [currentPageConfig, setCurrentPageConfig] = useState({});
const count = useRef(0);
useImperativeHandle(ref, () => ({
getHomePageConfig: () => orderTable,
}));
useEffect(() => {
console.log(roleHomePages, 'homePageConfig');
if (!roleHomePages) {
return;
}
let list = roleHomePages.map(item => {
let obj = { ...item, keyIndex: count.current };
count.current += 1;
return obj;
});
setOrderTable(list);
}, [roleHomePages]);
// 拖拽回调函数
const dragCallBack = data => {
if (data) {
console.log(data);
setOrderTable(data);
}
};
const addHomePage = () => {
let obj = {
productType: productList[0].PackageName,
homePage: '',
roleld: [],
roleName: [],
keyIndex: count.current,
};
setModalType('add');
setCurrentPageConfig(obj);
setVisible(true);
};
const delUser = (e, index) => {
e.stopPropagation();
let list = lodash.cloneDeep(orderTable);
list.splice(index, 1);
setOrderTable(list);
};
const onsubmit = val => {
let list = lodash.cloneDeep(orderTable);
console.log(list, currentPageConfig);
if (modalType === 'add') {
count.current += 1;
list.push(val);
} else {
let index = list.findIndex(item => item.keyIndex === currentPageConfig.keyIndex);
list[index] = val;
}
setOrderTable(list);
};
const columns = [
// {
// title: '序号',
// dataIndex: 'index',
// width: 50,
// key: 'index',
// },
{
title: '产品类型',
dataIndex: 'productType',
width: 100,
key: 'productType',
},
{
title: '主页Url',
dataIndex: 'homePage',
width: 150,
key: 'homePage',
ellipsis: {
showTitle: false,
},
render: (text, record, index) => (
<Tooltip placement="left" title={text}>
{text}
</Tooltip>
),
},
{
title: '角色',
dataIndex: 'roleName',
width: 150,
key: 'roleName',
ellipsis: {
showTitle: false,
},
render: (text, record, index) => <Tooltip title={text}>{text}</Tooltip>,
},
{
title: '操作',
dataIndex: '',
width: 80,
align: 'center',
key: '',
render: (text, record, index) => (
<>
<Space>
{/* <Tooltip title="编辑默认承办人">
<EditTwoTone
onClick={() => toEdit(record, index)}
style={{ fontSize: '16px', color: '#1890FF' }}
/>
</Tooltip> */}
<DeleteOutlined
onClick={e => delUser(e, index)}
style={{ fontSize: '16px', color: '#e86060' }}
/>
</Space>
</>
),
},
];
return (
<>
<div className={styles.btnBox}>
<Button onClick={addHomePage}>新增角色主页配置</Button>
</div>
<DragTable
bordered
style={{ marginBottom: '10px' }}
rowKey={record => record.keyIndex}
columns={columns}
dataSource={orderTable}
pagination={false}
size="small"
dragCallBack={dragCallBack}
onClick={record => {
setCurrentPageConfig(record);
setVisible(true);
setModalType('edit');
console.log(record);
}}
ItemTypes="homePageOrder"
scroll={{
y: 500,
}}
/>
<HomeConfigModal
visible={visible}
modalType={modalType}
productList={productList}
client={client}
currentPageConfig={currentPageConfig}
onFinish={val => onsubmit(val)}
handleCancel={() => setVisible(false)}
/>
</>
);
};
export default forwardRef(HomePageConfigs);
.btnBox {
margin-bottom: 10px;
}
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { getLoginPage, getMapCofigs, getWebThemes, getProductList } from '@/services/webConfig/api';
import { SketchPicker } from 'react-color';
import {
......@@ -24,6 +24,7 @@ import ColorLinear from './ColorLinear';
import Upload from '@/components/Upload';
import styles from './siteConfigDrawer.less';
import ParmarModal from './ParmarModal';
import HomePageConfigs from './HomePageConfigs';
const { Option } = Select;
const plainOptions = ['搜索', '消息', '反馈'];
const defaultCheckedList = ['搜索', '消息', '反馈'];
......@@ -77,7 +78,8 @@ export default props => {
const [visibleChecked4, setVisibleChecked4] = useState(''); // 语音播报开关
const [visibleChecked5, setVisibleChecked5] = useState(''); // 菜单样式开关
const [visibleChecked7, setVisibleChecked7] = useState(''); // 地图遮罩开关
const [homePageConfig, setHomePageConfig] = useState();
const homepageConfigRef = useRef();
useEffect(() => {
onGetLoginPages();
let text = [];
......@@ -145,6 +147,7 @@ export default props => {
setVisibleChecked2(config.hideMap);
setVisibleChecked4(config.messageVoice);
setVisibleChecked7(config.useCoverMap == 'true');
setHomePageConfig(config.roleHomePages);
form.setFieldsValue({
...config,
primaryColor: config.primaryColor ? config.primaryColor : '#0087F7',
......@@ -173,6 +176,7 @@ export default props => {
setVisibleChecked4(true);
setVisibleChecked5(true);
setVisibleChecked7(true);
setHomePageConfig([]);
form.setFieldsValue({
shortcutIcon: 'assets\\images\\icon\\熊猫-蓝色.png',
logo: 'assets\\images\\logo\\熊猫-蓝绿色.svg',
......@@ -199,6 +203,7 @@ export default props => {
setVisibleChecked3('');
setVisibleChecked4('');
setVisibleChecked5('');
setHomePageConfig([]);
}
}, [visible]);
const onGetLoginPages = () => {
......@@ -263,6 +268,9 @@ export default props => {
const colorIndex = colorList.findIndex(item => item.color === validate.primaryColor);
onOk({
...validate,
roleHomePages: homepageConfigRef.current
.getHomePageConfig()
.map((item, index) => ({ ...item, index })),
headerPrimaryColor: colorList[colorIndex].headerColor,
mode: 'single',
menu: 'banner-left',
......@@ -439,7 +447,7 @@ export default props => {
<Divider orientation="left" style={{ borderTopColor: '#99bbe8' }}>
主页配置
</Divider>
<Form.Item label="产品类型" name="productType">
<Form.Item label="产品类型(默认)" name="productType">
<Select placeholder="请选择主页产品类型">
{productList.map(item => (
<Option value={item.PackageName} key={item.PackageName}>
......@@ -448,12 +456,19 @@ export default props => {
))}
</Select>
</Form.Item>
<Form.Item label="主页Url" name="homePage">
<Form.Item label="主页地址(默认)" name="homePage">
<Input placeholder="请输入主页路径" autoComplete="off" />
</Form.Item>
<HomePageConfigs
ref={homepageConfigRef}
roleHomePages={homePageConfig}
productList={productList}
client={form.getFieldValue('client')}
/>
<Divider orientation="left" style={{ borderTopColor: '#99bbe8' }}>
主题配置
</Divider>
{/* <Form.Item name="headerPrimaryColor" label="顶部">
<div className={styles.colorBox}>
<div
......
......@@ -7,7 +7,7 @@ import 'ace-builds/src-noconflict/mode-json';
import 'ace-builds/src-noconflict/theme-solarized_light';
const ConfigWrapper = props => {
const { value, children, onChange, ...rest } = props;
const { value, children, onChange, id, ...rest } = props;
const [text, setText] = useState('');
const [visible, setVisible] = useState(false);
......@@ -44,7 +44,7 @@ const ConfigWrapper = props => {
err = true;
}
if (!err) {
saveConfigContent(value, JSON.stringify(JSON.parse(text), null, 4))
saveConfigContent(value, JSON.stringify(JSON.parse(text), null, 4), id)
.then(res => {
if (res.code === 0) {
notification.success({
......
......@@ -49,8 +49,8 @@ const EditForm = props => {
};
// 回显表单
useEffect(() => {
console.log(info);
console.log(infoAll);
console.log(info, 'info');
console.log(infoAll, 'infoalll');
form.resetFields();
otherForm.resetFields();
setPlainOptions(info);
......@@ -111,7 +111,6 @@ const EditForm = props => {
const submit = () => {
const targetForm = nodeType === 1 ? form : otherForm;
let obj = targetForm.getFieldsValue();
console.log(obj);
console.log(plainOptions);
let data = [];
if (nodeType == 1) {
......@@ -125,7 +124,18 @@ const EditForm = props => {
} else {
obj.relatedRoleList = '';
}
console.log(productList, 'productlIST');
let arr = obj.pageUrl.split('/'); // 用const声明常量
const product = productList.find(item => item.PackageName.includes(arr[0]));
if (product) {
arr.shift();
obj.pageUrl = arr.join('/');
}
console.log(product, 'product');
obj.product = product?.PackageName || 'civweb4';
}
console.log(obj, 'fadas');
submitCallback(obj);
};
......@@ -301,7 +311,7 @@ const EditForm = props => {
<Item label="菜单别名" name="shortName" style={{ marginLeft: '11px' }}>
<Input placeholder="请输入菜单别名" style={{ width: '100%' }} />
</Item>
<Item label="产品类型" name="product" style={{ marginLeft: '11px' }}>
{/* <Item label="产品类型" name="product" style={{ marginLeft: '11px' }}>
<Select placeholder="请选择产品类型" allowClear style={{ width: '100%' }}>
{productList &&
productList.length > 0 &&
......@@ -311,7 +321,7 @@ const EditForm = props => {
</Option>
))}
</Select>
</Item>
</Item> */}
<Item
label="菜单图标"
name="imageUrl"
......@@ -359,7 +369,7 @@ const EditForm = props => {
</div>
</Item>
<Item label="配置文件" name="config" style={{ marginLeft: '11px' }}>
<EditeConfigWrapper>
<EditeConfigWrapper id={infoAll.menuID}>
<Select
allowClear
showSearch
......
......@@ -95,8 +95,9 @@ export const getWebMenuInfo = param =>
// },
// );
export const saveConfigContent = (fileName, content) =>
export const saveConfigContent = (fileName, content, id) =>
post(`${PUBLISH_SERVICE}/PlatformCenter/SaveConfigContent`, {
id,
fileName,
web4ConfigContent: content,
});
......@@ -329,3 +330,8 @@ export const BatchDragSingleWebsite = data =>
post(`${PUBLISH_SERVICE}/WebSite/BatchDragSingleWebsite`, data);
export const QueryBaseMapItems = param => get(`${PANDA_GIS}/MapLayer/QueryBaseMapItems`, param);
// 通过client获取角色
export const GetRoleGroups = param => get(`${PUBLISH_SERVICE}/UserCenter/GetRoleGroups`, param);
export const SortScheme = param => get(`${PANDA_GIS}/MapLayer/SortScheme`, 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