Bläddra i källkod

更改员工Id绑定下拉框

wangh 2 år sedan
förälder
incheckning
8732864cfd
1 ändrade filer med 56 tillägg och 56 borttagningar
  1. 56 56
      src/components/child/AuthorityUser.vue

+ 56 - 56
src/components/child/AuthorityUser.vue

@@ -1,7 +1,5 @@
 <template>
-    <div  v-loading="loading"
-    element-loading-text="拼命加载中"
-    element-loading-spinner="el-icon-loading">
+    <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
         <div class="job-box">
             <div class="job-head">
                 <div>
@@ -23,12 +21,12 @@
                         <el-option v-for="item in position" :key="item.id" :label="item.jobName" :value="item.id">
                         </el-option>
                     </el-select>
-                    <el-select @change="UserChange()" v-model="Valueuesr"  clearable placeholder="员工">
-                        <el-option v-for="item in Users" :key="item.userId" :label="item.cnName" :value="item.userId">
+                    <el-select @change="UserChange()" v-model="Valueuesr" clearable placeholder="员工">
+                        <el-option v-for="item in Users" :key="item.id" :label="item.cnName" :value="item.id">
                         </el-option>
                     </el-select>
                     <el-button type="primary" @click="saveAuth()">保 存</el-button>
-                </div> 
+                </div>
             </div>
             <div class="job-table">
                 <el-table :data="authorityLists.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
@@ -37,19 +35,21 @@
                     </el-table-column>
                     <el-table-column prop="name" label="权限页面" width="180">
                     </el-table-column>
-                    
-                    <el-table-column width="55" :label="op.functionName"  :key="op.id" v-for="op in opList">
+
+                    <el-table-column width="55" :label="op.functionName" :key="op.id" v-for="op in opList">
                         <template slot-scope="scope">
                             <div>
-                                <el-checkbox @change='checkchange(authorityLists[scope.$index].id,op.id)'  v-if=" authorityLists[scope.$index].opList.indexOf(op.id) != -1" :value="authorityLists[scope.$index].selList.indexOf(op.id) != -1" >
-                                </el-checkbox >
-                                <el-checkbox  v-else :disabled="true" >
+                                <el-checkbox @change='checkchange(authorityLists[scope.$index].id, op.id)'
+                                    v-if="authorityLists[scope.$index].opList.indexOf(op.id) != -1"
+                                    :value="authorityLists[scope.$index].selList.indexOf(op.id) != -1">
+                                </el-checkbox>
+                                <el-checkbox v-else :disabled="true">
                                 </el-checkbox>
                             </div>
                         </template>
                     </el-table-column>
-                   
-                  
+
+
                     <el-table-column prop="address" label="备注">
                     </el-table-column>
                 </el-table>
