Commit 97d1d9ff authored by maple's avatar maple

[fix]新建小区

parent b24ce801
...@@ -205,7 +205,8 @@ export default defineConfig({ ...@@ -205,7 +205,8 @@ export default defineConfig({
path: './CellList', path: './CellList',
name: 'celllist', name: 'celllist',
routes:[ routes:[
{path:'./',component:'./CommunityManagement/CellList/CellList'} { path: './', component: './CommunityManagement/CellList/CellList' },
{path:'./add',component:'./CommunityManagement/CellList/Add'},
] ]
}, },
{ {
......
import React, { useState,useEffect} from 'react';
import { Upload,Button, message,Row,Col } from 'antd';
import { UploadOutlined } from '@ant-design/icons';
// { imageType: "tosContract", extends: extend }
//"/tos/image/upload"
import { Fromate2 } from '@/utils/method'
const FileUpload = (props: any) => {
const {value,onChange}=props
const [fileList, setFileList] = useState([]);
const uploadProps = {
accept:".pdf,",
action:props.url,
data: props.data,
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)
if (props.reg != null) {
onChange(Fromate2(fileList,props.reg))
} else {
onChange(fileList)
}
}
},
};
return (
<>
<Row gutter={8}>
<Col><div style={{lineHeight:2}}>{props.title}</div></Col>
<Col>
<Upload {...uploadProps}>
<Button>
<UploadOutlined /> Upload
</Button>
</Upload>
</Col>
</Row>
</>
);
};
export default FileUpload;
...@@ -22,7 +22,7 @@ const Picture = (props:any) => { ...@@ -22,7 +22,7 @@ const Picture = (props:any) => {
useEffect(() => { useEffect(() => {
var tmp = props.defaultValue var tmp = props.defaultValue
// console.log(tmp) console.log(tmp)
var checkFlag=false var checkFlag=false
if (tmp != null) { if (tmp != null) {
tmp.map((item, index) => { tmp.map((item, index) => {
...@@ -37,7 +37,7 @@ const Picture = (props:any) => { ...@@ -37,7 +37,7 @@ const Picture = (props:any) => {
} }
} }
},[]) },[props.defaultValue])
const handleCancel = () => { const handleCancel = () => {
setPreviewVisible(false) setPreviewVisible(false)
} }
......
...@@ -11,7 +11,7 @@ import Picture from './Picture'; ...@@ -11,7 +11,7 @@ import Picture from './Picture';
import { getUrlPicName } from '../../utils/string'; import { getUrlPicName } from '../../utils/string';
const PictureOptions = (props:any) => { const PictureOptions = (props:any) => {
const { value, onChange }=props
const [fileList, setFileList] = useState([]) const [fileList, setFileList] = useState([])
const [fileListLen, setFileListLen] = useState(0) const [fileListLen, setFileListLen] = useState(0)
const add = () => { const add = () => {
...@@ -19,8 +19,10 @@ const PictureOptions = (props:any) => { ...@@ -19,8 +19,10 @@ const PictureOptions = (props:any) => {
setFileList(fileList => ([...fileList, {index:fileListLen + 1,name:null,pic:null}])) setFileList(fileList => ([...fileList, {index:fileListLen + 1,name:null,pic:null}]))
} }
useEffect(() => { useEffect(() => {
var tmp = props.defultValue var tmp = value
if (tmp != null) { if (tmp != null&&tmp.length>0&&(typeof tmp[0])=="object") {
console.log("图片默认值")
console.log(tmp)
var initArray = new Array() var initArray = new Array()
tmp.map((item: any, index: any) => { tmp.map((item: any, index: any) => {
if (item.pic == null) { if (item.pic == null) {
...@@ -35,21 +37,16 @@ const PictureOptions = (props:any) => { ...@@ -35,21 +37,16 @@ const PictureOptions = (props:any) => {
status:"Done"}) status:"Done"})
}) })
setFileList(initArray) setFileList(initArray)
props.putSubmit( CheckParm(initArray))
setFileListLen(initArray.length + 1) setFileListLen(initArray.length + 1)
} else {
setFileList([{index: 0,name:null,pic:null}])
} }
},[]) }, [value])
const Delete = (index: any, e: any) => { const Delete = (index: any, e: any) => {
var tmp = fileList var tmp = fileList
tmp.splice(index, 1); tmp.splice(index, 1);
// console.log("删除")
// console.log(tmp)
setFileList(fileList => ([...tmp])) setFileList(fileList => ([...tmp]))
// console.log(fileList) onChange( CheckParm(tmp))
props.putSubmit( CheckParm(tmp))
} }
const CheckParm = (values: Array<any>) => { const CheckParm = (values: Array<any>) => {
var tmp = new Array() var tmp = new Array()
...@@ -66,7 +63,8 @@ const PictureOptions = (props:any) => { ...@@ -66,7 +63,8 @@ const PictureOptions = (props:any) => {
const PictureName=(index: any,values:any) => { const PictureName=(index: any,values:any) => {
var tmp = fileList var tmp = fileList
tmp[index].pic = values tmp[index].pic = values
props.putSubmit( CheckParm(tmp)) console.log(tmp)
onChange( CheckParm(tmp))
} }
const InputGet = (index: any, e: any) => { const InputGet = (index: any, e: any) => {
var tmp = fileList var tmp = fileList
...@@ -75,14 +73,16 @@ const PictureOptions = (props:any) => { ...@@ -75,14 +73,16 @@ const PictureOptions = (props:any) => {
} else { } else {
tmp[index].name = e.target.value tmp[index].name = e.target.value
} }
// console.log(tmp) console.log(tmp)
props.putSubmit(CheckParm(tmp)) onChange(CheckParm(tmp))
} }
return ( return (
<div> <div>
{ {
fileList.map((item, index) => { fileList.map((item, index) => {
console.log(index)
console.log(item)
return ( return (
<Row key={item.index}> <Row key={item.index}>
<Col><Picture onSubmit={PictureName.bind(this, index)} data={props.data} defaultValue={[item]} disabled={props.disabled}/></Col> <Col><Picture onSubmit={PictureName.bind(this, index)} data={props.data} defaultValue={[item]} disabled={props.disabled}/></Col>
......
...@@ -22,20 +22,20 @@ const uploadButton = ( ...@@ -22,20 +22,20 @@ const uploadButton = (
</div> </div>
); );
import { getUrlPicName } from '../../utils/string'; import { getUrlPicName } from '../../utils/string';
const PictureOptionsRow = (props:any) => { const PictureOptionsRow = (props: any) => {
// const [defa] = props; const {value, onChange} = props;
const [fileList, setFileList] = useState([]) const [fileList, setFileList] = useState([])
const [previewVisible, setPreviewVisible] = useState(false) const [previewVisible, setPreviewVisible] = useState(false)
const [previewImage,setPreviewImage]=useState('') const [previewImage,setPreviewImage]=useState('')
const handleCancel = () => setPreviewVisible(false); const handleCancel = () => setPreviewVisible(false);
useEffect(() => { useEffect(() => {
if (props.defultValue!=null) { if (value!=null) {
var tmp = props.defultValue; var tmp = value
var result = new Array() var result = new Array()
var resultToInside=new Array() var resultToInside=new Array()
tmp.map((item, index) => { tmp.map((item:any, index:any) => {
if (item.name == null) { if (item.name == null) {
item.name = getUrlPicName(item.url) item.name = getUrlPicName(item.url)
item.uid=index item.uid=index
...@@ -44,7 +44,7 @@ const PictureOptionsRow = (props:any) => { ...@@ -44,7 +44,7 @@ const PictureOptionsRow = (props:any) => {
resultToInside.push(item.name) resultToInside.push(item.name)
}) })
setFileList(result) setFileList(result)
props.putSubmit(resultToInside) onChange(resultToInside)
} }
}, []) }, [])
...@@ -54,7 +54,7 @@ const PictureOptionsRow = (props:any) => { ...@@ -54,7 +54,7 @@ const PictureOptionsRow = (props:any) => {
} }
setPreviewImage(file.url || file.preview) setPreviewImage(file.url || file.preview)
setPreviewVisible(true) setPreviewVisible(true)
}; }
const handleChange = ({ file, fileList }) => { const handleChange = ({ file, fileList }) => {
...@@ -64,7 +64,7 @@ const PictureOptionsRow = (props:any) => { ...@@ -64,7 +64,7 @@ const PictureOptionsRow = (props:any) => {
fileList.map((item, index) => { fileList.map((item, index) => {
result.push(item.name) result.push(item.name)
}) })
props.putSubmit(result) onChange(result)
} }
const beforeUpload=( file:any) => { const beforeUpload=( file:any) => {
if (file.type === 'image/png' || file.type === 'image/jpeg' || file.type === 'image/jpg') { if (file.type === 'image/png' || file.type === 'image/jpeg' || file.type === 'image/jpg') {
......
...@@ -5,7 +5,7 @@ import SearchOptions from './SearchOptions'; ...@@ -5,7 +5,7 @@ import SearchOptions from './SearchOptions';
const SearchOptionsCommnity = (props: any) => { const SearchOptionsCommnity = (props: any) => {
const {dispatch, CommunityList,defaultValue,placeholder,disabled} = props; const {dispatch, CommunityList,defaultValue,placeholder,disabled,value,onChange} = props;
const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})}; const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})};
useEffect(() => { useEffect(() => {
...@@ -16,12 +16,12 @@ const SearchOptionsCommnity = (props: any) => { ...@@ -16,12 +16,12 @@ const SearchOptionsCommnity = (props: any) => {
const extendName = (values: any) => { const extendName = (values: any) => {
// console.log(values)
props.onSubmit(values); onChange(values);
} }
return ( return (
<>{CommunityList!=null? <>{CommunityList!=null?
<SearchOptions disabled={disabled} placeholder={placeholder} defaultValue={defaultValue} list={CommunityList} onSubmit={extendName} /> <SearchOptions disabled={disabled} placeholder={placeholder} defaultValue={value} list={CommunityList} onSubmit={extendName} />
:null :null
} }
</> </>
......
...@@ -30,19 +30,19 @@ const TimeSelect = (props:any) => { ...@@ -30,19 +30,19 @@ const TimeSelect = (props:any) => {
} else if(type==1&&buttonNum.ButtonNum==0) { } else if(type==1&&buttonNum.ButtonNum==0) {
buttonNum.ButtonNum+=1 buttonNum.ButtonNum+=1
} }
console.log(buttonNum) // console.log(buttonNum)
setCurString(buttonNum) setCurString(buttonNum)
} }
const saveResult = (values:any) => { const saveResult = (values:any) => {
var tmp = curString var tmp = curString
tmp.resultList = values tmp.resultList = values
setCurString(tmp) setCurString(tmp)
console.log("这里") // console.log("这里")
console.log(curString) // console.log(curString)
} }
useEffect(() => { useEffect(() => {
console.log("时段选择器") // console.log("时段选择器")
console.log(defaultValue) // console.log(defaultValue)
if (defaultValue != null) { if (defaultValue != null) {
var tmp = defaultValue var tmp = defaultValue
var result=new Array() var result=new Array()
...@@ -53,7 +53,7 @@ const TimeSelect = (props:any) => { ...@@ -53,7 +53,7 @@ const TimeSelect = (props:any) => {
setTimesLen(result.length) setTimesLen(result.length)
var resultList= CheckParm(result) var resultList= CheckParm(result)
saveResult(resultList) saveResult(resultList)
console.log(resultList) // console.log(resultList)
props.putSubmit(resultList) props.putSubmit(resultList)
} }
}, [defaultValue]); }, [defaultValue]);
...@@ -84,7 +84,7 @@ const TimeSelect = (props:any) => { ...@@ -84,7 +84,7 @@ const TimeSelect = (props:any) => {
showBtn(1) showBtn(1)
} }
saveResult(resultList) saveResult(resultList)
console.log(resultList) // console.log(resultList)
props.putSubmit(resultList) props.putSubmit(resultList)
} }
const timeForm = (values: any) => { const timeForm = (values: any) => {
...@@ -108,8 +108,8 @@ const TimeSelect = (props:any) => { ...@@ -108,8 +108,8 @@ const TimeSelect = (props:any) => {
const timeChange = (index: any, values: any) => { const timeChange = (index: any, values: any) => {
var tmp = times; var tmp = times;
console.log("Maple诊断"+index) // console.log("Maple诊断"+index)
console.log(values) // console.log(values)
if (values != null) { if (values != null) {
tmp[index].time =timeForm(values) tmp[index].time =timeForm(values)
} else { } else {
......
import React from 'react';
import styles from './index.less';
const TitleGet = (props:any) => {
return (
<>
<div className={styles.item}>{props.title}</div>
</>
);
};
export default TitleGet;
// 线栏
.font{
border-left: 5px solid rgba(24,144,255,1);
font-family:'Source Han Sans CN';
font-size: 18px;
font-weight: 600;
color: #000000;
}
.item{
.font();
text-indent: 15px;
}
\ No newline at end of file
...@@ -4,6 +4,7 @@ import { Link, useIntl, connect, Dispatch, history } from 'umi'; ...@@ -4,6 +4,7 @@ import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router' import { routerRedux } from 'dva/router'
import {Fromate} from '@/utils/method'
export default { export default {
namespace: 'FacilityBookings', namespace: 'FacilityBookings',
state: { state: {
...@@ -113,6 +114,8 @@ export default { ...@@ -113,6 +114,8 @@ export default {
} break; } break;
case 7: { case 7: {
let tmp = resp.data; let tmp = resp.data;
const reg = [["url", "categoriesImageUrl"], ["name", "categoriesName"]]
const reg2 = [["url", null]]
let sourceData = { let sourceData = {
canReservationDay: tmp.canReservationDay, canReservationDay: tmp.canReservationDay,
canReservationNum: tmp.canReservationNum, canReservationNum: tmp.canReservationNum,
...@@ -125,10 +128,11 @@ export default { ...@@ -125,10 +128,11 @@ export default {
nomarginCancelReservationDay: tmp.nomarginCancelReservationDay, nomarginCancelReservationDay: tmp.nomarginCancelReservationDay,
periodType: tmp.periodType, periodType: tmp.periodType,
reservationQuantumTime: tmp.reservationQuantumTime, reservationQuantumTime: tmp.reservationQuantumTime,
facilitiesImageList: tmp.facilitiesImageList, categoriesName: Fromate(tmp.categoriesList, reg),
categoriesList:tmp.categoriesList, categoriesDetailsImageName:Fromate(tmp.facilitiesImageList,reg2)
} }
// console.log(sourceData) console.log(sourceData)
console.log("##############################")
yield put({ type: 'returnSource', sourceData }); yield put({ type: 'returnSource', sourceData });
} break; } break;
case 8: { case 8: {
......
import React, { useState, useEffect,useRef } from 'react';
import { Input ,Tabs,Form,InputNumber,Col,Button, Row} from 'antd';
const { TabPane } = Tabs;
import {connect} from 'umi';
const layout = {
labelCol: { span: 2},
// wrapperCol: { span: 8 },
};
import { RA } from '@/utils/method';
const module = "CellList"
// const params=[
// ["residentialName":"A8",]
// ["residentialAddress":"TianHe Road No.28"]
// ["residentialHotline":"hotline"]
// ["residentialPhone":"200-8888888"]
// ["residentialEmail":"sales@huahuico.com"]
// ["residentialManagerUserName":"Mr Chen"]
// ["residentialHotlineName":"200-22122221"]
// [ "balouscheduleFile":["A.pdf"],]
// [ "serviceGuideFile":["B.pdf"],]
// ["lifeServiceFile": ["C.pdf"]]
// ]
// 小区名
// #工作时间
// 小区联系方式
// 小区管理员
// 楼巴时刻表
// 物业办事指南
// 保质期服务
// 帮助中心
import FileUpload from '@/components/FileUpload/FileUpload'
import TitleBack from '@/components/TitleBack/TitleBack'
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity'
import Line from '@/components/Line/Line';
const Add = (props:any) => {
const { dispatch, Data } = props;
const formRef =useRef(null)
const onFinish = (values:any) => {
console.log(values);
RA(29,values, module, dispatch);
}
useEffect(() => {
},[])
const validateMessages ={
required: '${label} is required!',
types: {
email: '${label} is not validate email!',
number: '${label} is not a validate number!',
string:'${label} is not a validate number!'
},
string: {
range: '${label} must be between ${min} and ${max}',
},
number: {
range: '${label} must be between ${min} and ${max}',
},
}
return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
<TitleBack title="Add Commnunity Infomation" ></TitleBack>
<Form ref={formRef} {...layout} name="nest-messages" onFinish={onFinish} validateMessages={validateMessages}>
<Form.Item name={"name"} label="小区名" rules={[{required:true}]}><SearchOptionsCommnity /></Form.Item>
<Form.Item name={"zipcode"} label="邮编" rules={[]}><Input style={{width: 200 }} /></Form.Item>
<Form.Item name={"residentialAddress"} label="地址" rules={[]}><Input style={{width: 300}} /></Form.Item>
<Form.Item label="小区联系方式" style={{marginBottom:0}}>
<Form.Item style={{ display: 'inline-block', width: '200' }} name={"residentialPhone"} rules={[]}><Input placeholder="小区联系电话" /></Form.Item>
<Form.Item style={{ display: 'inline-block', width: '200', marginLeft:20 }} name={"residentialEmail"} rules={[]}><Input placeholder="小区联系邮箱"/></Form.Item>
</Form.Item>
<Form.Item name={"residentialManagerUserName"} label="小区管理人员" rules={[]}><Input style={{width:200}} /></Form.Item>
<Line />
<Form.Item label="帮助中心" style={{ marginBottom: 0 }}>
<Form.Item style={{ display: 'inline-block', width: '200' }} name={"residentialHotlineName"} rules={[]}><Input placeholder="热线电话名称"/></Form.Item>
<Form.Item style={{ display: 'inline-block', width: '200', marginLeft:20 }} name={"residentialHotline"} rules={[]}><Input placeholder="热线电话"/></Form.Item>
</Form.Item>
<Line />
<Form.Item wrapperCol={{ ...layout.wrapperCol, offset: 2 }} style={{marginBottom:0}}>
<Form.Item style={{ display: 'inline-block', width: '200' }} name={"balouscheduleFile"} ><FileUpload title="choose" url={"/tos/image/upload"} data={{ imageType: "tosCreateCommunity", extends: "A9" }} reg="name" /></Form.Item>
<Form.Item style={{ display: 'inline-block', width: '200', marginLeft:100 }} name={"serviceGuideFile"}><FileUpload title="choose" url={"/tos/image/upload"} data={{ imageType: "tosCreateCommunity", extends: "A9" }} reg="name" /></Form.Item>
<Form.Item style={{ display: 'inline-block', width: '200', marginLeft:100 }} name={"lifeServiceFile"}><FileUpload title="choose" url={"/tos/image/upload"} data={{ imageType: "tosCreateCommunity", extends: "A9" }} reg="name" /></Form.Item>
</Form.Item>
<Form.Item wrapperCol={{ ...layout.wrapperCol, offset: 2 }}><Button type="primary" htmlType="submit">Submit</Button></Form.Item>
</Form>
</div>
);
};
function map(state:any) {
const { Data} = state[module]
return { Data}
}
export default connect(map)(Add);
{/* "zipcode":"510000"
"residentialName":"A8",
"residentialAddress":"TianHe Road No.28",
"residentialHotline":"hotline",
"residentialPhone":"200-8888888",
"residentialEmail":"sales@huahuico.com",
"residentialManagerUserName":"Mr Chen",
"residentialHotlineName":"200-22122221",
"balouscheduleFile":["A.pdf"],
"serviceGuideFile":["B.pdf"],
"lifeServiceFile":["C.pdf"] */}
\ No newline at end of file
...@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Input ,Tabs,Table,Space, Button} from 'antd'; import { Input ,Tabs,Table,Space, Button} from 'antd';
const { TabPane } = Tabs; const { TabPane } = Tabs;
import {connect} from 'umi'; import {connect,history} from 'umi';
const columns = [ const columns = [
...@@ -45,12 +45,20 @@ const CellList = (props:any) => { ...@@ -45,12 +45,20 @@ const CellList = (props:any) => {
const CallbackSearch = (values:any) => { const CallbackSearch = (values:any) => {
RA(24, {communityName: values }, module, dispatch); RA(24, {communityName: values }, module, dispatch);
} }
const goToAdd = () => {
history.push("./CellList/add");
}
return ( return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}> <div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
{ {
Data != null ? <> Data != null ? <>
{/* <TitleSearch listkey={['communityName']} list={['Community Name']} onSubmit={CallBackTitleSearch}/> */} {/* <TitleSearch listkey={['communityName']} list={['Community Name']} onSubmit={CallBackTitleSearch}/> */}
<SearchOptionsCommnity onSubmit={CallbackSearch} /> <SearchOptionsCommnity onSubmit={CallbackSearch} />
<div style={{height:80,position:"relative"}}>
<div style={{ position: "absolute", right: 0 }}>
<Button type="primary" onClick={goToAdd}>Create new Community</Button>
</div>
</div>
<Table loading={false} rowKey="id" style={{ marginTop: 16 }} <Table loading={false} rowKey="id" style={{ marginTop: 16 }}
dataSource={Data.rows} dataSource={Data.rows}
columns={columnsVal} columns={columnsVal}
......
...@@ -20,7 +20,7 @@ import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptio ...@@ -20,7 +20,7 @@ import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptio
// reservationQuantumTime: ["09:00-07:00"] // reservationQuantumTime: ["09:00-07:00"]
import { getUrlLast,numberToString } from '../../../utils/string' import { getUrlLast,numberToString } from '../../../utils/string'
import {checkParam} from '@/utils/method'
const Facility = (props:any) => { const Facility = (props:any) => {
...@@ -28,8 +28,7 @@ const Facility = (props:any) => { ...@@ -28,8 +28,7 @@ const Facility = (props:any) => {
const RA = (index:any,values: any) => { dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } }) }; const RA = (index:any,values: any) => { dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } }) };
const ResultClear = () => { dispatch({ type: 'FacilityBookings/ResultClear' })} const ResultClear = () => { dispatch({ type: 'FacilityBookings/ResultClear' })}
const [Ref1, setRef1] = useState([])
const [Ref2, setRef2] = useState([])
const [Ref3, setRef3] = useState([]) const [Ref3, setRef3] = useState([])
const [extend, setExtend] = useState(null) const [extend, setExtend] = useState(null)
...@@ -40,31 +39,9 @@ const Facility = (props:any) => { ...@@ -40,31 +39,9 @@ const Facility = (props:any) => {
const formRef = useRef(null); const formRef = useRef(null);
const picFromate = (values: any) => {
var result=new Array()
if (values != null) {
values.map((item:any, index:any) => {
result.push({ url: item })
})
}
return result
}
const picFromate2 = (values: any) => {
var result=new Array()
if (values != null) {
values.map((item:any, index:any) => {
result.push({ url: item.categoriesImageUrl,name:item.categoriesName })
})
}
console.log(result)
return result
}
useEffect(() => { useEffect(() => {
if (Result != null) { if (Result != null) {
console.log("页面请求") console.log("页面结果")
console.log(Result) console.log(Result)
ResultClear() ResultClear()
history.push("/CommunityManagement/FacilityBookings") history.push("/CommunityManagement/FacilityBookings")
...@@ -84,15 +61,13 @@ const Facility = (props:any) => { ...@@ -84,15 +61,13 @@ const Facility = (props:any) => {
} }
useEffect(() => { useEffect(() => {
if (sourceData != null) { if (sourceData != null) {
console.log("当前数据不为空") console.log("【传入详情,当前数据不为空】")
console.log(sourceData) console.log(sourceData)
setExtend(sourceData.communityName) setExtend(sourceData.communityName)
setTimeExtend(sourceData.reservationQuantumTime) setTimeExtend(sourceData.reservationQuantumTime)
// 中断 // 中断
var data = sourceData.facilitiesImageList // setPictrueExtend({tab:null,pic:null,pics:null})
var data2=sourceData.categoriesList
setPictrueExtend({tab:null,pic:picFromate2(data2),pics:picFromate(data)})
formRef.current.setFieldsValue(sourceData) formRef.current.setFieldsValue(sourceData)
} }
}, [sourceData]) }, [sourceData])
...@@ -117,42 +92,21 @@ const Facility = (props:any) => { ...@@ -117,42 +92,21 @@ const Facility = (props:any) => {
setPATHNAME("Add Facility") setPATHNAME("Add Facility")
} }
},[]) },[])
const PictureOptionsRef = (values:any) => {
console.log(values)
setRef1(values)
}
const TimeSelectRef = (values:any) => { const TimeSelectRef = (values:any) => {
// console.log(values) // console.log(values)
setRef3(values) setRef3(values)
} }
const PictureOptionsRowRef = (values:any) => {
// console.log(values)
setRef2(values)
}
const checkParam = (values: any) => {
var flag = true
for (var i in values) {
// console.log(values[i]);
if (values[i] == null) {
flag=false
} else {
if(values[i].length == 0){ flag=false}
}
}
return flag
}
const onFinish = (values: any) => { const onFinish = (values: any) => {
var result = values var result = values
result.communityName=extend
result.categoriesName= Ref1
result.categoriesDetailsImageName = Ref2
if (Ref3.length!=0) { if (Ref3.length!=0) {
result.reservationQuantumTime = Ref3 result.reservationQuantumTime = Ref3
} else { } else {
result.reservationQuantumTime = ["09:00-20:00"] result.reservationQuantumTime = ["09:00-20:00"]
} }
result.categoriesOpenTime = "09:00-20:00" result.categoriesOpenTime = "09:00-20:00"
if (result.communityManagerFee == null) { if (result.communityManagerFee == null) {
result.communityManagerFee=numberToString(0) result.communityManagerFee=numberToString(0)
...@@ -173,9 +127,9 @@ const Facility = (props:any) => { ...@@ -173,9 +127,9 @@ const Facility = (props:any) => {
console.log('Success:', result); console.log('Success:', result);
//中断 //中断
if (pictrueExtend.tab == 3) { if (pictrueExtend.tab == 3) {
console.log("提交")
if (Result == null) { if (Result == null) {
RA(6, result); console.log("提交")
// RA(6, result);
} }
} else { } else {
result.id = DataSave.id result.id = DataSave.id
...@@ -190,12 +144,15 @@ const Facility = (props:any) => { ...@@ -190,12 +144,15 @@ const Facility = (props:any) => {
}else{message.error("Error,Please finish it,not empty!",3)} }else{message.error("Error,Please finish it,not empty!",3)}
}; };
const onBillChange = (values: any, allValues: any) => {
if (values["communityName"] != null) {
setExtend(values["communityName"])
}
}
const onFinishFailed = (errorInfo:any) => { const onFinishFailed = (errorInfo:any) => {
console.log('Failed:', errorInfo); console.log('Failed:', errorInfo);
}; };
const extendName = (values:any) => {
setExtend(values)
}
const Subscribe = () => { const Subscribe = () => {
history.push(getUrlLast(location.pathname)+ "/FacilityApply") history.push(getUrlLast(location.pathname)+ "/FacilityApply")
} }
...@@ -218,16 +175,19 @@ const Facility = (props:any) => { ...@@ -218,16 +175,19 @@ const Facility = (props:any) => {
formRef.current.setFieldsValue(tmp) formRef.current.setFieldsValue(tmp)
} }
const test = () => {
console.log(extend)
}
return ( return (
<div className={styles.base}> <div className={styles.base}>
{/* 头部组件v1.2 */} {/* 头部组件v1.2 */}
<TitleBack title={PATHNAME} url={getUrlLast(location.pathname)+"?Facility=true"}/> <TitleBack title={PATHNAME} url={getUrlLast(location.pathname) + "?Facility=true"} />
<Form ref={formRef} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed} > <Form ref={formRef} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed} onValuesChange={onBillChange} >
<Row gutter={32}> <Row gutter={32}>
<Col>所属小区</Col> <Col>所属小区</Col>
<Col><SearchOptionsCommnity defaultValue={extend} onSubmit={extendName} disabled={pictrueExtend.tab!=3?true:false} /></Col> <Col><Form.Item name="communityName" ><SearchOptionsCommnity disabled={pictrueExtend.tab!=3?true:false} /></Form.Item></Col>
</Row> </Row>
<Row gutter={32} style={{marginTop:28}}> <Row gutter={32} style={{marginTop:28}}>
<Col>设施名称</Col> <Col>设施名称</Col>
...@@ -240,74 +200,34 @@ const Facility = (props:any) => { ...@@ -240,74 +200,34 @@ const Facility = (props:any) => {
<Row gutter={32} style={{ marginTop: 28 }}> <Row gutter={32} style={{ marginTop: 28 }}>
{ {
extend != null ? extend != null ?<>
<><Col>设施品类</Col> <Col>设施品类</Col>
<Col> <Col>
{ <Form.Item name="categoriesName" >
pictrueExtend.pic!=null <PictureOptions disabled={facilityDetail}
?
<PictureOptions disabled={facilityDetail} defultValue={[]} putSubmit={PictureOptionsRef}
data={{
userToken: token,
imageType: 'categoriesImageName',
extends: extend,
}}
defultValue={pictrueExtend.pic}
/>
:null
}
{
pictrueExtend.tab == 3 ? <>
<PictureOptions disabled={facilityDetail} defultValue={[]} putSubmit={PictureOptionsRef}
data={{ data={{
userToken: token, userToken: token,
imageType: 'categoriesImageName', imageType: 'categoriesImageName',
extends: extend, extends: extend,
}} /> }} /></Form.Item > </Col>
</>
:null
}
</Col>
</> : null </> : null
} }
</Row> </Row>
<Row gutter={32} style={{ marginTop: 28 }}> <Row gutter={32} style={{ marginTop: 28 }}>
{ {
extend != null ? extend != null ?<>
<Col>设施详情</Col> <Col>设施详情</Col>
:null
}
{/* 未完成 */}
<Col> <Col>
{ <Form.Item name="categoriesDetailsImageName" >
pictrueExtend.pics!=null <PictureOptionsRow disabled={facilityDetail}
? data={{
<PictureOptionsRow disabled={facilityDetail} putSubmit={PictureOptionsRowRef} data={{
userToken: token,
imageType: 'categoriesDetailsImageName',
extends: extend,
}}
defultValue={pictrueExtend.pics} />
:null
}
{
pictrueExtend.tab == 3 ? <>
{
extend != null ?
<PictureOptionsRow disabled={facilityDetail} putSubmit={PictureOptionsRowRef} data={{
userToken: token, userToken: token,
imageType: 'categoriesDetailsImageName', imageType: 'categoriesDetailsImageName',
extends: extend, extends: extend,
}}/> }} /></Form.Item ></Col>
:null
}
</> </>
:null :null
} }
</Col>
</Row> </Row>
<Line /> <Line />
<Row gutter={32} style={{marginTop:28}}> <Row gutter={32} style={{marginTop:28}}>
......
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,Table,Space,Pagination,Tooltip, message } from 'antd'; import { Input ,Form,Table,Space,Pagination,Tooltip, message } from 'antd';
import { UploadOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { Link, useIntl, connect, Dispatch } from 'umi';
import { DatePicker } from 'antd'; import { DatePicker } from 'antd';
import { Upload, Button } from 'antd'; import { Upload, Button } from 'antd';
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';
...@@ -62,13 +62,13 @@ const ContractContent = (props: any) => { ...@@ -62,13 +62,13 @@ const ContractContent = (props: any) => {
if (editFlag) { if (editFlag) {
setExtend(DataSaveDetail.communityName) setExtend(DataSaveDetail.communityName)
var result=new Array() var result=new Array()
if (DataSaveDetail.fileUrls != null) { // if (DataSaveDetail.fileUrls != null) {
DataSaveDetail.fileUrls.map((item:any, index:any) => { // DataSaveDetail.contractFileName.map((item:any, index:any) => {
result.push({ uid: index,name:item }) // result.push({ uid: index,name:item })
}) // })
} // }
setFileList(result) setFileList([{ uid: 1,name:DataSaveDetail.contractFileName }])
formRef.current.setFieldsValue({ formRef.current.setFieldsValue({
contractFileName: "cleanFiles", contractFileName: "cleanFiles",
...@@ -180,7 +180,7 @@ const ContractContent = (props: any) => { ...@@ -180,7 +180,7 @@ const ContractContent = (props: any) => {
) : ( ) : (
<div className={styles.box7}> <div className={styles.box7}>
<div className={styles.box7item1}>Contract</div> <div className={styles.box7item1}>Contract</div>
<div className={styles.box7item2}>.PDF</div> <div className={styles.box7item2}>{DataSaveDetail!=null?DataSaveDetail.contractFileName:null}</div>
<div className={styles.box7item3}><a href={DataSaveDetail!=null?DataSaveDetail.fileUrls:null}>Preview</a></div> <div className={styles.box7item3}><a href={DataSaveDetail!=null?DataSaveDetail.fileUrls:null}>Preview</a></div>
</div> </div>
) )
......
...@@ -33,9 +33,7 @@ const Guard = (props:any) => { ...@@ -33,9 +33,7 @@ const Guard = (props:any) => {
return ( return (
<div className={styles.base}> <div className={styles.base}>
<TitleGet title={"Version 1.0.7"} />
<TitleGet title={"Version 1.0.6"} />
<p> <p>
token:{page.token} token:{page.token}
</p> </p>
......
...@@ -90,7 +90,9 @@ const requestList = [ ...@@ -90,7 +90,9 @@ const requestList = [
["/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 合同新增和编辑"], ["/tos/contract/add", "27 合同新增和编辑"],
["/tos/tosCommunityNotic/add", "28 新增小区公告接口"],
["/tos/tosManageCommunity/save","29 新建一个小区"]
] ]
const params = [ const params = [
...@@ -113,3 +115,40 @@ export function RA(playload: any) { ...@@ -113,3 +115,40 @@ export function RA(playload: any) {
// console.log(playload) // console.log(playload)
// console.log(playload.index) // console.log(playload.index)
// console.log(requestList[playload.index]) // console.log(requestList[playload.index])
// http://47.74.233.180:8651/tos/tosCommunityNotic/add
// {
// "noticTitle":"Garden公告",
// "communityNum":"珠江丽景小区",
// "noticText":"今晚晚上停水4小时",
// "noticScope":"1",
// "noticStartTime":"2020-07-01 12:30:00",
// "noticEndTime":"2020-08-01 9:30:00",
// "file":["A.jpg"]
// }
//新增小区公告接口文件上传 http://47.74.233.180:8651/tos/image/upload imageType 参数值为 tosNotice
// 48、新建一个小区
// http://47.74.233.180:8651/tos/tosManageCommunity/save
// {
// "residentialName":"A8",
// "residentialAddress":"TianHe Road No.28",
// "residentialHotline":"hotline",
// "residentialPhone":"200-8888888",
// "residentialEmail":"sales@huahuico.com",
// "residentialManagerUserName":"Mr Chen",
// "residentialHotlineName":"200-22122221",
// "balouscheduleFile":["A.pdf"],
// "serviceGuideFile":["B.pdf"],
// "lifeServiceFile":["C.pdf"]
// }
// 49、新建一个小区-上传楼巴办事指南
// http://localhost:8651/tos/image/upload
// imageType 值为 tosCreateCommunity
// extends 值为 对应小区名 如 A9
...@@ -14,6 +14,7 @@ export const checkParam = (values: any) => { ...@@ -14,6 +14,7 @@ export const checkParam = (values: any) => {
return flag return flag
} }
// onBlur={checkInput} maxLength={33} // onBlur={checkInput} maxLength={33}
export const checkInput = (e: any) => { export const checkInput = (e: any) => {
// console.log(e) // console.log(e)
...@@ -55,14 +56,32 @@ export const setCookie=(key:string,value: string)=>{ ...@@ -55,14 +56,32 @@ 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 } }) };
const Fromate = (values: any,valuesForm) => { // const reg = [["url", "categoriesImageUrl"], ["name", "categoriesName"]]
// const values = [{ categoriesImageUrl: "http://url", categoriesName: "A9" },{ categoriesImageUrl: "http://url...", categoriesName: "A8" }]
export const Fromate = (values:any,reg:any) => {
var result=new Array() var result=new Array()
if (values != null) { if (values != null) {
values.map((item:any, index:any) => { values.map((item:any, index:any) => {
result.push({ uid: index,name:item.categoriesName }) var obj={}
for (var i = 0; i < reg.length; i++){
if (reg[i][1] == null) {
obj[reg[i][0]]=item
} else {
obj[reg[i][0]] = item[reg[i][1]]
}
}
result.push(obj)
}) })
} }
console.log(result) return result
}
// const reg2 = "name"
// const values2 = [{name:"kat",url:"longtime"},{name:"jack",url:"longtime2"}]
export const Fromate2 = (values:any, reg:string) => {
var result = new Array()
values.map((item:any, index:number) => {
result.push(item[reg]);
})
return 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