Commit 039c5669 authored by cellee's avatar cellee

新增小区添加到搜索列表

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 6cb9bebd
import React from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { Table, Tag, Space, Button, Radio, Row, Col, Input, Checkbox } from 'antd';
import { connect } from 'dva';
import { gray } from 'chalk';
import { StarOutlined, StarFilled, StarTwoTone , DownOutlined, UpOutlined } from '@ant-design/icons';
import { StarOutlined, StarFilled, StarTwoTone, DownOutlined, UpOutlined } from '@ant-design/icons';
import { indexOf } from 'lodash';
import { useIntl, getLocale } from 'umi';
......@@ -58,8 +58,8 @@ class SelectOptions extends React.Component {
constructor(props) {
super(props);
const { list, dispatch, checklist } = this.props;
// console.log(list)
// console.log(checklist)
console.log(checklist);
if (list == null) {
//console.error("组件错误:没有数据导入")
}
......@@ -81,17 +81,16 @@ class SelectOptions extends React.Component {
menuList: ArrayToPingYin.get(list),
checkedListOptions: list,
checkedList: checklist,
indeterminate: list.sort().toString() == checklist.sort().toString() ? false : true, // 多选框 总框的 状态
checkAll: list.sort().toString() == checklist.sort().toString() ? true : false, // 判断传递来的小区是不是全选
indeterminate: list.sort().toString() == checklist.sort().toString() ? false : true, // 多选框 总框的 状态
checkAll: list.sort().toString() == checklist.sort().toString() ? true : false, // 判断传递来的小区是不是全选
checkNone: false,
resultList: checklist,
flag: false,
lastValue: null,
};
}
}
componentDidUpdate() {
componentDidUpdate(prevProps) {
if (this.props.show != null) {
if (this.props.show == this.state.flag) {
console.log(this.props.show);
......@@ -102,6 +101,21 @@ class SelectOptions extends React.Component {
}
console.log(this.state.componetVisible);
}
if (this.props.list !== prevProps.list) {
// 发生改变重新赋值
this.setState({
menuList: ArrayToPingYin.get(this.props.list),
checkedListOptions: this.props.list,
checkedList: this.props.single != null ? [] : this.props.list,
indeterminate: false,
checkAll: true,
checkNone: false,
resultList: this.props.single != null ? [] : this.props.list,
flag: false,
lastValue: null,
});
}
}
}
componentDidMount() {
......@@ -300,14 +314,12 @@ class SelectOptions extends React.Component {
</div>
<div style={{ width: '100%', backgroundColor: '#eeeeee', userSelect: 'none' }}>
<div style={{ width: '100%', height: 30, position: 'relative' }}>
{/* a-z 索引 */}
<div style={{ fontSize: 14, position: 'absolute' }}>
<a style={{ marginLeft: 16 }} onClick={this.itemSelectAll.bind(this)}>
{this.state.selectoptionsAll}
</a>
{menuListNormal.map((item, index) => {
if (this.state.menuList.indexOf(item) > -1) {
return (
<a
......@@ -364,8 +376,8 @@ class SelectOptions extends React.Component {
style={{ width: 200, margin: '10px' }}
/>
<CheckboxGroup
options={this.state.checkedListOptions} // 所有数组
value={this.state.checkedList} // 选中的数组
options={this.state.checkedListOptions} // 所有数组
value={this.state.checkedList} // 选中的数组
onChange={this.onChangeValue}
style={{ marginLeft: 10 }}
/>
......
......@@ -56,7 +56,6 @@ const TitleSearch = (props: any) => {
// console.log(CommunityList)
if (CommunityList != null) {
// console.log("小区数量初始化完毕") OK
var tmp = {};
tmp[community] = CommunityList;
// props.onSubmit(tmp) 禁用 改用组件初始化
......@@ -180,7 +179,7 @@ const TitleSearch = (props: any) => {
<SelectOptions
checklist={checklist}
single={single}
list={CommunityList.sort()}
list={communitys !== null ? communitys.sort() : []}
show={selectOptions}
onSubmit={printContent}
/>
......
......@@ -65,7 +65,9 @@ export default {
case 24:
{
let Data = resp.data;
let CommunityList = resp.data.communityList;
yield put({ type: 'returnPage', Data });
yield put({ type: 'Init/returnCommunityList', CommunityList });
}
break;
case 29: // 小区新增编辑
......
import * as service from '../services/Init';
import { message } from 'antd';
import { routerRedux } from 'dva/router'
import { routerRedux } from 'dva/router';
export default {
namespace: 'Init',
......@@ -11,21 +11,17 @@ export default {
reducers: {
returnCommunityList(state, { CommunityList }) {
// console.log(CommunityList);
return { ...state, CommunityList };
},
},
effects: {
//获取
*tosCommunityget({ playload }, { call, put }) {
*tosCommunityget({ playload }, { call, put }) {
const resp = yield call(service.tosCommunityget, playload);
let CommunityList = resp.data.communityList;
yield put({ type: 'returnCommunityList', CommunityList, });
yield put({ type: 'returnCommunityList', CommunityList });
},
},
};
......@@ -183,9 +183,9 @@ const FacilityBookings = (props: any) => {
if (tab == 1) {
RA(9, {
userToken: token,
pageNum: curString.curPage,
subscribeDate: curString.subscribeDate,
status: curString.status,
subscribeDate: curString.subscribeDate,
pageNum: curString.curPage,
communityNameList: curString.communityNameList,
});
} else {
......
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