webpackJsonp([73],{

/***/ "SEBt":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ }),

/***/ "bL+H":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/babel-runtime/core-js/json/stringify.js
var stringify = __webpack_require__("mvHQ");
var stringify_default = /*#__PURE__*/__webpack_require__.n(stringify);

// EXTERNAL MODULE: ./src/api/index.js + 5 modules
var api = __webpack_require__("gyMJ");

// EXTERNAL MODULE: ./src/utils/index.js
var utils = __webpack_require__("0xDb");

// EXTERNAL MODULE: ./node_modules/xlsx/xlsx.js
var xlsx = __webpack_require__("uXZL");
var xlsx_default = /*#__PURE__*/__webpack_require__.n(xlsx);

// EXTERNAL MODULE: ./src/utils/util.js
var util = __webpack_require__("oFuF");

// EXTERNAL MODULE: ./node_modules/moment/moment.js
var moment = __webpack_require__("PJh5");
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);

// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/bluetoothUnlockRecord.vue

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//






/* harmony default export */ var bluetoothUnlockRecord = ({
  inject: ['reload'],
  name: "warningLog",
  data: function data() {
    return {
      pageSize: 20,
      pageNum: 1,
      defaultProps: {
        children: "children",
        label: "name"
      },
      config: {
        header: ["设备号", "开锁方式", "开锁时间"],
        data: [["", "", "", ""]],
        rowNum: 7, //表格行数
        headerHeight: 35,
        headerBGC: "#0f1325", //表头
        oddRowBGC: "#0f1325", //奇数行
        evenRowBGC: "#171c33", //偶数行
        index: false,
        columnWidth: [200, 200, 200, 200],
        align: ["center"]
      },
      query: {
        openType: 5,
        operateName: "",
        operModul: "",
        datePicker: ['', ''],
        cardName: ""
      },
      query1: {
        openType: "",
        operateName: "",
        operModul: ""
      },
      activeName: "first",
      tableData: [],
      tableData1: [],
      multipleSelection: [],
      delList: [],
      editVisible: false,
      pageTotal: 0,
      pageTotal1: 0,
      form: {},
      idx: -1,
      id: -1,
      logList: [],
      options: [],
      selectRoomId: "",
      openRoom: false,
      selectkey: [],
      userInfo: {
        type: ''
      },
      checkNodeId: []
    };
  },
  beforeCreate: function beforeCreate() {
    // var tenantId = JSON.parse(localStorage.getItem('tenantId'))
    // if (tenantId == 400) {
    //   this.$store.commit('defaultsettenantid')
    // }
  },
  created: function created() {
    var _this = this;

    this.userInfo = JSON.parse(localStorage.getItem('info'));
    var data = {
      package: 1,
      q: stringify_default()({
        lockType: 1
      })
    };
    Object(api["g" /* httpPost */])(data, this.$api.getDeviceItems).then(function (res) {
      _this.$store.commit("deviceFun", res.data.list);
    });
    this.getalllist();
    // this.selectoption=JSON.parse(localStorage.getItem('selectoption'))
    // this.selectoptionValue=localStorage.getItem('tenantId')
  },
  mounted: function mounted() {
    // this.getlockAlert();
    this.getcard();
  },

  methods: {
    // 选择房源
    checkNode: function checkNode(e) {
      this.checkNodeId = e;
      var options = this.options;
      var arr = this.getId(options, e[e.length - 1]);
      var listarr = [arr[0]];
      var obj = this.getNodeId(listarr);
      this.checkNodeId = obj;
    },
    getParentId: function getParentId(list, id) {
      for (var i in list) {
        if (list[i].id == id) {
          return [list[i]];
        }
        if (list[i].children) {
          var node = this.getParentId(list[i].children, id);
          if (node !== undefined) {
            return node.concat(list[i]);
          }
        }
      }
    },
    getId: function getId(list, id) {
      for (var i in list) {
        if (list[i].id == id) {
          return [list[i]];
        }
        if (list[i].children) {
          var node = this.getParentId(list[i].children, id);
          if (node !== undefined) {
            return node;
          }
        }
      }
    },
    getNodeId: function getNodeId(list) {
      var newNodeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

      for (var i in list) {
        newNodeId.push(list[i].id);
        if (list[i].children) {
          this.getNodeId(list[i].children, newNodeId);
        }
      }
      return newNodeId;
    },
    resetAll: function resetAll() {
      this.query = {
        openType: 5,
        operateName: "",
        operModul: "",
        datePicker: ['', ''],
        cardName: ""
      };
      this.handleSearch();
    },

    // selectTenantId(e) {
    //   localStorage.setItem('tenantId', e)
    //   this.reload()
    // },
    exportFun: function exportFun() {
      var data = {
        orderBy: "open_time desc",
        q: stringify_default()({
          roomId: this.selectRoomId,
          openType: this.query.openType
        })
      };
      Object(api["a" /* download */])(data, this.$api.export).then(function (res) {
        var link = document.createElement("a");
        var blob = new Blob([res], {
          type: "application/vnd.ms-excel"
        });
        var objectUrl = URL.createObjectURL(blob);
        link.href = objectUrl;
        link.download = "开锁记录.xlsx";
        link.click();
        URL.revokeObjectURL(objectUrl);
      });
    },
    handleCheckChange: function handleCheckChange(data, checked, node) {
      if (checked) {
        this.selectRoomId = data.id;
        this.query.operateName = data.name;
        this.$refs.tree.setCheckedKeys([data.id]);
      } else {
        if (this.checkedId == data.id) {
          this.$refs.tree.setCheckedKeys([data.id]);
        }
      }
    },
    handleClose: function handleClose(done) {
      this.openRoom = false;
    },

    // 打开房间选择列表
    openRoomlist: function openRoomlist() {
      this.openRoom = true;
    },
    handleChange: function handleChange(value) {
      console.log(value);
      this.selectRoomId = value[value.length - 1];
    },

    //获取房源筛选列表
    getalllist: function getalllist() {
      var _this2 = this;

      var data = {};
      Object(api["d" /* httpGet */])(data, this.$api.getTree).then(function (res) {
        var list = res.data.sort(function (pre, cur) {
          return pre.id - cur.id;
        });
        var array = Object(utils["n" /* uniqueArray */])(list, "id");
        _this2.options = Object(utils["p" /* ztreeToElementTree */])(array, {});
      });
    },
    timestampToTime: function timestampToTime(cjsj) {
      if (cjsj.toString().length == 10) {
        cjsj = cjsj * 1000;
      }
      var date = new Date(cjsj); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
      var Y = date.getFullYear() + "-";
      var M = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1) + "-";
      var D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
      var h = (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
      var m = (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) + ":";
      var s = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
      return Y + M + D + h + m + s;
    },
    getOpenType: function getOpenType(openType) {
      var str = "";
      switch (openType) {
        case 1:
          str = "指纹开锁";
          break;
        case 2:
          str = "数字键盘开锁";
          break;
        case 3:
          str = "NFC开锁";
          break;
        case 4:
          str = "机械钥匙开锁";
          break;
        case 5:
          str = "蓝牙开锁";
          break;
        case 6:
          str = "NB开锁";
          break;
        case 7:
          str = "身份证";
          break;
        case 8:
          str = "无线钥匙开锁";
          break;
        case 9:
          str = "人脸开锁";
          break;
        case 10:
          str = "离线卡开锁";
          break;
        default:
          str = "其它开锁";
          break;
      }
      return str;
    },
    screenRoomName: function screenRoomName(id) {
      var name = util["a" /* default */].findIndexArray(this.options, id, []);
      var path = '';
      if (name) {
        path = name.join('/');
      }
      return path;
    },
    screenRoomNameOne: function screenRoomNameOne(imei) {
      return this.$store.state.deviceList.filter(function (item) {
        return item.imei == imei;
      })[0];
    },
    getcard: function getcard() {
      var _this3 = this;

      var operUrl = "",
          q = {};
      if (this.query.openType == 5) {
        operUrl = "/v1/device/send/bleCommand";
        var roomid = this.checkNodeId.length > 0 ? this.checkNodeId.splice(this.checkNodeId.length - 1, 1) : [];
        q = this.searchParaProcess({
          operRequ: "bleUnlockRecord",
          roomIds: roomid,
          startTime: this.query.datePicker[0],
          endTime: this.query.datePicker[1],
          // operUrl:operUrl,
          request: [this.query.cardName]
        });
      } else if (this.query.openType == 6) {
        operUrl = "/v1/device/isp/openLock";
        var roomid = this.checkNodeId.length > 0 ? this.checkNodeId.splice(this.checkNodeId.length - 1, 1) : [];
        q = this.searchParaProcess({
          // openType: this.query.openType,
          roomIds: roomid,
          startTime: this.query.datePicker[0],
          endTime: this.query.datePicker[1],
          operUrl: operUrl,
          request: [this.query.cardName]
        });
      }
      var data1 = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        orderType: "desc",
        orderBy: "createAt",
        q: q
      };
      Object(api["g" /* httpPost */])(data1, this.$api.getOperateList).then(function (res) {
        var data = [];
        res.data.list.map(function (li, index) {
          var operRequ = JSON.parse(li.operRequ).param[0];
          var str = _this3.getOpenType(_this3.query.openType);
          // var compli = this.comparison(operRequ.data.deviceNum);
          var path = "",
              compli = "";
          if (operRequ.hasOwnProperty("data")) {
            path = _this3.screenRoomName(operRequ.data.roomId);
            li.roomName = path ? path : operRequ.data.roomName ? operRequ.data.roomName : '';
            li.roomId = operRequ.data.roomId;
            li.name = operRequ.data.cardName;
            li.deviceNum = operRequ.data.lockerId ? operRequ.data.lockerId : operRequ.data.deviceNum;
          } else {
            li.roomName = operRequ.roomName;
            li.name = operRequ.cardName;
            li.deviceNum = operRequ.deviceNum || operRequ.imei;
          }
          li.openType = str;
          li.createAt = moment_default()(li.createAt).format("YYYY-MM-DD HH:mm:ss");
          var str = [li.deviceNum, str, li.createAt];
          data.push(str);
        });
        _this3.devicestatus = false;
        _this3.pageTotal = res.data.total;
        _this3.$nextTick(function () {
          _this3.config.data = data;
          _this3.logList = res.data.list;
          _this3.devicestatus = true;
        });
      });
    },
    comparison: function comparison(deviceNum) {
      var deviceList = this.$store.state.deviceList;
      deviceList.some(function (item, index) {
        if (item.deviceNum == deviceNum) {
          return item;
        }
      });
    },
    comparisonOne: function comparisonOne(deviceNum) {
      var deviceList = this.$store.state.deviceList;
      deviceList.some(function (item, index) {
        if (item.imei == deviceNum) {
          return item;
        }
      });
    },

    //门锁报警同步刷新
    getlockAlert: function getlockAlert() {
      Object(api["d" /* httpGet */])("", this.$api.getOperateList).then(function (res) {});
    },
    searchParaProcess: function searchParaProcess(obj) {
      var myObj = new Object();
      for (var key in obj) {
        if (obj[key] != "" && obj[key] != 'Invalid date' && obj[key] != null) {
          myObj[key] = obj[key];
        }
      }
      return stringify_default()(myObj);
    },

    // 触发搜索按钮
    handleSearch: function handleSearch() {
      var _this4 = this;

      this.pageNum = 1;
      this.openRoom = false;
      var operUrl = "",
          q = {};
      if (this.query.openType == 5) {
        operUrl = "/v1/device/send/bleCommand";
        var roomid = this.checkNodeId.length > 0 ? this.checkNodeId.splice(this.checkNodeId.length - 1, 1) : [];
        q = this.searchParaProcess({
          operRequ: "bleUnlockRecord",
          roomIds: roomid,
          startTime: this.query.datePicker[0],
          endTime: this.query.datePicker[1],
          // operUrl:operUrl,
          request: [this.query.cardName]
        });
      } else if (this.query.openType == 6) {
        operUrl = "/v1/device/isp/openLock";
        var roomid = this.checkNodeId.length > 0 ? this.checkNodeId.splice(this.checkNodeId.length - 1, 1) : [];
        q = this.searchParaProcess({
          // openType: this.query.openType,
          roomIds: roomid,
          startTime: this.query.datePicker[0],
          endTime: this.query.datePicker[1],
          operUrl: operUrl,
          request: [this.query.cardName]
        });
      }
      var data = {
        pageNum: 1,
        pageSize: this.pageSize,
        orderType: "desc",
        orderBy: "createAt",
        q: q
      };
      Object(api["g" /* httpPost */])(data, this.$api.getOperateList).then(function (res) {
        var data = [];
        res.data.list.map(function (li, index) {
          var operRequ = JSON.parse(li.operRequ).param[0];
          var str = _this4.getOpenType(_this4.query.openType);
          var path = "",
              compli = "";
          if (operRequ.hasOwnProperty("data")) {
            path = _this4.screenRoomName(operRequ.data.roomId);
            li.roomName = path ? path : operRequ.data.roomName ? operRequ.data.roomName : '';
            li.roomId = operRequ.data.roomId;
            li.name = operRequ.data.cardName;
            li.deviceNum = operRequ.data.lockerId ? operRequ.data.lockerId : operRequ.data.deviceNum;
          } else {
            li.roomName = operRequ.roomName;
            li.name = operRequ.cardName;
            li.deviceNum = operRequ.deviceNum || operRequ.imei;
          }
          li.openType = str;
          li.createAt = moment_default()(li.createAt).format("YYYY-MM-DD HH:mm:ss");
          var str = [li.deviceNum, str, li.createAt];
          data.push(str);
        });
        _this4.devicestatus = false;
        _this4.pageTotal = res.data.total;
        _this4.$store.commit("increment", 1);
        _this4.$nextTick(function () {
          _this4.config.data = data;
          _this4.logList = res.data.list;
          _this4.devicestatus = true;
        });
      });
      //   this.$set(this.query, "pageIndex", 1);
    },

    // 分页导航
    handlePageChange: function handlePageChange(val) {
      this.pageNum = val;
      this.getcard();
    },
    handleSizeChange: function handleSizeChange(val) {
      this.pageSize = val;
      this.getcard();
    }
  }
});
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-35ca909c","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/views/bluetoothUnlockRecord.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"container"},[_c('div',{staticClass:"handle-box"},[_c('selectoption'),_vm._v(" "),_c('el-cascader',{attrs:{"options":_vm.options,"size":"small","props":{ checkStrictly: true },"clearable":true},on:{"change":_vm.checkNode},model:{value:(_vm.query.operateName),callback:function ($$v) {_vm.$set(_vm.query, "operateName", $$v)},expression:"query.operateName"}}),_vm._v(" "),_c('el-input',{staticClass:"handle-input mr10 wRem3",attrs:{"size":"small","placeholder":"账号","clearable":true},model:{value:(_vm.query.cardName),callback:function ($$v) {_vm.$set(_vm.query, "cardName", $$v)},expression:"query.cardName"}}),_vm._v(" "),_c('el-date-picker',{staticClass:"wRem3",attrs:{"size":"small","type":"datetime","placeholder":"选择开始日期时间","default-time":"00:00:00"},model:{value:(_vm.query.datePicker[0]),callback:function ($$v) {_vm.$set(_vm.query.datePicker, 0, $$v)},expression:"query.datePicker[0]"}}),_vm._v(" "),_c('el-date-picker',{staticClass:"wRem3",attrs:{"size":"small","type":"datetime","placeholder":"选择结束日期时间","default-time":"00:00:00"},model:{value:(_vm.query.datePicker[1]),callback:function ($$v) {_vm.$set(_vm.query.datePicker, 1, $$v)},expression:"query.datePicker[1]"}}),_vm._v(" "),_c('el-select',{staticClass:"handle-select mr10",attrs:{"size":"small","placeholder":"开门方式","clearable":""},model:{value:(_vm.query.openType),callback:function ($$v) {_vm.$set(_vm.query, "openType", $$v)},expression:"query.openType"}},[_c('el-option',{key:"5",attrs:{"label":"蓝牙开锁","value":5}}),_vm._v(" "),_c('el-option',{key:"6",attrs:{"label":"NB开锁","value":6}})],1),_vm._v(" "),_c('el-button',{staticStyle:{"background":"#FA8E00","border":"none"},attrs:{"size":"small","type":"primary","icon":"el-icon-search"},on:{"click":_vm.handleSearch}},[_vm._v("搜索")]),_vm._v(" "),_c('el-button',{staticStyle:{"background":"#FA8E00","border":"none"},attrs:{"size":"small","type":"primary","icon":"el-icon-search"},on:{"click":_vm.resetAll}},[_vm._v("重置")]),_vm._v(" "),_c('el-button',{staticStyle:{"background":"#FA8E00","border":"none"},attrs:{"size":"small","type":"primary","icon":"el-icon-download"},on:{"click":_vm.exportFun}},[_vm._v("导出")])],1),_vm._v(" "),_c('el-table',{staticStyle:{"width":"100%"},attrs:{"data":_vm.logList,"stripe":"","height":"500"}},[_c('el-table-column',{attrs:{"prop":"deviceNum","label":"设备号","width":"250"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"name","label":"账号","width":"180"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"roomName","label":"房间号"}}),_vm._v(" "),_c('el-table-column',{attrs:{"label":"开锁方式","prop":"openType"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"createAt","label":"开锁时间","width":"250"}})],1),_vm._v(" "),_c('div',{staticClass:"pagination"},[_c('el-pagination',{attrs:{"background":"","layout":"total,sizes, prev, pager, next","current-page":_vm.pageNum,"page-size":_vm.pageSize,"total":_vm.pageTotal},on:{"current-change":_vm.handlePageChange,"size-change":_vm.handleSizeChange}})],1)],1),_vm._v(" "),_c('el-dialog',{attrs:{"title":"选择房间","visible":_vm.openRoom,"width":"30%","before-close":_vm.handleClose},on:{"update:visible":function($event){_vm.openRoom=$event}}},[_c('el-tree',{ref:"tree",attrs:{"data":_vm.options,"show-checkbox":"","node-key":"id","props":_vm.defaultProps},on:{"check-change":_vm.handleCheckChange}}),_vm._v(" "),_c('span',{staticClass:"dialog-footer",attrs:{"slot":"footer"},slot:"footer"},[_c('el-button',{on:{"click":function($event){_vm.openRoom = false}}},[_vm._v("取 消")]),_vm._v(" "),_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.handleSearch}},[_vm._v("确 定")])],1)],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var views_bluetoothUnlockRecord = (esExports);
// CONCATENATED MODULE: ./src/views/bluetoothUnlockRecord.vue
function injectStyle (ssrContext) {
  __webpack_require__("SEBt")
}
var normalizeComponent = __webpack_require__("VU/8")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-35ca909c"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  bluetoothUnlockRecord,
  views_bluetoothUnlockRecord,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var src_views_bluetoothUnlockRecord = __webpack_exports__["default"] = (Component.exports);


/***/ })

});