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
4f76d27a
Commit
4f76d27a
authored
Jan 29, 2021
by
王珂
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改电力设备bug
parent
c4a2063b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
67 deletions
+81
-67
EquipmentModel.js
src/view/bizview/equipmentLedger/Equipment/EquipmentModel.js
+12
-1
MatchEquipment.js
src/view/bizview/equipmentLedger/Equipment/MatchEquipment.js
+9
-9
index.js
src/view/bizview/equipmentLedger/Equipment/index.js
+60
-57
No files found.
src/view/bizview/equipmentLedger/Equipment/EquipmentModel.js
View file @
4f76d27a
...
...
@@ -4,7 +4,7 @@ import SysConsts from 'amos-processor/lib/config/consts';
import
formatUrl
from
'amos-processor/lib/utils/urlFormat'
;
import
*
as
endConf
from
'amos-processor/lib/config/endconf'
;
import
{
FasSerUrl
}
from
'../../../../consts/urlConsts'
;
import
{
Form
,
Upload
,
Input
,
Select
,
Radio
,
Modal
,
AmosAlert
,
Icon
}
from
'amos-framework'
;
import
{
Form
,
Upload
,
Input
,
Select
,
Radio
,
Modal
,
AmosAlert
,
Icon
,
Toast
}
from
'amos-framework'
;
import
{
TreeSelect
}
from
'amos-antd'
;
import
PropTypes
from
'amos-react-router/lib/PropTypes'
;
import
{
getEquipmentDataAction
,
getFireStationDataAction
,
getPrePlanPictureAction
}
from
'../../../../services/ledgerService'
;
...
...
@@ -109,6 +109,16 @@ class EquipmentModel extends Component {
onInputChange
=
(
key
,
value
)
=>
{
const
{
form
}
=
this
.
state
;
let
reg
=
/
[\u
4E00-
\u
9FA5
]
/g
;
if
(
key
===
'code'
)
{
if
(
reg
.
test
(
value
))
{
Toast
.
open
({
content
:
'编码不能输入汉字'
,
placement
:
'topMiddle'
});
return
;
}
}
form
[
key
]
=
value
.
trim
();
this
.
setState
({
form
});
};
...
...
@@ -162,6 +172,7 @@ class EquipmentModel extends Component {
getPrePlanPictureData
=
equipmentId
=>
{
getPrePlanPictureAction
(
equipmentId
,
''
).
then
(
data
=>
{
let
pMap
=
new
Map
();
console
.
log
(
data
);
data
.
forEach
(
ele
=>
{
let
type
=
ele
.
type
;
if
(
type
>=
1
&&
type
<=
4
)
{
...
...
src/view/bizview/equipmentLedger/Equipment/MatchEquipment.js
View file @
4f76d27a
...
...
@@ -108,33 +108,33 @@ class MatchEquipment extends Component {
componentDidMount
()
{
if
(
this
.
props
.
location
.
state
)
{
let
{
equipmentId
,
show
}
=
this
.
props
.
location
.
state
;
if
(
equipmentId
===
undefined
){
equipmentId
=
this
.
props
.
location
.
query
.
equipmentId
this
.
setState
({
equipmentId
:
equipmentId
});
if
(
equipmentId
===
undefined
){
equipmentId
=
this
.
props
.
location
.
query
.
equipmentId
;
this
.
setState
({
equipmentId
});
}
let
{
searchParam
}
=
this
.
state
;
searchParam
.
pageNumber
=
0
;
searchParam
.
pageSize
=
10
;
if
(
equipmentId
)
{
this
.
getEquipmentData
(
equipmentId
);
this
.
setState
({
equipmentId
},()
=>
this
.
getMatchEquipmentListData
(
searchParam
));
this
.
setState
({
equipmentId
},()
=>
this
.
getPrePlanPictureData
());
this
.
setState
({
equipmentId
},()
=>
this
.
getMatchEquipmentListData
(
searchParam
));
this
.
setState
({
equipmentId
},()
=>
this
.
getPrePlanPictureData
());
}
if
(
void
0
!==
show
)
{
this
.
setState
({
show
});
}
}
//兼容url直接请求
if
(
this
.
props
.
location
.
query
){
if
(
this
.
props
.
location
.
query
){
let
{
equipmentId
}
=
this
.
props
.
location
.
query
;
let
{
searchParam
}
=
this
.
state
;
searchParam
.
pageNumber
=
0
;
searchParam
.
pageSize
=
10
;
if
(
equipmentId
)
{
this
.
getEquipmentData
(
equipmentId
);
this
.
setState
({
equipmentId
},()
=>
this
.
getMatchEquipmentListData
(
searchParam
));
this
.
setState
({
equipmentId
},()
=>
this
.
getPrePlanPictureData
());
this
.
setState
({
equipmentId
:
equipmentId
});
this
.
setState
({
equipmentId
},()
=>
this
.
getMatchEquipmentListData
(
searchParam
));
this
.
setState
({
equipmentId
},()
=>
this
.
getPrePlanPictureData
());
this
.
setState
({
equipmentId
});
}
}
}
...
...
src/view/bizview/equipmentLedger/Equipment/index.js
View file @
4f76d27a
...
...
@@ -104,14 +104,17 @@ class Equipment extends Component {
}
onChange
(
type
,
value
)
{
let
val
=
value
.
trim
();
if
(
type
===
'name'
)
{
this
.
setState
({
name
:
val
ue
});
this
.
setState
({
name
:
val
});
}
else
{
this
.
setState
({
equipClassify
:
value
});
this
.
setState
({
equipClassify
:
val
});
}
if
(
val
)
{
let
searchParam
=
[{
name
:
type
,
value
:
val
,
type
:
'LIKE'
}];
searchParam
.
current
=
0
;
this
.
getEquipmentListData
(
searchParam
);
}
let
searchParam
=
[{
name
:
type
,
value
,
type
:
'LIKE'
}];
searchParam
.
current
=
0
;
this
.
getEquipmentListData
(
searchParam
);
}
onRowClick
=
record
=>
{
...
...
@@ -263,67 +266,67 @@ class Equipment extends Component {
submit
=
(
e
)
=>
{
let
{
form
}
=
this
.
model
;
const
{
isClick
}
=
this
.
state
if
(
isClick
)
{
//如果为true 开始执行
this
.
setState
({
isClick
:
false
});
//将isClick 变成false,将不会执行处理事件
form
.
validate
((
valid
,
dataValues
)
=>
{
if
(
valid
)
{
delete
dataValues
.
createDate
;
let
formData
=
new
FormData
();
const
{
isClick
}
=
this
.
state
;
if
(
isClick
)
{
//如果为true 开始执行
this
.
setState
({
isClick
:
false
});
//将isClick 变成false,将不会执行处理事件
form
.
validate
((
valid
,
dataValues
)
=>
{
if
(
valid
)
{
delete
dataValues
.
createDate
;
let
formData
=
new
FormData
();
dataValues
.
imageUrl1
&&
formData
.
append
(
'img1'
,
dataValues
.
imageUrl1
[
0
]);
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
.
imageUrl1
&&
formData
.
append
(
'img1'
,
dataValues
.
imageUrl1
[
0
]);
dataValues
.
imageUrl2
&&
formData
.
append
(
'img2'
,
dataValues
.
imageUrl2
[
0
]);
dataValues
.
imageUrl3
&&
formData
.
append
(
'img3'
,
dataValues
.
imageUrl3
[
0
]);
dataValues
.
imageUrl4
&&
formData
.
append
(
'img4'
,
dataValues
.
imageUrl4
[
0
]);
if
(
dataValues
)
{
for
(
var
key
in
dataValues
)
{
if
(
dataValues
[
key
]
==
null
||
typeof
(
dataValues
[
key
])
==
"undefined"
)
{
delete
dataValues
[
key
];
}
if
(
dataValues
)
{
for
(
var
key
in
dataValues
)
{
if
(
dataValues
[
key
]
==
null
||
typeof
dataValues
[
key
]
==
'undefined'
)
{
delete
dataValues
[
key
];
}
}
}
Object
.
keys
(
dataValues
).
map
(
item
=>
{
if
(
item
===
'chargeDeptId'
&&
dataValues
[
item
]
===
null
)
{
formData
.
append
(
item
,
-
1
);
}
else
if
(
item
===
'chargeUserId'
&&
dataValues
[
item
]
===
null
)
{
formData
.
append
(
item
,
-
1
);
}
else
if
(
item
===
'fireStationId'
&&
dataValues
[
item
]
===
null
)
{
formData
.
append
(
item
,
-
1
);
}
else
{
formData
.
append
(
item
,
dataValues
[
item
]);
}
Object
.
keys
(
dataValues
).
map
(
item
=>
{
if
(
item
===
'chargeDeptId'
&&
dataValues
[
item
]
===
null
)
{
formData
.
append
(
item
,
-
1
);
}
else
if
(
item
===
'chargeUserId'
&&
dataValues
[
item
]
===
null
)
{
formData
.
append
(
item
,
-
1
);
}
else
if
(
item
===
'fireStationId'
&&
dataValues
[
item
]
===
null
)
{
formData
.
append
(
item
,
-
1
);
}
else
{
formData
.
append
(
item
,
dataValues
[
item
]);
}
});
fetch
(
updateEquipmentUrl
,
{
method
:
'post'
,
headers
:
{
'Accept'
:
'application/json;charset=UTF-8'
,
'X-Api-Key'
:
_amosTool
.
Store
.
getCookieByName
(
apiKey
),
'X-Access-Token'
:
ls
.
read
(
token
),
'appKey'
:
window
.
appKey
,
'product'
:
window
.
product
,
'token'
:
ls
.
read
(
token
)
},
body
:
formData
}).
then
(
e
=>
{
AmosAlert
.
success
(
'提示'
,
'保存成功'
);
this
.
state
.
reload
();
this
.
setState
({
enableEditOp
:
false
});
fetch
(
updateEquipmentUrl
,
{
method
:
'post'
,
headers
:
{
'Accept'
:
'application/json;charset=UTF-8'
,
'X-Api-Key'
:
_amosTool
.
Store
.
getCookieByName
(
apiKey
),
'X-Access-Token'
:
ls
.
read
(
token
),
'appKey'
:
window
.
appKey
,
'product'
:
window
.
product
,
'token'
:
ls
.
read
(
token
)
},
body
:
formData
}).
then
(
e
=>
{
AmosAlert
.
success
(
'提示'
,
'保存成功'
);
this
.
state
.
reload
();
this
.
setState
({
enableEditOp
:
false
});
})
})
.
catch
(
e
=>
{
AmosAlert
.
error
(
'错误'
,
'保存失败'
);
});
}
else
{
console
.
log
(
'error submit!!'
);
return
false
;
}
});
}
else
{
console
.
log
(
'error submit!!'
);
return
false
;
}
});
const
that
=
this
;
// 为定时器中的setState绑定this
setTimeout
(
function
()
{
// 设置延迟事件,1秒后将执行
that
.
setState
({
isClick
:
true
});
// 将isClick设置为true
setTimeout
(
()
=>
{
// 设置延迟事件,1秒后将执行
that
.
setState
({
isClick
:
true
});
// 将isClick设置为true
},
5000
);
}
...
...
@@ -340,7 +343,7 @@ class Equipment extends Component {
<
/div
>
<
div
className
=
'important-equipment-tools'
>
<
span
>
搜索:
<
/span
>
<
Input
value
=
{
name
}
onChange
=
{
e
=>
this
.
onChange
(
'name'
,
e
.
target
.
value
)}
placeholder
=
"按编号,名称搜索"
/>
<
Input
value
=
{
name
}
onChange
=
{
e
=>
this
.
onChange
(
'name'
,
e
.
target
.
value
)}
placeholder
=
"按编号,名称搜索"
/>
<
Button
icon
=
{
<
BizIcon
icon
=
"tianjia"
/>
}
transparent
onClick
=
{()
=>
this
.
add
()}
/
>
<
Button
icon
=
{
<
BizIcon
icon
=
"xiugai"
/>
}
transparent
onClick
=
{()
=>
this
.
edit
()}
/
>
<
Button
icon
=
{
<
BizIcon
icon
=
"shanchu"
/>
}
transparent
onClick
=
{()
=>
this
.
delete
()}
/
>
...
...
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