webpackJsonp([55],{

/***/ "YC1C":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

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

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

// EXTERNAL MODULE: ./src/views/zw.vue + 1 modules
var zw = __webpack_require__("RMlb");

// 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/offInCard/offInCardOver.vue
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//




/* harmony default export */ var offInCardOver = ({
  inject: ['reload'],
  name: "offInCardOver",
  data: function data() {
    return {
      dialogVisible: false,
      firstAuthList: [],
      secondAuthList: [],
      threeAuthList: [],
      fourAuthList: [],
      romeLockerList: [],
      options: [],
      roomFirst: "",
      roomSecond: "",
      roomThree: "",
      roomFour: "",
      roomFive: "",
      submitData: {
        cardNo: "",
        num: "",
        endTime: "",
        startTime: ""
      },
      tableData: [],
      romeFiveAuth: [],
      FiveAuthList: {
        communcationKey: "",
        firstAuth: "",
        secondAuth: "",
        threeAuth: "",
        fourAuth: ""
      },
      privateKey: "",
      privateKeyType: ""
    };
  },

  components: { zw: zw["a" /* default */] },
  created: function created() {
    this.getFirstAuthListMethods();
  },

  methods: {
    // 删除
    deleteCardMethods: function deleteCardMethods(index, row) {
      var _this2 = this;

      var data3 = {
        code: "zg/auth/clearCardAuth",
        data: {
          cardNo: row.cardNum
        }
      };
      Object(api["g" /* httpPost */])(data3, this.$api.sendCommand).then(function (res) {
        if (res.code == 200) {
          _this2.getCardBindAuthList();
        }
      });
    },

    // 房源改变
    getRoomMethods: function getRoomMethods(e) {
      if (e == 1) {
        if (this.roomFirst != '') {
          this.getSecondAuthList();this.privateKeyType = 1;
        } else {
          this.roomSecond = "";
          this.roomThree = "";
          this.roomFour = "";
          this.roomFive = "";
          this.privateKeyType = "";
        }
      } else if (e == 2) {
        if (this.roomSecond != '') {
          this.getThreeAuthList();this.privateKeyType = 2;
        } else {
          this.roomThree = "";
          this.roomFour = "";
          this.roomFive = "";
          this.privateKeyType = 1;
        }
      } else if (e == 3) {
        if (this.roomThree != '') {
          this.getFourAuthList();this.privateKeyType = 3;
        } else {
          this.roomFour = "";
          this.roomFive = "";
          this.privateKeyType = 2;
        }
      } else if (e == 4) {
        if (this.roomFour != '') {
          this.getRomeLockerList();this.privateKeyType = 4;
        } else {
          this.roomFive = "";
          this.privateKeyType = 3;
        }
      } else if (e == 5) {
        if (this.roomFive != '') {
          this.privateKeyType = 5;
        } else {
          this.privateKeyType = 4;
        }
      }
      console.log(this.privateKeyType);
      // switch(e){
      //   case 1: this.getSecondAuthList();this.privateKeyType=1; break;
      //   case 2: this.getThreeAuthList();this.privateKeyType=2; break;
      //   case 3: this.getFourAuthList();this.privateKeyType=3; break;
      //   case 4: this.getRomeLockerList();this.privateKeyType=4; break;
      //   case 5: this.privateKeyType=5; break;
      // }
    },

    // 获取一级房源
    getFirstAuthListMethods: function getFirstAuthListMethods() {
      var _this3 = this;

      var data3 = {
        code: "zg/auth/firstAuthList",
        data: {}
      };
      Object(api["g" /* httpPost */])(data3, this.$api.sendCommand).then(function (res) {
        if (res.code == 200) {
          _this3.firstAuthList = res.data;
        }
      });
    },

    // 获取二级房源
    getSecondAuthList: function getSecondAuthList() {
      var _this4 = this;

      var data3 = {
        code: "zg/auth/secondAuthList",
        data: {
          parentId: this.roomFirst
        }
      };
      Object(api["g" /* httpPost */])(data3, this.$api.sendCommand).then(function (res) {
        if (res.code == 200) {
          _this4.secondAuthList = res.data;
        }
      });
    },

    // 获取三级房源
    getThreeAuthList: function getThreeAuthList() {
      var _this5 = this;

      var data3 = {
        code: "zg/auth/threeAuthList",
        data: {
          parentId: this.roomSecond
        }
      };
      Object(api["g" /* httpPost */])(data3, this.$api.sendCommand).then(function (res) {
        if (res.code == 200) {
          _this5.threeAuthList = res.data;
        }
      });
    },

    // 获取四级房源
    getFourAuthList: function getFourAuthList() {
      var _this6 = this;

      var data3 = {
        code: "zg/auth/fourAuthList",
        data: {
          parentId: this.roomThree
        }
      };
      Object(api["g" /* httpPost */])(data3, this.$api.sendCommand).then(function (res) {
        if (res.code == 200) {
          _this6.fourAuthList = res.data;
        }
      });
    },

    // 获取五级房源
    getRomeLockerList: function getRomeLockerList() {
      var _this7 = this;

      var data3 = {
        code: "zg/auth/getRomeLockerList",
        data: {
          parentId: this.roomFour
        }
      };
      Object(api["g" /* httpPost */])(data3, this.$api.sendCommand).then(function (res) {
        if (res.code == 200) {
          _this7.romeLockerList = res.data;
        }
      });
    },
    showDialogMethods: function showDialogMethods() {
      this.dialogVisible = true;
      var roomId = "",
          type = "";
      if (this.roomFive != '') {
        roomId = this.roomFive;
        type = 5;
      } else if (this.roomFour != '') {
        roomId = this.roomFour;
        type = 4;
      } else if (this.roomThree != '') {
        roomId = this.roomThree;
        type = 3;
      } else if (this.roomSecond != '') {
        roomId = this.roomSecond;
        type = 2;
      } else if (this.roomFirst != '') {
        roomId = this.roomFirst;
        type = 1;
      }
      this.getromeFiveAuth(roomId, type);
      this.addNfc();
    },
    getromeFiveAuth: function getromeFiveAuth(roomId, type) {
      if (type == 1) {
        var result = this.firstAuthList.filter(function (item) {
          return item.code == roomId;
        })[0];
        if (result) {
          this.getPrivateKey(result.value, type);
        }
      } else if (type == 2) {
        var result = this.secondAuthList.filter(function (item) {
          return item.code == roomId;
        })[0];
        if (result) {
          this.getPrivateKey(result.value, type);
        }
      } else if (type == 3) {
        var result = this.threeAuthList.filter(function (item) {
          return item.code == roomId;
        })[0];
        if (result) {
          this.getPrivateKey(result.value, type);
        }
      } else if (type == 4) {
        var result = this.fourAuthList.filter(function (item) {
          return item.code == roomId;
        })[0];
        if (result) {
          this.getPrivateKey(result.value, type);
        }
      } else if (type == 5) {
        var result = this.romeLockerList.filter(function (item) {
          return item.code == roomId;
        })[0];
        if (result) {
          this.getPrivateKey(result.value, type);
        }
      }
    },
    getPrivateKey: function getPrivateKey(authName, type) {
      var _this8 = this;

      var data = {
        code: "zg/auth/findAuthCodeInfo",
        data: {
          authName: authName,
          type: type
        }
      };
      Object(api["g" /* httpPost */])(data, this.$api.sendCommand).then(function (res) {
        if (res.code == 200) {
          _this8.privateKey = res.data;
        }
      });
    },
    setVoucherNfc: function setVoucherNfc(data) {
      this.submitData.cardNo = data.cardNo;
      this.getCardBindAuthList();
    },
    getCardBindAuthList: function getCardBindAuthList() {
      var _this9 = this;

      var data3 = {
        code: "zg/auth/findCardBindAuth",
        data: {
          cardNo: this.submitData.cardNo
        }
      };
      Object(api["g" /* httpPost */])(data3, this.$api.sendCommand).then(function (res4) {
        _this9.tableData = res4.data;
      });
    },
    addNfc: function addNfc() {
      var _this = this;
      this.$refs.mychild.cardFun(0x8010, function (data) {
        if (data.status == 0) {
          console.log(data);
          _this.setVoucherNfc(data);
        } else {
          _this.$message.error("读卡错误，请检查读卡器是否正常！");
        }
      });
    },
    writeNfc: function writeNfc() {
      var _this10 = this;

      var _this = this;
      if (this.privateKeyType == '') {
        _this.$message.error("请选择房源");
        return;
      }
      if (this.submitData.startTime == '' || this.submitData.endTime == '') {
        _this.$message.error("请选择开始结束时间");
        return;
      }
      if (this.submitData.cardNo == '') {
        _this.$message.error("请放置卡片在读卡器上");
        return;
      }
      var cardNo = this.submitData.cardNo;
      var startTime = moment_default()(this.submitData.startTime).format("X").toString(16);
      var endTime = moment_default()(this.submitData.endTime).format("X").toString(16);
      var useCountLimit = this.submitData.num.toString(16);
      var privateKey = this.privateKey;
      if (this.submitData.num == '') {
        useCountLimit = '255';
      }
      useCountLimit = useCountLimit.toString(16);
      var keyType = "";
      if (this.privateKeyType == 1) {
        keyType = 0x01;
      } else if (this.privateKeyType == 2) {
        keyType = 0x02;
      } else if (this.privateKeyType == 3) {
        keyType = 0x03;
      } else if (this.privateKeyType == 4) {
        keyType = 0x04;
      } else if (this.privateKeyType == 5) {
        keyType = 0xff;
      }
      this.$refs.mychild.writeCard(0x8011, cardNo, startTime, endTime, useCountLimit, privateKey, keyType, function (data) {
        if (data.status == 0) {
          console.log(data);
          var data3 = {
            code: "zg/auth/reportCardAuthInfo",
            data: {
              authCode: privateKey,
              cardNo: cardNo,
              endTime: moment_default()(_this10.submitData.endTime).format("X"),
              startTime: moment_default()(_this10.submitData.startTime).format("X"),
              useCount: useCountLimit
            }
          };
          Object(api["g" /* httpPost */])(data3, _this10.$api.sendCommand).then(function (res4) {
            if (res4.code == 200) {
              _this.dialogVisible = false;
              _this.$message.success("上报成功");
            }
          });
        } else {
          console.log(data);
          _this.$message.error("写卡错误，请检查读卡器是否正常！");
        }
      });
    }
  }
});
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-77e1b581","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/offInCard/offInCardOver.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"p-2"},[_c('zw',{ref:"mychild"}),_vm._v(" "),_c('div',{staticClass:"searvh"},[_c('el-select',{staticClass:"w-2 mb-2",attrs:{"placeholder":"请选择房源","clearable":"","size":"small"},on:{"change":function($event){return _vm.getRoomMethods(1)}},model:{value:(_vm.roomFirst),callback:function ($$v) {_vm.roomFirst=$$v},expression:"roomFirst"}},_vm._l((_vm.firstAuthList),function(item){return _c('el-option',{key:item.code,attrs:{"label":item.value,"value":item.code}})}),1),_vm._v(" "),_c('el-select',{staticClass:"w-2 mb-2",attrs:{"placeholder":"请选择楼宇","clearable":"","size":"small"},on:{"change":function($event){return _vm.getRoomMethods(2)}},model:{value:(_vm.roomSecond),callback:function ($$v) {_vm.roomSecond=$$v},expression:"roomSecond"}},_vm._l((_vm.secondAuthList),function(item){return _c('el-option',{key:item.code,attrs:{"label":item.value,"value":item.code}})}),1),_vm._v(" "),_c('el-select',{staticClass:"w-2 mb-2",attrs:{"placeholder":"请选择单元","clearable":"","size":"small"},on:{"change":function($event){return _vm.getRoomMethods(3)}},model:{value:(_vm.roomThree),callback:function ($$v) {_vm.roomThree=$$v},expression:"roomThree"}},_vm._l((_vm.threeAuthList),function(item){return _c('el-option',{key:item.code,attrs:{"label":item.value,"value":item.code}})}),1),_vm._v(" "),_c('el-select',{staticClass:"w-2 mb-2",attrs:{"placeholder":"请选择楼层","clearable":"","size":"small"},on:{"change":function($event){return _vm.getRoomMethods(4)}},model:{value:(_vm.roomFour),callback:function ($$v) {_vm.roomFour=$$v},expression:"roomFour"}},_vm._l((_vm.fourAuthList),function(item){return _c('el-option',{key:item.code,attrs:{"label":item.value,"value":item.code}})}),1),_vm._v(" "),_c('el-select',{staticClass:"w-2 mb-2",attrs:{"placeholder":"请选择房间","clearable":"","size":"small"},on:{"change":function($event){return _vm.getRoomMethods(5)}},model:{value:(_vm.roomFive),callback:function ($$v) {_vm.roomFive=$$v},expression:"roomFive"}},_vm._l((_vm.romeLockerList),function(item){return _c('el-option',{key:item.code,attrs:{"label":item.value,"value":item.code}})}),1),_vm._v(" "),_c('el-button',{staticClass:"mb-2",staticStyle:{"background":"#FA8E00","border":"none"},attrs:{"type":"primary","clearable":"","size":"small"},nativeOn:{"click":function($event){return _vm.addNfc.apply(null, arguments)}}},[_vm._v("读卡")]),_vm._v(" "),_c('el-button',{staticClass:"mb-2",staticStyle:{"background":"#FA8E00","border":"none"},attrs:{"type":"primary","clearable":"","size":"small"},on:{"click":_vm.showDialogMethods}},[_vm._v("写卡")])],1),_vm._v(" "),_c('div',[_c('el-table',{staticStyle:{"width":"100%"},attrs:{"data":_vm.tableData,"stripe":"","height":"600"}},[_c('el-table-column',{attrs:{"type":"index","width":"80","label":"序号"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"cardNum","label":"卡号"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"authName","label":"权限名称"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"startTime","label":"开始时间"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"endTime","label":"结束时间"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"useCount","label":"使用次数"},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [(scope.row.useCount==255)?_c('span',[_vm._v(_vm._s(scope.row.useCountStr))]):_c('span',[_vm._v(_vm._s(scope.row.useCount))])]}}])}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"createTime","label":"创建时间"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"useCount","label":"操作"},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [_c('span',{on:{"click":function($event){return _vm.deleteCardMethods(scope.$index,scope.row)}}},[_vm._v("删除")])]}}])})],1)],1),_vm._v(" "),_c('el-dialog',{attrs:{"title":"发放离线卡","visible":_vm.dialogVisible,"width":"50%"},on:{"update:visible":function($event){_vm.dialogVisible=$event}}},[_c('div',{staticClass:"formdata"},[_c('el-date-picker',{staticClass:"mb-2",attrs:{"clearable":"","size":"middle d-block","type":"datetime","placeholder":"选择开始日期时间"},model:{value:(_vm.submitData.startTime),callback:function ($$v) {_vm.$set(_vm.submitData, "startTime", $$v)},expression:"submitData.startTime"}}),_vm._v(" "),_c('el-date-picker',{staticClass:"mb-2",attrs:{"clearable":"","size":"middle d-block","type":"datetime","placeholder":"选择结束日期时间"},model:{value:(_vm.submitData.endTime),callback:function ($$v) {_vm.$set(_vm.submitData, "endTime", $$v)},expression:"submitData.endTime"}}),_vm._v(" "),_c('el-input',{attrs:{"clearable":"","size":"middle","placeholder":"请输入使用次数,默认永久"},model:{value:(_vm.submitData.num),callback:function ($$v) {_vm.$set(_vm.submitData, "num", $$v)},expression:"submitData.num"}})],1),_vm._v(" "),_c('span',{staticClass:"dialog-footer",attrs:{"slot":"footer"},slot:"footer"},[_c('el-button',{on:{"click":function($event){_vm.dialogVisible = false}}},[_vm._v("取 消")]),_vm._v(" "),_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.writeNfc}},[_vm._v("确 定")])],1)])],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var offInCard_offInCardOver = (esExports);
// CONCATENATED MODULE: ./src/views/offInCard/offInCardOver.vue
function injectStyle (ssrContext) {
  __webpack_require__("ktVO")
}
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-77e1b581"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  offInCardOver,
  offInCard_offInCardOver,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

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


/***/ }),

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

// removed by extract-text-webpack-plugin

/***/ })

});