Commit b24ce801 authored by maple's avatar maple

[fix]合同新建和编辑

parent 817395e6
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
//预订设施查询 //预订设施查询
*RA({ playload }, { call, put }) { *RA({ playload }, { call, put }) {
console.log("开始请求")
const resp = yield call(service.RA, playload); const resp = yield call(service.RA, playload);
console.log(resp) console.log(resp)
if (resp.code == 500||resp.error_code!="0000") { if (resp.code == 500||resp.error_code!="0000") {
...@@ -58,18 +58,10 @@ export default { ...@@ -58,18 +58,10 @@ export default {
yield put({ type: 'returnDataSaveDetail', DataSaveDetail}); yield put({ type: 'returnDataSaveDetail', DataSaveDetail});
}break; }break;
case 18: case 27: {
case 14:{ var tmp=resp
message.success("Success Operation!",3) yield put({ type: 'returnResult', tmp })
// window.location.href = '/CommunityManagement/FacilityBookings'; history.back()
history.push("/UserManagement/LIFEUserManagement")
} break;
case 13: {
let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail });
} break;
case 16: {
console.log("等待删除完成")
} break; } break;
} }
......
...@@ -35,7 +35,8 @@ const Contract = (props:any) => { ...@@ -35,7 +35,8 @@ const Contract = (props:any) => {
SA(record) SA(record)
history.push(location.pathname+'/Detail') history.push(location.pathname+'/Detail')
} }
const goToEdit = () => { const goToEdit = (record: any, e: any) => {
SA(record)
history.push(location.pathname+'/Edit') history.push(location.pathname+'/Edit')
} }
...@@ -51,6 +52,7 @@ const Contract = (props:any) => { ...@@ -51,6 +52,7 @@ const Contract = (props:any) => {
title: "Actions", title: "Actions",
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<Space size="middle"> <Space size="middle">
<a onClick={goToEdit.bind(this, record)}>Edit</a>
<a onClick={goToDetail.bind(this,record)}>Detail</a> <a onClick={goToDetail.bind(this,record)}>Detail</a>
</Space> </Space>
), ),
...@@ -74,7 +76,7 @@ const Contract = (props:any) => { ...@@ -74,7 +76,7 @@ const Contract = (props:any) => {
{/* 列表组件 */} {/* 列表组件 */}
{ {
Data!=null?<Table rowKey={"id"} style={{ marginTop: 16 }} dataSource={Data.list} columns={columns} pagination={{ defaultCurrent: 1, total: 16 }} />:null Data!=null?<Table rowKey={"id"} style={{ marginTop: 16 }} dataSource={Data.list} columns={columns} pagination={{ defaultCurrent: 1, total: Data.totalRow }} />:null
} }
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect,useRef} from 'react';
import styles from './ContractContent.less'; import styles from './ContractContent.less';
import { Input ,Menu,Table,Space,Pagination,Tooltip } from 'antd'; import { Input ,Form,Table,Space,Pagination,Tooltip, message } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { Link, useIntl, connect, Dispatch } from 'umi';
import { DatePicker } from 'antd'; import { DatePicker } from 'antd';
...@@ -11,22 +11,34 @@ import { UploadOutlined } from '@ant-design/icons'; ...@@ -11,22 +11,34 @@ import { UploadOutlined } from '@ant-design/icons';
import LINE from '../../components/Line/Line'; import LINE from '../../components/Line/Line';
import TextArea from 'antd/lib/input/TextArea'; import TextArea from 'antd/lib/input/TextArea';
const uploadProps = { import moment from 'moment';
// action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
onChange({ file, fileList }) {
if (file.status !== 'uploading') {
console.log(file, fileList);
}
},
};
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
const ContractContent = (props: any) => { const ContractContent = (props: any) => {
const {dispatch,location,DataSave,DataSaveDetail } = props; const {dispatch,location,DataSave,DataSaveDetail } = props;
const formRef = useRef(null);
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 [ editFlag, setEditFlag ] = useState(false); const [editFlag, setEditFlag] = useState(false);
const [extend, setExtend] = useState();
const [fileList, setFileList] = useState([]);
// const ad = [{ uid:"1",name: "A.pdf",status: "done" }]
const uploadProps = {
accept:".pdf,",
action:"/tos/image/upload",
data: { imageType: "tosContract", extends: extend },
fileList:fileList,
onChange({ file, fileList }) {
let tmp=fileList
setFileList(tmp.filter(file => !!file.status))
if (file.status == 'done') {
console.log(fileList);
message.success( file.name,3)
}
},
};
useEffect(() => { useEffect(() => {
if ((location.pathname).indexOf("/Edit")>-1) { if ((location.pathname).indexOf("/Edit")>-1) {
setEditFlag(true) setEditFlag(true)
...@@ -47,13 +59,36 @@ const ContractContent = (props: any) => { ...@@ -47,13 +59,36 @@ const ContractContent = (props: any) => {
useEffect(() => { useEffect(() => {
if (DataSaveDetail != null) { if (DataSaveDetail != null) {
console.log(DataSaveDetail) console.log(DataSaveDetail)
if (editFlag) {
setExtend(DataSaveDetail.communityName)
var result=new Array()
if (DataSaveDetail.fileUrls != null) {
DataSaveDetail.fileUrls.map((item:any, index:any) => {
result.push({ uid: index,name:item })
})
}
setFileList(result)
formRef.current.setFieldsValue({
contractFileName: "cleanFiles",
contractNumber: "456",
contractPartyA: "国企A",
contractPartyB: "民企B",
contractTitle: "清洁服务协议",
contractValidEndDate: moment("2020-09-21", "YYYY-MM-DD"),
contractValidStartDate: moment("2020-08-28","YYYY-MM-DD"),
})
}
} }
}, [DataSaveDetail]) }, [DataSaveDetail])
const goToReturn = () => { const goToReturn = () => {
// console.log(fileList)
history.back() history.back()
} }
// communityName: "A7" // communityName: "A7"
// contractFileName: "cleanFiles" // contractFileName: "cleanFiles"
// contractNumber: "456" // contractNumber: "456"
...@@ -68,50 +103,78 @@ const ContractContent = (props: any) => { ...@@ -68,50 +103,78 @@ const ContractContent = (props: any) => {
// extend: "" // extend: ""
// fileUrls: Array(1) // fileUrls: Array(1)
// 0: "http://acc-huahu // 0: "http://acc-huahu
const extendName = (values:any) => {
console.log(values);
setExtend(values)
}
const onFinish = (values:any) => {
values.contractValidStartDate= values.contractValidStartDate.format('YYYY-MM-DD')
values.contractValidEndDate = values.contractValidEndDate.format('YYYY-MM-DD')
values.communityName = extend
var data=new Array()
for (var i = 0; i < fileList.length; i++){
data.push(fileList[i].name)
}
values.contractFileNameList=data
RA(27, values)
console.log(values)
}
return ( return (
<div className={styles.base}> <div className={styles.base}>
{/* 头部组件 */} {/* 头部组件 */}
<div className={styles.box}> <div className={styles.box}>
<div className={styles.item1}>Edit Service Provider</div> <div className={styles.item1}>{editFlag ? "Edit Service Provider" : "Service Provider Detail"}</div>
<button className={styles.item3} onClick={goToReturn}>返回</button> <button className={styles.item3} onClick={goToReturn}>返回</button>
</div> </div>
{/* </div>
// "contractNumber":"7891222",
// "contractPartyA":"央企Q",
// "contractPartyB":"私企E",
// "communityName":"A7",
// "contractValidStartDate":"2020-07-01",
// "contractValidEndDate":"2020-08-01",
// "contractFileName":"维修协议概述",
// "contractRemindContent":"提醒内容111",
// "contractFileNameList": ["A.pdf"] */}
<Form ref={formRef} name="basic" onFinish={onFinish} >
<div className={styles.box1}> <div className={styles.box1}>
<div className={styles.box1item1}>Contract Code</div> <div className={styles.box1item1}>Contract Code</div>
<div className = { styles.box1item2 } > {editFlag?(<Input style={{width:200}} placeholder="Contract Code" />):(DataSaveDetail!=null?DataSaveDetail.contractNumber:null)}</div> <div className = { styles.box1item2 } > {editFlag?(<Form.Item name="contractNumber"><Input style={{width:200}} placeholder="Contract Code" /></Form.Item>):(DataSaveDetail!=null?DataSaveDetail.contractNumber:null)}</div>
<div className={styles.box1item3}>Contract Party A</div> <div className={styles.box1item3}>Contract Party A</div>
<div className={styles.box1item4}>{editFlag?(<Input style={{width:200}} placeholder="Corporate Name" />):(DataSaveDetail!=null?DataSaveDetail.contractPartyA:null)}</div> <div className={styles.box1item4}>{editFlag?(<Form.Item name="contractPartyA"><Input style={{width:200}} placeholder="Corporate Name" /></Form.Item>):(DataSaveDetail!=null?DataSaveDetail.contractPartyA:null)}</div>
<div className={styles.box1item5}>Contract Party B</div> <div className={styles.box1item5}>Contract Party B</div>
<div className={styles.box1item6}>{editFlag?(<Input style={{width:200}} placeholder="Corporate Name" />):(DataSaveDetail!=null?DataSaveDetail.contractPartyB:null)}</div> <div className={styles.box1item6}>{editFlag?(<Form.Item name="contractPartyB"><Input style={{width:200}} placeholder="Corporate Name" /></Form.Item>):(DataSaveDetail!=null?DataSaveDetail.contractPartyB:null)}</div>
</div> </div>
<div className={styles.box5}> <div className={styles.box5}>
<div className={styles.box5item1}>Project</div> <div className={styles.box5item1}>Project</div>
<div className={styles.box5item2}>{editFlag?(<Input style={{width:200}} placeholder="Project Name" />):(DataSaveDetail!=null?DataSaveDetail.communityName:null)}</div> <div className={styles.box5item2}>{editFlag?(<SearchOptionsCommnity defaultValue={extend} onSubmit={extendName} />):(DataSaveDetail!=null?DataSaveDetail.communityName:null)}</div>
</div> </div>
<div className={styles.box4}> <div className={styles.box4}>
<div className={styles.box4item1}>Contract Title</div> <div className={styles.box4item1}>Contract Title</div>
<div className={styles.box4item2}>{editFlag?(<Input style={{width:200}} placeholder="XXXX Labor Contract" />):(DataSaveDetail!=null?DataSaveDetail.contractTitle:null)}</div> <div className={styles.box4item2}>{editFlag?(<Form.Item name="contractFileName"><Input style={{width:200}} placeholder="XXXX Labor Contract" /></Form.Item>):(DataSaveDetail!=null?DataSaveDetail.contractTitle:null)}</div>
</div> </div>
<div className={styles.box6}> <div className={styles.box6}>
<div className={styles.box6item1}>Effective Date</div> <div className={styles.box6item1}>Effective Date</div>
<div className={styles.box6item2}>{editFlag ? (<DatePicker style={{width:140}}/>) : (<div className={styles.box6item2x1}>{DataSaveDetail!=null?DataSaveDetail.contractValidEndDate:null}</div>)}</div> <div className={styles.box6item2}>{editFlag ? (<Form.Item name="contractValidStartDate"><DatePicker style={{width:140}}/></Form.Item>) : (<div className={styles.box6item2x1}>{DataSaveDetail!=null?DataSaveDetail.contractValidEndDate:null}</div>)}</div>
<div className={styles.box6item3}>{editFlag ? (<DatePicker style={{width:140}}/>) : (<div className={styles.box6item2x1}>{DataSaveDetail!=null?DataSaveDetail.contractValidStartDate:null}</div>)}</div> <div className={styles.box6item3}>{editFlag ? (<Form.Item name="contractValidEndDate"><DatePicker style={{width:140}}/></Form.Item>) : (<div className={styles.box6item2x1}>{DataSaveDetail!=null?DataSaveDetail.contractValidStartDate:null}</div>)}</div>
</div> </div>
{ {
editFlag ? ( editFlag ? (
<div className={styles.box7p}> <div className={styles.box7p}>
<div className={styles.box7item1}>Contract</div> <div className={styles.box7item1}>Contract</div>
<div className={styles.box7item0}> <div className={styles.box7item0}>
{extend != null ?
<Upload {...uploadProps}> <Upload {...uploadProps}>
<Button> <Button>
<UploadOutlined /> Upload <UploadOutlined /> Upload
</Button> </Button>
</Upload> </Upload>:null
}
</div> </div>
</div> </div>
) : ( ) : (
...@@ -129,8 +192,8 @@ const ContractContent = (props: any) => { ...@@ -129,8 +192,8 @@ const ContractContent = (props: any) => {
<div className={styles.box8item2}> <div className={styles.box8item2}>
<div className={styles.box8item2x1}> <div className={styles.box8item2x1}>
{ {
editFlag ? (<TextArea autoSize={false} style={{ padding: 8, width: 600, height: 194 }}></TextArea>) : ( editFlag ? (<Form.Item name="contractRemindContent"><TextArea autoSize={false} style={{ padding: 8, width: 600, height: 194 }}></TextArea></Form.Item>) : (
<TextArea autoSize={false} style={{padding:8,width:600,height:194}} disabled value={"The contract will expire soon. Please prepare the contract plan"}></TextArea> <TextArea autoSize={false} style={{padding:8,width:600,height:194}} disabled defaultValue={"Please note the information..."}></TextArea>
) )
} }
</div> </div>
...@@ -140,13 +203,14 @@ const ContractContent = (props: any) => { ...@@ -140,13 +203,14 @@ const ContractContent = (props: any) => {
{ {
editFlag ? (<div> editFlag ? (<div>
<LINE/> <LINE/>
<Button type="primary" size="large">Submit</Button> <Button type="primary" htmlType="submit">Submit</Button>
</div>):(<div />) </div>):(<div />)
} }
</Form>
</div> </div>
); )
}; }
function mapStateToProps(state:any) { function mapStateToProps(state:any) {
const { DataSave,Result,DataSaveDetail } = state.Contract; const { DataSave,Result,DataSaveDetail } = state.Contract;
......
...@@ -89,7 +89,8 @@ const requestList = [ ...@@ -89,7 +89,8 @@ const requestList = [
["/tos/property/decorate/record/get", "23 装修列表获取"], ["/tos/property/decorate/record/get", "23 装修列表获取"],
["/tos/tosCommunity/get", "24 获取小区列表"], ["/tos/tosCommunity/get", "24 获取小区列表"],
["/tos/tosCommunityNotic/get", "25 获取小区公告列表"], ["/tos/tosCommunityNotic/get", "25 获取小区公告列表"],
["/tos/tosVisitorRecord/get","26 获取访客记录列表"], ["/tos/tosVisitorRecord/get", "26 获取访客记录列表"],
["/tos/contract/add","27 合同新增和编辑"],
] ]
const params = [ const params = [
...@@ -101,6 +102,8 @@ function requestAuto(url:string,values:any) { ...@@ -101,6 +102,8 @@ function requestAuto(url:string,values:any) {
return request(url, Body(values)) return request(url, Body(values))
} }
export function RA(playload: any) { export function RA(playload: any) {
console.log(playload)
console.log(playload.index)
var url =(requestList[playload.index])[0] var url =(requestList[playload.index])[0]
console.log(playload.index + "》【发送请求】" + url + " " + (requestList[playload.index])[1]) console.log(playload.index + "》【发送请求】" + url + " " + (requestList[playload.index])[1])
console.log("参数如下:") console.log("参数如下:")
......
...@@ -53,4 +53,16 @@ export const setCookie=(key:string,value: string)=>{ ...@@ -53,4 +53,16 @@ export const setCookie=(key:string,value: string)=>{
} }
export const RA = (index:any,values:any,module:string,dispatch:any) => { dispatch({ type: module+'/RA', playload: {index:index, body:values } }) }; export const RA = (index: any, values: any, module: string, dispatch: any) => { dispatch({ type: module + '/RA', playload: { index: index, body: values } }) };
\ No newline at end of file
const Fromate = (values: any,valuesForm) => {
var result=new Array()
if (values != null) {
values.map((item:any, index:any) => {
result.push({ uid: index,name:item.categoriesName })
})
}
console.log(result)
return result
}
\ No newline at end of file
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