Commit 4c31a407 authored by 皮倩雯's avatar 皮倩雯

fix: '巡维保排序功能'

parent 7bcf7dc5
Pipeline #48247 skipped with stages
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Card, Space, Table, Popconfirm, Spin, Tooltip, notification } from 'antd'; import {
Form,
Card,
Space,
Table,
Popconfirm,
Spin,
Tooltip,
notification,
Input,
Button,
} from 'antd';
import { import {
DoubleLeftOutlined, DoubleLeftOutlined,
...@@ -8,12 +19,14 @@ import { ...@@ -8,12 +19,14 @@ import {
RightOutlined, RightOutlined,
EditTwoTone, EditTwoTone,
DeleteOutlined, DeleteOutlined,
SyncOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import classnames from 'classnames'; import classnames from 'classnames';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import { GetCM_Ledger_LoadLedgers, CM_Ledger_RmoveLedger } from '@/services/standingBook/api'; import { GetCM_Ledger_LoadLedgers, CM_Ledger_RmoveLedger } from '@/services/standingBook/api';
import AddModal from './BookConfig'; import AddModal from './BookConfig';
import styles from './standingBook.less'; import styles from './standingBook.less';
// import Search from 'antd/lib/transfer/search';
const StandingBook = props => { const StandingBook = props => {
const [allData, setAllData] = useState([]); const [allData, setAllData] = useState([]);
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
...@@ -26,7 +39,11 @@ const StandingBook = props => { ...@@ -26,7 +39,11 @@ const StandingBook = props => {
const [isType, setIsType] = useState(''); // 弹窗类型 const [isType, setIsType] = useState(''); // 弹窗类型
const [pickItem, setPickItem] = useState(''); const [pickItem, setPickItem] = useState('');
const [hoverItemIndex, setHoverItemIndex] = useState(0); // hover流程索引 const [hoverItemIndex, setHoverItemIndex] = useState(0); // hover流程索引
const [searchWord, setSearchWord] = useState(''); // 关键字
const [searchData, setSearchData] = useState([]);
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const { Item } = Form; const { Item } = Form;
const { Search } = Input;
const editor = record => { const editor = record => {
setFormObj(record); setFormObj(record);
...@@ -51,6 +68,7 @@ const StandingBook = props => { ...@@ -51,6 +68,7 @@ const StandingBook = props => {
key: 'name', key: 'name',
align: 'center', align: 'center',
width: 200, width: 200,
render: item => searchStyle(item),
}, },
{ {
...@@ -159,8 +177,10 @@ const StandingBook = props => { ...@@ -159,8 +177,10 @@ const StandingBook = props => {
}); });
console.log(arr); console.log(arr);
setAllData(arr); setAllData(arr);
setShowSearchStyle(false);
// 第一次进入展示第一页 不是第一次进入根据当前选择的来进行展示 // 第一次进入展示第一页 不是第一次进入根据当前选择的来进行展示
flag === 0 ? setPickItem(newArr[0]) : setPickItem(pickItem); flag === 0 ? setPickItem(newArr[0]) : setPickItem(pickItem);
pickItem ? setPickItem(pickItem) : setPickItem(newArr[0]);
console.log(newArr, 'newArr'); console.log(newArr, 'newArr');
setTableData(newArr); setTableData(newArr);
} }
...@@ -233,6 +253,52 @@ const StandingBook = props => { ...@@ -233,6 +253,52 @@ const StandingBook = props => {
setIsVisible(false); setIsVisible(false);
setFlag(flag + 1); setFlag(flag + 1);
}; };
const onSearch = () => {
console.log(searchWord);
console.log(pickItem);
setTreeLoading(true);
GetCM_Ledger_LoadLedgers({ accountName: searchWord }).then(res => {
setTreeLoading(false);
if (res.msg === 'Ok' && res.data.root) {
console.log(res.data.root);
setMaxLength(res.data.root.length + 1);
let arr = formateArrDataA(res.data.root, 'type');
let newArr = [];
Object.keys(arr).map((item, index) => {
newArr.push(item);
});
console.log(arr);
setShowSearchStyle(true);
setAllData(arr);
setSearchData(res.data.root);
setPickItem('');
// 第一次进入展示第一页 不是第一次进入根据当前选择的来进行展示
// flag === 0 ? setPickItem(newArr[0]) : setPickItem(pickItem);
console.log(newArr, 'newArr');
// setTableData(newArr);
}
});
};
const handleSearch = e => {
setSearchWord(e.target.value);
};
// 模糊查询匹配的样式
const searchStyle = val => {
let n;
if (showSearchStyle) {
n = val.replace(new RegExp(searchWord, 'g'), `<span style='color:red'>${searchWord}</span>`);
} else {
n = val;
}
return <div dangerouslySetInnerHTML={{ __html: n }} />;
};
const handleReset = () => {
setFlag(flag + 1);
setSearchWord('');
};
return ( return (
<PageContainer className={styles.userManageContainer}> <PageContainer className={styles.userManageContainer}>
<div className={styles.contentContainers}> <div className={styles.contentContainers}>
...@@ -324,31 +390,46 @@ const StandingBook = props => { ...@@ -324,31 +390,46 @@ const StandingBook = props => {
[styles.userContainerHide]: !treeVisible, [styles.userContainerHide]: !treeVisible,
})} })}
> >
<Table <div style={{ marginTop: '10px', marginLeft: '10px' }}>
size="small" <Search
rowKey="ID" style={{ width: 260 }}
bordered placeholder="台账名称"
onRow={record => { enterButton
return { onSearch={onSearch}
onDoubleClick: event => { onChange={e => handleSearch(e)}
event.stopPropagation(); value={searchWord}
editor(record); />
}, // 双击 <Button icon={<SyncOutlined />} onClick={handleReset}>
}; 重置
}} </Button>
columns={columns} </div>
dataSource={allData[pickItem]} <div style={{ marginTop: '10px' }}>
// loading={tableLoading} <Table
scroll={{ x: 'max-content', y: 'calc(100vh - 150px)' }} size="small"
// scroll={{ x: 'max-content' }} rowKey="ID"
pagination={{ bordered
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, onRow={record => {
pageSizeOptions: [10, 20, 50, 100], return {
defaultPageSize: 20, onDoubleClick: event => {
showQuickJumper: true, event.stopPropagation();
showSizeChanger: true, editor(record);
}} }, // 双击
/> };
}}
columns={columns}
dataSource={pickItem ? allData[pickItem] : searchData}
// loading={tableLoading}
scroll={{ x: 'max-content', y: 'calc(100vh - 180px)' }}
// scroll={{ x: 'max-content' }}
pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20,
showQuickJumper: true,
showSizeChanger: true,
}}
/>
</div>
</div> </div>
<AddModal <AddModal
visible={isVisible} visible={isVisible}
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
position: relative; position: relative;
.ant-table.ant-table-bordered > .ant-table-container { .ant-table.ant-table-bordered > .ant-table-container {
min-width: calc(100vw - 582px); min-width: calc(100vw - 582px);
height: calc(100vh - 120px); // height: calc(100vh - 175px);
overflow-x: hidden; overflow-x: hidden;
border: none; border: none;
} }
......
...@@ -431,29 +431,35 @@ const AddModal = props => { ...@@ -431,29 +431,35 @@ const AddModal = props => {
className="ue-editable-select-input" className="ue-editable-select-input"
onChange={inputType2} onChange={inputType2}
value={Type2} value={Type2}
placeholder="选择此计划关联的设备台账名称,如果没有请先配置台账管理台账名称为设备" placeholder="选择此计划关联的设备台账名称"
/> />
<Dropdown <Dropdown
placement="bottomRight" placement="bottomRight"
style={{ width: '430px' }} style={{ width: '430px' }}
overlay={ overlay={
<Menu> <Menu>
{treeData.length {treeData.length ? (
? treeData.map((item, index) => { treeData.map((item, index) => {
return ( return (
<Menu.Item <Menu.Item
onClick={() => { onClick={() => {
setType2(item); setType2(item);
form.setFieldsValue({ accountName: item }); form.setFieldsValue({ accountName: item });
}} }}
style={{ width: '430px', marginLeft: '-8px' }} style={{ width: '430px', marginLeft: '-8px' }}
key={index} key={index}
> >
{item} {item}
</Menu.Item> </Menu.Item>
); );
}) })
: ''} ) : (
<Menu.Item style={{ width: '430px', marginLeft: '-8px' }}>
<span style={{ color: 'red' }}>
暂无数据,请先配置台账管理台账名称为设备
</span>
</Menu.Item>
)}
</Menu> </Menu>
} }
> >
......
/*
* @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 } from 'antd';
import Sortable from 'sortablejs';
import styles from './maintenance.less';
import DragTable from '@/components/DragTable/DragTable';
const SortModal = props => {
const { callBackSubmit = () => {}, title, visible, onCancel, sortData } = props;
const [orderTable, setOrderTable] = useState([]);
const [flowIDs, setFlowIDs] = useState([]);
const onSumbit = () => {
console.log(flowIDs);
callBackSubmit({ str: flowIDs });
};
// 根据orderTable值改变flowIDs
useEffect(() => {
let ids = [];
orderTable.map(item => {
ids.push(item.id);
});
console.log(ids);
setFlowIDs(ids);
}, [orderTable]);
useEffect(() => {
console.log(sortData);
if (visible) {
setOrderTable(sortData);
}
}, [visible]);
// 拖拽回调函数
const dragCallBack = data => {
console.log(data);
if (data) {
setOrderTable(data);
}
};
const columns = [
{
title: '字段名',
dataIndex: 'businessName',
width: 150,
key: 'businessName',
},
];
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;
...@@ -2,10 +2,15 @@ ...@@ -2,10 +2,15 @@
/* eslint-disable camelcase */ /* eslint-disable camelcase */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Space, Table, Popconfirm, Tooltip, Button, notification } from 'antd'; import { Space, Table, Popconfirm, Tooltip, Button, notification } from 'antd';
import { CM_XWBPlan_DataList, CM_XWBPlan_RemovePlan } from '@/services/maintenance/api'; import {
import { EditTwoTone, DeleteOutlined, PlusOutlined } from '@ant-design/icons'; CM_XWBPlan_DataList,
CM_XWBPlan_RemovePlan,
CM_XWBPlan_ChangeOrder,
} from '@/services/maintenance/api';
import { EditTwoTone, DeleteOutlined, PlusOutlined, OrderedListOutlined } from '@ant-design/icons';
import styles from './maintenance.less'; import styles from './maintenance.less';
import AddModal from './AddModal'; import AddModal from './AddModal';
import SortModal from './SortModal';
const maintenance = () => { const maintenance = () => {
const [addVisible, setAddVisible] = useState(false); const [addVisible, setAddVisible] = useState(false);
...@@ -13,6 +18,7 @@ const maintenance = () => { ...@@ -13,6 +18,7 @@ const maintenance = () => {
const [formObj, setFormObj] = useState(''); const [formObj, setFormObj] = useState('');
const [treeLoading, setTreeLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false);
const [flag, setFlag] = useState(0); const [flag, setFlag] = useState(0);
const [sortVisible, setSortVisible] = useState(false);
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
const columns = [ const columns = [
...@@ -295,6 +301,32 @@ const maintenance = () => { ...@@ -295,6 +301,32 @@ const maintenance = () => {
setFlag(flag + 1); setFlag(flag + 1);
}; };
const sort = () => {
setSortVisible(true);
};
const onOK = prop => {
setSortVisible(false);
let aa = prop.str.toString();
console.log(aa);
CM_XWBPlan_ChangeOrder(aa).then(res => {
if (res.code === 0) {
notification.success({
message: '提示',
duration: 3,
description: '调整成功',
});
setFlag(flag + 1);
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
};
return ( return (
<div className={styles.maintenanceContainer}> <div className={styles.maintenanceContainer}>
<div className={styles.contentContainers}> <div className={styles.contentContainers}>
...@@ -303,13 +335,26 @@ const maintenance = () => { ...@@ -303,13 +335,26 @@ const maintenance = () => {
<Button <Button
icon={<PlusOutlined className={styles.icon} />} icon={<PlusOutlined className={styles.icon} />}
onClick={add} onClick={add}
type="primary"
style={{ style={{
marginLeft: '30px', marginLeft: '30px',
verticalAlign: 'middle', verticalAlign: 'middle',
marginTop: '10px', marginTop: '10px',
}} }}
> >
添加 <span style={{ marginTop: '-3px' }}>新增</span>
</Button>
<Button
icon={<OrderedListOutlined className={styles.icon} />}
onClick={sort}
type="primary"
style={{
marginLeft: '30px',
verticalAlign: 'middle',
marginTop: '10px',
}}
>
<span style={{ marginTop: '-3px' }}>调序</span>
</Button> </Button>
</span> </span>
</div> </div>
...@@ -345,6 +390,13 @@ const maintenance = () => { ...@@ -345,6 +390,13 @@ const maintenance = () => {
formObj={formObj} formObj={formObj}
placement="right" placement="right"
/> />
<SortModal
title="调整顺序"
visible={sortVisible}
sortData={tableData}
onCancel={() => setSortVisible(false)}
callBackSubmit={onOK}
/>
</div> </div>
</div> </div>
); );
......
...@@ -33,6 +33,15 @@ ...@@ -33,6 +33,15 @@
} }
} }
} }
.cardContent {
height: 30rem;
overflow-y: scroll;
overflow-x: scroll;
width: 100%;
}
.doctorTable {
margin-bottom: 16px;
}
.linkDrowp { .linkDrowp {
position: absolute; position: absolute;
top: 0px; top: 0px;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2022-04-06 11:38:46 * @Date: 2022-04-06 11:38:46
* @LastEditTime: 2022-04-15 16:45:47 * @LastEditTime: 2022-04-19 17:16:39
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
...@@ -239,7 +239,7 @@ const DrawBoardManage = () => { ...@@ -239,7 +239,7 @@ const DrawBoardManage = () => {
{ {
title: '模型类型', title: '模型类型',
align: 'center', align: 'center',
width: 200,
dataIndex: 'typeName', dataIndex: 'typeName',
key: 'typeName', key: 'typeName',
render: (text, record) => { render: (text, record) => {
...@@ -259,7 +259,7 @@ const DrawBoardManage = () => { ...@@ -259,7 +259,7 @@ const DrawBoardManage = () => {
{ {
title: '模型名称', title: '模型名称',
align: 'center', align: 'center',
width: 300,
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
render: (text, record) => { render: (text, record) => {
...@@ -274,7 +274,7 @@ const DrawBoardManage = () => { ...@@ -274,7 +274,7 @@ const DrawBoardManage = () => {
{ {
title: '图像', title: '图像',
align: 'center', align: 'center',
width: 200,
dataIndex: 'modelPath', dataIndex: 'modelPath',
key: 'modelPath', key: 'modelPath',
render: (text, record) => { render: (text, record) => {
...@@ -316,7 +316,7 @@ const DrawBoardManage = () => { ...@@ -316,7 +316,7 @@ const DrawBoardManage = () => {
title: '设计者', title: '设计者',
align: 'center', align: 'center',
dataIndex: 'people', dataIndex: 'people',
width: 100, width: 80,
key: 'people', key: 'people',
render: (text, record) => { render: (text, record) => {
const obj = { const obj = {
...@@ -330,7 +330,7 @@ const DrawBoardManage = () => { ...@@ -330,7 +330,7 @@ const DrawBoardManage = () => {
{ {
title: '创建日期', title: '创建日期',
align: 'center', align: 'center',
width: 250, width: 150,
dataIndex: 'createTime', dataIndex: 'createTime',
key: 'createTime', key: 'createTime',
render: (text, record) => { render: (text, record) => {
...@@ -345,7 +345,7 @@ const DrawBoardManage = () => { ...@@ -345,7 +345,7 @@ const DrawBoardManage = () => {
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
width: 200, width: 150,
key: 'action', key: 'action',
render: record => { render: record => {
let aa = ( let aa = (
...@@ -382,6 +382,7 @@ const DrawBoardManage = () => { ...@@ -382,6 +382,7 @@ const DrawBoardManage = () => {
title: '添加子模型', title: '添加子模型',
align: 'center', align: 'center',
dataIndex: 'stateModel', dataIndex: 'stateModel',
width: 100,
key: 'stateModel', key: 'stateModel',
render: (text, record) => { render: (text, record) => {
const obj = { const obj = {
...@@ -622,8 +623,7 @@ const DrawBoardManage = () => { ...@@ -622,8 +623,7 @@ const DrawBoardManage = () => {
<Card style={{ width: '100%', height: 'calc(100vh - 130px)' }}> <Card style={{ width: '100%', height: 'calc(100vh - 130px)' }}>
<div style={{ display: 'flex', justifyContent: 'space-around', width: '100%' }}> <div style={{ display: 'flex', justifyContent: 'space-around', width: '100%' }}>
{/* 左侧类型树 */} {/* 左侧类型树 */}
<div style={{ minWidth: '250px' }}>
<div style={{ width: '250px' }}>
<Spin spinning={treeLoading} tip="loading..."> <Spin spinning={treeLoading} tip="loading...">
<div <div
style={{ display: 'flex', justifyContent: 'space-between', alignContent: 'center' }} style={{ display: 'flex', justifyContent: 'space-between', alignContent: 'center' }}
...@@ -707,9 +707,7 @@ const DrawBoardManage = () => { ...@@ -707,9 +707,7 @@ const DrawBoardManage = () => {
</div> </div>
{/* 右侧表格 */} {/* 右侧表格 */}
<div <div style={{ marginLeft: '20px', marginTop: '-10px', overflow: 'scroll' }}>
style={{ width: '1400px', marginLeft: '20px', marginTop: '-10px', overflow: 'scroll' }}
>
<div <div
style={{ style={{
height: '41px', height: '41px',
...@@ -781,7 +779,8 @@ const DrawBoardManage = () => { ...@@ -781,7 +779,8 @@ const DrawBoardManage = () => {
columns={columns} columns={columns}
dataSource={tableData} dataSource={tableData}
loading={tableLoading} loading={tableLoading}
scroll={{ x: 'max-content', y: 'calc(100vh - 262px)' }} style={{ minWidth: '100%' }}
scroll={{ y: 'calc(100vh - 262px)', x: '800px' }}
onExpand={onUnfold} onExpand={onUnfold}
onRow={record => ({ onRow={record => ({
// onDoubleClick: event => { // onDoubleClick: event => {
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
.ant-card-body { .ant-card-body {
padding: 12px; padding: 12px;
} }
.ant-table-body {
width: 100%;
}
.listItem { .listItem {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2022-04-06 11:39:53 * @Date: 2022-04-06 11:39:53
* @LastEditTime: 2022-04-15 15:35:27 * @LastEditTime: 2022-04-19 17:24:27
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
...@@ -107,7 +107,6 @@ const ModelFileManage = () => { ...@@ -107,7 +107,6 @@ const ModelFileManage = () => {
dataIndex: 'name', dataIndex: 'name',
align: 'center', align: 'center',
key: 'name', key: 'name',
width: 400,
render: item => searchStyle(item), render: item => searchStyle(item),
}, },
{ {
...@@ -115,7 +114,6 @@ const ModelFileManage = () => { ...@@ -115,7 +114,6 @@ const ModelFileManage = () => {
dataIndex: 'templet', dataIndex: 'templet',
align: 'center', align: 'center',
key: 'templet', key: 'templet',
width: 200,
render: (text, record, index) => ( render: (text, record, index) => (
<span> <span>
{record.templet ? ( {record.templet ? (
...@@ -166,7 +164,6 @@ const ModelFileManage = () => { ...@@ -166,7 +164,6 @@ const ModelFileManage = () => {
dataIndex: 'thumbnailURL', dataIndex: 'thumbnailURL',
align: 'center', align: 'center',
key: 'thumbnailURL', key: 'thumbnailURL',
width: 400,
render: text => ( render: text => (
<Image <Image
src={window.location.origin + `/Publish/Web/File/Sketch/Preview/${text}`} src={window.location.origin + `/Publish/Web/File/Sketch/Preview/${text}`}
...@@ -177,6 +174,7 @@ const ModelFileManage = () => { ...@@ -177,6 +174,7 @@ const ModelFileManage = () => {
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
width: 200,
align: 'center', align: 'center',
render: record => ( render: record => (
<Space size="middle"> <Space size="middle">
...@@ -480,7 +478,7 @@ const ModelFileManage = () => { ...@@ -480,7 +478,7 @@ const ModelFileManage = () => {
<Pagination <Pagination
style={{ float: 'right', marginTop: '10px' }} style={{ float: 'right', marginTop: '10px' }}
total={total} total={total}
showTotal={item => `共 ${item} 条`} showTotal={(aa, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`}
defaultPageSize={pageSize} defaultPageSize={pageSize}
defaultCurrent={1} defaultCurrent={1}
pageSizeOptions={[10, 20, 40, 100]} pageSizeOptions={[10, 20, 40, 100]}
......
...@@ -11,20 +11,49 @@ import { ...@@ -11,20 +11,49 @@ import {
Checkbox, Checkbox,
Radio, Radio,
Tooltip, Tooltip,
Divider,
Row,
Col,
} from 'antd'; } from 'antd';
import { PlusOutlined, InfoCircleOutlined } from '@ant-design/icons'; import { PlusOutlined, InfoCircleOutlined } from '@ant-design/icons';
import WebConfigForm from './webConfigForm'; import WebConfigForm from './webConfigForm';
import Upload from '@/components/Upload'; import Upload from '@/components/Upload';
import styles from './siteConfigDrawer.less'; import styles from './siteConfigDrawer.less';
const { Option } = Select; const { Option } = Select;
const plainOptions = ['搜索', '首页', '常用', '工单', '消息'];
const defaultCheckedList = ['搜索', '首页', '常用', '工单', '消息'];
export default props => { export default props => {
const { visible, onClose, config, hasIntegerate, isEdit, onOk, submitting, productList } = props; const { visible, onClose, config, hasIntegerate, isEdit, onOk, submitting, productList } = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
const [loginPages, setLoginPages] = useState([]); const [loginPages, setLoginPages] = useState([]);
const [checkedList, setCheckedList] = useState([]);
const [indeterminate, setIndeterminate] = useState(false);
const [checkAll, setCheckAll] = useState(true);
const CheckboxGroup = Checkbox.Group;
useEffect(() => { useEffect(() => {
onGetLoginPages(); onGetLoginPages();
}, []); console.log(isEdit);
if (isEdit) {
if (config) {
setCheckedList(config.topMenu.split(','));
if (config.topMenu.split(',').length == 1 && config.topMenu.split(',')[0] == '') {
setIndeterminate(false);
} else {
setIndeterminate(
!!config.topMenu.split(',').length &&
config.topMenu.split(',').length < plainOptions.length,
);
}
setCheckAll(config.topMenu.split(',').length === plainOptions.length);
}
} else {
setCheckedList(defaultCheckedList);
setIndeterminate(false);
setCheckAll(true);
}
}, [visible]);
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
...@@ -54,6 +83,11 @@ export default props => { ...@@ -54,6 +83,11 @@ export default props => {
const onsubmit = () => { const onsubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
console.log(validate);
console.log(checkedList);
console.log(checkedList.toString());
validate.topMenu = checkedList.toString();
console.log(validate);
if (validate) { if (validate) {
onOk({ onOk({
...validate, ...validate,
...@@ -63,6 +97,18 @@ export default props => { ...@@ -63,6 +97,18 @@ export default props => {
} }
}); });
}; };
const onCheckAllChange = e => {
setCheckedList(e.target.checked ? plainOptions : []);
setIndeterminate(false);
setCheckAll(e.target.checked);
};
const onChange = list => {
setCheckedList(list);
setIndeterminate(!!list.length && list.length < plainOptions.length);
setCheckAll(list.length === plainOptions.length);
};
return ( return (
<Drawer <Drawer
title={isEdit ? '查看/编辑网站配置' : '新增网站'} title={isEdit ? '查看/编辑网站配置' : '新增网站'}
...@@ -206,6 +252,19 @@ export default props => { ...@@ -206,6 +252,19 @@ export default props => {
<Radio value={false}></Radio> <Radio value={false}></Radio>
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
<Form.Item name="topMenu" label="功能配置">
<Checkbox
indeterminate={indeterminate}
onChange={onCheckAllChange}
checked={checkAll}
style={{ marginTop: '5px' }}
>
全选
</Checkbox>
<br />
<br />
<CheckboxGroup options={plainOptions} value={checkedList} onChange={onChange} />
</Form.Item>
</Form> </Form>
</Drawer> </Drawer>
); );
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
overflow-y: scroll; overflow-y: scroll;
// overflow: auto; // overflow: auto;
overflow: hidden; overflow: hidden;
width: 410px; width: 320px;
left: 0; left: 0;
top: 0; top: 0;
margin-right: 10px; margin-right: 10px;
......
...@@ -771,83 +771,83 @@ const SiteManageV2 = () => { ...@@ -771,83 +771,83 @@ const SiteManageV2 = () => {
<Button onClick={restButton}>重置</Button> <Button onClick={restButton}>重置</Button>
</Card> </Card>
<div style={{ background: '#fff' }}> <div style={{ background: '#fff' }}>
<Card <Spin spinning={checkLoading} tip="loading...">
className={classnames({ <Card
[styles.boxH]: treeVisible, className={classnames({
[styles.cardBoxR]: true, [styles.boxH]: treeVisible,
})} [styles.cardBoxR]: true,
> })}
<div
style={{
display: 'flex',
flexDirection: 'column ',
height: 'calc(100vh - 240px)',
}}
> >
{/* <Checkbox className={styles.siteAll}>全选/反选</Checkbox> */}
{dataList.length > 0 && !visibleParams.loading ? (
<>
<p className={styles.siteline}>已选择列表:</p>
<div
className={styles.siteSelectList}
style={{
height: selectedState ? '1200px' : '220px',
transition: 'height 0.5s',
}}
>
<ul className={styles.siteSelectUl}>
{selectList.map((item, index) => (
<li
key={`${item.userName}${item.groupId}${index}`}
onClick={() => handleDel(index)}
>
{`${item.userName}(${item.groupName})`}
</li>
))}
</ul>
</div>
<div style={{ textAlign: 'center', margin: '10px 0' }}>
<Tooltip title="收起">
<CaretUpOutlined
style={{
fontSize: '20px',
color: '#178BF6',
display: selectedState ? 'block' : 'none',
}}
onClick={() => setSelectedState(false)}
/>
</Tooltip>
<Tooltip title="展开">
<CaretDownOutlined
style={{
fontSize: '20px',
color: '#178BF6',
display: selectedState ? 'none' : 'block',
}}
onClick={() => setSelectedState(true)}
/>
</Tooltip>
</div>
<div className={styles.siteBtn}>
<Button
type="primary"
className={styles.siteCommit}
onClick={handleCommitBtn}
>
提交
</Button>
</div>
</>
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
<div <div
style={{ style={{
overflowY: 'scroll', display: 'flex',
flexGrow: '1', flexDirection: 'column ',
height: 'calc(100vh - 240px)',
}} }}
> >
<Spin spinning={checkLoading} tip="loading..."> {/* <Checkbox className={styles.siteAll}>全选/反选</Checkbox> */}
{dataList.length > 0 && !visibleParams.loading ? (
<>
<p className={styles.siteline}>已选择列表:</p>
<div
className={styles.siteSelectList}
style={{
height: selectedState ? '1200px' : '220px',
transition: 'height 0.5s',
}}
>
<ul className={styles.siteSelectUl}>
{selectList.map((item, index) => (
<li
key={`${item.userName}${item.groupId}${index}`}
onClick={() => handleDel(index)}
>
{`${item.userName}(${item.groupName})`}
</li>
))}
</ul>
</div>
<div style={{ textAlign: 'center', margin: '10px 0' }}>
<Tooltip title="收起">
<CaretUpOutlined
style={{
fontSize: '20px',
color: '#178BF6',
display: selectedState ? 'block' : 'none',
}}
onClick={() => setSelectedState(false)}
/>
</Tooltip>
<Tooltip title="展开">
<CaretDownOutlined
style={{
fontSize: '20px',
color: '#178BF6',
display: selectedState ? 'none' : 'block',
}}
onClick={() => setSelectedState(true)}
/>
</Tooltip>
</div>
<div className={styles.siteBtn}>
<Button
type="primary"
className={styles.siteCommit}
onClick={handleCommitBtn}
>
提交
</Button>
</div>
</>
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
<div
style={{
overflowY: 'scroll',
flexGrow: '1',
}}
>
{dataList.map((item, index) => ( {dataList.map((item, index) => (
<Panels <Panels
{...item} {...item}
...@@ -858,10 +858,10 @@ const SiteManageV2 = () => { ...@@ -858,10 +858,10 @@ const SiteManageV2 = () => {
handleChangeSignel={handleChangeSignel} handleChangeSignel={handleChangeSignel}
/> />
))} ))}
</Spin> </div>
</div> </div>
</div> </Card>
</Card> </Spin>
{dataList.length > 0 && !visibleParams.loading ? ( {dataList.length > 0 && !visibleParams.loading ? (
<div style={{ textAlign: 'right', marginTop: '25px' }}> <div style={{ textAlign: 'right', marginTop: '25px' }}>
<Pagination <Pagination
......
/* eslint-disable camelcase */
/* /*
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2021-09-27 09:42:21 * @Date: 2021-09-27 09:42:21
* @LastEditTime: 2021-09-27 16:49:28 * @LastEditTime: 2022-04-19 14:56:50
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index'; import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index';
...@@ -26,3 +27,7 @@ export const CM_XWBPlan_RemovePlan = query => ...@@ -26,3 +27,7 @@ export const CM_XWBPlan_RemovePlan = query =>
// 巡维保计划数据编辑OR添加 // 巡维保计划数据编辑OR添加
export const CM_XWBPlan_DataEditORAdd = data => export const CM_XWBPlan_DataEditORAdd = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_DataEditORAdd`, data); post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_DataEditORAdd`, data);
// 巡维保计划数据编辑OR添加
export const CM_XWBPlan_ChangeOrder = planIds =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_ChangeOrder?planIds=${planIds}`);
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