Lines 60-65
Link Here
|
60 |
v-model="attribute.value" |
60 |
v-model="attribute.value" |
61 |
/> |
61 |
/> |
62 |
</span> |
62 |
</span> |
|
|
63 |
<a |
64 |
v-if=" |
65 |
attributes.length == counter + 1 || |
66 |
attributes[counter + 1] |
67 |
.processing_attribute_id != |
68 |
attribute.processing_attribute_id |
69 |
" |
70 |
class="btn btn-link" |
71 |
@click=" |
72 |
addAttribute( |
73 |
attribute.processing_attribute_id |
74 |
) |
75 |
" |
76 |
><font-awesome-icon icon="plus" /> |
77 |
{{ $__("Add") }}</a |
78 |
> |
79 |
<a |
80 |
v-else |
81 |
class="btn btn-link" |
82 |
@click="removeAttribute(counter)" |
83 |
><font-awesome-icon icon="minus" /> |
84 |
{{ $__("Remove") }}</a |
85 |
> |
63 |
</li> |
86 |
</li> |
64 |
</ol> |
87 |
</ol> |
65 |
</fieldset> |
88 |
</fieldset> |
Lines 238-265
export default {
Link Here
|
238 |
error => {} |
261 |
error => {} |
239 |
) |
262 |
) |
240 |
this.updateDefaultValues() |
263 |
this.updateDefaultValues() |
241 |
this.attributes = this.processing.attributes.map(attribute => { |
264 |
this.attributes = [] |
242 |
let value = "" |
265 |
this.processing.attributes.forEach(attribute => { |
|
|
266 |
let values = [] |
243 |
if (!apply_default_value) { |
267 |
if (!apply_default_value) { |
244 |
let existing_attribute = this.train_item.attributes.find( |
268 |
this.train_item.attributes |
245 |
a => |
269 |
.filter( |
246 |
a.processing_attribute_id == |
270 |
a => |
247 |
attribute.processing_attribute_id |
271 |
a.processing_attribute_id == |
248 |
) |
272 |
attribute.processing_attribute_id |
249 |
if (existing_attribute) { |
273 |
) |
250 |
value = existing_attribute.value |
274 |
.forEach(a => values.push(a.value)) |
251 |
} |
|
|
252 |
} else if (attribute.type == "db_column") { |
275 |
} else if (attribute.type == "db_column") { |
253 |
value = |
276 |
values.push( |
254 |
this.default_values[attribute.processing_attribute_id] |
277 |
this.default_values[attribute.processing_attribute_id] |
|
|
278 |
) |
279 |
} else { |
280 |
values.push("") |
255 |
} |
281 |
} |
256 |
return { |
282 |
values.forEach(value => |
257 |
processing_attribute_id: attribute.processing_attribute_id, |
283 |
this.attributes.push({ |
258 |
name: attribute.name, |
284 |
processing_attribute_id: |
259 |
type: attribute.type, |
285 |
attribute.processing_attribute_id, |
260 |
option_source: attribute.option_source, |
286 |
name: attribute.name, |
261 |
value, |
287 |
type: attribute.type, |
262 |
} |
288 |
option_source: attribute.option_source, |
|
|
289 |
value, |
290 |
}) |
291 |
) |
263 |
}) |
292 |
}) |
264 |
const client_av = APIClient.authorised_values |
293 |
const client_av = APIClient.authorised_values |
265 |
let av_cat_array = this.processing.attributes |
294 |
let av_cat_array = this.processing.attributes |
Lines 280-285
export default {
Link Here
|
280 |
}) |
309 |
}) |
281 |
.then(() => this.loaded()) |
310 |
.then(() => this.loaded()) |
282 |
}, |
311 |
}, |
|
|
312 |
addAttribute(processing_attribute_id) { |
313 |
let last_index = this.attributes.findLastIndex( |
314 |
attribute => |
315 |
attribute.processing_attribute_id == processing_attribute_id |
316 |
) |
317 |
let new_attribute = (({ value, ...keepAttrs }) => keepAttrs)( |
318 |
this.attributes[last_index] |
319 |
) |
320 |
this.attributes.splice(last_index + 1, 0, new_attribute) |
321 |
}, |
322 |
removeAttribute(counter) { |
323 |
this.attributes.splice(counter, 1) |
324 |
}, |
283 |
onSubmit(e) { |
325 |
onSubmit(e) { |
284 |
e.preventDefault() |
326 |
e.preventDefault() |
285 |
|
327 |
|