webpackJsonp([54],{

/***/ "Iq79":
/***/ (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/configPage.vue

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


/* harmony default export */ var configPage = ({
  inject: ['reload'],
  name: 'conf',
  data: function data() {
    return {
      selectoption: [],
      selectoptionValue: '',
      tableData: [],
      enterpriseidedit: false,
      modifyStatus: false,
      Enterprise1: {
        value: '',
        label: ''
      },
      title: "添加",
      config: {},
      row: {},
      index: '',
      userInfo: {
        type: ''
      }
    };
  },
  created: function created() {
    this.userInfo = JSON.parse(localStorage.getItem('info'));
    this.height = document.documentElement.clientHeight - 160;
    this.getConfig();
    this.selectoption = JSON.parse(localStorage.getItem('selectoption'));
    this.selectoptionValue = localStorage.getItem('tenantId');
  },

  methods: {
    selectTenantId: function selectTenantId(e) {
      localStorage.setItem('tenantId', e);
      this.reload();
    },
    addConfig: function addConfig() {
      this.Enterprise1 = {
        value: '',
        label: ''
      }, this.title = "添加";
      this.enterpriseidedit = true;
      this.modifyStatus = false;
    },
    getConfig: function getConfig() {
      var _this = this;

      Object(api["d" /* httpGet */])('', this.$api.getConfig).then(function (res) {
        if (res.success) {
          _this.tableData = res.data.list;
        } else {
          _this.$message.error("获取失败");
        }
      });
    },
    editConfig: function editConfig(index, row) {
      this.row = row;
      this.Enterprise1.value = row.value;
      this.Enterprise1.label = row.label;
      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 {
        var tableData = this.tableData;
        if (this.modifyStatus) {
          tableData[this.index].value = this.Enterprise1.value;
          tableData[this.index].label = this.Enterprise1.label;
        } else {
          var obj = {
            value: this.Enterprise1.value,
            label: this.Enterprise1.label
          };
          tableData.push(obj);
        }
        var data = {
          list: tableData
        };
        Object(api["g" /* httpPost */])(data, this.$api.editConfig).then(function (res) {
          if (res.success) {
            _this3.tableData = res.data;
            _this3.enterpriseidedit = false;
            _this3.getConfig();
          } else {
            if (_this3.modifyStatus) {
              _this3.$message.error("修改失败");
            } else {
              _this3.$message.error("添加失败");
            }
          }
        });
      }
    }
  }
});
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-78d5f5d9","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/configPage.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-button',{staticStyle:{"background":"#FA8E00","border":"none"},attrs:{"type":"primary","size":"small"},on:{"click":_vm.addConfig}},[_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":"label","label":"名称"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"value","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-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":"租户ID"}},[_c('el-input',{attrs:{"type":"number","clearable":true},model:{value:(_vm.Enterprise1.value),callback:function ($$v) {_vm.$set(_vm.Enterprise1, "value", $$v)},expression:"Enterprise1.value"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"名称"}},[_c('el-input',{attrs:{"clearable":true},model:{value:(_vm.Enterprise1.label),callback:function ($$v) {_vm.$set(_vm.Enterprise1, "label", $$v)},expression:"Enterprise1.label"}})],1)],1)],1)],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var views_configPage = (esExports);
// CONCATENATED MODULE: ./src/views/configPage.vue
function injectStyle (ssrContext) {
  __webpack_require__("j2gd")
}
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-78d5f5d9"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  configPage,
  views_configPage,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

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


/***/ }),

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

// removed by extract-text-webpack-plugin

/***/ })

});