Lines 76-81
export default {
Link Here
|
76 |
}, |
76 |
}, |
77 |
methods: { |
77 |
methods: { |
78 |
async fetchInitialData(dataType) { |
78 |
async fetchInitialData(dataType) { |
|
|
79 |
let currentSelection |
80 |
if (this.modelValue) { |
81 |
const dataToPersist = this.data.find( |
82 |
item => this.modelValue === item[this.dataIdentifier] |
83 |
) |
84 |
const preSelectedData = this.selectedData[this.dataIdentifier] |
85 |
? this.selectedData |
86 |
: null |
87 |
currentSelection = dataToPersist |
88 |
? dataToPersist |
89 |
: preSelectedData |
90 |
} |
79 |
const client = APIClient.erm |
91 |
const client = APIClient.erm |
80 |
await client[dataType] |
92 |
await client[dataType] |
81 |
.getAll( |
93 |
.getAll( |
Lines 88-94
export default {
Link Here
|
88 |
) |
100 |
) |
89 |
.then( |
101 |
.then( |
90 |
items => { |
102 |
items => { |
91 |
this.data = items |
103 |
const checkDuplicate = items.find( |
|
|
104 |
item => |
105 |
currentSelection[this.dataIdentifier] === |
106 |
item[this.dataIdentifier] |
107 |
) |
108 |
currentSelection = checkDuplicate |
109 |
? null |
110 |
: currentSelection |
111 |
this.data = currentSelection |
112 |
? [currentSelection, ...items] |
113 |
: items |
92 |
this.search = "" |
114 |
this.search = "" |
93 |
this.limit = 19 |
115 |
this.limit = 19 |
94 |
this.scrollPage = 1 |
116 |
this.scrollPage = 1 |
95 |
- |
|
|