<div slot="header"><?php echo tr("EDITING")?></div>
<div slot="body" class="tm-grid tm-grid-large" style="width: 400px">
<div class="tm-width-1-1">
<h5>{{title}}</h5>
</div>
<div class="tm-width-1-1">
<tm-input-number
title="<?php echo tr('DAY_PLAN')?>"
id="plan_day"
v-model="plan_day"
></tm-input-number>
</div>
<div class="tm-width-1-1">
<tm-input-number
title="<?php echo tr('DAY_FACT')?>"
id="fact_day"
v-model="fact_day"
></tm-input-number>
</div>
</div>
<div slot="footer" class="tm-flex tm-flex-right">
<div class="tm-text-red">{{textError}}</div>
<button class="tm-btn tm-margin-horz" @click="save"><?php echo tr("SAVE")?></button>
<button class="tm-btn " @click="visible=false" ><?php echo tr("CANCEL")?></button>
</div>
</modal>
</script>
<script>
Vue.component("item-edit-modal", {
template: "#item-edit-template",
data() {
return {
rating_bgi_id: null,
plan_day: null,
fact_day: null,
visible: false,
title: '',
canEdit: false,
textError: "",
};
},
computed: {
},
methods: {
open(ratingItem, workshopName, indicatorName) {
this.rating_bgi_id = ratingItem.id;
this.plan_day = ratingItem.value_day_plan;
this.fact_day = ratingItem.value_day_fact;
this.visible = true;
this.title = "Цех: " + workshopName + " Показатель: " + indicatorName;
},
save() {
let body = {
rating_bgi_id: this.rating_bgi_id,
plan_day: this.plan_day,
fact_day: this.fact_day,
};
let url =
"/index.php?module=_page";
fetch(url, {
method: "POST",
body: JSON.stringify(body),
})
.then((response) => response.json())
.then((data) => {
if (data.error === true) {
Notify.showError(data.message);
} else {
Notify.showSuccess(data.message);
this.$emit("saved");
this.visible = false;
}
BaseTemplate.hideProgress();
});
},
},
});
</script>
что это?
Обсуждают сегодня