Skip to content

Commit 50c303e

Browse files
authored
Merge pull request #1194 from ProcessMaker/bugfix/FOUR-4986-4.1
Bugfix FOUR-4986 - File Upload control inside a loop in the record list issues
2 parents 804eee2 + b378053 commit 50c303e

File tree

5 files changed

+1093
-21
lines changed

5 files changed

+1093
-21
lines changed

src/components/renderer/file-upload.vue

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ export default {
9494
(loop, removed) => this.listenRemovedLoop(loop, removed));
9595
9696
this.removeDefaultClasses();
97-
98-
this.checkIfInRecordList();
9997
10098
this.setPrefix();
10199
if (this.$refs['uploader']) {
@@ -288,15 +286,6 @@ export default {
288286
this.prefix = parent.loopContext + '.';
289287
}
290288
},
291-
setFileUploadNameForChildren(children, prefix) {
292-
children.forEach(child => {
293-
if (_.get(child, '$options.name') === 'FileUpload') {
294-
child.prefix = prefix;
295-
} else if (_.get(child, '$children', []).length > 0) {
296-
this.setFileUploadNameForChildren(child.$children, prefix);
297-
}
298-
});
299-
},
300289
addFile(file) {
301290
if (this.disabled) {
302291
file.ignored = true;
@@ -420,14 +409,6 @@ export default {
420409
: null;
421410
}
422411
},
423-
checkIfInRecordList() {
424-
const parent = this.parentRecordList(this);
425-
if (parent !== null) {
426-
const recordList = parent;
427-
const prefix = recordList.name + '.';
428-
this.setFileUploadNameForChildren(recordList.$children, prefix);
429-
}
430-
},
431412
},
432413
};
433414
</script>

src/components/renderer/form-record-list.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
debug-context="Record List Add"
8787
:key="Array.isArray(value) ? value.length : 0"
8888
:_parent="validationData"
89+
@update="updateRowDataNamePrefix"
8990
/>
9091
</b-modal>
9192
<b-modal
@@ -112,6 +113,7 @@
112113
debug-context="Record List Edit"
113114
:_parent="validationData"
114115
:key="editFormVersion"
116+
@update="updateRowDataNamePrefix"
115117
/>
116118
</b-modal>
117119
<b-modal
@@ -164,6 +166,7 @@ export default {
164166
props: ['name', 'label', 'fields', 'value', 'editable', '_config', 'form', 'validationData', 'formConfig', 'formComputed', 'formWatchers'],
165167
data() {
166168
return {
169+
currentRowIndex: null,
167170
editFormVersion: 0,
168171
single: '',
169172
plural: '',
@@ -259,6 +262,9 @@ export default {
259262
},
260263
},
261264
methods: {
265+
updateRowDataNamePrefix() {
266+
this.setUploadDataNamePrefix(this.currentRowIndex);
267+
},
262268
emitShownEvent() {
263269
window.ProcessMaker.EventBus.$emit('modal-shown');
264270
},
@@ -270,6 +276,7 @@ export default {
270276
return field.key === '__filedownload';
271277
},
272278
setUploadDataNamePrefix(index = null) {
279+
this.currentRowIndex = index;
273280
let rowId = null;
274281
if (index !== null && this.editItem) {
275282
rowId = this.editItem.row_id;
@@ -451,6 +458,9 @@ export default {
451458
this.$root.$emit('removed-record', this, recordData);
452459
},
453460
},
461+
mounted() {
462+
this.updateRowDataNamePrefix = _.debounce(this.updateRowDataNamePrefix, 100);
463+
},
454464
};
455465
</script>
456466

0 commit comments

Comments
 (0)