Files
REG_IBL/one-ui/masterdata/one-md-auto-verification-v2/components/mdAutoVerificationDeltaCheck.vue
2026-05-25 20:01:37 +07:00

289 lines
9.7 KiB
Vue

<template>
<v-layout v-if="xisdelta === 'Y'">
<v-flex xs12>
<v-card class="mb-2" color="white" style="min-height:90px">
<v-toolbar class="mb-1" color="blue lighten-3" dark height="50px">
<v-toolbar-title>DELTA CHECK : {{xautoverificationlists.name}}</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-form ref="formdeltacheck" v-model="valid" lazy-validation>
<v-layout>
<v-flex xs18 pa-1>
<v-layout row>
<v-flex xs6 pa-1>
<v-select item-text="Nat_DeltaTypeName" return-object :items="xdifs" v-model="xdif" label="Difference*" :rules="xdifRules" required></v-select>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="dc_validinterval" label="Valid Interval*" :rules="dc_validintervalRules" required></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-select item-text="M_TimeName" return-object :items="xtimes" v-model="xtime" label="Rate Time Unit*" :rules="xtimeRules" required></v-select>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs6 pa-1>
<v-text-field v-model="dc_minvalue" label="Min Value*" :rules="dc_minvalueRules" required></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
<v-text-field v-model="dc_maxvalue" label="Max Value*" :rules="dc_maxvalueRules" required></v-text-field>
</v-flex>
<v-flex xs6 pa-1>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-form>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click="saveFormDeltaCheck()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-flex>
<template>
<v-dialog v-model="dialogalertnotest" 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>
Pilih pemeriksaan terlebih dahulu
</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="dialogalertnotest = false">
Tutup
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
</v-layout>
</template>
<style scoped>
</style>
<script>
module.exports = {
data: () => ({
color: "success",
validtest: false,
search: "",
valid: false,
dialogdeletealerttest: false,
dialogalertnotest: false,
xid: 0,
xdifRules: [
v => !!v || 'Difference harus dipilih'
],
xtimeRules: [
v => !!v || 'Rate time unit harus dipilih'
],
dc_maxvalueRules: [
v => !!v || 'Max Value harus diisi'
],
dc_minvalueRules: [
v => !!v || 'Min Value harus diisi'
],
dc_validintervalRules: [
v => !!v || 'Valid Interval harus diisi'
],
msgalerttest: ""
}),
mounted() {
this.$store.dispatch("deltacheck/selecttime")
this.$store.dispatch("deltacheck/selectdif")
},
computed: {
xisdelta() {
return this.$store.state.deltacheck.isdelta
},
vdeltachecks() {
return this.$store.state.deltacheck.deltachecks
},
dc_deltadifference: {
get() {
return this.$store.state.deltacheck.deltadifference
},
set(val) {
this.$store.commit("deltacheck/update_deltadifference", val)
}
},
dc_deltadifferencepercent: {
get() {
return this.$store.state.deltacheck.deltadifferencepercent
},
set(val) {
this.$store.commit("deltacheck/update_deltadifferencepercent", val)
}
},
dc_ratedifference: {
get() {
return this.$store.state.deltacheck.ratedifference
},
set(val) {
this.$store.commit("deltacheck/update_ratedifference", val)
}
},
dc_ratedifferencepercent: {
get() {
return this.$store.state.deltacheck.ratedifferencepercent
},
set(val) {
this.$store.commit("deltacheck/update_ratedifferencepercent", val)
}
},
dc_validinterval: {
get() {
return this.$store.state.deltacheck.validinterval
},
set(val) {
this.$store.commit("deltacheck/update_validinterval", val)
}
},
dc_minvalue: {
get() {
return this.$store.state.deltacheck.minvalue
},
set(val) {
this.$store.commit("deltacheck/update_minvalue", val)
}
},
dc_maxvalue: {
get() {
return this.$store.state.deltacheck.maxvalue
},
set(val) {
this.$store.commit("deltacheck/update_maxvalue", val)
}
},
dialogdeltacheck() {
return this.$store.state.deltacheck.dialog_form_delta_check
},
xselected_test: {
get() {
return this.$store.state.deltacheck.selected_test
},
set(val) {
this.$store.commit("deltacheck/update_selected_test", val)
}
},
xautoverificationlists() {
return this.$store.state.autoverificationlist.selected_autoverificationlist
},
xtests() {
return this.$store.state.deltacheck.tests
},
is_loading() {
return this.$store.state.deltacheck.search_status == 1
},
xtimes() {
return this.$store.state.deltacheck.times
},
xtime: {
get() {
return this.$store.state.deltacheck.time
},
set(val) {
this.$store.commit("deltacheck/update_time", val)
}
},
xdifs() {
return this.$store.state.deltacheck.difs
},
xdif: {
get() {
return this.$store.state.deltacheck.dif
},
set(val) {
this.$store.commit("deltacheck/update_dif", val)
}
}
},
methods: {
updateDialogFormScheduleTest() {
this.$store.commit("deltacheck/update_dialog_form_delta_check", false)
},
openFormScheduleTest() {
this.$store.commit("deltacheck/update_selected_test", {})
this.$refs.formdeltacheck.reset()
this.$refs.formdeltacheck.resetValidation()
this.$store.commit("deltacheck/update_dialog_form_delta_check", true)
},
saveFormDeltaCheck() {
var testid = this.$store.state.autoverificationlist.selected_autoverificationlist.id ? this.$store.state.autoverificationlist
.selected_autoverificationlist.id : 0
console.log(testid)
if (testid == 0) {
this.dialogalertnotest = true
} else {
if (this.$refs.formdeltacheck.validate()) {
this.$store.dispatch("deltacheck/save", {
Nat_DeltaCheckNat_TestID: this.$store.state.autoverificationlist.selected_autoverificationlist.id,
Nat_TestName: this.$store.state.autoverificationlist.selected_autoverificationlist.name,
Nat_DeltaCheckNat_DeltaTypeID: this.xdif.Nat_DeltaTypeID,
Nat_DeltaCheckInterval: this.dc_validinterval,
Nat_DeltaCheckM_TimeID: this.xtime.M_TimeID,
Nat_DeltaCheckMinValue: this.dc_minvalue,
Nat_DeltaCheckMaxValue: this.dc_maxvalue,
search: this.$store.state.autoverificationlist.xsearch
})
}
}
},
updateAlert_success(val) {
this.$store.commit("autoverificationlist/update_alert_success", val)
},
thr_search: _.debounce(function () {
this.$store.dispatch("deltacheck/search", {
id: this.$store.state.autoverificationlist.selected_autoverificationlist.id
})
}, 2000),
deleteTest(data) {
this.xid = data.id
console.log(this.xid)
this.$store.commit("deltacheck/update_selected_test", data)
this.msgalerttest = "Yakin, mau hapus pemeriksaan " + this.xselected_test.name + "dari autoverificationlist " +
this.xautoverificationlists.name + " ?"
this.dialogdeletealerttest = true
},
closeDeleteAlertTest() {
this.$store.dispatch("deltacheck/delete", {
xid: this.xid,
autoverificationlistid: this.$store.state.autoverificationlist.selected_autoverificationlist.id,
autoverificationlistname: this.$store.state.autoverificationlist.selected_autoverificationlist.name,
testname: this.xselected_test.name
})
this.dialogdeletealerttest = false
}
},
watch: {
search(val, old) {
console.log(val)
if (val !== "" && val !== old && val && val.length > 2) {
this.$store.commit("deltacheck/update_search", val)
this.thr_search()
}
}
}
}
</script>