Vue.component('list_appointments', {
delimiters: ['{>', '<}'],
template: '#list_appointments-template',
data: function () {
return {
active_list_appointments_template: false,
drug: {
id: null,
patient: null,
disease_history: null,
drug: null,
start_day: null,
end_day: null,
is_delete: false,
},
list_appointments_drugs: [],
}
},
methods: {
addDrug: function () {
// хочу добавить в list_appointments_drugs новый объект drug, но получается что добавляю модель
this.list_appointments_drugs.unshift(this.drug)
},
editDrug: function () {
},
deleteDrug: function () {
},
openTemplate: function () {
this.active_list_appointments_template = true
},
closeTemplate: function () {
this.active_list_appointments_template = false
},
onCancel: function () {
this.close()
},
onConfirm: function () {
this.close()
}
},
beforeCreate: function () {
var self = this
//Профиль пациента
axios.get('http://' + window.location.host + '/api/patients/' + document.getElementById('id_patient').innerText + '/?format=json').then(function (response) {
self.patient = response.data
}).catch(function (error) {
console.log(error);
});
//Текущая история болезни
axios.get('http://' + window.location.host + '/api/disease_stories/' + document.getElementById('id_disease_history').innerText + '/?format=json').then(function (response) {
self.disease_history = response.data
}).catch(function (error) {
console.log(error);
});
}
})