925 lines
30 KiB
Vue
925 lines
30 KiB
Vue
<template>
|
|
<v-layout>
|
|
<!-- Alert dialog -->
|
|
<!-- Alert dialog -->
|
|
<v-dialog v-model="dialogdeletealert" max-width="30%">
|
|
<v-card>
|
|
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
|
|
Peringatan !
|
|
</v-card-title>
|
|
<v-card-text class="pt-2 pb-2">
|
|
<v-layout row>
|
|
<v-flex xs12 d-flex>
|
|
<v-layout row>
|
|
<v-flex pb-1 xs12>
|
|
<v-layout row>
|
|
<v-flex pt-2 pr-2 xs12>
|
|
{{ msgalert }}
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-divider></v-divider>
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn color="primary" flat @click="dialogdeletealert = false"> Tutup </v-btn>
|
|
<v-btn color="primary" flat @click="deleteRow()"> Yakin lah </v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
<!-- End alert dialog -->
|
|
|
|
<v-dialog v-model="dialog_form" persistent width="500">
|
|
<v-card>
|
|
<v-card-title class="headline grey lighten-2" primary-title>
|
|
Form Kelainan Lab
|
|
</v-card-title>
|
|
<v-card-text>
|
|
<v-layout row>
|
|
<v-flex xs12>
|
|
<v-autocomplete label="Pemeriksaan" v-model="selected_nat_test" :items="nat_tests"
|
|
:search-input.sync="search_test" auto-select-first no-filter item-text="codeNameTest" return-object
|
|
:loading="isLoading" no-data-text="Cari Pemeriksaan" :error="errTest != ''" :error-messages="errTest">
|
|
<template slot="item" slot-scope="{ item }">
|
|
<v-list-tile-content>
|
|
<v-list-tile-title v-text="item.codeNameTest"></v-list-tile-title>
|
|
</v-list-tile-content>
|
|
</template>
|
|
</v-autocomplete>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-layout row>
|
|
<v-flex xs12>
|
|
<v-autocomplete label="Kelainan" v-model="selected_kelainan" :items="kelainans"
|
|
:error="errKelaianan != ''" :error-messages="errKelaianan" :search-input.sync="search_item_datakelainan"
|
|
auto-select-first no-filter item-text="Mcu_KelainanName" return-object :loading="isLoading"
|
|
no-data-text="Cari Kelainan">
|
|
<template slot="item" slot-scope="{ item }">
|
|
<v-list-tile-content>
|
|
<v-list-tile-title v-text="item.Mcu_KelainanName"></v-list-tile-title>
|
|
</v-list-tile-content>
|
|
</template>
|
|
</v-autocomplete>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-layout row>
|
|
<v-flex xs12>
|
|
<v-select v-model="gender" :items="genders" item-text="name" label="Jenis Kelamin"
|
|
return-object></v-select>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-layout row>
|
|
<v-flex xs12>
|
|
<v-select v-model="selected_fitness" :items="xfitness" :error="errFitness != ''"
|
|
:error-messages="errFitness" item-text="fitnessname" label="Fitness" return-object></v-select>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-layout row>
|
|
<v-flex xs12>
|
|
<v-select v-model="selected_type" :items="types" item-text="name" label="Tipe Hasil Kelainan"
|
|
return-object></v-select>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-card v-if="selected_type.id != 'range'" class="pa-2">
|
|
<v-layout class="mb-2" row>
|
|
<v-flex xs12>
|
|
<v-select v-model="selected_operator_perbandingan" :items="operator_perbandingan"
|
|
:error="errOperatorPerbandingan != ''" item-text="name" solo label="Operator perbandingan"
|
|
return-object hide-details :error-messages="errOperatorPerbandingan"></v-select>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-layout v-if="selected_type.id == 'fixvalue'" row>
|
|
<v-flex xs12>
|
|
<v-text-field label="Nilai pembanding" v-model="value_pembanding" :error="errNilaiPembanding != ''" box
|
|
hide-details :error-messages="errNilaiPembanding"></v-text-field>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card>
|
|
<v-card v-if="selected_type.id == 'range'" class="pa-2">
|
|
<v-layout row>
|
|
<v-flex pa-2 xs6>
|
|
<v-text-field label="Nilai Min" v-model="min_value" :error="errMinValue != ''"
|
|
:error-messages="errMinValue" hide-details outline></v-text-field>
|
|
<v-switch v-model="min_inclusive" label="Inclusive"></v-switch>
|
|
</v-flex>
|
|
<v-flex pa-2 xs6>
|
|
<v-text-field label="Nilai Max" v-model="max_value" :error="errMaxValue != ''"
|
|
:error-messages="errMaxValue" hide-details outline></v-text-field>
|
|
<v-switch v-model="max_inclusive" label="Inclusive"></v-switch>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card>
|
|
</v-card-text>
|
|
|
|
<v-divider></v-divider>
|
|
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn color="primary" :disabled="loading_save" @click="saveData()">
|
|
Simpan
|
|
</v-btn>
|
|
<v-btn color="primary" flat @click="dialog_form = false"> Tutup </v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
|
|
<v-flex xs12>
|
|
<v-card class="mb-2" color="white">
|
|
<v-toolbar color="blue lighten-3" dark height="50px">
|
|
<v-toolbar-title>Master Kelainan Lab</v-toolbar-title>
|
|
<v-spacer></v-spacer>
|
|
<v-btn @click="openNewForm()" icon>
|
|
<v-icon>library_add</v-icon>
|
|
</v-btn>
|
|
</v-toolbar>
|
|
<v-layout row style="background: white; padding-top: 5px; padding-left: 2px">
|
|
<v-layout row justify-left>
|
|
<v-flex xs3>
|
|
<v-text-field class="ma-1" label="Cari" placeholder="Cari Pemeriksaan atau Kelainan" outline
|
|
v-model="xsearch" hide-details></v-text-field>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-layout>
|
|
<v-divider></v-divider>
|
|
<v-layout row class="scroll-container" style="max-height: 645px; overflow: auto">
|
|
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
|
<v-data-table :headers="headers" :items="xkelainanlab" :loading="isLoading" hide-actions
|
|
class="elevation-1">
|
|
<template slot="items" slot-scope="props">
|
|
<td class="text-xs-center pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">
|
|
{{ props.item.rownumber }}
|
|
</td>
|
|
<td class="text-xs-left pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">
|
|
<p class="mb-0" style="font-size: medium">
|
|
{{ props.item.codeNameTest }} : {{ props.item.Mcu_KelainanName }}
|
|
</p>
|
|
</td>
|
|
<td class="text-xs-center pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">
|
|
<v-tooltip bottom>
|
|
<template v-slot:activator="{ on, attrs }">
|
|
<v-icon v-bind="attrs" v-on="on" class="mr-3" @click="openEditForm(props.item)"
|
|
color="primary">edit
|
|
</v-icon>
|
|
</template>
|
|
<span>Edit</span>
|
|
</v-tooltip>
|
|
<v-tooltip bottom>
|
|
<template v-slot:activator="{ on, attrs }">
|
|
<v-icon v-bind="attrs" v-on="on" @click="confirmDelete(props.item)" color="error">delete
|
|
</v-icon>
|
|
</template>
|
|
<span>Hapus</span>
|
|
</v-tooltip>
|
|
</td>
|
|
</template>
|
|
</v-data-table>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-divider></v-divider>
|
|
<v-layout>
|
|
<v-flex>
|
|
<v-pagination style="margin-top: 10px; margin-bottom: 10px" v-model="curr_page" :length="xtotal_page">
|
|
</v-pagination>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card>
|
|
</v-flex>
|
|
</v-layout>
|
|
</template>
|
|
|
|
<style scoped></style>
|
|
|
|
<script>
|
|
module.exports = {
|
|
data() {
|
|
return {
|
|
act: "new",
|
|
xid: null,
|
|
errTest: "",
|
|
errKelaianan: "",
|
|
errFitness: "",
|
|
errOperatorPerbandingan: "",
|
|
errNilaiPembanding: "",
|
|
errMinValue: "",
|
|
errMaxValue: "",
|
|
operator_perbandingan: [
|
|
{ id: "KD", name: "Kurang dari" },
|
|
{ id: "LD", name: "Lebih dari" },
|
|
{ id: "SD", name: "Sama dengan" },
|
|
{ id: "KDSD", name: "Kurang dari sama dengan" },
|
|
{ id: "LDSD", name: "Lebih dari sama dengan" },
|
|
{ id: "TSD", name: "Tidak sama dengan" },
|
|
],
|
|
types: [
|
|
{ id: "fixvalue", name: "Nilai Pembanding" },
|
|
{ id: "range", name: "Range" },
|
|
{ id: "nomalvalue", name: "Normal Value" },
|
|
],
|
|
genders: [
|
|
{ id: "A", name: "Semua Jenis Kelamin" },
|
|
{ id: "M", name: "Laki-laki" },
|
|
{ id: "F", name: "Perempuan" },
|
|
],
|
|
search_test: "",
|
|
search_item_test: "",
|
|
search_item_datakelainan: "",
|
|
search_item_datafitness: "",
|
|
xOperatorPerbandingan: "",
|
|
nilaiPerbandingan: "",
|
|
test_error_message: "",
|
|
kelainan_error_message: "",
|
|
operatorPerbandingan_error_message: "",
|
|
clr: "success",
|
|
xid: "",
|
|
vtestcode: "",
|
|
dialogdeletealert: false,
|
|
msgalert: "",
|
|
headers: [
|
|
{
|
|
text: "NO",
|
|
align: "Center",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "5%",
|
|
class: "pa-2 blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "KELAINAN",
|
|
align: "Center",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "80%",
|
|
class: "pa-2 blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "AKSI",
|
|
align: "Center",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "10%",
|
|
class: "pa-2 blue lighten-3 white--text",
|
|
},
|
|
],
|
|
};
|
|
},
|
|
mounted() {
|
|
this.$store.dispatch("kelainan/search");
|
|
this.$store.dispatch("kelainan/getfitness");
|
|
},
|
|
computed: {
|
|
selected_fitness: {
|
|
get() {
|
|
return this.$store.state.kelainan.selected_fitness;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_selected_fitness", val);
|
|
}
|
|
},
|
|
xfitness() {
|
|
return this.$store.state.kelainan.fitness;
|
|
},
|
|
max_inclusive: {
|
|
get() {
|
|
return this.$store.state.kelainan.max_inclusive;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_max_inclusive", val);
|
|
},
|
|
},
|
|
min_inclusive: {
|
|
get() {
|
|
return this.$store.state.kelainan.min_inclusive;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_min_inclusive", val);
|
|
},
|
|
},
|
|
max_value: {
|
|
get() {
|
|
return this.$store.state.kelainan.max_value;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_max_value", val);
|
|
},
|
|
},
|
|
min_value: {
|
|
get() {
|
|
return this.$store.state.kelainan.min_value;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_min_value", val);
|
|
},
|
|
},
|
|
value_pembanding: {
|
|
get() {
|
|
return this.$store.state.kelainan.value_pembanding;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_value_pembanding", val);
|
|
},
|
|
},
|
|
selected_operator_perbandingan: {
|
|
get() {
|
|
return this.$store.state.kelainan.selected_operator_perbandingan;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_selected_operator_perbandingan", val);
|
|
},
|
|
},
|
|
selected_type: {
|
|
get() {
|
|
return this.$store.state.kelainan.selected_type;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_selected_type", val);
|
|
},
|
|
},
|
|
selected_kelainan: {
|
|
get() {
|
|
return this.$store.state.kelainan.selected_kelainan;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_selected_kelainan", val);
|
|
},
|
|
},
|
|
kelainans: {
|
|
get() {
|
|
return this.$store.state.kelainan.kelainans;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_kelainans", val);
|
|
},
|
|
},
|
|
selected_nat_test: {
|
|
get() {
|
|
return this.$store.state.kelainan.selected_nat_test;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_selected_nat_test", val);
|
|
},
|
|
},
|
|
nat_tests: {
|
|
get() {
|
|
return this.$store.state.kelainan.nat_tests;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_nat_tests", val);
|
|
},
|
|
},
|
|
isEdit() {
|
|
return this.xact === "edit";
|
|
},
|
|
xkelainanlab() {
|
|
return this.$store.state.kelainan.kelainanlab;
|
|
},
|
|
isLoading() {
|
|
return this.$store.state.kelainan.search_status == 1;
|
|
},
|
|
curr_page: {
|
|
get() {
|
|
return this.$store.state.kelainan.current_page;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_current_page", val);
|
|
this.$store.commit("kelainan/update_last_id", -1);
|
|
this.$store.dispatch("kelainan/search");
|
|
},
|
|
},
|
|
gender: {
|
|
get() {
|
|
return this.$store.state.kelainan.gender;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_gender", val);
|
|
},
|
|
},
|
|
xtotal_page: {
|
|
get() {
|
|
return this.$store.state.kelainan.total_kelainanlab_page;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_total_kelainanlab_page", val);
|
|
},
|
|
},
|
|
xsearch: {
|
|
get() {
|
|
return this.$store.state.kelainan.x_search;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_x_search", val);
|
|
},
|
|
},
|
|
dialog_form: {
|
|
get() {
|
|
return this.$store.state.kelainan.dialog_form;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_dialog_form", val);
|
|
this.$store.commit("kelainan/update_fitness", [])
|
|
this.$store.commit("kelainan/update_selected_fitness", {})
|
|
},
|
|
},
|
|
loading_save: {
|
|
get() {
|
|
return this.$store.state.kelainan.loading_save;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_loading_save", val);
|
|
},
|
|
},
|
|
xact: {
|
|
get() {
|
|
return this.$store.state.kelainan.act;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_act", val);
|
|
},
|
|
},
|
|
xtests() {
|
|
return this.$store.state.kelainan.tests;
|
|
},
|
|
vtest: {
|
|
get() {
|
|
return this.$store.state.kelainan.selected_test;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_selected_test", val);
|
|
},
|
|
},
|
|
xdatakelainans() {
|
|
return this.$store.state.kelainan.datakelainans;
|
|
},
|
|
vdatakelainan: {
|
|
get() {
|
|
return this.$store.state.kelainan.selected_datakelainan;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_selected_datakelainan", val);
|
|
},
|
|
},
|
|
isNilaiNormal: {
|
|
get() {
|
|
return this.$store.state.kelainan.selected_isNilaiNormal;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_selected_isNilaiNormal", val);
|
|
},
|
|
},
|
|
snackbar: {
|
|
get() {
|
|
return this.$store.state.kelainan.alert_success;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_alert_success", val);
|
|
},
|
|
},
|
|
msgsnackbar() {
|
|
return this.$store.state.kelainan.msg_success;
|
|
},
|
|
dialog_error: {
|
|
get() {
|
|
return this.$store.state.kelainan.alert_error;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_alert_error", val);
|
|
},
|
|
},
|
|
msgError() {
|
|
return this.$store.state.kelainan.error_message;
|
|
},
|
|
message_existing: {
|
|
get() {
|
|
return this.$store.state.kelainan.message_existing;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("kelainan/update_message_existing", val);
|
|
},
|
|
},
|
|
},
|
|
methods: {
|
|
resetForm() {
|
|
this.selected_nat_test = {};
|
|
this.nat_tests = [];
|
|
this.selected_kelainan = {};
|
|
this.kelainans = [];
|
|
// this.$store.commit("kelainan/update_fitness", [])
|
|
this.gender = { id: "A", name: "Semua Jenis Kelamin" };
|
|
this.selected_type = { id: "range", name: "Range" };
|
|
this.min_value = "";
|
|
this.max_value = "";
|
|
this.min_inclusive = false;
|
|
this.max_inclusive = false;
|
|
this.value_pembanding = "";
|
|
this.selected_operator_perbandingan = {};
|
|
this.errTest = "";
|
|
this.errKelaianan = "";
|
|
this.errFitness = "";
|
|
this.errOperatorPerbandingan = "";
|
|
this.errNilaiPembanding = "";
|
|
this.errMinValue = "";
|
|
this.errMaxValue = "";
|
|
},
|
|
openEditForm(data) {
|
|
this.dialog_form = true;
|
|
this.act = "edit";
|
|
this.xid = data.Mcu_SummaryLabID;
|
|
this.selectMe(data);
|
|
this.nat_tests = [
|
|
{
|
|
Nat_TestID: data.Nat_TestID,
|
|
Nat_TestCode: data.Nat_TestCode,
|
|
codeNameTest: data.codeNameTest,
|
|
},
|
|
];
|
|
this.selected_nat_test = {
|
|
Nat_TestID: data.Nat_TestID,
|
|
Nat_TestCode: data.Nat_TestCode,
|
|
codeNameTest: data.codeNameTest,
|
|
};
|
|
this.kelainans = [
|
|
{
|
|
Mcu_KelainanID: data.Mcu_KelainanID,
|
|
Mcu_KelainanName: data.Mcu_KelainanName,
|
|
Mcu_KelainanClasification: data.Mcu_KelainanClasification,
|
|
},
|
|
];
|
|
this.selected_kelainan = {
|
|
Mcu_KelainanID: data.Mcu_KelainanID,
|
|
Mcu_KelainanName: data.Mcu_KelainanName,
|
|
Mcu_KelainanClasification: data.Mcu_KelainanClasification,
|
|
};
|
|
this.$store.commit("kelainan/update_fitness", [
|
|
{
|
|
Mcu_FitnessCategoryID: data.Mcu_FitnessCategoryID,
|
|
fitnessname: data.fitnessname
|
|
}
|
|
])
|
|
this.$store.commit("kelainan/update_selected_fitness", {
|
|
Mcu_FitnessCategoryID: data.Mcu_FitnessCategoryID,
|
|
fitnessname: data.fitnessname
|
|
})
|
|
let gendername = "Semua Jenis Kelamin";
|
|
if (data.gender == "M") gendername = "Laki-laki";
|
|
else if (data.gender == "F") gendername = "Perempuan";
|
|
|
|
console.log('degub_gender')
|
|
console.log({ id: data.gender, name: gendername })
|
|
|
|
this.gender = { id: data.gender, name: gendername };
|
|
this.selected_type = { id: data.typex, name: data.typexname };
|
|
this.selected_operator_perbandingan = {
|
|
id: data.summarylabtypecode,
|
|
name: data.summarylabtype,
|
|
};
|
|
this.value_pembanding = data.Mcu_SummaryLabValue;
|
|
this.min_inclusive = data.Mcu_SummaryLabMinInclusive;
|
|
this.max_inclusive = data.Mcu_SummaryLabMaxInclusive;
|
|
this.min_value = data.Mcu_SummaryLabMinValue;
|
|
this.max_value = data.Mcu_SummaryLabMaxValue;
|
|
},
|
|
openNewForm() {
|
|
this.act = "new";
|
|
this.resetForm();
|
|
this.dialog_form = true;
|
|
this.$store.dispatch("kelainan/getfitness");
|
|
},
|
|
isSelected(p) {
|
|
return (
|
|
p.Mcu_SummaryLabID ==
|
|
this.$store.state.kelainan.selected_kelainanlab.Mcu_SummaryLabID
|
|
);
|
|
},
|
|
selectMe(selected) {
|
|
this.$store.commit("kelainan/update_selected_kelainanlab", selected);
|
|
this.$store.commit("kelainan/update_last_id", selected.Mcu_SummaryLabID);
|
|
|
|
// set value selected test
|
|
this.$store.commit("kelainan/update_tests", [
|
|
{
|
|
Nat_TestID: selected.Nat_TestID,
|
|
codeNameTest: selected.codeNameTest,
|
|
Nat_TestCode: selected.Nat_TestCode,
|
|
},
|
|
]);
|
|
this.$store.commit("kelainan/update_selected_test", {
|
|
Nat_TestID: selected.Nat_TestID,
|
|
codeNameTest: selected.codeNameTest,
|
|
Nat_TestCode: selected.Nat_TestCode,
|
|
});
|
|
|
|
// set value selected kelainan
|
|
this.$store.commit("kelainan/update_datakelainans", [
|
|
{
|
|
Mcu_KelainanID: selected.Mcu_KelainanID,
|
|
Mcu_KelainanName: selected.Mcu_KelainanName,
|
|
},
|
|
]);
|
|
this.$store.commit("kelainan/update_selected_datakelainan", {
|
|
Mcu_KelainanID: selected.Mcu_KelainanID,
|
|
Mcu_KelainanName: selected.Mcu_KelainanName,
|
|
});
|
|
|
|
this.$store.commit("kelainan/update_fitness", [
|
|
{
|
|
Mcu_FitnessCategoryID: selected.Mcu_FitnessCategoryID,
|
|
fitnessname: selected.fitnessname
|
|
}
|
|
])
|
|
this.$store.commit("kelainan/update_selected_fitness", {
|
|
Mcu_FitnessCategoryID: selected.Mcu_FitnessCategoryID,
|
|
fitnessname: selected.fitnessname
|
|
})
|
|
|
|
this.$store.dispatch("kelainan/getfitness");
|
|
},
|
|
thr_search: _.debounce(function () {
|
|
this.$store.dispatch("kelainan/search");
|
|
}, 1000),
|
|
thr_search_test: _.debounce(function () {
|
|
this.$store.dispatch("kelainan/searchtest", this.search_item_test);
|
|
}, 2000),
|
|
thr_search_datakelainan: _.debounce(function () {
|
|
this.$store.dispatch("kelainan/searchkelainan", this.search_item_datakelainan);
|
|
}, 2000),
|
|
testValidation() {
|
|
if (_.isEmpty(this.vtest)) {
|
|
this.test_error_message = "Anda belum memilih pemeriksaan";
|
|
}
|
|
if (this.vtest) {
|
|
this.test_error_message = "";
|
|
}
|
|
},
|
|
kelainanValidation() {
|
|
if (_.isEmpty(this.vdatakelainan)) {
|
|
this.kelainan_error_message = "Anda belum memilih kelainan";
|
|
}
|
|
if (this.vdatakelainan) {
|
|
this.kelainan_error_message = "";
|
|
}
|
|
},
|
|
operatorValidation() {
|
|
if (_.isEmpty(this.xOperatorPerbandingan)) {
|
|
this.operatorPerbandingan_error_message =
|
|
"Anda belum memilih operator perbandingan";
|
|
}
|
|
if (this.xOperatorPerbandingan) {
|
|
this.operatorPerbandingan_error_message = "";
|
|
}
|
|
},
|
|
resetAllInput() {
|
|
this.vtest = "";
|
|
this.vdatakelainan = "";
|
|
this.xOperatorPerbandingan = "";
|
|
this.isNilaiNormal = true;
|
|
this.nilaiPerbandingan = "";
|
|
this.test_error_message = "";
|
|
this.kelainan_error_message = "";
|
|
this.operatorPerbandingan_error_message = "";
|
|
this.message_existing = "";
|
|
},
|
|
resetAllError() {
|
|
this.test_error_message = "";
|
|
this.kelainan_error_message = "";
|
|
this.operatorPerbandingan_error_message = "";
|
|
this.message_existing = "";
|
|
},
|
|
openForm() {
|
|
this.dialog_form = true;
|
|
this.$store.commit("kelainan/update_act", "add");
|
|
this.$store.commit("kelainan/update_last_id", -1);
|
|
this.resetAllInput();
|
|
},
|
|
handleSwitchChange() {
|
|
if (this.isNilaiNormal) {
|
|
this.nilaiPerbandingan = "";
|
|
}
|
|
},
|
|
saveAdd() {
|
|
this.testValidation();
|
|
this.kelainanValidation();
|
|
this.operatorValidation();
|
|
if (
|
|
this.test_error_message === "" &&
|
|
this.operatorPerbandingan_error_message === "" &&
|
|
this.kelainan_error_message === ""
|
|
) {
|
|
let prm = {
|
|
testId: this.vtest.Nat_TestID,
|
|
testCode: this.vtest.Nat_TestCode,
|
|
kelainanId: this.vdatakelainan.Mcu_KelainanID,
|
|
type: this.xOperatorPerbandingan,
|
|
normalValue: this.isNilaiNormal === true ? "Y" : "N",
|
|
value: this.isNilaiNormal === true ? "" : this.nilaiPerbandingan,
|
|
};
|
|
|
|
// console.log('cek prm',prm)
|
|
this.$store.dispatch("kelainan/add", prm);
|
|
}
|
|
},
|
|
openEdit(data) {
|
|
let operator;
|
|
|
|
switch (data.Mcu_SummaryLabType) {
|
|
case "<":
|
|
operator = "KD";
|
|
break;
|
|
case ">":
|
|
operator = "LD";
|
|
break;
|
|
case "=":
|
|
operator = "SD";
|
|
break;
|
|
case "<=":
|
|
operator = "KDSD";
|
|
break;
|
|
case ">=":
|
|
operator = "LDSD";
|
|
break;
|
|
case "!=":
|
|
operator = "TSD";
|
|
break;
|
|
default:
|
|
operator = ""; // Atur default jika diperlukan
|
|
}
|
|
|
|
this.selectMe(data);
|
|
this.dialog_form = true;
|
|
this.$store.commit("kelainan/update_act", "edit");
|
|
this.xid = data.Mcu_SummaryLabID;
|
|
this.vtest = data.Nat_TestID;
|
|
this.vdatakelainan = data.Mcu_KelainanID;
|
|
this.xOperatorPerbandingan = operator;
|
|
this.isNilaiNormal = data.Mcu_SummaryLabIsNormalValue === "Y" ? true : false;
|
|
this.nilaiPerbandingan = data.Mcu_SummaryLabValue;
|
|
this.$store.commit("kelainan/update_last_id", data.Mcu_SummaryLabID);
|
|
this.resetAllError();
|
|
},
|
|
saveEdit() {
|
|
this.testValidation();
|
|
this.kelainanValidation();
|
|
this.operatorValidation();
|
|
if (
|
|
this.test_error_message === "" &&
|
|
this.operatorPerbandingan_error_message === "" &&
|
|
this.kelainan_error_message === ""
|
|
) {
|
|
let prm = {
|
|
xid: this.xid,
|
|
type: this.xOperatorPerbandingan,
|
|
normalValue: this.isNilaiNormal === true ? "Y" : "N",
|
|
value: this.isNilaiNormal === true ? "" : this.nilaiPerbandingan,
|
|
};
|
|
this.$store.dispatch("kelainan/edit", prm);
|
|
}
|
|
},
|
|
confirmDelete(data) {
|
|
this.selectMe(data);
|
|
this.xid = data.Mcu_SummaryLabID;
|
|
this.msgalert = "Yakin, mau hapus kelainan lab " + data.codeNameTest + " ?";
|
|
|
|
this.dialogdeletealert = true;
|
|
},
|
|
deleteRow() {
|
|
this.$store.commit("kelainan/update_last_id", -1);
|
|
let prm = {
|
|
xid: this.xid,
|
|
};
|
|
this.$store.dispatch("kelainan/deleterow", prm);
|
|
this.dialogdeletealert = false;
|
|
},
|
|
thr_search_test: _.debounce(function () {
|
|
let prm = {
|
|
search: this.search_test,
|
|
};
|
|
this.$store.dispatch("kelainan/searchtest", prm);
|
|
}, 2000),
|
|
saveData() {
|
|
this.loading_save = true;
|
|
this.errTest = "";
|
|
if (_.isEmpty(this.selected_nat_test)) {
|
|
this.errTest = "Anda belum memlih pemeriksaan";
|
|
}
|
|
|
|
this.errKelaianan = "";
|
|
if (_.isEmpty(this.selected_kelainan)) {
|
|
this.errKelaianan = "Anda belum memlih kelainan";
|
|
}
|
|
this.errFitness = "";
|
|
if (_.isEmpty(this.selected_fitness)) {
|
|
this.errFitness = "Anda belum memilih fitness";
|
|
}
|
|
|
|
this.errOperatorPerbandingan = "";
|
|
this.errNilaiPembanding = "";
|
|
if (this.selected_type.id != "range") {
|
|
if (_.isEmpty(this.selected_operator_perbandingan)) {
|
|
this.errOperatorPerbandingan = "Anda lupa memilih operator perbandingan";
|
|
console.log("operator perbandingan " + this.errOperatorPerbandingan);
|
|
}
|
|
}
|
|
|
|
if (this.selected_type.id == "fixvalue") {
|
|
if (this.value_pembanding == "") {
|
|
this.errNilaiPembanding = "Anda lupa mengisi nilai pembanding";
|
|
console.log("Nilai pembanding" + this.errNilaiPembanding);
|
|
}
|
|
}
|
|
|
|
this.errMinValue = "";
|
|
this.errMaxValue = "";
|
|
if (this.selected_type.id === "range") {
|
|
console.log(this.min_value);
|
|
if (this.min_value == "") {
|
|
this.errMinValue = "Anda lupa mengisi min value";
|
|
console.log("min pembanding" + this.errMinValue);
|
|
}
|
|
|
|
if (this.max_value == "") {
|
|
this.errMaxValue = "Anda lupa mengisi max value";
|
|
console.log("max pembanding" + this.errMaxValue);
|
|
}
|
|
}
|
|
|
|
if (
|
|
this.errTest == "" &&
|
|
this.errKelaianan == "" &&
|
|
this.errFitness == "" &&
|
|
this.errOperatorPerbandingan == "" &&
|
|
this.errNilaiPembanding == "" &&
|
|
this.errMinValue == "" &&
|
|
this.errMaxValue == ""
|
|
) {
|
|
let prm = {
|
|
xid: this.xid,
|
|
nat_test: this.selected_nat_test,
|
|
kelainan: this.selected_kelainan,
|
|
fitness: this.selected_fitness,
|
|
gender: this.gender,
|
|
type: this.selected_type,
|
|
operator_pembanding: this.selected_operator_perbandingan,
|
|
value_pembanding: this.value_pembanding,
|
|
min_value: this.min_value,
|
|
max_value: this.max_value,
|
|
min_inclusive: this.min_inclusive,
|
|
max_inclusive: this.max_inclusive,
|
|
};
|
|
|
|
if (this.act == "new") this.$store.dispatch("kelainan/newData", prm);
|
|
else this.$store.dispatch("kelainan/editData", prm);
|
|
} else {
|
|
this.loading_save = false;
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
search_test(val, old) {
|
|
if (val == old) return;
|
|
if (!val) return;
|
|
if (val.length < 1) return;
|
|
if (this.$store.state.kelainan.search_status == 1) return;
|
|
this.thr_search_test();
|
|
},
|
|
xsearch(val, old) {
|
|
this.xsearch = val;
|
|
this.thr_search();
|
|
},
|
|
|
|
search_item_test(val, old) {
|
|
if (val == old) return;
|
|
if (!val) return;
|
|
|
|
if (val.length < 1) {
|
|
this.$store.dispatch("kelainan/searchtest", this.search_item_test);
|
|
return this.thr_search_test();
|
|
}
|
|
|
|
if (val.length > 2) {
|
|
this.$store.dispatch("kelainan/searchtest", this.search_item_test);
|
|
return this.thr_search_test();
|
|
}
|
|
},
|
|
|
|
search_item_datakelainan(val, old) {
|
|
if (val == old) return;
|
|
if (!val) return;
|
|
|
|
if (val.length < 1) {
|
|
//this.$store.dispatch("kelainan/searchkelainan", this.search_item_datakelainan)
|
|
return this.thr_search_datakelainan();
|
|
}
|
|
|
|
if (val.length > 2) {
|
|
//this.$store.dispatch("kelainan/searchkelainan", this.search_item_datakelainan)
|
|
return this.thr_search_datakelainan();
|
|
}
|
|
}
|
|
},
|
|
};
|
|
</script>
|