Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
visualcloud
/
Vmatrix-client-taro
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b0386bf4
authored
Nov 20, 2019
by
hank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 日程bug
parent
128a9629
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
22 deletions
+45
-22
src/pages/home/film/schedule_add/components/device/index.tsx
+45
-22
No files found.
src/pages/home/film/schedule_add/components/device/index.tsx
View file @
b0386bf4
...
@@ -27,6 +27,7 @@ type PageState = {
...
@@ -27,6 +27,7 @@ type PageState = {
list
:
any
[]
list
:
any
[]
activeIndex
:
number
activeIndex
:
number
allCount
:
string
allCount
:
string
cId
:
string
}
}
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
type
IProps
=
PageStateProps
&
PageDispatchProps
&
PageOwnProps
...
@@ -43,9 +44,10 @@ class DeviceSelect extends Component {
...
@@ -43,9 +44,10 @@ class DeviceSelect extends Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
const
{
film
Id
}
=
this
.
$router
.
params
const
{
cId
,
f
Id
}
=
this
.
$router
.
params
this
.
state
=
{
this
.
state
=
{
filmId
,
filmId
:
fId
,
cId
,
page
:
1
,
page
:
1
,
checked
:
new
Set
(),
checked
:
new
Set
(),
showModal
:
false
,
showModal
:
false
,
...
@@ -63,26 +65,28 @@ class DeviceSelect extends Component {
...
@@ -63,26 +65,28 @@ class DeviceSelect extends Component {
checked
:
new
Set
(),
checked
:
new
Set
(),
showTempalte
:
'HORIZONTAL'
showTempalte
:
'HORIZONTAL'
})
})
Taro
.
getStorage
({
key
:
'schedule-add-device'
})
.
then
(
res
=>
{
cId
===
undefined
&&
let
arr
=
JSON
.
parse
(
res
.
data
).
map
(
item
=>
{
Taro
.
getStorage
({
key
:
'schedule-add-device'
})
return
item
.
equipmentId
.
then
(
res
=>
{
})
let
arr
=
JSON
.
parse
(
res
.
data
).
map
(
item
=>
{
this
.
setState
({
return
item
.
equipmentId
checked
:
new
Set
(
arr
)
})
this
.
setState
({
checked
:
new
Set
(
arr
)
})
})
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
setState
(
{
this
.
setState
({
checked
:
new
Set
()
checked
:
new
Set
(
)
}
)
})
})
})
}
}
componentWillMount
()
{
componentWillMount
()
{
this
.
getData
()
this
.
getData
()
this
.
getGroupList
()
this
.
getGroupList
()
this
.
get
C
Detail
()
this
.
get
Film
Detail
()
}
}
getData
(
name
?:
string
|
''
)
{
getData
(
name
?:
string
|
''
)
{
...
@@ -98,11 +102,27 @@ class DeviceSelect extends Component {
...
@@ -98,11 +102,27 @@ class DeviceSelect extends Component {
})
})
})
})
}
}
getFilmDetail
()
{
const
{
fId
}
=
this
.
$router
.
params
fId
&&
api
.
common
.
getFilmDetailInfo
(
fId
).
then
(
res
=>
{
this
.
setState
(
{
cId
:
res
.
calendarId
},
()
=>
{
this
.
getCDetail
()
}
)
console
.
log
(
res
.
calendarId
,
'filmData'
)
})
}
getCDetail
()
{
getCDetail
()
{
/**
/**
* 获取日程详情
* 获取日程详情
*/
*/
const
{
cId
}
=
this
.
$router
.
params
const
{
cId
}
=
this
.
state
console
.
log
(
cId
==
null
,
cId
,
'cId'
)
cId
&&
cId
&&
cId
!==
'null'
&&
cId
!==
'null'
&&
api
.
common
.
getScheduleDetail
(
cId
).
then
(
res
=>
{
api
.
common
.
getScheduleDetail
(
cId
).
then
(
res
=>
{
...
@@ -178,23 +198,25 @@ class DeviceSelect extends Component {
...
@@ -178,23 +198,25 @@ class DeviceSelect extends Component {
async
updateBind
()
{
async
updateBind
()
{
// 更新设备绑定
// 更新设备绑定
const
{
checked
,
list
}
=
this
.
state
const
{
checked
,
list
}
=
this
.
state
let
{
cId
,
fId
}
=
this
.
$router
.
params
let
{
cId
}
=
this
.
state
let
{
fId
}
=
this
.
$router
.
params
if
(
cId
===
'null'
)
{
if
(
cId
===
'null'
)
{
cId
=
''
cId
=
''
}
}
console
.
log
(
cId
,
'cId'
)
let
checkedArr
:
any
=
[]
let
checkedArr
:
any
=
[]
const
equipmentsIds
=
[]
const
equipmentsIds
=
[]
const
equipmentTopicList
=
[]
const
equipmentTopicList
=
[]
list
.
map
(
item
=>
{
list
.
map
(
item
=>
{
if
(
checked
.
has
(
item
.
equipmentId
))
{
if
(
checked
.
has
(
item
.
equipmentId
))
{
checkedArr
.
push
(
item
)
checkedArr
.
push
(
item
)
if
(
cId
)
{
if
(
cId
||
cId
===
''
)
{
equipmentsIds
.
push
(
item
.
equipmentId
)
equipmentsIds
.
push
(
item
.
equipmentId
)
equipmentTopicList
.
push
(
item
.
mqttTopic
)
equipmentTopicList
.
push
(
item
.
mqttTopic
)
}
}
}
}
})
})
if
(
cId
)
{
if
(
cId
||
cId
===
''
)
{
let
obj
=
{
let
obj
=
{
calendarName
:
'DEFAULstring'
,
calendarName
:
'DEFAULstring'
,
filmInfos
:
[
filmInfos
:
[
...
@@ -205,12 +227,13 @@ class DeviceSelect extends Component {
...
@@ -205,12 +227,13 @@ class DeviceSelect extends Component {
],
],
equipmentsIds
:
equipmentsIds
,
equipmentsIds
:
equipmentsIds
,
equipmentTopicList
:
equipmentTopicList
,
equipmentTopicList
:
equipmentTopicList
,
calendarType
:
cId
?
'CUSTOME'
:
'DEFAUL'
,
calendarType
:
'DEFAUL'
,
calendarId
:
''
calendarId
:
''
}
}
if
(
!
cId
)
{
if
(
cId
===
''
)
{
console
.
log
(
'createSchedule'
)
delete
obj
.
calendarId
delete
obj
.
calendarId
api
.
common
.
create
d
Schedule
(
obj
).
then
(()
=>
{
api
.
common
.
createSchedule
(
obj
).
then
(()
=>
{
Taro
.
navigateBack
()
Taro
.
navigateBack
()
})
})
}
else
{
}
else
{
...
...
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