webpackJsonp([79],{

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

// removed by extract-text-webpack-plugin

/***/ }),

/***/ "sZ3M":
/***/ (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/administrativeDepartment.vue

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

// import { formatTime } from '../../../echart/big-screen-vue-datav/src/utils';

/* harmony default export */ var administrativeDepartment = ({
  name: "basetable",
  data: function data() {
    return {
      modifyfrom: { oldPassword: "", newPassword: "", confirmPassword: "" },
      isRouterAlive: true,
      identity: "",
      userType: "",
      enterpriselist: [],
      Enterprise: { name: "" },
      rololist: [],
      enterpriseidedit: false,
      yhsflist: [
      // { value: 0, label: "超级管理员" },
      // { value: 1, label: "管理员" },
      { value: 2, label: "老师" }, { value: 3, label: "学生" }],
      yhlxlist: [{ value: 1, label: "管理员" }, { value: 2, label: "子用户" }, { value: 3, label: "小程序用户" }],
      pageSize: 10,
      pageIndex: 1,
      query: {
        address: "",
        name: "",
        pageIndex: 1,
        pageSize: 10,
        options: []
      },
      tableData: [],
      multipleSelection: [],
      delList: [],
      editVisible: false,
      pageTotal: 0,
      form: {},
      addform: {
        username: "",
        password: "",
        enterpriseName: "",
        identity: "",
        userType: "",
        enterpriseId: "",
        roleId: ""
      },
      rules: {
        username: [{ required: true, message: "请输入名称", trigger: "blur" }],
        phone: [{ required: true, message: "请输入电话", trigger: "blur" }, { min: 11, max: 11, message: "长度为 11 个字符", trigger: "blur" }],
        password: [{ required: true, message: "请输入密码", trigger: "blur" }],
        enterpriseName: [{ required: true, message: "请选择部门", trigger: "blur" }],
        userType: [{ required: true, message: "请选择用户类型", trigger: "blur" }]
      },
      idx: -1,
      id: -1,
      editVisible1: false,
      alluser: []
    };
  },
  created: function created() {
    this.getUserList();
  },
  mounted: function mounted() {
    this.getEnterprise(); //查询所属部门
  },

  methods: {
    // 获取用户列表
    getUserList: function getUserList() {
      var _this = this;

      var data = {
        pageNum: 1,
        pageSize: 10
      };
      Object(api["d" /* httpGet */])(data, this.$api.getUserList).then(function (res) {
        _this.alluser = res.data.list;
      });
    },
    enterfun: function enterfun(e) {
      var _this2 = this;

      this.enterpriselist.map(function (li) {
        if (li.id == e) {
          _this2.addform.enterpriseName = li.name;
          _this2.addform.enterpriseId = li.id;
        }
      });
    },
    getEnterprise: function getEnterprise() {
      var _this3 = this;

      var data = {
        pageNum: 1,
        pageSize: 10
      };
      Object(api["d" /* httpGet */])(data, this.$api.getEnterprise).then(function (res) {
        var that = _this3;
        var enterpriselist = res.data.list;
        enterpriselist.map(function (li) {
          var obj = that.alluser.find(function (x) {
            return x.enterpriseId == li.id;
          });
          if (obj) {
            li.personList.push(obj);
            li.personNum = li.personList.length;
          }
        });
        console.log(enterpriselist);
        _this3.enterpriselist = enterpriselist;
        _this3.tableData = enterpriselist;
        _this3.pageTotal = res.data.total;
      });
    },
    addEnterprise: function addEnterprise() {
      var _this4 = this;

      Object(api["d" /* httpGet */])("", this.$api.userInfo).then(function (res3) {
        if (res3.success) {
          var data = {
            name: _this4.Enterprise.name,
            parentId: res3.data.enterpriseId
          };
          Object(api["g" /* httpPost */])(data, _this4.$api.addEnterprise).then(function (res) {
            if (res.success) {
              _this4.$message.success("创建成功");
              _this4.enterpriseidedit = false;
              _this4.getEnterprise();
            }
          });
        }
      });
    },
    createEnterprise: function createEnterprise() {
      this.enterpriseidedit = true;
    },

    // 编辑操作
    handleEdit1: function handleEdit1() {
      this.editVisible1 = true;
    },

    // 保存编辑  添加用户
    saveEdit1: function saveEdit1() {
      var _this5 = this;

      this.addform.identity = this.identity;
      this.addform.userType = this.userType;
      if (this.addform.username == "" || this.addform.phone == "" || this.addform.password == "" || this.addform.userType == "") {
        this.$message.error("请填写完整信息");
      } else if (this.addform.phone.length != 11) {
        this.$message.error("请填写正确手机号");
      } else {
        var addform = this.addform;
        addform['tenantId'] = JSON.parse(localStorage.getItem('tenantId'));
        Object(api["g" /* httpPost */])(addform, this.$api.addUser).then(function (res) {
          if (res.code == 200) {
            _this5.$message.success("添加成功");
            _this5.editVisible1 = false;
            _this5.isRouterAlive = false;
            _this5.$nextTick(function () {
              this.isRouterAlive = true;
            });
          }
        });
      }
    },
    handleChange: function handleChange(value) {
      console.log(value);
    },

    // 触发搜索按钮
    handleSearch: function handleSearch() {
      this.$set(this.query, "pageIndex", 1);
      this.getUserList1(1, 10);
    },

    // 删除操作
    handleDelete: function handleDelete(index, row) {
      var _this6 = this;

      // 二次确认删除
      this.$confirm("确定要删除吗？", "提示", {
        type: "warning"
      }).then(function () {
        var data = [row.id];
        Object(api["g" /* httpPost */])(data, _this6.$api.deleteUser).then(function (res) {
          _this6.$message.success("删除成功");
          _this6.getUserList();
        });
      }).catch(function () {});
    },

    // 多选操作
    handleSelectionChange: function handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    delAllSelection: function delAllSelection() {
      var length = this.multipleSelection.length;
      var str = "";
      this.delList = this.delList.concat(this.multipleSelection);
      for (var i = 0; i < length; i++) {
        str += this.multipleSelection[i].name + " ";
      }
      this.$message.error("\u5220\u9664\u4E86" + str);
      this.multipleSelection = [];
    },

    // 编辑操作
    handleEdit: function handleEdit(index, row) {
      this.idx = index;
      this.form = row;
      console.log(this.form);
      this.editVisible = true;
    },

    // 保存编辑
    saveEdit: function saveEdit() {
      var _this7 = this;

      if (this.modifyfrom.confirmPassword != this.modifyfrom.newPassword) {
        this.$message.error("确认密码输入错误！");
      } else {
        var data = {
          new: this.modifyfrom.newPassword,
          old: this.modifyfrom.oldPassword
        };
        Object(api["g" /* httpPost */])(data, this.$api.editPassword).then(function (res) {
          if (res.success) {
            _this7.$message.success("修改成功！");
            _this7.editVisible = false;
          } else {
            _this7.$message.error("修改失败，请输入正确的旧密码！");
          }
        });
      }
    },

    // 分页导航
    handlePageChange: function handlePageChange(val) {
      // this.$set(this.query, "pageIndex", val);
      console.log(val);
      this.getUserList1(val, 10);
    },
    getUserList1: function getUserList1(pageNum, pageSize) {
      var _this8 = this;

      var q = {
        username: this.query.name
      };
      var data = {
        pageNum: pageNum,
        pageSize: pageSize,
        q: stringify_default()(q)
      };
      Object(api["d" /* httpGet */])(data, this.$api.getUserList).then(function (res) {
        _this8.tableData = res.data.list;
        _this8.pageTotal = res.data.total;
      });
    }
  }
});
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-2a0c4926","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/administrativeDepartment.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.isRouterAlive)?_c('div',[_c('div',{staticClass:"container"},[_c('div',{staticClass:"handle-box"},[_c('el-input',{staticClass:"handle-input mr10",attrs:{"placeholder":"登录账号"},model:{value:(_vm.query.name),callback:function ($$v) {_vm.$set(_vm.query, "name", $$v)},expression:"query.name"}}),_vm._v(" "),_c('el-button',{attrs:{"type":"primary","icon":"el-icon-search"},on:{"click":_vm.handleSearch}},[_vm._v("搜索")]),_vm._v(" "),_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.handleEdit1}},[_vm._v("创建子账户")]),_vm._v(" "),_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.createEnterprise}},[_vm._v("创建部门")])],1),_vm._v(" "),_c('el-table',{ref:"multipleTable",staticClass:"table",attrs:{"data":_vm.tableData,"border":"","header-cell-class-name":"table-header"},on:{"selection-change":_vm.handleSelectionChange}},[_c('el-table-column',{attrs:{"prop":"id","label":"ID","width":"55","align":"center"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"name","label":"名称"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"parentName","label":"上级"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"personNum","label":"人员"}}),_vm._v(" "),_c('el-table-column',{attrs:{"label":"操作","width":"180","align":"center"},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [_c('el-button',{attrs:{"type":"text","icon":"el-icon-edit"},on:{"click":function($event){return _vm.handleEdit(scope.$index, scope.row)}}},[_vm._v("编辑")]),_vm._v(" "),_c('el-button',{staticClass:"red",attrs:{"type":"text","icon":"el-icon-delete"},on:{"click":function($event){return _vm.handleDelete(scope.$index, scope.row)}}},[_vm._v("删除")])]}}],null,false,2927004000)})],1),_vm._v(" "),_c('div',{staticClass:"pagination"},[_c('el-pagination',{attrs:{"background":"","layout":"total, prev, pager, next","current-page":_vm.pageIndex,"page-size":_vm.pageSize,"total":_vm.pageTotal},on:{"current-change":_vm.handlePageChange}})],1),_vm._v(" "),_c('el-dialog',{attrs:{"title":"编辑","visible":_vm.editVisible1,"width":"30%"},on:{"update:visible":function($event){_vm.editVisible1=$event}},scopedSlots:_vm._u([{key:"footer",fn:function(){return [_c('span',{staticClass:"dialog-footer"},[_c('el-button',{on:{"click":function($event){_vm.editVisible1 = false}}},[_vm._v("取 消")]),_vm._v(" "),_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.saveEdit1}},[_vm._v("保 存")])],1)]},proxy:true}],null,false,4211661439)},[_c('el-form',{ref:"addform",staticClass:"demo-ruleForm",attrs:{"model":_vm.addform,"rules":_vm.rules,"label-width":"100px"}},[_c('el-form-item',{attrs:{"label":"用户名","prop":"username"}},[_c('el-input',{model:{value:(_vm.addform.username),callback:function ($$v) {_vm.$set(_vm.addform, "username", $$v)},expression:"addform.username"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"电话","prop":"phone"}},[_c('el-input',{model:{value:(_vm.addform.phone),callback:function ($$v) {_vm.$set(_vm.addform, "phone", $$v)},expression:"addform.phone"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"密码","prop":"password"}},[_c('el-input',{model:{value:(_vm.addform.password),callback:function ($$v) {_vm.$set(_vm.addform, "password", $$v)},expression:"addform.password"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"部门","prop":"enterpriseName"}},[_c('el-select',{attrs:{"placeholder":"请选择"},on:{"change":_vm.enterfun},model:{value:(_vm.addform.enterpriseName),callback:function ($$v) {_vm.$set(_vm.addform, "enterpriseName", $$v)},expression:"addform.enterpriseName"}},_vm._l((_vm.enterpriselist),function(item){return _c('el-option',{key:item.id,attrs:{"label":item.name,"value":item.id}})}),1)],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"用户身份","prop":"identity"}},[_c('el-select',{attrs:{"placeholder":"请选择"},model:{value:(_vm.identity),callback:function ($$v) {_vm.identity=$$v},expression:"identity"}},_vm._l((_vm.yhsflist),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":"用户类型","prop":"userType"}},[_c('el-select',{attrs:{"placeholder":"请选择"},model:{value:(_vm.userType),callback:function ($$v) {_vm.userType=$$v},expression:"userType"}},_vm._l((_vm.yhlxlist),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-select',{attrs:{"placeholder":"请选择"},model:{value:(_vm.addform.roleId),callback:function ($$v) {_vm.$set(_vm.addform, "roleId", $$v)},expression:"addform.roleId"}},_vm._l((_vm.rololist),function(item){return _c('el-option',{key:item.id,attrs:{"label":item.name,"value":item.id}})}),1)],1)],1)],1)],1),_vm._v(" "),_c('el-dialog',{attrs:{"title":"编辑","visible":_vm.editVisible,"width":"30%"},on:{"update:visible":function($event){_vm.editVisible=$event}},scopedSlots:_vm._u([{key:"footer",fn:function(){return [_c('span',{staticClass:"dialog-footer"},[_c('el-button',{on:{"click":function($event){_vm.editVisible = false}}},[_vm._v("取 消")]),_vm._v(" "),_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.saveEdit}},[_vm._v("确 定")])],1)]},proxy:true}],null,false,2750799758)},[_c('el-form',{ref:"form",attrs:{"model":_vm.form,"label-width":"70px"}},[_c('el-form-item',{attrs:{"label":"旧密码"}},[_c('el-input',{attrs:{"show-password":""},model:{value:(_vm.modifyfrom.oldPassword),callback:function ($$v) {_vm.$set(_vm.modifyfrom, "oldPassword", $$v)},expression:"modifyfrom.oldPassword"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"新密码"}},[_c('el-input',{attrs:{"show-password":""},model:{value:(_vm.modifyfrom.newPassword),callback:function ($$v) {_vm.$set(_vm.modifyfrom, "newPassword", $$v)},expression:"modifyfrom.newPassword"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"确认密码"}},[_c('el-input',{attrs:{"show-password":""},model:{value:(_vm.modifyfrom.confirmPassword),callback:function ($$v) {_vm.$set(_vm.modifyfrom, "confirmPassword", $$v)},expression:"modifyfrom.confirmPassword"}})],1)],1)],1),_vm._v(" "),_c('el-dialog',{attrs:{"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(" "),_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.addEnterprise}},[_vm._v("确 定")])],1)]},proxy:true}],null,false,2948929809)},[_c('el-form',{ref:"form",attrs:{"model":_vm.Enterprise,"label-width":"70px"}},[_c('el-form-item',{attrs:{"label":"部门名字"}},[_c('el-input',{model:{value:(_vm.Enterprise.name),callback:function ($$v) {_vm.$set(_vm.Enterprise, "name", $$v)},expression:"Enterprise.name"}})],1)],1)],1)],1):_vm._e()}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var views_administrativeDepartment = (esExports);
// CONCATENATED MODULE: ./src/views/administrativeDepartment.vue
function injectStyle (ssrContext) {
  __webpack_require__("dkyW")
}
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-2a0c4926"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  administrativeDepartment,
  views_administrativeDepartment,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

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


/***/ })

});