webpackJsonp([72],{

/***/ "6fyX":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ }),

/***/ "rFFW":
/***/ (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: ./node_modules/moment/moment.js
var moment = __webpack_require__("PJh5");
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);

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

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

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

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





/* harmony default export */ var systemConfiguration = ({
  inject: ['reload'],
  name: "systemConfiguration",
  data: function data() {
    return {
      fileList: [],
      info: { type: '' },
      zNodes: [],
      form: {
        number: '',
        id: '',
        endTime: '',
        key: ''
      }
    };
  },
  mounted: function mounted() {
    var info = JSON.parse(localStorage.getItem('info'));
    this.info = info;
    this.getEnterprise();
  },

  methods: {
    getEnterprise: function getEnterprise() {
      var _this2 = this;

      Object(api["d" /* httpGet */])("", this.$api.getEnterprise).then(function (res) {
        res.data.list.map(function (li) {
          if (li.id == _this2.info.enterpriseId) {
            var quota = JSON.parse(li.quota);
            if (quota) {
              _this2.form.number = quota.quota;
              _this2.form.id = li.id;
              _this2.form.endTime = quota.deadline;
            }
          }
          li.pid = li.parentId;
          li.label = li.name;
          li.value = li.id;
        });
        var zNodes = [];var arr = [];
        zNodes = Object(utils["p" /* ztreeToElementTree */])(res.data.list, {});
        if (zNodes.length > 0) {
          if (zNodes[0].children) {
            zNodes[0].children.map(function (li) {
              var obj = {
                name: li.name,
                id: li.id,
                label: li.name,
                value: li.id,
                parentId: li.parentId
              };
              arr.push(obj);
            });
            _this2.zNodes = arr;
          }
        }
      });
    },
    handleRemove: function handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePreview: function handlePreview(file) {
      console.log(file);
    },
    handleExceed: function handleExceed(files, fileList) {
      this.$message.warning("\u5F53\u524D\u9650\u5236\u9009\u62E9 1 \u4E2A\u6587\u4EF6\uFF0C\u672C\u6B21\u9009\u62E9\u4E86 " + files.length + " \u4E2A\u6587\u4EF6\uFF0C\u5171\u9009\u62E9\u4E86 " + (files.length + fileList.length) + " \u4E2A\u6587\u4EF6");
    },
    beforeRemove: function beforeRemove(file, fileList) {
      return this.$confirm("\u786E\u5B9A\u79FB\u9664 " + file.name + "\uFF1F");
    },

    /*读取授权文件*/
    handleChange: function handleChange(file) {
      var _this = this;
      var reader = new FileReader(); //先new 一个读文件的对象 FileReader
      if (typeof FileReader === "undefined") {
        //用来判断你的浏览器是否支持 FileReader
        this.$message({
          type: "info",
          message: "您的浏览器不支持文件读取。"
        });
        return;
      }
      //  reader.readAsText(file.raw, "gb2312");  //读.txt文件
      reader.readAsArrayBuffer(file.raw); //读任意文件
      reader.onload = function (e) {
        var ints = new Uint8Array(e.target.result); //要使用读取的内容，所以将读取内容转化成Uint8Array
        // ints = ints.slice(0, 5000); //截取一段读取的内容
        var snippets = new TextDecoder('gb2312').decode(ints); //二进制缓存区内容转化成中文（即也就是读取到的内容）
        _this.form.key = snippets;
      };
    },
    onSubmit: function onSubmit() {
      var _this3 = this;

      var q = {
        "quota": this.form.number,
        "deadline": this.form.endTime
      };
      var code = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0DLoa5uX9MjFQJkwvsTb92xkJnwffrdcjKnuFcYN3z4GrGYt0voO22zl3ncNOCzsXZmL6iOK6ukjolajqnpKB/ipXI0/17nZbmY4zturM49EkVt4qw0BvFR7bN/qo7By2Z9dpHOswDEDrJZk+mmD3MCX+ZK5zuhDFVYjDvX9oTZEBdTY5qrgVp2p3fOQCOccGR8ael8lQ+uwewlEMJoJ+NwtF6YPm/SEkVlcnD04J84i7RSXHLoXCV549E8Qv0rDfgcAZhWJfDFmdpuUr42N7TwXl2QI7hNXjqdGbmZjjeZ5MYVWIhDAUGPXB3wlJhYjem7wfjJyeKQ8Zi8vhTtkkQIDAQAB';

      var data = {
        key: Object(api["j" /* setCode */])(code, stringify_default()(q)),
        id: this.form.id
      };
      Object(api["g" /* httpPost */])(data, this.$api.editLincense).then(function (res) {
        if (res.success) {
          _this3.$message.success('设置成功');
          _this3.reload();
        } else {
          _this3.$message.error("\u8BBE\u7F6E\u5931\u8D25\uFF1A" + res.message);
        }
      });
    },
    onSubmitOne: function onSubmitOne() {
      var _this4 = this;

      if (this.form.key == '') {
        this.$message.error("请上传授权文件");
      } else {
        var data = {
          key: this.form.key,
          id: this.form.id
        };
        Object(api["g" /* httpPost */])(data, this.$api.editLincense).then(function (res) {
          if (res.success) {
            _this4.$message.success('设置成功');
            _this4.reload();
          } else {
            _this4.$message.error("\u8BBE\u7F6E\u5931\u8D25\uFF1A" + res.message);
          }
        });
      }
    }
  }
});
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-39529bfc","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/systemConfiguration.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('el-card',{attrs:{"shadow":"never"}},[(_vm.info.type === 0)?_c('div',{staticClass:"width-percentage-60"},[_c('el-form',{ref:"form",attrs:{"model":_vm.form,"label-width":"150px"}},[_c('el-form-item',{attrs:{"label":"企业/部门"}},[_c('el-select',{attrs:{"placeholder":"请选择"},model:{value:(_vm.form.id),callback:function ($$v) {_vm.$set(_vm.form, "id", $$v)},expression:"form.id"}},_vm._l((_vm.zNodes),function(item){return _c('el-option',{key:item.value,attrs:{"label":item.label,"value":item.value}})}),1)],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"设备接入数量"}},[_c('el-input',{model:{value:(_vm.form.number),callback:function ($$v) {_vm.$set(_vm.form, "number", $$v)},expression:"form.number"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"设备接入授权时间"}},[_c('el-col',{attrs:{"span":11}},[_c('el-date-picker',{staticStyle:{"width":"100%"},attrs:{"type":"date","placeholder":"选择日期","value-format":"timestamp","format":"yyyy 年 MM 月 dd 日"},model:{value:(_vm.form.endTime),callback:function ($$v) {_vm.$set(_vm.form, "endTime", $$v)},expression:"form.endTime"}})],1)],1),_vm._v(" "),_c('el-form-item',[_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.onSubmit}},[_vm._v("确认")])],1)],1)],1):_c('div',{staticClass:"width-percentage-60"},[_c('el-form',{ref:"form",attrs:{"model":_vm.form,"label-width":"150px"}},[_c('el-form-item',{attrs:{"label":"设备接入数量"}},[_c('el-input',{attrs:{"disabled":""},model:{value:(_vm.form.number),callback:function ($$v) {_vm.$set(_vm.form, "number", $$v)},expression:"form.number"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"设备接入授权时间"}},[_c('el-col',{attrs:{"span":11}},[_c('el-date-picker',{staticStyle:{"width":"100%"},attrs:{"type":"date","placeholder":"选择日期","disabled":"","value-format":"timestamp","format":"yyyy 年 MM 月 dd 日"},model:{value:(_vm.form.endTime),callback:function ($$v) {_vm.$set(_vm.form, "endTime", $$v)},expression:"form.endTime"}})],1)],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"授权文件"}},[_c('el-upload',{ref:"upload",staticClass:"upload-demo",attrs:{"action":"","on-change":_vm.handleChange,"auto-upload":false,"limit":1}},[_vm._v(" 点击上传\n          ")])],1),_vm._v(" "),_c('el-form-item',[_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.onSubmitOne}},[_vm._v("确认")])],1)],1)],1)])],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var views_systemConfiguration = (esExports);
// CONCATENATED MODULE: ./src/views/systemConfiguration.vue
function injectStyle (ssrContext) {
  __webpack_require__("6fyX")
}
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-39529bfc"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  systemConfiguration,
  views_systemConfiguration,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

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


/***/ })

});