1 |
- {"version":3,"sources":["webpack:///src/views/ums/role/allocMenu.vue","webpack:///./src/views/ums/role/allocMenu.vue?f742","webpack:///./src/views/ums/role/allocMenu.vue"],"names":["allocMenu","name","data","menuTreeList","defaultProps","children","label","roleId","created","this","$route","query","treeList","getRoleMenu","methods","_this","Object","menu","then","response","_this2","role","menuList","checkedMenuIds","length","i","parentId","push","id","$refs","tree","setCheckedKeys","handleSave","_this3","checkedNodes","getCheckedNodes","set_default","a","checkedNode","add","$confirm","confirmButtonText","cancelButtonText","type","obj","menuIds","from_default","join","$message","message","duration","$router","back","handleClear","role_allocMenu","render","_vm","_h","$createElement","_c","_self","staticClass","attrs","shadow","ref","show-checkbox","default-expand-all","node-key","highlight-current","props","_v","staticStyle","margin-top","align","on","click","$event","staticRenderFns","Component","__webpack_require__","normalizeComponent","ssrContext","__webpack_exports__"],"mappings":"iMAuBAA,GACAC,KAAA,YACAC,KAFA,WAGA,OACAC,gBACAC,cACAC,SAAA,WACAC,MAAA,SAEAC,OAAA,OAGAC,QAZA,WAaAC,KAAAF,OAAAE,KAAAC,OAAAC,MAAAJ,OACAE,KAAAG,WACAH,KAAAI,YAAAJ,KAAAF,SAEAO,SACAF,SADA,WACA,IAAAG,EAAAN,KACAO,OAAAC,EAAA,EAAAD,GAAAE,KAAA,SAAAC,GACAJ,EAAAZ,aAAAgB,EAAAjB,QAGAW,YANA,SAMAN,GAAA,IAAAa,EAAAX,KACAO,OAAAK,EAAA,EAAAL,CAAAT,GAAAW,KAAA,SAAAC,GACA,IAAAG,EAAAH,EAAAjB,KACAqB,KACA,SAAAD,KAAAE,OAAA,EACA,QAAAC,EAAA,EAAAA,EAAAH,EAAAE,OAAAC,IAAA,CACA,IAAAR,EAAAK,EAAAG,GACA,IAAAR,EAAAS,UACAH,EAAAI,KAAAV,EAAAW,IAIAR,EAAAS,MAAAC,KAAAC,eAAAR,MAGAS,WArBA,WAqBA,IAAAC,EAAAxB,KACAyB,EAAAzB,KAAAoB,MAAAC,KAAA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AAA,SAaA,kBAEA,MAUAG,EAAA,QAAAJ,EAAA","file":"static/js/38.be83db5c8c3b4f377ef5.js","sourcesContent":["<template>\r\n <el-card class=\"form-container\" shadow=\"never\">\r\n <el-tree\r\n :data=\"menuTreeList\"\r\n show-checkbox\r\n default-expand-all\r\n node-key=\"id\"\r\n ref=\"tree\"\r\n highlight-current\r\n :props=\"defaultProps\"\r\n >\r\n </el-tree>\r\n <div style=\"margin-top: 20px\" align=\"center\">\r\n <el-button type=\"primary\" @click=\"handleSave()\">保存</el-button>\r\n <el-button @click=\"handleClear()\">清空</el-button>\r\n </div>\r\n </el-card>\r\n</template>\r\n\r\n<script>\r\nimport { fetchTreeList } from \"@/api/menu\";\r\nimport { listMenuByRole, allocMenu } from \"@/api/role\";\r\n\r\nexport default {\r\n name: \"allocMenu\",\r\n data() {\r\n return {\r\n menuTreeList: [],\r\n defaultProps: {\r\n children: \"children\",\r\n label: \"title\",\r\n },\r\n roleId: null,\r\n };\r\n },\r\n created() {\r\n this.roleId = this.$route.query.roleId;\r\n this.treeList();\r\n this.getRoleMenu(this.roleId);\r\n },\r\n methods: {\r\n treeList() {\r\n fetchTreeList().then((response) => {\r\n this.menuTreeList = response.data;\r\n });\r\n },\r\n getRoleMenu(roleId) {\r\n listMenuByRole(roleId).then((response) => {\r\n let menuList = response.data;\r\n let checkedMenuIds = [];\r\n if (menuList != null && menuList.length > 0) {\r\n for (let i = 0; i < menuList.length; i++) {\r\n let menu = menuList[i];\r\n if (menu.parentId !== 0) {\r\n checkedMenuIds.push(menu.id);\r\n }\r\n }\r\n }\r\n this.$refs.tree.setCheckedKeys(checkedMenuIds);\r\n });\r\n },\r\n handleSave() {\r\n let checkedNodes = this.$refs.tree.getCheckedNodes();\r\n let checkedMenuIds = new Set();\r\n if (checkedNodes != null && checkedNodes.length > 0) {\r\n for (let i = 0; i < checkedNodes.length; i++) {\r\n let checkedNode = checkedNodes[i];\r\n checkedMenuIds.add(checkedNode.id);\r\n if (checkedNode.parentId !== 0) {\r\n checkedMenuIds.add(checkedNode.parentId);\r\n }\r\n }\r\n }\r\n this.$confirm(\"是否分配菜单?\", \"提示\", {\r\n confirmButtonText: \"确定\",\r\n cancelButtonText: \"取消\",\r\n type: \"warning\",\r\n }).then(() => {\r\n // let params = new URLSearchParams();\r\n // params.append(\"roleId\", this.roleId);\r\n // params.append(\"menuIds\", Array.from(checkedMenuIds));\r\n let menuIds = Array.from(checkedMenuIds).join(',')\r\n let obj = {\r\n menuIds:menuIds,\r\n roleId: this.roleId,\r\n };\r\n allocMenu(obj).then((response) => {\r\n this.$message({\r\n message: \"分配成功\",\r\n type: \"success\",\r\n duration: 1000,\r\n });\r\n this.$router.back();\r\n });\r\n });\r\n },\r\n handleClear() {\r\n this.$refs.tree.setCheckedKeys([]);\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style scoped>\r\n</style>\r\n\n\n\n// WEBPACK FOOTER //\n// src/views/ums/role/allocMenu.vue","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-card',{staticClass:\"form-container\",attrs:{\"shadow\":\"never\"}},[_c('el-tree',{ref:\"tree\",attrs:{\"data\":_vm.menuTreeList,\"show-checkbox\":\"\",\"default-expand-all\":\"\",\"node-key\":\"id\",\"highlight-current\":\"\",\"props\":_vm.defaultProps}}),_vm._v(\" \"),_c('div',{staticStyle:{\"margin-top\":\"20px\"},attrs:{\"align\":\"center\"}},[_c('el-button',{attrs:{\"type\":\"primary\"},on:{\"click\":function($event){_vm.handleSave()}}},[_vm._v(\"保存\")]),_vm._v(\" \"),_c('el-button',{on:{\"click\":function($event){_vm.handleClear()}}},[_vm._v(\"清空\")])],1)],1)}\nvar staticRenderFns = []\nvar esExports = { render: render, staticRenderFns: staticRenderFns }\nexport default esExports\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/vue-loader/lib/template-compiler?{\"id\":\"data-v-69c4c24c\",\"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/ums/role/allocMenu.vue\n// module id = null\n// module chunks = ","function injectStyle (ssrContext) {\n require(\"!!../../../../node_modules/extract-text-webpack-plugin/dist/loader.js?{\\\"omit\\\":1,\\\"remove\\\":true}!vue-style-loader!css-loader?{\\\"sourceMap\\\":true}!../../../../node_modules/vue-loader/lib/style-compiler/index?{\\\"vue\\\":true,\\\"id\\\":\\\"data-v-69c4c24c\\\",\\\"scoped\\\":true,\\\"hasInlineConfig\\\":false}!../../../../node_modules/vue-loader/lib/selector?type=styles&index=0!./allocMenu.vue\")\n}\nvar normalizeComponent = require(\"!../../../../node_modules/vue-loader/lib/component-normalizer\")\n/* script */\nexport * from \"!!babel-loader!../../../../node_modules/vue-loader/lib/selector?type=script&index=0!./allocMenu.vue\"\nimport __vue_script__ from \"!!babel-loader!../../../../node_modules/vue-loader/lib/selector?type=script&index=0!./allocMenu.vue\"\n/* template */\nimport __vue_template__ from \"!!../../../../node_modules/vue-loader/lib/template-compiler/index?{\\\"id\\\":\\\"data-v-69c4c24c\\\",\\\"hasScoped\\\":true,\\\"transformToRequire\\\":{\\\"video\\\":[\\\"src\\\",\\\"poster\\\"],\\\"source\\\":\\\"src\\\",\\\"img\\\":\\\"src\\\",\\\"image\\\":\\\"xlink:href\\\"},\\\"buble\\\":{\\\"transforms\\\":{}}}!../../../../node_modules/vue-loader/lib/selector?type=template&index=0!./allocMenu.vue\"\n/* template functional */\nvar __vue_template_functional__ = false\n/* styles */\nvar __vue_styles__ = injectStyle\n/* scopeId */\nvar __vue_scopeId__ = \"data-v-69c4c24c\"\n/* moduleIdentifier (server only) */\nvar __vue_module_identifier__ = null\nvar Component = normalizeComponent(\n __vue_script__,\n __vue_template__,\n __vue_template_functional__,\n __vue_styles__,\n __vue_scopeId__,\n __vue_module_identifier__\n)\n\nexport default Component.exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/views/ums/role/allocMenu.vue\n// module id = null\n// module chunks = "],"sourceRoot":""}
|