Commit 4a459f3b authored by cellee's avatar cellee

Signed-off-by: cellee <893264950@qq.com>

parent 34bd254a
...@@ -86,15 +86,15 @@ export default { ...@@ -86,15 +86,15 @@ export default {
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
// '/tos/': {
// target: 'http://47.74.233.180:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
'/tos/': { '/tos/': {
target: 'http://192.168.1.28:8651', target: 'http://47.74.233.180:8651',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
// '/tos/': {
// target: 'http://192.168.1.28:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
}, },
}; };
/* /*
* @Author: your name * @Author: your name
* @Date: 2021-02-01 14:54:48 * @Date: 2021-02-01 14:54:48
* @LastEditTime: 2021-02-01 16:57:27 * @LastEditTime: 2021-02-05 18:00:41
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\components\Form\PdfUpload.tsx * @FilePath: \tostumi\src\components\Form\PdfUpload.tsx
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Input, Upload, message, Button } from 'antd'; import { Input, Upload, message, Button, Spin } from 'antd';
import { LoadingOutlined, PlusOutlined, MinusCircleOutlined } from '@ant-design/icons'; import { LoadingOutlined, PlusOutlined, MinusCircleOutlined } from '@ant-design/icons';
interface PriceInputProps { interface PriceInputProps {
...@@ -35,67 +35,106 @@ const PdfUpload: React.FC<PriceInputProps> = ({ value = {}, onChange, disabled, ...@@ -35,67 +35,106 @@ const PdfUpload: React.FC<PriceInputProps> = ({ value = {}, onChange, disabled,
return isJpgOrPng && isLt2M; return isJpgOrPng && isLt2M;
} }
// 上传成功怎么做
const handleChange = (info: any) => { const handleChange = (info: any) => {
if (info.file.status === 'uploading') { let { status, response } = info.file;
if (status === 'uploading') {
setLoading(true); setLoading(true);
return; return;
} else { } else {
setLoading(false); setLoading(false);
} }
if (info.file.status === 'done') { if (status === 'done') {
// Get this url from response in real world. let { fileName, key } = response.data;
// getBase64(info.file.originFileObj, (imageUrl: any) => { let list = JSON.parse(JSON.stringify(imgList));
// setLoading(true); let obj = {
// setImageUrl(imageUrl); uid: Math.floor(Math.random() * 100),
// }); name: fileName,
console.log(info); status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
};
if (!list[parseInt(key)]) {
// 先判断这个是不是在上传途中被删除掉了
message.warning('The current category has been deleted');
return false;
} else {
// 否则添加进去
list[parseInt(key)].fileList.push(obj);
setImgList([...list]);
}
} }
}; };
// 新增的按钮 // 新增的按钮
const add = () => { const add = () => {
let list = Object.assign(imgList); let list = JSON.parse(JSON.stringify(imgList));
let item = [ let item = {
{
id: Math.floor(Math.random() * 100), id: Math.floor(Math.random() * 100),
name: '', name: '',
fileList: [], fileList: [],
}, tip: true,
]; message: '123',
};
list.push(item); list.push(item);
console.log(list);
setImgList([...list]); setImgList([...list]);
}; };
// 删除的按钮 // 删除的按钮
const del = (index: any) => { const del = (index: any) => {
let list = Object.assign(imgList); let list = JSON.parse(JSON.stringify(imgList));
list.splice(index, 1); list.splice(index, 1);
setImgList([...list]); setImgList([...list]);
}; };
// 上传的按钮
const uploadButton = (
<div>
{loading ? <LoadingOutlined /> : <PlusOutlined />}
<div style={{ marginTop: 8 }}>Upload</div>
</div>
);
//携带数据 、 传递给后台加 key
const updeta = (key: any) => {
data.key = key;
return data;
};
// 点击预览
const handlePreview = async (file: any) => {
if (!file.url && !file.preview) {
// file.preview = await getBase64(file.originFileObj);
}
console.log(file);
// setpreviewImage(file.url || file.preview);
// setpreviewTitle(file.name);
// setpreviewVisible(true);
};
return ( return (
<> <>
{imgList.map((item: any, index: any) => { {imgList.map((item: any, index: any) => {
return ( return (
<div className="pdf" key={index}> <div className="pdf" key={index}>
<span> <div className={item.tip ? 'inpt ant-form-item-has-error' : 'inpt'}>
<Input placeholder="Basic usage" className="pdf-input" /> <Input placeholder="Basic usage" className="pdf-input" />
</span> {item.tip ? <span className="tips">{item.message}</span> : null}
<div className="pdf-div"> </div>
<div className={item.tip ? 'pdf-div ant-upload-list-item-error' : 'pdf-div'}>
<Upload <Upload
className="avatar-uploader" className="avatar-uploader"
accept=".pdf" accept=".pdf"
action={action != null ? action : '/tos/image/upload'} action={action != null ? action : '/tos/community/pdf/upload'}
data={data} data={() => updeta(index)} // 携带数据
name="file" name="file"
listType="picture" listType="picture-card"
fileList={item.fileList} fileList={item.fileList}
// showUploadList={false} // showUploadList={false}
onPreview={handlePreview} // 预览
beforeUpload={beforeUpload} beforeUpload={beforeUpload}
onChange={handleChange} onChange={handleChange}
> >
<Button icon={loading ? <LoadingOutlined /> : <PlusOutlined />}>Upload</Button> {item.fileList && item.fileList.length >= 5 ? null : uploadButton}
</Upload> </Upload>
<MinusCircleOutlined <MinusCircleOutlined
className="pdf-icon" className="pdf-icon"
......
...@@ -8,16 +8,36 @@ ...@@ -8,16 +8,36 @@
// pdf上传 // pdf上传
.pdf { .pdf {
margin-bottom: 15px; margin-bottom: 15px;
display: flex;
justify-content: baseline;
.inpt {
position: relative;
height: 110px;
.tips {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
color: #f00;
}
}
.pdf-input { .pdf-input {
width: 104px; width: 104px;
margin-right: 10px; margin-right: 10px;
} }
.pdf-div { .pdf-div {
display: inline-block !important; vertical-align: super;
min-height: 112px;
.ant-upload-picture-card-wrapper {
width: auto;
}
&.ant-upload-list-item-error {
.ant-upload {
border-color: #f00;
}
} }
.avatar-uploader {
display: inline-block !important;
width: 100px;
} }
.pdf-icon { .pdf-icon {
font-size: 20px !important; font-size: 20px !important;
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Pagination } from 'antd'; import { Pagination, DatePicker } from 'antd';
import {} from '@ant-design/icons'; import {} from '@ant-design/icons';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import { RA } from '@/utils/method'; import { RA } from '@/utils/method';
...@@ -69,7 +69,7 @@ const SystemFeedback = (props: any) => { ...@@ -69,7 +69,7 @@ const SystemFeedback = (props: any) => {
let p = { let p = {
pageNum: page, pageNum: page,
}; };
setTerm({ ...p }); setTerm({ ...term, ...p });
RA(59, p, module, dispatch); RA(59, p, module, dispatch);
}; };
...@@ -78,8 +78,26 @@ const SystemFeedback = (props: any) => { ...@@ -78,8 +78,26 @@ const SystemFeedback = (props: any) => {
RA(59, term, module, dispatch); RA(59, term, module, dispatch);
}; };
// 日期选择
function onChange(date: any, dateString: any) {
let time = {
submissionTime: dateString ? dateString : null,
};
setTerm({ ...term, ...time });
RA(59, { ...term, ...time }, module, dispatch);
}
//不能选之后的日期
function disabledDate(current: any) {
// Can not select days before today and today
return current && current > moment().endOf('day');
}
return ( return (
<> <>
<div style={{ padding: '20px 20px 0 20px' }}>
<DatePicker onChange={onChange} disabledDate={disabledDate} />
</div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<ProTable <ProTable
dataSource={Data ? Data.list : null} dataSource={Data ? Data.list : null}
......
...@@ -214,6 +214,7 @@ const Adds = (props: any) => { ...@@ -214,6 +214,7 @@ const Adds = (props: any) => {
// 表单提交 // 表单提交
function onFinish(values: any) { function onFinish(values: any) {
console.log(values);
// 额外判断 // 额外判断
let obj: any = new Object(); let obj: any = new Object();
...@@ -229,8 +230,8 @@ const Adds = (props: any) => { ...@@ -229,8 +230,8 @@ const Adds = (props: any) => {
obj.residentialManagerUserName = undeFi(values.residentialManagerUserName); obj.residentialManagerUserName = undeFi(values.residentialManagerUserName);
obj.residentialStartWorking = values.workingHours[0].format('HH:mm'); obj.residentialStartWorking = values.workingHours[0].format('HH:mm');
obj.residentialEndWorking = values.workingHours[1].format('HH:mm'); obj.residentialEndWorking = values.workingHours[1].format('HH:mm');
obj.residentialPhone = values.info.tel; obj.residentialPhone = values.tel;
obj.residentialEmail = values.info.email; obj.residentialEmail = values.email;
// 上传内容 // 上传内容
...@@ -265,10 +266,10 @@ const Adds = (props: any) => { ...@@ -265,10 +266,10 @@ const Adds = (props: any) => {
if (Data) { if (Data) {
obj.id = Data.id; obj.id = Data.id;
} }
// console.log(values); console.log(values);
// console.log(obj); console.log(obj);
// 上传 // 上传
RA(29, obj, 'CellList', dispatch); // RA(29, obj, 'CellList', dispatch);
} }
// 返回 // 返回
...@@ -412,7 +413,11 @@ const Adds = (props: any) => { ...@@ -412,7 +413,11 @@ const Adds = (props: any) => {
</Form.Item> </Form.Item>
{/* 小区联系方式 */} {/* 小区联系方式 */}
<Form.Item name="tel" label="Community Telephone" rules={village[4] as any}> <Form.Item
name="residentialPhone"
label="Community Telephone"
rules={village[4] as any}
>
<Input <Input
style={{ marginRight: '10px', width: '240px' }} style={{ marginRight: '10px', width: '240px' }}
placeholder="Please enter phone" placeholder="Please enter phone"
...@@ -422,7 +427,7 @@ const Adds = (props: any) => { ...@@ -422,7 +427,7 @@ const Adds = (props: any) => {
</Form.Item> </Form.Item>
{/* 小区邮箱 */} {/* 小区邮箱 */}
<Form.Item name="email" label="Community Mailbox" rules={village[5] as any}> <Form.Item name="residentialEmail" label="Community Mailbox" rules={village[5] as any}>
<Input style={{ width: '240px' }} placeholder="Please enter email" /> <Input style={{ width: '240px' }} placeholder="Please enter email" />
</Form.Item> </Form.Item>
...@@ -452,7 +457,8 @@ const Adds = (props: any) => { ...@@ -452,7 +457,8 @@ const Adds = (props: any) => {
<PictureOptionsRow <PictureOptionsRow
action="/tos/image/upload" action="/tos/image/upload"
data={{ data={{
imageType: 'tosNotice', imageType: 'communityBannerImage',
// extends: codename,
}} }}
limitNums={1} limitNums={1}
// imgs={ImageSrc} // imgs={ImageSrc}
...@@ -462,10 +468,21 @@ const Adds = (props: any) => { ...@@ -462,10 +468,21 @@ const Adds = (props: any) => {
{/* 第一个上传 */} {/* 第一个上传 */}
<Form.Item name={'banner2'} label="Maintenance Schedule:" colon={false}> <Form.Item name={'banner2'} label="Maintenance Schedule:" colon={false}>
<PdfUpload <PdfUpload
action="/tos/image/upload" action="/tos/community/pdf/upload"
data={{
type: 'tosCommunityPdf',
extends: codename,
}}
></PdfUpload>
</Form.Item>
{/* 第二个上传 */}
<Form.Item name={'banner3'} label=" Essential Information:" colon={false}>
<PdfUpload
action="/tos/community/pdf/upload"
data={{ data={{
imageType: 'tosNotice', type: 'tosCommunityPdf',
comName: codename, extends: codename,
}} }}
></PdfUpload> ></PdfUpload>
</Form.Item> </Form.Item>
......
...@@ -38,8 +38,7 @@ li { ...@@ -38,8 +38,7 @@ li {
margin-left: 0; margin-left: 0;
display: block; display: block;
} }
input, input {
.ant-upload-list {
width: 240px; width: 240px;
} }
.ant-picker-range { .ant-picker-range {
......
...@@ -110,8 +110,8 @@ const VisitorRecord = (props: any) => { ...@@ -110,8 +110,8 @@ const VisitorRecord = (props: any) => {
<div style={{ width: '100%', padding: '0px 15px 15px 15px', backgroundColor: '#ffffff' }}> <div style={{ width: '100%', padding: '0px 15px 15px 15px', backgroundColor: '#ffffff' }}>
<ProTable <ProTable
loading={loading} loading={loading}
rowKey="id"
dataSource={Data != null ? Data.list : null} dataSource={Data != null ? Data.list : null}
rowKey="index"
columns={columns} columns={columns}
pagination={false} // 隐藏默认分页 pagination={false} // 隐藏默认分页
search={false} search={false}
......
...@@ -110,8 +110,8 @@ const VisitorRecord = (props: any) => { ...@@ -110,8 +110,8 @@ const VisitorRecord = (props: any) => {
<div style={{ width: '100%', padding: '0px 15px 15px 15px', backgroundColor: '#ffffff' }}> <div style={{ width: '100%', padding: '0px 15px 15px 15px', backgroundColor: '#ffffff' }}>
<ProTable <ProTable
loading={loading} loading={loading}
rowKey="id"
dataSource={Data != null ? Data.list : null} dataSource={Data != null ? Data.list : null}
rowKey="index"
columns={columns} columns={columns}
pagination={false} // 隐藏默认分页 pagination={false} // 隐藏默认分页
search={false} search={false}
......
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