webpackJsonp([74],{

/***/ "Sp/M":
/***/ (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");

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

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


/* harmony default export */ var quantityConfiguration = ({
  inject: ['reload'],
  name: "quantityConfiguration",
  data: function data() {
    return {
      selectoption: [],
      selectoptionValue: '',
      tableData: [],
      enterpriseidedit: false,
      modifyStatus: false,
      Enterprise1: {
        value: '',
        label: ''
      },
      title: "添加",
      config: {},
      row: {},
      index: '',
      enterpriseName: '',
      pageSize: 10,
      pageNum: 1,
      pagetotal: 0,
      userInfo: {
        type: ''
      }
    };
  },

  components: {},
  created: function created() {
    this.userInfo = JSON.parse(localStorage.getItem('info'));
    this.height = document.documentElement.clientHeight - 200;
    this.getConfig();
    // this.selectoption = JSON.parse(localStorage.getItem('selectoption'))
    // this.selectoptionValue = localStorage.getItem('tenantId')
  },

  methods: {
    // selectTenantId(e) {
    //   localStorage.setItem('tenantId', e)
    //   this.reload()
    // },
    serachFun: function serachFun() {
      this.pageNum = 1;
      this.tableData = [];
      this.getConfig();
    },
    handleSizeChange: function handleSizeChange(val) {
      this.pageSize = val;
      this.getConfig();
    },
    handleCurrentChange: function handleCurrentChange(val) {
      this.pageNum = val;
      this.getConfig();
    },
    addConfig: function addConfig() {
      this.Enterprise1 = {
        value: '',
        label: ''
      }, this.title = "添加";
      this.enterpriseidedit = true;
      this.modifyStatus = false;
    },
    getConfig: function getConfig() {
      var _this = this;

      var str = {
        name: this.enterpriseName
      };
      var data = {
        q: stringify_default()(str),
        // pageSize: this.pageSize,
        // pageNum: this.pageNum,
        pageSize: 1,
        pageNum: 1
      };
      Object(api["d" /* httpGet */])(data, this.$api.getEnterprise).then(function (res) {
        if (res.success) {
          _this.tableData = res.data.list;
          _this.pagetotal = res.data.total;
        } else {
          _this.$message.error("获取失败");
        }
      });
    },
    editConfig: function editConfig(index, row) {
      this.row = row;
      this.Enterprise1.value = row.quota;
      this.Enterprise1.label = row.name;
      this.index = index;
      this.title = "编辑";
      this.enterpriseidedit = true;
      this.modifyStatus = true;
    },
    deleteConfig: function deleteConfig(index, row) {
      var _this2 = this;

      this.$confirm("确定要删除吗？", "提示", {
        type: "warning"
      }).then(function () {
        var tableData = JSON.parse(stringify_default()(_this2.tableData));
        tableData.splice(index, 1);
        var data = {
          list: tableData
        };
        Object(api["g" /* httpPost */])(data, _this2.$api.editConfig).then(function (res) {
          if (res.success) {
            _this2.tableData = res.data;
            _this2.enterpriseidedit = false;
            _this2.getConfig();
          } else {
            _this2.$message.error("删除失败");
          }
        });
      });
    },
    confirmEditConfig: function confirmEditConfig() {
      var _this3 = this;

      if (this.Enterprise1.value == '' || this.Enterprise1.label == '') {
        this.$message.error("请填写完整信息");
      } else {
        if (this.userInfo.type == 0 && this.row.id == this.userInfo.enterpriseId) {
          var data = this.Enterprise1.value;
          Object(api["g" /* httpPost */])(data, this.$api.edutLicense).then(function (res) {
            if (res.success) {
              _this3.pageNum = 1;
              _this3.tableData = [];
              _this3.getConfig();
              _this3.$message.success("修改成功");
              _this3.enterpriseidedit = false;
            } else {
              _this3.$message.error("修改失败");
            }
          }).catch(function (err) {
            console.log(err);
            _this3.$message.error(err.message);
          });
        } else {
          Object(api["d" /* httpGet */])('', "/v1/device/edit/quota/" + this.row.id + "/" + this.Enterprise1.value).then(function (res) {
            if (res.success) {
              _this3.pageNum = 1;
              _this3.tableData = [];
              _this3.getConfig();
              _this3.$message.success("修改成功");
              _this3.enterpriseidedit = false;
            } else {
              _this3.$message.error("修改失败");
            }
          }).catch(function (err) {
            console.log(err);
            _this3.$message.error(err.message);
          });
        }
      }
    }
  }
});
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-31d4aeff","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/quantityConfiguration.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('el-card',{staticClass:"box-card"},[_c('selectoption'),_vm._v(" "),_c('el-input',{staticClass:"w300",attrs:{"size":"small","type":"text","placeholder":"请输入部门名称","clearable":""},model:{value:(_vm.enterpriseName),callback:function ($$v) {_vm.enterpriseName=$$v},expression:"enterpriseName"}}),_vm._v(" "),_c('el-button',{attrs:{"type":"primary","size":"small"},on:{"click":_vm.serachFun}},[_vm._v("搜索")]),_vm._v(" "),_c('el-table',{staticStyle:{"width":"100%"},attrs:{"data":_vm.tableData,"height":_vm.height,"border":true}},[_c('el-table-column',{attrs:{"prop":"name","label":"企业名称"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"quota","label":"允许接入设备数量"}}),_vm._v(" "),_c('el-table-column',{attrs:{"label":"操作"},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [_c('el-button',{attrs:{"type":"text","size":"small"},on:{"click":function($event){return _vm.editConfig(scope.$index,scope.row)}}},[_vm._v("修改")]),_vm._v(" "),_c('el-button',{attrs:{"type":"text","size":"small"},on:{"click":function($event){return _vm.deleteConfig(scope.$index,scope.row)}}},[_vm._v("删除")])]}}])})],1),_vm._v(" "),_c('el-pagination',{attrs:{"current-page":_vm.pageNum,"page-sizes":[10,20,100, 200, 300, 400],"page-size":_vm.pageSize,"layout":"total, sizes, prev, pager, next, jumper","total":_vm.pagetotal},on:{"size-change":_vm.handleSizeChange,"current-change":_vm.handleCurrentChange}}),_vm._v(" "),_c('el-dialog',{staticClass:"eldialog",attrs:{"title":_vm.title,"visible":_vm.enterpriseidedit,"width":"30%"},on:{"update:visible":function($event){_vm.enterpriseidedit=$event}},scopedSlots:_vm._u([{key:"footer",fn:function(){return [_c('span',{staticClass:"dialog-footer"},[_c('el-button',{on:{"click":function($event){_vm.enterpriseidedit = false}}},[_vm._v("取 消")]),_vm._v(" "),(_vm.modifyStatus)?_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.confirmEditConfig}},[_vm._v("修 改")]):_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.confirmEditConfig}},[_vm._v("确 定")])],1)]},proxy:true}])},[_c('el-form',{ref:"form1",attrs:{"model":_vm.Enterprise1,"label-width":"70px"}},[_c('el-form-item',{attrs:{"label":"名称"}},[_c('el-input',{attrs:{"clearable":true,"disabled":true},model:{value:(_vm.Enterprise1.label),callback:function ($$v) {_vm.$set(_vm.Enterprise1, "label", $$v)},expression:"Enterprise1.label"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"数量"}},[_c('el-input',{attrs:{"type":"text","maxlength":"16","clearable":true},model:{value:(_vm.Enterprise1.value),callback:function ($$v) {_vm.$set(_vm.Enterprise1, "value", $$v)},expression:"Enterprise1.value"}})],1)],1)],1)],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var views_quantityConfiguration = (esExports);
// CONCATENATED MODULE: ./src/views/quantityConfiguration.vue
function injectStyle (ssrContext) {
  __webpack_require__("zZv+")
}
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-31d4aeff"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  quantityConfiguration,
  views_quantityConfiguration,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

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


/***/ }),

/***/ "zZv+":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ })

});