Initial import
This commit is contained in:
101
one-ui/masterdata/one-md-nat-methode/api/methode.js
Normal file
101
one-ui/masterdata/one-md-nat-methode/api/methode.js
Normal file
@@ -0,0 +1,101 @@
|
||||
const URL = "/one-api/v1/masterdata/";
|
||||
|
||||
export async function search(token, name, scode) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'methode/search', {
|
||||
token:token,
|
||||
nama: name,
|
||||
scode: scode
|
||||
});
|
||||
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 + 'methode/save',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 newmethode(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'methode/newmethode',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(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'methode/deletemethode',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 checkcodeexist(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'methode/checkcodeexist ',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
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-layout class="mb-2" column>
|
||||
<v-dialog v-model="dialogconfirmationdelete" persistent max-width="290">
|
||||
<v-card>
|
||||
<v-card-title dark class="headline error pt-2 pb-2" primary-title style="color:white">
|
||||
<h4 dark>Konfirmasi</h4>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
{{msgconfirmationdelete}}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small color="error darken-1 text-sm-left" flat @click="doDeleteData()">Hapus</v-btn>
|
||||
<v-btn small color="primary darken-1 text-sm-right" flat @click="dialogconfirmationdelete = false">Batal</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-card>
|
||||
<v-layout row>
|
||||
<v-flex xs12>
|
||||
<v-subheader red--text text--lighten-1> DETAIL METODE
|
||||
<v-flex text-md-right>
|
||||
<v-btn v-if="xact === 'new'" @click="saveNewMethode()" small color="info">Simpan</v-btn>
|
||||
<v-btn v-if="xact === 'edit'" @click="deleteData()" small color="error">Hapus</v-btn>
|
||||
<v-btn v-if="xact === 'edit'" @click="saveData()" small color="primary">Simpan</v-btn>
|
||||
</v-flex>
|
||||
</v-subheader>
|
||||
<v-divider></v-divider>
|
||||
<v-layout wrap>
|
||||
<v-flex xs12 pa-2>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-text-field class="pr-1" v-model="xcode" @change="checkCodeExist()" label="Kode*"></v-text-field>
|
||||
<p style="margin-top: -14px;margin-right:2px;color:#fff" v-if="checkError('requirecode')" class="error pl-2 pr-2" style="color:#fff">Kode harus diisi ya</p>
|
||||
<p style="margin-top: -14px;margin-right:2px;color:#fff" v-if="checkError('requirecodeexist')" class="error pl-2 pr-2" style="color:#fff">Sudah dipake dong</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-text-field class="pr-1" v-model="xmethodename" label="Nama*"></v-text-field>
|
||||
<p style="margin-top: -14px;margin-right:2px;color:#fff" v-if="checkError('requirename')" class="error pl-2 pr-2" style="color:#fff">Kalo gak ada namanya, bingung dong</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-text-field class="pr-1" v-model="xmethodenameresult" label="Nama Tercetak di Hasil*"></v-text-field>
|
||||
<p style="margin-top: -14px;margin-right:2px;color:#fff" v-if="checkError('requirenameresult')" class="error pl-2 pr-2" style="color:#fff">Kalo gak ada namanya, bingung dong</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-text-field class="pr-1" v-model="xpriority" label="Prioritas"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-flex>
|
||||
</v-card>
|
||||
</v-layout>
|
||||
|
||||
|
||||
<template>
|
||||
|
||||
<v-dialog v-model="dialogerrormsg" max-width="30%">
|
||||
<v-card>
|
||||
<v-card-title class="headline red en-1 pt-2 pb-2" primary-title>
|
||||
<h4 style="color:#FFEBEE">Peringatan !</h4>
|
||||
</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 v-html="errormsg" xs12>
|
||||
|
||||
</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="error" flat @click="dialogerrormsg = false">
|
||||
Tutup
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
table,
|
||||
td,
|
||||
th {
|
||||
border: 1px solid #ddd;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 8px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.mini-input .v-input {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.mini-input .v-input,
|
||||
.mini-input .v-input--selection-controls,
|
||||
.mini-input .v-input__slot {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.mini-input .v-messages {
|
||||
min-height: 0px;
|
||||
}
|
||||
|
||||
input.fhm-input {
|
||||
border: 1px solid black;
|
||||
border-radius: 2px;
|
||||
-webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1),
|
||||
0 0 4px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1),
|
||||
0 0 4px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1),
|
||||
0 0 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 2px 4px;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
margin: 0 0 1px 0;
|
||||
width: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data: () => ({
|
||||
dialogerrormsg: false,
|
||||
errormsg: '',
|
||||
search_sample: '',
|
||||
startdate: '',
|
||||
enddate: '',
|
||||
menustartdate: false,
|
||||
menuenddate: false,
|
||||
date: new Date().toISOString().substr(0, 10)
|
||||
}),
|
||||
computed: {
|
||||
dialogconfirmationdelete: {
|
||||
get() {
|
||||
return this.$store.state.methode.dialog_confirmation_delete
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_dialog_confirmation_delete", val)
|
||||
}
|
||||
},
|
||||
msgconfirmationdelete() {
|
||||
return this.$store.state.methode.msg_confirmation_delete
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.methode.search_status == 1
|
||||
},
|
||||
xact() {
|
||||
return this.$store.state.methode.act
|
||||
},
|
||||
detail() {
|
||||
return this.$store.state.methode.selected_methode
|
||||
},
|
||||
|
||||
xcode: {
|
||||
get() {
|
||||
return this.$store.state.methode.code
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_code", val)
|
||||
this.$store.commit("methode/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xmethodename: {
|
||||
get() {
|
||||
return this.$store.state.methode.methode_name
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_methode_name", val)
|
||||
this.$store.commit("methode/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xmethodenameresult: {
|
||||
get() {
|
||||
return this.$store.state.methode.methode_nameresult
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_methode_nameresult", val)
|
||||
this.$store.commit("methode/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xpriority: {
|
||||
get() {
|
||||
return this.$store.state.methode.priority
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_priority", val)
|
||||
this.$store.commit("methode/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
startComputedDateFormatted() {
|
||||
return this.formatDate(this.xstartdate)
|
||||
},
|
||||
xstartdate: {
|
||||
get() {
|
||||
return this.$store.state.methode.startdate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_startdate", val)
|
||||
}
|
||||
},
|
||||
endComputedDateFormatted() {
|
||||
return this.formatDate(this.xenddate)
|
||||
},
|
||||
xenddate: {
|
||||
get() {
|
||||
return this.$store.state.methode.enddate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_enddate", val)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
checkError(value) {
|
||||
var errors = this.$store.state.methode.errors
|
||||
if (errors.includes(value)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
checkCodeExist() {
|
||||
this.$store.dispatch("methode/checkcodeexist", {
|
||||
code: this.xcode
|
||||
})
|
||||
},
|
||||
saveData() {
|
||||
var prm = {}
|
||||
prm.Nat_MethodeID = this.$store.state.methode.selected_methode.Nat_MethodeID
|
||||
prm.Nat_MethodeCode = this.xcode
|
||||
prm.Nat_MethodeName = this.xmethodename
|
||||
prm.Nat_MethodeNameInResult = this.xmethodenameresult
|
||||
prm.Nat_MethodePriority = this.xpriority
|
||||
this.$store.dispatch("methode/save", prm)
|
||||
|
||||
},
|
||||
saveNewMethode() {
|
||||
var error_count = 0
|
||||
var error_msg = ''
|
||||
if (this.xcode === "") {
|
||||
error_count++
|
||||
error_msg +=
|
||||
"<p><kbd class='text-uppercase'>Kode</kbd> : Diisi dong kodenya</p>"
|
||||
}
|
||||
if (this.$store.state.methode.code_exist === 'Y' && this.$store.state.methode.act === 'new'){
|
||||
error_count++
|
||||
error_msg +=
|
||||
"<p><kbd class='text-uppercase'>Kode</kbd> : Kodenya sudah digunakan, ganti ya</p>"
|
||||
}
|
||||
if (this.xmethodename === "") {
|
||||
error_count++
|
||||
error_msg +=
|
||||
"<p><kbd class='text-uppercase'>Nama Methode</kbd> : Diisi dong nama metodenya</p>"
|
||||
}
|
||||
if (this.xmethodenameresult === "") {
|
||||
error_count++
|
||||
error_msg +=
|
||||
"<p><kbd class='text-uppercase'>Nama Metode di Hasil</kbd> : Diisi dong nama metode di hasilnya</p>"
|
||||
}
|
||||
if (error_count > 0) {
|
||||
this.errormsg = error_msg
|
||||
this.dialogerrormsg = true
|
||||
} else {
|
||||
var prm = {}
|
||||
prm.Nat_MethodeID = 0
|
||||
prm.Nat_MethodeCode = this.xcode
|
||||
prm.Nat_MethodeName = this.xmethodename
|
||||
prm.Nat_MethodeNameInResult = this.xmethodenameresult
|
||||
prm.Nat_MethodePriority = this.xpriority
|
||||
this.$store.dispatch("methode/newmethode", prm)
|
||||
}
|
||||
},
|
||||
thr_search_sample: _.debounce(function () {
|
||||
this.$store.dispatch("methode/searchsample", this.search_sample)
|
||||
}, 2000),
|
||||
formatDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [year, month, day] = date.split('-')
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
deFormatedDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [day, month, year] = date.split('-')
|
||||
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
|
||||
},
|
||||
deleteData() {
|
||||
let msg = "Yakin, akan menghapus data metode " + this.xmethodename + " ?"
|
||||
this.$store.commit("methode/update_msg_confirmation_delete", msg)
|
||||
this.$store.commit("methode/update_dialog_confirmation_delete", true)
|
||||
},
|
||||
doDeleteData() {
|
||||
var prm = {}
|
||||
prm.Nat_MethodeID = this.$store.state.methode.selected_methode.Nat_MethodeID
|
||||
prm.Nat_MethodeName = this.xmethodename
|
||||
this.$store.dispatch("methode/delete", prm)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
search_sample(val, old) {
|
||||
if (val == old) return
|
||||
if (!val) return
|
||||
if (val.length < 1) return
|
||||
if (this.$store.state.methode.update_autocomplete_status == 1) return
|
||||
this.thr_search_sample()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,232 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
<v-dialog v-model="dialogsuccess" persistent max-width="290">
|
||||
<v-card>
|
||||
<v-card-title color="success" class="headline">Berhasil !</v-card-title>
|
||||
<v-card-text>
|
||||
{{msgsuccess}}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="green darken-1" flat @click="closeDialogSuccess">OK</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-card class="mb-2 pa-2 searchbox">
|
||||
<v-layout>
|
||||
<v-text-field class="xs6 ma-1" label="" placeholder="Kode" single-line outline v-model="scode" @keyup.enter="searchMethode"
|
||||
hide-details></v-text-field>
|
||||
|
||||
<v-text-field class="xs6 ma-1" label="" placeholder="Nama" single-line outline v-model="name" @keyup.enter="searchMethode" hide-details></v-text-field>
|
||||
<span @click="setNewMethode" class="icon-medium-fill-base xs1 white--text primary ml-1 icon-add"></span>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table disable-sort="true" :headers="headers" :items="methodes" :loading="isLoading" :pagination.sync="pagination" 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.Nat_MethodeCode}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.Nat_MethodeName}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.Nat_MethodeNameInResult}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.Nat_MethodePriority}}</td>
|
||||
</template>
|
||||
<template>
|
||||
<div class="text-xs-center">
|
||||
<v-pagination v-model="page" :length="15" :total-visible="4"></v-pagination>
|
||||
</div>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<one-dialog-alert :status="openalertconfirmation" :msg="msgalertconfirmation" @forget-dialog-alert="forgetAlertConfirmation()"
|
||||
@close-dialog-alert="closeAlertConfirmation()"></one-dialog-alert>
|
||||
</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;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
'one-dialog-info': httpVueLoader('../../../common/oneDialogInfo.vue'),
|
||||
'one-dialog-alert': httpVueLoader('../../../common/oneDialogAlert.vue')
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("methode/search", {
|
||||
name: this.name,
|
||||
scode: this.scode,
|
||||
lastid: -1
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
isSelected(p) {
|
||||
return p.Nat_MethodeID == this.$store.state.methode.selected_methode.Nat_MethodeID
|
||||
},
|
||||
searchMethode() {
|
||||
this.$store.dispatch("methode/search", {
|
||||
name: this.name,
|
||||
scode: this.scode,
|
||||
lastid: -1
|
||||
})
|
||||
},
|
||||
selectMe(sta) {
|
||||
if (this.$store.state.methode.no_save == 0) {
|
||||
this.$store.commit("methode/update_selected_methode", sta)
|
||||
this.$store.commit("methode/update_methode_name", sta.Nat_MethodeName)
|
||||
this.$store.commit("methode/update_methode_nameresult", sta.Nat_MethodeNameInResult)
|
||||
this.$store.commit("methode/update_code", sta.Nat_MethodeCode)
|
||||
this.$store.commit("methode/update_priority", sta.Nat_MethodePriority)
|
||||
this.$store.commit("methode/update_code_exist",'N')
|
||||
this.$store.commit("methode/update_act", 'edit')
|
||||
} else {
|
||||
this.$store.commit("methode/update_open_alert_confirmation", true)
|
||||
}
|
||||
|
||||
},
|
||||
closeAlertConfirmation() {
|
||||
this.$store.commit("methode/update_open_alert_confirmation", false)
|
||||
},
|
||||
forgetAlertConfirmation() {
|
||||
this.$store.commit("methode/update_no_save", 0)
|
||||
this.$store.commit("methode/update_open_alert_confirmation", false)
|
||||
},
|
||||
updateAlert_success(val) {
|
||||
this.$store.commit("methode/update_alert_success", val)
|
||||
},
|
||||
setNewMethode() {
|
||||
this.$store.commit("methode/update_selected_methode", {})
|
||||
this.$store.commit("methode/update_methode_name", '')
|
||||
this.$store.commit("methode/update_methode_nameresult", '')
|
||||
this.$store.commit("methode/update_priority", '')
|
||||
this.$store.commit("methode/update_code", '')
|
||||
this.$store.commit("methode/update_code_exist",'N')
|
||||
this.$store.commit("methode/update_act", 'new')
|
||||
},
|
||||
closeDialogSuccess() {
|
||||
let arrmethode = this.$store.state.methode.methodes
|
||||
var idx = _.findIndex(arrmethode, item => item.Nat_MethodeID === this.$store.state.methode.last_id)
|
||||
console.log(idx)
|
||||
this.$store.dispatch("methode/search", {
|
||||
name: this.name,
|
||||
scode: this.scode,
|
||||
lastid: idx
|
||||
})
|
||||
this.$store.commit("methode/update_dialog_success", false)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialogsuccess: {
|
||||
get() {
|
||||
return this.$store.state.methode.dialog_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_dialog_success", val)
|
||||
}
|
||||
},
|
||||
msgsuccess() {
|
||||
return this.$store.state.methode.msg_success
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.methode.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_alert_success", val)
|
||||
}
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.methode.search_status == 1
|
||||
},
|
||||
xstatuses() {
|
||||
return this.$store.state.methode.statuses
|
||||
},
|
||||
xselectedstatus: {
|
||||
get() {
|
||||
return this.$store.state.methode.selected_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_selected_status", val)
|
||||
}
|
||||
},
|
||||
methodes() {
|
||||
return this.$store.state.methode.methodes
|
||||
},
|
||||
openalertconfirmation: {
|
||||
get() {
|
||||
return this.$store.state.methode.open_alert_confirmation
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("methode/update_open_alert_confirmation", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
msgalertconfirmation: "Perubahan yang telah dilakukan belum disimpan dong !",
|
||||
items: [],
|
||||
name: '',
|
||||
scode: '',
|
||||
page: 1,
|
||||
headers: [{
|
||||
text: "KODE",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "10%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "40%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA TERCETAK DI HASIL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "40%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "PRIORITAS",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "10%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
}
|
||||
],
|
||||
pagination: {
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 25,
|
||||
sortBy: 'Nat_MethodeCode.toString()',
|
||||
totalItems: this.$store.state.methode.total_methodes
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
94
one-ui/masterdata/one-md-nat-methode/index.php
Normal file
94
one-ui/masterdata/one-md-nat-methode/index.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<!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/icomoon-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 style="background:#F5E8DF!important" >
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap >
|
||||
<v-flex xs6 class="left" fill-height pa-1>
|
||||
<one-md-methode-list></one-md-methode-list>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="right" fill-height pa-1>
|
||||
<one-md-methode-detail></one-md-methode-detail>
|
||||
<!-- <one-md-methode-address></one-md-methode-address> -->
|
||||
</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">
|
||||
window.calculate_age = function (inp_dob) {
|
||||
var now = moment(new Date())
|
||||
var dob = moment(new Date(inp_dob))
|
||||
var year = now.diff(dob,'years')
|
||||
dob.add(year,'years')
|
||||
var month = now.diff(dob,'months')
|
||||
dob.add(month,'months')
|
||||
var day = now.diff(dob,'days')
|
||||
if (isNaN(year)) return ''
|
||||
return `${year} tahun ${month} bulan ${day} hari`
|
||||
}
|
||||
|
||||
|
||||
import { store } from './store.js<?php echo $ts ?>';
|
||||
//for methodeing
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
methods: {
|
||||
tab_selected : function(tab) {
|
||||
return this.$store.state.tab_selected == tab
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponentNoMenu.vue'),
|
||||
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
|
||||
'one-md-methode-list': httpVueLoader('./components/oneMdMethodeList.vue'),
|
||||
'one-md-methode-detail': httpVueLoader('./components/oneMdMethodeDetail.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
284
one-ui/masterdata/one-md-nat-methode/modules/methode.js
Normal file
284
one-ui/masterdata/one-md-nat-methode/modules/methode.js
Normal file
@@ -0,0 +1,284 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/methode.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id: -1,
|
||||
last_saved_id: -1,
|
||||
x_addr_id: 0,
|
||||
act: 'new',
|
||||
act_addr: 'new',
|
||||
get_data_status: 0,
|
||||
search_methode: 0,
|
||||
search_error_message: '',
|
||||
dob: '',
|
||||
code: '',
|
||||
methode_name: '',
|
||||
methode_nameresult: '',
|
||||
priority: 0,
|
||||
methodes: [],
|
||||
total_methodes: 0,
|
||||
total_methode: 0,
|
||||
selected_methode: {},
|
||||
save_status: 0,
|
||||
btn_save_seen: true,
|
||||
pgrs_save: false,
|
||||
save_error_message: '',
|
||||
no_save: 0,
|
||||
open_alert_confirmation: false,
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
dialog_success: false,
|
||||
dialog_confirmation_delete: false,
|
||||
msg_confirmation_delete: "",
|
||||
dialog_confirmation_delete_addr: false,
|
||||
msg_confirmation_delete_addr: "",
|
||||
autocomplete_status: 0,
|
||||
dialog_form_address: false,
|
||||
errors: [],
|
||||
code_exist:'N'
|
||||
},
|
||||
mutations: {
|
||||
update_x_addr_id(state, val) {
|
||||
state.x_addr_id = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
update_last_saved_id(state, val) {
|
||||
state.last_saved_id = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_act_addr(state, val) {
|
||||
state.act_addr = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_search_error_message(state, patient) {
|
||||
state.search_error_message = patient
|
||||
},
|
||||
update_search_methode(state, methode) {
|
||||
state.search_methode = methode
|
||||
},
|
||||
update_code(state, val) {
|
||||
state.code = val
|
||||
},
|
||||
update_methode_name(state, val) {
|
||||
state.methode_name = val
|
||||
},
|
||||
update_methode_nameresult(state, val) {
|
||||
state.methode_nameresult = val
|
||||
},
|
||||
update_priority(state, val) {
|
||||
state.priority = val
|
||||
},
|
||||
update_methodes(state, data) {
|
||||
state.methodes = data
|
||||
},
|
||||
update_selected_methode(state, val) {
|
||||
state.selected_methode = val
|
||||
},
|
||||
|
||||
update_startdate(state, val) {
|
||||
state.startdate = val
|
||||
},
|
||||
update_enddate(state, val) {
|
||||
state.enddate = val
|
||||
},
|
||||
update_btn_save_seen(state, val) {
|
||||
state.btn_save_seen = val
|
||||
},
|
||||
update_pgrs_save(state, val) {
|
||||
state.pgrs_save = val
|
||||
},
|
||||
update_save_error_message(state, msg) {
|
||||
state.save_error_message = ''
|
||||
},
|
||||
update_no_save(state, val) {
|
||||
state.no_save = val
|
||||
},
|
||||
update_open_alert_confirmation(state, val) {
|
||||
state.open_alert_confirmation = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_dialog_success(state, val) {
|
||||
state.dialog_success = val
|
||||
},
|
||||
update_dialog_confirmation_delete(state, val) {
|
||||
state.dialog_confirmation_delete = val
|
||||
},
|
||||
update_msg_confirmation_delete(state, val) {
|
||||
state.msg_confirmation_delete = val
|
||||
},
|
||||
update_dialog_confirmation_delete_addr(state, val) {
|
||||
state.dialog_confirmation_delete_addr = val
|
||||
},
|
||||
update_msg_confirmation_delete_addr(state, val) {
|
||||
state.msg_confirmation_delete_addr = val
|
||||
},
|
||||
update_addresses(state, val) {
|
||||
state.addresses = val
|
||||
},
|
||||
update_autocomplete_status(state, val) {
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_dialog_form_address(state, val) {
|
||||
state.dialog_form_address = val
|
||||
},
|
||||
update_label_address(state, val) {
|
||||
state.label_address = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_total_methodes(state, val) {
|
||||
state.total_methodes = val
|
||||
},
|
||||
update_selected_status(state, val) {
|
||||
state.selected_status = val
|
||||
},
|
||||
update_code_exist(state, val) {
|
||||
state.code_exist = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_methode", 1)
|
||||
try {
|
||||
let resp = await api.search(one_token(), prm.name, prm.scode)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_methode", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_methode", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_methodes", data.records)
|
||||
context.commit("update_total_methodes", data.total)
|
||||
context.commit("update_no_save", 0)
|
||||
context.commit("update_act",'edit')
|
||||
if (prm.lastid === -1) {
|
||||
context.commit("update_selected_methode", data.records[0])
|
||||
var sta = data.records[0]
|
||||
context.commit("update_methode_name", sta.Nat_MethodeName)
|
||||
context.commit("update_methode_nameresult", sta.Nat_MethodeNameInResult)
|
||||
context.commit("update_code", sta.Nat_MethodeCode)
|
||||
context.commit("update_priority", sta.Nat_MethodePriority)
|
||||
} else {
|
||||
context.commit("update_selected_methode", data.records[prm.lastid])
|
||||
var sta = data.records[prm.lastid]
|
||||
context.commit("update_methode_name", sta.Nat_MethodeName)
|
||||
context.commit("update_methode_nameresult", sta.Nat_MethodeNameInResult)
|
||||
context.commit("update_code", sta.Nat_MethodeCode)
|
||||
context.commit("update_priority", sta.Nat_MethodePriority)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_methode", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
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)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_last_id", prm.Nat_MethodeID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data metode " + prm.Nat_MethodeName + " sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async newmethode(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.newmethode(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
console.log(resp.data.id)
|
||||
context.commit("update_last_id", resp.data.id)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data metode " + prm.Nat_MethodeName + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.xdelete(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_last_id", 0)
|
||||
context.commit("update_dialog_confirmation_delete", false)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data metode " + prm.Nat_MethodeName + " sudah dihapus dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_methode_name", '')
|
||||
context.commit("update_methode_nameresult", '')
|
||||
context.commit("update_priority", '')
|
||||
context.commit("update_code", '')
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async checkcodeexist(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.checkcodeexist(prm)
|
||||
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_code_exist",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
27
one-ui/masterdata/one-md-nat-methode/store.js
Normal file
27
one-ui/masterdata/one-md-nat-methode/store.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import methode from "./modules/methode.js";
|
||||
import system from "../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
methode: methode,
|
||||
system: system
|
||||
},
|
||||
state: {
|
||||
tab_selected: 'methode'
|
||||
},
|
||||
mutations: {
|
||||
change_tab(state, ntab) {
|
||||
state.tab_selected = ntab
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
change_tab(context, ntab) {
|
||||
context.commit('change_tab', ntab)
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user