Parcourir la source

电签角色修给

duy il y a 2 mois
Parent
commit
a7e17347e4
2 fichiers modifiés avec 122 ajouts et 31 suppressions
  1. 9 1
      src/api/sigital/signer.js
  2. 113 30
      src/views/digital/signer.vue

+ 9 - 1
src/api/sigital/signer.js

@@ -69,7 +69,15 @@ export const elementDetail= (params) => {
         url: '/api/blade-manager/signConfig/elementDetail',
         method: 'get',
         params
-    })
+    })  
+}
+
+export const roleDetail= (params) => {
+    return request({
+        url: '/api//blade-manager/signConfig/roleDetail',
+        method: 'get',
+        params
+    })  
 }
 //删除
 export const removeEle = (data) => {

+ 113 - 30
src/views/digital/signer.vue

@@ -46,7 +46,7 @@
                         <div class="header-btn">
                            
                             <el-button type="primary" size="small" @click="addEleClick">新增</el-button>
-                            <el-button type="info" size="small">编辑</el-button>
+                            <el-button type="info" size="small" @click="editEleClick" :disabled="checkedList.length<1">编辑</el-button>
                             <el-button type="success" size="small"  @click="openClick(row,1)" :loading="openLoading">启用</el-button>
                             <el-button type="warning" size="small"  @click="openClick(row,0)" :loading="closeLoading">停用</el-button>
                             <el-button type="danger" size="small" @click="rowDel(row)" :loading="removeLoad">删除</el-button>
@@ -88,7 +88,7 @@
                                 label="绑定岗位"
                                >
                                <template slot-scope="scope">
-                                <el-link type="primary" @click="eleCheck(scope.row,scope.$index,1)">查看</el-link>
+                                <el-link type="primary" @click="selectPost(scope.row,scope.$index,1)">查看</el-link>
                                </template>
                                 </el-table-column>
                                 <el-table-column
@@ -212,13 +212,13 @@
                         提示:配置之后会把所有元素表该元素字段都自动配置电签岗位对应关系。
                     </p>
                    <div class="source-radio-group">
-                    <el-radio-group v-model="selectedSourceOption">
+                    <el-radio-group v-model="selectedSourceOption" :disabled="isEleView">
                         <el-radio :label="0">适配所有元素表</el-radio>
                         <el-radio :label="1">部分元素表</el-radio>
                     </el-radio-group>
                    </div>
                  <!-- 并行显示的下拉框 -->
-                        <div v-if="selectedSourceOption === 1" class="dropdown-container">
+                        <div v-if="selectedSourceOption === 1&&!isEleView" class="dropdown-container">
                             <el-select v-model="elementCategorySelect" placeholder="请选择表分类" style="flex: 1; margin-right: 10px;" clearable @change="changeSelect" >
                                 <el-option
                                     v-for="item in elementCategoryOptions"
@@ -252,12 +252,13 @@
                             </el-scrollbar>
                         </div>
                         <el-table
-                            v-else
+                        
+                            v-if="selectedSourceOption === 1&&isEleView"
                             :data="elementList1"
                             border
-                            style="width: 100%">
+                            style="width: 100%;margin-top: 20px;">
                             <el-table-column
-                            prop="label"
+                            prop="name"
                             label="元素表名称"
                            >
                             </el-table-column>
@@ -265,7 +266,7 @@
                           
                         </el-table>
                 </div>
-                <span slot="footer" class="dialog-footer">
+                <span slot="footer" class="dialog-footer" v-if="!isEleView">
                     <el-button @click="quitClose">取 消</el-button>
                     <el-button type="primary" @click="confirmSourceSelection">确 定</el-button>
                 </span>
@@ -279,7 +280,7 @@
                 :before-close="handleBindPostClose">
                 <div class="bind-post-content">
                     <!-- 参建方分类 + 岗位名称下拉框 -->
-                    <div class="dropdown-pair">
+                    <div class="dropdown-pair" v-if="!isPosView">
                         <el-select v-model="partyCategorySelect" placeholder="请选择参建方分类" style="flex: 1; margin-right: 10px;">
                             <el-option
                                 v-for="item in partyCategoryOptions"
@@ -300,7 +301,7 @@
                     </div>
 
                     <!-- 岗位列表 -->
-                    <div class="position-list-container">
+                    <div class="position-list-container" v-if="!isPosView">
                         <el-scrollbar > <!-- 18行 * 30px = 540px -->
                             <ul class="position-checkbox-list">
                                 <li v-for="(item, index) in positionList" :key="index" class="position-item">
@@ -309,6 +310,25 @@
                             </ul>
                         </el-scrollbar>
                     </div>
+                    <el-table
+                        
+                        v-if="isPosView"
+                        :data="positionList1"
+                        border
+                        style="width: 100%;margin-top: 20px;">
+                     
+                        <el-table-column
+                        prop="name"
+                        label="所属方"
+                       >
+                        </el-table-column>
+                        <el-table-column
+                        prop="name"
+                        label="岗位名称"
+                       >
+                        </el-table-column>
+                      
+                    </el-table>
                 </div>
                 <span slot="footer" class="dialog-footer">
                     <el-button @click="positionClose">取 消</el-button>
@@ -319,7 +339,7 @@
 </template>
 
 <script>
-  import {getRoleList,getListPage,getElementList,getTableTypeList,getTableList,queryAllRoleList,submitEle,elementDetail,removeEle,updateStatusEle} from "@/api/sigital/signer.js";
+  import {getRoleList,getListPage,getElementList,getTableTypeList,getTableList,queryAllRoleList,submitEle,elementDetail,roleDetail,removeEle,updateStatusEle} from "@/api/sigital/signer.js";
   import { getDictionary } from "@/api/system/dict";
     export default {
         data() {
@@ -376,6 +396,9 @@
                 ],
                 positionNameOptions: [],
                 positionList: [],
+                positionList1:[],
+                isPosView: true, // 是否查看
+
             }
         },
         watch: {
@@ -440,10 +463,12 @@
                     type: this.tabPosition,
                     roleName: this.postText
                 }).then(res => {
+                    console.log(res,'res');
+                    
                     this.roleListLoading = false;
-                    if (res.code == 200) {
+                    if (res.data.code == 200) {
                         this.roleListLoading = false;
-                        this.roleData = res.data;
+                        this.roleData = res.data.data;
                     }else{
                         this.roleData = [];
                     }
@@ -481,6 +506,16 @@
             },
             addEleClick() {
                 this.addDialogVisible = true;
+                this.tableData1=[{}]
+            },
+            editEleClick(row) {
+                
+                this.addDialogVisible = true;
+                this.tableData1 = [...this.checkedList]
+                console.log( this.tableData1,' this.tableData1');
+                this.isPosView=false
+                this.isEleView=false
+                
             },
             //启用
             openClick(row,type){
@@ -554,6 +589,14 @@
             handleAdd(row,index) {
                 console.log('新增', row);
                 this.tableData1.splice(index, 0, {});
+                this.elementList = [];
+                this.selectedSourceOption = 1;
+                this.elementTableNameSelect = [];
+                this.elementCategorySelect = '';
+                this.positionList  = [];
+                this.positionNameSelect = [];
+                this.partyCategorySelect = '';
+             
 
                 // 新增操作的逻辑
             },
@@ -586,13 +629,16 @@
             async remove(ids) {
                 this.removeLoad = true;
                 removeEle(ids).then(res => {
+                    console.log(res,'res');
+                    
                     this.removeLoad = false;
-                    if (res.code == 200) {
+                    if (res.data.code == 200) {
                         this.$message({
                             type: "success",
                             message: "删除成功!",
                         });
                         this.getTableData();
+                        this.getRoleData();
                     }
                 }).finally(() => {
                     this.removeLoad = false;
@@ -618,7 +664,10 @@
                     this.isEleView = false;
                     this.eleCheckRow = row;
                     this.eleIndex=index
-                    this.selectedSourceOption=0
+                    this.selectedSourceOption=row.tableType
+                   if(row.id){
+                    this.getEleDetail(row.id,1)
+                   }
                    
                     this.getElementCategoryOptions();
                    
@@ -629,14 +678,36 @@
           
             },
             //查看详情
-            getEleDetail(id){
+            getEleDetail(id,type){
                 elementDetail({
                    id
                 }).then(res => {
-                    if (res.code == 200) {
-                        this.elementList1 = res.data;
+                    console.log(res.data,'res.dat');
+                    
+                    if (res.data.code == 200) {
+                        if(type==1){
+                            this.elementList = res.data.data;
+                                
+                        }else{
+                            this.elementList1 = res.data.data;
+                        }
+                      
                     }else{
                         this.elementList1 = [];
+                        this.elementList = [];
+                    }
+                })
+            },
+            getPosDetail(id){
+                roleDetail({
+                   id
+                }).then(res => {
+                    console.log(res.data,'res.dat');
+                    
+                    if (res.data.code == 200) {
+                        this.positionList1 = res.data.data;
+                    }else{
+                        this.positionList1 = [];
                     }
                 })
             },
@@ -715,7 +786,7 @@
             },
             // 确认按钮点击事件
             confirmSourceSelection() {
-                if (this.selectedSourceOption === 1) {
+                if (this.selectedSourceOption === 0) {
                     // 处理适配所有元素表的逻辑
                     console.log("适配所有元素表");
                     // this.eleCheckRow.tableType = 1;
@@ -739,7 +810,7 @@
                     if (this.elementTableNameSelect.length > 0) {
                         this.tableData1.forEach((item, index) => {
                             if (item.id === this.eleCheckRow.id) {
-                                this.tableData1[index].tableIds = this.elementTableNameSelect.join(',');
+                                this.tableData1[index].tableIds = this.elementTableNameSelect
                             }
                         });
                     }else{
@@ -759,14 +830,23 @@
                 this.sourceDialogVisible = false;
             },
             // 打开绑定岗位弹窗
-            selectPost(row) {
+            selectPost(row,index,type) {
+                console.log(type,'type');
+        
+                if(type===1){
+                    this.isPosView=true
+                    this.getPosDetail(row.id)
+                }else{
+                    this.isPosView=false
+                    this.partyCategorySelect='1'
+                    this.getPositionList();
+                    this.selectedPostRow = row;
+                    this.positionNameSelect = [];
+                    this.partyCategorySelect = '';
+                    this.positionList  = [];
+                 }
                 this.bindPostDialogVisible = true;
-                this.partyCategorySelect='1'
-                this.getPositionList();
-                this.selectedPostRow = row;
-                this.positionNameSelect = [];
-                this.partyCategorySelect = '';
-                this.positionList  = [];
+              
             },
             changePositionName() {
                 this.getPositionList();
@@ -799,14 +879,14 @@
                         // this.selectedPostRow.roleIds = this.positionNameSelect.join(',');
                         this.tableData1.forEach((item, index) => {
                             if (item.id === this.selectedPostRow.id) {
-                                this.tableData1[index].roleIds =this.positionNameSelect.join(',');
+                                this.tableData1[index].roleIds =this.positionNameSelect
                             }
                         });
                     }else{
                         // this.selectedPostRow.roleIds = '';
                         this.tableData1.forEach((item, index) => {
                             if (item.id === this.selectedPostRow.id) {
-                                this.tableData1[index].roleIds =''
+                                this.tableData1[index].roleIds =[]
                             }
                         });
                     }
@@ -821,6 +901,9 @@
                     ).then((res) => {
                     if(res.data.code==200){
                         this.$message.success(res.data.msg)
+                        this.getTableData();
+                        this.getRoleData();
+                        this.addDialogVisible=false
                     }else{
                         this.$message.error(res.data.msg)
                     }
@@ -850,7 +933,7 @@
         .post-list{
             margin-top: 10px;
             height: calc(100% - 110px);
-            border: 1px solid red;
+            // border: 1px solid red;
         }