作者 小范

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

@@ -161,48 +161,51 @@ @@ -161,48 +161,51 @@
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 - <template>  
165 - <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-row>  
168 - <el-col :span="4" >  
169 - <el-button type="primary" @click.native="treeMerge(false)">合并节点</el-button>  
170 - </el-col>  
171 - <el-col :span="4">  
172 - <el-button type="success" @click.native="treeMerge(true)">展开节点</el-button>  
173 - </el-col>  
174 - </el-row>  
175 - <el-divider></el-divider>  
176 - <el-form :model="permForm" style="width: 95%" ref="permForm">  
177 - <el-tree :data="permissons" :props="treeDefaultProps"  
178 - @check="clickDeal"  
179 - :default-expand-all = "treeExpand"  
180 - show-checkbox highlight-current  
181 - node-key="permissionId" ref="tree">  
182 - </el-tree>  
183 - </el-form>  
184 - <div align="center" class="dialog-footer" style="margin-bottom: 20px">  
185 - <el-button @click.native="PermFormVisible = false">取消</el-button>  
186 - <el-button type="primary" @click.native="setPermSubmit" :loading="addLoading">提交</el-button>  
187 - </div>  
188 - </el-tab-pane>  
189 - <el-tab-pane label="数据权限" name="second">  
190 - <el-divider></el-divider>  
191 - <el-form :model="permForms" style="width: 95%" ref="permForm">  
192 - <el-tree :data="departmentList" :props="treeDefaultPropss"  
193 - @check="dataPermTreeClickDeal"  
194 - :default-expand-all = "treeExpands"  
195 - show-checkbox highlight-current  
196 - node-key="data_perm_id" ref="trees">  
197 - </el-tree>  
198 - </el-form>  
199 - <div align="center" class="dialog-footer" style="margin-bottom: 20px">  
200 - <el-button @click.native="PermFormVisible = false">取消</el-button>  
201 - <el-button type="primary" @click.native="setDataPerm" :loading="addLoading">提交</el-button>  
202 - </div>  
203 - </el-tab-pane>  
204 - </el-tabs>  
205 - </template> 164 + <div v-loading.lock="isLoading">
  165 + <template>
  166 + <el-tabs style="border: 0px;background-color: rgba(0,0,0,0)" v-model="activeName" @tab-click="handleClick">
  167 + <el-tab-pane style="border: 0px;background-color: rgba(0,0,0,0)" label="权限管理" name="first">
  168 + <el-row>
  169 + <el-col :span="4" >
  170 + <el-button type="primary" @click.native="treeMerge(false)">合并节点</el-button>
  171 + </el-col>
  172 + <el-col :span="4">
  173 + <el-button type="success" @click.native="treeMerge(true)">展开节点</el-button>
  174 + </el-col>
  175 + </el-row>
  176 + <el-divider></el-divider>
  177 + <el-form :model="permForm" style="width: 95%" ref="permForm">
  178 + <el-tree :data="permissons" :props="treeDefaultProps"
  179 + @check="clickDeal"
  180 + :default-expand-all = "treeExpand"
  181 + show-checkbox highlight-current
  182 + node-key="permissionId" ref="tree">
  183 + </el-tree>
  184 + </el-form>
  185 + <div align="center" class="dialog-footer" style="margin-bottom: 20px">
  186 + <el-button @click.native="PermFormVisible = false">取消</el-button>
  187 + <el-button type="primary" @click.native="setPermSubmit" :loading="addLoading">提交</el-button>
  188 + </div>
  189 + </el-tab-pane>
  190 + <el-tab-pane label="数据权限" name="second">
  191 + <el-divider></el-divider>
  192 + <el-form :model="permForms" style="width: 95%" ref="permForm">
  193 + <el-tree :data="departmentList" :props="treeDefaultPropss"
  194 + @check="dataPermTreeClickDeal"
  195 + :default-expand-all = "treeExpands"
  196 + show-checkbox highlight-current
  197 + node-key="data_perm_id" ref="trees">
  198 + </el-tree>
  199 + </el-form>
  200 + <div align="center" class="dialog-footer" style="margin-bottom: 20px">
  201 + <el-button @click.native="PermFormVisible = false">取消</el-button>
  202 + <el-button type="primary" @click.native="setDataPerm" :loading="addLoading">提交</el-button>
  203 + </div>
  204 + </el-tab-pane>
  205 + </el-tabs>
  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