周兴 2 лет назад
Родитель
Сommit
adbc6e2083

+ 3 - 3
src/components/base/dk-table/dk-table-column.vue

@@ -94,7 +94,7 @@
     <template #default="{ row,rowIndex}">
       <div class="normal-class" @dblclick.stop="copyValue(row,rowIndex)"><a
         style="text-decoration: underline;color: #2d8cf0;"
-        @click="handleLink(row)">{{
+        @click="handleLink(row,rowIndex)">{{
           row[field]
         }}</a>
         <!--        <span v-else>{{ row[field] }}</span></div>-->
@@ -527,12 +527,12 @@ export default {
      * @author : 周兴
      * @date   : 2022/8/9 9:58
      */
-    handleLink(row) {
+    handleLink(row,rowIndex) {
       // 切换当前行
       if (this.dkTable) {
         this.dkTable.setCurrentRow(row);
       }
-      this.$emit('on-link', row)
+      this.$emit('on-link', row,rowIndex,this.field)
     },
     /**
      * @desc   : 查询可替换的数据

+ 26 - 13
src/view/mst/custom-report/form.vue

@@ -1271,24 +1271,24 @@ export default {
      */
     handleSqlScript(sqlItem) {
       let sqlScript = sqlItem.sqlScript
-      sqlScript = sqlScript.replaceAll('#{ftyId}', -1)
       let conditionData = this.$refs['conditionTable'].getTableDataFilter();
-      conditionData.forEach(t => {
-        // 日期范围
-        if (t.kind === this.$config.reportKind.dateRange) {
-          sqlScript = sqlScript.replaceAll('#{' + t.code?.trim() + 'Start' + '}', null)
-          sqlScript = sqlScript.replaceAll('#{' + t.code?.trim() + 'End' + '}', null)
-        } else {
-          sqlScript = sqlScript.replaceAll('#{' + t.code?.trim() + '}', null)
-        }
-      })
       // 不用控制严格,只要有跳转条件,其他页签的都处理下的(兼容link模式)
       this.sqlTabsOptions.forEach((t, index) => {
         if (t.changeScript) {
           let changeScripts = t.changeScript.trim().split(',');
           this.sqlTabsOptions.forEach((item, itemNo) => {
-            if(index != itemNo){
+            if (index != itemNo) {
               sqlScript = item.sqlScript
+              sqlScript = sqlScript.replaceAll('#{ftyId}', -1)
+              conditionData.forEach(t => {
+                // 日期范围
+                if (t.kind === this.$config.reportKind.dateRange) {
+                  sqlScript = sqlScript.replaceAll('#{' + t.code?.trim() + 'Start' + '}', null)
+                  sqlScript = sqlScript.replaceAll('#{' + t.code?.trim() + 'End' + '}', null)
+                } else {
+                  sqlScript = sqlScript.replaceAll('#{' + t.code?.trim() + '}', null)
+                }
+              })
               changeScripts.forEach(it => {
                 sqlScript = sqlScript.replaceAll('#{' + it + '}', null)
               })
@@ -1339,19 +1339,32 @@ export default {
       params.conditionDeleteList = this.$refs['conditionTable'].getDeleteData();
       // sql
       params.sqlList = this.sqlTabsOptions.copy();
+      let filters = null;
       params.sqlList.forEach((item, i) => {
         item.displayNo = i + 1;
-        let filters = this.sqlTabsOptions.filter(it => it.changeTabName === item.label);
-        item.changeScriptOthers = []
+        filters = this.sqlTabsOptions.filter(it => it.changeTabName === item.label);
         if (filters && filters.length > 0) {
           filters.forEach(it => {
             if (it.changeScript) {
+              if(!item.changeScriptOthers){
+                item.changeScriptOthers = []
+              }
               item.changeScriptOthers.pushNoRepeat(it.changeScript)
             }
           })
         }
         // 处理表格
         item.tableSettingList.forEach((it, index) => {
+          // 统计在列表中的跳转页签
+          if (it.changeTabName) {
+            filters = params.sqlList.filter(t => t.label === it.changeTabName);
+            if(filters && filters.length > 0){
+              if(!filters[0].changeScriptOthers){
+                filters[0].changeScriptOthers = []
+              }
+              filters[0].changeScriptOthers.pushNoRepeat(item.changeScript)
+            }
+          }
           // 宽度为空默认150
           it.width = it.width ? it.width : '150';
           // 数据类型如果为空默认是字符串

+ 15 - 12
src/view/mst/custom-report/report.vue

@@ -26,7 +26,7 @@
 
     <!-- 表格展示  -->
     <!--    {{form['tableData_' + tabIndex]}}-->
-    <div v-if="tabsOptions && tabsOptions[tabIndex] ">
+    <div v-if="tabsOptions && tabsOptions[tabIndex] && flgVisible">
       <DkTable slot="top" :id="'table-'+$options.name" :ref="'table-select-' + tabIndex"
                :data="form['tableData_' + tabIndex]"
                :height="tabsOptions.length > 1?this.tableHeight - 30:this.tableHeight"
@@ -71,6 +71,7 @@ export default {
   data() {
     return {
       reportId: '',
+      flgVisible:true,
       form: {},
       reportForm: {},
       tableData: [],// 报表数据
@@ -80,7 +81,7 @@ export default {
       tabsOptions: [], // tab数据源
       changeFlag: false,// 是否是跳转
       searchParams: {},// 查询条件
-      linkChangeTabs:[],// 点击链接跳转到相应的页签
+      linkChangeTabs:{},// 点击链接跳转到相应的页签
     }
   },
   methods: {
@@ -106,7 +107,7 @@ export default {
      * @date   : 2023/4/19 18:01
      */
     async chooseData(row, rowIndex,changeTabName) {
-      console.log('eee',row,rowIndex,changeTabName)
+      this.flgVisible = false
       if(!changeTabName){
         changeTabName = this.tabsOptions[this.tabIndex].changeTabName
       }
@@ -124,6 +125,7 @@ export default {
         }
         // 切换页签,处理小计
         this.changeTabHandleSubTotal();
+        this.flgVisible = true;
         this.$nextTick(() => {
           //查询条件
           this.setCondition(this.searchCond)
@@ -135,7 +137,7 @@ export default {
           if (changeScript.indexOf(',') >= 0) {
             let changeScripts = changeScript.split(',');
             changeScripts.forEach(it => {
-              params[it] = row[it]
+              params[it] = row[it]?row[it]:null
             })
           } else {
             params[changeScript] = row[changeScript]
@@ -144,7 +146,6 @@ export default {
           this.getData(params)              // 执行查询
           this.searchParams = {...params}  // 记录当时的查询条件
           this.changeFlag = true;
-
         })
       }
     },
@@ -179,6 +180,7 @@ export default {
      * @date   : 2023/3/30 8:48
      */
     handleChangeSqlTab(val) {
+      this.flgVisible = false
       this.$nextTick(() => {
         // 先记录现在的页签的表格翻页信息
         // console.log('this.pageInfo', this.pageInfo, this.tabsOptions[this.tabIndex])
@@ -189,6 +191,9 @@ export default {
         }
         // 切换页签,处理小计
         this.changeTabHandleSubTotal();
+        setTimeout(()=>{
+          this.flgVisible = true;
+        },200)
       })
     },
     /**
@@ -262,8 +267,9 @@ export default {
      * @author : 周兴
      * @date   : 2023/4/28 16:00
      */
-    handleLink(e){
-      this.chooseData(e);
+    handleLink(row,rowIndex, field){
+      let changeTabName = this.linkChangeTabs[field]
+      this.chooseData(row,rowIndex,changeTabName);
     },
     /**
      * @desc   : 设置小计行
@@ -515,7 +521,7 @@ export default {
      * @date   : 2023/3/28 19:55
      */
     handleTableSetting(row, index) {
-      let table = row.tableSettingList;
+      let table = row.tableSettingList?.copy();
       row.tableColumns = []
       this.showFooter = false;
       if (table && table.length > 0) {
@@ -533,10 +539,7 @@ export default {
             // 是否是链接
             if(it.flgLink){
               item.type = 'link'
-              this.linkChangeTabs.push({
-                field:it.code,
-                tabName:it.changeTabName
-              })
+              this.linkChangeTabs[it.code] = it.changeTabName
             }
             item.dataType = it.dataType ? it.dataType : this.$config.dataType.str
             if (it.flgSum) {