Commit cc07a700 authored by cellee's avatar cellee

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

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