Flatten nested repos
This commit is contained in:
24
test/vuex/one-process-ref-out/api/company.js
Normal file
24
test/vuex/one-process-ref-out/api/company.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const URL = "/one-api/mockup/refout/refout/";
|
||||
|
||||
export async function search(search, is_internal, page) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refout/search_company', {
|
||||
search: search,
|
||||
page: page,
|
||||
is_internal: is_internal
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
47
test/vuex/one-process-ref-out/api/patient.js
Normal file
47
test/vuex/one-process-ref-out/api/patient.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const URL = "/one-api/mockup/refout/refout/";
|
||||
|
||||
export async function search(search, company_id, is_internal, page) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refout/search', {
|
||||
search: search,
|
||||
company_id: company_id,
|
||||
is_internal: is_internal,
|
||||
page: 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 send(token, ids) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refout/send', {
|
||||
token: token,
|
||||
ids: ids
|
||||
});
|
||||
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,280 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
|
||||
<v-card class="mb-2 pa-2 searchbox">
|
||||
<v-layout >
|
||||
<v-flex xs7 pa-1>
|
||||
<v-select
|
||||
:items="types"
|
||||
v-model="is_internal"
|
||||
item-text="text"
|
||||
item-value="val"
|
||||
|
||||
hide-details
|
||||
outline
|
||||
></v-select>
|
||||
</v-flex>
|
||||
<v-flex xs5>
|
||||
<v-text-field class="ma-1"
|
||||
label=""
|
||||
placeholder="Pencarian"
|
||||
single-line
|
||||
outline
|
||||
v-model="query"
|
||||
hide-details
|
||||
:height="height"
|
||||
@keyup.native="searchUp"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
|
||||
|
||||
|
||||
<!-- <v-flex pt-1 pb-1 pl-2 pr-1 xs4>
|
||||
<v-autocomplete
|
||||
label="Perusahaan"
|
||||
v-model="selected_company"
|
||||
:items="companies"
|
||||
:search-input.sync="query_company"
|
||||
|
||||
auto-select-first
|
||||
no-filter
|
||||
return-object
|
||||
clearable
|
||||
item-text="M_CompanyName"
|
||||
:loading="is_loading"
|
||||
no-data-text="Pilih Company"
|
||||
hide-details
|
||||
outline
|
||||
:height="height"
|
||||
>
|
||||
<template
|
||||
slot="item"
|
||||
slot-scope="{ item }"
|
||||
>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.M_CompanyName"></v-list-tile-title>
|
||||
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
|
||||
</v-autocomplete>
|
||||
</v-flex> -->
|
||||
|
||||
<v-btn class="xs3 ma-1 one-btn-icon" color="success" @click="search">
|
||||
<span class="icon-search"></span>
|
||||
</v-btn>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card >
|
||||
<v-layout row>
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="companies"
|
||||
: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.company_name }}</td>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
</v-data-table>
|
||||
<v-pagination
|
||||
v-model="curr_company_page"
|
||||
:length="total_company_page"
|
||||
:total-visible="5"
|
||||
@input="change_page"
|
||||
></v-pagination>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* .searchbox .v-input.v-text-field .v-input__slot{
|
||||
min-height:50px;
|
||||
} */
|
||||
/* .v-autocomplete.v-text-field--enclosed:not(.v-text-field--solo):not(.v-text-field--single-line) .v-select__slot>input {
|
||||
margin-top: 14px;
|
||||
} */
|
||||
.searchbox .v-btn {
|
||||
min-height:50px;
|
||||
}
|
||||
table.v-table tbody td,table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.searchbox .one-btn-icon {
|
||||
font-size: 1.5em
|
||||
}
|
||||
|
||||
/* Overwrite */
|
||||
.v-text-field--box>.v-input__control>.v-input__slot,
|
||||
.v-text-field--full-width>.v-input__control>.v-input__slot,
|
||||
.v-text-field--outline>.v-input__control>.v-input__slot {
|
||||
align-items: stretch;
|
||||
min-height: 50px
|
||||
}
|
||||
|
||||
.v-text-field--box .v-label, .v-text-field--full-width .v-label, .v-text-field--outline .v-label {
|
||||
top: 12px;
|
||||
}
|
||||
|
||||
.v-text-field.v-text-field--enclosed .v-input__append-inner {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.v-text-field--outline.v-text-field--single-line input {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.v-select.v-text-field--enclosed:not(.v-text-field--single-line) .v-select__selections {
|
||||
padding-top: 6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components : {
|
||||
'one-dialog-confirm': httpVueLoader('../../common/oneDialogConfirm.vue')
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$store.dispatch('company/search')
|
||||
},
|
||||
|
||||
methods : {
|
||||
isSelected(p) {
|
||||
let x = this.$store.state.company.selected_company
|
||||
if (!x)
|
||||
return false
|
||||
|
||||
if (x.company_id == p.company_id)
|
||||
return true
|
||||
|
||||
return false
|
||||
},
|
||||
|
||||
search() {
|
||||
this.$store.dispatch("company/search")
|
||||
},
|
||||
|
||||
searchUp(e) {
|
||||
if (e.which == 13) {
|
||||
this.search()
|
||||
}
|
||||
},
|
||||
|
||||
selectMe(doc) {
|
||||
this.$store.commit('company/update_selected_company', doc)
|
||||
|
||||
// SELECTED ORDER = []
|
||||
this.$store.commit('patient/update_selected_order', [])
|
||||
this.$store.dispatch('patient/search')
|
||||
},
|
||||
|
||||
one_money (x) {
|
||||
return window.one_money(x)
|
||||
},
|
||||
|
||||
change_page(x) {
|
||||
this.curr_company_page = x
|
||||
this.$store.dispatch('company/search')
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
||||
query : {
|
||||
get () {
|
||||
return this.$store.state.company.query
|
||||
},
|
||||
set (v) {
|
||||
this.$store.commit('company/update_query', v)
|
||||
}
|
||||
},
|
||||
|
||||
companies : {
|
||||
get () {
|
||||
return this.$store.state.company.companies
|
||||
},
|
||||
set (v) {
|
||||
this.$store.commit('testref/update_companies', v)
|
||||
}
|
||||
},
|
||||
|
||||
selected_company() {
|
||||
return this.$store.state.company.selected_company
|
||||
},
|
||||
|
||||
isLoading () {
|
||||
return false
|
||||
},
|
||||
|
||||
is_loading () {
|
||||
return false
|
||||
},
|
||||
|
||||
dialog_confirm () {
|
||||
return this.$store.state.dialog_confirm
|
||||
},
|
||||
|
||||
total_company_page () {
|
||||
return this.$store.state.company.total_company_page
|
||||
},
|
||||
|
||||
curr_company_page : {
|
||||
get () { return this.$store.state.company.curr_company_page },
|
||||
set (v) { this.$store.commit('company/update_curr_company_page', v) }
|
||||
},
|
||||
|
||||
is_internal : {
|
||||
get() { return this.$store.state.company.is_internal },
|
||||
set(v) { this.$store.commit('company/update_is_internal', v); this.search() }
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "NAMA COMPANY / CABANG",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "100%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
}
|
||||
],
|
||||
|
||||
pagination:{
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 5,
|
||||
sortBy: 'company_name',
|
||||
totalItems: this.$store.state.company.total_company
|
||||
},
|
||||
|
||||
height: 50,
|
||||
types: [
|
||||
{val:'N', text:'Rujuk Eksternal'},
|
||||
{val:'Y', text:'Rujuk Internal'}
|
||||
]
|
||||
};
|
||||
},
|
||||
|
||||
watch : {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,299 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
|
||||
<v-card class="mb-2 pa-2 searchbox">
|
||||
<v-layout >
|
||||
<v-flex xs6>
|
||||
<v-text-field class="ma-1"
|
||||
label=""
|
||||
placeholder="Pencarian"
|
||||
single-line
|
||||
outline
|
||||
v-model="query"
|
||||
hide-details
|
||||
:height="height"
|
||||
@keyup.native="searchUp"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
|
||||
<v-btn class="xs3 ma-1 one-btn-icon" color="success" @click="search">
|
||||
<span class="icon-search"></span>
|
||||
</v-btn>
|
||||
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="primary" :disabled="selected_order.length < 1" :dark="selected_order.length > 0" class=" one-btn-icon" @click="sendSome">
|
||||
<v-icon>send</v-icon>
|
||||
</v-btn>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card >
|
||||
<v-layout row>
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="patients"
|
||||
:loading="isLoading"
|
||||
hide-actions
|
||||
select-all
|
||||
item-key="T_OrderRefOutID"
|
||||
class="elevation-1"
|
||||
v-model="selected_order">
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-center pl-4 pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
||||
<v-checkbox v-model="props.selected" hide-details primary></v-checkbox>
|
||||
</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_OrderHeaderLabNumber }}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.patient_name }}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_SampleTypeName }}</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 pr-1 pl-1 pa-0" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
||||
<v-btn color="blue" small dark class="ma-0" @click="sendMe(props.item)">Kirim</v-btn>
|
||||
</td> -->
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
</v-data-table>
|
||||
<v-pagination
|
||||
v-model="curr_patient_page"
|
||||
:length="total_patient_page"
|
||||
:total-visible="5"
|
||||
@input="change_page"
|
||||
></v-pagination>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
|
||||
<v-snackbar
|
||||
v-model="snackbar"
|
||||
top
|
||||
>
|
||||
Order berhasil dikirim
|
||||
<v-btn flat color="red" @click.native="snackbar = false">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
table tr th:first-child {
|
||||
background-color: #90caf9!important;
|
||||
border-color: #90caf9!important;
|
||||
}
|
||||
/* .searchbox .v-input.v-text-field .v-input__slot{
|
||||
min-height:50px;
|
||||
} */
|
||||
/* .v-autocomplete.v-text-field--enclosed:not(.v-text-field--solo):not(.v-text-field--single-line) .v-select__slot>input {
|
||||
margin-top: 14px;
|
||||
} */
|
||||
.searchbox .v-btn {
|
||||
min-height:50px;
|
||||
}
|
||||
table.v-table tbody td,table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.searchbox .one-btn-icon {
|
||||
font-size: 1.5em
|
||||
}
|
||||
|
||||
/* Overwrite */
|
||||
.v-text-field--box>.v-input__control>.v-input__slot,
|
||||
.v-text-field--full-width>.v-input__control>.v-input__slot,
|
||||
.v-text-field--outline>.v-input__control>.v-input__slot {
|
||||
align-items: stretch;
|
||||
min-height: 50px
|
||||
}
|
||||
|
||||
.v-text-field--box .v-label, .v-text-field--full-width .v-label, .v-text-field--outline .v-label {
|
||||
top: 12px;
|
||||
}
|
||||
|
||||
.v-text-field.v-text-field--enclosed .v-input__append-inner {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.v-text-field--outline.v-text-field--single-line input {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.v-select.v-text-field--enclosed:not(.v-text-field--single-line) .v-select__selections {
|
||||
padding-top: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components : {
|
||||
// 'one-dialog-confirm': httpVueLoader('../../common/oneDialogConfirm.vue')
|
||||
},
|
||||
|
||||
mounted() {
|
||||
|
||||
// this.$store.dispatch('patient/search')
|
||||
},
|
||||
|
||||
methods : {
|
||||
isSelected(p) {
|
||||
let x = this.$store.state.patient.selected_patient
|
||||
if (!x)
|
||||
return false
|
||||
|
||||
// if (x.patient_id == p.patient_id)
|
||||
// return true
|
||||
|
||||
return false
|
||||
},
|
||||
|
||||
search() {
|
||||
this.$store.dispatch("patient/search")
|
||||
},
|
||||
|
||||
searchUp(e) {
|
||||
if (e.which == 13) {
|
||||
this.search()
|
||||
}
|
||||
},
|
||||
|
||||
selectMe(doc) {
|
||||
this.$store.commit('patient/update_selected_patient', doc)
|
||||
// this.$store.dispatch('patient/search')
|
||||
},
|
||||
|
||||
one_money (x) {
|
||||
return window.one_money(x)
|
||||
},
|
||||
|
||||
change_page(x) {
|
||||
this.curr_patient_page = x
|
||||
this.$store.dispatch('patient/search')
|
||||
},
|
||||
|
||||
sendMe (doc) {
|
||||
this.$store.dispatch("patient/send", doc.T_OrderRefOutID)
|
||||
},
|
||||
|
||||
sendSome (doc) {
|
||||
if (this.selected_order.length < 1) {
|
||||
alert('Tidak ada yang perlu di kirim')
|
||||
return
|
||||
}
|
||||
|
||||
let x = []
|
||||
for (let i in this.selected_order)
|
||||
x.push(this.selected_order[i].T_OrderRefOutID)
|
||||
|
||||
this.$store.dispatch("patient/send", x.join(","))
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
||||
query : {
|
||||
get () {
|
||||
return this.$store.state.patient.query
|
||||
},
|
||||
set (v) {
|
||||
this.$store.commit('patient/update_query', v)
|
||||
}
|
||||
},
|
||||
|
||||
patients () {
|
||||
|
||||
return this.$store.state.patient.patients
|
||||
|
||||
},
|
||||
|
||||
selected_patient() {
|
||||
return this.$store.state.patient.selected_patient
|
||||
},
|
||||
|
||||
isLoading () {
|
||||
return false
|
||||
},
|
||||
|
||||
is_loading () {
|
||||
return false
|
||||
},
|
||||
|
||||
total_patient_page () {
|
||||
return this.$store.state.patient.total_patient_page
|
||||
},
|
||||
|
||||
curr_patient_page : {
|
||||
get () { return this.$store.state.patient.curr_patient_page },
|
||||
set (v) { this.$store.commit('patient/update_curr_patient_page', v) }
|
||||
},
|
||||
|
||||
snackbar : {
|
||||
get () { return this.$store.state.patient.snackbar },
|
||||
set (v) { this.$store.commit('patient/update_snackbar', v) }
|
||||
},
|
||||
|
||||
selected_order : {
|
||||
get () { return this.$store.state.patient.selected_order },
|
||||
set (v) { this.$store.commit('patient/update_selected_order', v) }
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "LAB NUMBER",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "13%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "22%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "SPECIMEN",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "20%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "PEMERIKSAAN",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "40%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
}
|
||||
],
|
||||
|
||||
pagination:{
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 5,
|
||||
sortBy: 'patient_name',
|
||||
totalItems: this.$store.state.patient.total_patient
|
||||
},
|
||||
|
||||
height: 50
|
||||
};
|
||||
},
|
||||
|
||||
watch : {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
81
test/vuex/one-process-ref-out/index.php
Normal file
81
test/vuex/one-process-ref-out/index.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<!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 style="background:#F5E8DF!important" >
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap >
|
||||
<v-flex xs4 class="left" fill-height pa-1>
|
||||
<one-process-ref-out-company-list></one-process-ref-out-company-list>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs8 pa-1>
|
||||
<one-process-ref-out-patient-list></one-process-ref-out-patient-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',
|
||||
methods: {
|
||||
tab_selected : function(tab) {
|
||||
return this.$store.state.tab_selected == tab
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-process-ref-out-company-list': httpVueLoader('./components/oneProcessRefOutCompanyList.vue'),
|
||||
'one-process-ref-out-patient-list': httpVueLoader('./components/oneProcessRefOutPatientList.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
86
test/vuex/one-process-ref-out/modules/company.js
Normal file
86
test/vuex/one-process-ref-out/modules/company.js
Normal file
@@ -0,0 +1,86 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/company.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
|
||||
query: '',
|
||||
companies: [],
|
||||
selected_company: {},
|
||||
total_company: 0,
|
||||
total_company_page: 0,
|
||||
curr_company_page: 1,
|
||||
|
||||
is_internal: "N"
|
||||
},
|
||||
mutations: {
|
||||
|
||||
update_search_error_message(state, patient) {
|
||||
state.search_error_message = patient
|
||||
},
|
||||
|
||||
update_search_status(state, v) {
|
||||
state.search_status = v
|
||||
},
|
||||
|
||||
update_query(state, q) {
|
||||
state.query = q
|
||||
},
|
||||
|
||||
update_companies(state, d) {
|
||||
state.companies = d.records
|
||||
state.total_company = d.total
|
||||
state.total_company_page = d.total_page
|
||||
},
|
||||
|
||||
update_selected_company(state, d) {
|
||||
state.selected_company = d
|
||||
},
|
||||
|
||||
update_curr_company_page(state, d) {
|
||||
state.curr_company_page = d
|
||||
},
|
||||
|
||||
update_is_internal(state, d) {
|
||||
state.is_internal = d
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
|
||||
try {
|
||||
let resp = await api.search(context.state.query, context.state.is_internal, context.state.curr_company_page)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
|
||||
context.commit('patient/update_patients', {records:[],total:0,total_page:0}, {root:true})
|
||||
context.commit('patient/update_curr_patient_page', 1, {root:true})
|
||||
try {
|
||||
context.commit('update_selected_company', data.records[0])
|
||||
context.commit('patient/update_selected_order', [], {root:true})
|
||||
context.dispatch('patient/search', null, {root:true})
|
||||
} catch(ee) {}
|
||||
context.commit("update_companies", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
111
test/vuex/one-process-ref-out/modules/patient.js
Normal file
111
test/vuex/one-process-ref-out/modules/patient.js
Normal file
@@ -0,0 +1,111 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/patient.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
|
||||
query: '',
|
||||
patients: [],
|
||||
selected_patient: {},
|
||||
total_patient: 0,
|
||||
total_patient_page: 0,
|
||||
curr_patient_page: 1,
|
||||
|
||||
is_internal: "N",
|
||||
snackbar: false,
|
||||
selected_order: []
|
||||
},
|
||||
mutations: {
|
||||
|
||||
update_search_error_message(state, patient) {
|
||||
state.search_error_message = patient
|
||||
},
|
||||
|
||||
update_search_status(state, v) {
|
||||
state.search_status = v
|
||||
},
|
||||
|
||||
update_query(state, q) {
|
||||
state.query = q
|
||||
},
|
||||
|
||||
update_patients(state, d) {
|
||||
state.patients = d.records
|
||||
state.total_patient = d.total
|
||||
state.total_patient_page = d.total_page
|
||||
},
|
||||
|
||||
update_selected_patient(state, d) {
|
||||
state.selected_patient = d
|
||||
},
|
||||
|
||||
update_curr_patient_page(state, d) {
|
||||
state.curr_patient_page = d
|
||||
},
|
||||
|
||||
update_is_internal(state, d) {
|
||||
state.is_internal = d
|
||||
},
|
||||
|
||||
update_snackbar(state, d) {
|
||||
state.snackbar = d
|
||||
},
|
||||
|
||||
update_selected_order(state, d) {
|
||||
state.selected_order = d
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
|
||||
try {
|
||||
let resp = await api.search(context.state.query, context.rootState.company.selected_company.company_id, context.rootState.company.is_internal, context.state.curr_patient_page)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
|
||||
|
||||
context.commit("update_patients", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async send(context, ids) {
|
||||
|
||||
try {
|
||||
let resp = await api.send(one_token(), ids)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
context.commit('update_snackbar', true)
|
||||
context.commit('update_selected_order', [])
|
||||
context.dispatch("search")
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
test/vuex/one-process-ref-out/store.js
Normal file
28
test/vuex/one-process-ref-out/store.js
Normal file
@@ -0,0 +1,28 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import company from "./modules/company.js";
|
||||
import patient from "./modules/patient.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
company: company,
|
||||
patient: patient,
|
||||
system: system
|
||||
},
|
||||
|
||||
state: {
|
||||
dialog_confirm: false
|
||||
},
|
||||
|
||||
mutations: {
|
||||
update_dialog_confirm(state, v) {
|
||||
state.dialog_confirm = v
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user