@@ -88,11 +88,11 @@ export default {
             pageSize: 14,// 每页的数据条数
             stateArr: [],
             selectedAccount: [],
-            PathUrl:'http://localhost:5256',
-            opList :[],//操作方式
-            loading:true,
-            Users:[],
-            Valueuesr:'',//员工val
+            PathUrl: 'http://localhost:5256',
+            opList: [],//操作方式
+            loading: true,
+            Users: [],
+            Valueuesr: '',//员工val
         }
     },
     methods: {
@@ -112,10 +112,10 @@ export default {
         },
         //多选框选中方法
         handleSelect(selection, row) {
-            console.log(selection,row)
+            console.log(selection, row)
             if (selection.length > 0) {
                 row.selList = this.opList.map(x => x.id);
-            }else{
+            } else {
                 row.selList = [];
             }
         },
@@ -135,13 +135,13 @@ export default {
         selectRadioup(index, row) {
             console.log(index, row)
         },
-        pageload(moduleId){
+        pageload(moduleId) {
             var that = this;
             //初始化界面数据
             this.$axios.post(this.PathUrl + '/api/System/GetAuth', {
                 "pageSize": this.pageSize,
                 "currentPage": this.currentPage,
-                "moduleId":moduleId,
+                "moduleId": moduleId,
             }, {
                 headers: {
                     'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IkZ1dHVyZSIsImV4cCI6MTY3OTU0MjgwNSwiaXNzIjoiT0FTeXN0ZW0uY29tIiwiYXVkIjoiT0FTeXN0ZW0uY29tIn0.iy5SUInq1p3yjZultRPyzCa2ekLeepSdMLxvPwXY6MI',
@@ -153,17 +153,17 @@ export default {
                     that.authorityList = resp.data.data.systemMenuPermissionData; //页面数据(默认权限页面)
                     that.authorityLists = that.authorityList;
                     that.opList = resp.data.data.pageOperation; //操作方式
-                    that.loading =false;
+                    that.loading = false;
                 }
-            }).then(suc=>{
-                if(this.Valueuesr != ''){
+            }).then(suc => {
+                if (this.Valueuesr != '') {
                     //链式调用加载
                     this.UserChange();
                 }
             })
         },
         //公司下拉框
-        companyChange(){
+        companyChange() {
 
             this.valuedepartmental = ''; //清空数据
             this.valueposition = '';
@@ -172,10 +172,10 @@ export default {
             this.Valueuesr = ''; //清空数据
             this.Users = [];
 
-            if(this.valuecorporation == ''){
+            if (this.valuecorporation == '') {
                 return;
             }
-           
+
             var that = this;
             //初始化界面数据
             this.$axios.post(this.PathUrl + '/api/System/QueryDepartmentList', {
@@ -194,14 +194,14 @@ export default {
 
         },
         //部门下拉框
-        depaChange(){
+        depaChange() {
 
             this.position = []; //职位数据
             this.valueposition = '';//职位val
             this.Valueuesr = ''; //清空数据
             this.Users = [];
 
-            if(this.valuecorporation == '' || this.valuedepartmental == ''){
+            if (this.valuecorporation == '' || this.valuedepartmental == '') {
                 return;
             }
 
@@ -209,7 +209,7 @@ export default {
             //初始化界面数据
             this.$axios.post(this.PathUrl + '/api/System/QueryJobPost', {
                 "CompanyId": this.valuecorporation,
-                "DepId":this.valuedepartmental,
+                "DepId": this.valuedepartmental,
                 "PortType": 1,
             }, {
                 headers: {
@@ -218,24 +218,24 @@ export default {
             }).then(resp => {
                 console.log(resp);
                 if (resp.data.code == 200) {
-                    that.position =  resp.data.data;
+                    that.position = resp.data.data;
                 }
             })
         },
         //保存权限
-        saveAuth(){
+        saveAuth() {
             var that = this;
 
-            if(this.Valueuesr == ''){
+            if (this.Valueuesr == '') {
                 this.$message.error('请选择员工!');
-                return;  
+                return;
             }
 
             var savejob = [];
-            this.authorityLists.forEach(item=>{
+            this.authorityLists.forEach(item => {
                 savejob.push({
-                    SmId:item.id,
-                    FIds:item.selList,
+                    SmId: item.id,
+                    FIds: item.selList,
                 });
             })
             console.log(savejob);
@@ -254,18 +254,18 @@ export default {
                         message: '保存成功!',
                         type: 'success'
                     });
-                }else{
-                    this.$message.error('保存失败!'+ resp.data.msg);
+                } else {
+                    this.$message.error('保存失败!' + resp.data.msg);
                 }
             })
         },
         //职位下拉获取权限
-        JobChange(){
+        JobChange() {
 
             this.Valueuesr = ''; //清空数据
             this.Users = [];
 
-            if(this.valuecorporation == '' || this.valuedepartmental == '' || this.valueposition == ''){
+            if (this.valuecorporation == '' || this.valuedepartmental == '' || this.valueposition == '') {
                 return;
             }
 
@@ -273,9 +273,9 @@ export default {
             //获取员工信息
             this.$axios.post(this.PathUrl + '/api/System/QueryUserList', {
                 "CompanyId": this.valuecorporation,
-                "DepId":this.valuedepartmental, 
-                "JobPostId":this.valueposition,
-                "PortType":1
+                "DepId": this.valuedepartmental,
+                "JobPostId": this.valueposition,
+                "PortType": 1
 
             }, {
                 headers: {
@@ -284,12 +284,12 @@ export default {
             }).then(resp => {
                 console.log(resp);
                 if (resp.data.code == 200) {
-                   that.Users = resp.data.data;
+                    that.Users = resp.data.data;
                 }
             })
         },
         //全选
-        allchange(selection){
+        allchange(selection) {
             let that = this;
 
             if (selection.length > 0) {
@@ -297,7 +297,7 @@ export default {
                     item.selList = that.opList.map(x => x.id);
                 });
 
-            }else{
+            } else {
                 this.authorityLists.forEach(item => {
                     item.selList = [];
                 });
@@ -306,9 +306,9 @@ export default {
         checkchange(rowid, linid) {
             this.authorityLists.forEach(item => {
                 if (item.id == rowid) {
-                    if(item.selList.indexOf(linid) == -1){
+                    if (item.selList.indexOf(linid) == -1) {
                         item.selList.push(linid);
-                    }else{
+                    } else {
                         item.selList.splice(item.selList.indexOf(linid), 1)
                     }
                 }
@@ -316,14 +316,14 @@ export default {
             console.warn(this.authorityLists);
         },
         //员工下拉框
-        UserChange(){
+        UserChange() {
             console.log(this.Valueuesr);
-
-            var moduleId = this.value == "" ? 13 :this.value;
-            if(this.Valueuesr == ''){
+            debugger
+            var moduleId = this.value == "" ? 13 : this.value;
+            if (this.Valueuesr == '') {
 
                 var arr = this.authorityList;
-                arr.forEach(item=>{
+                arr.forEach(item => {
                     item.selList = [];
                 })
                 this.authorityList = arr;
@@ -335,7 +335,7 @@ export default {
             //获取员工信息
             this.$axios.post(this.PathUrl + '/api/System/QueryUserAuth', {
                 "Userid": this.Valueuesr,
-                "moduleId":moduleId
+                "moduleId": moduleId
 
             }, {
                 headers: {