webpackJsonp([30],{ /***/ "K/kD": /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ "dlid": /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ "wgqa": /***/ (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/bindingRoles.vue // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var bindingRoles = ({ inject: ['reload'], name: "basetable", data: function data() { return { selectoption: [], selectoptionValue: '', defaultkeys: [], query: { address: "", name: "", pageIndex: 1, pageSize: 5, options: [{ value: "xaxqgy", label: "雄安新区XXX公寓", children: [] }] }, radio: 1, treedata: [], defaultProps: { children: "children", label: "label" }, options: [{ value: "选项1", label: "超级系统管理员" }, { value: "选项2", label: "业务员" }], value: "", tableData: [], multipleSelection: [], delList: [], editVisible: false, editVisible1: false, pageTotal: 0, form: {}, form1: {}, idx: -1, id: -1, tableRowClassName: "", selectedstyle: "", pageNum: 1, userInfo: { type: '' } }; }, created: function created() { this.userInfo = JSON.parse(localStorage.getItem('info')); this.getUserID(); this.getUserList(); this.selectoption = JSON.parse(localStorage.getItem('selectoption')); this.selectoptionValue = localStorage.getItem('tenantId'); }, methods: { selectTenantId: function selectTenantId(e) { localStorage.setItem('tenantId', e); this.reload(); }, // 勾选角色 handleCheckChange: function handleCheckChange() { var authoritieslist = this.$refs.tree.getCheckedNodes(); var authorities = []; for (var i in authoritieslist) { // 判断子节点是否存在子节点 如果存在直接请求并且提示 false if (!authoritieslist[i].hasOwnProperty("children")) { // 判断是否只选择一个 如果存在直接请求并且提示 false authoritieslist.map(function (li) { authorities.push(li.id); }); this.authorities = authorities; // if (authoritieslist.length == 1) { // console.log(authoritieslist); // } else { // this.$message.error("只选择一个节点"); // this.$refs.tree.setCheckedKeys([]); // return // } } else { this.$message.error("只能选择当前分类最后的子分类"); this.$refs.tree.setCheckedKeys([]); return; } } }, // 用户绑定角色 bindUser: function bindUser() { var _this = this; var data = { userId: this.userId, roleIds: this.authorities || [] }; Object(api["g" /* httpPost */])(data, this.$api.bindRole).then(function (res) { if (res.success) { _this.$message.success('添加成功'); } else { _this.$message.error('添加失败'); } }); }, // 获取用户列表 getUserList: function getUserList() { var _this2 = this; var info = localStorage.getItem('info'); var q = {}; if (JSON.parse(info).type == 0) { q = { username: this.query.name }; } else { q = { username: this.query.name, enterpriseId: JSON.parse(info).enterpriseId }; } var data = { q: stringify_default()(q), pageNum: this.pageNum, pageSize: 5 }; Object(api["d" /* httpGet */])(data, this.$api.getUserList).then(function (res) { if (res.success) { var dt = res.data.list; dt.map(function (li, index) { li.index = ""; li.index = index; }); _this2.tableData = dt; _this2.pageTotal = res.data.total; } else { _this2.$message.error('获取失败'); } }); }, // 获取角色id getUserID: function getUserID() { var _this3 = this; var data = { pageNum: 1, pageSize: 100 }; Object(api["d" /* httpGet */])(data, this.$api.getRoleList).then(function (res) { var obj = []; res.data.list.map(function (li) { var str = { id: li.id, label: li.name }; obj.push(str); }); _this3.treedata = obj; }); }, handleChange: function handleChange(value) { console.log(value); }, // 触发搜索按钮 handleSearch: function handleSearch() { this.$set(this.query, "pageIndex", 1); this.$store.commit('increment', 1); this.getData(); }, getData: function getData() { var _this4 = this; var info = localStorage.getItem('info'); var q = {}; if (JSON.parse(info).type == 0) { q = { username: this.query.name }; } else { q = { username: this.query.name, enterpriseId: JSON.parse(info).enterpriseId }; } var data = { q: stringify_default()(q), pageNum: this.pageNum, pageSize: 5 }; Object(api["d" /* httpGet */])(data, this.$api.getUserList).then(function (res) { var dt = res.data.list; dt.map(function (li, index) { li.index = ""; li.index = index; }); _this4.$store.commit('increment', 1); _this4.tableData = dt; _this4.pageTotal = res.data.total; }); }, // 删除操作 handleDelete: function handleDelete(index) { var _this5 = this; // 二次确认删除 this.$confirm("确定要删除吗?", "提示", { type: "warning" }).then(function () { _this5.$message.success("删除成功"); _this5.tableData.splice(index, 1); }).catch(function () {}); }, // 多选操作 handleSelectionChange: function handleSelectionChange(val) { this.getIndex = val.index; this.userId = val.id; this.getroleId(val.id); }, getroleId: function getroleId(id) { var _this6 = this; var data = { userId: id }; Object(api["d" /* httpGet */])(data, this.$api.getRolesByUser).then(function (res) { if (res.success) { if (res.data.length > 0) { var defaultkeys = []; _this6.$refs.tree.setCheckedKeys([]); res.data.map(function (li) { defaultkeys.push(li.id); }); // defaultkeys.push(res.data[0].id) console.log(defaultkeys); _this6.defaultkeys = defaultkeys; } else { _this6.defaultkeys = []; _this6.$refs.tree.setCheckedKeys([]); } } else { _this6.$message.error('获取失败'); } }); }, 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; this.editVisible = true; }, // 保存编辑 saveEdit: function saveEdit() { this.editVisible = false; this.$message.success("\u4FEE\u6539\u7B2C " + (this.idx + 1) + " \u884C\u6210\u529F"); this.$set(this.tableData, this.idx, this.form); }, // 编辑操作 handleEdit1: function handleEdit1() { this.editVisible1 = true; }, // 保存编辑 saveEdit1: function saveEdit1() { this.editVisible1 = false; }, // 分页导航 handlePageChange: function handlePageChange(val) { this.pageNum = val; this.getUserList(val); } } }); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-58fbb739","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/bindingRoles.vue var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('el-row',{staticStyle:{"background":"#fff","padding":"20px"},attrs:{"gutter":20}},[_c('el-col',{attrs:{"span":12}},[_c('div',{staticStyle:{"margin-bottom":"20px"}},[_c('selectoption'),_vm._v(" "),_c('el-input',{staticClass:"handle-input mr10",attrs:{"size":"small","placeholder":"登录账号","clearable":true},model:{value:(_vm.query.name),callback:function ($$v) {_vm.$set(_vm.query, "name", $$v)},expression:"query.name"}}),_vm._v(" "),_c('el-button',{staticStyle:{"background":"#FA8E00","border":"none"},attrs:{"type":"primary","size":"small","icon":"el-icon-search"},on:{"click":_vm.handleSearch}},[_vm._v("搜索")])],1),_vm._v(" "),_c('div',{staticClass:"container"},[_c('el-table',{ref:"multipleTable",staticClass:"table",attrs:{"data":_vm.tableData,"border":"","highlight-current-row":"","header-cell-class-name":"table-header"},on:{"row-click":_vm.handleSelectionChange}},[_c('el-table-column',{attrs:{"prop":"id","label":"ID","width":"55","align":"center"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"username","label":"登录账号"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"type","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("\n 删除")])]}}])})],1),_vm._v(" "),_c('div',{staticClass:"pagination"},[_c('el-pagination',{attrs:{"background":"","layout":"total, prev, pager, next","current-page":_vm.query.pageIndex,"page-size":_vm.query.pageSize,"total":_vm.pageTotal},on:{"current-change":_vm.handlePageChange}})],1)],1)]),_vm._v(" "),_c('el-col',{attrs:{"span":12}},[_c('div',{staticClass:"prever"},[_c('el-button',{staticStyle:{"background":"#FA8E00","border":"none"},attrs:{"type":"primary","size":"small"},on:{"click":_vm.bindUser}},[_vm._v("保存设置")])],1),_vm._v(" "),_c('div',{staticClass:"treediv"},[_c('el-tree',{ref:"tree",attrs:{"data":_vm.treedata,"default-checked-keys":_vm.defaultkeys,"show-checkbox":"","node-key":"id","default-expand-all":"","props":_vm.defaultProps},on:{"check":_vm.handleCheckChange}})],1)])],1),_vm._v(" "),_c('el-dialog',{attrs:{"title":"编辑","width":"30%"},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}]),model:{value:(_vm.editVisible),callback:function ($$v) {_vm.editVisible=$$v},expression:"editVisible"}},[_c('el-form',{ref:"form",attrs:{"model":_vm.form,"label-width":"70px"}},[_c('el-form-item',{attrs:{"label":"用户名"}},[_c('el-input',{attrs:{"clearable":true},model:{value:(_vm.form.name),callback:function ($$v) {_vm.$set(_vm.form, "name", $$v)},expression:"form.name"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"类型"}},[_c('el-input',{attrs:{"clearable":true},model:{value:(_vm.form.address),callback:function ($$v) {_vm.$set(_vm.form, "address", $$v)},expression:"form.address"}})],1)],1)],1),_vm._v(" "),_c('el-dialog',{attrs:{"title":"编辑","width":"30%"},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}]),model:{value:(_vm.editVisible1),callback:function ($$v) {_vm.editVisible1=$$v},expression:"editVisible1"}},[_c('el-form',{ref:"form",attrs:{"model":_vm.form1,"label-width":"70px"}},[_c('el-form-item',{attrs:{"label":"用户名"}},[_c('el-input',{attrs:{"clearable":true},model:{value:(_vm.form1.name),callback:function ($$v) {_vm.$set(_vm.form1, "name", $$v)},expression:"form1.name"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"类型"}},[_c('el-select',{attrs:{"placeholder":"请选择"},model:{value:(_vm.value),callback:function ($$v) {_vm.value=$$v},expression:"value"}},_vm._l((_vm.options),function(item){return _c('el-option',{key:item.value,attrs:{"label":item.label,"value":item.value}})}),1)],1)],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"默认角色"}},[_c('el-radio-group',{model:{value:(_vm.radio),callback:function ($$v) {_vm.radio=$$v},expression:"radio"}},[_c('el-radio',{attrs:{"label":1},model:{value:(_vm.radio),callback:function ($$v) {_vm.radio=$$v},expression:"radio"}},[_vm._v("是")]),_vm._v(" "),_c('el-radio',{attrs:{"label":2},model:{value:(_vm.radio),callback:function ($$v) {_vm.radio=$$v},expression:"radio"}},[_vm._v("否")])],1)],1)],1)],1)} var staticRenderFns = [] var esExports = { render: render, staticRenderFns: staticRenderFns } /* harmony default export */ var views_bindingRoles = (esExports); // CONCATENATED MODULE: ./src/views/bindingRoles.vue function injectStyle (ssrContext) { __webpack_require__("K/kD") __webpack_require__("dlid") } 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-58fbb739" /* moduleIdentifier (server only) */ var __vue_module_identifier__ = null var Component = normalizeComponent( bindingRoles, views_bindingRoles, __vue_template_functional__, __vue_styles__, __vue_scopeId__, __vue_module_identifier__ ) /* harmony default export */ var src_views_bindingRoles = __webpack_exports__["default"] = (Component.exports); /***/ }) });