Initial import
This commit is contained in:
131
one-ui/masterdata/one-md-test-lang-v3/api/nattest.js
Normal file
131
one-ui/masterdata/one-md-test-lang-v3/api/nattest.js
Normal file
@@ -0,0 +1,131 @@
|
||||
const URL = "/one-api/v1/masterdata/";
|
||||
|
||||
export async function lookup(token, search,langid, current_page ) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/lookup', { token: token, search: search, langid:langid, current_page:current_page });
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function save(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/addnewmapword', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function savenattestlang(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/savenattestlang', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function getlang(token) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/getlang',{token:token});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function update(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/editmapword', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function updateunit(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/updateunit', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function xdelete(token,id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/deletemapword', { id: id, token:token });
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
97
one-ui/masterdata/one-md-test-lang-v3/api/nattestlang.js
Normal file
97
one-ui/masterdata/one-md-test-lang-v3/api/nattestlang.js
Normal file
@@ -0,0 +1,97 @@
|
||||
const URL = "/one-api/v1/masterdata/";
|
||||
|
||||
export async function save(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/addnewnattestlang', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function xdelete(token,id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/deletenattestlang', { id: id ,token:token});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function lookup(token,id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/lookupnattestlang', { id: id,token:token });
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function lookupnattestlang(token,id,search,current_page) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/lookupnattestlangx', { id: id, token:token, search: search, current_page:current_page });
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function lookupnattestlanghide(token,id,search,current_page) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'testlangv3/lookupnattestlanghidex', { id: id, token:token, search: search, current_page:current_page });
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,656 @@
|
||||
<template>
|
||||
<v-layout>
|
||||
<template>
|
||||
|
||||
<v-dialog v-model="dialogdeletealert" max-width="30%">
|
||||
<v-card>
|
||||
<v-card-title class="headline blue lighten-3 white--text 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 flat @click="dialogdeletealert = false">
|
||||
Tutup
|
||||
</v-btn>
|
||||
<v-btn flat @click="closeDeleteAlert()">
|
||||
Yakin lah
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<v-flex xs12>
|
||||
<v-card class="scroll-container" style="/*max-height:645px;overflow: auto;*/">
|
||||
<v-toolbar color="blue lighten-3 white--text" dark height="50px">
|
||||
<v-toolbar-title class="black--text">PEMERIKSAAN</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-icon style="color:#757575" @click="simpanBahasaKata()">save</v-icon>
|
||||
</v-toolbar>
|
||||
<v-snackbar v-model="snackbar" :color="color" :timeout="5000" :multi-line="false" :vertical="false" :top="true">
|
||||
{{msgsnackbar}}
|
||||
<v-btn flat @click="updateAlert_success(false)">
|
||||
Tutup
|
||||
</v-btn>
|
||||
</v-snackbar>
|
||||
<v-layout row style="background:#EEEEEE;padding-top:5px;" justify-left>
|
||||
<v-list-tile>
|
||||
<v-select item-text="Nat_LangName" return-object :items="langs" style="font-size:14px" class="textinput mini-select ma-1"
|
||||
v-model="selected_filter_lang" hide-details></v-select>
|
||||
<input type="text" v-model="xsearch" class="textinput" placeholder="Pemeriksaan..." />
|
||||
</v-list-tile-content>
|
||||
</v-list-tile>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
<div>
|
||||
<v-layout row class="scroll-container" style="max-height:600px;overflow: auto;">
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table :headers="headers" :items="vnattests" :loading="isLoading" hide-actions class="elevation-1">
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_TestSasCode}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_TestName}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.Nat_TestTypeName}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.Nat_GroupName}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{props.item.Nat_SubGroupName}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{props.item.T_TestIsNonLabs}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
||||
<v-text-field style="margin-top:0;padding-top:0" v-model="props.item.Nat_TestLangName" hide-details></v-text-field></td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
||||
<v-text-field style="margin-top:0;padding-top:0" v-model="props.item.Nat_TestLangUnitName" hide-details></v-text-field></td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
||||
<v-text-field style="margin-top:0;padding-top:0" v-model="props.item.Nat_TestLangConversion" hide-details></v-text-field></td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
||||
<v-text-field style="margin-top:0;padding-top:0" v-model="props.item.Nat_TestLangFlagLow" hide-details></v-text-field></td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
||||
<v-text-field style="margin-top:0;padding-top:0" v-model="props.item.Nat_TestLangFlagHigh" hide-details></v-text-field></td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</div>
|
||||
<v-layout row>
|
||||
<v-flex class="text-xs-center" pt-3 xs12>
|
||||
<v-pagination style="margin-top:10px;margin-bottom:10px" v-model="curr_page" :length="xtotal_page"></v-pagination>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<template>
|
||||
<v-layout row justify-center>
|
||||
<v-dialog v-model="dialognattest" persistent max-width="600px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">Form Kata</span>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-form ref="formnattest" v-model="valid" lazy-validation>
|
||||
<v-layout wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="nattestname" label="Nama Kata" :rules="nameRules" required></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" flat @click="updateDialogFormKata()">Tutup</v-btn>
|
||||
<v-btn v-if="xact === 'new'" color="blue darken-1" flat @click="saveFormKata()">Simpan</v-btn>
|
||||
<v-btn v-if="xact === 'edit'" color="blue darken-1" flat @click="updateFormKata()">Simpan Perubahan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-layout>
|
||||
</template>
|
||||
<template>
|
||||
<v-layout row justify-center>
|
||||
<v-dialog v-model="dialogunit" persistent max-width="600px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">Form Ubah Satuan</span>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-form ref="formunit" v-model="valid" lazy-validation>
|
||||
<v-layout wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="unitname" readonly label="Satuan"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="unitnamesi" label="Satuan SI"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="unitkonversi" label="Konversi SI"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" flat @click="updateDialogUnit()">Tutup</v-btn>
|
||||
<v-btn color="blue darken-1" flat @click="updateUnit()">Simpan Perubahan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-layout>
|
||||
</template>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.searchbox .v-input.v-text-field .v-input__slot {
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
.searchbox .v-btn {
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
table.v-table tbody td,
|
||||
table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.textinput {
|
||||
-webkit-transition: width 0.4s ease-in-out;
|
||||
transition: width 0.4s ease-in-out;
|
||||
background-color: white;
|
||||
background-position: 10px 10px;
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 40px;
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
margin-bottom: 5px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #607d8b;
|
||||
|
||||
}
|
||||
|
||||
.textinput:focus {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.textinput:focus::-webkit-input-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.textinput:focus::-moz-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.textinput:-moz-placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.boxoutline {
|
||||
color: red;
|
||||
border: 1px solid red;
|
||||
justify-content: center;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
padding-left: 10px;
|
||||
background: #ffffff;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border-radius: 1px
|
||||
}
|
||||
|
||||
.boxoutline:hover {
|
||||
background: rgba(0, 0, 0, 0.07) !important;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.boxsolid {
|
||||
color: #ffffff;
|
||||
border: 1px solid #ffffff;
|
||||
justify-content: center;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
padding-left: 10px;
|
||||
background: #f44336;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border-radius: 1px
|
||||
}
|
||||
|
||||
.boxsolid:hover {
|
||||
background: #f44336de;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.scroll-container {
|
||||
scroll-padding: 50px 0 0 50px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 7px;
|
||||
}
|
||||
|
||||
/* this targets the default scrollbar (compulsory) */
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background-color: #73baf3;
|
||||
}
|
||||
|
||||
/* the new scrollbar will have a flat appearance with the set background color */
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: #2196f3;
|
||||
}
|
||||
|
||||
/* this will style the thumb, ignoring the track */
|
||||
|
||||
::-webkit-scrollbar-button {
|
||||
background-color: #0079da;
|
||||
}
|
||||
|
||||
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
|
||||
|
||||
::-webkit-scrollbar-corner {
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
/* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data: () => ({
|
||||
color: "success",
|
||||
valid: false,
|
||||
nattestname: '',
|
||||
unitid:0,
|
||||
unitlangid:0,
|
||||
unitname:'',
|
||||
unitnamesi:'',
|
||||
unitkonversi:'',
|
||||
headers: [{
|
||||
text: "KODE",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "8%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "TIPE",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "GRUP",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "SUB GRUP",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "TIPE HASIL",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "8%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA SI",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "SATUAN",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "5%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "KONVERSI",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "5%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "LOW",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "5%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "HIGH",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "5%",
|
||||
class: "blue lighten-3 white--text"
|
||||
},
|
||||
],
|
||||
nameRules: [
|
||||
v => !!v || 'Nama Kata harus diisi'
|
||||
],
|
||||
nattestcode: '',
|
||||
codeRules: [
|
||||
v => !!v || 'Kode Kata harus diisi'
|
||||
],
|
||||
dialogdeletealert: false,
|
||||
msgalert: "",
|
||||
xid: 0
|
||||
}),
|
||||
mounted() {
|
||||
this.$store.dispatch("nattest/getlang", {
|
||||
search: this.xsearch,
|
||||
langid: this.selected_filter_lang.Nat_LangID,
|
||||
current_page: 1
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
xact() {
|
||||
return this.$store.state.nattest.act
|
||||
},
|
||||
xerrors() {
|
||||
return this.$store.state.nattest.errors
|
||||
},
|
||||
xshowall() {
|
||||
return this.$store.state.nattest.show_all
|
||||
},
|
||||
vnattests() {
|
||||
return this.$store.state.nattest.nattests
|
||||
},
|
||||
vshownattests() {
|
||||
return this.$store.state.nattest.shownattests
|
||||
},
|
||||
xnattestlangs() {
|
||||
return this.$store.state.nattest.nattestlangs
|
||||
},
|
||||
xtotalnattests() {
|
||||
return this.$store.state.nattest.total_nattests
|
||||
},
|
||||
xtotalfilternattests() {
|
||||
return this.$store.state.nattest.total_filter_nattests
|
||||
},
|
||||
selected_filter_lang: {
|
||||
get() {
|
||||
return this.$store.state.nattest.selected_filter_lang
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("nattest/update_selected_filter_lang", val)
|
||||
this.searchTest()
|
||||
}
|
||||
},
|
||||
langs: {
|
||||
get() {
|
||||
return this.$store.state.nattest.langs
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("nattest/update_langs", val)
|
||||
}
|
||||
},
|
||||
dialognattest() {
|
||||
return this.$store.state.nattest.dialog_form_nattest
|
||||
},
|
||||
dialogunit() {
|
||||
return this.$store.state.nattest.dialog_form_unit
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.nattest.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("nattest/update_alert_success", val)
|
||||
}
|
||||
},
|
||||
msgsnackbar() {
|
||||
return this.$store.state.nattest.msg_success
|
||||
},
|
||||
lookupstatus() {
|
||||
return this.$store.state.nattest.lookup_nattest
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.nattest.search_status == 1
|
||||
},
|
||||
xsearch: {
|
||||
get() {
|
||||
return this.$store.state.nattest.x_search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("nattest/update_x_search", val)
|
||||
}
|
||||
},
|
||||
curr_page: {
|
||||
get() {
|
||||
return this.$store.state.nattest.current_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("nattest/update_current_page", val)
|
||||
this.$store.dispatch("nattest/lookup", {
|
||||
search: this.xsearch,
|
||||
langid: this.selected_filter_lang.Nat_LangID,
|
||||
current_page: val
|
||||
})
|
||||
}
|
||||
},
|
||||
xtotal_page: {
|
||||
get() {
|
||||
return this.$store.state.nattest.total_nattests
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("nattest/update_total_nattests", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateShowAll(val) {
|
||||
this.$store.commit("nattest/update_show_all", val)
|
||||
this.$store.dispatch("nattest/lookup", {
|
||||
search: this.xsearch,
|
||||
langid: this.selected_filter_lang.Nat_LangID,
|
||||
current_page: 1
|
||||
})
|
||||
},
|
||||
isSelected(p) {
|
||||
return p.id == this.$store.state.nattest.selected_nattest.id
|
||||
},
|
||||
subname(name) {
|
||||
var xname = name
|
||||
if (xname.length > 18) {
|
||||
xname = xname.substring(0, 18) + '...'
|
||||
}
|
||||
return xname
|
||||
},
|
||||
selectMe(sc) {
|
||||
},
|
||||
updateDialogFormKata() {
|
||||
this.$store.commit("nattest/update_dialog_form_nattest", false)
|
||||
},
|
||||
updateDialogUnit() {
|
||||
this.$store.commit("nattest/update_dialog_form_unit", false)
|
||||
},
|
||||
searchTest() {
|
||||
this.$store.dispatch("nattest/lookup", {
|
||||
search: this.xsearch,
|
||||
langid: this.selected_filter_lang.Nat_LangID,
|
||||
current_page: this.curr_page
|
||||
})
|
||||
},
|
||||
openFormKata() {
|
||||
this.$refs.formnattest.reset()
|
||||
this.$refs.formnattest.resetValidation()
|
||||
this.$store.commit("nattest/update_act", 'new')
|
||||
this.$store.commit("nattest/update_dialog_form_nattest", true)
|
||||
},
|
||||
saveFormKata() {
|
||||
if (this.$refs.formnattest.validate()) {
|
||||
this.$store.dispatch("nattest/save", {
|
||||
name: this.nattestname,
|
||||
search: this.xsearch,
|
||||
current_page: 1
|
||||
})
|
||||
}
|
||||
},
|
||||
updateFormKata() {
|
||||
if (this.$refs.formnattest.validate()) {
|
||||
this.$store.dispatch("nattest/update", {
|
||||
id: this.xid,
|
||||
name: this.nattestname,
|
||||
search: this.xsearch,
|
||||
current_page: this.curr_page
|
||||
})
|
||||
}
|
||||
},
|
||||
updateUnit() {
|
||||
this.$store.dispatch("nattest/updateunit", {
|
||||
unitid: this.unitid,
|
||||
unitlangid: this.unitlangid,
|
||||
unitname: this.unitname,
|
||||
unitnamesi: this.unitnamesi,
|
||||
unitkonversi: this.unitkonversi,
|
||||
langid: this.selected_filter_lang.Nat_LangID,
|
||||
search: this.xsearch,
|
||||
current_page: this.curr_page
|
||||
})
|
||||
},
|
||||
updateAlert_success(val) {
|
||||
this.$store.commit("nattest/update_alert_success", val)
|
||||
},
|
||||
editKata(data) {
|
||||
this.xid = data.id
|
||||
this.nattestname = data.name
|
||||
this.$store.commit("nattest/update_act", 'edit')
|
||||
this.$store.commit("nattest/update_dialog_form_nattest", true)
|
||||
},
|
||||
deleteKata(data) {
|
||||
this.xid = data.id
|
||||
var xdata = {
|
||||
id: data.id,
|
||||
name: data.name,
|
||||
search: this.xsearch,
|
||||
current_page: this.curr_page
|
||||
}
|
||||
this.$store.commit("nattest/update_selected_nattest", xdata)
|
||||
this.msgalert = "Yakin, mau hapus nattest " + data.name + " ?"
|
||||
this.dialogdeletealert = true
|
||||
},
|
||||
editUnit(data) {
|
||||
this.unitid = data.Nat_UnitLangNat_UnitID
|
||||
this.unitlangid = data.Nat_UnitLangID
|
||||
this.unitname = data.Nat_UnitName
|
||||
this.unitnamesi = data.Nat_UnitLangSiName
|
||||
this.unitkonversi = data.Nat_UnitLangConversion
|
||||
this.$store.commit("nattest/update_dialog_form_unit", true)
|
||||
},
|
||||
showDetail(idx) {
|
||||
var arrOrders = this.$store.state.nattest.nattests
|
||||
this.$store.dispatch("nattestlang/lookupnattestlang", {
|
||||
id: arrOrders[idx].id,
|
||||
search: this.xsearch,
|
||||
current_page: this.curr_page
|
||||
})
|
||||
arrOrders[idx].show_detail = arrOrders[idx].show_detail === 'Y' ? 'N' : 'Y'
|
||||
this.$store.commit("nattest/update_nattests", arrOrders)
|
||||
this.$store.commit("nattest/update_nattestlangs", arrOrders)
|
||||
},
|
||||
hideDetail(idx) {
|
||||
var arrOrders = this.$store.state.nattest.nattests
|
||||
this.$store.dispatch("nattestlang/lookupnattestlanghide", {
|
||||
id: arrOrders[idx].id,
|
||||
search: this.xsearch,
|
||||
current_page: this.curr_page
|
||||
})
|
||||
arrOrders[idx].show_detail = arrOrders[idx].show_detail === 'Y' ? 'N' : 'Y'
|
||||
this.$store.commit("nattest/update_nattests", arrOrders)
|
||||
},
|
||||
simpanBahasaKataold(idx) {
|
||||
var arrOrders = this.$store.state.nattest.nattests
|
||||
var prm = {}
|
||||
prm.nattestid = arrOrders[idx].id
|
||||
prm.nattestname = arrOrders[idx].name
|
||||
prm.nattestlangs = arrOrders[idx].nattestlangs
|
||||
prm.search = this.xsearch
|
||||
prm.curr_page = this.curr_page
|
||||
this.$store.dispatch("nattest/savenattestlang", prm)
|
||||
},
|
||||
simpanBahasaKata() {
|
||||
var prm = {}
|
||||
prm.nattestlangs = this.$store.state.nattest.nattests
|
||||
prm.search = this.xsearch
|
||||
prm.langid = this.selected_filter_lang.Nat_LangID
|
||||
prm.curr_page = this.curr_page
|
||||
this.$store.dispatch("nattest/savenattestlang", prm)
|
||||
},
|
||||
closeDeleteAlert() {
|
||||
this.$store.dispatch("nattest/delete", {
|
||||
nattestid: this.$store.state.nattest.selected_nattest.id,
|
||||
nattestname: this.$store.state.nattest.selected_nattest.name
|
||||
})
|
||||
this.dialogdeletealert = false
|
||||
},
|
||||
thr_search: _.debounce(function () {
|
||||
this.$store.dispatch("nattest/lookup", {
|
||||
search: this.xsearch,
|
||||
langid: this.selected_filter_lang.Nat_LangID,
|
||||
current_page: this.curr_page
|
||||
})
|
||||
}, 1000)
|
||||
},
|
||||
watch: {
|
||||
xsearch(val, old) {
|
||||
if (val !== old && this.lookupstatus !== 1) {
|
||||
console.log(val)
|
||||
this.xsearch = val
|
||||
this.thr_search()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
75
one-ui/masterdata/one-md-test-lang-v3/index.php
Normal file
75
one-ui/masterdata/one-md-test-lang-v3/index.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>One</title>
|
||||
<link rel="stylesheet" href="../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../libs/vendor/css/vuetify.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp" >
|
||||
<one-navbar></one-navbar>
|
||||
<v-content class="blue lighten-5" >
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap >
|
||||
<v-flex xs12 class="left" fill-height pa-1>
|
||||
<!-- komponen kiri -->
|
||||
<one-md-test-lang-list></one-md-test-lang-list>
|
||||
</v-flex>
|
||||
<!-- <v-flex xs8 class="right" fill-height pa-1>
|
||||
komponen kanan
|
||||
<one-md-test-langlang-list></one-md-test-langlang-list>
|
||||
</v-flex> -->
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</v-content>
|
||||
<one-footer> </one-footer>
|
||||
</v-app>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<script src="../../libs/vendor/moment.min.js"></script>
|
||||
<script src="../../libs/vendor/numeral.min.js"></script>
|
||||
<script src="../../libs/vendor/moment-locale-id.js"></script>
|
||||
<script src="../../libs/vendor/lodash.js"></script>
|
||||
<script src="../../libs/vendor/axios.min.js"></script>
|
||||
<script src="../../libs/vendor/vue.js"></script>
|
||||
<script src="../../libs/vendor/vuex.js"></script>
|
||||
<script src="../../libs/vendor/vuetify.js"></script>
|
||||
<script src="../../libs/vendor/httpVueLoader.js"></script>
|
||||
<script src="../../libs/one_global.js"></script>
|
||||
<!-- App Script -->
|
||||
<?php
|
||||
$ts = "?ts=" . Date("ymdhis");
|
||||
?>
|
||||
<script type="module">
|
||||
import { store } from './store.js<?php echo $ts ?>';
|
||||
//for testing
|
||||
// window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponentNoMenu.vue'),
|
||||
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
|
||||
'one-md-test-lang-list': httpVueLoader('./components/oneMdTestLangList.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
342
one-ui/masterdata/one-md-test-lang-v3/modules/nattest.js
Normal file
342
one-ui/masterdata/one-md-test-lang-v3/modules/nattest.js
Normal file
@@ -0,0 +1,342 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/nattest.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
act: 'new',
|
||||
lookup_nattest: 0,
|
||||
lookup_error_message: '',
|
||||
nattests: [],
|
||||
nattestlangs: [],
|
||||
shownattests: [],
|
||||
total_nattests: 0,
|
||||
total_filter_nattests: 0,
|
||||
selected_nattest: {
|
||||
name: "[ Belum memilih Pemeriksaan ]"
|
||||
},
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_nattest: false,
|
||||
dialog_form_unit: false,
|
||||
dialog_edit_form_nattest: false,
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
show_all: 'N',
|
||||
errors: [],
|
||||
get_data_status: 0,
|
||||
get_data_error_message: '',
|
||||
autocomplete_status: 0,
|
||||
search_status: 0,
|
||||
current_page:1,
|
||||
x_search: '',
|
||||
langs:[],
|
||||
selected_filter_lang:{}
|
||||
},
|
||||
mutations: {
|
||||
update_langs(state, val) {
|
||||
state.langs = val
|
||||
},
|
||||
update_selected_filter_lang(state, val) {
|
||||
state.selected_filter_lang = val
|
||||
},
|
||||
update_x_search(state, val) {
|
||||
state.x_search = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_show_all(state, val) {
|
||||
state.show_all = val
|
||||
},
|
||||
update_lookup_error_message(state, status) {
|
||||
state.lookup_error_message = status
|
||||
},
|
||||
update_lookup_nattest(state, status) {
|
||||
state.lookup_nattest = status
|
||||
},
|
||||
update_nattests(state, data) {
|
||||
state.nattests = data.records
|
||||
state.total_nattests = data.total
|
||||
state.total_filter_nattests = data.total_filter
|
||||
},
|
||||
update_nattestlangs(state, data) {
|
||||
state.nattestlangs = data.records
|
||||
},
|
||||
update_shownattests(state, data) {
|
||||
state.nattests = data.records
|
||||
},
|
||||
update_selected_nattest(state, val) {
|
||||
state.selected_nattest = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_nattest(state, val) {
|
||||
state.dialog_form_nattest = val
|
||||
},
|
||||
update_dialog_edit_form_nattest(state, val) {
|
||||
state.dialog_edit_form_nattest = val
|
||||
},
|
||||
update_dialog_form_unit(state, val) {
|
||||
state.dialog_form_unit = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_get_data_error_message(state, val) {
|
||||
state.get_data_error_message = val
|
||||
},
|
||||
update_autocomplete_status(state, val) {
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
}
|
||||
|
||||
},
|
||||
actions: {
|
||||
async lookup(context, prm) {
|
||||
context.commit("update_lookup_nattest", 1)
|
||||
try {
|
||||
let resp = await api.lookup(one_token(), prm.search, prm.langid, prm.current_page)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_nattest", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_nattest", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_nattests", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_nattest", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.save(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_errors", [])
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_nattest", false)
|
||||
var msg = "Pemeriksaan " + prm.name + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_current_page", 1)
|
||||
context.dispatch("lookup", {
|
||||
search: prm.search,
|
||||
current_page: 1
|
||||
})
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async update(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.update(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_nattest", false)
|
||||
var msg = "Data sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_current_page", prm.current_page)
|
||||
context.dispatch("lookup", {
|
||||
search: prm.search,
|
||||
langid: prm.langid,
|
||||
current_page: prm.current_page
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async updateunit(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.updateunit(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_unit", false)
|
||||
var msg = "Satuan " + prm.unitname + " sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_current_page", prm.current_page)
|
||||
context.dispatch("lookup", {
|
||||
search: prm.search,
|
||||
langid: prm.langid,
|
||||
current_page: prm.current_page
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xdelete(one_token(), prm.nattestid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_alert_success", true)
|
||||
|
||||
var msg = "Pemeriksaan " + prm.nattestname + " sudah dihapus dong"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_selected_nattest", {})
|
||||
context.commit("update_current_page", prm.current_page)
|
||||
context.dispatch("lookup", {
|
||||
search: prm.search,
|
||||
current_page: 1
|
||||
})
|
||||
context.commit("sampletype/update_nattest_sampletype", [], {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async savenattestlang(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.savenattestlang(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_errors", [])
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_nattest", false)
|
||||
var msg = "Pemeriksaan sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_current_page", 1)
|
||||
context.dispatch("lookup", {
|
||||
search: prm.search,
|
||||
langid: prm.langid,
|
||||
current_page: prm.curr_page
|
||||
})
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getlang(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
let resp= await api.getlang(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status",3)
|
||||
} else {
|
||||
context.commit("update_get_data_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_langs",data.records.langs)
|
||||
context.commit("update_selected_filter_lang",data.records.langs[0])
|
||||
prm.langid = data.records.langs[0].Nat_LangID
|
||||
context.dispatch("lookup",prm)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
169
one-ui/masterdata/one-md-test-lang-v3/modules/nattestlang.js
Normal file
169
one-ui/masterdata/one-md-test-lang-v3/modules/nattestlang.js
Normal file
@@ -0,0 +1,169 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/nattestlang.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
nattestlangs: [],
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_nattestlang: false,
|
||||
lookup_nattestlang: 0,
|
||||
lookupnattestlang: 0,
|
||||
errors:[],
|
||||
startdate:moment(new Date()).format('YYYY-MM-DD'),
|
||||
enddate:moment(new Date()).format('YYYY-MM-DD')
|
||||
},
|
||||
mutations: {
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_nattestlangs(state, data) {
|
||||
state.nattestlangs = data
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_nattestlang(state, val) {
|
||||
state.dialog_form_nattestlang = val
|
||||
},
|
||||
update_lookup_nattestlang(state, val) {
|
||||
state.lookup_nattestlang = val
|
||||
},
|
||||
update_lookupnattestlang(state, val) {
|
||||
state.lookupnattestlang = val
|
||||
},
|
||||
update_startdate(state,val){
|
||||
state.startdate = val
|
||||
},
|
||||
update_enddate(state,val){
|
||||
state.enddate = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.save(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("nattest/update_save_status", 3, { root: true })
|
||||
context.commit("nattest/update_save_error_message", resp.message, { root: true })
|
||||
} else {
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
if(data.total !== -1){
|
||||
context.commit("nattest/update_save_status", 2, { root: true })
|
||||
context.commit("nattest/update_save_error_message", resp.message, { root: true })
|
||||
context.commit("nattest/update_alert_success", true, { root: true })
|
||||
|
||||
context.commit("update_dialog_form_nattestlang", false)
|
||||
var msg = "Bahan " + prm.nattestname + " sudah update dong"
|
||||
context.commit("nattest/update_msg_success", msg, { root: true })
|
||||
context.commit("nattest/update_alert_success", true, { root: true })
|
||||
context.dispatch("lookup", {
|
||||
id: prm.nattestid
|
||||
})
|
||||
}else{
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async lookup(context, prm) {
|
||||
context.commit("update_lookup_nattestlang", 1)
|
||||
try {
|
||||
let resp = await api.lookup(one_token(),prm.id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_nattestlang", 3)
|
||||
} else {
|
||||
context.commit("update_lookup_nattestlang", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_nattestlangs", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_nattestlang", 3)
|
||||
}
|
||||
},
|
||||
async lookupnattestlang(context, prm) {
|
||||
context.commit("update_lookupnattestlang", 1)
|
||||
try {
|
||||
let resp = await api.lookupnattestlang(one_token(),prm.id,prm.search, prm.current_page)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookupnattestlang", 3)
|
||||
} else {
|
||||
context.commit("update_lookupnattestlang", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("nattest/update_nattests", data, { root: true })
|
||||
// context.commit("nattest/update_shownattests", data, { root: true })
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookupnattestlang", 3)
|
||||
}
|
||||
},
|
||||
async lookupnattestlanghide(context, prm) {
|
||||
context.commit("update_lookupnattestlang", 1)
|
||||
try {
|
||||
let resp = await api.lookupnattestlanghide(one_token(),prm.id,prm.search, prm.current_page)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookupnattestlang", 3)
|
||||
} else {
|
||||
context.commit("update_lookupnattestlang", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("nattest/update_nattests", data, { root: true })
|
||||
// context.commit("nattest/update_shownattests", data, { root: true })
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookupnattestlang", 3)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xdelete(one_token(),prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("nattest/update_save_status", 3, { root: true })
|
||||
context.commit("nattest/update_save_error_message", resp.message, { root: true })
|
||||
} else {
|
||||
context.commit("nattest/update_save_status", 2, { root: true })
|
||||
context.commit("nattest/update_save_error_message", resp.message, { root: true })
|
||||
context.commit("nattest/update_alert_success", true, { root: true })
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Mou "+prm.name+" dari nattest " + prm.nattestname + " sudah dihapus dong"
|
||||
context.commit("nattest/update_msg_success", msg, { root: true })
|
||||
context.commit("nattest/update_alert_success", true, { root: true })
|
||||
context.dispatch("lookup", {
|
||||
id: prm.nattestid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
one-ui/masterdata/one-md-test-lang-v3/store.js
Normal file
25
one-ui/masterdata/one-md-test-lang-v3/store.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import nattest from "./modules/nattest.js";
|
||||
import nattestlang from "./modules/nattestlang.js";
|
||||
import system from "../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
nattestlang: nattestlang,
|
||||
nattest: nattest,
|
||||
system:system
|
||||
},
|
||||
state: {
|
||||
|
||||
},
|
||||
mutations: {
|
||||
|
||||
},
|
||||
actions: {
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user