Quellcode durchsuchen

feat: 子表弹窗数据前置和后置参数暴露

johnsen vor 6 Monaten
Ursprung
Commit
28f0af191c

+ 17 - 7
src/business/platform/form/formrender/dynamic-form/dynamic-form-table.vue

@@ -507,6 +507,14 @@ export default {
       traverse(this.columns)
       return displayColumns
     },
+    tableColumns() {
+      return this.displayColumns.filter(
+        (column) =>
+          !this.columnHidden(column) &&
+          column.field_type != 'desc' &&
+          column.label != ''
+      )
+    },
     buttons() {
       const buttons = this.field.field_options.buttons || []
       const bs = []
@@ -938,7 +946,9 @@ export default {
       // 初始化运行公式计算 unshift
       this.initRunCalFormula(this.dataModel.length - 1)
       // 后置事件
-      this.afterScript(this.actionCode, this.actionPosition)
+      this.afterScript(this.actionCode, this.actionPosition, {
+        rowData: data
+      })
       if (this.$refs.elTable) {
         this.$refs.elTable.doLayout()
       }
@@ -1056,7 +1066,6 @@ export default {
               }
             })
           }
-
           this.importTableDialogVisible = false
           this.importValue = null
           this.importList = []
@@ -1155,7 +1164,7 @@ export default {
       // TODO: 需要格式化展示的数据
       this.convertExportData(data, columnMap).then((data) => {
         IbpsExport.excel({
-          columns: columns,
+          columns: this.tableColumns,
           data: data,
           nameKey: 'name',
           title: this.field.label
@@ -1285,8 +1294,7 @@ export default {
     handleDialogMode(index) {
       const data = this.$utils.isNotEmpty(index)
         ? this.dataModel[index]
-        : // : this.subDefaultFormData
-          this.subDefaultFormData
+        : this.subDefaultFormData
       this.dialogFormData = {
         responses: JSON.parse(JSON.stringify(data)),
         // 表单字段权限
@@ -1402,7 +1410,8 @@ export default {
         this.dataModel.splice(this.dialogFormIndex, 1, data)
         // 后置事件
         this.afterScript(this.actionCode, this.actionPosition, {
-          index: this.dialogFormIndex
+          index: this.dialogFormIndex,
+          rowData: this.dataModel[this.dialogFormIndex]
         })
       } else {
         this.addData(data)
@@ -1462,7 +1471,8 @@ export default {
       }
       const params = {
         button: button,
-        index: index
+        index: index,
+        rowData: this.dataModel[index] || []
       }
       if (!callback) {
         callback = () => {}