Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-convertor-view
Project
Project
Details
Activity
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
station
amos-convertor-view
Commits
a266d2ed
Commit
a266d2ed
authored
Apr 13, 2021
by
王珂
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_upgrade' of 172.16.10.76:station/amos-convertor-view into dev_upgrade
parents
02287a1e
4e4700cd
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
213 additions
and
67 deletions
+213
-67
point.scss
src/styles/view/biz/point/point.scss
+3
-2
request.js
src/utils/request.js
+137
-0
EquipmentModel.js
src/view/bizview/equipmentLedger/Equipment/EquipmentModel.js
+41
-3
index.js
src/view/bizview/equipmentLedger/Equipment/index.js
+1
-0
PointSearch.js
src/view/bizview/point/PointSearch.js
+27
-33
PointStatistics.js
src/view/bizview/point/PointStatistics.js
+4
-29
No files found.
src/styles/view/biz/point/point.scss
View file @
a266d2ed
...
...
@@ -49,8 +49,9 @@
position
:
absolute
;
text-align
:
center
;
font-size
:
20px
;
top
:
40%
;
right
:
40%
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
}
...
...
src/utils/request.js
View file @
a266d2ed
...
...
@@ -25,6 +25,8 @@ const compleHeaders = () => {
};
};
/**
* 获取 token
*/
...
...
@@ -194,4 +196,139 @@ export const fileDownload = ({ url, data, fileName, method = 'GET' }) => {
});
};
export
const
recursive
=
function
(
list
,
childName
=
'children'
)
{
class
recursiveClass
{
constructor
(
_list
,
_childName
)
{
this
.
list
=
_list
||
[];
this
.
childName
=
_childName
;
}
some
(
callback
)
{
const
func
=
arr
=>
{
return
arr
.
some
((
e
,
index
)
=>
{
const
flag
=
callback
(
e
,
index
);
if
(
flag
)
{
return
flag
;
}
else
{
if
(
e
[
this
.
childName
]
&&
e
[
this
.
childName
].
length
>
0
)
{
return
func
(
e
[
this
.
childName
]);
}
}
return
false
;
});
};
return
func
(
this
.
list
);
}
find
(
callback
)
{
let
obj
=
null
;
const
func
=
(
arr
,
parent
)
=>
{
return
arr
.
find
((
e
,
index
)
=>
{
const
flag
=
callback
(
e
,
index
,
parent
);
if
(
flag
)
{
obj
=
e
;
return
flag
;
}
else
{
if
(
e
[
this
.
childName
]
&&
e
[
this
.
childName
].
length
>
0
)
{
return
func
(
e
[
this
.
childName
],
e
);
}
}
return
false
;
});
};
func
(
this
.
list
,
{});
return
obj
;
}
findParent
(
callback
)
{
let
obj
=
null
;
const
func
=
(
arr
,
parent
)
=>
{
return
arr
.
find
((
e
,
index
)
=>
{
const
flag
=
callback
(
e
,
index
,
parent
);
if
(
flag
)
{
obj
=
parent
;
return
flag
;
}
else
{
if
(
e
[
this
.
childName
]
&&
e
[
this
.
childName
].
length
>
0
)
{
return
func
(
e
[
this
.
childName
],
e
);
}
}
return
false
;
});
};
func
(
this
.
list
,
{});
return
obj
;
}
findIndex
(
callback
)
{
let
resIndex
=
-
1
;
const
func
=
(
arr
,
parent
)
=>
{
return
arr
.
find
((
e
,
index
)
=>
{
const
flag
=
callback
(
e
,
index
,
parent
);
if
(
flag
)
{
resIndex
=
index
;
return
flag
;
}
else
{
if
(
e
[
this
.
childName
]
&&
e
[
this
.
childName
].
length
>
0
)
{
return
func
(
e
[
this
.
childName
],
e
);
}
}
return
false
;
});
};
func
(
this
.
list
,
{});
return
resIndex
;
}
filter
(
callback
)
{
const
func
=
(
arr
,
parent
)
=>
{
return
arr
.
filter
((
e
,
index
)
=>
{
const
flag
=
callback
(
e
,
index
,
parent
);
if
(
flag
)
{
if
(
e
[
this
.
childName
]
&&
e
[
this
.
childName
].
length
>
0
)
{
e
[
this
.
childName
]
=
func
(
e
[
this
.
childName
],
e
);
}
}
return
flag
;
});
};
return
func
(
this
.
list
,
{});
}
search
(
callback
)
{
const
func
=
(
arr
,
parent
)
=>
{
return
arr
.
filter
((
e
,
index
)
=>
{
let
flag
=
callback
(
e
,
index
,
parent
);
if
(
e
[
this
.
childName
]
&&
e
[
this
.
childName
].
length
>
0
)
{
e
[
this
.
childName
]
=
func
(
e
[
this
.
childName
],
e
);
if
(
e
[
this
.
childName
]
&&
e
[
this
.
childName
].
length
>
0
)
{
flag
=
true
;
}
}
return
flag
;
});
};
return
func
(
this
.
list
,
{});
}
map
(
callback
)
{
const
func
=
(
arr
,
parent
)
=>
{
return
arr
.
map
((
e
,
index
)
=>
{
const
node
=
callback
(
e
,
index
,
parent
);
if
(
node
)
{
e
=
node
;
}
if
(
e
[
this
.
childName
]
&&
e
[
this
.
childName
].
length
>
0
)
{
e
[
this
.
childName
]
=
func
(
e
[
this
.
childName
],
e
);
}
return
e
;
});
};
return
func
(
this
.
list
,
{});
}
}
return
new
recursiveClass
(
list
,
childName
);
};
export
{
amosRequest
,
singleFetch
,
convertDatalist
,
buildPageable
,
formatUrl
};
src/view/bizview/equipmentLedger/Equipment/EquipmentModel.js
View file @
a266d2ed
...
...
@@ -51,6 +51,7 @@ class EquipmentModel extends Component {
imageUrl2
:
[],
imageUrl3
:
[],
imageUrl4
:
[],
equipmentPic
:
[],
reservePlan
:
''
,
riskSourceId
:
0
},
...
...
@@ -60,7 +61,8 @@ class EquipmentModel extends Component {
rules
:
{
code
:
[{
required
:
true
,
message
:
'编码不能为空'
}],
name
:
[{
required
:
true
,
message
:
'名称不能为空'
}],
position3d
:
[{
validator
:
this
.
validPositon3d
}]
position3d
:
[{
validator
:
this
.
validPositon3d
}],
equipmentPic
:
[{
required
:
true
,
message
:
'重点设备照片不能为空'
}]
},
previewVisible
:
false
,
previewImage
:
''
,
...
...
@@ -175,7 +177,7 @@ class EquipmentModel extends Component {
console
.
log
(
data
);
data
.
forEach
(
ele
=>
{
let
type
=
ele
.
type
;
if
(
type
>=
1
&&
type
<=
4
)
{
if
(
type
>=
1
)
{
pMap
.
set
(
type
,
ele
.
picture
);
}
});
...
...
@@ -231,6 +233,9 @@ class EquipmentModel extends Component {
case 4:
_form.imageUrl4 = [file];
break;
case 5:
_form.equipmentPic = [file];
break;
}
this.setState({ form: _form });
};
...
...
@@ -255,7 +260,7 @@ class EquipmentModel extends Component {
changeData = async file => {
file.url = await getBase64(file);
let _form = this.state.form;
let { imageUrl1 = [], imageUrl2 = [], imageUrl3 = [], imageUrl4 = [] } = this.state.form;
let { imageUrl1 = [], imageUrl2 = [], imageUrl3 = [], imageUrl4 = []
,equipmentPic = []
} = this.state.form;
switch (file.mylist) {
case '
imageUrl1
':
_form.imageUrl1 = [...imageUrl1, file];
...
...
@@ -269,6 +274,10 @@ class EquipmentModel extends Component {
case '
imageUrl4
':
_form.imageUrl4 = [...imageUrl4, file];
break;
case '
equipmentPic
':
_form.equipmentPic = [...equipmentPic, file];
break;
}
this.setState({ form: _form });
};
...
...
@@ -315,6 +324,14 @@ class EquipmentModel extends Component {
this.setState({ form });
break;
}
case '
equipmentPic
': {
let index = form.equipmentPic.indexOf(file);
let newFileList = form.equipmentPic.slice();
newFileList.splice(index, 1);
form.equipmentPic = newFileList;
this.setState({ form });
break;
}
}
};
...
...
@@ -545,6 +562,27 @@ class EquipmentModel extends Component {
<FormItem label={<span>备注</span>} field="remark" {...formItemLayout}>
<TextArea rows={4} className="risk_factor_input" required value={form.remark} onChange={e => this.onInputChange('
remark
', e.target.value)} />
</FormItem>
<FormItem label={<span>重点设备照片</span>} field='
equipmentPic
' {...formItemLayout}>
<div>
<Upload
customRequest={this.handleUpload}
className="upload-img"
fileList={form.equipmentPic}
listType="picture-card"
beforeUpload={file => {
file.mylist = '
equipmentPic
';
this.beforeUpload(file);
}}
onPreview={this.handlePreview}
onRemove={file => {
file.mylist = '
equipmentPic
';
this.fileRemove(file);
}}
>
{form.equipmentPic ? form.equipmentPic.length >= 1 ? null : uploadButton : uploadButton}
</Upload>
</div>
</FormItem>
</div>
</Form>
</div>
...
...
src/view/bizview/equipmentLedger/Equipment/index.js
View file @
a266d2ed
...
...
@@ -305,6 +305,7 @@ class Equipment extends Component {
dataValues
.
imageUrl2
&&
formData
.
append
(
'img2'
,
dataValues
.
imageUrl2
[
0
]);
dataValues
.
imageUrl3
&&
formData
.
append
(
'img3'
,
dataValues
.
imageUrl3
[
0
]);
dataValues
.
imageUrl4
&&
formData
.
append
(
'img4'
,
dataValues
.
imageUrl4
[
0
]);
dataValues
.
equipmentPic
&&
formData
.
append
(
'equipmentPic'
,
dataValues
.
equipmentPic
[
0
]);
if
(
dataValues
)
{
for
(
var
key
in
dataValues
)
{
...
...
src/view/bizview/point/PointSearch.js
View file @
a266d2ed
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
{
Select
,
Input
}
from
'amos-antd'
;
import
{
MultiSelect
,
Button
}
from
'amos-framework'
;
import
{
MultiSelect
}
from
'amos-framework'
;
import
{
fetchPointQueryCriteria
,
queryUserByDeptIdAction
}
from
'./../../../services/checkInfoService'
;
import
BizIcon
from
'../../common/icon/BizIcon'
;
const
Option
=
Select
.
Option
;
const
multiSelectOption
=
MultiSelect
.
Option
;
...
...
@@ -25,7 +24,7 @@ class PointSearch extends Component {
departmentOptions
:
[],
statusData
:
[],
searchParam
:
{},
selectData
:[]
selectData
:
[]
};
}
componentWillMount
()
{
...
...
@@ -38,11 +37,10 @@ class PointSearch extends Component {
componentWillReceiveProps
(
nextProps
)
{
const
{
countStatus
}
=
nextProps
||
{};
let
status
=
[];
let
{
searchParam
,
selectData
,
statusData
}
=
this
.
state
;
let
{
searchParam
,
statusData
}
=
this
.
state
;
if
(
countStatus
){
let
temp
=
statusData
.
find
(
item
=>
item
.
value
===
countStatus
);
console
.
log
(
'temp--------------->'
+
temp
);
console
.
log
(
`temp--------------->
${
temp
}
`
);
if
(
temp
!==
undefined
)
{
searchParam
.
checkStatus
=
temp
.
value
;
let
checkStatus
=
[];
...
...
@@ -64,10 +62,10 @@ class PointSearch extends Component {
}
onSelectedChange
=
(
value
,
type
)
=>
{
let
{
searchParam
,
selectData
}
=
this
.
state
;
let
{
searchParam
}
=
this
.
state
;
searchParam
[
type
]
=
value
;
let
selectStatus
=
[];
if
(
type
===
'checkStatus'
)
{
if
(
type
===
'checkStatus'
)
{
searchParam
[
type
]
=
value
.
join
(
','
);
selectStatus
=
value
;
}
...
...
@@ -78,34 +76,24 @@ class PointSearch extends Component {
}
onDeptChange
=
(
value
)
=>
{
if
(
value
===
undefined
){
let
{
searchParam
}
=
this
.
state
;
delete
searchParam
[
'userId'
];
this
.
setState
({
searchParam
,
userData
:
[]});
Object
.
assign
(
searchParam
,{
pageNumber
:
0
,
pageSize
:
10
});
this
.
setState
({
searchParam
});
searchParam
&&
this
.
props
.
setSearchParam
(
searchParam
);
}
else
{
this
.
queryUserByDept
(
value
);
let
{
searchParam
}
=
this
.
state
;
if
(
searchParam
[
'deptId'
]
!==
value
)
{
searchParam
[
'deptId'
]
=
value
;
searchParam
[
'userId'
]
=
undefined
;
Object
.
assign
(
searchParam
,{
pageNumber
:
0
,
pageSize
:
10
});
this
.
setState
({
searchParam
});
if
(
value
===
undefined
){
this
.
setState
({
userData
:
[]
});
this
.
props
.
setSearchParam
(
searchParam
);
}
else
{
this
.
queryUserByDept
(
value
);
}
}
}
queryUserByDept
=
deptId
=>
{
queryUserByDeptIdAction
(
deptId
).
then
(
data
=>
{
let
userData
=
data
;
this
.
setState
({
userData
:
userData
});
});
};
//查询巡检人员
getPointSearchConditionAction
=
()
=>
{
fetchPointQueryCriteria
().
then
(
data
=>
{
let
userlist
=
[];
let
departmentList
=
[];
let
typeList
=
[];
let
statusList
=
[];
...
...
@@ -136,6 +124,13 @@ class PointSearch extends Component {
});
}
queryUserByDept
=
deptId
=>
{
queryUserByDeptIdAction
(
deptId
).
then
(
data
=>
{
let
userData
=
data
;
this
.
setState
({
userData
});
});
};
searchData
=
()
=>
{
let
{
searchParam
}
=
this
.
state
;
Object
.
assign
(
searchParam
,
{
pageNumber
:
0
,
pageSize
:
10
});
...
...
@@ -194,12 +189,12 @@ class PointSearch extends Component {
allowClear
value
=
{
searchParam
.
userId
}
>
{
checkUserOptions
}
{
checkUserOptions
}
<
/Select
>
<
/div
>
<
div
className
=
'catalog-select-multiple'
>
<
MultiSelect
data
=
{
statusData
}
data
=
{
statusData
}
renderOption
=
{
item
=>
<
multiSelectOption
value
=
{
item
.
value
}
>
{
item
.
name
}
<
/multiSelectOption>
}
values
=
{
selectData
}
onChange
=
{(
e
)
=>
this
.
onSelectedChange
(
e
,
'checkStatus'
)}
...
...
@@ -209,7 +204,6 @@ class PointSearch extends Component {
<
div
className
=
'search-device'
>
<
Input
placeholder
=
"请输入搜索内容"
onChange
=
{
this
.
onChange
}
onPressEnter
=
{
this
.
searchData
}
style
=
{{
width
:
'150px'
,
'border-radius'
:
'10px'
}}
/
>
<
img
src
=
{
require
(
'./../../../assets/fsc/check/search.png'
)}
alt
=
''
onClick
=
{
this
.
searchData
}
/
>
{
/*<Button icon={<BizIcon icon='sousuo' />} transparent onClick={this.searchData} />*/
}
<
/div
>
<
/div
>
);
...
...
src/view/bizview/point/PointStatistics.js
View file @
a266d2ed
...
...
@@ -54,35 +54,19 @@ class PointStatistics extends Component {
let
{
colors
,
data
}
=
this
.
getColor
(
dataList
);
return
{
color
:
colors
,
tooltip
:
{
trigger
:
'item'
,
formatter
:
"<div style='color: white; font-size: 16px;' >{b}:<br />数量({c});比例({d}%)</div>"
},
series
:
[
{
name
:
'巡检点统计'
,
// silent: true,
type
:
'pie'
,
radius
:
[
'45%'
,
'65%'
],
itemStyle
:
{
normal
:
{
label
:
{
show
:
false
,
// position: 'center',
// formatter: function(params) {
// let dataIndex = params.dataIndex;
// if (parseInt(dataIndex) === 0) {
// return '{a|' + total + '}' + '\r\n' + '{b|' + '总数' + '}';
// } else {
// return '';
// }
// },
// rich: {
// a: {
// fontSize: '28',
// color: 'black'
// },
// b: {
// fontSize: '16',
// color: 'black'
// }
// }
},
labelLine
:
{
show
:
false
...
...
@@ -92,15 +76,6 @@ class PointStatistics extends Component {
labelLine
:
{
show
:
true
,
length
:
90
},
label
:
{
show
:
true
,
position
:
'outer'
,
formatter
:
'{b}
\
n {c}({d}%)'
,
textStyle
:
{
fontSize
:
'25'
,
fontWeight
:
'bold'
}
}
}
},
...
...
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