Commit 4a459f3b authored by cellee's avatar cellee

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

parent 34bd254a
......@@ -86,15 +86,15 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://47.74.233.180:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
'/tos/': {
target: 'http://192.168.1.28:8651',
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://192.168.1.28:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
},
};
/*
* @Author: your name
* @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
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\components\Form\PdfUpload.tsx
*/
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';
interface PriceInputProps {
......@@ -35,67 +35,106 @@ const PdfUpload: React.FC<PriceInputProps> = ({ value = {}, onChange, disabled,
return isJpgOrPng && isLt2M;
}
// 上传成功怎么做
const handleChange = (info: any) => {
if (info.file.status === 'uploading') {
let { status, response } = info.file;
if (status === 'uploading') {
setLoading(true);
return;
} else {
setLoading(false);
}
if (info.file.status === 'done') {
// Get this url from response in real world.
// getBase64(info.file.originFileObj, (imageUrl: any) => {
// setLoading(true);
// setImageUrl(imageUrl);
// });
console.log(info);
if (status === 'done') {
let { fileName, key } = response.data;
let list = JSON.parse(JSON.stringify(imgList));
let obj = {
uid: Math.floor(Math.random() * 100),
name: fileName,
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 = () => {
let list = Object.assign(imgList);
let item = [
{
let list = JSON.parse(JSON.stringify(imgList));
let item = {
id: Math.floor(Math.random() * 100),
name: '',
fileList: [],
},
];
tip: true,
message: '123',
};
list.push(item);
console.log(list);
setImgList([...list]);
};
// 删除的按钮
const del = (index: any) => {
let list = Object.assign(imgList);
let list = JSON.parse(JSON.stringify(imgList));
list.splice(index, 1);
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 (
<>
{imgList.map((item: any, index: any) => {
return (
<div className="pdf" key={index}>
<span>
<div className={item.tip ? 'inpt ant-form-item-has-error' : 'inpt'}>
<Input placeholder="Basic usage" className="pdf-input" />
</span>
<div className="pdf-div">
{item.tip ? <span className="tips">{item.message}</span> : null}
</div>
<div className={item.tip ? 'pdf-div ant-upload-list-item-error' : 'pdf-div'}>
<Upload
className="avatar-uploader"
accept=".pdf"
action={action != null ? action : '/tos/image/upload'}
data={data}
action={action != null ? action : '/tos/community/pdf/upload'}
data={() => updeta(index)} // 携带数据
name="file"
listType="picture"
listType="picture-card"
fileList={item.fileList}
// showUploadList={false}
onPreview={handlePreview} // 预览
beforeUpload={beforeUpload}
onChange={handleChange}
>
<Button icon={loading ? <LoadingOutlined /> : <PlusOutlined />}>Upload</Button>
{item.fileList && item.fileList.length >= 5 ? null : uploadButton}
</Upload>
<MinusCircleOutlined
className="pdf-icon"
......
......@@ -8,16 +8,36 @@
// pdf上传
.pdf {
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 {
width: 104px;
margin-right: 10px;
}
.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 {
font-size: 20px !important;
......
import React, { useState, useEffect, useRef } from 'react';
import { Pagination } from 'antd';
import { Pagination, DatePicker } from 'antd';
import {} from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
import { RA } from '@/utils/method';
......@@ -69,7 +69,7 @@ const SystemFeedback = (props: any) => {
let p = {
pageNum: page,
};
setTerm({ ...p });
setTerm({ ...term, ...p });
RA(59, p, module, dispatch);
};
......@@ -78,8 +78,26 @@ const SystemFeedback = (props: any) => {
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 (
<>
<div style={{ padding: '20px 20px 0 20px' }}>
<DatePicker onChange={onChange} disabledDate={disabledDate} />
</div>
<div style={{ padding: 20 }}>
<ProTable
dataSource={Data ? Data.list : null}
......
......@@ -214,6 +214,7 @@ const Adds = (props: any) => {
// 表单提交
function onFinish(values: any) {
console.log(values);
// 额外判断
let obj: any = new Object();
......@@ -229,8 +230,8 @@ const Adds = (props: any) => {
obj.residentialManagerUserName = undeFi(values.residentialManagerUserName);
obj.residentialStartWorking = values.workingHours[0].format('HH:mm');
obj.residentialEndWorking = values.workingHours[1].format('HH:mm');
obj.residentialPhone = values.info.tel;
obj.residentialEmail = values.info.email;
obj.residentialPhone = values.tel;
obj.residentialEmail = values.email;
// 上传内容
......@@ -265,10 +266,10 @@ const Adds = (props: any) => {
if (Data) {
obj.id = Data.id;
}
// console.log(values);
// console.log(obj);
console.log(values);
console.log(obj);
// 上传
RA(29, obj, 'CellList', dispatch);
// RA(29, obj, 'CellList', dispatch);
}
// 返回
......@@ -412,7 +413,11 @@ const Adds = (props: any) => {
</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
style={{ marginRight: '10px', width: '240px' }}
placeholder="Please enter phone"
......@@ -422,7 +427,7 @@ const Adds = (props: any) => {
</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" />
</Form.Item>
......@@ -452,7 +457,8 @@ const Adds = (props: any) => {
<PictureOptionsRow
action="/tos/image/upload"
data={{
imageType: 'tosNotice',
imageType: 'communityBannerImage',
// extends: codename,
}}
limitNums={1}
// imgs={ImageSrc}
......@@ -462,10 +468,21 @@ const Adds = (props: any) => {
{/* 第一个上传 */}
<Form.Item name={'banner2'} label="Maintenance Schedule:" colon={false}>
<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={{
imageType: 'tosNotice',
comName: codename,
type: 'tosCommunityPdf',
extends: codename,
}}
></PdfUpload>
</Form.Item>
......
......@@ -38,8 +38,7 @@ li {
margin-left: 0;
display: block;
}
input,
.ant-upload-list {
input {
width: 240px;
}
.ant-picker-range {
......
......@@ -110,8 +110,8 @@ const VisitorRecord = (props: any) => {
<div style={{ width: '100%', padding: '0px 15px 15px 15px', backgroundColor: '#ffffff' }}>
<ProTable
loading={loading}
rowKey="id"
dataSource={Data != null ? Data.list : null}
rowKey="index"
columns={columns}
pagination={false} // 隐藏默认分页
search={false}
......
......@@ -110,8 +110,8 @@ const VisitorRecord = (props: any) => {
<div style={{ width: '100%', padding: '0px 15px 15px 15px', backgroundColor: '#ffffff' }}>
<ProTable
loading={loading}
rowKey="id"
dataSource={Data != null ? Data.list : null}
rowKey="index"
columns={columns}
pagination={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