Procházet zdrojové kódy

fix:1359 打开对话框时未回填所选值

liujiayin před 2 roky
rodič
revize
dc30187705

+ 18 - 11
src/business/platform/data/templaterender/templates/list.vue

@@ -520,6 +520,17 @@ export default {
         },
         selectionAll: {
             handler (val, oldVal) {
+                console.log('523 selectionAll', val)
+                /**
+                 * 单选:selectionAll是对象{}
+                 * 多选:selectionAll是数组对象[]
+                 */
+                // selectionAll
+                // if (this.multiple) {
+                //     this.$emit('selected', val)
+                // } else {
+                //     this.$emit('selected', val[0])
+                // }
                 this.$emit('selected', val)
             },
             deep: true
@@ -655,7 +666,7 @@ export default {
             if (this.multiple) {
                 selectionAll = [].concat(this.selectionAll)
             } else {
-                selectionAll.push(this.selectionAll)
+                selectionAll = this.selectionAll
             }
             // 获取当前页选中的id
             const selectIds = []
@@ -706,11 +717,12 @@ export default {
                     }
                 }
             })
-            if (this.multiple) {
-                this.selectionAll = selectionAll
-            } else {
-                this.selectionAll = selectionAll[0]
-            }
+            // if (this.multiple) {
+            //     this.selectionAll = selectionAll
+            // } else {
+            //     this.selectionAll = selectionAll[0]
+            // }
+            this.selectionAll = selectionAll
         },
         setSelectRow () {
             setTimeout(() => {
@@ -754,9 +766,6 @@ export default {
             if (this.$utils.isEmpty(this.selectionAll)) {
                 return
             }
-            if (!this.$utils.isArray(this.selectionAll)) {
-                this.selectionAll = [this.selectionAll]
-            }
             if (this.multiple) {
                 this.selectionAll.forEach((row) => {
                     selectAllIds.push(this.getPkValue(row))
@@ -891,8 +900,6 @@ export default {
             this.hadDoSearch = true
             this.loadData()
             this.addDataCont = {}
-            this.selectionAll = []
-            this.selection = []
         },
         /* 流程页面关闭,刷新当前页面*/
         loadFlowFData (v, temp) {