作者 小范

组织机构配置权限功能完善

@@ -161,6 +161,7 @@ @@ -161,6 +161,7 @@
161 :close-on-click-modal="false" 161 :close-on-click-modal="false"
162 top="5vh" width="75%" 162 top="5vh" width="75%"
163 > 163 >
  164 + <div v-loading.lock="isLoading">
164 <template> 165 <template>
165 <el-tabs style="border: 0px;background-color: rgba(0,0,0,0)" v-model="activeName" @tab-click="handleClick"> 166 <el-tabs style="border: 0px;background-color: rgba(0,0,0,0)" v-model="activeName" @tab-click="handleClick">
166 <el-tab-pane style="border: 0px;background-color: rgba(0,0,0,0)" label="权限管理" name="first"> 167 <el-tab-pane style="border: 0px;background-color: rgba(0,0,0,0)" label="权限管理" name="first">
@@ -203,6 +204,8 @@ @@ -203,6 +204,8 @@
203 </el-tab-pane> 204 </el-tab-pane>
204 </el-tabs> 205 </el-tabs>
205 </template> 206 </template>
  207 +
  208 + </div>
206 </el-dialog> 209 </el-dialog>
207 </section> 210 </section>
208 </template> 211 </template>
@@ -268,6 +271,8 @@ @@ -268,6 +271,8 @@
268 pageNum: 1, 271 pageNum: 1,
269 pageSize: 5, 272 pageSize: 5,
270 listLoading: false, 273 listLoading: false,
  274 + loading:{},
  275 + isLoading: false,
271 sels: [],//列表选中列 276 sels: [],//列表选中列
272 dialogMap: { 277 dialogMap: {
273 update: '编辑', 278 update: '编辑',
@@ -486,6 +491,14 @@ @@ -486,6 +491,14 @@
486 }, 491 },
487 // 配置权限管理 492 // 配置权限管理
488 setPerm: function (index, row) { 493 setPerm: function (index, row) {
  494 + // this.loading = this.$loading({
  495 + // lock: true,
  496 + // text: '加载中',
  497 + // spinner: 'el-icon-loading',
  498 + // background: 'rgba(0, 0, 0, 0.7)',
  499 + // fullscreen: true
  500 + // });
  501 + this.isLoading = true;
489 this.PermFormVisible = true; 502 this.PermFormVisible = true;
490 this.activeName= 'first'; 503 this.activeName= 'first';
491 //获取接口权限 504 //获取接口权限
@@ -530,6 +543,8 @@ @@ -530,6 +543,8 @@
530 }).catch(error => { 543 }).catch(error => {
531 // 关闭加载 544 // 关闭加载
532 _this.$message.error(error.toString()) 545 _this.$message.error(error.toString())
  546 + }).finally(()=>{
  547 + this.isLoading = false;
533 }) 548 })
534 }, 549 },
535 // 配置数据权限 550 // 配置数据权限
@@ -548,30 +563,6 @@ @@ -548,30 +563,6 @@
548 this.$refs.trees.setCheckedKeys(this.permForms.permissionIds); 563 this.$refs.trees.setCheckedKeys(this.permForms.permissionIds);
549 }); 564 });
550 }, 565 },
551 - //提交数据权限  
552 - setDataPerm(){  
553 - let _this = this;  
554 -  
555 - if (this.currentRolePermList && this.currentRolePermList.length>0){  
556 - this.currentRolePermList.forEach((v,i) =>{  
557 - _this.permForms.permissionIds[i]=v.data_perm_id;  
558 - })  
559 - }  
560 - dataPermSet(this.permForms).then((response) => {  
561 - const res = response.data  
562 - // 添加失败  
563 - if (res.code !== '200') {  
564 - // 关闭加载  
565 - return this.$message.error(res.msg)  
566 - }  
567 - // 添加,成功  
568 - this.$message.success(res.msg)  
569 - // 隐藏对话框  
570 - this.PermFormVisible = false;  
571 - }).catch(error => {  
572 - this.$message.error(error.toString())  
573 - })  
574 - },  
575 //显示新增界面,每次点开初始化数据 566 //显示新增界面,每次点开初始化数据
576 handleAdd: function (index,row) { 567 handleAdd: function (index,row) {
577 this.addFormVisible = true; 568 this.addFormVisible = true;
@@ -789,8 +780,37 @@ @@ -789,8 +780,37 @@
789 // } 780 // }
790 } 781 }
791 }, 782 },
792 - dataPermTreeClickDeal: function (currentObj, treeStatus) {  
793 - this.permForms.permissionIds.push(currentObj.data_perm_id); 783 + dataPermTreeClickDeal: function (currentObj, tree) {
  784 + // alert(JSON.stringify(tree.checkedKeys))
  785 + // alert("选择前的数组="+this.permForms.permissionIds)
  786 + this.permForms.permissionIds = tree.checkedKeys
  787 + // alert("选择后的数组="+this.permForms.permissionIds)
  788 + },
  789 + //提交数据权限
  790 + setDataPerm(){
  791 + this.loading = this.$loading({
  792 + lock: true,
  793 + text: '正在提交',
  794 + spinner: 'el-icon-loading',
  795 + background: 'rgba(0, 0, 0, 0.7)'
  796 + });
  797 + let _this = this;
  798 + dataPermSet(this.permForms).then((response) => {
  799 + const res = response.data
  800 + // 添加失败
  801 + if (res.code !== '200') {
  802 + // 关闭加载
  803 + return this.$message.error(res.msg)
  804 + }
  805 + // 添加,成功
  806 + this.$message.success(res.msg)
  807 + // 隐藏对话框
  808 + this.PermFormVisible = false;
  809 + }).catch(error => {
  810 + this.$message.error(error.toString())
  811 + }).finally(()=>{
  812 + this.loading.close()
  813 + })
794 }, 814 },
795 815
796 }, 816 },
@@ -805,6 +825,7 @@ @@ -805,6 +825,7 @@
805 } 825 }
806 }; 826 };
807 this.isExpansion=true; 827 this.isExpansion=true;
  828 +
808 } 829 }
809 } 830 }
810 831