Browse Source

照明定时中控设置1/2

voice
zmt 4 years ago
parent
commit
5bce23414a
  1. 8
      src/pages.json
  2. 2
      src/subpackage/device/components/store_name/store_name.vue
  3. 2
      src/subpackage/device/js/device_api.js
  4. 37
      src/subpackage/device/js/ouxuanac.md
  5. 8
      src/subpackage/device/pages/index/index.vue
  6. 55
      src/subpackage/device/pages/switch_manage/switch_manage.vue
  7. 4
      src/subpackage/device/pages/timing/timing_list.vue
  8. 347
      src/subpackage/device/pages/timing/timing_setting.vue
  9. BIN
      src/subpackage/device/static/images/longOpen.png
  10. BIN
      src/subpackage/device/static/images/timing.png

8
src/pages.json

@ -221,12 +221,18 @@
}
},
{
"path": "pages/index/timing_list",
"path": "pages/timing/timing_list",
"style" : {
"navigationBarTitleText": "定时列表"
}
},
{
"path": "pages/timing/timing_setting",
"style" : {
"navigationBarTitleText": "定时设置"
}
},
{
"path": "pages/switch_manage/switch_manage",
"style" : {
"navigationBarTitleText": "管理"

2
src/subpackage/device/components/store_name/store_name.vue

@ -23,7 +23,7 @@ export default {
return ()=> {return (this.theme=='light')?'#FFFFFF':'#1a1a1a';}
},
getThemeBg(){
return ()=> {return (this.theme=='light')?'none':'#FFFFFF';}
return ()=> {return (this.theme=='light')?'none':'none';} //
},
},
props: ["theme"],//, "light":

2
src/subpackage/device/js/device_api.js

@ -48,7 +48,7 @@ export const DEVICE_API = {
//2021/0713
acUpdate:`${ORIGIN}/ouxuanac/getDescribeDevice`, //中控在线状态查询
delInfoAC:`${ORIGIN}/ouxuanac/getDescribeDevice`, //删除状态
// delInfoAC:`${ORIGIN}/ouxuanac/getDescribeDevice`, //删除状态
}
export default DEVICE_API;

37
src/subpackage/device/js/ouxuanac.md

@ -328,20 +328,39 @@ https://test.ouxuanzhineng.cn/ouxuanac/tts/textToVoice.wav?text=试试看&voice_
### 更新定时列表 sendPacket
```
请求参数
let _data = {
"device": this.curStoreInfo.device_name,
"data": {
"name": "audio-player",
"value": {
"url": _url
}
},
// "token": "f0d5c19b-b87e-11eb-bc7d-5254005df464"
{
"device": "00-10-7a-0f-6d-7a",
"data": {
"name": "get-time-select",
"value": {}
}
}
返回:
{"code":0,"data":[{"date_slice":[{"end":"","start":""}],"day_of_month":null,"day_of_week":[0,1,2,3,5,4,6],"expand_tags":null,"expand_value":{"main":{"name":"set-rpio","title":"测试中控照明8","value":{"id":"8","status":"low"}}},"extension":null,"group":"RPIO","time_arrow_id":"7d56981c-8dd4-11eb-9aad-4e965989bbce","times_on_day":["10:12:00-10:12:10"],"type":"DAY_OF_WEEK","weights":0},{"date_slice":[{"end":"","start":""}],"day_of_month":null,"day_of_week":[0,1,2,3,6,5,4],"expand_tags":null,"expand_value":{"main":{"name":"set-rpio","title":"测试中控照明9","value":{"id":"9","status":"low"}}},"extension":null,"group":"RPIO","time_arrow_id":"862813af-8dd4-11eb-9aad-4e965989bbce","times_on_day":["10:12:00-10:12:10"],"type":"DAY_OF_WEEK","weights":0},{"date_slice":[{"end":"","start":""}],"day_of_month":null,"day_of_week":[0,4,1,5,2,6,3],"expand_tags":null,"expand_value":{"main":{"name":"set-rpio","title":"测试中控照明10","value":{"id":"10","status":"low"}}},"extension":null,"group":"RPIO","time_arrow_id":"8def57e1-8dd4-11eb-9aad-4e965989bbce","times_on_day":["10:12:00-10:12:10"],"type":"DAY_OF_WEEK","weights":0},{"date_slice":[{"end":"","start":""}],"day_of_month":null,"day_of_week":[0,1,2,3,6,5,4],"expand_tags":null,"expand_value":{"main":{"name":"set-rpio","title":"测试中控照明8","value":{"id":"8","status":"high"}}},"extension":null,"group":"RPIO","time_arrow_id":"be5eb915-8dd4-11eb-9aad-4e965989bbce","times_on_day":["10:13:00-10:13:10"],"type":"DAY_OF_WEEK","weights":0},{"date_slice":[{"end":"","start":""}],"day_of_month":null,"day_of_week":[0,1,2,3,6,5,4],"expand_tags":null,"expand_value":{"main":{"name":"set-rpio","title":"测试中控照明9","value":{"id":"9","status":"high"}}},"extension":null,"group":"RPIO","time_arrow_id":"c8c39f5c-8dd4-11eb-9aad-4e965989bbce","times_on_day":["10:13:00-10:13:10"],"type":"DAY_OF_WEEK","weights":0}],"message":""}
```
### 删除定时任务 sendPacket
```
请求参数
{
"device": "00-10-7a-0f-6d-7a",
"delay": 1,
"data": {
"name": "delete-time-select",
"value": {
"uuid": "d185c9f8-8dd4-11eb-9aad-4e965989bbce"
}
}
}
<dict>
<key>devicePlatform</key>
<string>ios</string>
<key>deviceIdentifier</key>
<string>00008027-000D452836E8002E</string>
<key>audo-0714-01</key>
<string>iPad-Pro3-12.9-inch1</string>
</dict>
```

8
src/subpackage/device/pages/index/index.vue

@ -50,8 +50,12 @@ const tabArr = [
{id: 11, name: '水阀', path: `/pages/switch_manage/switch_manage`},
{id: 12, name: '互动设备', path: `/pages/switch_manage/switch_manage`},
{id: 13, name: '监控', path: ``},
{id: 14, name: '音响', path: `/pages/audio_manage/audio_manage`},
{id: 14, name: '音响', path: `/pages/audio_manage/audio_manage`}, //audio_manage
{id: 15, name: '机器人', path: ``},
{id: 16, name: '租球机', path: ``},
{id: 17, name: '窗帘', path: ``},
{id: 18, name: '路由器', path: ``},
{id: 19, name: '物联卡', path: ``},
];
import { mapState } from 'vuex'
export default {
@ -118,7 +122,7 @@ export default {
})
},
goTimingList(){
let timing_list = "/subpackage/device/pages/index/timing_list"
let timing_list = "/subpackage/device/pages/timing/timing_list"
util.routeTo(`${timing_list}`, 'nT');
},
getImgPath(id){

55
src/subpackage/device/pages/switch_manage/switch_manage.vue

@ -2,8 +2,9 @@
<view class="switch-manage">
<store-name></store-name>
<view class="sm-tit">{{pageInfo.name || '-'}}</view>
<view class="sm-list">
<view class="sl-item" v-for="(e, i) in deviceList" :key="i">
<view class="sl-item" v-for="(e, i) in deviceList" :key="i" :style="{width:pageInfo.name=='照明管理'?'710rpx':''}">
<view class="si-top">
<image mode="aspectFit" :src="getIcon()"></image>
<view class="st-right">
@ -19,14 +20,22 @@
</view>
</view>
<view class="si-bottom" v-if="pageInfo.isOpen || pageInfo.isClose">
<view v-if="pageInfo.isOpen" @click="operateBtn({ switchInfo: e, status: 1 })">
<view v-if="pageInfo.isOpen" @click="operateBtn({ switchInfo: e, status: 1 })" :style="{width:getIconWidth()}">
<image mode="aspectFit" :src="pageInfo.openIcon || ''"></image>
<view>{{pageInfo.openName || '-'}}</view>
</view>
<view v-if="pageInfo.isClose" @click="operateBtn({ switchInfo: e, status: 0 })">
<view v-if="pageInfo.isClose" @click="operateBtn({ switchInfo: e, status: 0 })" :style="{width:getIconWidth()}">
<image mode="aspectFit" :src="pageInfo.closeIcon || ''"></image>
<view>{{pageInfo.closeName || '-'}}</view>
</view>
<view v-if="pageInfo.isLongOpen" @click="operateBtn({ switchInfo: e, status: 2 })" :style="{width:getIconWidth()}">
<image mode="aspectFit" :src="pageInfo.longOpenIcon || ''"></image>
<view>{{pageInfo.longOpenName || '-'}}</view>
</view>
<view v-if="pageInfo.isTiming" @click="operateBtn({ switchInfo: e, status: 3 })" :style="{width:getIconWidth()}">
<image mode="aspectFit" :src="pageInfo.timingIcon || ''"></image>
<view>{{pageInfo.timingName || '-'}}</view>
</view>
</view>
</view>
</view>
@ -42,52 +51,52 @@ import deviceServer from '../../js/device_server';
import deviceApi from '../../js/device_api';
const showArr = {
's1': {
id: 1, name: '照明管理', isOpen: true, isClose: true,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关', hardware_type: 'Light'
id: 1, name: '照明管理', isOpen: true, isClose: true, isLongOpen:true, isTiming:true,
openIcon: '/subpackage/device/static/images/open.png',closeIcon: '/subpackage/device/static/images/close.png',
longOpenIcon: '/subpackage/device/static/images/longOpen.png',timingIcon: '/subpackage/device/static/images/timing.png',
openName: '开', closeName: '关', longOpenName: '长按', timingName: '定时', hardware_type: 'Light',iconNum:4
},
's2': {
id: 2, name: '空调管理', isOpen: true, isClose: true,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关', hardware_type: 'Air'
openName: '开', closeName: '关', hardware_type: 'Air',iconNum:2
},
's3': {
id: 3, name: '风扇管理', isOpen: true, isClose: true,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关', hardware_type: 'Fan'
openName: '开', closeName: '关', hardware_type: 'Fan',iconNum:2
},
's4': {
id: 4, name: '门禁管理', isOpen: true, isClose: false,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关', hardware_type: 'AccessControl'
openName: '开', closeName: '关', hardware_type: 'AccessControl',iconNum:2
},
's5': {
id: 5, name: '门闸管理', isOpen: true, isClose: true,
openIcon: '/subpackage/device/static/images/in.png',
closeIcon: '/subpackage/device/static/images/out.png',
openName: '进', closeName: '出', hardware_type: 'GateControl'
openName: '进', closeName: '出', hardware_type: 'GateControl',iconNum:2
},
's6': {
id: 6, name: '平板管理', isOpen: false, isClose: false,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关', hardware_type: ''
openName: '开', closeName: '关', hardware_type: '',iconNum:2
},
's11': {
id: 11, name: '水阀管理', isOpen: true, isClose: true,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关', hardware_type: 'WaterValve'
openName: '开', closeName: '关', hardware_type: 'WaterValve',iconNum:2
},
's12': {
id: 12, name: '互动设备管理', isOpen: true, isClose: true,
openIcon: '/subpackage/device/static/images/open.png',
closeIcon: '/subpackage/device/static/images/close.png',
openName: '开', closeName: '关', hardware_type: ''
openName: '开', closeName: '关', hardware_type: '',iconNum:2
},
}
@ -101,7 +110,12 @@ export default {
computed: {
...mapState({
curStoreInfo: state => state.device.curStoreInfo,
})
}),
getIconWidth(){//icon
return ()=>{
return 100/this.pageInfo.iconNum+'%'
}
}
},
watch: {
curStoreInfo(newVal, oldVal){
@ -156,9 +170,16 @@ export default {
.catch(util.hideLoad)
},
// status 0 -> 1 ->
// status 0 -> 1 -> ,2 -> ,3 ->
operateBtn: util.debounce(function({ switchInfo, status }){
console.log("icon tap status: ",status,switchInfo)
if(status == 2) return util.showNone("未对接,前端等待接口中...")
if(status == 3) return (()=>{
let timing_setting = `/subpackage/device/pages/timing/timing_setting?opts=1`
util.routeTo(`${timing_setting}`, 'nT');
})()
//todo page.json ,setting
let _data = this.getOperateReqData({ switchInfo, status })
//->& 20201224 5
if(switchInfo.hardware_type === 'AccessControl'&&status == 1){

4
src/subpackage/device/pages/index/timing_list.vue → src/subpackage/device/pages/timing/timing_list.vue

@ -197,10 +197,6 @@
delta: 1
})
},
goTimingList() {
let timing_list = "/subpackage/device/pages/index/timing_list"
util.routeTo(`${timing_list}`, 'nT');
},
//
operateReq({
data,

347
src/subpackage/device/pages/timing/timing_setting.vue

@ -0,0 +1,347 @@
<template>
<view class="timing-page">
<store-name></store-name>
<view class="t-title">照明定时</view>
<view class="t-box">
<view class="info-list">
<view class="il-switch">
<text class="">时间动作</text>
<view class=""><image src="../../../../static/images/icon/retail/choose.png" mode=""></image></view>
<view class=""><image src="../../../../static/images/icon/retail/choose.png" mode=""></image></view>
</view>
<view class="il-select">
<text class="">时间类型</text>
<view class="">
<text>星期</text><image src="../../../../static/images/icon/arrow_b2.png" mode=""></image>
</view>
</view>
<view class="il-select-week">
<block v-for="(e,i) in weekArrSelect" :key="i">
<view class="" :class="e?'active':''" @click="clickWeekTab(i)">星期{{weekArrCN[i]}}</view>
</block>
</view>
<view class="il-select">
<text class="">时间类型</text>
<view class="">
<text>15:30</text><image src="../../../../static/images/icon/arrow_b2.png" mode=""></image>
</view>
</view>
</view>
<view class="save-btn">保存</view>
<view class="bottom-tips">保存后发布后将会以最新的定时更新到欧轩智能中控设备首页<text>定时列表</text>可查看最新发布</view>
</view>
</view>
</template>
<script>
import util from '../../../../utils/util';
import store_name from '../../components/store_name/store_name';
import deviceServer from '../../js/device_server';
import deviceApi from '../../js/device_api';
const rootPage = '/subpackage/device'
const tabArr = [{
id: 0,
name: '全部',
path: ``,
on: true
},
];
const weekArrCN = ["日", "一", "二","三","四","五","六"];
import {
mapState
} from 'vuex'
export default {
components: {
'store-name': store_name
},
computed: {
...mapState({
storeList: state => state.device.storeList,
curStoreInfo: state => state.device.curStoreInfo,
}),
isDel() {
return (item) => {
return item[2] == "删除" ? "true" : ""
}
}
},
data() {
return {
// tabArr,
// infoArr,
weekArrCN,
weekArr:[0,1,2,3,4,5,6],
weekArrSelect:[false,false,false,false,false,false,false]
}
},
async onLoad(opts) {
try {
util.showLoad();
let _brandInfo = await this.$store.dispatch('getBrandInfo');
await this.$store.dispatch('getStoreList');
util.hideLoad();
} catch (err) {
util.hideLoad();
}
},
onShow() {
this.updateList() //
},
watch: {
curStoreInfo(newVal, oldVal){
// this.infoArr.length = 1
this.updateList()
}
},
methods: {
clickWeekTab(index) {
if(this.weekArrSelect[index]) {
this.$set(this.weekArrSelect,index,false)
}else{
this.$set(this.weekArrSelect,index,true)
}
},
//
delItem(e,i) {
let that = this
let delData = {
"device": this.curStoreInfo.device_name,
"delay": 1,
"data": {
"name": "delete-time-select",
"value": {
"uuid": e[3]
}
}
}
uni.showModal({
content: `确认要删除: ${e[0]}的计划任务 ?`,
success(res) {
console.log("确认删除", res.confirm)
if(res.confirm){
that.operateReq({
data: delData,
succFun: (res) => {
that.updateList()
},
isTip:true
})
}
},
})
},
async updateList() {
let that = this
let timingData = {
"device": this.curStoreInfo.device_name,
"data": {
"name": "get-time-select",
"value": {}
}
}
this.operateReq({
data: timingData,
succFun: (list) => {
that.infoArr.length = 1;
list.forEach(async (item,i)=> {
if(item.day_of_week)item.day_of_week = item.day_of_week.sort((a,b)=>a-b);//
let timetxt = await that.getTimeTxt(item);
that.infoArr.push([item.expand_value.main.title||"-",timetxt||"-","删除",item.time_arrow_id])
})
}
})
},
//,
getTimeTxt(row) {
return new Promise((rs,rj)=>{
let timeText = ""
if (!row.expand_value) {
rj('error')
}
if (row.type === 'DAY_OF_WEEK' && row.day_of_week) {
let arr = []
for (let i = 0; i < row.day_of_week.length; i++) {
arr += ' 周' + ['日', '一', '二', '三', '四', '五', '六'][row.day_of_week[i]];
}
timeText = `每个星期的 <strong>[${arr} ]</strong> `
}
if (row.type === 'DAY_OF_MONTH' && row.day_of_month) {
let arr = []
for (let i = 0; i < row.day_of_month.length; i++) {
arr += row.day_of_month[i] + '号 ';
}
timeText = `每个月的 <strong>[ ${arr} ]</strong> `
}
if (row.type === 'DATE_SLICE' && row.date_slice) {
timeText = ` ${row.date_slice[0].start.substring(0, 10)}~${row.date_slice[0].end.substring(0, 10)}`
}
if (row.times_on_day && row.times_on_day.length) {
timeText += ` 当天<strong>${row.times_on_day[0].substring(0, 5)}</strong>`
}
if (!row.expand_value.main) return '历史错误数据';
rs(` ${timeText} 执行 ${row.expand_value.main.value.status === 'high' ? '<strong style="color:gray;">[关闭]</strong>' : '<strong style="color:#009874;">[开启]</strong>'} 操作`)
})
},
goBack() {
uni.navigateBack({
delta: 1
})
},
//
operateReq({
data,
succFun,
isTip = false,
isLoad = true,
}) {
let that = this
if (isLoad) util.showLoad();
deviceServer.post({
url: deviceApi.ouxuanac,
data: data,
isDefaultGet: false,
})
.then(res => {
if (isLoad) util.hideLoad();
if (res.data.code == 0) {
if (isTip) util.showNone(res.data.message || '操作成功!');
succFun(res.data.data)
} else {
if (isTip) util.showNone(res.data.message || '操作失败!');
}
})
.catch(err => {
if (isLoad) util.hideLoad()
})
},
}
}
</script>
<style lang="scss">
@import '~style/public.scss';
.timing-page {
.t-title {
font-size: 44rpx;
color: #1A1A1A;
font-weight: 900;
margin: 60rpx auto 72rpx 40rpx;
}
.t-box {
height: 500rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
width: 100%;
.info-list {
// margin-top: 30rpx;
margin-bottom: 50rpx;
padding: 50rpx 30rpx;
width: 700rpx;
height: auto;
background: #FFFFFF;
border-radius: 10rpx;
// font-size: 28rpx;
// height: 600rpx;
@include centerFlex(flex-start);
flex-direction: column;
align-items: flex-start;
font-size: 32rpx;
.il-switch{
width: 580rpx;
@include centerFlex(space-between);
> view{
@include centerFlex(center);
image{
margin-left: 20rpx;
width: 40rpx;height: 40rpx;
}
}
}
.il-select{
margin-top: 50rpx;
@include centerFlex(flex-start);
text{
}
> view{
@include centerFlex(space-between);
padding: 20rpx;
margin-left: 20rpx;
width: 480rpx;
height: 96rpx;
background: #FFFFFF;
border: 2rpx solid #D8D8D8;
border-radius: 10rpx;
text{
color: #9C9C9F;
}
image{
width: 28rpx;
height: 28rpx;
transform: rotate(90deg);
}
}
}
.il-select-week{
width: 100%;
height: auto;
@include centerFlex(flex-start);
flex-wrap: wrap;
> view{
@include centerFlex(center);
width: 160rpx;
height: 88rpx;
border: 2rpx solid #979797;
border-radius: 6rpx;
color: #979797;
margin-left: 40rpx;
margin-top: 40rpx;
}
.active{
background: rgba(0,152,116,0.12);
border: 2rpx solid #009874;color: #009874;
}
}
}
}
}
// css
.save-btn{
width: 700rpx;
height: 110rpx;
text-align: center;
line-height: 110rpx;
background: #009874;
border-radius: 10px;
color: white;
}
.bottom-tips{
font-size: 28rpx;
color: #1A1A1A;
text{
color: #009874;
}
margin: 40rpx;
}
</style>

BIN
src/subpackage/device/static/images/longOpen.png

After

Width: 100  |  Height: 100  |  Size: 6.3 KiB

BIN
src/subpackage/device/static/images/timing.png

After

Width: 100  |  Height: 100  |  Size: 5.1 KiB

Loading…
Cancel
Save