9 changed files with 471 additions and 39 deletions
-
2src/pages/employee/manage/manage.vue
-
15src/store/actions.js
-
34src/store/device.js
-
4src/store/index.js
-
32src/subpackage/device/components/store_name/store_name.vue
-
7src/subpackage/device/js/device_api.js
-
275src/subpackage/device/js/ouxuanac.md
-
21src/subpackage/device/pages/index/index.vue
-
120src/subpackage/device/pages/switch_manage/switch_manage.vue
@ -1,5 +1,16 @@ |
|||
// 异步方法
|
|||
|
|||
import { servers } from '../js/server'; |
|||
import { API } from '../js/api'; |
|||
export default { |
|||
|
|||
getBrandInfo({commit, state}){ |
|||
return servers.get({ |
|||
url: API.calc, |
|||
data: {}, |
|||
failMsg: '加载数据失败!' |
|||
}) |
|||
.then(res=>{ |
|||
commit('setBrandInfo',res); |
|||
return res; |
|||
}) |
|||
} |
|||
} |
@ -0,0 +1,34 @@ |
|||
import deviceServer from '../subpackage/device/js/device_server'; |
|||
import deviceApi from '../subpackage/device/js/device_api'; |
|||
|
|||
export default { |
|||
state(){ |
|||
return { |
|||
storeList: [], |
|||
curStoreInfo: {} |
|||
} |
|||
}, |
|||
mutations: { |
|||
setStoreList(state, query){ |
|||
state.storeList = query; |
|||
}, |
|||
setStoreInfo(state, query){ |
|||
state.curStoreInfo = query; |
|||
} |
|||
}, |
|||
actions: { // 小程序模块化访问失败 this.$store.dispatch('device/getStoreList')
|
|||
getStoreList({ commit, state , rootState}){ |
|||
return deviceServer.get({ |
|||
url: deviceApi.stadiumList, |
|||
data: { brand_id: rootState.brandInfo.brand.id }, |
|||
failMsg: '加载失败!', |
|||
}) |
|||
.then(res=>{ |
|||
let _list = res.list || []; |
|||
commit('setStoreList', _list); |
|||
if(JSON.stringify(state.curStoreInfo) == '{}'&&_list.length)commit('setStoreInfo', _list[0]); |
|||
return res; |
|||
}) |
|||
} |
|||
} |
|||
} |
@ -1,7 +1,12 @@ |
|||
import { ORIGIN } from '../../../js/api'; |
|||
|
|||
export const DEVICE_API = { |
|||
hardwareList:`${ORIGIN}/admin/stadium/hardware/list`, // 品牌信息
|
|||
stadiumList:`${ORIGIN}/stadium/list`, // 店铺列表
|
|||
hardwareList:`${ORIGIN}/admin/stadium/hardware/list`, // 设备列表
|
|||
ouxuanac:`${ORIGIN}/ouxuanac/sendPacket`, // 中控控制
|
|||
// ouxuanac--> http://api.ouxuan.net/project/233/interface/api/10012 接口文档
|
|||
// ouxuanac--> http://git.ouxuan.net/ouxuanac/ouxuanac-common/src/branch/master/cmd.ts // 接口参数结构 || ouxuanac.md
|
|||
|
|||
} |
|||
|
|||
export default DEVICE_API; |
@ -0,0 +1,275 @@ |
|||
### 请求示例 |
|||
|
|||
``` json |
|||
|
|||
{ |
|||
"device":"00-10-7a-0f-6d-7a", |
|||
"data":{ // 此对象为下面提供的function对象 |
|||
"name":"set-rpio", |
|||
"value":{ |
|||
"id":"12", |
|||
"status":"low" |
|||
} |
|||
}, |
|||
"token": "" |
|||
} |
|||
|
|||
``` |
|||
|
|||
### 接口参数数据结构 |
|||
|
|||
```ts |
|||
enum RelayOP { |
|||
Low = "low", // 低电位,为开启 |
|||
High = "high", // 高电位, 为关闭 |
|||
} |
|||
|
|||
//--------------------------if 通讯方式为开关量时使用----------------------------- |
|||
|
|||
//原生继电器 |
|||
function relayPacket(id: string, op: RelayOP) { |
|||
return { |
|||
"name": "set-rpio", |
|||
"value": { |
|||
"id": id, |
|||
"status": op |
|||
} |
|||
} |
|||
} |
|||
|
|||
//原生继电器获取状态 通讯方式为开关量时使用 |
|||
function relayGetPacket(id: string) { |
|||
return { |
|||
"name": "get-rpio", |
|||
"value": { |
|||
"id": id, |
|||
} |
|||
} |
|||
} |
|||
|
|||
//------------------------------------------------------- |
|||
|
|||
|
|||
//--------------------------if 通讯方式485,且设备类型为 照明/风扇/门禁/水阀 时使用----------------------------- |
|||
//485继电器 p为继电器口和原生继电器id意义一致 |
|||
function relay485Packet(id: string, p: string, o: RelayOP) { |
|||
return { |
|||
"name": "zzio404d-gpio", |
|||
"value": { |
|||
"id": id, |
|||
"p": p, |
|||
"o": o, |
|||
} |
|||
} |
|||
} |
|||
|
|||
//获取状态 返回RelayOP |
|||
function relay485StatusPacket(id: string, p: string) { |
|||
return { |
|||
"name": "zzio404d-gpio-status", |
|||
"value": { |
|||
"id": id, |
|||
"p": p, |
|||
} |
|||
} |
|||
} |
|||
|
|||
//------------------------------------------------------- |
|||
|
|||
|
|||
//--------------------------if 通讯方式Tcp,且设备类型为 照明/风扇/门禁/水阀 时使用----------------------------- |
|||
//Tcp继电器 o为空时获取状态 |
|||
function relayTcpPacket(tcp: string, id: string, p: string, o: RelayOP) { |
|||
return { |
|||
"name": "zzio404d-gpio-tcp", |
|||
"value": { |
|||
"tcp": tcp, |
|||
"id": id, |
|||
"p": p, |
|||
"o": o, |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
//获取状态 返回RelayOP |
|||
function relayTcpStatusPacket(tcp: string, id: string, p: string) { |
|||
return { |
|||
"name": "zzio404d-gpio-status-tcp", |
|||
"value": { |
|||
"id": id, |
|||
"tcp": tcp, |
|||
"p": p, |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
enum AirOP { |
|||
status = "status", |
|||
on = "on", |
|||
off = "off", |
|||
} |
|||
|
|||
//--------------------------if 通讯方式485, 设备类型为空调 ,硬件型号为Acmelec 时使用----------------------------- |
|||
//485通讯的acmelec |
|||
function air485AcmelecPacket(id: string, op: AirOP) { |
|||
return { |
|||
"name": "acmelec", |
|||
"value": { |
|||
"id": id, |
|||
"op": op, |
|||
} |
|||
} |
|||
} |
|||
|
|||
//--------------------------if 通讯方式485, 设备类型为空调 ,硬件型号为Zhongnan 时使用----------------------------- |
|||
//485的中南 |
|||
function air485ZhongnanPacket(id: string, op: AirOP) { |
|||
return { |
|||
"name": "zhongnan", |
|||
"value": { |
|||
"id": id, |
|||
"op": op, |
|||
} |
|||
} |
|||
} |
|||
|
|||
//--------------------------if 通讯方式485, 设备类型为空调 ,硬件型号为Jianda 时使用----------------------------- |
|||
//485的仁大建科 |
|||
function air485JiandaPacket(id: string, op: AirOP) { |
|||
return { |
|||
"name": "ray-air-rs", |
|||
"value": { |
|||
"id": id, |
|||
"op": op, |
|||
} |
|||
} |
|||
} |
|||
|
|||
//--------------------------if 通讯方式tcp, 设备类型为空调 ,硬件型号为Jianda 时使用----------------------------- |
|||
//tcp的仁大建科 |
|||
function airTcpJiandaPacket(tcp: string, id: string, op: AirOP) { |
|||
return { |
|||
"name": "ray-air-rs-tcp", |
|||
"value": { |
|||
"tcp": tcp, |
|||
"id": id, |
|||
"op": op, |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
enum LockerOP { |
|||
status = "status", |
|||
on = "on", |
|||
} |
|||
|
|||
|
|||
//--------------------------if 通讯方式485, 设备类型为储物柜时使用----------------------------- |
|||
//485 储物柜 |
|||
//tcp 储物柜 cid为硬件地址id id为具体箱子的id |
|||
function Locker485Packet(id: string, cid: string, op: LockerOP) { |
|||
return { |
|||
"name": "lock-b", |
|||
"value": { |
|||
"id": id, |
|||
"cid": cid, |
|||
"op": op, |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
//--------------------------if 通讯方式tcp, 设备类型为储物柜时使用----------------------------- |
|||
//tcp 储物柜 cid为硬件地址id id为具体箱子的id |
|||
function LockerTcpPacket(tcp: string, cid: string, id: string, op: LockerOP) { |
|||
return { |
|||
"name": "lock-b-tcp", |
|||
"value": { |
|||
"tcp": tcp, |
|||
"id": id, |
|||
"cid": cid, |
|||
"op": op, |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
//--------------------------if 通讯方式tcp, 设备类型为售货柜 硬件型号为 yunyin 时使用----------------------------- |
|||
//售货柜出货 |
|||
function YunyinPacket(tcp: string, id: string) { |
|||
//请求三次接口 重置 开启 重置 |
|||
return [ |
|||
{ |
|||
"name": "yunyin-reseq", |
|||
"value": { |
|||
"tcp": tcp, |
|||
"id": id, |
|||
} |
|||
}, |
|||
{ |
|||
"name": "yunyin-pop", |
|||
"value": { |
|||
"tcp": tcp, |
|||
"id": id, |
|||
} |
|||
}, |
|||
{ |
|||
"name": "yunyin-reseq", |
|||
"value": { |
|||
"tcp": tcp, |
|||
"id": id, |
|||
} |
|||
}, |
|||
] |
|||
} |
|||
|
|||
//获取yunyin机器码 |
|||
function YunyinMacPacket(tcp: string) { |
|||
return [ |
|||
{ |
|||
"name": "yunyin-mac", |
|||
"value": { |
|||
"tcp": tcp, |
|||
} |
|||
} |
|||
] |
|||
} |
|||
|
|||
|
|||
enum CoffeeboxTemperature { |
|||
hot = "hot", //热 |
|||
cold = "cold", //冷 |
|||
} |
|||
|
|||
//--------------------------if 通讯方式tcp, 设备类型为咖啡机 硬件型号为 miaoque 时使用----------------------------- |
|||
function CoffeeboxPacket(tcp: string, id: string, t: CoffeeboxTemperature) { |
|||
|
|||
return { |
|||
"name": "coffeebox-tcp", |
|||
"value": { |
|||
"tcp": tcp, |
|||
"id": id, |
|||
"t": t, |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
//--------------------------if 通讯方式tcp, 设备类型为门闸时使用----------------------------- |
|||
//门闸 |
|||
function GatePacket(tcp: string, cid: string,) { |
|||
return { |
|||
"name": "gate", |
|||
"value": { |
|||
"tcp": tcp, |
|||
"cid": cid, //进出控制ID |进入-> enter_id 离开-> leave_id| |
|||
}, |
|||
"is_delay": true, |
|||
"queue_group": "gate", |
|||
} |
|||
} |
|||
``` |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue