toggle
This commit is contained in:
parent
de61513d9d
commit
370599e61c
2 changed files with 55 additions and 39 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, reactive } from "vue";
|
import { ref, onMounted, watch } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
|
|
@ -257,6 +257,14 @@ function filterSelector(val: string, update: Function) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** เช็คการเปลี่ยนแปลงของค่า isActive*/
|
||||||
|
watch(
|
||||||
|
() => isActive.value,
|
||||||
|
() => {
|
||||||
|
searchByStatus();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
/** เริ่มเมื่อโหลดหน้านี้*/
|
/** เริ่มเมื่อโหลดหน้านี้*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await Promise.all([fetchCommandType(), fetchCommandSys()]);
|
await Promise.all([fetchCommandType(), fetchCommandSys()]);
|
||||||
|
|
@ -285,20 +293,18 @@ onMounted(async () => {
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div> -->
|
</div> -->
|
||||||
<q-space />
|
<q-space />
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6 q-py-sm">
|
||||||
<q-select
|
<div class="row items-center no-wrap justify-end">
|
||||||
outlined
|
<q-badge
|
||||||
dense
|
outline
|
||||||
v-model="isActive"
|
:color="`${isActive ? `primary` : `orange`}`"
|
||||||
class="inputgreen"
|
:label="`${isActive ? `Active` : `InActive`}`"
|
||||||
label="สถานะการใช้งาน"
|
/>
|
||||||
:options="activeOptions"
|
<label :class="`q-ml-lg toggle-control`">
|
||||||
option-label="label"
|
<input type="checkbox" v-model="isActive" />
|
||||||
option-value="value"
|
<span class="control"></span>
|
||||||
emit-value
|
</label>
|
||||||
map-options
|
</div>
|
||||||
@update:model-value="searchByStatus"
|
|
||||||
></q-select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ const isActiveOption = ref<ActiveOptions[]>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const dataForm = reactive<ListTemplateSalary>({
|
const dataForm = reactive<ListTemplateSalary>({
|
||||||
id: '',
|
id: "",
|
||||||
name: "",
|
name: "",
|
||||||
isActive: false,
|
isActive: false,
|
||||||
});
|
});
|
||||||
|
|
@ -227,6 +227,7 @@ function updatePagination(newPagination: any) {
|
||||||
pagination.value.rowsPerPage = newPagination.rowsPerPage;
|
pagination.value.rowsPerPage = newPagination.rowsPerPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** เช็คการเปลี่ยนแปลงของค่า pagination.value.rowsPerPage*/
|
||||||
watch(
|
watch(
|
||||||
() => pagination.value.rowsPerPage,
|
() => pagination.value.rowsPerPage,
|
||||||
async () => {
|
async () => {
|
||||||
|
|
@ -234,6 +235,13 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** เช็คการเปลี่ยนแปลงของค่า isActive*/
|
||||||
|
watch(
|
||||||
|
() => isActive.value,
|
||||||
|
async () => {
|
||||||
|
await fetchSalaryList();
|
||||||
|
}
|
||||||
|
);
|
||||||
/** เริ่มเมื่อโหลดหน้านี้*/
|
/** เริ่มเมื่อโหลดหน้านี้*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getMainData();
|
getMainData();
|
||||||
|
|
@ -280,32 +288,33 @@ onMounted(() => {
|
||||||
<div v-if="activeOrderId !== ''">
|
<div v-if="activeOrderId !== ''">
|
||||||
<div class="row q-pa-sm q-col-gutter-sm">
|
<div class="row q-pa-sm q-col-gutter-sm">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="row q-gutter-sm">
|
<div class="row q-gutter-sm items-center">
|
||||||
<div class="col-3">
|
<div>
|
||||||
<q-select
|
<q-btn
|
||||||
outlined
|
flat
|
||||||
dense
|
dense
|
||||||
v-model="isActive"
|
round
|
||||||
class="inputgreen"
|
icon="add"
|
||||||
label="สถานะการใช้งาน"
|
color="add"
|
||||||
:options="isActiveOption"
|
@click="onDialogAdd"
|
||||||
option-label="label"
|
><q-tooltip>เพิ่มข้อมูล</q-tooltip>
|
||||||
option-value="value"
|
</q-btn>
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
@update:model-value="fetchSalaryList"
|
|
||||||
></q-select>
|
|
||||||
</div>
|
</div>
|
||||||
<q-btn
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
round
|
|
||||||
icon="add"
|
|
||||||
color="add"
|
|
||||||
@click="onDialogAdd"
|
|
||||||
><q-tooltip>เพิ่มข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
<q-space />
|
<q-space />
|
||||||
|
|
||||||
|
<div class="row items-center no-wrap">
|
||||||
|
<q-badge
|
||||||
|
outline
|
||||||
|
:color="`${isActive ? `primary` : `orange`}`"
|
||||||
|
:label="`${isActive ? `ใช้` : `ไม่ใช้`}งาน`"
|
||||||
|
/>
|
||||||
|
<label :class="`q-ml-lg toggle-control`">
|
||||||
|
<input type="checkbox" v-model="isActive" />
|
||||||
|
<span class="control"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
borderless
|
borderless
|
||||||
dense
|
dense
|
||||||
|
|
@ -336,6 +345,7 @@ onMounted(() => {
|
||||||
:options="columns"
|
:options="columns"
|
||||||
option-value="name"
|
option-value="name"
|
||||||
options-cover
|
options-cover
|
||||||
|
style="min-width: 150px"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue