deviceLink_frm.html 11.8 KB
<!DOCTYPE html>
<html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
      <meta name="referrer" content="no-referrer">
      <title>数据联动</title>
      <link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/api.css"/>
      <link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/aui.css"/>
      <link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/home.css"/>
      <link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/element.css"/>
      <link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/style.css"/>
      <link rel="stylesheet" type="text/css" href="http://iot.uccc.cc:9090/app/css/mine/mine.css"/>

      <style>
          html,
          body{
            background-color: #F4F6F9;
          }
      </style>
  </head>
  <body>
    <div id="app">
      <template>
        <div class="device-list-outside">
          <div class="device-list-area">
            <div class="device-info-card" v-for="(list_d, list_i) in sceneList">
              <div class="store01001-device-details-list-panel-inside">
                <el-row class="device-info-card-inside" style="margin-top: 15px;padding-left:5px;padding-right:5px;">
                  <p>
                    <span style="height:8px;width: 8px;background: #5B7FF8;border-radius: 4px;line-height: 5rem;"></span>
                    <span style="font-size: 16px;">{{ list_d.scene_name }}</span>
                    <img src="http://iot.uccc.cc:9090/product/06001/icon-edit.png" style="height: 16px;width: 16px;float: right;"  tapmode @click="handleEdit"/>
                    <img src="http://iot.uccc.cc:9090/product/06001/icon-delete.png" style="height: 16px;width: 16px;float: right;margin-right: 20px;" tapmode @click="handleDelete"/>
                  </p>
                  <el-row style="margin-top: 15px;">
                  <el-col :span=5>
                    <div class="card-img" style="height: 60px;width: 60px;">
                      <img :src="list_d.store.storeType.pic_url" style="height: 100%;"/>
                    </div>
                  </el-col>
                  <el-col :span=1>&nbsp;</el-col>
                  <el-col :span=18 style="font-size: 12px;">
                    <el-row>
                      <span v-if="list_d.store.online === '在线'" class="device-status-online" style="width: 40px;">
                        <span>在线</span>
                      </span>
                      <span v-if="list_d.store.online === '离线'" class="device-status-offline" style="width: 40px;">
                        <span>离线</span>
                      </span>
                      <span v-if="!list_d.storeDetail.switch" class="device-status-online" style="width: 40px;color: #70C248;">
                        <span>分闸</span>
                      </span>
                      <span v-if="list_d.storeDetail.switch" class="device-status-online" style="width: 40px;color: #F26161;border:1px solid #F26161;">
                        <span>合闸</span>
                      </span>
                    </el-row>
                    <el-row>
                      <el-col :span=24 style="margin-top: 0.2rem;">
                        <span class="device-code" style="color: #37394E;"><span v-if="userType === 1">设备</span><span v-if="userType === 2">项目</span>名称:{{  }}</span>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span=24 style="margin-top: 0.2rem;">
                        <span class="device-code" style="color: #37394E;">设备编号:{{ list_d.imei }}</span>
                      </el-col>
                    </el-row>
                  </el-col>
                  </el-row>
                </el-row>
                <div style="height: 1px;width: 100%;background: #F0F5FF;"></div>
                <!-- 温度联动 -->
                <p style="margin-top: 15px;margin-bottom: 10px;color: #37394E;">{{temp_link}}</p>
                <el-row style="background: #F4F6F9;height: 44px;text-align: center;margin-bottom: 10px;">
                  <el-col :span=1>&nbsp;</el-col>
                  <el-col :span=2>
                    <img src="http://iot.uccc.cc:9090/product/06001/icon-if.png" style="height: 24px;width: 24px;margin: 10px auto;" />
                  </el-col>
                  <el-col :span=12 style="line-height: 44px;">
                    <span style="font-size: 12px;color: #37394E;">如果:<span style="font-weight: bold;">大于等于{{ list_d.temp_max }}℃</span></span>
                  </el-col>
                  <el-col :span=2>
                    <img src="http://iot.uccc.cc:9090/product/06001/icon-todo.png" style="height: 24px;width: 24px;margin: 10px auto;" />
                  </el-col>
                  <el-col :span=7 style="line-height: 44px;">
                    <span style="font-size: 12px;color: #37394E;">执行:<span style="font-weight: bold;">{{ list_d.temp_max_action }}</span></span>
                  </el-col>
                </el-row>
                <el-row style="background: #F4F6F9;height: 44px;text-align: center;">
                  <el-col :span=1>&nbsp;</el-col>
                  <el-col :span=2>
                    <img src="http://iot.uccc.cc:9090/product/06001/icon-if.png" style="height: 24px;width: 24px;margin: 10px auto;" />
                  </el-col>
                  <el-col :span=12 style="line-height: 44px;">
                    <span style="font-size: 12px;color: #37394E;">如果:<span style="font-weight: bold;">小于等于{{ list_d.temp_min }}℃</span></span>
                  </el-col>
                  <el-col :span=2>
                    <img src="http://iot.uccc.cc:9090/product/06001/icon-todo.png" style="height: 24px;width: 24px;margin: 10px auto;" />
                  </el-col>
                  <el-col :span=7 style="line-height: 44px;">
                    <span style="font-size: 12px;color: #37394E;">执行:<span style="font-weight: bold;">{{ list_d.temp_min_action }}</span></span>
                  </el-col>
                </el-row>
                <!-- 湿度联动 -->
                <p style="margin-top: 15px;margin-bottom: 10px;color: #37394E;">{{rh_link}}</p>
                <el-row style="background: #F4F6F9;height: 44px;text-align: center;margin-bottom: 10px;">
                  <el-col :span=1>&nbsp;</el-col>
                  <el-col :span=2>
                    <img src="http://iot.uccc.cc:9090/product/06001/icon-if.png" style="height: 24px;width: 24px;margin: 10px auto;" />
                  </el-col>
                  <el-col :span=12 style="line-height: 44px;">
                    <span style="font-size: 12px;color: #37394E;">如果:<span style="font-weight: bold;">大于等于80%</span></span>
                  </el-col>
                  <el-col :span=2>
                    <img src="http://iot.uccc.cc:9090/product/06001/icon-todo.png" style="height: 24px;width: 24px;margin: 10px auto;" />
                  </el-col>
                  <el-col :span=7 style="line-height: 44px;">
                    <span style="font-size: 12px;color: #37394E;">执行:<span style="font-weight: bold;">分闸</span></span>
                  </el-col>
                </el-row>
                <el-row style="background: #F4F6F9;height: 44px;text-align: center;">
                  <el-col :span=1>&nbsp;</el-col>
                  <el-col :span=2>
                    <img src="http://iot.uccc.cc:9090/product/06001/icon-if.png" style="height: 24px;width: 24px;margin: 10px auto;" />
                  </el-col>
                  <el-col :span=12 style="line-height: 44px;">
                    <span style="font-size: 12px;color: #37394E;">如果:<span style="font-weight: bold;">小于等于20%</span></span>
                  </el-col>
                  <el-col :span=2>
                    <img src="http://iot.uccc.cc:9090/product/06001/icon-todo.png" style="height: 24px;width: 24px;margin: 10px auto;" />
                  </el-col>
                  <el-col :span=7 style="line-height: 44px;">
                    <span style="font-size: 12px;color: #37394E;">执行:<span style="font-weight: bold;">合闸</span></span>
                  </el-col>
                </el-row>
                <div style="height: 15px;"></div>
              </div>
            </div>
          </div>
        </div>
        <div class="login-out-btn" tapmode @click="addScene">添加联动场景</div>
      </template>
    </div>
  </body>
  <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/api.js"></script>
  <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/jquery-3.3.1.min.js"></script>
  <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/vue.min.js"></script>
  <!-- <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/common.js"></script> -->
  <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/element.js"></script>
  <!-- <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/ctrl.js"></script> -->
  <script type="text/javascript" src="http://iot.uccc.cc:9090/app/js/fastclick.js "></script>
  <script type="text/javascript" src="../../../script/common.js"></script>
  <script type="text/javascript" src="../../../script/ctrl.js"></script>
  <script type="text/javascript">
      var vm, that;
      apiready = function(){
        api.parseTapmode();
        $(function() {
                  FastClick.attach(document.body);
        }); 

          //---------初始化vue
          vm = new Vue({
            el: '#app',
            data: {
              temp_link: '温度联动',
              rh_link: '湿度联动',
              imei: api.pageParam.imei,
              token: api.getPrefs({sync: true,key: 'userToken'}),
              sceneList: [],
              userType: Number(api.getPrefs({sync: true,key: 'userType'})),
            },
            mounted() {
              //window.chooseProduct = this.chooseProduct;
            },
            created() {
              this.getSceneList() //获取场景列表
              that = this
              /** 下拉刷新 */
              api.setRefreshHeaderInfo({
                  loadingImg:'widget://image/alpha0.png',
                  bgColor: '#5B7FF8',
                  textColor: 'rgba(255,255,255,0.5)',
                  textDown: '下拉刷新...',
                  textUp: '松开刷新...'
              }, function(ret, err) {
                that.getSceneList();
              });
              // setTimeout(() => {
              //   this.addScene() 
              // }, 1000);
            },
            methods: {
              handleEdit() {
                console.log('1111');
              },
              handleDelete() {
                console.log('222');
              },
              async getSceneList() {
                let params = {
                  imei: this.imei,
                  token: this.token
                }
                let sceneList = await get_scene_list_by_imei(params) //温湿度设备的imei
                api.refreshHeaderLoadDone();
                this.sceneList = []
                if (sceneList.code === 0) {
                  this.sceneList = sceneList.data
                }
                
              },
              addScene() {
                api.openWin({
                  name: 'addScence_win',
                  // url: 'http://iot.uccc.cc:9090/app_html/store02001/device_details_win.html',
                  url: './addScence_win.html',
                  bounces: true,
                  pageParam: {
                    wsdimei: api.pageParam.imei
                  }
                });
              }
            }
          })
      };
  </script>
</html>