zhengwei 4 gadi atpakaļ
vecāks
revīzija
622b2de94a

+ 0 - 8
src/components/Navside.vue

@@ -62,11 +62,9 @@ export default {
   methods: {
     //展开一级菜单
     handleOpen(key, keyPath) {
-      console.log('handleOpen', key, keyPath);
     },
     //关闭一级菜单
     handleClose(key, keyPath) {
-      console.log('handleClose', key, keyPath);
     },
     //选中二级菜单栏项
     selectMenu(i, columnId, c) {
@@ -89,12 +87,9 @@ export default {
 
       let paraRequest = new GetShopNaviAllRequest();
       paraRequest.setShopid(localStorage.shopId);
-      console.log(localStorage.token);
       that.client.getShopNaviAll(paraRequest, {"Token": localStorage.token}, (err, GetShopNaviAllReply) => {
         if (err == null) {
-          console.log(GetShopNaviAllReply.getColumnrs());
           let res = JSON.parse(GetShopNaviAllReply.getColumnrs());
-          console.log(res);
           let naviJson = [];
           let topNaviJson = [];
           res.forEach((parentItem, i) => {
@@ -126,12 +121,9 @@ export default {
           })
           that.navs = naviJson;
           that.singleNavs = topNaviJson;
-          console.log(naviJson);
-          console.log(topNaviJson);
         } else {
           let res = err;
           that.$message.error(res.message + ',错误代码:' + res.code);
-          console.log(res);
         }
       });
     },

+ 7 - 7
src/router/index.js

@@ -219,13 +219,13 @@ const routes = [
                 meta: {
                     title: "私有心率设备",
                 }
-            }, {
-                path: '/hrSensorLog',
-                name: 'hrSensorLog',
-                component: () => import('@/views/HrSensor/HrSensorLog.vue'),
-                meta: {
-                    title: "设备记录",
-                }
+            // }, {
+            //     path: '/hrSensorLog',
+            //     name: 'hrSensorLog',
+            //     component: () => import('@/views/HrSensor/HrSensorLog.vue'),
+            //     meta: {
+            //         title: "心率记录",
+            //     }
             }, {
                 path: '/bindRecord',
                 name: 'bindRecord',

+ 169 - 570
src/views/HrSensor/HrSensor.vue

@@ -1,30 +1,19 @@
 <template>
   <div class="context">
     <div class="panel">
-      <h5>心率设备</h5>
+      <h5>场馆心率设备</h5>
       <div class="likeTab">
         <el-button type="primary" @click="goType('hrSensor')" size="mini">场馆心率设备</el-button>
         <el-button type @click="goType('hrSensorPrivate')" size="mini">私有心率设备</el-button>
       </div>
       <div class="panel-body">
         <div class="panel_control">
-          <el-row :gutter="20">
+          <el-row :gutter="2">
             <el-col :span="5">
-              <em>心率设备:</em>
-              <el-input v-model="panel.str" placeholder="请输入编号" type="number"></el-input>
+              <em style="line-height: 40px; margin-right: 10px">心率设备:</em>
+              <el-input v-model="panel.str" placeholder="请输入编号" type="number" style="width: 120px"/>
             </el-col>
-            <!--<el-col :span="4">-->
-            <!--<em>设备状态:</em>-->
-            <!--&lt;!&ndash;status&ndash;&gt;-->
-            <!--<el-select v-model="panel.status" placeholder="请选择">-->
-            <!--<el-option-->
-            <!--v-for="item in panel.statusOptions"-->
-            <!--:key="item.value"-->
-            <!--:label="item.label"-->
-            <!--:value="item.value">-->
-            <!--</el-option>-->
-            <!--</el-select>-->
-            <!--</el-col>-->
+
             <el-col :span="2">
               <el-button size type="primary" @click="query" plain>查询</el-button>
             </el-col>
@@ -33,16 +22,13 @@
       </div>
     </div>
     <div class="change">
-      <el-button @click="addMember" type="primary" size="mini">新增心率设备</el-button>
-      <el-button @click="editList" size="mini">编辑心率设备</el-button>
-      <el-button type="success" @click="getAllPower" :loading="BtnGetAllPower" size="mini">全部设备电量</el-button>
-      <!--<el-button @click="delList" type="danger">删除心率设备</el-button>-->
+      <el-button @click="addHrSensor" type="primary" size="mini">新增心率设备</el-button>
+      <el-button @click="editHrSensor" size="mini">编辑心率设备</el-button>
     </div>
     <div class="table">
       <el-table :data="tableData" border is-horizontal-resize
                 :default-sort="{ prop: 'date', order: 'descending' }" element-loading-background="rgba(0, 0, 0, 0.8)"
                 class @selection-change="handleSelectionChange" @current-change="clickChange">
-        >
         <el-table-column label="选择" width="55">
           <template slot-scope="scope">
             <el-radio v-model="tableRadio" :label="scope.row">
@@ -50,108 +36,57 @@
             </el-radio>
           </template>
         </el-table-column>
-        <!--<el-table-column-->
-        <!--type="index"-->
-        <!--label="序号"-->
-        <!--align="center"-->
 
-        <!--width="50">-->
-        <!--</el-table-column>-->
-        <!--<el-table-column-->
-        <!--prop="InVenueNo"-->
-        <!--label="馆内编号"-->
-        <!--align="center"-->
-        <!--width="90"-->
-        <!--&gt;-->
-        <!--</el-table-column>-->
-        <el-table-column prop="Sn" label="序列号" align="InVenueNo" width="100px" sortable></el-table-column>
-        <el-table-column prop="UserName" label="用户" align="center" sortable>
+        <el-table-column prop="sn" label="序列号" align="InVenueNo" width="100px" sortable></el-table-column>
+        <el-table-column prop="bind_user_name" label="用户" align="center" sortable>
           <template slot-scope="scope">
-            {{ scope.row.UserName }}
-            <!--<el-select v-model="scope.row.BindUserId" @change="getRowTop(scope.row)" filterable v-if="scope.row.BindUserId">-->
-            <!--<el-option-->
-            <!--v-for="item in panel.options"-->
-            <!--:key="item.value"-->
-            <!--:label="item.label"-->
-            <!--:value="item.value">-->
-            <!--</el-option>-->
-            <!--</el-select>-->
-
-            <!--<el-button @click="takeBack(scope.row)" type="danger" v-if="!scope.row.BindUserId">{{scope.row.UserName}} 设备收回</el-button>-->
+            {{ scope.row.bind_user_name == "" ? "暂未绑定" : scope.row.bind_user_name }}
           </template>
         </el-table-column>
-        <el-table-column prop="PowerPercent" label="电量" align="center" width="80px" sortable>
+        <el-table-column prop="power_percent" label="电量" align="center" width="80px" sortable>
           <template slot-scope="scope">
-                        <span style="color: red" v-if="parseInt(scope.row.PowerPercent) <= 20">{{
-                            scope.row.PowerPercent
-                          }}</span>
+            <span style="color: red" v-if="parseInt(scope.row.power_percent) <= 20">{{ scope.row.power_percent }}</span>
             <span style="color: gold"
-                  v-if="parseInt(scope.row.PowerPercent) > 20 && parseInt(scope.row.PowerPercent) < 80">{{
-                scope.row.PowerPercent
+                  v-if="parseInt(scope.row.power_percent) > 20 && parseInt(scope.row.power_percent) < 80">{{
+                scope.row.power_percent
               }}</span>
-            <span style="color: #67C23A" v-if="parseInt(scope.row.PowerPercent) >= 80">{{
-                scope.row.PowerPercent
+            <span style="color: #67C23A" v-if="parseInt(scope.row.power_percent) >= 80">{{
+                scope.row.power_percent
               }}</span>
           </template>
         </el-table-column>
-        <el-table-column prop="PowerUpdateAt" label="电量更新时间" align="center" width="150px"
-                         :formatter="filterFmtDate"></el-table-column>
 
-        <!--<el-table-column-->
-        <!--prop="Status"-->
-        <!--label="状态"-->
-        <!--align="center"-->
-        <!--width="90"-->
-        <!--&gt;-->
-        <!--<template slot-scope="scope">-->
-        <!--&lt;!&ndash;1:启用  8:暂停  9:删除&ndash;&gt;-->
-        <!--<span v-if="scope.row.Status == 1" style="color: #67c23a">已启用</span>-->
-        <!--<span v-if="scope.row.Status == 8" style="color: #E6A23C">已暂停</span>-->
-        <!--<span v-if="scope.row.Status == 9" style="color: red">已删除</span>-->
-        <!--</template>-->
-        <!--</el-table-column>-->
+        <el-table-column prop="power_update_at" label="电量更新时间" align="center" width="150" :formatter="filterFmtDate"/>
+
         <el-table-column prop="id" label="操作">
           <template slot-scope="scope">
-            <!--<el-button type="success" v-if="scope.row.Status == 8" size="mini"-->
-            <!--@click="pauseRow(scope.row,1)">-->
-            <!--启用-->
-            <!--</el-button>-->
-            <!--<el-button type="warning" v-if="scope.row.Status == 1" size="mini"-->
-            <!--@click="pauseRow(scope.row,8)">-->
-            <!--禁用-->
-            <!--</el-button>-->
-
             <el-button type="danger" size="mini" @click="pauseRowDel(scope.row)">删除</el-button>
-
-            <el-button type="primary" size="mini" @click="goPage(scope.row)">记录</el-button>
-            <el-button type="success" size="mini" @click="getPower(scope.row)">获取电量</el-button>
           </template>
         </el-table-column>
       </el-table>
       <br/>
-      <el-pagination background :total="pageination.total" :page-size="pageination.pageItem"
-                     @current-change="pageChange"
-                     :current-page.sync="cur_page"
-      ></el-pagination>
+      <el-pagination background :total="pagination.total" :page-size="pagination.pageItem"
+                     @current-change="pageChange" :current-page.sync="cur_page"/>
     </div>
-    <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="650px">
+    <el-dialog :title="dialogTitle" :visible.sync="dialogSensorVisible" width="550px">
       <div class="dialogContent">
         <div class>
-          <el-form ref="form" :model="form" label-width="160px">
-            <!--<el-form-item label="馆内编号" :required="true">-->
-            <!--<el-input v-model="form.venueNo"></el-input>-->
-            <!--</el-form-item>-->
+          <el-form ref="form" :model="form" label-width="80px">
             <el-form-item label="序列号" :required="true">
               <el-input v-model="form.sn"></el-input>
             </el-form-item>
+
+            <el-form-item label="馆内编号">
+              <el-input v-model="form.venueNo"></el-input>
+            </el-form-item>
           </el-form>
         </div>
       </div>
       <div class="dialogFooter">
-        <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmMember">确定</el-button>
-        <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
+        <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmAddSensor">确定</el-button>
+        <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditSensor">确定
         </el-button>
-        <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
+        <el-button size="small" @click="dialogSensorVisible = false">取消</el-button>
       </div>
     </el-dialog>
   </div>
@@ -159,19 +94,6 @@
 
 <script>
 import Global from '../../Global.js'
-import {
-  testTable,
-  testSelect,
-  ShopManagerStatusEdit,
-  ClassDetailOne,
-  QueryHrSensors,
-  AddHrSensors,
-  HrSensorsStatusEdit,
-  EditHrSensors,
-  UnBindHrSensorsToUser,
-  GetHrSensorsPowerPercent,
-  ShopVenueEquipEditStatus,
-} from "../../api/getApiRes";
 import {
   StandardRequest
 } from "@/grpc/base_pb";
@@ -183,81 +105,35 @@ export default {
       activeName: 'comm',
       dialogVisible: false,//其他dialog
       BtnGetAllPower: false,//
-      dialogMemberVisible: false,//新增心率设备dialog
-      dialogLesson: false,//课时调整
-      dialogGift: false,//赠送课时调整
-      dialogExpTime: false,//有效期调整
-      dialogLessonTable: false,//心率设备课程
+      dialogSensorVisible: false,//新增心率设备dialog
       dialogTitle: '新增心率设备',
-      dialogValue: [],
       tableRadio: [],
+      multipleSelection: [],
+      draw: 1,
+      start: 0,
+      recordsTotal: 0,
+      cur_page: 1,
       // panel 配置项目
       panel: {
         str: '',
-        phone: '',
-        compname: '',
-        keyword: '',
-        USERCODE: '',
-        endType: '',
-        taskstatus: 99,
-        status: "",
-        draw: 1,
-        start: 0,
-        recordsTotal: 0,
         tableData: [],
         allTableData: [],
-        limit: '10',
-        multipleSort: false,
-        loading: false,
-        fileList: [],
-        multipleSelection: [],
-        detectedmac: '',
-        statusOptions: [
-          {value: "", label: '全部'},
-          {value: 1, label: '启用'},
-          {value: 8, label: '暂停'},
-          {value: 9, label: '删除'},
-        ], options: [
-          {value: 99, label: '全部'},
-          {value: 1, label: '进行中'},
-          {value: 2, label: '已完成'},
-        ],
-        endTypeOptions: [
-          {value: 99, label: '全部'},
-          {value: 30, label: '近一个月'},
-          {value: 7, label: '近一周'},
-          {value: 1, label: '当日'},
-        ],
-        time1: globalBt(),
+        loading: false
       },
-      multipleSelection: [],
-      pageination: {
+      pagination: {
         pageItem: 10,
-        pageoptions: pageOptions(),
+        pageOptions: pageOptions(),
         total: 100,
         pageIndex: 1,
       },
       form: {
-        name: '',
-        userCode: '',
         sn: '',
+        hrId: '',
         venueNo: '',
         shopId: '',
-        teacherId: 0,
-        memberType: 1,
-        lesson: 1,
-        gift: 1,
         btnType: 0,//0新建,1编辑编辑
         memo: '',
-        phone: '',
-        expTime: '',
-        dialogdata: [],//穿梭待选
-        dialogValue: [],//穿梭已选
       },
-      memberTypes: [
-        {value: 1, label: '年心率设备'},
-        {value: 2, label: '充值心率设备'},
-      ],
       tableData: []
     }
   },
@@ -267,7 +143,6 @@ export default {
   methods: {
     handleClick(tab, event) {
       let that = this;
-
       if (tab.name == "personal") {
         // 私有
         that.$router.push({path: '/hrSensorPrivate'});
@@ -276,291 +151,25 @@ export default {
         that.$router.push({path: '/hrSensor'});
       }
     },
-    // 设备回收
-    takeBack(row) {
-      let that = this;
-      this.$confirm('是否回收用户' + row.name + '的心率设备?', '回收操作', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        let param = {
-          token: localStorage.token,
-          Id: row.Id,
-          status: 0,
-        };
-        let postdata = qs.stringify(param);
-        UnBindHrSensorsToUser(postdata).then(res => {
-          let json = res;
-          if (json.Code == 0) {
-            that.$message({
-              showClose: true,
-              message: row.name + '回收成功!',
-              type: 'success'
-            });
-            // table 重载
-            that.getTableQuery();
-          } else {
-            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-          }
-        })
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消回收'
-        });
-      });
-    },
-    goPage(row) {
-      // 查看绑定记录
-      this.$router.push({path: '/hrSensorLog', query: {hrId: row.HrId}});
-    },
     goType(url) {
       this.$router.push({path: '/' + url});
     },
-    // 编辑
-    editList() {
-      let that = this;
-      this.clearForm();
-      console.log(this.tableRadio);
-      if (this.tableRadio.length == 0) {
-        this.$message.error("请先选中一条记录");
-        return false
-      }
-      let row = this.tableRadio;
-      this.form.shopid = row.ShopId;
-      this.form.userId = row.Id;
-      this.form.name = row.Name;
-      this.form.userCode = row.Usercode;
-      this.form.password = '';
-      this.form.hrId = row.HrId;
-      this.form.sn = row.Sn;
-      this.form.venueNo = row.InVenueNo;
-      this.dialogVisible = true;
-      this.dialogTitle = '编辑心率设备';
-      this.form.btnType = 1;
-      this.dialogMemberVisible = true
-    },
     clickChange(item) {
       this.tableRadio = item
     },
-    // 选择课程后,获取当前课程的建议上课人数和课时消耗
-    getRowTop(row) {
-      let that = this;
-      console.log(row);
-      let param = {
-        token: localStorage.token,
-        classId: row.ClassId,
-      };
-      let postdata = qs.stringify(param);
-      ClassDetailOne(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          row.TopLimit = json.Rs.TopLimit;
-          row.ConsumeHour = json.Rs.ConsumeHour;
-        } else {
-          that.$message.error(json.Memo + ' 错误码:' + json.Code);
-        }
-      })
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
     },
-    // 编辑
-    editMember(row) {
+    // 新增心率设备
+    addHrSensor() {
       this.clearForm();
-      this.form.name = row.Name;
-      this.form.phone = row.Phone;
-      this.form.shopId = row.ShopId;
-      this.form.teacherId = row.TeacherId;
-      this.form.btnType = 1;
-      this.dialogMemberVisible = true
-      this.dialogTitle = '编辑心率设备'
-    },
-    // 禁用
-    pauseRow(row, status) {
-      let that = this;
-      let param = {
-        token: localStorage.token,
-        hrId: row.HrId,
-        status: status,//1:启用 8:暂停 9:删除
-      };
-      let postdata = qs.stringify(param);
-      HrSensorsStatusEdit(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          that.$message({
-            showClose: true,
-            message: '执行成功!',
-            type: 'success'
-          });
-          // table 重载
-          that.getTableQuery();
-        } else {
-          that.$message.error(json.Memo + ' 错误码:' + json.Code);
-        }
-      })
-    },
-    // pauseRow(row) {
-    //     let that = this;
-    //     this.$confirm('是否禁用心率设备' + row.Sn + '?', '禁用操作', {
-    //         confirmButtonText: '确定',
-    //         cancelButtonText: '取消',
-    //         type: 'warning'
-    //     }).then(() => {
-    //         let param = {
-    //             token: localStorage.token,
-    //             shopId : localStorage.token,
-    //             status: 8,
-    //         };
-    //         let postdata = qs.stringify(param);
-    //         ShopVenueEquipEditStatus(postdata).then(res => {
-    //             let json = res;
-    //             if (json.Code == 0) {
-    //                 that.$message({
-    //                     showClose: true,
-    //                     message: row.name + '禁用成功!',
-    //                     type: 'success'
-    //                 });
-    //                 // table 重载
-    //                 that.getTableQuery();
-    //             } else {
-    //                 that.$message.error(json.Memo + ' 错误码:' + json.Code);
-    //             }
-    //         })
-    //     }).catch(() => {
-    //         this.$message({
-    //             type: 'info',
-    //             message: '已取消禁用'
-    //         });
-    //     });
-    // },
-    // 启用
-    runRow(row) {
-      let that = this;
-      this.$confirm('是否启用心率设备' + row.Sn + '?', '启用操作', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        let param = {
-          token: localStorage.token,
-          Id: row.Id,
-          status: 1,
-        };
-        let postdata = qs.stringify(param);
-        testTable(postdata).then(res => {
-          let json = res;
-          if (json.Code == 0) {
-            that.$message({
-              showClose: true,
-              message: row.name + '启用成功!',
-              type: 'success'
-            });
-            // table 重载
-            that.getTableQuery();
-          } else {
-            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-          }
-        })
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消启用'
-        });
-      });
-    },
-    // 获取电量
-    getPower(row) {
-      let that = this;
-      let param = {
-        token: localStorage.token,
-        shopId: row.ShopId,
-        hrId: row.HrId,
-      };
-      let postdata = qs.stringify(param);
-      GetHrSensorsPowerPercent(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          console.log(json);
-          that.$message({
-            showClose: true,
-            message: '电量获取成功!',
-            type: 'success'
-          });
-        } else {
-          that.$message.error(json.Memo);
-        }
-      })
-    },
-    getAllPower() {
-      let that = this;
-      that.BtnGetAllPower = true;
-      let param = {
-        token: localStorage.token,
-        shopId: localStorage.ShopId,
-      };
-      let postdata = qs.stringify(param);
-      GetHrSensorsPowerPercent(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          // table 重载
-          that.getTableQuery();
-          that.$message({
-            showClose: true,
-            message: '电量获取成功!',
-            type: 'success'
-          });
-        } else {
-          that.$message.error(json.Memo);
-        }
-        that.BtnGetAllPower = false;
-      })
-    },
-    // 删除
-    pauseRowDel(row) {
-      let that = this;
-      let param = {
-        token: localStorage.token,
-        hrId: row.HrId,
-        status: 9,//1:启用,8:暂停,9:删除
-      };
-      let postdata = qs.stringify(param);
-      this.$confirm('此操作将永久删除该心率设备, 是否继续?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        HrSensorsStatusEdit(postdata).then(res => {
-          let json = res;
-          if (json.Code == 0) {
-            that.$message({
-              showClose: true,
-              message: '选中的心率设备已删除!',
-              type: 'success'
-            });
-            // 重载列表
-            that.getTableQuery();
-          } else {
-            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-          }
-        });
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消删除'
-        });
-      });
-    },
-    // 关闭所有
-    allDialogClose() {
-      this.dialogVisible = false;
-      this.dialogGift = false;
-      this.dialogLesson = false;
-      this.dialogExpTime = false;
-      this.dialogLessonTable = false;
+      this.dialogSensorVisible = true;
+      this.form.btnType = 0;
+      this.dialogTitle = '新增心率设备'
     },
     // 确认提交新增心率设备
-    confirmMember() {
+    confirmAddSensor() {
       let that = this;
-      // checkNum
       if (!that.form.sn) {
         this.$message.error('错了哦,编号不能为空');
         return false
@@ -569,40 +178,62 @@ export default {
         this.$message.error('错了哦,编号不能超过20个字符');
         return false
       }
-      // if (!that.form.venueNo) {
-      //     this.$message.error('错了哦,实体序列号不能为空');
-      //     return false
-      // }
-      // if (that.form.venueNo.length > 30) {
-      //     this.$message.error('错了哦,实体序列号不能超过30个字符');
-      //     return false
-      // }
 
-      let param = {
-        token: localStorage.token,
+      const jsonStr = {
         shopId: localStorage.shopId,
         sn: that.form.sn,
         venueNo: that.form.venueNo,
       };
-      let postdata = qs.stringify(param);
-      AddHrSensors(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          // 关闭弹窗
-          that.dialogMemberVisible = false;
-          // 重载列表
-          that.getTableQuery();
-          that.$message({
-            showClose: true,
-            message: '心率设备添加成功!',
-            type: 'success'
-          });
+
+      let paraRequest = new StandardRequest();
+      paraRequest.setShopid(localStorage.shopId);
+      paraRequest.setJsonstr(JSON.stringify(jsonStr));
+      paraRequest.setSign(getSignStr(jsonStr));
+      console.log(paraRequest);
+      that.client.addHrSensors(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+        if (err == null) {
+          console.log(StandardReply.getJsonrst());
+          let res = JSON.parse(StandardReply);
+          if (res.code === 0) {
+            // 关闭弹窗
+            that.dialogSensorVisible = false;
+            // 重载列表
+            that.getTableQuery();
+            that.$message({
+              showClose: true,
+              message: '心率设备添加成功!',
+              type: 'success'
+            });
+          } else {
+            that.$message.error(res.memo + ',错误代码:' + res.code);
+          }
         } else {
-          that.$message.error(json.Memo + ' 错误码:' + json.Code);
+          let res = err;
+          that.$message.error(res.message + ',错误代码:' + res.code);
+          console.log(res);
         }
-      })
+      });
+    },
+    // 编辑
+    editHrSensor() {
+      let that = this;
+      this.clearForm();
+      if (this.tableRadio == null || this.tableRadio.length == 0) {
+        this.$message.error("请先选中一条记录");
+        return false
+      }
+      let row = this.tableRadio;
+      this.form.shopid = row.shop_id;
+      this.form.hrId = row.uu_hr_id;
+      this.form.sn = row.sn;
+      this.form.venueNo = row.venue_no;
+      this.dialogVisible = true;
+      this.dialogTitle = '编辑心率设备';
+      this.form.btnType = 1;
+      this.dialogSensorVisible = true
     },
-    confirmEditMember() {
+    //确认编辑心率设备
+    confirmEditSensor() {
       let that = this;
       // checkNum
       if (!that.form.sn) {
@@ -613,108 +244,78 @@ export default {
         this.$message.error('错了哦,编号不能超过20个字符');
         return false
       }
-      // if (!that.form.venueNo) {
-      //     this.$message.error('错了哦,实体序列号不能为空');
-      //     return false
-      // }
-      // if (that.form.venueNo.length > 30) {
-      //     this.$message.error('错了哦,实体序列号不能超过30个字符');
-      //     return false
-      // }
-
-      let param = {
-        token: localStorage.token,
+      const jsonStr = {
         shopId: localStorage.shopId,
-        hrId: that.form.hrId,
         sn: that.form.sn,
-        venueNo: that.form.venueNo,
+        UUhrId: that.form.hrId,
+        venueNo: that.form.venueNo
       };
-      let postdata = qs.stringify(param);
-      EditHrSensors(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          // 关闭弹窗
-          that.dialogMemberVisible = false;
-          // 重载列表
-          that.getTableQuery();
-          that.$message({
-            showClose: true,
-            message: '心率设备信息编辑成功!',
-            type: 'success'
-          });
-        } else {
-          that.$message.error(json.Memo + ' 错误码:' + json.Code);
-        }
-      })
-    },
-    // 确认提交课时
-    confirmLesson() {
-      let that = this;
-      // checkNum
 
-      let param = {
-        token: localStorage.token,
-        userCode: that.form.userCode,
-        lesson: that.form.lesson,
-      };
-      let postdata = qs.stringify(param);
-      testSelect(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          // 关闭弹窗
-          that.dialogVisible = false;
-          // 重载列表
-          that.getTableQuery();
-          that.$message({
-            showClose: true,
-            message: '课时调整成功!',
-            type: 'success'
-          });
+      let paraRequest = new StandardRequest();
+      paraRequest.setShopid(localStorage.shopId);
+      paraRequest.setJsonstr(JSON.stringify(jsonStr));
+      paraRequest.setSign(getSignStr(jsonStr));
+      console.log(paraRequest);
+      that.client.editHrSensors(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+        if (err == null) {
+          console.log(StandardReply.getJsonrst());
+          let res = JSON.parse(StandardReply);
+          if (res.code === 0) {
+            // 关闭弹窗
+            that.dialogSensorVisible = false;
+            // 重载列表
+            that.getTableQuery();
+            that.$message({
+              showClose: true,
+              message: '心率设备信息编辑成功!',
+              type: 'success'
+            });
+          } else {
+            that.$message.error(res.memo + ',错误代码:' + res.code);
+          }
         } else {
-          that.$message.error(json.Memo + ' 错误码:' + json.Code);
+          let res = err;
+          that.$message.error(res.message + ',错误代码:' + res.code);
+          console.log(res);
         }
-      })
-    },
-    // 新增心率设备
-    addMember() {
-      this.clearForm();
-      this.dialogMemberVisible = true;
-      this.form.btnType = 0;
-      this.dialogTitle = '新增心率设备'
+      });
     },
-    // 删除
-    delList() {
+    // 删除心率带
+    pauseRowDel(row) {
       let that = this;
-      if (this.tableRadio.length == 0) {
-        this.$message.error("请先选中一条记录");
-        return false
-      }
-      let hrId = this.tableRadio.HrId;
-
-      let param = {
-        token: localStorage.token,
-        hrId: hrId,
-        status: 9,//1:启用,8:暂停,9:删除
-      };
-      let postdata = qs.stringify(param);
-
       this.$confirm('此操作将永久删除该心率设备, 是否继续?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        HrSensorsStatusEdit(postdata).then(res => {
-          let json = res;
-          if (json.Code == 0) {
-            that.$message({
-              showClose: true,
-              message: '选中的心率设备已删除!',
-              type: 'success'
-            });
-            // 重载列表
-            that.getTableQuery();
+        const jsonStr = {
+          shopId: localStorage.shopId,
+          UUHrID: row.HrId
+        };
+        let paraRequest = new StandardRequest();
+        paraRequest.setShopid(localStorage.shopId);
+        paraRequest.setJsonstr(JSON.stringify(jsonStr));
+        paraRequest.setSign(getSignStr(jsonStr));
+        console.log(paraRequest);
+        that.client.hrSensorsDel(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+          if (err == null) {
+            console.log(StandardReply.getJsonrst());
+            let res = JSON.parse(StandardReply);
+            if (res.code === 0) {
+              that.$message({
+                showClose: true,
+                message: '选中的心率设备已删除!',
+                type: 'success'
+              });
+              // 重载列表
+              that.getTableQuery();
+            } else {
+              that.$message.error(res.memo + ',错误代码:' + res.code);
+            }
           } else {
-            that.$message.error(json.Memo + ' 错误码:' + json.Code);
+            let res = err;
+            that.$message.error(res.message + ',错误代码:' + res.code);
+            console.log(res);
           }
         });
       }).catch(() => {
@@ -724,9 +325,9 @@ export default {
         });
       });
     },
-
-    handleSelectionChange(val) {
-      this.multipleSelection = val;
+    // 关闭所有
+    allDialogClose() {
+      this.dialogVisible = false;
     },
     // 查询按钮
     query() {
@@ -741,7 +342,6 @@ export default {
       this.form.name = '';
       this.form.sn = '';
       this.form.venueNo = '';
-      this.form.phone = '';
       this.form.userCode = '';
       this.form.shopId = '';
     },
@@ -752,11 +352,10 @@ export default {
 
       const jsonStr = {
         shopId: localStorage.shopId,
-        snOrNO: this.panel.str,
+        snOrNO: that.panel.str,
         start: that.start,
-        tableMax: that.pageination.pageItem
+        tableMax: that.pagination.pageItem
       };
-
       let paraRequest = new StandardRequest();
       paraRequest.setShopid(localStorage.shopId);
       paraRequest.setJsonstr(JSON.stringify(jsonStr));
@@ -769,8 +368,8 @@ export default {
           that.loading = false;
           if (res.code === 0) {
             if (res.rs) {
-              that.allTableData = json.Rs;
-              that.recordsTotal = json.Rs.length;
+              that.allTableData = res.rs;
+              that.recordsTotal = res.pagecount * that.pagination.pageItem;
             } else {
               that.allTableData = [];
               that.recordsTotal = 0;
@@ -791,32 +390,32 @@ export default {
     setPagination() {
       // 分页属性
       let that = this;
-      that.pageination.total = that.recordsTotal;
+      that.pagination.total = that.recordsTotal;
 
       // 默认分页
       that.tableData = that.allTableData.filter((item, index) => {
-        return index < that.pageination.pageItem;
+        return index < that.pagination.pageItem;
       });
     },
     // 每页显示数量
     handleSizeChange() {
       let that = this;
       that.tableData = that.allTableData.filter((item, index) => {
-        return index < that.pageination.pageItem;
+        return index < that.pagination.pageItem;
       });
-      that.draw = that.pageination.pageItem;
+      that.draw = that.pagination.pageItem;
       // that.getTableQuery();
     },
     // 翻页
     pageChange(pageIndex) {
       let that = this;
       // 获取当前页
-      let index = that.pageination.pageItem * (pageIndex - 1);
+      let index = that.pagination.pageItem * (pageIndex - 1);
       // 数据总数
-      let nums = that.pageination.pageItem * pageIndex;
+      let nums = that.pagination.pageItem * pageIndex;
       // 容器
       let tables = [];
-      for (var i = index; i < nums; i++) {
+      for (let i = index; i < nums; i++) {
         if (that.allTableData[i]) {
           tables.push(that.allTableData[i])
         }
@@ -829,13 +428,13 @@ export default {
     sortChange(params) {
       console.log(params)
     },
-    //            过滤时间
+    // 过滤时间
     filterFmtDate(value, row, column) {
       let that = this;
       if (column == 0) {
         return '未获得'
       } else {
-        return nonTfmtDatetoLength(new Date(column * 1000), 16);
+        return nonTfmtDatetoLength(column, 16);
       }
     },
   },

+ 0 - 665
src/views/HrSensor/HrSensorLog.vue

@@ -1,665 +0,0 @@
-<template>
-    <div class="context">
-        <el-page-header @back="goBack" content="所属设备"></el-page-header>
-        <div class="panel">
-            <br>
-            <h5> {{regionName}}</h5>
-        </div>
-        <div class="change">
-            <el-button @click="addMember" type="primary" size="mini">新增区域设备</el-button>
-            <el-button @click="editList" size="mini">编辑区域设备</el-button>
-            <!--<el-button @click="delList" type="danger">删除区域设备</el-button>-->
-        </div>
-        <div class="table">
-            <el-table
-                    :data="tableData"
-                    border
-                    is-horizontal-resize
-                    :default-sort="{prop: 'date', order: 'descending'}"
-                    element-loading-background="rgba(0, 0, 0, 0.8)"
-                    class=""
-                    @selection-change="handleSelectionChange" @current-change="clickChange"
-
-            >
-                <el-table-column label="选择" width="55">
-                    <template slot-scope="scope">
-                        <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
-                    </template>
-                </el-table-column>
-                <el-table-column
-                        type="index"
-                        label="序号"
-                        align="center"
-                        width="50">
-                </el-table-column>
-                <el-table-column
-                        prop="EqSn"
-                        label="序列号"
-                >
-                </el-table-column>
-                <el-table-column
-                        prop="Version"
-                        label="版本"
-                        sortable
-                >
-                </el-table-column>
-                <el-table-column
-                        prop="EquipType"
-                        label="类型"
-                        sortable
-                >
-                    <template slot-scope="scope">
-                        <span v-if="scope.row.EquipType == 1">TVBox</span>
-                        <span v-if="scope.row.EquipType == 2">BLEHub</span>
-                        <span v-if="scope.row.EquipType == 3">演示设备</span>
-                    </template>
-                </el-table-column>
-                <el-table-column
-                        prop="Status"
-                        label="状态"
-                        sortable
-                >
-                    <!--1:启用  8:暂停  9:删除-->
-                    <template slot-scope="scope">
-                        <span v-if="scope.row.Status == 1" style="color: yellowgreen">启用</span>
-                        <span v-if="scope.row.Status == 8" style="color: yellow">暂停</span>
-                        <span v-if="scope.row.Status == 9" style="color: red">删除</span>
-                    </template>
-                </el-table-column>
-                <el-table-column
-                        prop="address"
-                        label="操作">
-                    <template slot-scope="scope">
-                        <!--<el-button type="success" @click="run(scope.row)" v-if="scope.row.Status == 8">开启</el-button>-->
-                        <!--<el-button type="danger" @click="pause(scope.row)" v-if="scope.row.Status == 1">暂停</el-button>-->
-                      <span v-if="scope.row.EquipType != 3" style="color: red">
-                        <el-button type="danger"  size="mini"
-                                   @click="pauseRowDel(scope.row)">
-                            删除
-                        </el-button>
-                      </span>
-                    </template>
-                </el-table-column>
-            </el-table>
-            <br>
-            <el-pagination
-                    background
-                    :total="pageination.total"
-                    :page-size="pageination.pageItem"
-                    @current-change="pageChange"
-            ></el-pagination>
-        </div>
-        <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="650px">
-            <div class="dialogContent">
-                <div class="">
-                    <el-form ref="form" :model="form" label-width="160px">
-                        <el-form-item label="设备序列号">
-                            <el-input v-model="form.eqSn "></el-input>
-                        </el-form-item>
-                        <el-form-item label="版本号">
-                            <el-input v-model="form.version"></el-input>
-                        </el-form-item>
-                        <el-form-item label="设备类型">
-                            <el-select v-model="form.equipType " placeholder="请选择">
-                                <el-option
-                                        v-for="item in options"
-                                        :key="item.value"
-                                        :label="item.label"
-                                        :value="item.value">
-                                </el-option>
-                            </el-select>
-                        </el-form-item>
-                    </el-form>
-                </div>
-            </div>
-            <div class="dialogFooter">
-                <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmMember">确定</el-button>
-                <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
-                </el-button>
-                <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
-            </div>
-        </el-dialog>
-    </div>
-</template>
-
-<script>
-    import Global from '../../Global.js'
-    import {
-        testTable,
-        ShopManagerStatusEdit,
-        QueryVenueEquip,
-        AddShopVenueEquip,
-        EditShopVenueEquip,
-        ShopVenueEquipEditStatus
-    } from "../../api/getApiRes";
-
-    let qs = require('qs');
-    export default {
-        data() {
-            return {
-                regionName: '',
-                dialogVisible: false,
-                dialogMemberVisible: false,
-                dialogTitle: '新增区域设备',
-                // panel 配置项目
-                multipleSelection: [],
-                tableRadio: [],
-                pageination: {
-                    pageItem: 10,
-                    pageoptions: pageOptions(),
-                    total: 100,
-                    pageIndex: 1,
-                },
-                form: {
-                    eqId: '',
-                    eqSn: '',
-                    name: '',
-                    version: '',
-                    userCode: '',
-                    shopId: '',
-                    btnType: 0,
-                    equipType: 1,
-                },
-                options: [
-                    {value: 1, label: 'TVBox'},
-                    {value: 2, label: 'BLEHub'},
-                    {value: 3, label: '演示设备'},
-                ],
-                shops: [],
-                tableData: [],
-                serachBtnStatus: false,
-            }
-        },
-        mounted() {
-            this.regionName = this.$route.query.name;
-            this.getTableQuery();
-        },
-        methods: {
-            goBack() {
-                this.$router.push({
-                    path: '/region', query: {}
-                });
-            },
-            // 删除
-            pauseRowDel(row) {
-                let that = this;
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                    svId: row.SvId,
-                    eqId: row.EqId,
-                    status: 9,//1:启用 8:暂停 9:删除
-                };
-                let postdata = qs.stringify(param);
-                this.$confirm('此操作将永久删除该区域设备, 是否继续?', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    ShopVenueEquipEditStatus(postdata).then(res => {
-                        let json = res;
-                        if (json.Code == 0) {
-                            that.$message({
-                                showClose: true,
-                                message: '选中的区域设备已删除!',
-                                type: 'success'
-                            });
-                            // 重载列表
-                            that.getTableQuery();
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    });
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消删除'
-                    });
-                });
-            },
-            clearForm() {
-                // clear
-                this.form.name = '';
-                this.form.userCode = '';
-                this.form.shopId = '';
-                this.form.eqSn = '';
-                this.form.version = '';
-                this.form.equipType = 1;
-            },
-            handleSelectionChange(val) {
-                this.multipleSelection = val;
-            },
-            // 新增区域设备
-            addMember() {
-                this.clearForm();
-                this.dialogMemberVisible = true;
-                this.btnType = 0;
-                this.dialogTitle = '新增区域设备'
-            },
-            clickChange(item) {
-                this.tableRadio = item
-            },
-            // 删除
-            delList() {
-                let that = this;
-                if (this.tableRadio.length == 0) {
-                    this.$message.error("请先选中一条记录");
-                    return false
-                }
-                let userId = this.tableRadio.Id;
-
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                    svId: this.$route.query.svId,
-                    eqId: this.tableRadio.EqId,
-                    status: 9,//1:启用 8:暂停 9:删除
-                };
-                let postdata = qs.stringify(param);
-
-                this.$confirm('此操作将永久删除该区域设备, 是否继续?', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    ShopVenueEquipEditStatus(postdata).then(res => {
-                        let json = res;
-                        if (json.Code == 0) {
-                            that.$message({
-                                showClose: true,
-                                message: '选中的区域设备已删除!',
-                                type: 'success'
-                            });
-                            // 重载列表
-                            that.getTableQuery();
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    });
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消删除'
-                    });
-                });
-            },
-            // 编辑
-            editList() {
-                let that = this;
-                this.clearForm();
-                if (this.tableRadio.length == 0) {
-                    this.$message.error("请先选中一条记录");
-                    return false
-                }
-                let row = this.tableRadio;
-                this.form.shopid = row.ShopId;
-                this.form.userId = row.Id;
-                this.form.name = row.Name;
-                this.form.userCode = row.Usercode;
-                this.form.password = '';
-                this.form.phone = row.Phone;
-                this.form.eqId = row.EqId;
-                this.form.eqSn = row.EqSn.trim();
-                this.form.version = row.Version.trim();
-                this.form.equipType = row.EquipType;
-                this.form.memo = row.Memo;
-                this.form.adminType = row.AdminType;
-                this.dialogVisible = true;
-                this.dialogTitle = '编辑区域设备';
-                this.form.btnType = 1;
-                this.dialogMemberVisible = true
-            },
-            // 确认提交新增区域设备
-            confirmMember() {
-                let that = this;
-                // checkNum
-                if (!that.form.eqSn) {
-                    this.$message.error('错了哦,设备序列号不能为空');
-                    return false
-                }
-                if (that.form.version.length > 10) {
-                    this.$message.error('错了哦,版本号字符不能超过10位');
-                    return false
-                }
-
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                    svId: this.$route.query.svId,
-                    eqSn: this.form.eqSn,
-                    version: this.form.version,
-                    equipType: this.form.equipType,
-                };
-                let postdata = qs.stringify(param);
-                AddShopVenueEquip(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        // 关闭弹窗
-                        that.dialogMemberVisible = false;
-                        // 重载列表
-                        that.getTableQuery();
-                        that.$message({
-                            showClose: true,
-                            message: '所属设备添加成功!',
-                            type: 'success'
-                        });
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            confirmEditMember() {
-                let that = this;
-                console.log(that.form.version.length);
-                // checkNum
-                if (!that.form.eqSn) {
-                    this.$message.error('错了哦,设备序列号不能为空');
-                    return false
-                }
-                if (that.form.version.length > 10) {
-                    this.$message.error('错了哦,版本号字符不能超过10位');
-                    return false
-                }
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                    svId: this.$route.query.svId,
-                    eqId: this.form.eqId,
-                    eqSn: this.form.eqSn,
-                    version: this.form.version,
-                    equipType: this.form.equipType,
-                };
-                let postdata = qs.stringify(param);
-                EditShopVenueEquip(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        // 关闭弹窗
-                        that.dialogMemberVisible = false;
-                        // 重载列表
-                        that.getTableQuery();
-                        that.$message({
-                            showClose: true,
-                            message: '区域设备信息编辑成功!',
-                            type: 'success'
-                        });
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            // 查询按钮
-            query() {
-                // 按钮倒计时
-                let that = this;
-                that.serachBtnStatus = true;
-                let totalTime = 2;
-                let clock = window.setInterval(() => {
-                    totalTime--;
-                    if (totalTime < 0) {
-                        totalTime = 2;
-                        that.serachBtnStatus = false;
-                    }
-                }, 1000);
-
-                this.getTableQuery();
-                this.$message.success('查询完毕');
-            },
-            // 页面数据查询
-            getTableQuery() {
-                let that = this;
-                that.loading = true;
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                    svId: this.$route.query.svId,
-                    eqType:1//设备类型 1 电视盒子 2 演示对应中间件 3 演示客户端
-                };
-                let postdata = qs.stringify(param);
-                QueryVenueEquip(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        that.loading = false;
-                        if (json.Rs) {
-                            that.allTableData = json.Rs;
-                            that.recordsTotal = json.Rs.length;
-                        } else {
-                            that.allTableData = [];
-                            that.recordsTotal = 0;
-                        }
-                        // 设置分页数据
-                        that.setPagination();
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            // 设置分页数据
-            setPagination() {
-                // 分页属性
-                let that = this;
-                that.pageination.total = that.recordsTotal;
-                // 默认分页
-                that.tableData = that.allTableData.filter((item, index) => {
-                    return index < that.pageination.pageItem;
-                });
-            },
-            // 每页显示数量
-            handleSizeChange() {
-                let that = this;
-                that.tableData = that.allTableData.filter((item, index) => {
-                    return index < that.pageination.pageItem;
-                });
-                that.draw = that.pageination.pageItem;
-                that.getTableQuery();
-            },
-            // 翻页
-            pageChange(pageIndex) {
-                let that = this;
-                // 获取当前页
-                let index = that.pageination.pageItem * (pageIndex - 1);
-                // 数据总数
-                let nums = that.pageination.pageItem * pageIndex;
-                // 容器
-                let tables = [];
-                for (var i = index; i < nums; i++) {
-                    if (that.allTableData[i]) {
-                        tables.push(that.allTableData[i])
-                    }
-                    this.tableData = tables;
-                }
-                that.start = index * that.draw;
-                // that.getTableQuery();
-            },
-            // 自动排序
-            sortChange(params) {
-                console.log(params)
-            },
-            // 过滤时间
-            filterFmtDate(value, row, column) {
-                let that = this;
-                return nonTfmtDate(column, 11);
-            },
-            // 暂停
-            pause(row) {
-                let that = this;
-                console.log(row);
-                this.$confirm('是否暂停设备' + row.EqSn + '?', '暂停操作', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-
-                    let param = {
-                        key: localStorage.ServiceKey,
-                        shopId: localStorage.ServiceId,
-                        svId: this.$route.query.svId,
-                        eqId: row.EqId,
-                        status: 8,//1:启用 8:暂停 9:删除
-                    };
-
-                    let postdata = qs.stringify(param);
-                    ShopVenueEquipEditStatus(postdata).then(res => {
-                        let json = res;
-                        if (json.Code == 0) {
-                            that.$message({
-                                showClose: true,
-                                message: row.EqSn + '暂停成功!',
-                                type: 'success'
-                            });
-                            // table 重载
-                            that.getTableQuery();
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    })
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消暂停'
-                    });
-                });
-            },
-            // 开启
-            run(row) {
-                let that = this;
-                this.$confirm('是否开启设备' + row.EqSn + '?', '开启操作', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-
-                    let param = {
-                        key: localStorage.ServiceKey,
-                        shopId: localStorage.ServiceId,
-                        svId: this.$route.query.svId,
-                        eqId: row.EqId,
-                        status: 1,//1:启用 8:暂停 9:删除
-                    };
-
-                    let postdata = qs.stringify(param);
-                    ShopVenueEquipEditStatus(postdata).then(res => {
-                        let json = res;
-                        if (json.Code == 0) {
-                            that.$message({
-                                showClose: true,
-                                message: row.EqSn + '开启成功!',
-                                type: 'success'
-                            });
-                            // table 重载
-                            that.getTableQuery();
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    })
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消开启'
-                    });
-                });
-            },
-        },
-        watch: {
-            $route(to) {
-                if (to.name == 'hrSensorLog') {
-                    this.regionName = this.$route.query.name;
-                    this.getTableQuery();
-                }
-            },
-        },
-    }
-</script>
-
-<style scoped>
-    @import "../../assets/css/panel.css";
-
-    .context {
-        /* height: 770px; */
-        overflow-y: scroll;
-
-        display: block;
-        margin: 0 auto;
-        background-color: #fff !important;
-        padding: 30px;
-        padding-bottom: 60px;
-    }
-
-    .panel-body {
-        padding: 20px;
-        background: #F0F2F5;
-    }
-
-    .change {
-        width: 100%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-        padding-top: 10px;
-        padding-bottom: 10px;
-    }
-
-    .change button {
-        float: left;
-    }
-
-    .change button.pull-right {
-        float: right;
-    }
-
-    .dialogTitle {
-        width: 100%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-        color: #000000;
-        font-size: 18px;
-        text-align: center;
-    }
-
-    .dialogTitle em {
-        float: none;
-        font-style: normal;
-        color: #3799FF;
-        margin: 0;
-    }
-
-    /deep/ .el-transfer-panel__item .el-checkbox__input {
-        left: 40px;
-    }
-
-    .dialogFooter {
-        width: 90%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-        margin-top: 10px;
-    }
-
-    .dialogFooter button {
-        float: right;
-        margin-left: 10px;
-    }
-
-    /deep/ .el-date-editor .el-range__icon {
-        line-height: 22px;
-    }
-
-    .panel /deep/ .el-date-editor .el-range-separator {
-        line-height: 22px;
-    }
-
-    /deep/ .el-select {
-        width: 100%;
-    }
-    .panel h5 {
-        font-size: 24px;
-    }
-
-    /*ipad only*/
-    @media only screen and (max-width: 1366px) {
-        .panel /deep/ .el-date-editor--daterange {
-            width: 100%;
-        }
-    }
-
-</style>

+ 581 - 938
src/views/HrSensor/HrSensorPrivate.vue

@@ -1,952 +1,595 @@
 <template>
-    <div class="context">
-        <div class="panel">
-            <h5>心率设备</h5>
-            <div class="likeTab">
-                <el-button type="" @click="goType('heartEquip')" size="mini">场馆心率设备</el-button>
-                <el-button type="primary" @click="goType('hrSensorPrivate')" size="mini">私有心率设备</el-button>
-            </div>
-            <div class="panel-body">
-                <div class="panel_control">
-                    <el-row :gutter="20">
-                        <el-col :span="5">
-                            <em>心率设备:</em>
-                            <el-input v-model="panel.str" placeholder="请输入编号" type="number"></el-input>
-                        </el-col>
-                        <!--<el-col :span="5">-->
-                        <!--<em>设备状态:</em>-->
-                        <!--&lt;!&ndash;status&ndash;&gt;-->
-                        <!--<el-select v-model="panel.status" placeholder="请选择">-->
-                        <!--<el-option-->
-                        <!--v-for="item in panel.statusOptions"-->
-                        <!--:key="item.value"-->
-                        <!--:label="item.label"-->
-                        <!--:value="item.value">-->
-                        <!--</el-option>-->
-                        <!--</el-select>-->
-                        <!--</el-col>-->
-                        <el-col :span="2">
-                            <el-button size="" type="primary" @click="query" plain>查询</el-button>
-                        </el-col>
-                    </el-row>
-                </div>
-            </div>
+  <div class="context">
+    <div class="panel">
+      <h5>私有心率设备</h5>
+      <div class="likeTab">
+        <el-button type @click="goType('hrSensor')" size="mini">场馆心率设备</el-button>
+        <el-button type="primary" @click="goType('hrSensorPrivate')" size="mini">私有心率设备</el-button>
+      </div>
+      <div class="panel-body">
+        <div class="panel_control">
+          <el-row :gutter="2">
+            <el-col :span="5">
+              <em style="line-height: 40px; margin-right: 10px">心率设备:</em>
+              <el-input v-model="panel.str" placeholder="请输入编号" type="number" style="width: 120px"/>
+            </el-col>
+
+            <el-col :span="2">
+              <el-button size type="primary" @click="query" plain>查询</el-button>
+            </el-col>
+          </el-row>
         </div>
-        <div class="change">
-            <el-button @click="addMember" type="primary" size="mini">新增心率设备</el-button>
-            <el-button @click="editList" size="mini">编辑心率设备</el-button>
-            <el-button type="success" @click="getAllPower" :loading="BtnGetAllPower" size="mini">全部设备电量</el-button>
-            <!--<el-button @click="delList" type="danger">删除心率设备</el-button>-->
-        </div>
-        <div class="table">
-            <el-table :data="tableData" border is-horizontal-resize :default-sort="{prop: 'date', order: 'descending'}"
-                element-loading-background="rgba(0, 0, 0, 0.8)" class="" @selection-change="handleSelectionChange"
-                @current-change="clickChange">
-                >
-                <el-table-column label="选择" width="55">
-                    <template slot-scope="scope">
-                        <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
-                    </template>
-                </el-table-column>
-                <!--<el-table-column-->
-                <!--type="index"-->
-                <!--label="序号"-->
-                <!--align="center"-->
-
-                <!--width="50">-->
-                <!--</el-table-column>-->
-                <el-table-column prop="Sn" label="序列号" align="InVenueNo" width="100px" sortable>
-                </el-table-column>
-                <el-table-column prop="UserName" label="用户" align="center" sortable>
-
-                    <template slot-scope="scope">
-                        {{scope.row.UserName}}
-                        <!--<el-select v-model="scope.row.BindUserId" @change="getRowTop(scope.row)" filterable v-if="scope.row.BindUserId">-->
-                        <!--<el-option-->
-                        <!--v-for="item in panel.options"-->
-                        <!--:key="item.value"-->
-                        <!--:label="item.label"-->
-                        <!--:value="item.value">-->
-                        <!--</el-option>-->
-                        <!--</el-select>-->
-
-                        <!--<el-button @click="takeBack(scope.row)" type="danger" v-if="!scope.row.BindUserId">{{scope.row.UserName}} 设备收回</el-button>-->
-                    </template>
-                </el-table-column>
-                <el-table-column prop="PowerPercent" label="电量" align="center" width="80px" sortable>
-                    <template slot-scope="scope">
-                        <span style="color: red"
-                            v-if="parseInt(scope.row.PowerPercent) <= 20">{{scope.row.PowerPercent}}</span>
-                        <span style="color: gold"
-                            v-if="parseInt(scope.row.PowerPercent) > 20 && parseInt(scope.row.PowerPercent) < 80">{{scope.row.PowerPercent}}</span>
-                        <span style="color: #67C23A"
-                            v-if="parseInt(scope.row.PowerPercent) >= 80">{{scope.row.PowerPercent}}</span>
-                    </template>
-                </el-table-column>
-                <el-table-column prop="PowerUpdateAt" label="电量更新时间" align="center" width="140px"
-                    :formatter="filterFmtDate">
-                </el-table-column>
-                <!--<el-table-column-->
-                <!--prop="Status"-->
-                <!--label="状态"-->
-                <!--align="center"-->
-                <!--width="90"-->
-                <!--&gt;-->
-                <!--<template slot-scope="scope">-->
-                <!--&lt;!&ndash;1:启用  8:暂停  9:删除&ndash;&gt;-->
-                <!--<span v-if="scope.row.Status == 1" style="color: #67c23a">已启用</span>-->
-                <!--<span v-if="scope.row.Status == 8" style="color: #E6A23C">已暂停</span>-->
-                <!--<span v-if="scope.row.Status == 9" style="color: red">已删除</span>-->
-                <!--</template>-->
-                <!--</el-table-column>-->
-                <el-table-column prop="id" label="操作">
-                    <template slot-scope="scope">
-                        <!--<el-button type="success" v-if="scope.row.Status == 8" size="mini"-->
-                        <!--@click="pauseRow(scope.row,1)">-->
-                        <!--启用-->
-                        <!--</el-button>-->
-                        <!--<el-button type="warning" v-if="scope.row.Status == 1" size="mini"-->
-                        <!--@click="pauseRow(scope.row,8)">-->
-                        <!--暂停-->
-                        <!--</el-button>-->
-                        <el-button type="danger" size="mini" @click="pauseRowDel(scope.row)">
-                            删除
-                        </el-button>
-                        <el-button type="primary" size="mini" @click="goPage(scope.row)">记录</el-button>
-                        <el-button type="success" size="mini" @click="getPower(scope.row)">获取电量</el-button>
-                    </template>
-                </el-table-column>
-            </el-table>
-            <br>
-            <el-pagination background :total="pageination.total" :page-size="pageination.pageItem"
-                @current-change="pageChange" :current-page.sync="cur_page"></el-pagination>
-        </div>
-        <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="650px">
-            <div class="dialogContent">
-                <div class="">
-                    <el-form ref="form" :model="form" label-width="160px">
-                        <el-form-item label="会员账号" :required="true">
-                            <!--userId-->
-                            <el-select v-model="form.userId" placeholder="请选择" :disabled="form.btnType == 1" filterable>
-                                <el-option v-for="item in form.userList" :key="item.value" :label="item.label"
-                                    :value="item.value">
-                                </el-option>
-                            </el-select>
-                        </el-form-item>
-                        <el-form-item label="序列号" :required="true">
-                            <el-input v-model="form.sn"></el-input>
-                        </el-form-item>
-                    </el-form>
-                </div>
-            </div>
-            <div class="dialogFooter">
-                <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmMember">确定</el-button>
-                <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
-                </el-button>
-                <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
-            </div>
-        </el-dialog>
+      </div>
+    </div>
+    <div class="change">
+      <el-button @click="addHrSensor" type="primary" size="mini">新增心率设备</el-button>
+      <el-button @click="editHrSensor" size="mini">编辑心率设备</el-button>
+    </div>
+    <div class="table">
+      <el-table :data="tableData" border is-horizontal-resize
+                :default-sort="{ prop: 'date', order: 'descending' }" element-loading-background="rgba(0, 0, 0, 0.8)"
+                class @selection-change="handleSelectionChange" @current-change="clickChange">
+        <el-table-column label="选择" width="55">
+          <template slot-scope="scope">
+            <el-radio v-model="tableRadio" :label="scope.row">
+              <i></i>
+            </el-radio>
+          </template>
+        </el-table-column>
+
+        <el-table-column prop="sn" label="序列号" align="InVenueNo" width="100px" sortable></el-table-column>
+        <el-table-column prop="owner_user_name" label="用户" align="center" sortable>
+          <template slot-scope="scope">
+            {{ scope.row.owner_user_name == "" ? "暂未绑定" : scope.row.owner_user_name }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="power_percent" label="电量" align="center" width="80px" sortable>
+          <template slot-scope="scope">
+            <span style="color: red" v-if="parseInt(scope.row.power_percent) <= 20">{{ scope.row.power_percent }}</span>
+            <span style="color: gold"
+                  v-if="parseInt(scope.row.power_percent) > 20 && parseInt(scope.row.power_percent) < 80">{{
+                scope.row.power_percent
+              }}</span>
+            <span style="color: #67C23A" v-if="parseInt(scope.row.power_percent) >= 80">{{
+                scope.row.power_percent
+              }}</span>
+          </template>
+        </el-table-column>
+
+        <el-table-column prop="power_update_at" label="电量更新时间" align="center" width="150" :formatter="filterFmtDate"/>
+
+        <el-table-column prop="id" label="操作">
+          <template slot-scope="scope">
+            <el-button type="danger" size="mini" @click="pauseRowDel(scope.row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <br/>
+      <el-pagination background :total="pagination.total" :page-size="pagination.pageItem"
+                     @current-change="pageChange" :current-page.sync="cur_page"/>
     </div>
+    <el-dialog :title="dialogTitle" :visible.sync="dialogSensorVisible" width="550px" align="center">
+      <div class="dialogContent">
+        <div class>
+          <el-form ref="form" :model="form" >
+            <el-form-item label="会员账号" :required="true" label-width="120px">
+              <!--userId-->
+              <el-select v-model="form.uu_user_id" placeholder="请选择" :disabled="form.btnType == 1" filterable style="width: 350px">
+                <el-option v-for="item in form.userList" :key="item.value" :label="item.label"
+                           :value="item.value">
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="序列号" :required="true" label-width="110px">
+              <el-input v-model="form.sn" style="width: 350px;margin-left: 10px"/>
+            </el-form-item>
+
+          </el-form>
+        </div>
+      </div>
+      <div class="dialogFooter">
+        <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmAddSensor">确定</el-button>
+        <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditSensor">确定</el-button>
+        <el-button size="small" @click="dialogSensorVisible = false">取消</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-    import Global from '../../Global.js'
-    import {
-        testTable,
-        testSelect,
-        ShopManagerStatusEdit,
-        ClassDetailOne,
-        QueryPvtHrSensors,
-        AddPvtHrSensors,
-        HrSensorsStatusEdit,
-        EditHrSensors,
-        UnBindHrSensorsToUser,
-        VipUserSimpleQuery,
-        GetHrSensorsPowerPercent
-    } from "../../api/getApiRes";
-
-    let qs = require('qs');
-    export default {
-        data() {
-            return {
-                activeName: 'comm',
-                dialogVisible: false,//其他dialog
-                BtnGetAllPower: false,//
-                dialogMemberVisible: false,//新增心率设备dialog
-                dialogLesson: false,//课时调整
-                dialogGift: false,//赠送课时调整
-                dialogExpTime: false,//有效期调整
-                dialogLessonTable: false,//心率设备课程
-                dialogTitle: '新增心率设备',
-                dialogValue: [],
-                tableRadio: [],
-                // panel 配置项目
-                panel: {
-                    str: '',
-                    phone: '',
-                    compname: '',
-                    keyword: '',
-                    USERCODE: '',
-                    endType: '',
-                    taskstatus: 99,
-                    status: "",
-                    draw: 1,
-                    start: 0,
-                    recordsTotal: 0,
-                    tableData: [],
-                    allTableData: [],
-                    limit: '10',
-                    multipleSort: false,
-                    loading: false,
-                    fileList: [],
-                    multipleSelection: [],
-                    detectedmac: '',
-                    statusOptions: [
-                        { value: "", label: '全部' },
-                        { value: 1, label: '启用' },
-                        { value: 8, label: '暂停' },
-                        { value: 9, label: '删除' },
-                    ], options: [
-                        { value: 99, label: '全部' },
-                        { value: 1, label: '进行中' },
-                        { value: 2, label: '已完成' },
-                    ],
-                    endTypeOptions: [
-                        { value: 99, label: '全部' },
-                        { value: 30, label: '近一个月' },
-                        { value: 7, label: '近一周' },
-                        { value: 1, label: '当日' },
-                    ],
-                    time1: globalBt(),
-                },
-                multipleSelection: [],
-                pageination: {
-                    pageItem: 10,
-                    pageoptions: pageOptions(),
-                    total: 100,
-                    pageIndex: 1,
-                },
-                form: {
-                    name: '',
-                    userCode: '',
-                    sn: '',
-                    venueNo: '',
-                    shopId: '',
-                    teacherId: 0,
-                    memberType: 1,
-                    lesson: 1,
-                    gift: 1,
-                    btnType: 0,//0新建,1编辑编辑
-                    memo: '',
-                    phone: '',
-                    expTime: '',
-                    userId: '',
-                    userList: [],//穿梭待选
-                    dialogdata: [],//穿梭待选
-                    dialogValue: [],//穿梭已选
-                },
-                memberTypes: [
-                    { value: 1, label: '年心率设备' },
-                    { value: 2, label: '充值心率设备' },
-                ],
-                tableData: []
+import Global from '../../Global.js'
+import {
+  StandardRequest
+} from "@/grpc/base_pb";
+
+let qs = require('qs');
+export default {
+  data() {
+    return {
+      activeName: 'comm',
+      dialogVisible: false,//其他dialog
+      BtnGetAllPower: false,//
+      dialogSensorVisible: false,//新增心率设备dialog
+      dialogTitle: '新增心率设备',
+      tableRadio: [],
+      multipleSelection: [],
+      draw: 1,
+      start: 0,
+      recordsTotal: 0,
+      cur_page: 1,
+      // panel 配置项目
+      panel: {
+        str: '',
+        tableData: [],
+        allTableData: [],
+        loading: false
+      },
+      pagination: {
+        pageItem: 10,
+        pageOptions: pageOptions(),
+        total: 100,
+        pageIndex: 1,
+      },
+      form: {
+        sn: '',
+        hrId: '',
+        venueNo: '',
+        shopId: '',
+        userList: [],
+        btnType: 0,//0新建,1编辑编辑
+        memo: '',
+      },
+      tableData: []
+    }
+  },
+  mounted() {
+    this.vipSelect();
+    this.getTableQuery();
+  },
+  methods: {
+    handleClick(tab, event) {
+      let that = this;
+      if (tab.name == "personal") {
+        // 私有
+        that.$router.push({path: '/hrSensorPrivate'});
+      } else {
+        // 公共
+        that.$router.push({path: '/hrSensor'});
+      }
+    },
+    goType(url) {
+      this.$router.push({path: '/' + url});
+    },
+    clickChange(item) {
+      this.tableRadio = item
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    vipSelect() {
+      let that = this;
+
+      const jsonStr = {
+        shopId: localStorage.shopId,
+        classId: -99,//-99代表查询全部
+        isAcross: 0 //0:不跨店 1跨店 -99是全部
+      };
+
+      let paraRequest = new StandardRequest();
+      paraRequest.setShopid(localStorage.shopId);
+      paraRequest.setJsonstr(JSON.stringify(jsonStr));
+      paraRequest.setSign(getSignStr(jsonStr));
+      that.client.vipUserSimpleQuery(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+        if (err == null) {
+          console.log(StandardReply);
+          let res = JSON.parse(StandardReply);
+          if (res.code === 0) {
+            if (res.rs) {
+              that.form.userId = '';
+              that.form.userList = turnResToOptionBySimViper(res.rs);
+            } else {
+              return false;
             }
-        },
-        mounted() {
-            this.vipSelect();
-            this.getTableQuery();
-        },
-        methods: {
-            vipSelect() {
-                let that = this;
-                let param = {
-                    token: localStorage.token,
-                };
-                let postdata = qs.stringify(param);
-                VipUserSimpleQuery(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        that.form.userId = '';
-                        that.form.userList = turnResToOptionBySimViper(json.Rs);
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            handleClick(tab, event) {
-                let that = this;
-
-                if (tab.name == "personal") {
-                    // 私有
-                    that.$router.push({ path: '/hrSensorPrivate' });
-                } else {
-                    // 公共
-                    that.$router.push({ path: '/hrSensor' });
-                }
-            },
-            // 设备回收
-            takeBack(row) {
-                let that = this;
-                this.$confirm('是否回收用户' + row.name + '的心率设备?', '回收操作', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    let param = {
-                        token: localStorage.token,
-                        Id: row.Id,
-                        status: 0,
-                    };
-                    let postdata = qs.stringify(param);
-                    UnBindHrSensorsToUser(postdata).then(res => {
-                        let json = res;
-                        if (json.Code == 0) {
-                            that.$message({
-                                showClose: true,
-                                message: row.name + '回收成功!',
-                                type: 'success'
-                            });
-                            // table 重载
-                            that.getTableQuery();
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    })
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消回收'
-                    });
-                });
-            },
-            goPage(row) {
-                // 查看绑定记录
-                this.$router.push({ path: '/bindRecord', query: { hrId: row.HrId } });
-            },
-            goType(url) {
-                this.$router.push({ path: '/' + url });
-            },
-            // 编辑
-            editList() {
-                let that = this;
-                this.clearForm();
-                console.log(this.tableRadio);
-                if (this.tableRadio.length == 0) {
-                    this.$message.error("请先选中一条记录");
-                    return false
-                }
-                let row = this.tableRadio;
-                this.form.shopid = row.ShopId;
-                this.form.userId = row.UserId;
-                this.form.name = row.Name;
-                this.form.userCode = row.Usercode;
-                this.form.password = '';
-                this.form.hrId = row.HrId;
-                this.form.sn = row.Sn;
-                this.form.venueNo = row.InVenueNo;
-                this.dialogVisible = true;
-                this.dialogTitle = '编辑心率设备';
-                this.form.btnType = 1;
-                this.dialogMemberVisible = true
-            },
-            clickChange(item) {
-                this.tableRadio = item
-            },
-            // 选择课程后,获取当前课程的建议上课人数和课时消耗
-            getRowTop(row) {
-                let that = this;
-                console.log(row);
-                let param = {
-                    token: localStorage.token,
-                    classId: row.ClassId,
-                };
-                let postdata = qs.stringify(param);
-                ClassDetailOne(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        row.TopLimit = json.Rs.TopLimit;
-                        row.ConsumeHour = json.Rs.ConsumeHour;
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            // 获取电量
-            getPower(row) {
-                let that = this;
-                let param = {
-                    token: localStorage.token,
-                    shopId: row.ShopId,
-                    hrId: row.HrId,
-                };
-                let postdata = qs.stringify(param);
-                GetHrSensorsPowerPercent(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        console.log(json);
-                        that.$message({
-                            showClose: true,
-                            message: '电量获取成功!',
-                            type: 'success'
-                        });
-                    } else {
-                        that.$message.error(json.Memo);
-                    }
-                })
-            },
-            getAllPower() {
-                let that = this;
-                that.BtnGetAllPower = true;
-                let param = {
-                    token: localStorage.token,
-                    shopId: localStorage.ShopId,
-                };
-                let postdata = qs.stringify(param);
-                GetHrSensorsPowerPercent(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        // table 重载
-                        that.getTableQuery();
-                        that.$message({
-                            showClose: true,
-                            message: '电量获取成功!',
-                            type: 'success'
-                        });
-                    } else {
-                        that.$message.error(json.Memo);
-                    }
-                    that.BtnGetAllPower = false;
-                })
-            },
-            // 编辑
-            editMember(row) {
-                this.clearForm();
-                this.form.name = row.Name;
-                this.form.phone = row.Phone;
-                this.form.shopId = row.ShopId;
-                this.form.teacherId = row.TeacherId;
-                this.form.btnType = 1;
-                this.dialogMemberVisible = true
-                this.dialogTitle = '编辑心率设备'
-            },
-            // 禁用
-            pauseRow(row, status) {
-                let that = this;
-                let param = {
-                    token: localStorage.token,
-                    hrId: row.HrId,
-                    status: status,//1:启用 8:暂停 9:删除
-                };
-                let postdata = qs.stringify(param);
-                HrSensorsStatusEdit(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        that.$message({
-                            showClose: true,
-                            message: '执行成功!',
-                            type: 'success'
-                        });
-                        // table 重载
-                        that.getTableQuery();
-                        that.vipSelect();
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            // pauseRow(row) {
-            //     let that = this;
-            //     this.$confirm('是否禁用心率设备' + row.Sn + '?', '禁用操作', {
-            //         confirmButtonText: '确定',
-            //         cancelButtonText: '取消',
-            //         type: 'warning'
-            //     }).then(() => {
-            //         let param = {
-            //             token: localStorage.token,
-            //             shopId : localStorage.token,
-            //             status: 8,
-            //         };
-            //         let postdata = qs.stringify(param);
-            //         ShopVenueEquipEditStatus(postdata).then(res => {
-            //             let json = res;
-            //             if (json.Code == 0) {
-            //                 that.$message({
-            //                     showClose: true,
-            //                     message: row.name + '禁用成功!',
-            //                     type: 'success'
-            //                 });
-            //                 // table 重载
-            //                 that.getTableQuery();
-            //             } else {
-            //                 that.$message.error(json.Memo + ' 错误码:' + json.Code);
-            //             }
-            //         })
-            //     }).catch(() => {
-            //         this.$message({
-            //             type: 'info',
-            //             message: '已取消禁用'
-            //         });
-            //     });
-            // },
-            // 启用
-            runRow(row) {
-                let that = this;
-                this.$confirm('是否启用心率设备' + row.Sn + '?', '启用操作', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    let param = {
-                        token: localStorage.token,
-                        Id: row.Id,
-                        status: 1,
-                    };
-                    let postdata = qs.stringify(param);
-                    testTable(postdata).then(res => {
-                        let json = res;
-                        if (json.Code == 0) {
-                            that.$message({
-                                showClose: true,
-                                message: row.name + '启用成功!',
-                                type: 'success'
-                            });
-                            // table 重载
-                            that.getTableQuery();
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    })
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消启用'
-                    });
-                });
-            },
-            // 删除
-            pauseRowDel(row) {
-                let that = this;
-
-                let param = {
-                    token: localStorage.token,
-                    hrId: row.HrId,
-                    status: 9,//1:启用,8:暂停,9:删除
-                };
-                let postdata = qs.stringify(param);
-                this.$confirm('此操作将永久删除该心率设备, 是否继续?', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    HrSensorsStatusEdit(postdata).then(res => {
-                        let json = res;
-                        if (json.Code == 0) {
-                            that.$message({
-                                showClose: true,
-                                message: '选中的心率设备已删除!',
-                                type: 'success'
-                            });
-                            // 重载列表
-                            that.getTableQuery();
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    });
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消删除'
-                    });
-                });
-            },
-            // 关闭所有
-            allDialogClose() {
-                this.dialogVisible = false;
-                this.dialogGift = false;
-                this.dialogLesson = false;
-                this.dialogExpTime = false;
-                this.dialogLessonTable = false;
-            },
-            // 确认提交新增心率设备
-            confirmMember() {
-                let that = this;
-                // checkNum
-                if (!that.form.sn) {
-                    this.$message.error('错了哦,编号不能为空');
-                    return false
-                }
-                if (that.form.sn.length > 20) {
-                    this.$message.error('错了哦,编号不能超过20个字符');
-                    return false
-                }
-                let param = {
-                    token: localStorage.token,
-                    shopId: localStorage.shopId,
-                    sn: that.form.sn,
-                    userId: that.form.userId,
-                };
-                let postdata = qs.stringify(param);
-                AddPvtHrSensors(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        // 关闭弹窗
-                        that.dialogMemberVisible = false;
-                        // 重载列表
-                        that.getTableQuery();
-                        that.$message({
-                            showClose: true,
-                            message: '心率设备添加成功!',
-                            type: 'success'
-                        });
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            confirmEditMember() {
-                let that = this;
-                // checkNum
-                if (!that.form.sn) {
-                    this.$message.error('错了哦,编号不能为空');
-                    return false
-                }
-                if (that.form.sn.length > 20) {
-                    this.$message.error('错了哦,编号不能超过20个字符');
-                    return false
-                }
-
-                let param = {
-                    token: localStorage.token,
-                    shopId: localStorage.shopId,
-                    hrId: that.form.hrId,
-                    sn: that.form.sn,
-                    venueNo: 0,
-                };
-                let postdata = qs.stringify(param);
-                EditHrSensors(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        // 关闭弹窗
-                        that.dialogMemberVisible = false;
-                        // 重载列表
-                        that.getTableQuery();
-                        that.$message({
-                            showClose: true,
-                            message: '心率设备信息编辑成功!',
-                            type: 'success'
-                        });
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            // 确认提交课时
-            confirmLesson() {
-                let that = this;
-                // checkNum
-
-                let param = {
-                    token: localStorage.token,
-                    userCode: that.form.userCode,
-                    lesson: that.form.lesson,
-                };
-                let postdata = qs.stringify(param);
-                testSelect(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        // 关闭弹窗
-                        that.dialogVisible = false;
-                        // 重载列表
-                        that.getTableQuery();
-                        that.$message({
-                            showClose: true,
-                            message: '课时调整成功!',
-                            type: 'success'
-                        });
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            // 新增心率设备
-            addMember() {
-                this.clearForm();
-                this.dialogMemberVisible = true;
-                this.form.btnType = 0;
-                this.dialogTitle = '新增心率设备'
-            },
-            // 删除
-            delList() {
-                let that = this;
-                if (this.tableRadio.length == 0) {
-                    this.$message.error("请先选中一条记录");
-                    return false
-                }
-                let hrId = this.tableRadio.HrId;
-
-                let param = {
-                    token: localStorage.token,
-                    hrId: hrId,
-                    status: 9,//1:启用,8:暂停,9:删除
-                };
-                let postdata = qs.stringify(param);
-
-                this.$confirm('此操作将永久删除该心率设备, 是否继续?', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    HrSensorsStatusEdit(postdata).then(res => {
-                        let json = res;
-                        if (json.Code == 0) {
-                            that.$message({
-                                showClose: true,
-                                message: '选中的心率设备已删除!',
-                                type: 'success'
-                            });
-                            // 重载列表
-                            that.getTableQuery();
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    });
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消删除'
-                    });
-                });
-            },
-
-            handleSelectionChange(val) {
-                this.multipleSelection = val;
-            },
-            // 查询按钮
-            query() {
-                let that = this;
-                that.start = 0;
-                that.cur_page = 1;
-                this.getTableQuery();
-                this.$message.success('查询完毕');
-            },
-            clearForm() {
-                // clear
-                this.form.name = '';
-                this.form.sn = '';
-                this.form.venueNo = '';
-                this.form.phone = '';
-                this.form.userCode = '';
-                this.form.shopId = '';
-                this.form.userId = '';
-            },
-            // 页面数据查询
-            getTableQuery() {
-                let that = this;
-                that.loading = true;
-                let param = {
-                    token: localStorage.token,
-                    str: this.panel.str,//
-                    status: this.panel.status,//
-                    shopId: localStorage.shopId,//
-                };
-                let postdata = qs.stringify(param);
-                QueryPvtHrSensors(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        that.loading = false;
-                        if (json.Rs) {
-                            that.allTableData = json.Rs;
-                            that.recordsTotal = json.Rs.length;
-                        } else {
-                            that.allTableData = [];
-                            that.recordsTotal = 0;
-                        }
-
-                        // 设置分页数据
-                        that.setPagination();
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            // 设置分页数据
-            setPagination() {
-                // 分页属性
-                let that = this;
-                that.pageination.total = that.recordsTotal;
-
-                // 默认分页
-                that.tableData = that.allTableData.filter((item, index) => {
-                    return index < that.pageination.pageItem;
-                });
-            },
-            // 每页显示数量
-            handleSizeChange() {
-                let that = this;
-                that.tableData = that.allTableData.filter((item, index) => {
-                    return index < that.pageination.pageItem;
-                });
-                that.draw = that.pageination.pageItem;
-                // that.getTableQuery();
-            },
-            // 翻页
-            pageChange(pageIndex) {
-                let that = this;
-                // 获取当前页
-                let index = that.pageination.pageItem * (pageIndex - 1);
-                // 数据总数
-                let nums = that.pageination.pageItem * pageIndex;
-                // 容器
-                let tables = [];
-                for (var i = index; i < nums; i++) {
-                    if (that.allTableData[i]) {
-                        tables.push(that.allTableData[i])
-                    }
-                    this.tableData = tables;
-                }
-                that.start = index * that.draw;
-                // that.getTableQuery();
-            },
-            // 自动排序
-            sortChange(params) {
-                console.log(params)
-            },
-            //            过滤时间
-            filterFmtDate(value, row, column) {
-                let that = this;
-                if (column == 0) {
-                    return '未获得'
-                } else {
-                    return nonTfmtDatetoLength(new Date(column * 1000), 16);
-                }
-            },
+          } else {
+            that.$message.error(res.memo + ',错误代码:' + res.code);
+          }
+        } else {
+          let res = err;
+          that.$message.error(res.message + ',错误代码:' + res.code);
         }
-        ,
-        watch: {
-            $route(to) {
-                if (to.name == 'hrSensorPrivate') {
-                    if (this.$route.query.page == 'second') {
-                        this.getTableQuery();
-                        this.vipSelect();
-                    }
-                }
+      });
+    },
+    // 新增心率设备
+    addHrSensor() {
+      this.clearForm();
+      this.dialogSensorVisible = true;
+      this.form.btnType = 0;
+      this.dialogTitle = '新增心率设备'
+    },
+    // 确认提交新增心率设备
+    confirmAddSensor() {
+      let that = this;
+      if (!that.form.sn) {
+        this.$message.error('错了哦,编号不能为空');
+        return false
+      }
+      if (that.form.sn.length > 20) {
+        this.$message.error('错了哦,编号不能超过20个字符');
+        return false
+      }
+
+      const jsonStr = {
+        shopId: localStorage.shopId,
+        sn: that.form.sn,
+        UUUserID: that.form.uu_user_id,
+      };
+
+      let paraRequest = new StandardRequest();
+      paraRequest.setShopid(localStorage.shopId);
+      paraRequest.setJsonstr(JSON.stringify(jsonStr));
+      paraRequest.setSign(getSignStr(jsonStr));
+      console.log(paraRequest);
+      that.client.addPvtHrSensors(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+        if (err == null) {
+          console.log(StandardReply.getJsonrst());
+          let res = JSON.parse(StandardReply);
+          if (res.code === 0) {
+            // 关闭弹窗
+            that.dialogSensorVisible = false;
+            // 重载列表
+            that.getTableQuery();
+            that.$message({
+              showClose: true,
+              message: '心率设备添加成功!',
+              type: 'success'
+            });
+          } else {
+            that.$message.error(res.memo + ',错误代码:' + res.code);
+          }
+        } else {
+          let res = err;
+          that.$message.error(res.message + ',错误代码:' + res.code);
+          console.log(res);
+        }
+      });
+    },
+    // 编辑
+    editHrSensor() {
+      let that = this;
+      this.clearForm();
+      if (this.tableRadio == null || this.tableRadio.length == 0) {
+        this.$message.error("请先选中一条记录");
+        return false
+      }
+      let row = this.tableRadio;
+      this.form.shopid = row.shop_id;
+      this.form.hrId = row.uu_hr_id;
+      this.form.sn = row.sn;
+      this.form.uu_user_id = row.uu_user_id;
+      this.form.venueNo = row.venue_no;
+      this.dialogVisible = true;
+      this.dialogTitle = '编辑心率设备';
+      this.form.btnType = 1;
+      this.dialogSensorVisible = true
+    },
+    //确认编辑心率设备
+    confirmEditSensor() {
+      let that = this;
+      // checkNum
+      if (!that.form.sn) {
+        this.$message.error('错了哦,编号不能为空');
+        return false
+      }
+      if (that.form.sn.length > 20) {
+        this.$message.error('错了哦,编号不能超过20个字符');
+        return false
+      }
+      const jsonStr = {
+        shopId: localStorage.shopId,
+        sn: that.form.sn,
+        UUhrId: that.form.hrId,
+        venueNo: that.form.venueNo
+      };
+
+      let paraRequest = new StandardRequest();
+      paraRequest.setShopid(localStorage.shopId);
+      paraRequest.setJsonstr(JSON.stringify(jsonStr));
+      paraRequest.setSign(getSignStr(jsonStr));
+      console.log(paraRequest);
+      that.client.editHrSensors(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+        if (err == null) {
+          console.log(StandardReply.getJsonrst());
+          let res = JSON.parse(StandardReply);
+          if (res.code === 0) {
+            // 关闭弹窗
+            that.dialogSensorVisible = false;
+            // 重载列表
+            that.getTableQuery();
+            that.$message({
+              showClose: true,
+              message: '心率设备信息编辑成功!',
+              type: 'success'
+            });
+          } else {
+            that.$message.error(res.memo + ',错误代码:' + res.code);
+          }
+        } else {
+          let res = err;
+          that.$message.error(res.message + ',错误代码:' + res.code);
+          console.log(res);
+        }
+      });
+    },
+
+    // 删除心率带
+    pauseRowDel(row) {
+      let that = this;
+      this.$confirm('此操作将永久删除该心率设备, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        const jsonStr = {
+          shopId: localStorage.shopId,
+          UUhrId: row.uu_hr_id
+        };
+        let paraRequest = new StandardRequest();
+        paraRequest.setShopid(localStorage.shopId);
+        paraRequest.setJsonstr(JSON.stringify(jsonStr));
+        paraRequest.setSign(getSignStr(jsonStr));
+        console.log(paraRequest);
+        that.client.hrSensorsDel(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+          if (err == null) {
+            console.log(StandardReply.getJsonrst());
+            let res = JSON.parse(StandardReply);
+            if (res.code === 0) {
+              that.$message({
+                showClose: true,
+                message: '选中的心率设备已删除!',
+                type: 'success'
+              });
+              // 重载列表
+              that.getTableQuery();
+            } else {
+              that.$message.error(res.memo + ',错误代码:' + res.code);
+            }
+          } else {
+            let res = err;
+            that.$message.error(res.message + ',错误代码:' + res.code);
+            console.log(res);
+          }
+        });
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
+    // 关闭所有
+    allDialogClose() {
+      this.dialogVisible = false;
+    },
+    // 查询按钮
+    query() {
+      let that = this;
+      that.start = 0;
+      that.cur_page = 1;
+      this.getTableQuery();
+      this.$message.success('查询完毕');
+    },
+    clearForm() {
+      // clear
+      this.form.name = '';
+      this.form.sn = '';
+      this.form.venueNo = '';
+      this.form.userCode = '';
+      this.form.shopId = '';
+    },
+    // 页面数据查询
+    getTableQuery() {
+      let that = this;
+      that.loading = true;
+
+      const jsonStr = {
+        shopId: localStorage.shopId,
+        snOrNO: that.panel.str,
+        start: that.start,
+        tableMax: that.pagination.pageItem
+      };
+      let paraRequest = new StandardRequest();
+      paraRequest.setShopid(localStorage.shopId);
+      paraRequest.setJsonstr(JSON.stringify(jsonStr));
+      paraRequest.setSign(getSignStr(jsonStr));
+      console.log(paraRequest);
+      that.client.hrSensorsPvtQuery(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+        if (err == null) {
+          console.log(StandardReply.getJsonrst());
+          let res = JSON.parse(StandardReply);
+          that.loading = false;
+          if (res.code === 0) {
+            if (res.rs) {
+              that.allTableData = res.rs;
+              that.recordsTotal = res.pagecount * that.pagination.pageItem;
+            } else {
+              that.allTableData = [];
+              that.recordsTotal = 0;
             }
+            // 设置分页数据
+            that.setPagination();
+          } else {
+            that.$message.error(res.memo + ',错误代码:' + res.code);
+          }
+        } else {
+          let res = err;
+          that.$message.error(res.message + ',错误代码:' + res.code);
+          console.log(res);
         }
-    }
+      });
+    },
+    // 设置分页数据
+    setPagination() {
+      // 分页属性
+      let that = this;
+      that.pagination.total = that.recordsTotal;
+
+      // 默认分页
+      that.tableData = that.allTableData.filter((item, index) => {
+        return index < that.pagination.pageItem;
+      });
+    },
+    // 每页显示数量
+    handleSizeChange() {
+      let that = this;
+      that.tableData = that.allTableData.filter((item, index) => {
+        return index < that.pagination.pageItem;
+      });
+      that.draw = that.pagination.pageItem;
+      // that.getTableQuery();
+    },
+    // 翻页
+    pageChange(pageIndex) {
+      let that = this;
+      // 获取当前页
+      let index = that.pagination.pageItem * (pageIndex - 1);
+      // 数据总数
+      let nums = that.pagination.pageItem * pageIndex;
+      // 容器
+      let tables = [];
+      for (let i = index; i < nums; i++) {
+        if (that.allTableData[i]) {
+          tables.push(that.allTableData[i])
+        }
+        this.tableData = tables;
+      }
+      that.start = index * that.draw;
+      // that.getTableQuery();
+    },
+    // 自动排序
+    sortChange(params) {
+      console.log(params)
+    },
+    // 过滤时间
+    filterFmtDate(value, row, column) {
+      let that = this;
+      if (column == 0) {
+        return '未获得'
+      } else {
+        return nonTfmtDatetoLength(column, 16);
+      }
+    },
+  },
+}
 </script>
 
 <style scoped>
-    @import "../../assets/css/panel.css";
-
-    .context {
-        /* height: 770px; */
-        overflow-y: scroll;
-
-        display: block;
-        margin: 0 auto;
-        background-color: #fff !important;
-        padding: 30px;
-    }
-
-    .panel-body {
-        padding: 20px;
-        background: #F0F2F5;
-    }
-
-    .change {
-        width: 100%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-        padding-top: 10px;
-        padding-bottom: 10px;
-    }
-
-    .change button {
-        float: left;
-    }
-
-    .change button.pull-right {
-        float: right;
-    }
-
-    .likeTab {
-        width: 100%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-        padding-top: 10px;
-        padding-bottom: 0;
-        border-bottom: 1px solid #ccc;
-        margin-bottom: 10px;
-    }
-
-    .likeTab button {
-        float: left;
-        border-radius: 0;
-    }
-
-    .likeTab button.pull-right {
-        float: right;
-    }
-
-    .dialogTitle {
-        width: 100%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-        color: #000000;
-        font-size: 18px;
-        text-align: center;
-    }
-
-    .dialogTitle em {
-        float: none;
-        font-style: normal;
-        color: #3799FF;
-        margin: 0;
-    }
-
-    /deep/ .el-transfer-panel__item .el-checkbox__input {
-        left: 40px;
-    }
-
-    .dialogFooter {
-        width: 90%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-        margin-top: 10px;
-    }
-
-    .dialogFooter button {
-        float: right;
-        margin-left: 10px;
-    }
-
-    .dialogContent {
-        width: 100%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-    }
-
-    .dialogContent .pull-left {
-        width: 30%;
-        float: left;
-    }
-
-    .dialogContent .pull-right {
-        width: 70%;
-        float: right;
-    }
-
-    /deep/ .el-dialog .el-select {
-        width: 100%;
-    }
-
-    .panel_control /deep/ .el-input {
-        width: 90px;
-        float: left;
-    }
+@import "../../assets/css/panel.css";
+
+.context {
+  /* height: 770px; */
+  overflow-y: scroll;
+
+  display: block;
+  margin: 0 auto;
+  background-color: #fff !important;
+  padding: 30px;
+}
+
+.panel-body {
+  padding: 20px;
+  background: #f0f2f5;
+}
+
+.change {
+  width: 100%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+  padding-top: 10px;
+  padding-bottom: 10px;
+}
+
+.change button {
+  float: left;
+}
+
+.change button.pull-right {
+  float: right;
+}
+
+.likeTab {
+  width: 100%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+  padding-top: 10px;
+  padding-bottom: 0;
+  border-bottom: 1px solid #ccc;
+  margin-bottom: 10px;
+}
+
+.likeTab button {
+  float: left;
+  border-radius: 0;
+}
+
+.likeTab button.pull-right {
+  float: right;
+}
+
+.dialogTitle {
+  width: 100%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+  color: #000000;
+  font-size: 18px;
+  text-align: center;
+}
+
+.dialogTitle em {
+  float: none;
+  font-style: normal;
+  color: #3799ff;
+  margin: 0;
+}
+
+/deep/ .el-transfer-panel__item .el-checkbox__input {
+  left: 40px;
+}
+
+.dialogFooter {
+  width: 90%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+  margin-top: 10px;
+}
+
+.dialogFooter button {
+  float: right;
+  margin-left: 10px;
+}
+
+.dialogContent {
+  width: 100%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+}
+
+.dialogContent .pull-left {
+  width: 30%;
+  float: left;
+}
+
+.dialogContent .pull-right {
+  width: 70%;
+  float: right;
+}
+
+.panel_control /deep/ .el-input {
+  width: 90px;
+  float: left;
+}
 </style>

+ 373 - 127
src/views/SystemManage/ShopDevice.vue

@@ -1,7 +1,11 @@
 <template>
   <div class="context">
     <div class="panel">
-      <h5>所属设备 -- xx区域</h5>
+      <h5> 商家设备管理 </h5>
+    </div>
+    <div class="change">
+      <el-button @click="addRegionEquip" type="primary" size="mini">新增区域设备</el-button>
+      <el-button @click="editList" size="mini">编辑区域设备</el-button>
     </div>
     <div class="table">
       <el-table
@@ -11,7 +15,13 @@
           :default-sort="{prop: 'date', order: 'descending'}"
           element-loading-background="rgba(0, 0, 0, 0.8)"
           class=""
+          @selection-change="handleSelectionChange" @current-change="clickChange"
       >
+        <el-table-column label="选择" width="55">
+          <template slot-scope="scope">
+            <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
+          </template>
+        </el-table-column>
         <el-table-column
             type="index"
             label="序号"
@@ -19,241 +29,459 @@
             width="50">
         </el-table-column>
         <el-table-column
-            prop="CreatedAt"
-            label="日期"
-            :formatter="filterFmtDate"
+            prop="eqsn"
+            label="序列号"
+        >
+        </el-table-column>
+        <el-table-column
+            prop="version"
+            label="版本"
             sortable
         >
         </el-table-column>
         <el-table-column
-            prop="OptName"
-            label="操作者"
+            prop="equip_type"
+            label="类型"
             sortable
         >
+          <template slot-scope="scope">
+            <span v-if="scope.row.equip_type == 1">TVBox</span>
+            <span v-if="scope.row.equip_type == 2">BLEHub</span>
+            <span v-if="scope.row.equip_type == 3">演示设备</span>
+          </template>
         </el-table-column>
         <el-table-column
-            prop="OptInfo"
-            label="操作信息"
+            prop="status"
+            label="状态"
             sortable
         >
+          <!--1:启用  8:暂停  9:删除-->
+          <template slot-scope="scope">
+            <span v-if="scope.row.status == 1" style="color: yellowgreen">启用</span>
+            <span v-if="scope.row.status == 8" style="color: yellow">暂停</span>
+            <span v-if="scope.row.status == 9" style="color: red">删除</span>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="address"
+            label="操作">
           <template slot-scope="scope">
-                        <el-button type="success" @click="run(scope.row.id)" v-if="scope.row.Status != 4">开启</el-button>
-                        <el-button type="danger" @click="pause(scope.row.id)" v-if="scope.row.Status == 4">暂停</el-button>
+            <el-button type="success" @click="run(scope.row)" v-if="scope.row.status == 8">开启</el-button>
+            <el-button type="danger" @click="pause(scope.row)" v-if="scope.row.status == 1">暂停</el-button>
+            <span v-if="scope.row.equip_type != 3" style="color: red">
+                        <el-button type="danger" size="mini" @click="pauseRowDel(scope.row)">删除</el-button>
+                      </span>
           </template>
         </el-table-column>
       </el-table>
       <br>
       <el-pagination
           background
-          :total="pageination.total"
-          :page-size="pageination.pageItem"
+          :total="pagination.total"
+          :page-size="pagination.pageItem"
           @current-change="pageChange"
       ></el-pagination>
     </div>
-
+    <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="650px">
+      <div class="dialogContent">
+        <div class="">
+          <el-form ref="form" :model="form" label-width="160px">
+            <el-form-item label="设备序列号">
+              <el-input v-model="form.eqSn "></el-input>
+            </el-form-item>
+            <el-form-item label="版本号">
+              <el-input v-model="form.version"></el-input>
+            </el-form-item>
+            <el-form-item label="设备类型">
+              <el-select v-model="form.equipType " placeholder="请选择">
+                <el-option
+                    v-for="item in options"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-form>
+        </div>
+      </div>
+      <div class="dialogFooter">
+        <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmMember">确定</el-button>
+        <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
+        </el-button>
+        <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import Global from '../../Global.js'
 import {
-  OptLogListQuery,
-  testTable,
-  testSelect, ShopManagerListQuery, ShopListQuery
+  QueryVenueEquip,
+  AddShopVenueEquip,
+  EditShopVenueEquip,
+  ShopVenueEquipEditStatus
 } from "../../api/getApiRes";
+import {
+  StandardRequest
+} from "@/grpc/base_pb";
 
 let qs = require('qs');
 export default {
   data() {
     return {
+      regionName: '',
       dialogVisible: false,
-      dialogTitle: '新增管理员',
-      times: globalBt2(7),
+      dialogMemberVisible: false,
+      dialogTitle: '新增区域设备',
       // panel 配置项目
-      panel: {
-        userCode: '',
-        tel: '',
-        userId: '',
-        shopList: 0,
-        shopId: '',
-        options: [],
-        shopOptions: [],
-        draw: 1,
-        start: 0,
-        recordsTotal: 0,
-        tableData: [],
-        allTableData: [],
-        limit: '10',
-        multipleSort: false,
-        loading: false,
-        fileList: [],
-        multipleSelection: [],
-        detectedmac: '',
-        time1: globalBt(),
-        timeScope: globalBt2(30),
-      },
       multipleSelection: [],
-      pageination: {
+      tableRadio: [],
+      pagination: {
         pageItem: 10,
-        pageoptions: pageOptions(),
+        pageOptions: pageOptions(),
         total: 100,
         pageIndex: 1,
       },
       form: {
+        eqId: '',
+        eqSn: '',
         name: '',
+        version: '',
         userCode: '',
         shopId: '',
+        btnType: 0,
+        equipType: 1,
       },
+      options: [
+        {value: 1, label: 'TVBox'},
+        {value: 2, label: 'BLEHub'},
+        {value: 3, label: '演示设备'},
+      ],
       shops: [],
       tableData: [],
-      serachBtnStatus: false,
     }
   },
   mounted() {
-    this.panelSelect();
-    this.shopPanelSelect();
+    this.regionName = this.$route.query.name;
     this.getTableQuery();
   },
   methods: {
-    shopPanelSelect(){
+    goBack() {
+      this.$router.push({
+        path: '/hrSensor', query: {}
+      });
+    },
+    clickChange(item) {
+      this.tableRadio = item
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    clearForm() {
+      // clear
+      this.form.name = '';
+      this.form.userCode = '';
+      this.form.shopId = '';
+      this.form.eqSn = '';
+      this.form.version = '';
+      this.form.equipType = 1;
+    },
+    // 新增区域设备
+    addRegionEquip() {
+      this.clearForm();
+      this.dialogMemberVisible = true;
+      this.btnType = 0;
+      this.dialogTitle = '新增区域设备'
+    },
+    // 确认提交新增区域设备
+    confirmMember() {
       let that = this;
+      // checkNum
+      if (!that.form.eqSn) {
+        this.$message.error('错了哦,设备序列号不能为空');
+        return false
+      }
+      if (that.form.version.length > 10) {
+        this.$message.error('错了哦,版本号字符不能超过10位');
+        return false
+      }
+
       let param = {
-        token: localStorage.token,
+        key: localStorage.ServiceKey,
+        shopId: localStorage.ServiceId,
+        svId: this.$route.query.svId,
+        eqSn: this.form.eqSn,
+        version: this.form.version,
+        equipType: this.form.equipType,
       };
       let postdata = qs.stringify(param);
-      ShopListQuery(postdata).then(res => {
+      AddShopVenueEquip(postdata).then(res => {
         let json = res;
         if (json.Code == 0) {
-          if (json.Rs == '') {
-            that.$message.error('当前没有可选的店铺,请先在店面管理中添加店铺!');
-            return false
-          }
-          that.panel.shopOptions = turnShopResToOption(json.Rs);
-          that.panel.shopOptions.unshift({value: '', label: "全部"});
+          // 关闭弹窗
+          that.dialogMemberVisible = false;
+          // 重载列表
+          that.getTableQuery();
+          that.$message({
+            showClose: true,
+            message: '所属设备添加成功!',
+            type: 'success'
+          });
         } else {
           that.$message.error(json.Memo + ' 错误码:' + json.Code);
         }
       })
     },
-    // 加载选项
-    panelSelect() {
+    //修改设备
+    editList() {
+      let that = this;
+      this.clearForm();
+      if (this.tableRadio.length == 0) {
+        this.$message.error("请先选中一条记录");
+        return false
+      }
+      let row = this.tableRadio;
+      this.form.shopid = row.ShopId;
+      this.form.userId = row.Id;
+      this.form.name = row.Name;
+      this.form.userCode = row.Usercode;
+      this.form.password = '';
+      this.form.phone = row.Phone;
+      this.form.eqId = row.EqId;
+      this.form.eqSn = row.eqsn.trim();
+      this.form.version = row.version.trim();
+      this.form.equipType = row.equip_type;
+      this.form.memo = row.Memo;
+      this.form.adminType = row.AdminType;
+      this.dialogVisible = true;
+      this.dialogTitle = '编辑区域设备';
+      this.form.btnType = 1;
+      this.dialogMemberVisible = true
+    },
+    //确认提交修改
+    confirmEditMember() {
       let that = this;
+      console.log(that.form.version.length);
+      // checkNum
+      if (!that.form.eqSn) {
+        this.$message.error('错了哦,设备序列号不能为空');
+        return false
+      }
+      if (that.form.version.length > 10) {
+        this.$message.error('错了哦,版本号字符不能超过10位');
+        return false
+      }
       let param = {
-        token: localStorage.token,
-        start: 1,
-        tableMax: 999,
+        key: localStorage.ServiceKey,
+        shopId: localStorage.ServiceId,
+        svId: this.$route.query.svId,
+        eqId: this.form.eqId,
+        eqSn: this.form.eqSn,
+        version: this.form.version,
+        equipType: this.form.equipType,
       };
       let postdata = qs.stringify(param);
-      ShopManagerListQuery(postdata).then(res => {
+      EditShopVenueEquip(postdata).then(res => {
         let json = res;
         if (json.Code == 0) {
-          that.panel.options = this.turnResToOptionByUsers(json.Rs);
-          that.panel.options.unshift({value: '', label: "全部"});
-          console.log(that.panel.options);
+          // 关闭弹窗
+          that.dialogMemberVisible = false;
+          // 重载列表
+          that.getTableQuery();
+          that.$message({
+            showClose: true,
+            message: '区域设备信息编辑成功!',
+            type: 'success'
+          });
         } else {
           that.$message.error(json.Memo + ' 错误码:' + json.Code);
         }
       })
     },
-    turnResToOptionByUsers(data) {
-      if (!data) return false
-      let ids = data.map(item => {
-        return {
-          label: item.Name + ' ' + item.Phone,
-          key: parseInt(item.Id),
-          value: parseInt(item.Id),
-        }
-      })
-      return ids
-    },
-    clearForm() {
-      // clear
-      this.form.name = '';
-      this.form.userCode = '';
-      this.form.shopId = '';
+    //删除
+    pauseRowDel(row) {
+      let that = this;
+      let param = {
+        key: localStorage.ServiceKey,
+        shopId: localStorage.ServiceId,
+        svId: row.SvId,
+        eqId: row.eq_id,
+        status: 9,//1:启用 8:暂停 9:删除
+      };
+      let postdata = qs.stringify(param);
+      this.$confirm('此操作将永久删除该区域设备, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        ShopVenueEquipEditStatus(postdata).then(res => {
+          let json = res;
+          if (json.Code == 0) {
+            that.$message({
+              showClose: true,
+              message: '选中的区域设备已删除!',
+              type: 'success'
+            });
+            // 重载列表
+            that.getTableQuery();
+          } else {
+            that.$message.error(json.Memo + ' 错误码:' + json.Code);
+          }
+        });
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
     },
-    handleSelectionChange(val) {
-      this.multipleSelection = val;
+    // 暂停
+    pause(row) {
+      let that = this;
+      console.log(row);
+      this.$confirm('是否暂停设备' + row.eqsn + '?', '暂停操作', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+
+        let param = {
+          key: localStorage.ServiceKey,
+          shopId: localStorage.ServiceId,
+          svId: this.$route.query.svId,
+          eqId: row.eq_id,
+          status: 8,//1:启用 8:暂停 9:删除
+        };
+
+        let postdata = qs.stringify(param);
+        ShopVenueEquipEditStatus(postdata).then(res => {
+          let json = res;
+          if (json.Code == 0) {
+            that.$message({
+              showClose: true,
+              message: row.eqsn + '暂停成功!',
+              type: 'success'
+            });
+            // table 重载
+            that.getTableQuery();
+          } else {
+            that.$message.error(json.Memo + ' 错误码:' + json.Code);
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消暂停'
+        });
+      });
     },
-    // 查询按钮
-    query() {
-      // 按钮倒计时
+    // 开启
+    run(row) {
       let that = this;
-      that.serachBtnStatus = true;
-      let totalTime = 2
-      let clock = window.setInterval(() => {
-        totalTime--
-        if (totalTime < 0) {
-          totalTime = 2;
-          that.serachBtnStatus = false;
-        }
-      }, 1000)
+      this.$confirm('是否开启设备' + row.eqsn + '?', '开启操作', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+
+        let param = {
+          key: localStorage.ServiceKey,
+          shopId: localStorage.ServiceId,
+          svId: this.$route.query.svId,
+          eqId: row.eq_id,
+          status: 1,//1:启用 8:暂停 9:删除
+        };
 
-      this.getTableQuery();
-      this.$message.success('查询完毕');
+        let postdata = qs.stringify(param);
+        ShopVenueEquipEditStatus(postdata).then(res => {
+          let json = res;
+          if (json.Code == 0) {
+            that.$message({
+              showClose: true,
+              message: row.eqsn + '开启成功!',
+              type: 'success'
+            });
+            // table 重载
+            that.getTableQuery();
+          } else {
+            that.$message.error(json.Memo + ' 错误码:' + json.Code);
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消开启'
+        });
+      });
     },
     // 页面数据查询
     getTableQuery() {
       let that = this;
-      // this.getGetChildRegionSelect(0, 1);
       that.loading = true;
-      // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
-      let param = {
-        token: localStorage.token,
-        name: this.panel.name,
-        phone: this.panel.phone,
-        userId: this.panel.userId,
-        bt: nonTfmtDatetoLength(that.panel.timeScope[0], 10) + " 00:00:00",
-        et: nonTfmtDatetoLength(that.panel.timeScope[1], 10) + " 23:59:59",
-        start: 1,//
-        tableMax: 9999,//
-        optShopId:this.panel.shopId,
+
+      const jsonStr = {
+        shopId: localStorage.shopId,
+        eqType: 1//1:TVBox  2:蓝牙心率Hub 3:演示Pad  -99全部
       };
-      let postdata = qs.stringify(param);
-      OptLogListQuery(postdata).then(res => {
-        let json = res;
-        if (json.Code == 0) {
-          that.loading = false;
-          if (json.Rs) {
-            that.allTableData = json.Rs;
-            that.recordsTotal = json.Rs.length;
+
+      let paraRequest = new StandardRequest();
+      paraRequest.setShopid(localStorage.shopId);
+      paraRequest.setJsonstr(JSON.stringify(jsonStr));
+      paraRequest.setSign(getSignStr(jsonStr));
+      console.log(paraRequest);
+      that.client.shopVenueEquipQuery(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+        if (err == null) {
+          console.log(StandardReply.getJsonrst());
+          let res = JSON.parse(StandardReply);
+          if (res.code === 0) {
+            that.loading = false;
+            if (res.rs) {
+              that.allTableData = res.rs;
+              that.recordsTotal = res.rs.length;
+            } else {
+              that.allTableData = [];
+              that.recordsTotal = 0;
+            }
+            // 设置分页数据
+            that.setPagination();
           } else {
-            that.allTableData = [];
-            that.recordsTotal = 0;
+            that.$message.error(res.memo + ',错误代码:' + res.code);
           }
-          // 设置分页数据
-          that.setPagination();
         } else {
-          that.$message.error(json.Memo + ' 错误码:' + json.Code);
+          let res = err;
+          that.$message.error(res.message + ',错误代码:' + res.code);
+          console.log(res);
         }
-      })
+      });
     },
     // 设置分页数据
     setPagination() {
       // 分页属性
       let that = this;
-      that.pageination.total = that.recordsTotal;
+      that.pagination.total = that.recordsTotal;
       // 默认分页
       that.tableData = that.allTableData.filter((item, index) => {
-        return index < that.pageination.pageItem;
+        return index < that.pagination.pageItem;
       });
     },
     // 每页显示数量
     handleSizeChange() {
       let that = this;
       that.tableData = that.allTableData.filter((item, index) => {
-        return index < that.pageination.pageItem;
+        return index < that.pagination.pageItem;
       });
-      that.draw = that.pageination.pageItem;
+      that.draw = that.pagination.pageItem;
       that.getTableQuery();
     },
     // 翻页
     pageChange(pageIndex) {
       let that = this;
       // 获取当前页
-      let index = that.pageination.pageItem * (pageIndex - 1);
+      let index = that.pagination.pageItem * (pageIndex - 1);
       // 数据总数
-      let nums = that.pageination.pageItem * pageIndex;
+      let nums = that.pagination.pageItem * pageIndex;
       // 容器
       let tables = [];
       for (var i = index; i < nums; i++) {
@@ -275,6 +503,15 @@ export default {
       return nonTfmtDate(column, 11);
     },
   },
+  watch: {
+    $route(to) {
+      if (to.name == 'shopDevice') {
+        this.regionName = this.$route.query.name;
+        this.getTableQuery();
+        console.log(this.regionName);
+      }
+    },
+  },
 }
 </script>
 
@@ -355,6 +592,15 @@ export default {
 .panel /deep/ .el-date-editor .el-range-separator {
   line-height: 22px;
 }
+
+/deep/ .el-select {
+  width: 100%;
+}
+
+.panel h5 {
+  font-size: 24px;
+}
+
 /*ipad only*/
 @media only screen and (max-width: 1366px) {
   .panel /deep/ .el-date-editor--daterange {

+ 468 - 737
src/views/SystemManage/ShopRegion.vue

@@ -1,769 +1,500 @@
 <template>
-    <div class="context">
-        <div class="panel">
-            <h5>区域管理</h5>
-        </div>
-        <div class="change">
-            <el-button @click="addMember" type="primary" size="mini">新增区域</el-button>
-            <el-button @click="editList" size="mini">编辑区域</el-button>
-            <!--<el-button @click="delList" type="danger">删除区域</el-button>-->
-        </div>
-        <div class="table">
-            <el-table
-                    :data="tableData"
-                    border
-                    is-horizontal-resize
-                    :default-sort="{prop: 'date', order: 'descending'}"
-                    element-loading-background="rgba(0, 0, 0, 0.8)"
-                    class=""
-                    @selection-change="handleSelectionChange" @current-change="clickChange"
-            >
-                >
-                <el-table-column label="选择" width="55">
-                    <template slot-scope="scope">
-                        <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
-                    </template>
-                </el-table-column>
-                <el-table-column label="序号" type="index" width="50" align="center">
-                    <template scope="scope">
-                        <span>{{(start) + scope.$index + 1}}</span>
-                    </template>
-                </el-table-column>
-                <el-table-column
-                        prop="Name"
-                        label="区域名称"
-                        width="240">
-                </el-table-column>
-                <el-table-column
-                        prop="Base.CreatedAt"
-                        label="创建日期"
-                        :formatter="filterFmtDate"
-                        width="180"
-                        sortable
-                >
-                </el-table-column>
-                <!--<el-table-column-->
-                <!--prop="Status"-->
-                <!--label="状态"-->
-                <!--width="180">-->
-                <!--&lt;!&ndash;1:启用,8:暂停,9:删除&ndash;&gt;-->
-                <!--<template slot-scope="scope">-->
-                <!--<span v-if="scope.row.Status == 1" style="color: rgb(103, 194, 58)">已启用</span>-->
-                <!--<span v-if="scope.row.Status == 8" style="color: #E6A23C">已暂停</span>-->
-                <!--<span v-if="scope.row.Status == 9" style="color: red">已删除</span>-->
-                <!--</template>-->
-                <!--</el-table-column>-->
-                <el-table-column
-                        prop="id"
-                        label="操作"
-                >
-                    <template slot-scope="scope">
-                        <!--<el-button type="success" v-if="scope.row.Status == 8" size="mini"-->
-                        <!--@click="pauseRow(scope.row,1)">-->
-                        <!--启用-->
-                        <!--</el-button>-->
-                        <!--<el-button type="warning" v-if="scope.row.Status == 1" size="mini"-->
-                        <!--@click="pauseRow(scope.row,8)">-->
-                        <!--暂停-->
-                        <!--</el-button>-->
-                        <el-button type="danger" size="mini"
-                                   @click="pauseRowDel(scope.row)">
-                            删除
-                        </el-button>
-                        <el-button type="text" @click="goPage(scope.row)">设备管理</el-button>
-                    </template>
-                </el-table-column>
-            </el-table>
-            <br>
-            <el-pagination
-                    background
-                    :total="pagination.total"
-                    :page-size="pagination.pageItem"
-                    @current-change="pageChange"
-            ></el-pagination>
-        </div>
+  <div class="context">
+    <div class="panel">
+      <h5>商家区域管理</h5>
+    </div>
+    <div class="change">
+      <el-button @click="addRegion" type="primary" size="mini">新增区域</el-button>
+      <el-button @click="editRegion" size="mini">编辑区域</el-button>
+      <!--<el-button @click="deleteRegion" type="danger">删除区域</el-button>-->
+    </div>
+    <div class="table">
+      <el-table
+          :data="tableData"
+          border
+          is-horizontal-resize
+          :default-sort="{prop: 'date', order: 'descending'}"
+          element-loading-background="rgba(0, 0, 0, 0.8)"
+          @selection-change="handleSelectionChange" @current-change="clickChange"
+      >
+        <el-table-column label="选择" width="55">
+          <template slot-scope="scope">
+            <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
+          </template>
+        </el-table-column>
+        <el-table-column label="序号" type="index" width="50" align="center">
+          <template scope="scope">
+            <span>{{ (start) + scope.$index + 1 }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="name"
+            label="区域名称"
+            width="240">
+        </el-table-column>
+        <el-table-column
+            prop="create_at"
+            label="创建日期"
+            :formatter="filterFmtDate"
+            width="180"
+            sortable
+        >
+        </el-table-column>
 
-        <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="650px">
-            <div class="dialogContent">
-                <div class="">
-                    <el-form ref="form" :model="form" label-width="160px">
-                        <el-form-item label="区域名称">
-                            <el-input v-model="form.name"></el-input>
-                        </el-form-item>
-                    </el-form>
-                </div>
-            </div>
-            <div class="dialogFooter">
-                <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmMember">确定</el-button>
-                <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
-                </el-button>
-                <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
-            </div>
-        </el-dialog>
+        <el-table-column prop="id" label="操作">
+          <template slot-scope="scope">
+            <el-button type="danger" size="mini" @click="deleteRegion(scope.row)">删除</el-button>
+<!--            <el-button type="text" @click="goPage(scope.row)">设备管理</el-button>-->
+          </template>
+        </el-table-column>
+      </el-table>
+      <br>
+      <el-pagination
+          background
+          :total="pagination.total"
+          :page-size="pagination.pageItem"
+          @current-change="pageChange"
+      ></el-pagination>
     </div>
+
+    <el-dialog :title="dialogTitle" :visible.sync="dialogRegionVisible" width="650px">
+      <div class="dialogContent">
+        <div class="">
+          <el-form ref="form" :model="form" label-width="160px">
+            <el-form-item label="区域名称">
+              <el-input v-model="form.name"></el-input>
+            </el-form-item>
+          </el-form>
+        </div>
+      </div>
+      <div class="dialogFooter">
+        <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmAddRegion">确定</el-button>
+        <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditRegion">确定
+        </el-button>
+        <el-button size="small" @click="dialogRegionVisible = false">取消</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-    import Global from '../../Global.js'
-    import {
-        testTable,
-        testSelect,
-        QueryShopVenue,
-        AddShopVenue,
-        EditShopVenue,
-        ShopVenueStatusEdit,
-    } from "../../api/getApiRes";
+import Global from '../../Global.js'
+import {
+  AddShopVenue,
+  EditShopVenue,
+  ShopVenueStatusEdit,
+} from "../../api/getApiRes";
+import {
+  StandardRequest
+} from "@/grpc/base_pb";
 
-    let qs = require('qs');
-    export default {
-        data() {
-            return {
-                dialogVisible: false,//其他dialog
-                dialogMemberVisible: false,//新增区域dialog
-                dialogLesson: false,//课时调整
-                dialogGift: false,//赠送课时调整
-                dialogExpTime: false,//有效期调整
-                dialogLessonTable: false,//区域课程
-                dialogTitle: '新增区域',
-                dialogValue: [],
-                tableRadio: [],
-                start: 0,
-                draw: 1,
-                // panel 配置项目
-                panel: {
-                    name: '',
-                    phone: '',
-                    compname: '',
-                    keyword: '',
-                    USERCODE: '',
-                    endType: '',
-                    taskstatus: 99,
-                    draw: 1,
-                    start: 0,
-                    recordsTotal: 0,
-                    tableData: [],
-                    allTableData: [],
-                    limit: '10',
-                    multipleSort: false,
-                    loading: false,
-                    fileList: [],
-                    multipleSelection: [],
-                    detectedmac: '',
-                    options: [
-                        {value: 99, label: '全部'},
-                        {value: 1, label: '进行中'},
-                        {value: 2, label: '已完成'},
-                    ],
-                    endTypeOptions: [
-                        {value: 99, label: '全部'},
-                        {value: 30, label: '近一个月'},
-                        {value: 7, label: '近一周'},
-                        {value: 1, label: '当日'},
-                    ],
-                    time1: globalBt(),
-                },
-                multipleSelection: [],
-                pagination: {
-                    pageItem: 10,
-                    pageoptions: pageOptions(),
-                    total: 100,
-                    pageIndex: 1,
-                },
-                form: {
-                    name: '',
-                    userCode: '',
-                    shopId: '',
-                    teacherId: 0,
-                    memberType: 1,
-                    lesson: 1,
-                    gift: 1,
-                    btnType: 0,//0新建,1编辑编辑
-                    memo: '',
-                    phone: '',
-                    expTime: '',
-                    dialogdata: [],//穿梭待选
-                    dialogValue: [],//穿梭已选
-                },
-                memberTypes: [
-                    {value: 1, label: '年区域'},
-                    {value: 2, label: '充值区域'},
-                ],
-                tableData: []
-            }
-        },
-        mounted() {
-            this.getTableQuery();
-        },
-        methods: {
-            // 设备回收
-            // takeBack(row) {
-            //     let that = this;
-            //     this.$confirm('是否回收用户' + row.name + '的区域?', '回收操作', {
-            //         confirmButtonText: '确定',
-            //         cancelButtonText: '取消',
-            //         type: 'warning'
-            //     }).then(() => {
-            //         let param = {
-            //             token: localStorage.token,
-            //             Id: row.Id,
-            //             status: 0,
-            //         };
-            //         let postdata = qs.stringify(param);
-            //         testTable(postdata).then(res => {
-            //             let json = res;
-            //             if (json.Code == 0) {
-            //                 that.$message({
-            //                     showClose: true,
-            //                     message: row.name + '回收成功!',
-            //                     type: 'success'
-            //                 });
-            //                 // table 重载
-            //                 that.getTableQuery();
-            //             } else {
-            //                 that.$message.error(json.Memo + ' 错误码:' + json.Code);
-            //             }
-            //         })
-            //     }).catch(() => {
-            //         this.$message({
-            //             type: 'info',
-            //             message: '已取消回收'
-            //         });
-            //     });
-            // },
-            // 删除
-            pauseRowDel(row) {
-                let that = this;
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                    svId: row.SvId,
-                    status: 9,// 1:启用 8:暂停 9:删除
-                };
-                let postdata = qs.stringify(param);
-                this.$confirm('此操作将永久删除该区域设备, 是否继续?', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    ShopVenueStatusEdit(postdata).then(res => {
-                        let json = res;
-                        if (json.Code == 0) {
-                            that.$message({
-                                showClose: true,
-                                message: '选中的区域设备已删除!',
-                                type: 'success'
-                            });
-                            // 重载列表
-                            that.getTableQuery();
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    });
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消删除'
-                    });
-                });
-            },
-            // 禁用
-            pauseRow(row, status) {
-                let that = this;
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                    svId: row.SvId,
-                    status: status,
-                };
-                let postdata = qs.stringify(param);
-                ShopVenueStatusEdit(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        that.$message({
-                            showClose: true,
-                            message: '执行成功!',
-                            type: 'success'
-                        });
-                        // table 重载
-                        that.getTableQuery();
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            goPage(row) {
-                this.$router.push({
-                    path: '/heartLog', query: {
-                        name: row.Name,
-                        svId: row.SvId
-                    }
-                });
-            },
-            // 编辑
-            editList() {
-                let that = this;
-                this.clearForm();
-                console.log(this.tableRadio);
-                if (this.tableRadio.length == 0) {
-                    this.$message.error("请先选中一条记录");
-                    return false
-                }
-                let row = this.tableRadio;
-                this.form.shopid = row.ShopId;
-                this.form.userId = row.Id;
-                this.form.name = row.Name;
-                this.form.userCode = row.Usercode;
-                this.form.password = '';
-                this.form.phone = row.Phone;
-                this.form.memo = row.Memo;
-                this.form.svId = row.SvId;
-                this.form.adminType = row.AdminType;
-                this.dialogVisible = true;
-                this.dialogTitle = '编辑区域';
-                this.form.btnType = 1;
-                this.dialogMemberVisible = true
-            },
-            clickChange(item) {
-                this.tableRadio = item
-            },
-            // 选择课程后,获取当前课程的建议上课人数和课时消耗
-            getRowTop(row) {
-                let that = this;
-                console.log(row);
-                let param = {
-                    token: localStorage.token,
-                    classId: row.ClassId,
-                };
-                let postdata = qs.stringify(param);
-                ClassDetailOne(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        row.TopLimit = json.Rs.TopLimit;
-                        row.ConsumeHour = json.Rs.ConsumeHour;
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            // 编辑
-            editMember(row) {
-                this.clearForm();
-                this.form.name = row.Name;
-                this.form.phone = row.Phone;
-                this.form.shopId = row.ShopId;
-                this.form.teacherId = row.TeacherId;
-                this.form.btnType = 1;
-                this.dialogMemberVisible = true;
-                this.dialogTitle = '编辑区域'
-            },
-            // 禁用
-            // pauseRow(row) {
-            //     let that = this;
-            //     this.$confirm('是否禁用用户' + row.name + '?', '禁用操作', {
-            //         confirmButtonText: '确定',
-            //         cancelButtonText: '取消',
-            //         type: 'warning'
-            //     }).then(() => {
-            //         let param = {
-            //             token: localStorage.token,
-            //             Id: row.Id,
-            //             status: 0,
-            //         };
-            //         let postdata = qs.stringify(param);
-            //         testTable(postdata).then(res => {
-            //             let json = res;
-            //             if (json.Code == 0) {
-            //                 that.$message({
-            //                     showClose: true,
-            //                     message: row.name + '禁用成功!',
-            //                     type: 'success'
-            //                 });
-            //                 // table 重载
-            //                 that.getTableQuery();
-            //             } else {
-            //                 that.$message.error(json.Memo + ' 错误码:' + json.Code);
-            //             }
-            //         })
-            //     }).catch(() => {
-            //         this.$message({
-            //             type: 'info',
-            //             message: '已取消禁用'
-            //         });
-            //     });
-            // },
-            // 启用
-            // runRow(row) {
-            //     let that = this;
-            //     this.$confirm('是否启用用户' + row.name + '?', '启用操作', {
-            //         confirmButtonText: '确定',
-            //         cancelButtonText: '取消',
-            //         type: 'warning'
-            //     }).then(() => {
-            //         let param = {
-            //             token: localStorage.token,
-            //             Id: row.Id,
-            //             status: 1,
-            //         };
-            //         let postdata = qs.stringify(param);
-            //         testTable(postdata).then(res => {
-            //             let json = res;
-            //             if (json.Code == 0) {
-            //                 that.$message({
-            //                     showClose: true,
-            //                     message: row.name + '启用成功!',
-            //                     type: 'success'
-            //                 });
-            //                 // table 重载
-            //                 that.getTableQuery();
-            //             } else {
-            //                 that.$message.error(json.Memo + ' 错误码:' + json.Code);
-            //             }
-            //         })
-            //     }).catch(() => {
-            //         this.$message({
-            //             type: 'info',
-            //             message: '已取消启用'
-            //         });
-            //     });
-            // },
-            // 关闭所有
-            allDialogClose() {
-                this.dialogVisible = false;
-                this.dialogGift = false;
-                this.dialogLesson = false;
-                this.dialogExpTime = false;
-                this.dialogLessonTable = false;
-            },
-            // 确认提交新增区域
-            confirmMember() {
-                let that = this;
-                // checkNum
-                if (!that.form.name) {
-                    this.$message.error('错了哦,区域名称不能为空');
-                    return false
-                }
-                if (that.form.name.length > 16) {
-                    this.$message.error('错了哦,区域名称不能超过16个字符');
-                    return false
-                }
+let qs = require('qs');
+export default {
+  data() {
+    return {
+      dialogVisible: false,//其他dialog
+      dialogRegionVisible: false,//新增区域dialog
+      dialogTitle: '新增区域',
+      tableRadio: [],
+      start: 0,
+      draw: 1,
+      // panel 配置项目
+      panel: {
+        name: '',
+        draw: 1,
+        start: 0,
+        recordsTotal: 0,
+        tableData: [],
+        allTableData: [],
+        loading: false,
+        time1: globalBt(),
+      },
+      multipleSelection: [],
+      pagination: {
+        pageItem: 10,
+        pageOptions: pageOptions(),
+        total: 100,
+        pageIndex: 1,
+      },
+      form: {
+        name: '',
+        shopId: '',
+        svId: '',
+        btnType: 0,//0新建,1编辑编辑
+      },
+      tableData: []
+    }
+  },
+  mounted() {
+    this.getTableQuery();
+  },
+  methods: {
+    clickChange(item) {
+      this.tableRadio = item
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    clearForm() {
+      this.form.name = '';
+      this.form.svId = '';
+      this.form.shopId = '';
+    },
+    // 关闭所有弹出框
+    allDialogClose() {
+      this.dialogVisible = false;
+    },
+    // 新增区域
+    addRegion() {
+      this.clearForm();
+      this.dialogRegionVisible = true;
+      this.btnType = 0;
+      this.dialogTitle = '新增区域'
+    },
+    // 确认提交新增区域
+    confirmAddRegion() {
+      let that = this;
+      // checkNum
+      if (!that.form.name) {
+        this.$message.error('错了哦,区域名称不能为空');
+        return false
+      }
+      if (that.form.name.length > 16) {
+        this.$message.error('错了哦,区域名称不能超过16个字符');
+        return false
+      }
+
+      const jsonStr = {
+        shopId: localStorage.shopId,
+        venueName: this.form.name
+      };
 
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                    name: this.form.name
-                };
-                let postdata = qs.stringify(param);
-                AddShopVenue(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        // 关闭弹窗
-                        that.dialogMemberVisible = false;
-                        // 重载列表
-                        that.getTableQuery();
-                        that.$message({
-                            showClose: true,
-                            message: '区域添加成功!',
-                            type: 'success'
-                        });
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            confirmEditMember() {
-                let that = this;
-                // checkNum
-                if (!that.form.name) {
-                    this.$message.error('错了哦,区域名不能为空');
-                    return false
-                }
-                if (that.form.name.length > 16) {
-                    this.$message.error('错了哦,区域名字数超过16个字');
-                    return false
-                }
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                    svId: this.form.svId,
-                    name: this.form.name,
-                };
-                let postdata = qs.stringify(param);
-                EditShopVenue(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        // 关闭弹窗
-                        that.dialogMemberVisible = false;
-                        // 重载列表
-                        that.getTableQuery();
-                        that.$message({
-                            showClose: true,
-                            message: '区域信息编辑成功!',
-                            type: 'success'
-                        });
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            // 确认提交课时
-            confirmLesson() {
-                let that = this;
-                // checkNum
+      let paraRequest = new StandardRequest();
+      paraRequest.setShopid(localStorage.shopId);
+      paraRequest.setJsonstr(JSON.stringify(jsonStr));
+      paraRequest.setSign(getSignStr(jsonStr));
+      that.client.shopVenueAdd(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+        if (err == null) {
+          console.log(StandardReply.getJsonrst());
+          let res = JSON.parse(StandardReply);
+          if (res.code === 0) {
+            // 关闭弹窗
+            that.dialogRegionVisible = false;
+            // 重载列表
+            that.getTableQuery();
+            that.$message({
+              showClose: true,
+              message: '区域添加成功!',
+              type: 'success'
+            });
+          } else {
+            that.$message.error(res.memo + ',错误代码:' + res.code);
+          }
+        } else {
+          let res = err;
+          that.$message.error(res.message + ',错误代码:' + res.code);
+          console.log(res);
+        }
+      });
+    },
+    // 编辑
+    editRegion() {
+      let that = this;
+      this.clearForm();
+      console.log(this.tableRadio);
+      if (this.tableRadio.length == 0) {
+        this.$message.error("请先选中一条记录");
+        return false
+      }
+      let row = this.tableRadio;
+      this.form.name = row.name;
+      this.form.shopid = row.shop_id;
+      this.form.svId = row.uu_sv_id;
+      this.dialogVisible = true;
+      this.dialogTitle = '编辑区域';
+      this.form.btnType = 1;
+      this.dialogRegionVisible = true
+    },
+    //确认编辑区域
+    confirmEditRegion() {
+      let that = this;
+      // checkNum
+      if (!that.form.name) {
+        this.$message.error('错了哦,区域名不能为空');
+        return false
+      }
+      if (that.form.name.length > 16) {
+        this.$message.error('错了哦,区域名字数超过16个字');
+        return false
+      }
+      const jsonStr = {
+        UUSvId: this.form.svId,
+        venueName: this.form.name,
+      };
+      let paraRequest = new StandardRequest();
+      paraRequest.setShopid(localStorage.shopId);
+      paraRequest.setJsonstr(JSON.stringify(jsonStr));
+      paraRequest.setSign(getSignStr(jsonStr));
+      console.log(paraRequest);
+      that.client.shopVenueEdit(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+        if (err == null) {
+          console.log(StandardReply.getJsonrst());
+          let res = JSON.parse(StandardReply);
+          if (res.code === 0) {
+            // 关闭弹窗
+            that.dialogRegionVisible = false;
+            // 重载列表
+            that.getTableQuery();
+            that.$message({
+              showClose: true,
+              message: '区域信息编辑成功!',
+              type: 'success'
+            });
+          } else {
+            that.$message.error(res.memo + ',错误代码:' + res.code);
+          }
+        } else {
+          let res = err;
+          that.$message.error(res.message + ',错误代码:' + res.code);
+          console.log(res);
+        }
+      });
+    },
+    //删除
+    deleteRegion(row) {
+      let that = this;
 
-                let param = {
-                    token: localStorage.token,
-                    userCode: that.form.userCode,
-                    lesson: that.form.lesson,
-                };
-                let postdata = qs.stringify(param);
-                testSelect(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        // 关闭弹窗
-                        that.dialogVisible = false;
-                        // 重载列表
-                        that.getTableQuery();
-                        that.$message({
-                            showClose: true,
-                            message: '课时调整成功!',
-                            type: 'success'
-                        });
-                    } else {
-                        that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                    }
-                })
-            },
-            // 新增区域
-            addMember() {
-                this.clearForm();
-                this.dialogMemberVisible = true;
-                this.btnType = 0;
-                this.dialogTitle = '新增区域'
-            },
-            // 删除
-            delList() {
-                let that = this;
-                if (this.tableRadio.length == 0) {
-                    this.$message.error("请先选中一条记录");
-                    return false
-                }
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                    svId: this.tableRadio.SvId,
-                    status: 9,// 1:启用 8:暂停 9:删除
-                };
-                let postdata = qs.stringify(param);
 
-                this.$confirm('此操作将永久删除该区域, 是否继续?', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    ShopVenueStatusEdit(postdata).then(res => {
-                        let json = res;
-                        if (json.Code == 0) {
-                            that.$message({
-                                showClose: true,
-                                message: '选中的区域已删除!',
-                                type: 'success'
-                            });
-                            // 重载列表
-                            that.getTableQuery();
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    });
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消删除'
-                    });
-                });
-            },
+      this.$confirm('此操作将永久删除该区域设备, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
 
-            handleSelectionChange(val) {
-                this.multipleSelection = val;
-            },
-            // 查询按钮
-            query() {
-                this.getTableQuery();
-                this.$message.success('查询完毕');
-            },
-            clearForm() {
-                // clear
-                this.form.name = '';
-                this.form.svId = '';
-                this.form.phone = '';
-                this.form.userCode = '';
-                this.form.shopId = '';
-            },
-            // 页面数据查询
-            getTableQuery() {
-                let that = this;
-                that.loading = true;
-                let param = {
-                    key: localStorage.ServiceKey,
-                    shopId: localStorage.ServiceId,
-                };
-                let postdata = qs.stringify(param);
-                QueryShopVenue(postdata).then(res => {
-                    let json = res;
-                    if (json.Code == 0) {
-                        that.loading = false;
-                        if (json.Rs) {
-                            that.allTableData = json.Rs;
-                            that.recordsTotal = json.Rs.length;
-                        } else {
-                            that.allTableData = [];
-                            that.recordsTotal = 0;
-                        }
+        const jsonStr = {
+          shopId: localStorage.shopId,
+          UUSvId: row.uu_sv_id,
+          status: 9,// 1:启用 8:暂停 9:删除
+        };
+        let paraRequest = new StandardRequest();
+        paraRequest.setShopid(localStorage.shopId);
+        paraRequest.setJsonstr(JSON.stringify(jsonStr));
+        paraRequest.setSign(getSignStr(jsonStr));
+        console.log(paraRequest);
+        that.client.shopVenueStatusEdit(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+          if (err == null) {
+            console.log(StandardReply.getJsonrst());
+            let res = JSON.parse(StandardReply);
+            if (res.code === 0) {
+              that.$message({
+                showClose: true,
+                message: '选中的区域设备已删除!',
+                type: 'success'
+              });
+              // 重载列表
+              that.getTableQuery();
+            } else {
+              that.$message.error(res.memo + ',错误代码:' + res.code);
+            }
+          } else {
+            let res = err;
+            that.$message.error(res.message + ',错误代码:' + res.code);
+            console.log(res);
+          }
+        });
 
-                        // 设置分页数据
-                        that.setPagination();
-                    } else {
-                        if (!localStorage.ServiceKey) {
-                            that.$message.error('还未与心率系统对接,请联系管理员');
-                        } else {
-                            that.$message.error(json.Memo + ' 错误码:' + json.Code);
-                        }
-                    }
-                })
-            },
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
+    //设备管理页面
+    goPage(row) {
+      this.$router.push({
+        path: '/shopDevice', query: {
+          name: row.name,
+          svId: row.uu_sv_id
+        }
+      });
+    },
+    // 查询按钮
+    query() {
+      this.getTableQuery();
+      this.$message.success('查询完毕');
+    },
+    // 页面数据查询
+    getTableQuery() {
+      let that = this;
+      that.loading = true;
+      const jsonStr = {
+        shopId: localStorage.shopId
+      };
+      let paraRequest = new StandardRequest();
+      paraRequest.setShopid(localStorage.shopId);
+      paraRequest.setJsonstr(JSON.stringify(jsonStr));
+      paraRequest.setSign(getSignStr(jsonStr));
+      console.log(paraRequest);
+      that.client.shopVenueQuery(paraRequest, {"Token": localStorage.token}, (err, StandardReply) => {
+        if (err == null) {
+          console.log(StandardReply.getJsonrst());
+          let res = JSON.parse(StandardReply);
+          if (res.code === 0) {
+            that.loading = false;
+            if (res.rs) {
+              that.allTableData = res.rs;
+              that.recordsTotal = res.rs.length;
+            } else {
+              that.allTableData = [];
+              that.recordsTotal = 0;
+            }
             // 设置分页数据
-            setPagination() {
-                // 分页属性
-                let that = this;
-                that.pagination.total = that.recordsTotal;
+            that.setPagination();
+          } else {
+            that.$message.error(res.memo + ',错误代码:' + res.code);
+          }
+        } else {
+          let res = err;
+          that.$message.error(res.message + ',错误代码:' + res.code);
+          console.log(res);
+        }
+      });
+    },
+    // 设置分页数据
+    setPagination() {
+      // 分页属性
+      let that = this;
+      that.pagination.total = that.recordsTotal;
 
-                // 默认分页
-                that.tableData = that.allTableData.filter((item, index) => {
-                    return index < that.pagination.pageItem;
-                });
-            },
-            // 每页显示数量
-            handleSizeChange() {
-                let that = this;
-                that.tableData = that.allTableData.filter((item, index) => {
-                    return index < that.pagination.pageItem;
-                });
-                that.draw = that.pagination.pageItem;
-                // that.getTableQuery();
-            },
-            // 翻页
-            pageChange(pageIndex) {
-                let that = this;
-                // 获取当前页
-                let index = that.pagination.pageItem * (pageIndex - 1);
-                // 数据总数
-                let nums = that.pagination.pageItem * pageIndex;
-                // 容器
-                let tables = [];
-                for (var i = index; i < nums; i++) {
-                    if (that.allTableData[i]) {
-                        tables.push(that.allTableData[i])
-                    }
-                    this.tableData = tables;
-                }
-                that.start = index * that.draw;
-                // that.getTableQuery();
-            },
-            // 自动排序
-            sortChange(params) {
-                console.log(params)
-            },
-            // 过滤时间
-            filterFmtDate(value, row, column) {
-                let that = this;
-                return nonTfmtDate(column, 11);
-            },
-        },
-    }
+      // 默认分页
+      that.tableData = that.allTableData.filter((item, index) => {
+        return index < that.pagination.pageItem;
+      });
+    },
+    // 每页显示数量
+    handleSizeChange() {
+      let that = this;
+      that.tableData = that.allTableData.filter((item, index) => {
+        return index < that.pagination.pageItem;
+      });
+      that.draw = that.pagination.pageItem;
+      // that.getTableQuery();
+    },
+    // 翻页
+    pageChange(pageIndex) {
+      let that = this;
+      // 获取当前页
+      let index = that.pagination.pageItem * (pageIndex - 1);
+      // 数据总数
+      let nums = that.pagination.pageItem * pageIndex;
+      // 容器
+      let tables = [];
+      for (let i = index; i < nums; i++) {
+        if (that.allTableData[i]) {
+          tables.push(that.allTableData[i])
+        }
+        this.tableData = tables;
+      }
+      that.start = index * that.draw;
+      // that.getTableQuery();
+    },
+    // 自动排序
+    sortChange(params) {
+      console.log(params)
+    },
+    // 过滤时间
+    filterFmtDate(value, row, column) {
+      let that = this;
+      return nonTfmtDate(column, 11);
+    },
+  },
+}
 </script>
 
 <style scoped>
-    @import "../../assets/css/panel.css";
+@import "../../assets/css/panel.css";
 
-    .context {
-        /* height: 770px; */
-        overflow-y: scroll;
+.context {
+  /* height: 770px; */
+  overflow-y: scroll;
 
-        display: block;
-        margin: 0 auto;
-        background-color: #fff !important;
-        padding: 30px;
-    }
+  display: block;
+  margin: 0 auto;
+  background-color: #fff !important;
+  padding: 30px;
+}
 
-    .panel-body {
-        padding: 20px;
-        background: #F0F2F5;
-    }
+.panel-body {
+  padding: 20px;
+  background: #F0F2F5;
+}
 
-    .change {
-        width: 100%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-        padding-top: 10px;
-        padding-bottom: 10px;
-    }
+.change {
+  width: 100%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+  padding-top: 10px;
+  padding-bottom: 10px;
+}
 
-    .change button {
-        float: left;
-    }
+.change button {
+  float: left;
+}
 
-    .change button.pull-right {
-        float: right;
-    }
+.change button.pull-right {
+  float: right;
+}
 
-    .dialogTitle {
-        width: 100%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-        color: #000000;
-        font-size: 18px;
-        text-align: center;
-    }
+.dialogTitle {
+  width: 100%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+  color: #000000;
+  font-size: 18px;
+  text-align: center;
+}
 
-    .dialogTitle em {
-        float: none;
-        font-style: normal;
-        color: #3799FF;
-        margin: 0;
-    }
+.dialogTitle em {
+  float: none;
+  font-style: normal;
+  color: #3799FF;
+  margin: 0;
+}
 
-    /deep/ .el-transfer-panel__item .el-checkbox__input {
-        left: 40px;
-    }
+/deep/ .el-transfer-panel__item .el-checkbox__input {
+  left: 40px;
+}
 
-    .dialogFooter {
-        width: 90%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-        margin-top: 10px;
-    }
+.dialogFooter {
+  width: 90%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+  margin-top: 10px;
+}
 
-    .dialogFooter button {
-        float: right;
-        margin-left: 10px;
-    }
+.dialogFooter button {
+  float: right;
+  margin-left: 10px;
+}
 
-    .dialogContent {
-        width: 100%;
-        overflow: hidden;
-        display: block;
-        margin: 0 auto;
-    }
+.dialogContent {
+  width: 100%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+}
 
-    .dialogContent .pull-left {
-        width: 30%;
-        float: left;
-    }
+.dialogContent .pull-left {
+  width: 30%;
+  float: left;
+}
 
-    .dialogContent .pull-right {
-        width: 70%;
-        float: right;
-    }
+.dialogContent .pull-right {
+  width: 70%;
+  float: right;
+}
 </style>

+ 365 - 0
src/views/SystemManage/regionEquip.vue

@@ -0,0 +1,365 @@
+<template>
+  <div class="context">
+    <div class="panel">
+      <h5>所属设备 -- xx区域</h5>
+    </div>
+    <div class="table">
+      <el-table
+          :data="tableData"
+          border
+          is-horizontal-resize
+          :default-sort="{prop: 'date', order: 'descending'}"
+          element-loading-background="rgba(0, 0, 0, 0.8)"
+          class=""
+      >
+        <el-table-column
+            type="index"
+            label="序号"
+            align="center"
+            width="50">
+        </el-table-column>
+        <el-table-column
+            prop="CreatedAt"
+            label="日期"
+            :formatter="filterFmtDate"
+            sortable
+        >
+        </el-table-column>
+        <el-table-column
+            prop="OptName"
+            label="操作者"
+            sortable
+        >
+        </el-table-column>
+        <el-table-column
+            prop="OptInfo"
+            label="操作信息"
+            sortable
+        >
+          <template slot-scope="scope">
+                        <el-button type="success" @click="run(scope.row.id)" v-if="scope.row.Status != 4">开启</el-button>
+                        <el-button type="danger" @click="pause(scope.row.id)" v-if="scope.row.Status == 4">暂停</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <br>
+      <el-pagination
+          background
+          :total="pageination.total"
+          :page-size="pageination.pageItem"
+          @current-change="pageChange"
+      ></el-pagination>
+    </div>
+
+  </div>
+</template>
+
+<script>
+import Global from '../../Global.js'
+import {
+  OptLogListQuery,
+  testTable,
+  testSelect, ShopManagerListQuery, ShopListQuery
+} from "../../api/getApiRes";
+
+let qs = require('qs');
+export default {
+  data() {
+    return {
+      dialogVisible: false,
+      dialogTitle: '新增管理员',
+      times: globalBt2(7),
+      // panel 配置项目
+      panel: {
+        userCode: '',
+        tel: '',
+        userId: '',
+        shopList: 0,
+        shopId: '',
+        options: [],
+        shopOptions: [],
+        draw: 1,
+        start: 0,
+        recordsTotal: 0,
+        tableData: [],
+        allTableData: [],
+        limit: '10',
+        multipleSort: false,
+        loading: false,
+        fileList: [],
+        multipleSelection: [],
+        detectedmac: '',
+        time1: globalBt(),
+        timeScope: globalBt2(30),
+      },
+      multipleSelection: [],
+      pageination: {
+        pageItem: 10,
+        pageoptions: pageOptions(),
+        total: 100,
+        pageIndex: 1,
+      },
+      form: {
+        name: '',
+        userCode: '',
+        shopId: '',
+      },
+      shops: [],
+      tableData: [],
+      serachBtnStatus: false,
+    }
+  },
+  mounted() {
+    this.panelSelect();
+    this.shopPanelSelect();
+    this.getTableQuery();
+  },
+  methods: {
+    shopPanelSelect(){
+      let that = this;
+      let param = {
+        token: localStorage.token,
+      };
+      let postdata = qs.stringify(param);
+      ShopListQuery(postdata).then(res => {
+        let json = res;
+        if (json.Code == 0) {
+          if (json.Rs == '') {
+            that.$message.error('当前没有可选的店铺,请先在店面管理中添加店铺!');
+            return false
+          }
+          that.panel.shopOptions = turnShopResToOption(json.Rs);
+          that.panel.shopOptions.unshift({value: '', label: "全部"});
+        } else {
+          that.$message.error(json.Memo + ' 错误码:' + json.Code);
+        }
+      })
+    },
+    // 加载选项
+    panelSelect() {
+      let that = this;
+      let param = {
+        token: localStorage.token,
+        start: 1,
+        tableMax: 999,
+      };
+      let postdata = qs.stringify(param);
+      ShopManagerListQuery(postdata).then(res => {
+        let json = res;
+        if (json.Code == 0) {
+          that.panel.options = this.turnResToOptionByUsers(json.Rs);
+          that.panel.options.unshift({value: '', label: "全部"});
+          console.log(that.panel.options);
+        } else {
+          that.$message.error(json.Memo + ' 错误码:' + json.Code);
+        }
+      })
+    },
+    turnResToOptionByUsers(data) {
+      if (!data) return false
+      let ids = data.map(item => {
+        return {
+          label: item.Name + ' ' + item.Phone,
+          key: parseInt(item.Id),
+          value: parseInt(item.Id),
+        }
+      })
+      return ids
+    },
+    clearForm() {
+      // clear
+      this.form.name = '';
+      this.form.userCode = '';
+      this.form.shopId = '';
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    // 查询按钮
+    query() {
+      // 按钮倒计时
+      let that = this;
+      that.serachBtnStatus = true;
+      let totalTime = 2
+      let clock = window.setInterval(() => {
+        totalTime--
+        if (totalTime < 0) {
+          totalTime = 2;
+          that.serachBtnStatus = false;
+        }
+      }, 1000)
+
+      this.getTableQuery();
+      this.$message.success('查询完毕');
+    },
+    // 页面数据查询
+    getTableQuery() {
+      let that = this;
+      // this.getGetChildRegionSelect(0, 1);
+      that.loading = true;
+      // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
+      let param = {
+        token: localStorage.token,
+        name: this.panel.name,
+        phone: this.panel.phone,
+        userId: this.panel.userId,
+        bt: nonTfmtDatetoLength(that.panel.timeScope[0], 10) + " 00:00:00",
+        et: nonTfmtDatetoLength(that.panel.timeScope[1], 10) + " 23:59:59",
+        start: 1,//
+        tableMax: 9999,//
+        optShopId:this.panel.shopId,
+      };
+      let postdata = qs.stringify(param);
+      OptLogListQuery(postdata).then(res => {
+        let json = res;
+        if (json.Code == 0) {
+          that.loading = false;
+          if (json.Rs) {
+            that.allTableData = json.Rs;
+            that.recordsTotal = json.Rs.length;
+          } else {
+            that.allTableData = [];
+            that.recordsTotal = 0;
+          }
+          // 设置分页数据
+          that.setPagination();
+        } else {
+          that.$message.error(json.Memo + ' 错误码:' + json.Code);
+        }
+      })
+    },
+    // 设置分页数据
+    setPagination() {
+      // 分页属性
+      let that = this;
+      that.pageination.total = that.recordsTotal;
+      // 默认分页
+      that.tableData = that.allTableData.filter((item, index) => {
+        return index < that.pageination.pageItem;
+      });
+    },
+    // 每页显示数量
+    handleSizeChange() {
+      let that = this;
+      that.tableData = that.allTableData.filter((item, index) => {
+        return index < that.pageination.pageItem;
+      });
+      that.draw = that.pageination.pageItem;
+      that.getTableQuery();
+    },
+    // 翻页
+    pageChange(pageIndex) {
+      let that = this;
+      // 获取当前页
+      let index = that.pageination.pageItem * (pageIndex - 1);
+      // 数据总数
+      let nums = that.pageination.pageItem * pageIndex;
+      // 容器
+      let tables = [];
+      for (var i = index; i < nums; i++) {
+        if (that.allTableData[i]) {
+          tables.push(that.allTableData[i])
+        }
+        this.tableData = tables;
+      }
+      that.start = index * that.draw;
+      // that.getTableQuery();
+    },
+    // 自动排序
+    sortChange(params) {
+      console.log(params)
+    },
+    // 过滤时间
+    filterFmtDate(value, row, column) {
+      let that = this;
+      return nonTfmtDate(column, 11);
+    },
+  },
+}
+</script>
+
+<style scoped>
+@import "../../assets/css/panel.css";
+
+.context {
+  /* height: 770px; */
+  overflow-y: scroll;
+
+  display: block;
+  margin: 0 auto;
+  background-color: #fff !important;
+  padding: 30px;
+  padding-bottom: 60px;
+}
+
+.panel-body {
+  padding: 20px;
+  background: #F0F2F5;
+}
+
+.change {
+  width: 100%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+  padding-top: 10px;
+  padding-bottom: 10px;
+}
+
+.change button {
+  float: left;
+}
+
+.change button.pull-right {
+  float: right;
+}
+
+.dialogTitle {
+  width: 100%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+  color: #000000;
+  font-size: 18px;
+  text-align: center;
+}
+
+.dialogTitle em {
+  float: none;
+  font-style: normal;
+  color: #3799FF;
+  margin: 0;
+}
+
+/deep/ .el-transfer-panel__item .el-checkbox__input {
+  left: 40px;
+}
+
+.dialogFooter {
+  width: 90%;
+  overflow: hidden;
+  display: block;
+  margin: 0 auto;
+  margin-top: 10px;
+}
+
+.dialogFooter button {
+  float: right;
+  margin-left: 10px;
+}
+
+/deep/ .el-date-editor .el-range__icon {
+  line-height: 22px;
+}
+
+.panel /deep/ .el-date-editor .el-range-separator {
+  line-height: 22px;
+}
+/*ipad only*/
+@media only screen and (max-width: 1366px) {
+  .panel /deep/ .el-date-editor--daterange {
+    width: 100%;
+  }
+}
+
+</style>