|
@@ -8,6 +8,9 @@
|
|
|
<el-button size="small" class="xl_down_button" @click="addEquipment()">
|
|
|
新增设备</el-button
|
|
|
>
|
|
|
+ <el-button size="small" class="xl_down_button" @click="updateJizhan()">
|
|
|
+ 修改蓝牙基站MAC</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="11" style="text-align: left"> </el-col>
|
|
|
<el-col :span="1"> </el-col>
|
|
@@ -35,7 +38,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="Mac" align="center" label="mac"> </el-table-column>
|
|
|
|
|
|
- <el-table-column label="操作" align="center" width='100px'>
|
|
|
+ <el-table-column label="操作" align="center" width="100px">
|
|
|
<template slot-scope="scope">
|
|
|
<!-- <el-button
|
|
|
class="xl_d_button"
|
|
@@ -93,7 +96,7 @@
|
|
|
>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="mac" align="center" label="mac"> </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" width='200px'>
|
|
|
+ <el-table-column label="操作" align="center" width="200px">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
:disabled="buttonLinkFlag"
|
|
@@ -107,7 +110,7 @@
|
|
|
>
|
|
|
|
|
|
<el-button
|
|
|
- style='margin-top:10px'
|
|
|
+ style="margin-top: 10px"
|
|
|
v-show="scope.row.addFlag"
|
|
|
:disabled="buttonLinkFlag"
|
|
|
class="xl_d_button"
|
|
@@ -177,15 +180,124 @@
|
|
|
<button class="com_add" @click="addFun()">确定</button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :visible.sync="centerDialogVisible" width="545px" center class="dig_equi">
|
|
|
+ <div slot="title" class="title_di" style="width: 545px">
|
|
|
+ <img width="545px" src="../assets/manage/bg_di.png" />
|
|
|
+ <div class="equipment_title">新增设备</div>
|
|
|
+ <img
|
|
|
+ class="equipment_bg"
|
|
|
+ width="85px"
|
|
|
+ height="85px"
|
|
|
+ src="../assets/manage/bg_title.png"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <span class="min_equi">
|
|
|
+ <div class="equipment_class">
|
|
|
+ <div style="margin-left: 40px; width: 120px">选择设备: </div>
|
|
|
+ <el-select
|
|
|
+ v-model="type"
|
|
|
+ style="width: 100%; margin-right: 40px"
|
|
|
+ placeholder="请选择设备"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in options"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="equipment_class">
|
|
|
+ <div style="margin-left: 40px; width: 120px">设备mac: </div>
|
|
|
+ <el-input
|
|
|
+ style="width: 100%; margin-right: 40px"
|
|
|
+ v-model="mac"
|
|
|
+ placeholder="例如DC:0D:30:03:39:05"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <button class="cancle_add" @click="centerDialogVisible = false">取消</button>
|
|
|
+ <button class="com_add" @click="addFun()">确定</button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 修改mac -->
|
|
|
+ <el-dialog :visible.sync="baseStationFlag" width="545px" center class="dig_equi">
|
|
|
+ <div slot="title" class="title_di" style="width: 545px">
|
|
|
+ <img width="545px" src="../assets/manage/bg_di.png" />
|
|
|
+ <div class="equipment_title">选择蓝牙基站</div>
|
|
|
+ <img
|
|
|
+ class="equipment_bg"
|
|
|
+ width="85px"
|
|
|
+ height="85px"
|
|
|
+ src="../assets/manage/bg_title.png"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <span class="min_equi">
|
|
|
+ <div class="equipment_class">
|
|
|
+ <div style="margin-left: 40px; width: 240px">选择蓝牙基站mac: </div>
|
|
|
+ <el-select
|
|
|
+ v-model="baseStationDes"
|
|
|
+ style="width: 100%; margin-right: 40px"
|
|
|
+ placeholder="请选择设备"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in baseStationOptions"
|
|
|
+ :key="item.mac"
|
|
|
+ :label="item.mac"
|
|
|
+ :value="item.mac"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <button class="cancle_add" @click="baseStationFlag = false">取消</button>
|
|
|
+ <button class="com_add" @click="saveBaseSation">确定</button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 关闭弹框 -->
|
|
|
+ <el-dialog :visible.sync="comFlag" width="545px" center class="dig_equi">
|
|
|
+ <div slot="title" class="title_di" style="width: 545px">
|
|
|
+ <img width="545px" src="../assets/manage/bg_di.png" />
|
|
|
+ <div class="equipment_title">提示</div>
|
|
|
+ <img
|
|
|
+ class="equipment_bg"
|
|
|
+ width="85px"
|
|
|
+ height="85px"
|
|
|
+ src="../assets/manage/bg_title.png"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <span class="min_equi">
|
|
|
+ <div class="equipment_class">
|
|
|
+ <div style="margin-left: 40px; width: 240px">提示:关闭软件后生效,确认关闭吗?</div>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <button class="cancle_add" @click="comFlag = false">取消</button>
|
|
|
+ <button class="com_add" @click="visiblePopFun">确定</button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import axios from "axios";
|
|
|
import jsFileDownload from "js-file-download";
|
|
|
+let ipcRenderer = require("electron").ipcRenderer;
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ comFlag:false,
|
|
|
+ visiblePop: false,
|
|
|
centerDialogVisible: false,
|
|
|
+ //蓝牙基站所选参数
|
|
|
+ baseStationDes: "",
|
|
|
+ baseStationOptions: [],
|
|
|
+
|
|
|
options: [
|
|
|
{
|
|
|
value: "0",
|
|
@@ -230,6 +342,8 @@ export default {
|
|
|
},
|
|
|
buttonLinkFlag: false,
|
|
|
disabledTimeFlag: null,
|
|
|
+ //蓝牙基站的flag
|
|
|
+ baseStationFlag: false,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -257,6 +371,57 @@ export default {
|
|
|
//离开之后断开websocket连接
|
|
|
},
|
|
|
methods: {
|
|
|
+ visiblePopFun() {
|
|
|
+ this.baseStationFlag = false;
|
|
|
+ this.visiblePop = false;
|
|
|
+ this.comFlag=false;
|
|
|
+ //调用关闭软件的方法
|
|
|
+ ipcRenderer.send("window-close");
|
|
|
+ },
|
|
|
+ //保存蓝牙基站mac
|
|
|
+ saveBaseSation() {
|
|
|
+ //判断选择框是否选了mac了
|
|
|
+ if (this.baseStationDes == "") {
|
|
|
+ this.visiblePop = false;
|
|
|
+ this.$message.info("尚未选择蓝牙基站mac");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ let path = `v2/gateway/set`;
|
|
|
+ this.$http.postTmp(path, { mac: this.baseStationDes }, (res) => {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ this.baseStationFlag = false;
|
|
|
+ this.comFlag=true;
|
|
|
+ //修改成功后提示需要重启软件
|
|
|
+ //修改成功后关掉
|
|
|
+ // this.$message.success("添加成功");
|
|
|
+ // this.queryEle();
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //更新蓝牙基站mac
|
|
|
+ updateJizhan() {
|
|
|
+ let that = this;
|
|
|
+ that.baseStationDes = "";
|
|
|
+ //清空选项
|
|
|
+ this.baseStationFlag = true;
|
|
|
+ //调用蓝牙基站mac
|
|
|
+ //查询接口得到返回的mac数据
|
|
|
+ that.$http.getTmp(`v2/gateway/find`, {}, (res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ that.baseStationOptions = res.data;
|
|
|
+ // if(res.data,length>0){
|
|
|
+ // for(let i =0;i<res.data.length;i++){
|
|
|
+ // let a = res.data[i]
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ } else {
|
|
|
+ // this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
//新增设备
|
|
|
addEquiLine(val) {
|
|
|
let path = "v1/device/add";
|
|
@@ -266,7 +431,7 @@ export default {
|
|
|
};
|
|
|
this.$http.postTmp(path, data, (res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
- this.$message.success('添加成功');
|
|
|
+ this.$message.success("添加成功");
|
|
|
this.queryEle();
|
|
|
} else {
|
|
|
this.$message.error(res.data.message);
|
|
@@ -315,8 +480,8 @@ export default {
|
|
|
rssiFor(val) {
|
|
|
if (val.rssi == 0) {
|
|
|
return "";
|
|
|
- }else{
|
|
|
- return val.rssi
|
|
|
+ } else {
|
|
|
+ return val.rssi;
|
|
|
}
|
|
|
},
|
|
|
nameFormatter(val) {
|
|
@@ -827,7 +992,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- console.log(finalData)
|
|
|
+ console.log(finalData);
|
|
|
this.mergeData = finalData;
|
|
|
},
|
|
|
changeList(obj) {
|
|
@@ -1063,4 +1228,12 @@ export default {
|
|
|
left: 10px;
|
|
|
top: -10px;
|
|
|
}
|
|
|
+.equipment_title{
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ right:0;
|
|
|
+ top: 14px;
|
|
|
+ font-size:24px;
|
|
|
+ color:#ffffff;
|
|
|
+}
|
|
|
</style>
|