Commit ea0ef603 authored by tianfen's avatar tianfen

style: fix styles

parent 84294082
Pipeline #21497 skipped with stages
const rm = require('rimraf'); const rm = require('rimraf');
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const chalk = require('chalk'); const chalk = require('chalk');
const ora = require('ora') const ora = require('ora');
const webpackConfig = require('./webpack.prod.babel') const webpackConfig = require('./webpack.prod.babel');
const spinner = ora('building for production...'); const spinner = ora('building for production...');
// const Diff = require('diff'); // const Diff = require('diff');
/* eslint-disable */ /* eslint-disable */
......
...@@ -8,7 +8,9 @@ module.exports = options => ({ ...@@ -8,7 +8,9 @@ module.exports = options => ({
entry: options.entry, entry: options.entry,
output: Object.assign( output: Object.assign(
{ {
path: process.env.npm_config_releasepath ? path.resolve(process.env.npm_config_releasepath, 'civmanage'): path.resolve(process.cwd(), 'civmanage'), path: process.env.npm_config_releasepath
? path.resolve(process.env.npm_config_releasepath, 'civmanage')
: path.resolve(process.cwd(), 'civmanage'),
publicPath: process.env.PUBLIC_PATH || '/civmanage/', publicPath: process.env.PUBLIC_PATH || '/civmanage/',
}, },
options.output, options.output,
......
...@@ -17,7 +17,7 @@ module.exports = require('./webpack.base.babel')({ ...@@ -17,7 +17,7 @@ module.exports = require('./webpack.base.babel')({
], ],
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets // Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
//[chunkhash:8] [chunkhash:8] // [chunkhash:8] [chunkhash:8]
output: { output: {
filename: 'static/[name].[chunkhash:8].js', filename: 'static/[name].[chunkhash:8].js',
chunkFilename: 'static/[name].[chunkhash:8].chunk.js', chunkFilename: 'static/[name].[chunkhash:8].chunk.js',
......
...@@ -12,12 +12,22 @@ import { ...@@ -12,12 +12,22 @@ import {
Space, Space,
Collapse, Collapse,
Checkbox, Checkbox,
Select Select,
} from 'antd'; } from 'antd';
import lodash from 'lodash'; import lodash from 'lodash';
import { DoubleLeftOutlined, DoubleRightOutlined,DownOutlined,UpOutlined } from '@ant-design/icons'; import {
DoubleLeftOutlined,
DoubleRightOutlined,
DownOutlined,
UpOutlined,
} from '@ant-design/icons';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import {getWebModuleTree,chooseUserToStation,getAllGroup,getStationUserList} from '@/services/userCenter/siteManage/api'; import {
getWebModuleTree,
chooseUserToStation,
getAllGroup,
getStationUserList,
} from '@/services/userCenter/siteManage/api';
import ListCard, { import ListCard, {
checkChildrenByCondition, checkChildrenByCondition,
getId, getId,
...@@ -40,22 +50,22 @@ const SiteManage = props => { ...@@ -40,22 +50,22 @@ const SiteManage = props => {
const [treeData, setTreeData] = useState([]); // 树结构数据 const [treeData, setTreeData] = useState([]); // 树结构数据
const [currentStation, setCurrentStation] = useState({}); // 当前选中站点 const [currentStation, setCurrentStation] = useState({}); // 当前选中站点
const [searchWord, setSearchWord] = useState(''); // 关键字 const [searchWord, setSearchWord] = useState(''); // 关键字
const [visibleParams,setvisibleParams]=useState({ const [visibleParams, setvisibleParams] = useState({
modalVisible:false,//新增弹窗 modalVisible: false, // 新增弹窗
delVisible:false,//删除弹窗 delVisible: false, // 删除弹窗
editVisible:false,//修改弹窗 editVisible: false, // 修改弹窗
spinLoading:false,//加载弹窗 spinLoading: false, // 加载弹窗
btnLoading:false, btnLoading: false,
loading:false, loading: false,
checkBoxLoading:false checkBoxLoading: false,
}) });
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
const [dataList, setdataList] = useState([]); const [dataList, setdataList] = useState([]);
const [mulu, setMulu] = useState(true); const [mulu, setMulu] = useState(true);
const [optionsList,setOptionsList]=useState([]) const [optionsList, setOptionsList] = useState([]);
//侧边栏站点 // 侧边栏站点
useEffect(() => { useEffect(() => {
handleShowModal('spinLoading',true) handleShowModal('spinLoading', true);
getWebModuleTree({ getWebModuleTree({
userMode: userMode || 'super', userMode: userMode || 'super',
select: '', select: '',
...@@ -64,7 +74,7 @@ const SiteManage = props => { ...@@ -64,7 +74,7 @@ const SiteManage = props => {
node: -2, node: -2,
}) })
.then(res => { .then(res => {
handleShowModal('spinLoading',false) handleShowModal('spinLoading', false);
let arr = []; let arr = [];
if (res) { if (res) {
arr.push(res.find(item => item.id === 'Web4StationRoot')); arr.push(res.find(item => item.id === 'Web4StationRoot'));
...@@ -83,69 +93,67 @@ const SiteManage = props => { ...@@ -83,69 +93,67 @@ const SiteManage = props => {
} }
}) })
.catch(err => { .catch(err => {
handleShowModal('spinLoading',false) handleShowModal('spinLoading', false);
console.error(err); console.error(err);
}); });
}, [flag]); }, [flag]);
//右边对应的机构 // 右边对应的机构
useEffect(() => { useEffect(() => {
if (!currentStation.stationID) return; if (!currentStation.stationID) return;
handleShowModal('loading',true) handleShowModal('loading', true);
getAllGroup({stationId: currentStation.stationID,}).then(res=>{ getAllGroup({ stationId: currentStation.stationID }).then(res => {
if(res.code===0){ if (res.code === 0) {
let data=res.data; let { data } = res;
// for(let i=0;i<2000;i++){ // for(let i=0;i<2000;i++){
// data.push({ // data.push({
// GroupId:i+10000, // GroupId:i+10000,
// GroupName:`测试${i}` // GroupName:`测试${i}`
// }) // })
// } // }
handleShowModal('loading',false) handleShowModal('loading', false);
setdataList(data) setdataList(data);
setOptionsList(data) setOptionsList(data);
} }
}) });
}, [currentStation]); }, [currentStation]);
//弹出模态框 // 弹出模态框
const handleShowModal=(key,value)=>{ const handleShowModal = (key, value) => {
setvisibleParams({...visibleParams,[key]:value}); setvisibleParams({ ...visibleParams, [key]: value });
} };
// 获取搜索框的值 // 获取搜索框的值
const handleSearch = value => { const handleSearch = value => {
if(value){ if (value) {
dataList.forEach(item=>{ dataList.forEach(item => {
item.color=item.GroupName.indexOf(value)>-1?'#f00':'#333' item.color = item.GroupName.indexOf(value) > -1 ? '#f00' : '#333';
}) });
setdataList(lodash.cloneDeep(dataList)) setdataList(lodash.cloneDeep(dataList));
setSearchWord(value); setSearchWord(value);
} }
}; };
//搜索框点击进行锚点链接跳转 // 搜索框点击进行锚点链接跳转
const handleChange = value => { const handleChange = value => {
if(value){ if (value) {
let index=dataList.findIndex(item=>item.GroupId===value) let index = dataList.findIndex(item => item.GroupId === value);
dataList.forEach(item=>{ dataList.forEach(item => {
item.color='#333' item.color = '#333';
}) });
dataList[index].color='#f00' dataList[index].color = '#f00';
setdataList(lodash.cloneDeep(dataList)) setdataList(lodash.cloneDeep(dataList));
let anchorElement = document.getElementById(`siteId${value}`); let anchorElement = document.getElementById(`siteId${value}`);
anchorElement.scrollIntoView() anchorElement.scrollIntoView();
} }
}; };
const confirmModal = e => { const confirmModal = e => {
handleShowModal('modalVisible',false) handleShowModal('modalVisible', false);
setFlag(flag + 1); setFlag(flag + 1);
}; };
const delModal = () => { const delModal = () => {
handleShowModal('delVisible',false) handleShowModal('delVisible', false);
setFlag(flag + 1); setFlag(flag + 1);
}; };
const editModal = () => { const editModal = () => {
handleShowModal('editVisible',false) handleShowModal('editVisible', false);
setFlag(flag + 1); setFlag(flag + 1);
}; };
const handleHide = () => { const handleHide = () => {
...@@ -166,52 +174,59 @@ const SiteManage = props => { ...@@ -166,52 +174,59 @@ const SiteManage = props => {
{t.text} {t.text}
</List.Item> </List.Item>
)); ));
const handleChangeCollpase=(groupId,isShow)=>{ const handleChangeCollpase = (groupId, isShow) => {
let index=dataList.findIndex(item=>item.GroupId==groupId) let index = dataList.findIndex(item => item.GroupId == groupId);
dataList[index].isShow=!isShow dataList[index].isShow = !isShow;
if(dataList[index].children&&dataList[index].children.length>0){ if (dataList[index].children && dataList[index].children.length > 0) {
setdataList(lodash.cloneDeep(dataList)) setdataList(lodash.cloneDeep(dataList));
return; return;
} }
handleShowModal('loading',true) handleShowModal('loading', true);
getStationUserList({stationID:currentStation.stationID,groupId}).then(res=>{ getStationUserList({ stationID: currentStation.stationID, groupId }).then(
if(res.code===0&&res.data){ res => {
handleShowModal('loading',false) if (res.code === 0 && res.data) {
dataList[index].children=res.data; handleShowModal('loading', false);
setdataList(lodash.cloneDeep(dataList)) dataList[index].children = res.data;
} setdataList(lodash.cloneDeep(dataList));
}) }
} },
//每组全选全不选 );
const handleChangeAll=(e,index)=>{ };
dataList[index].isChecked=e.target.checked // 每组全选全不选
dataList[index].selectList=e.target.checked?dataList[index].userList:[] const handleChangeAll = (e, index) => {
dataList[index].children&&dataList[index].children.forEach(item=>{ dataList[index].isChecked = e.target.checked;
item.isChecked=e.target.checked dataList[index].selectList = e.target.checked
}) ? dataList[index].userList
setdataList(lodash.cloneDeep(dataList)) : [];
} dataList[index].children &&
//单个选择checkbox dataList[index].children.forEach(item => {
const handleChangeSignel=(e,index,vIndex)=>{ item.isChecked = e.target.checked;
dataList[index].children[vIndex].isChecked=e.target.checked; });
let checked=dataList[index].children.filter(item=>item.isChecked).length==dataList[index].children.length setdataList(lodash.cloneDeep(dataList));
dataList[index].isChecked=checked };
let selectArray=dataList[index].children.filter(item=>item.isChecked) // 单个选择checkbox
dataList[index].selectList=selectArray const handleChangeSignel = (e, index, vIndex) => {
setdataList(lodash.cloneDeep(dataList)) dataList[index].children[vIndex].isChecked = e.target.checked;
} let checked =
//提交 dataList[index].children.filter(item => item.isChecked).length ==
const handleCommitBtn=()=>{ dataList[index].children.length;
handleShowModal('btnLoading',true) dataList[index].isChecked = checked;
let result=[] let selectArray = dataList[index].children.filter(item => item.isChecked);
//数据处理成后台需要的格式 dataList[index].selectList = selectArray;
dataList.forEach(item=>{ setdataList(lodash.cloneDeep(dataList));
if(item.selectList&&item.selectList.length>0){ };
let idArr=item.selectList.map(v=>v.userID) // 提交
item.isChecked&&idArr.push(item.id) const handleCommitBtn = () => {
result.push(...idArr) handleShowModal('btnLoading', true);
let result = [];
// 数据处理成后台需要的格式
dataList.forEach(item => {
if (item.selectList && item.selectList.length > 0) {
let idArr = item.selectList.map(v => v.userID);
item.isChecked && idArr.push(item.id);
result.push(...idArr);
} }
}) });
chooseUserToStation( chooseUserToStation(
qs.stringify({ qs.stringify({
userList: String(result.flat()), userList: String(result.flat()),
...@@ -224,8 +239,8 @@ const SiteManage = props => { ...@@ -224,8 +239,8 @@ const SiteManage = props => {
}, },
) )
.then(res => { .then(res => {
handleShowModal('btnLoading',false) handleShowModal('btnLoading', false);
if (res.success) { if (res.success) {
notification.success({ notification.success({
message: '提示', message: '提示',
...@@ -241,10 +256,10 @@ const SiteManage = props => { ...@@ -241,10 +256,10 @@ const SiteManage = props => {
} }
}) })
.catch(err => { .catch(err => {
handleShowModal('btnLoading',false) handleShowModal('btnLoading', false);
console.log(err); console.log(err);
}); });
} };
return ( return (
<PageContainer> <PageContainer>
{/* <Row> {/* <Row>
...@@ -268,19 +283,19 @@ const SiteManage = props => { ...@@ -268,19 +283,19 @@ const SiteManage = props => {
</Spin> </Spin>
<AddModal <AddModal
visible={visibleParams.modalVisible} visible={visibleParams.modalVisible}
onCancel={()=>handleShowModal('modalVisible',false)} onCancel={() => handleShowModal('modalVisible', false)}
confirmModal={confirmModal} confirmModal={confirmModal}
/> />
<DelModal <DelModal
visible={visibleParams.delVisible} visible={visibleParams.delVisible}
stationId={currentStation.stationID} stationId={currentStation.stationID}
onCancel={()=>handleShowModal('delVisible',false)} onCancel={() => handleShowModal('delVisible', false)}
confirmModal={delModal} confirmModal={delModal}
/> />
<EditModal <EditModal
visible={visibleParams.editVisible} visible={visibleParams.editVisible}
stationObj={currentStation} stationObj={currentStation}
onCancel={()=>handleShowModal('editVisible',false)} onCancel={() => handleShowModal('editVisible', false)}
confirmModal={editModal} confirmModal={editModal}
/> />
<div> <div>
...@@ -338,7 +353,7 @@ const SiteManage = props => { ...@@ -338,7 +353,7 @@ const SiteManage = props => {
<Col span={1}>搜索</Col> <Col span={1}>搜索</Col>
<Col span={8}> <Col span={8}>
<Select <Select
style={{width:'100%'}} style={{ width: '100%' }}
showSearch showSearch
placeholder={placeholder} placeholder={placeholder}
onSearch={handleSearch} onSearch={handleSearch}
...@@ -347,18 +362,20 @@ const SiteManage = props => { ...@@ -347,18 +362,20 @@ const SiteManage = props => {
option.children.indexOf(input) >= 0 option.children.indexOf(input) >= 0
} }
> >
{optionsList.map(item=>{ {optionsList.map(item => (
return <Option key={item.GroupId} value={item.GroupId}>{item.GroupName}</Option> <Option key={item.GroupId} value={item.GroupId}>
})} {item.GroupName}
</Option>
))}
</Select> </Select>
</Col> </Col>
{/* <Col span={3} /> */} {/* <Col span={3} /> */}
<Col span={15} style={{textAlign:'right'}}> <Col span={15} style={{ textAlign: 'right' }}>
<Space size="small"> <Space size="small">
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
handleShowModal('modalVisible',true); handleShowModal('modalVisible', true);
}} }}
> >
新增 新增
...@@ -366,9 +383,11 @@ const SiteManage = props => { ...@@ -366,9 +383,11 @@ const SiteManage = props => {
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
handleShowModal('editVisible',true); handleShowModal('editVisible', true);
}} }}
disabled={!currentStation.stationID || visibleParams.spinLoading} disabled={
!currentStation.stationID || visibleParams.spinLoading
}
> >
编辑 编辑
</Button> </Button>
...@@ -376,9 +395,11 @@ const SiteManage = props => { ...@@ -376,9 +395,11 @@ const SiteManage = props => {
danger danger
type="primary" type="primary"
onClick={() => { onClick={() => {
handleShowModal('delVisible',true); handleShowModal('delVisible', true);
}} }}
disabled={!currentStation.stationID || visibleParams.spinLoading} disabled={
!currentStation.stationID || visibleParams.spinLoading
}
> >
删除 删除
</Button> </Button>
...@@ -386,22 +407,35 @@ const SiteManage = props => { ...@@ -386,22 +407,35 @@ const SiteManage = props => {
</Col> </Col>
</Row> </Row>
</Card> </Card>
<Card className={classnames({ [styles.boxH]: mulu, [styles.cardBoxR]: true, })}> <Card
className={classnames({
[styles.boxH]: mulu,
[styles.cardBoxR]: true,
})}
>
{/* <Checkbox className={styles.siteAll}>全选/反选</Checkbox> */} {/* <Checkbox className={styles.siteAll}>全选/反选</Checkbox> */}
<Spin spinning={visibleParams.loading}> <Spin spinning={visibleParams.loading}>
{dataList.map((item,index)=>{ {dataList.map((item, index) => (
return <Panels {...item} <Panels
index={index} {...item}
key={item.GroupId} index={index}
key={item.GroupId}
handleChangeCollpase={handleChangeCollpase} handleChangeCollpase={handleChangeCollpase}
handleChangeAll={handleChangeAll} handleChangeAll={handleChangeAll}
handleChangeSignel={handleChangeSignel} handleChangeSignel={handleChangeSignel}
/> />
})} ))}
</Spin> </Spin>
{dataList.length?<Button type='primary' className={styles.siteCommit} onClick={handleCommitBtn}>提交</Button>:null} {dataList.length ? (
<Button
type="primary"
className={styles.siteCommit}
onClick={handleCommitBtn}
>
提交
</Button>
) : null}
</Card> </Card>
</div> </div>
</div> </div>
{/* </Col> {/* </Col>
...@@ -410,28 +444,58 @@ const SiteManage = props => { ...@@ -410,28 +444,58 @@ const SiteManage = props => {
); );
}; };
const Panels = React.memo(props => {
const Panels=React.memo((props)=>{ let { index, GroupId, GroupName, children, isChecked, isShow, color } = props;
let {index,GroupId,GroupName,children,isChecked,isShow,color}=props; return (
return <div className={styles.sitePanel} key={GroupId} id={`siteId${GroupId}`}> <div className={styles.sitePanel} key={GroupId} id={`siteId${GroupId}`}>
<div className={styles.sitePanelHead} onClick={()=>props.handleChangeCollpase(GroupId,isShow)}> <div
{isShow?<UpOutlined className={styles.siteIcon}/>:<DownOutlined className={styles.siteIcon}/>} className={styles.sitePanelHead}
<p style={{color:color}}>{GroupName}</p> onClick={() => props.handleChangeCollpase(GroupId, isShow)}
>
{isShow ? (
<UpOutlined className={styles.siteIcon} />
) : (
<DownOutlined className={styles.siteIcon} />
)}
<p style={{ color }}>{GroupName}</p>
</div> </div>
{isShow? {isShow ? (
<div className={styles.sitePanelCon}> <div className={styles.sitePanelCon}>
<Checkbox key={'0'} className={styles.siteList} checked={isChecked} onClick={(e)=>props.handleChangeAll(e,index)}>全选</Checkbox> <Checkbox
{children&&children.map((v,vIndex)=>{ key="0"
return <CheckBoxRow {...v} index={index} vIndex={vIndex} key={v.userID} handleChangeSignel={props.handleChangeSignel}/> className={styles.siteList}
})} checked={isChecked}
</div>:null onClick={e => props.handleChangeAll(e, index)}
} >
全选
</Checkbox>
{children &&
children.map((v, vIndex) => (
<CheckBoxRow
{...v}
index={index}
vIndex={vIndex}
key={v.userID}
handleChangeSignel={props.handleChangeSignel}
/>
))}
</div>
) : null}
</div> </div>
}) );
});
const CheckBoxRow=React.memo((props)=>{ const CheckBoxRow = React.memo(props => {
let {vIndex,index,isChecked,userName}=props; let { vIndex, index, isChecked, userName } = props;
return <Checkbox className={styles.siteList} checked={isChecked} onClick={(e)=>props.handleChangeSignel(e,index,vIndex)}>{userName}</Checkbox> return (
}) <Checkbox
className={styles.siteList}
checked={isChecked}
onClick={e => props.handleChangeSignel(e, index, vIndex)}
>
{userName}
</Checkbox>
);
});
export default React.memo(appConnector(SiteManage)); export default React.memo(appConnector(SiteManage));
import { get, post, CITY_SERVICE,PUBLISH_SERVICE } from '@/services/index'; import { get, post, CITY_SERVICE, PUBLISH_SERVICE } from '@/services/index';
/* /*
** params ** params
...@@ -31,11 +31,10 @@ export const chooseUserToStation = (params, options) => ...@@ -31,11 +31,10 @@ export const chooseUserToStation = (params, options) =>
export const getUserByStation = params => export const getUserByStation = params =>
get(`${CITY_SERVICE}/OMS.svc/P_GetUserByStation`, params); get(`${CITY_SERVICE}/OMS.svc/P_GetUserByStation`, params);
//获取站点一级列表 // 获取站点一级列表
export const getAllGroup = params => export const getAllGroup = params =>
get(`${PUBLISH_SERVICE}/UserCenter/GetAllGroup`, params); get(`${PUBLISH_SERVICE}/UserCenter/GetAllGroup`, params);
//获取站点二级列表 // 获取站点二级列表
export const getStationUserList = params => export const getStationUserList = params =>
get(`${PUBLISH_SERVICE}/UserCenter/GetStationUserList`, params); get(`${PUBLISH_SERVICE}/UserCenter/GetStationUserList`, params);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment