Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TOSTUMI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maple
TOSTUMI
Commits
e5cd4123
Commit
e5cd4123
authored
May 21, 2021
by
cellee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Signed-off-by: cellee <893264950@qq.com>
parent
1596dbf3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
166 additions
and
106 deletions
+166
-106
service.tsx
src/pages/AccountManagement/Service/service.tsx
+16
-4
serviceEdit.tsx
src/pages/AccountManagement/Service/serviceEdit.tsx
+150
-102
No files found.
src/pages/AccountManagement/Service/service.tsx
View file @
e5cd4123
...
@@ -50,17 +50,25 @@ const service = (props: any) => {
...
@@ -50,17 +50,25 @@ const service = (props: any) => {
<
Space
size=
"middle"
>
<
Space
size=
"middle"
>
<
a
<
a
onClick=
{
()
=>
{
onClick=
{
()
=>
{
e
mpty
s
(
record
,
`/AccountManagement/service/edit`
);
e
dit
s
(
record
,
`/AccountManagement/service/edit`
);
}
}
}
}
>
>
Edit
Add
</
a
>
</
a
>
<
a
<
a
onClick=
{
()
=>
{
onClick=
{
()
=>
{
emptys
(
record
,
'/AccountManagement/service/detail'
);
emptys
(
record
,
'/AccountManagement/service/detail'
);
}
}
}
}
>
>
Detail
Edit
</
a
>
<
a
onClick=
{
()
=>
{
message
.
warning
(
'Under development'
);
}
}
>
Download
</
a
>
</
a
>
</
Space
>
</
Space
>
),
),
...
@@ -86,7 +94,7 @@ const service = (props: any) => {
...
@@ -86,7 +94,7 @@ const service = (props: any) => {
}
}
},
[
location
,
Init
,
Data
]);
},
[
location
,
Init
,
Data
]);
// 清除操作之前的数据
// 清除操作之前的数据
在跳转
const
emptys
=
(
data
:
any
,
url
:
any
)
=>
{
const
emptys
=
(
data
:
any
,
url
:
any
)
=>
{
// dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
// dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
dispatch
({
type
:
module
+
'/Result'
});
// 清掉之前的删除结果
dispatch
({
type
:
module
+
'/Result'
});
// 清掉之前的删除结果
...
@@ -95,6 +103,10 @@ const service = (props: any) => {
...
@@ -95,6 +103,10 @@ const service = (props: any) => {
history
.
push
(
url
+
'/'
+
data
.
id
);
history
.
push
(
url
+
'/'
+
data
.
id
);
};
};
const
edits
=
(
data
:
any
,
url
:
any
)
=>
{
history
.
push
(
url
+
'/'
+
data
.
communityName
);
};
// 点击搜索
// 点击搜索
const
CallBackTitleSearch
=
(
comment
:
any
)
=>
{
const
CallBackTitleSearch
=
(
comment
:
any
)
=>
{
...
...
src/pages/AccountManagement/Service/serviceEdit.tsx
View file @
e5cd4123
/*
/*
* @Author: your name
* @Author: your name
* @Date: 2021-03-02 14:39:40
* @Date: 2021-03-02 14:39:40
* @LastEditTime: 2021-0
4-22 15:18:59
* @LastEditTime: 2021-0
5-21 18:01:22
* @LastEditors: Please set LastEditors
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\pages\AccountManagement\Service\serviceEdit.tsx
* @FilePath: \tostumi\src\pages\AccountManagement\Service\serviceEdit.tsx
*/
*/
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Button
,
Spin
,
Form
,
Input
}
from
'antd'
;
import
{
Button
,
Spin
,
Form
,
Input
,
message
}
from
'antd'
;
import
{
connect
}
from
'umi'
;
import
{
connect
}
from
'umi'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
const
{
TextArea
}
=
Input
;
const
{
TextArea
}
=
Input
;
import
{
RA
,
SA
}
from
'@/utils/method'
;
import
{
RA
}
from
'@/utils/method'
;
const
module
=
'ServicePro'
;
const
module
=
'ServicePro'
;
import
'./service.less'
;
import
'./service.less'
;
...
@@ -19,100 +20,119 @@ import TitleBack from '@/components/TitleBack/TitleBack';
...
@@ -19,100 +20,119 @@ import TitleBack from '@/components/TitleBack/TitleBack';
import
SearchOptionsCommnity
from
'@/components/SearchOptions/SearchOptionsCommnity'
;
import
SearchOptionsCommnity
from
'@/components/SearchOptions/SearchOptionsCommnity'
;
import
PictureOptionsRow
from
'@/components/PictureOptions/PictureOptionsRow'
;
import
PictureOptionsRow
from
'@/components/PictureOptions/PictureOptionsRow'
;
import
moment
from
'moment'
;
import
{
getUrlPicName
}
from
'@/utils/string'
;
const
service
=
(
props
:
any
)
=>
{
const
service
=
(
props
:
any
)
=>
{
const
{
DataSave
,
dispatch
,
loading
,
match
}
=
props
;
const
{
DataSave
,
dispatch
,
loading
,
match
,
user
}
=
props
;
const
[
term
,
setTerm
]
=
useState
(
null
as
any
);
// 默认小区
const
[
term
,
setTerm
]
=
useState
(
null
as
any
);
// 默认小区
const
[
ImageSrc
,
setImageSrc
]
=
useState
([]
as
any
);
// 图片地址
const
[
ImageSrc
,
setImageSrc
]
=
useState
([]
as
any
);
// 图片地址
const
[
imgs
,
setImgs
]
=
useState
([]
as
any
);
// 回复地址
const
[
report
,
setreport
]
=
useState
([]
as
any
);
// 循环新增的报告
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
// 监听是否有数据
// 监听是否有数据
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
match
.
params
.
id
)
{
if
(
match
.
params
.
id
)
{
RA
(
69
,
{
id
:
match
.
params
.
id
},
module
,
dispatch
);
console
.
log
(
match
.
params
.
id
);
setTerm
(
match
.
params
.
id
);
// RA(69, { id: match.params.id }, module, dispatch);
}
}
},
[
match
]);
},
[
match
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
DataSave
!=
null
)
{
if
(
DataSave
!=
null
)
{
setTerm
({
...
DataSave
});
}
},
[
DataSave
]);
form
.
setFieldsValue
({
//onFinish 提交
communityName
:
DataSave
.
communityName
,
const
onFinish
=
(
values
:
any
)
=>
{
reportContent
:
DataSave
.
reportContent
,
// 存储个数
reportImages
:
DataSave
.
reportImages
?
DataSave
.
reportImages
.
split
(
','
)
:
null
,
let
num
=
[];
});
if
(
DataSave
.
reportPictures
.
length
>
0
)
{
// 先抽取所有的key
// 图片名any
let
obj
=
Object
.
keys
(
values
);
let
a
=
DataSave
.
reportPictures
.
map
((
item
:
any
,
i
:
any
)
=>
{
let
img
=
DataSave
.
reportImages
.
split
(
','
);
let
key
=
img
[
i
];
return
{
uid
:
i
,
name
:
key
,
status
:
'done'
,
url
:
item
,
};
});
// 图片列表
setImageSrc
(
a
);
}
if
(
DataSave
.
replyData
.
length
>
0
)
{
// 再看有多少个 值
// 图片名any
for
(
let
i
in
obj
)
{
let
b
=
[]
as
any
;
if
(
obj
[
i
].
indexOf
(
'reportContent'
)
!=
-
1
)
{
DataSave
.
replyData
[
0
].
replyPictures
.
map
((
item
:
any
,
i
:
any
)
=>
{
num
.
push
(
obj
[
i
]);
let
obj
=
{
}
uid
:
i
,
}
name
:
getUrlPicName
(
item
),
// 删除第一个
status
:
'done'
,
num
.
splice
(
num
.
indexOf
(
'reportContent'
),
1
);
url
:
item
,
// 开始拼接
let
tosReportRecordModels
=
[];
// 第一个是都有的
let
requte
=
{
reporterId
:
user
.
currentUser
.
userModel
.
id
,
communityName
:
values
.
communityName
,
imagesList
:
values
.
imagesList
,
reportContent
:
values
.
reportContent
,
};
};
b
.
push
(
obj
);
});
// 回复列表
setImgs
(
b
);
form
.
setFieldsValue
({
// 添加进去
replyContent
:
DataSave
.
replyData
[
0
].
replyContent
,
tosReportRecordModels
.
push
(
requte
);
// 如果存在其他的
if
(
num
.
length
>
0
)
{
num
.
forEach
((
i
,
idx
)
=>
{
let
img
=
'imagesList'
+
idx
;
let
cont
=
'reportContent'
+
idx
;
let
objs
=
{
reporterId
:
user
.
currentUser
.
userModel
.
id
,
communityName
:
values
.
communityName
,
imagesList
:
values
[
img
],
reportContent
:
values
[
cont
],
};
tosReportRecordModels
.
push
(
objs
);
});
});
}
}
}
// 最后结果
},
[
DataSave
]);
let
oves
=
{
tosReportRecordModels
,
};
//onFinish 提交
// 再发起请求
const
onFinish
=
(
values
:
any
)
=>
{
RA
(
77
,
oves
,
module
,
dispatch
);
values
.
id
=
match
.
params
.
id
;
values
.
reportImages
=
values
.
reportImages
?
values
.
reportImages
.
join
(
','
)
:
null
;
values
.
replyImages
=
values
.
replyImages
?
values
.
replyImages
.
join
(
','
)
:
null
;
RA
(
70
,
values
,
module
,
dispatch
);
};
};
// 选择小区名字并赋值
// 选择小区名字并赋值
const
opname
=
(
value
:
any
)
=>
{
const
opname
=
(
value
:
any
)
=>
{
//
console.log(value);
//
if (value) {
if
(
value
)
{
// RA(72, { communityName: value }, module, dispatch);
RA
(
72
,
{
communityName
:
value
},
module
,
dispatch
);
// }
}
// setTerm(value);
form
.
setFieldsValue
({
form
.
setFieldsValue
({
communityName
:
value
,
communityName
:
value
,
});
});
};
};
// 增加
const
addItem
=
()
=>
{
// 先检查表单内容填完了没
let
objs
=
form
.
getFieldsValue
();
// 存在没填写的就禁止增加
for
(
let
i
in
objs
)
{
if
(
typeof
objs
[
i
]
===
'undefined'
)
{
message
.
warning
(
'Please enter all information!'
);
return
false
;
}
}
// 再新增
let
a
=
report
;
a
.
push
(
report
.
length
);
setreport
([...
a
]);
};
return
(
return
(
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
<
div
className=
"edit"
>
<
div
className=
"edit"
>
{
/* 标题 */
}
{
/* 标题 */
}
<
TitleBack
title=
{
'
Edit
report'
}
/>
<
TitleBack
title=
{
'
Add
report'
}
/>
{
/* 信息 */
}
{
/* 信息 */
}
<
div
className=
"form_s"
>
<
div
className=
"form_s"
>
<
Form
<
Form
...
@@ -128,31 +148,32 @@ const service = (props: any) => {
...
@@ -128,31 +148,32 @@ const service = (props: any) => {
<
SearchOptionsCommnity
<
SearchOptionsCommnity
// ubmit={extendName}
// ubmit={extendName}
opname=
{
opname
}
opname=
{
opname
}
defaultName=
{
term
?
term
.
communityName
:
null
}
defaultName=
{
term
}
// type={1} // 单选还是多选 单选就直接去掉
// type={1} // 单选还是多选 单选就直接去掉
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
{
/* 小区地址 */
}
<
Form
.
Item
label=
"Address"
>
<
span
>
{
term
?
`${term.communityAddress} , ${term.postCode}`
:
null
}
</
span
>
</
Form
.
Item
>
{
/* 报告人 */
}
<
Form
.
Item
label=
"Reported By"
>
<
span
>
{
term
?
term
.
reporterName
:
null
}
</
span
>
</
Form
.
Item
>
{
/* 报告人联系方式 */
}
<
Form
.
Item
label=
"Contact Details"
>
{
/* <span style={{ display: 'inline-block', marginRight: 20 }}>
{term ? term.reporterEmail : null}
</span> */
}
<
span
>
{
term
?
term
.
reporterPhone
:
null
}
</
span
>
</
Form
.
Item
>
{
/* 报告描述 */
}
{
/* 报告描述 */
}
<
Form
.
Item
label=
"Description"
name=
"reportContent"
rules=
{
[{
required
:
true
}]
}
>
<
Form
.
Item
label=
"Description"
name=
"reportContent"
rules=
{
[{
required
:
true
}]
}
>
<
div
className=
"psoBox flex"
>
<
TextArea
rows=
{
4
}
style=
{
{
maxWidth
:
600
,
width
:
'100%'
}
}
/>
<
TextArea
rows=
{
4
}
style=
{
{
maxWidth
:
600
,
width
:
'100%'
}
}
/>
{
report
.
length
==
0
?
(
<
div
className=
"psoBtn"
>
<
Button
shape=
"circle"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
{
addItem
();
}
}
/>
</
div
>
)
:
(
''
)
}
</
div
>
</
Form
.
Item
>
</
Form
.
Item
>
{
/* 报告图片 */
}
{
/* 报告图片 */
}
<
Form
.
Item
label=
"Picture"
name=
"
reportImages
"
rules=
{
[{
required
:
true
}]
}
>
<
Form
.
Item
label=
"Picture"
name=
"
imagesList
"
rules=
{
[{
required
:
true
}]
}
>
<
PictureOptionsRow
<
PictureOptionsRow
action=
"/tos/image/upload"
action=
"/tos/image/upload"
data=
{
{
data=
{
{
...
@@ -166,24 +187,51 @@ const service = (props: any) => {
...
@@ -166,24 +187,51 @@ const service = (props: any) => {
</
Form
.
Item
>
</
Form
.
Item
>
<
hr
></
hr
>
<
hr
></
hr
>
{
/* --------------------------------------------------------------------------------------------- */
}
{
/* --------------------------------------------------------------------------------------------- */
}
{
/* 回复内容 */
}
<
Form
.
Item
label=
"Overview"
name=
"replyContent"
rules=
{
[{
required
:
true
}]
}
>
{
report
.
map
((
i
:
any
,
idx
:
any
)
=>
{
return
(
<
div
key=
{
idx
}
>
<
Form
.
Item
label=
"Description"
name=
{
'reportContent'
+
idx
}
rules=
{
[{
required
:
true
}]
}
>
<
div
className=
"psoBox flex"
>
<
TextArea
rows=
{
4
}
style=
{
{
maxWidth
:
600
,
width
:
'100%'
}
}
/>
<
TextArea
rows=
{
4
}
style=
{
{
maxWidth
:
600
,
width
:
'100%'
}
}
/>
{
idx
==
report
.
length
-
1
?
(
<
div
className=
"psoBtn"
>
<
Button
shape=
"circle"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
{
addItem
();
}
}
/>
</
div
>
)
:
(
''
)
}
</
div
>
</
Form
.
Item
>
</
Form
.
Item
>
{
/* 回复图片 */
}
<
Form
.
Item
label=
"Picture"
name=
"replyImages"
>
<
Form
.
Item
label=
"Picture"
name=
{
'imagesList'
+
idx
}
rules=
{
[{
required
:
true
}]
}
>
<
PictureOptionsRow
<
PictureOptionsRow
action=
"/tos/image/upload"
action=
"/tos/image/upload"
data=
{
{
data=
{
{
// imageType: 'tosReportImage',
imageType
:
'tosReportImage'
,
imageType
:
'tosReplyImage'
,
identification
:
''
,
identification
:
''
,
}
}
}
}
limitNums=
{
10
}
limitNums=
{
10
}
imgs=
{
imgs
}
imgs=
{
ImageSrc
}
over=
{
loading
}
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
hr
></
hr
>
<
hr
></
hr
>
</
div
>
);
})
}
{
/* --------------------------------------------------------------------------------------------- */
}
{
/* --------------------------------------------------------------------------------------------- */
}
{
/* 提交 */
}
{
/* 提交 */
}
<
Form
.
Item
label=
" "
colon=
{
false
}
>
<
Form
.
Item
label=
" "
colon=
{
false
}
>
...
@@ -199,9 +247,9 @@ const service = (props: any) => {
...
@@ -199,9 +247,9 @@ const service = (props: any) => {
};
};
function
map
(
state
:
any
)
{
function
map
(
state
:
any
)
{
const
loading
=
state
.
loading
.
models
.
ServicePro
;
const
loading
=
state
.
loading
.
global
;
const
Init
=
state
.
Init
;
const
{
Init
,
user
}
=
state
;
const
{
DataSave
,
curString
,
village
}
=
state
[
module
];
const
{
DataSave
,
curString
,
village
}
=
state
[
module
];
return
{
DataSave
,
loading
,
curString
,
village
,
Init
};
return
{
DataSave
,
loading
,
curString
,
village
,
Init
,
user
};
}
}
export
default
connect
(
map
)(
service
);
export
default
connect
(
map
)(
service
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment