1 |
- {"version":3,"sources":["webpack:///src/views/ums/role/allocResource.vue","webpack:///./src/views/ums/role/allocResource.vue?524d","webpack:///./src/views/ums/role/allocResource.vue","webpack:///./src/api/resource.js"],"names":["allocResource","name","data","roleId","allResource","allResourceCate","created","this","$route","query","getAllResourceCateList","methods","getAllResourceList","_this","Object","resource","then","response","i","length","checked","getResourceByRole","_this2","resourceCategory","getResourceByCate","categoryId","cateResource","push","_this3","role","forEach","item","getResourceChecked","id","isAllChecked","$forceUpdate","resourceId","isIndeterminate","cateResources","checkedCount","handleSave","_this4","$confirm","confirmButtonText","cancelButtonText","type","checkedResourceIds","set_default","a","add","obj","resourceIds","from_default","join","$message","message","duration","$router","back","handleClear","handleCheckAllChange","cate","handleCheckChange","_this5","role_allocResource","render","_vm","_h","$createElement","_c","_self","staticClass","attrs","shadow","_l","index","key","class","staticStyle","background","indeterminate","on","change","$event","model","value","callback","$$v","$set","expression","_v","_s","padding","span","margin-top","align","click","staticRenderFns","Component","__webpack_require__","normalizeComponent","ssrContext","__webpack_exports__","params","__WEBPACK_IMPORTED_MODULE_0__utils_request__","url","method"],"mappings":"0LA+BAA,GACAC,KAAA,gBACAC,KAFA,WAGA,OACAC,OAAA,KACAC,YAAA,KACAC,gBAAA,OAGAC,QATA,WAUAC,KAAAJ,OAAAI,KAAAC,OAAAC,MAAAN,OACAI,KAAAG,0BAEAC,SACAC,mBADA,WACA,IAAAC,EAAAN,KACAO,OAAAC,EAAA,EAAAD,GAAAE,KAAA,SAAAC,GACAJ,EAAAT,YAAAa,EAAAf,KACA,QAAAgB,EAAA,EAAAA,EAAAL,EAAAT,YAAAe,OAAAD,IACAL,EAAAT,YAAAc,GAAAE,SAAA,EAEAP,EAAAQ,kBAAAR,EAAAV,WAGAO,uBAVA,WAUA,IAAAY,EAAAf,KACAO,OAAAS,EAAA,EAAAT,GAAAE,KAAA,SAAAC,GACAK,EAAAjB,gBAAAY,EAAAf,KACA,QAAAgB,EAAA,EAAAA,EAAAI,EAAAjB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oECxBO,SAAmBK,GACxB,OAAOzF,OAAA0F,EAAA,EAAA1F,EACL2F,IAAK,iBACLC,OAAQ,MACRH,OAAQA,SAIL,SAAwBrG,GAC7B,OAAOY,OAAA0F,EAAA,EAAA1F,EACL2F,IAAK,mBACLC,OAAQ,OACRxG,KAAMA,SAIH,SAAwB+B,EAAI/B,GACjC,OAAOY,OAAA0F,EAAA,EAAA1F,EACL2F,IAAK,oBAAsBxE,EAC3ByE,OAAQ,OACRxG,KAAMA,SAIH,SAAwB+B,GAC7B,OAAOnB,OAAA0F,EAAA,EAAA1F,EACL2F,IAAK,oBAAsBxE,EAC3ByE,OAAQ,cAIL,WACL,OAAO5F,OAAA0F,EAAA,EAAA1F,EACL2F,IAAK,oBACLC,OAAQ","file":"static/js/23.ccbd70c3727702978066.js","sourcesContent":["<template>\r\n <el-card class=\"form-container\" shadow=\"never\">\r\n <div v-for=\"(cate,index) in allResourceCate\" :class=\"index===0?'top-line':null\" :key=\"'cate'+cate.id\">\r\n <el-row class=\"table-layout\" style=\"background: #F2F6FC;\">\r\n <el-checkbox v-model=\"cate.checked\"\r\n :indeterminate=\"isIndeterminate(cate.id)\"\r\n @change=\"handleCheckAllChange(cate)\">\r\n {{cate.name}}\r\n </el-checkbox>\r\n </el-row>\r\n <el-row class=\"table-layout\">\r\n <el-col :span=\"8\" v-for=\"resource in getResourceByCate(cate.id)\" :key=\"resource.id\" style=\"padding: 4px 0\">\r\n <el-checkbox v-model=\"resource.checked\" @change=\"handleCheckChange(resource)\">\r\n {{resource.name}}\r\n </el-checkbox>\r\n </el-col>\r\n </el-row>\r\n </div>\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\r\n </el-card>\r\n</template>\r\n\r\n<script>\r\n import {fetchAllResourceList} from '@/api/resource';\r\n import {listAllCate} from '@/api/resourceCategory';\r\n import {allocResource,listResourceByRole} from '@/api/role';\r\n\r\n export default {\r\n name: \"allocResource\",\r\n data() {\r\n return {\r\n roleId: null,\r\n allResource: null,\r\n allResourceCate: null\r\n };\r\n },\r\n created() {\r\n this.roleId = this.$route.query.roleId;\r\n this.getAllResourceCateList();\r\n },\r\n methods: {\r\n getAllResourceList() {\r\n fetchAllResourceList().then(response => {\r\n this.allResource = response.data;\r\n for (let i = 0; i < this.allResource.length; i++) {\r\n this.allResource[i].checked = false;\r\n }\r\n this.getResourceByRole(this.roleId);\r\n });\r\n },\r\n getAllResourceCateList() {\r\n listAllCate().then(response => {\r\n this.allResourceCate = response.data;\r\n for (let i = 0; i < this.allResourceCate.length; i++) {\r\n this.allResourceCate[i].checked = false;\r\n }\r\n this.getAllResourceList();\r\n });\r\n },\r\n getResourceByCate(categoryId) {\r\n let cateResource = [];\r\n if (this.allResource == null) return null;\r\n for (let i = 0; i < this.allResource.length; i++) {\r\n let resource = this.allResource[i];\r\n if (resource.categoryId === categoryId) {\r\n cateResource.push(resource);\r\n }\r\n }\r\n return cateResource;\r\n },\r\n getResourceByRole(roleId){\r\n listResourceByRole(roleId).then(response=>{\r\n let allocResource = response.data;\r\n this.allResource.forEach(item=>{\r\n item.checked = this.getResourceChecked(item.id,allocResource);\r\n });\r\n this.allResourceCate.forEach(item=>{\r\n item.checked = this.isAllChecked(item.id);\r\n });\r\n this.$forceUpdate();\r\n });\r\n },\r\n getResourceChecked(resourceId,allocResource){\r\n if(allocResource==null||allocResource.length===0) return false;\r\n for(let i=0;i<allocResource.length;i++){\r\n if(allocResource[i].id===resourceId){\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n isIndeterminate(categoryId) {\r\n let cateResources = this.getResourceByCate(categoryId);\r\n if (cateResources == null) return false;\r\n let checkedCount = 0;\r\n for (let i = 0; i < cateResources.length; i++) {\r\n if (cateResources[i].checked === true) {\r\n checkedCount++;\r\n }\r\n }\r\n return !(checkedCount === 0 || checkedCount === cateResources.length);\r\n },\r\n isAllChecked(categoryId) {\r\n let cateResources = this.getResourceByCate(categoryId);\r\n if (cateResources == null) return false;\r\n let checkedCount = 0;\r\n for (let i = 0; i < cateResources.length; i++) {\r\n if (cateResources[i].checked === true) {\r\n checkedCount++;\r\n }\r\n }\r\n if(checkedCount===0){\r\n return false;\r\n }\r\n return checkedCount === cateResources.length;\r\n },\r\n handleSave() {\r\n this.$confirm('是否分配资源?', '提示', {\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消',\r\n type: 'warning'\r\n }).then(() => {\r\n let checkedResourceIds = new Set();\r\n if (this.allResource != null && this.allResource.length > 0) {\r\n this.allResource.forEach(item => {\r\n if (item.checked) {\r\n checkedResourceIds.add(item.id);\r\n }\r\n });\r\n }\r\n // let params = new URLSearchParams();\r\n // params.append(\"roleId\", this.roleId);\r\n // params.append(\"resourceIds\", Array.from(checkedResourceIds).join(','));\r\n let obj = {\r\n roleId:this.roleId,\r\n resourceIds:Array.from(checkedResourceIds).join(',')\r\n }\r\n allocResource(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.allResourceCate.forEach(item => {\r\n item.checked = false;\r\n });\r\n this.allResource.forEach(item => {\r\n item.checked = false;\r\n });\r\n this.$forceUpdate();\r\n },\r\n handleCheckAllChange(cate) {\r\n let cateResources = this.getResourceByCate(cate.id);\r\n for (let i = 0; i < cateResources.length; i++) {\r\n cateResources[i].checked = cate.checked;\r\n }\r\n this.$forceUpdate();\r\n },\r\n handleCheckChange(resource) {\r\n this.allResourceCate.forEach(item=>{\r\n if(item.id===resource.categoryId){\r\n item.checked = this.isAllChecked(resource.categoryId);\r\n }\r\n });\r\n this.$forceUpdate();\r\n }\r\n }\r\n }\r\n</script>\r\n\r\n<style scoped>\r\n .table-layout {\r\n padding: 20px;\r\n border-left: 1px solid #DCDFE6;\r\n border-right: 1px solid #DCDFE6;\r\n border-bottom: 1px solid #DCDFE6;\r\n }\r\n\r\n .top-line {\r\n border-top: 1px solid #DCDFE6;\r\n }\r\n</style>\r\n\n\n\n// WEBPACK FOOTER //\n// src/views/ums/role/allocResource.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\"}},[_vm._l((_vm.allResourceCate),function(cate,index){return _c('div',{key:'cate'+cate.id,class:index===0?'top-line':null},[_c('el-row',{staticClass:\"table-layout\",staticStyle:{\"background\":\"#F2F6FC\"}},[_c('el-checkbox',{attrs:{\"indeterminate\":_vm.isIndeterminate(cate.id)},on:{\"change\":function($event){_vm.handleCheckAllChange(cate)}},model:{value:(cate.checked),callback:function ($$v) {_vm.$set(cate, \"checked\", $$v)},expression:\"cate.checked\"}},[_vm._v(\"\\n \"+_vm._s(cate.name)+\"\\n \")])],1),_vm._v(\" \"),_c('el-row',{staticClass:\"table-layout\"},_vm._l((_vm.getResourceByCate(cate.id)),function(resource){return _c('el-col',{key:resource.id,staticStyle:{\"padding\":\"4px 0\"},attrs:{\"span\":8}},[_c('el-checkbox',{on:{\"change\":function($event){_vm.handleCheckChange(resource)}},model:{value:(resource.checked),callback:function ($$v) {_vm.$set(resource, \"checked\", $$v)},expression:\"resource.checked\"}},[_vm._v(\"\\n \"+_vm._s(resource.name)+\"\\n \")])],1)}))],1)}),_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)],2)}\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-728cbc1d\",\"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/allocResource.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-728cbc1d\\\",\\\"scoped\\\":true,\\\"hasInlineConfig\\\":false}!../../../../node_modules/vue-loader/lib/selector?type=styles&index=0!./allocResource.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!./allocResource.vue\"\nimport __vue_script__ from \"!!babel-loader!../../../../node_modules/vue-loader/lib/selector?type=script&index=0!./allocResource.vue\"\n/* template */\nimport __vue_template__ from \"!!../../../../node_modules/vue-loader/lib/template-compiler/index?{\\\"id\\\":\\\"data-v-728cbc1d\\\",\\\"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!./allocResource.vue\"\n/* template functional */\nvar __vue_template_functional__ = false\n/* styles */\nvar __vue_styles__ = injectStyle\n/* scopeId */\nvar __vue_scopeId__ = \"data-v-728cbc1d\"\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/allocResource.vue\n// module id = null\n// module chunks = ","import request from '@/utils/request'\r\n\r\nexport function fetchList(params) {\r\n return request({\r\n url: '/resource/list',\r\n method: 'get',\r\n params: params\r\n })\r\n}\r\n\r\nexport function createResource(data) {\r\n return request({\r\n url: '/resource/create',\r\n method: 'post',\r\n data: data\r\n })\r\n}\r\n\r\nexport function updateResource(id, data) {\r\n return request({\r\n url: '/resource/update/' + id,\r\n method: 'post',\r\n data: data\r\n })\r\n}\r\n\r\nexport function deleteResource(id) {\r\n return request({\r\n url: '/resource/delete/' + id,\r\n method: 'post'\r\n })\r\n}\r\n\r\nexport function fetchAllResourceList() {\r\n return request({\r\n url: '/resource/listAll',\r\n method: 'get'\r\n })\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/api/resource.js"],"sourceRoot":""}
|