Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-boss
Project
Overview
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
姜雷
wx-boss
Commits
78aec937
Commit
78aec937
authored
Jan 15, 2020
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加启用禁用交互
parent
3503c3c8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
66 deletions
+110
-66
EquipmentState.js
...program/pages/components/EquipmentState/EquipmentState.js
+0
-0
EquipmentState.ts
...program/pages/components/EquipmentState/EquipmentState.ts
+46
-30
EquipmentState.wxss
...ogram/pages/components/EquipmentState/EquipmentState.wxss
+4
-1
EquipmentWarning.js
...ram/pages/components/EquipmentWarning/EquipmentWarning.js
+0
-0
EquipmentWarning.ts
...ram/pages/components/EquipmentWarning/EquipmentWarning.ts
+60
-35
No files found.
miniprogram/pages/components/EquipmentState/EquipmentState.js
View file @
78aec937
This diff is collapsed.
Click to expand it.
miniprogram/pages/components/EquipmentState/EquipmentState.ts
View file @
78aec937
...
...
@@ -166,38 +166,54 @@ Component({
if
(
!
this
.
data
.
dataList
[
status
].
length
)
this
.
refreshList
();
},
openEquipment
(
e
)
{
const
{
code
,
type
}
=
e
.
currentTarget
.
dataset
;
console
.
log
(
code
);
deviceFetch
({
url
:
`/device/
${
code
}
/
${
type
}
/enable`
,
method
:
'POST'
,
})
.
then
(
res
=>
{
wx
.
showToast
({
title
:
res
.
msg
||
'操作成功'
,
});
this
.
refreshList
();
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
wx
.
showModal
({
title
:
'提示'
,
content
:
'是否启用设备'
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
const
{
code
,
type
}
=
e
.
currentTarget
.
dataset
;
console
.
log
(
code
);
deviceFetch
({
url
:
`/device/
${
code
}
/
${
type
}
/enable`
,
method
:
'POST'
,
})
.
then
(
res
=>
{
wx
.
showToast
({
title
:
res
.
msg
||
'操作成功'
,
});
this
.
refreshList
();
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
},
});
},
closeEquipment
(
e
)
{
const
{
code
,
type
}
=
e
.
currentTarget
.
dataset
;
console
.
log
(
code
);
deviceFetch
({
url
:
`/device/
${
code
}
/
${
type
}
/forbidden`
,
method
:
'POST'
,
})
.
then
(
res
=>
{
wx
.
showToast
({
title
:
res
.
msg
||
'操作成功'
,
});
this
.
refreshList
();
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
wx
.
showModal
({
title
:
'提示'
,
content
:
'是否禁用设备'
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
const
{
code
,
type
}
=
e
.
currentTarget
.
dataset
;
console
.
log
(
code
);
deviceFetch
({
url
:
`/device/
${
code
}
/
${
type
}
/forbidden`
,
method
:
'POST'
,
})
.
then
(
res
=>
{
wx
.
showToast
({
title
:
res
.
msg
||
'操作成功'
,
});
this
.
refreshList
();
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
},
});
},
},
});
miniprogram/pages/components/EquipmentState/EquipmentState.wxss
View file @
78aec937
...
...
@@ -53,7 +53,10 @@
}
.EquipmentState-elist-ItemLocation {
margin-left: 20rpx;
flex: 1;
width: 340rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.EquipmentState-elist-ItemBtn {
width: 80rpx;
...
...
miniprogram/pages/components/EquipmentWarning/EquipmentWarning.js
View file @
78aec937
This diff is collapsed.
Click to expand it.
miniprogram/pages/components/EquipmentWarning/EquipmentWarning.ts
View file @
78aec937
import
{
deviceFetch
}
from
'../../../api/fetch'
;
let
warningLevelRangeOption
=
{
key
:
null
,
value
:
''
};
// pages/components/EquipmentWarning/EquipmentWarning.js
Component
({
lifetimes
:
{
...
...
@@ -49,7 +50,7 @@ Component({
.
then
(
res
=>
{
console
.
log
(
res
);
this
.
setData
({
warningLevelRange
:
res
.
data
,
warningLevelRange
:
[
warningLevelRangeOption
,
...
res
.
data
]
,
});
})
.
catch
(
err
=>
{
...
...
@@ -61,10 +62,18 @@ Component({
if
(
index
===
this
.
data
.
warnLevelIndex
)
return
;
const
item
=
this
.
data
.
warningLevelRange
[
index
];
console
.
log
(
item
);
this
.
setData
({
warnLevelIndex
:
index
,
warnLevel
:
item
.
key
,
});
if
(
item
.
key
)
{
this
.
setData
({
warnLevelIndex
:
index
,
warnLevel
:
item
.
key
,
});
}
else
{
this
.
setData
({
warnLevelIndex
:
''
,
warnLevel
:
0
,
});
}
this
.
refreshList
();
},
changeLocation
(
e
)
{
...
...
@@ -147,38 +156,54 @@ Component({
});
},
openEquipment
(
e
)
{
const
{
code
,
type
}
=
e
.
currentTarget
.
dataset
;
console
.
log
(
code
);
deviceFetch
({
url
:
`/device/
${
code
}
/
${
type
}
/enable`
,
method
:
'POST'
,
})
.
then
(
res
=>
{
wx
.
showToast
({
title
:
res
.
msg
||
'操作成功'
,
});
this
.
refreshList
();
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
wx
.
showModal
({
title
:
'提示'
,
content
:
'是否启用设备'
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
const
{
code
,
type
}
=
e
.
currentTarget
.
dataset
;
console
.
log
(
code
);
deviceFetch
({
url
:
`/device/
${
code
}
/
${
type
}
/enable`
,
method
:
'POST'
,
})
.
then
(
res
=>
{
wx
.
showToast
({
title
:
res
.
msg
||
'操作成功'
,
});
this
.
refreshList
();
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
},
});
},
closeEquipment
(
e
)
{
const
{
code
,
type
}
=
e
.
currentTarget
.
dataset
;
console
.
log
(
code
);
deviceFetch
({
url
:
`/device/
${
code
}
/
${
type
}
/forbidden`
,
method
:
'POST'
,
})
.
then
(
res
=>
{
wx
.
showToast
({
title
:
res
.
msg
||
'操作成功'
,
});
this
.
refreshList
();
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
wx
.
showModal
({
title
:
'提示'
,
content
:
'是否禁用设备'
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
const
{
code
,
type
}
=
e
.
currentTarget
.
dataset
;
console
.
log
(
code
);
deviceFetch
({
url
:
`/device/
${
code
}
/
${
type
}
/forbidden`
,
method
:
'POST'
,
})
.
then
(
res
=>
{
wx
.
showToast
({
title
:
res
.
msg
||
'操作成功'
,
});
this
.
refreshList
();
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
},
});
},
},
});
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