Commit cc07a700 authored by cellee's avatar cellee

小区界面更新和合同bug修复

parent 7052822d
...@@ -11,6 +11,7 @@ const ContractModel = { ...@@ -11,6 +11,7 @@ const ContractModel = {
totalRow:0, totalRow:0,
type:'Add', type:'Add',
record:-1, record:-1,
loding:true,
}, },
// 同步 // 同步
reducers: { reducers: {
...@@ -30,7 +31,8 @@ const ContractModel = { ...@@ -30,7 +31,8 @@ const ContractModel = {
payload:{ payload:{
list:data.list, list:data.list,
page:payload.page.pageNum, page:payload.page.pageNum,
totalRow:data.page.totalRow totalRow:data.page.totalRow,
loding:false
}, },
}) })
}else{ }else{
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Input ,Tabs,Table,Space, Button} from 'antd'; import { Input ,Tabs,Table,Space, Button ,Form ,message} from 'antd';
const { TabPane } = Tabs; const { TabPane } = Tabs;
import {connect,history} from 'umi'; import {connect,history} from 'umi';
// 图标 // 图标
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined,ClearOutlined,PlusOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
import TitleSearch from '@/components/TitleSearch/TitleSearch' import TitleSearch from '@/components/TitleSearch/TitleSearch'
...@@ -15,6 +16,9 @@ import { objectColumns } from '@/utils/string'; ...@@ -15,6 +16,9 @@ import { objectColumns } from '@/utils/string';
import { timestampToTime } from '@/utils/time'; import { timestampToTime } from '@/utils/time';
import CommunitySearch from "@/components/CommunitySearch/CommunitySearch"; import CommunitySearch from "@/components/CommunitySearch/CommunitySearch";
const module="CellList" const module="CellList"
import './celllist.less'
const CellList = (props:any) => { const CellList = (props:any) => {
const columns = objectColumns([ const columns = objectColumns([
...@@ -55,35 +59,105 @@ const CellList = (props:any) => { ...@@ -55,35 +59,105 @@ const CellList = (props:any) => {
SA(values,module,dispatch) SA(values,module,dispatch)
history.push("./CellList/Detail"); history.push("./CellList/Detail");
} }
// 表单标识
const [form] = Form.useForm()
// 表单提交
const onFinishContract = (value:any)=>{
// console.log(value)
if(!value.communityName&&!value.contractNumber&&!value.contractTitle){
message.error('Please enter one of them!')
}else{
console.log(value)
let payload = {
index: 19,
page:{
pageNum:1,
contractNumber:value.contractNumber,
contractTitle:value.contractTitle,
communityName:value.communityName
}
}
// requst(payload);
}
}
// 选择小区名字并赋值
const opname = (value:any)=>{
form.setFieldsValue({
'communityName' : value
})
}
// 重置
const onReset = () => {
form.resetFields();
let payload = {
index: 19,
page:{
pageNum:1
}
}
};
return ( return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}> <div >
{ {
Data != null ? <> Data != null ? <>
{/* <TitleSearch listkey={['communityName']} list={['Community Name']} onSubmit={CallBackTitleSearch}/> */} {/* <TitleSearch listkey={['communityName']} list={['Community Name']} onSubmit={CallBackTitleSearch}/> */}
<div style={{display: "flex"}}> <div className='contop'>
<SearchOptionsCommnity alone={true} onSubmit={CallbackSearch} /> <Form
autoComplete= "off"
{/* 添加管理员姓名的搜索 */} layout="inline"
<Input form={form}
placeholder="Administrator Name" name="contract"
allowClear onFinish={onFinishContract}
onChange={onChange} >
style={{width:200,marginLeft: 20}} /> <Form.Item name="communityName">
{/* 点击搜索 */} <SearchOptionsCommnity
<Button type="primary" icon={<SearchOutlined />} style={{width:80,marginLeft: 20}} > // ubmit={extendName}
opname={opname} />
搜索 </Form.Item>
</Button> <Form.Item name="contractNumber">
</div> <Input allowClear placeholder='Contract No' />
<div style={{height:80,position:"relative"}}> </Form.Item>
<div style={{ position: "absolute", right: 0 }}> <Form.Item name="contractTitle">
<Button type="primary" onClick={goToAdd}>Create new Community</Button> <Input allowClear placeholder='Contract Title' />
</div> </Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={false}>Search </Button>
<Button htmlType="button" onClick={onReset} style={{marginLeft:'15px'}} icon={<ClearOutlined />} loading={false}> Reset</Button>
</Form.Item>
</Form>
</div> </div>
<Table loading={false} rowKey="id" style={{ marginTop: 16 }} <ProTable
// request={requestHeadl}
pagination={false} // 隐藏默认分页
rowKey={"id"}
dataSource={Data.rows}
columns={columns}
search={false}
loading={false}
toolBarRender={() => [
<Button key="3" type="primary" onClick={()=>{}}>
<PlusOutlined />Add Contract
</Button>,
]}
options={{
density: true,
fullScreen: true,
reload: () => {
// resetHandler();
},
setting: false,
}}
headerTitle="Create new Community"
// pagination={{ defaultCurrent: 1, total: Data.totalRow }}
/>
{/* <Table loading={false} rowKey="id" style={{ marginTop: 16 }}
dataSource={Data.rows} dataSource={Data.rows}
columns={columns} columns={columns}
pagination={{ defaultCurrent: 1, total: Data.total}} /> pagination={{ defaultCurrent: 1, total: Data.total}} /> */}
</> : null </> : null
} }
......
.contop {
padding: 20px;
background: #fff;
margin-bottom: 20px;
}
.listbox {
width: 100%;
background-color: #ffffff;
padding: 10px;
}
.contop{
padding: 20px;
background: #fff;
margin-bottom: 20px;
}
.listbox{
width: 100%;
background-color: #ffffff;
padding: 10px;
}
import React , { useState, useEffect } from 'react'; import React , { useState, useEffect } from 'react';
import { Space, Button, message , Pagination ,Form ,Input } from 'antd'; import { Space, Button, message , Pagination ,Form ,Input } from 'antd';
import { connect, history, Loading } from 'umi'; import { connect, history , Loading } from 'umi';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined,SearchOutlined,ClearOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import moment from 'moment'; import moment from 'moment';
import styles from './ContractContent.less'; import styles from './ContractContent.less';
import { RA } from '@/services/tos'; import { RA } from '@/services/tos';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
const Contract = (props:any) => { const Contract = (props:any) => {
const {location,ContractModel,dispatch,loading } = props; const {location,dispatch,ContractModel,userListLoading } = props;
const RA = (index: any, values: any) => { dispatch({ type: 'Contract/RA', playload: { index: index, body: values } }) }; const RA = (index: any, values: any) => { dispatch({ type: 'Contract/RA', playload: { index: index, body: values } }) };
// const [confirmLoading,setConfirmLoading] = useState(false); // 表单加载loding console.log(userListLoading)
// 把请求装在一个地方 // 把请求装在一个地方
function requst(payload){ function requst(payload:any){
dispatch({type:'ContractModel/getList', payload:payload})} dispatch({type:'ContractModel/getList', payload:payload})
}
// 数据 // 数据
useEffect(()=>{ useEffect(()=>{
...@@ -31,7 +33,7 @@ const Contract = (props:any) => { ...@@ -31,7 +33,7 @@ const Contract = (props:any) => {
requst(payload); requst(payload);
},[1]) //页面进来执行一次 },[1]) //页面进来执行一次
// 跳转 // 跳转
const Jump = (record:any,Jump:String)=>{ const Jump = (record:any,Jump:String)=>{
console.log(record) console.log(record)
...@@ -123,7 +125,13 @@ const Contract = (props:any) => { ...@@ -123,7 +125,13 @@ const Contract = (props:any) => {
// 重置 // 重置
const onReset = () => { const onReset = () => {
form.resetFields(); form.resetFields();
requst(); let payload = {
index: 19,
page:{
pageNum:1
}
}
requst(payload);
}; };
// 表单提交 // 表单提交
...@@ -132,16 +140,26 @@ const Contract = (props:any) => { ...@@ -132,16 +140,26 @@ const Contract = (props:any) => {
if(!value.communityName&&!value.contractNumber&&!value.contractTitle){ if(!value.communityName&&!value.contractNumber&&!value.contractTitle){
message.error('Please enter one of them!') message.error('Please enter one of them!')
}else{ }else{
// RA(19, { console.log(value)
// pageNum:"1", let payload = {
// contractNumber:value.contractNumber, index: 19,
// contractTitle:value.contractTitle, page:{
// communityName:value.communityName pageNum:1,
// }) contractNumber:value.contractNumber,
contractTitle:value.contractTitle,
communityName:value.communityName
}
}
requst(payload);
} }
} }
// 选择小区名字并赋值
const opname = (value:any)=>{
form.setFieldsValue({
'communityName' : value
})
}
return ( return (
<> <>
...@@ -154,7 +172,9 @@ const Contract = (props:any) => { ...@@ -154,7 +172,9 @@ const Contract = (props:any) => {
onFinish={onFinishContract} onFinish={onFinishContract}
> >
<Form.Item name="communityName"> <Form.Item name="communityName">
<Input allowClear placeholder='Community name' /> <SearchOptionsCommnity
// ubmit={extendName}
opname={opname} />
</Form.Item> </Form.Item>
<Form.Item name="contractNumber"> <Form.Item name="contractNumber">
<Input allowClear placeholder='Contract No' /> <Input allowClear placeholder='Contract No' />
...@@ -163,8 +183,8 @@ const Contract = (props:any) => { ...@@ -163,8 +183,8 @@ const Contract = (props:any) => {
<Input allowClear placeholder='Contract Title' /> <Input allowClear placeholder='Contract Title' />
</Form.Item> </Form.Item>
<Form.Item> <Form.Item>
<Button type="primary" htmlType="submit"> Search </Button> <Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={userListLoading}>Search </Button>
<Button htmlType="button" onClick={onReset} style={{marginLeft:'15px'}}>Reset</Button> <Button htmlType="button" onClick={onReset} style={{marginLeft:'15px'}} icon={<ClearOutlined />} loading={userListLoading}> Reset</Button>
</Form.Item> </Form.Item>
</Form> </Form>
</div> </div>
...@@ -177,7 +197,7 @@ const Contract = (props:any) => { ...@@ -177,7 +197,7 @@ const Contract = (props:any) => {
dataSource={ContractModel.list} dataSource={ContractModel.list}
columns={columns} columns={columns}
search={false} search={false}
loading={loading} loading={userListLoading}
toolBarRender={() => [ toolBarRender={() => [
<Button key="3" type="primary" onClick={()=>{Jump(0,'Add')}}> <Button key="3" type="primary" onClick={()=>{Jump(0,'Add')}}>
<PlusOutlined />Add Contract <PlusOutlined />Add Contract
...@@ -210,11 +230,18 @@ const Contract = (props:any) => { ...@@ -210,11 +230,18 @@ const Contract = (props:any) => {
); );
}; };
function mapStateToProps({ ContractModel }) { const mapStateToProps = ({
const loading = ContractModel.list.length > 0 ? false: true; ContractModel,
loading,
}: {
ContractModel: any;
loading: Loading;
}) => {
console.log(loading)
return { return {
ContractModel, ContractModel,
loading userListLoading: loading.models.ContractModel,
}; };
} };
export default connect(mapStateToProps)(Contract);
export default connect(mapStateToProps)(Contract);
\ No newline at end of file
import React, { useState, useEffect,useRef} from 'react'; import React, { useState, useEffect,useRef} from 'react';
import styles from './ContractContent.less'; import styles from './ContractContent.less';
import { Input ,Form, message,Upload, Button, DatePicker ,Space, } from 'antd'; import { Input ,Form, message,Upload, Button, DatePicker ,Space, } from 'antd';
import { UploadOutlined } from '@ant-design/icons'; import { UploadOutlined ,LeftOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { Link, useIntl, connect, Dispatch ,Loading } from 'umi';
import { RA } from '@/services/tos'; import { RA } from '@/services/tos';
...@@ -19,7 +19,6 @@ import locale from 'antd/es/date-picker/locale/en_US'; ...@@ -19,7 +19,6 @@ import locale from 'antd/es/date-picker/locale/en_US';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity'; import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
const ContractContent = (props: any) => { const ContractContent = (props: any) => {
const { ContractModel,dispatch } = props; const { ContractModel,dispatch } = props;
const { RangePicker } = DatePicker; // 日期组件 const { RangePicker } = DatePicker; // 日期组件
const [form] = Form.useForm(); // 表单 const [form] = Form.useForm(); // 表单
...@@ -34,11 +33,14 @@ const ContractContent = (props: any) => { ...@@ -34,11 +33,14 @@ const ContractContent = (props: any) => {
const [fileList, setFileList] = useState([] as any); const [fileList, setFileList] = useState([] as any);
console.log(ContractModel)
useEffect(()=>{ useEffect(()=>{
// 如果是添加传来没有值的时候 就清空 否则 赋值给表单 // 如果是添加传来没有值的时候 就清空 否则 赋值给表单
if(ContractModel.record === -1){ if(ContractModel.record === -1){
// 返回列表 // 返回列表
}else if(ContractModel.record === 0){ }else if(ContractModel.record === 0){
form.resetFields() form.resetFields()
...@@ -68,12 +70,12 @@ const ContractContent = (props: any) => { ...@@ -68,12 +70,12 @@ const ContractContent = (props: any) => {
} }
} ,[ContractModel]) } ,[1])
// const goToReturn = () => { const goToReturn = () => {
// // console.log(fileList) // console.log(fileList)
// history.back() history.back()
// } }
// // 提交 // // 提交
const onFinish = (values:any) => { const onFinish = (values:any) => {
...@@ -103,7 +105,7 @@ const ContractContent = (props: any) => { ...@@ -103,7 +105,7 @@ const ContractContent = (props: any) => {
action:"/tos/image/upload", action:"/tos/image/upload",
data: { imageType: "tosContract" }, data: { imageType: "tosContract" },
fileList:fileList, fileList:fileList,
onChange({ file, fileList }) { onChange({ file, fileList }:{file:any,fileList:any} ) {
setFileList(fileList) setFileList(fileList)
...@@ -144,7 +146,7 @@ const ContractContent = (props: any) => { ...@@ -144,7 +146,7 @@ const ContractContent = (props: any) => {
{/* 头部组件 */} {/* 头部组件 */}
<div className={styles.box}> <div className={styles.box}>
<div className={styles.item1}>{ContractModel.type} Service Provider</div> <div className={styles.item1}>{ContractModel.type} Service Provider</div>
{/* <button className={styles.item3} onClick={goToReturn}>&lt;Back</button> */} <button className={styles.item3} onClick={goToReturn}><LeftOutlined />Back</button>
</div> </div>
{/* 表单 initialValues={defForm} */} {/* 表单 initialValues={defForm} */}
<Form <Form
...@@ -276,7 +278,7 @@ const ContractContent = (props: any) => { ...@@ -276,7 +278,7 @@ const ContractContent = (props: any) => {
) )
} }
function mapStateToProps({ ContractModel }) { function mapStateToProps({ ContractModel }: {ContractModel:any}) {
return { return {
ContractModel ContractModel
......
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