Browse Source

新增回显逻辑修改

duy 2 months ago
parent
commit
c17614ea3b
1 changed files with 51 additions and 24 deletions
  1. 51 24
      src/views/digital/signer.vue

+ 51 - 24
src/views/digital/signer.vue

@@ -185,10 +185,10 @@
                                     width="100"
                                     >
                                     <template slot-scope="scope">
-                                    <el-button type="text" @click="handleAdd(scope.row,$index)">
+                                    <el-button type="text" @click="handleAdd(scope.row,scope.$index)">
                                         <i class="el-icon-circle-plus-outline" style="font-size: 20px;color:#67C23A"></i>
                                     </el-button>
-                                    <el-button type="text" @click="handleDelete(scope.row,$index)">
+                                    <el-button type="text" @click="handleDelete(scope.row,row,scope.$index)">
                                         <i class="el-icon-remove-outline" style="font-size: 20px;color:red"></i>
                                     </el-button>
                                 </template>
@@ -203,6 +203,7 @@
             <!-- 选择元素来源 -->
             <el-dialog
             append-to-body
+          
                 title="选择元素来源"
                 :visible.sync="sourceDialogVisible"
                 width="50%"
@@ -219,7 +220,7 @@
                    </div>
                  <!-- 并行显示的下拉框 -->
                         <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-select v-model="elementCategorySelect" placeholder="请选择表分类" style="flex: 1; margin-right: 10px;" clearable @change="changeSelect"  >
                                 <el-option
                                     v-for="item in elementCategoryOptions"
                                     :key="item.value"
@@ -228,6 +229,7 @@
                                 </el-option>
                             </el-select>
                             <el-select 
+                                v-loading="loadingList"
                                 v-model="elementTableNameSelect" 
                                 placeholder="请输入元素表名称进行模糊检索" 
                                 style="flex: 1;" 
@@ -267,7 +269,7 @@
                         </el-table>
                 </div>
                 <span slot="footer" class="dialog-footer" v-if="!isEleView">
-                    <el-button @click="quitClose">取 消</el-button>
+                  
                     <el-button type="primary" @click="confirmSourceSelection">确 定</el-button>
                 </span>
             </el-dialog>
@@ -341,6 +343,7 @@
 <script>
   import {getRoleList,getListPage,getElementList,getTableTypeList,getTableList,queryAllRoleList,submitEle,elementDetail,roleDetail,removeEle,updateStatusEle} from "@/api/sigital/signer.js";
   import { getDictionary } from "@/api/system/dict";
+import { log } from "@antv/g2plot/lib/utils";
     export default {
         data() {
             return {
@@ -377,6 +380,7 @@
                 eleIndex: 0,
                 selectedSourceOption: 1, // 默认选中 "适配所有元素表"
                 elementCategorySelect: '', // 元素分类表分类选中值
+                loadingList: false,
                 elementTableNameSelect: [], // 元素表名称筛选选中值
                 elementCategoryOptions: [
                    
@@ -476,15 +480,19 @@
             },
             positionClick(event, item){
                 this.selectedItem = item; 
+                this.getTableData();
+                
             },
             getTableData() {
+       
+                
                 this.$refs.multipleTable.clearSelection();
                 this.tableLoading = true;
                 getListPage({
                     size: this.pageSize,
                     current: this.currentPage,
                     keyword: this.postText,
-                    id: this.selectedItem.id||'',
+                    roleId: this.selectedItem.roleId||''
                 }).then(res => {
                     this.tableLoading = false;
                     if (res.data.code == 200) {
@@ -588,14 +596,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 = '';
+                this.tableData1.splice(index + 1, 0, {});
+                // this.elementList = [];
+                // this.selectedSourceOption = 1;
+                // this.elementTableNameSelect = [];
+                // this.elementCategorySelect = '';
+                // this.positionList  = [];
+                // this.positionNameSelect = [];
+                // this.partyCategorySelect = '';
              
 
                 // 新增操作的逻辑
@@ -656,17 +664,29 @@
             },
             //选择元素来源
             eleCheck(row,index,type) {
+                console.log(row,'row');
+                this.eleCheckRow=row;
+                this.eleIndex=index;
                 if(type===1){
                     this.isEleView = true;
                     this.getEleDetail(row.id)
                     this.selectedSourceOption=row.tableType
                 }else{
                     this.isEleView = false;
-                    this.eleCheckRow = row;
-                    this.eleIndex=index
+                 
                     this.selectedSourceOption=row.tableType
+                    
                    if(row.id){
                     this.getEleDetail(row.id,1)
+                   }else{
+                console.log(row,'222');
+                 
+                    this.elementCategorySelect=row.eleType
+                    this.changeSelect(row.eleType)
+                    this.elementTableNameSelect=row.tableIds
+
+
+                    
                    }
                    
                     this.getElementCategoryOptions();
@@ -730,11 +750,11 @@
             },
             //获取元素表List
             getElementTableOptions(){
+                this.loadingList = true;
                 getTableList({
-                  
                     tableType:this.elementCategorySelect
                 }).then(res => {
-                    
+                    this.loadingList = false;
                     if (res.data.code == 200) {
                         this.elementTableOptions = res.data.data.map(item => ({
                             value: item.id,
@@ -786,13 +806,15 @@
             },
             // 确认按钮点击事件
             confirmSourceSelection() {
+                console.log(this.eleIndex,'eleIndex');
+                
                 if (this.selectedSourceOption === 0) {
                     // 处理适配所有元素表的逻辑
                     console.log("适配所有元素表");
                     // this.eleCheckRow.tableType = 1;
                     this.tableData1.forEach((item, index) => {
                         if (item.id === this.eleCheckRow.id) {
-                            this.tableData1[index].tableType = 1;
+                            this.tableData1[index].tableType = 0;
                         }
                     })
               
@@ -800,23 +822,28 @@
                     
                 } else {
                     // 处理适配部分元素表的逻辑
-                    console.log("适配部分元素表");
-                    // this.eleCheckRow.tableType = 2
+                    
+                    
                     this.tableData1.forEach((item, index) => {
-                        if (item.id === this.eleCheckRow.id) {
-                            this.tableData1[index].tableType = 2;
+                        if (index==this.eleIndex) {
+                            
+                            this.tableData1[index].tableType = 1;
                         }
                     })
                     if (this.elementTableNameSelect.length > 0) {
                         this.tableData1.forEach((item, index) => {
-                            if (item.id === this.eleCheckRow.id) {
+                            if (index==this.eleIndex) {
                                 this.tableData1[index].tableIds = this.elementTableNameSelect
+                                this.tableData1[index].eleType = this.elementCategorySelect;
                             }
                         });
                     }else{
                         this.tableData1.forEach((item, index) => {
-                            if (item.id === this.eleCheckRow.id) {
+                            if (index==this.eleIndex) {
                                 this.tableData1[index].tableIds ='';
+                                this.tableData1[index].eleType=''
+                                this.elementList1 = [];
+                                this.elementList = [];
                             }
                         });
                     }