แก้ไขการแสดงเครื่องหมาย " , " ในจำนวนเงิน

This commit is contained in:
AnandaTon 2023-09-04 17:46:16 +07:00
parent fc38afe05d
commit 1adbf574a6
3 changed files with 463 additions and 131 deletions

View file

@ -349,7 +349,15 @@
/> />
</div> </div>
<div class="col-xs-4 col-sm-4 col-md-4"> <div class="col-xs-4 col-sm-4 col-md-4">
<q-input <CurrencyInput
v-model="amount"
:edit="edit"
:options="{
currency: 'THB',
}"
:label="`${'เงินเดือน'}`"
/>
<!-- <q-input
:class="getClass(edit)" :class="getClass(edit)"
:outlined="edit" :outlined="edit"
dense dense
@ -362,7 +370,7 @@
@update:modelValue="clickEditRow" @update:modelValue="clickEditRow"
type="number" type="number"
hide-bottom-space hide-bottom-space
/> /> -->
</div> </div>
<div class="col-xs-4 col-sm-4 col-md-4"> <div class="col-xs-4 col-sm-4 col-md-4">
<q-input <q-input
@ -570,6 +578,7 @@ import HistoryTable from "@/components/TableHistory.vue";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import CurrencyInput from "@/components/CurruncyInput.vue";
const props = defineProps({ const props = defineProps({
statusEdit: { statusEdit: {

View file

@ -2,27 +2,55 @@
<template> <template>
<q-card flat bordered class="col-12 q-px-lg q-py-md"> <q-card flat bordered class="col-12 q-px-lg q-py-md">
<q-form ref="myForm"> <q-form ref="myForm">
<ProfileTable :rows="rows" :columns="columns" :filter="filter" :visible-columns="visibleColumns" <ProfileTable
v-model:inputfilter="filter" v-model:inputvisible="visibleColumns" :add="clickAdd" name="ตำแหน่ง/เงินเดือน" :rows="rows"
icon="mdi-cash" :statusEdit="statusEdit"> :columns="columns"
:filter="filter"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"
:add="clickAdd"
name="ตำแหน่ง/เงินเดือน"
icon="mdi-cash"
:statusEdit="statusEdit"
>
<template #columns="props"> <template #columns="props">
<q-tr :props="props"> <q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props" @click="selectData(props)" <q-td
class="cursor-pointer"> v-for="col in props.cols"
:key="col.name"
:props="props"
@click="selectData(props)"
class="cursor-pointer"
>
<div v-if="col.name == 'date'" class="table_ellipsis"> <div v-if="col.name == 'date'" class="table_ellipsis">
{{ date2Thai(col.value) }} {{ date2Thai(col.value) }}
</div> </div>
<div v-else-if="props.row.salaryStatus !== 'DEATH' && ( <div
col.name == 'positionSalaryAmount' || v-else-if="
col.name == 'mouthSalaryAmount' || props.row.salaryStatus !== 'DEATH' &&
col.name == 'amount') (col.name == 'positionSalaryAmount' ||
" class="table_ellipsis"> col.name == 'mouthSalaryAmount' ||
col.name == 'amount')
"
class="table_ellipsis"
>
{{ col.value == null ? "" : col.value.toLocaleString("en-US") }} {{ col.value == null ? "" : col.value.toLocaleString("en-US") }}
</div> </div>
<div v-else-if="props.row.salaryStatus === 'DEATH' && col.name == 'position'" class="table_ellipsis"> <div
v-else-if="
props.row.salaryStatus === 'DEATH' && col.name == 'position'
"
class="table_ellipsis"
>
งแกกรรม งแกกรรม
</div> </div>
<div v-else-if="props.row.salaryStatus === 'DEATH' && col.name !== 'salaryRef'" class="table_ellipsis"> <div
v-else-if="
props.row.salaryStatus === 'DEATH' && col.name !== 'salaryRef'
"
class="table_ellipsis"
>
- -
</div> </div>
<div v-else class="table_ellipsis"> <div v-else class="table_ellipsis">
@ -30,7 +58,15 @@
</div> </div>
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>
<q-btn color="info" flat dense round size="14px" icon="mdi-history" @click="clickHistory(props.row)" /> <q-btn
color="info"
flat
dense
round
size="14px"
icon="mdi-history"
@click="clickHistory(props.row)"
/>
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
@ -48,19 +84,46 @@
<div class="col-xs-12 col-sm-5 row"> <div class="col-xs-12 col-sm-5 row">
<q-card flat bordered class="fit q-pa-sm"> <q-card flat bordered class="fit q-pa-sm">
<q-scroll-area visible style="height: 70vh"> <q-scroll-area visible style="height: 70vh">
<q-input outlined dense v-model="search" placeholder="ค้นหา" class="q-mb-sm"> <q-input
outlined
dense
v-model="search"
placeholder="ค้นหา"
class="q-mb-sm"
>
<template v-slot:append> <template v-slot:append>
<q-icon name="mdi-magnify" /> <q-icon name="mdi-magnify" />
</template> </template>
</q-input> </q-input>
<q-tree v-if="edit" :nodes="nodesTree" dense node-key="id" v-model:selected="selected" <q-tree
v-model:expanded="expanded" no-selection-unset selected-color="primary" @update:selected="onSelected" v-if="edit"
default-expand-all /> :nodes="nodesTree"
<q-tree v-else :nodes="nodesTree" dense node-key="id" v-model:expanded="expanded" no-selection-unset dense
selected-color="primary" @update:selected="onSelected" default-expand-all> node-key="id"
v-model:selected="selected"
v-model:expanded="expanded"
no-selection-unset
selected-color="primary"
@update:selected="onSelected"
default-expand-all
/>
<q-tree
v-else
:nodes="nodesTree"
dense
node-key="id"
v-model:expanded="expanded"
no-selection-unset
selected-color="primary"
@update:selected="onSelected"
default-expand-all
>
<template v-slot:default-header="prop"> <template v-slot:default-header="prop">
<div class="row items-center"> <div class="row items-center">
<div class="text-primary" v-if="selected == prop.node.id"> <div
class="text-primary"
v-if="selected == prop.node.id"
>
{{ prop.node.label }} {{ prop.node.label }}
</div> </div>
<div v-else> <div v-else>
@ -78,24 +141,46 @@
<div class="row col-12 q-col-gutter-xs"> <div class="row col-12 q-col-gutter-xs">
<div class="col-xs-12 col-sm-12 col-md-12"></div> <div class="col-xs-12 col-sm-12 col-md-12"></div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<datepicker menu-class-name="modalfix" :readonly="!edit" v-model="date" :locale="'th'" autoApply <datepicker
:enableTimePicker="false" @update:modelValue="clickEditRow" week-start="0"> menu-class-name="modalfix"
:readonly="!edit"
v-model="date"
:locale="'th'"
autoApply
:enableTimePicker="false"
@update:modelValue="clickEditRow"
week-start="0"
>
<template #year="{ year }">{{ year + 543 }}</template> <template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{ <template #year-overlay-value="{ value }">{{
parseInt(value + 543) parseInt(value + 543)
}}</template> }}</template>
<template #trigger> <template #trigger>
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :borderless="!edit" <q-input
:model-value="date2Thai(date)" :rules="[ :class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(date)"
:rules="[
(val: string) => (val: string) =>
!!val || !!val ||
`${'กรุณาเลือกวัน เดือน ปี'}`, `${'กรุณาเลือกวัน เดือน ปี'}`,
]" :label="`${'วัน เดือน ปี'}`" hide-bottom-space> ]"
:label="`${'วัน เดือน ปี'}`"
hide-bottom-space
>
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" :style="edit <q-icon
? 'color: var(--q-primary)' name="event"
: 'color: var(--q-grey)' class="cursor-pointer"
"> :style="
edit
? 'color: var(--q-primary)'
: 'color: var(--q-grey)'
"
>
</q-icon> </q-icon>
</template> </template>
</q-input> </q-input>
@ -103,96 +188,274 @@
</datepicker> </datepicker>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<selector :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <selector
:borderless="!edit" v-model="posNoId" :rules="[ :class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="posNoId"
:rules="[
(val: string) => !!val || `${'กรุณาเลือกตำแหน่งเลขที่'}`, (val: string) => !!val || `${'กรุณาเลือกตำแหน่งเลขที่'}`,
]" :label="`${'ตำแหน่งเลขที่'}`" @update:modelValue="clickEditRow" emit-value map-options ]"
option-label="name" :options="posNoOptions" option-value="id" hide-bottom-space use-input :label="`${'ตำแหน่งเลขที่'}`"
input-debounce="0" @filter="(inputValue: any, @update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="posNoOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '1' doneFn: Function) => filterSelector(inputValue, doneFn, '1'
)" /> )"
/>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<selector :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <selector
:borderless="!edit" v-model="positionId" :class="getClass(edit)"
:rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่ง'}`]" :label="`${'ตำแหน่ง'}`" :outlined="edit"
@update:modelValue="clickEditRow" emit-value map-options option-label="name" dense
:options="positionOptions" option-value="id" hide-bottom-space use-input input-debounce="0" lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionId"
:rules="[(val: string) => !!val || `${'กรุณาเลือกตำแหน่ง'}`]"
:label="`${'ตำแหน่ง'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '2' doneFn: Function) => filterSelector(inputValue, doneFn, '2'
)" /> )"
/>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<!-- :rules="[(val:string) => !!val || `${'กรุณาเลือกด้าน/สาขา'}`]" --> <!-- :rules="[(val:string) => !!val || `${'กรุณาเลือกด้าน/สาขา'}`]" -->
<selector :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <selector
:borderless="!edit" v-model="positionPathSideId" :label="`${'ด้าน/สาขา'}`" :class="getClass(edit)"
@update:modelValue="clickEditRow" emit-value map-options option-label="name" :outlined="edit"
:options="positionSideOptions" option-value="id" hide-bottom-space use-input input-debounce="0" dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionPathSideId"
:label="`${'ด้าน/สาขา'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionSideOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '3' doneFn: Function) => filterSelector(inputValue, doneFn, '3'
)" /> )"
/>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<selector :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <selector
:borderless="!edit" v-model="positionTypeId" :rules="[ :class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionTypeId"
:rules="[
(val: string) => !!val || `${'กรุณาเลือกตำแหน่งประเภท'}`, (val: string) => !!val || `${'กรุณาเลือกตำแหน่งประเภท'}`,
]" :label="`${'ตำแหน่งประเภท'}`" @update:modelValue="clickEditRow" emit-value map-options ]"
option-label="name" :options="positionTypeOptions" option-value="id" hide-bottom-space use-input :label="`${'ตำแหน่งประเภท'}`"
input-debounce="0" @filter="(inputValue: any, @update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionTypeOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '4' doneFn: Function) => filterSelector(inputValue, doneFn, '4'
)" /> )"
/>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<selector :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <selector
:borderless="!edit" v-model="positionLineId" :class="getClass(edit)"
:rules="[(val: string) => !!val || `${'กรุณาเลือกสายงาน'}`]" :label="`${'สายงาน'}`" :outlined="edit"
@update:modelValue="clickEditRow" emit-value map-options option-label="name" dense
:options="positionLineOptions" option-value="id" hide-bottom-space use-input input-debounce="0" lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionLineId"
:rules="[(val: string) => !!val || `${'กรุณาเลือกสายงาน'}`]"
:label="`${'สายงาน'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionLineOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '5' doneFn: Function) => filterSelector(inputValue, doneFn, '5'
)" /> )"
/>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<selector :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <selector
:borderless="!edit" v-model="positionLevelId" :class="getClass(edit)"
:rules="[(val: string) => !!val || `${'กรุณาเลือกระดับ'}`]" :label="`${'ระดับ'}`" :outlined="edit"
@update:modelValue="clickEditRow" emit-value map-options option-label="name" dense
:options="positionLevelOptions" option-value="id" hide-bottom-space use-input input-debounce="0" lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionLevelId"
:rules="[(val: string) => !!val || `${'กรุณาเลือกระดับ'}`]"
:label="`${'ระดับ'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionLevelOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any, @filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '6' doneFn: Function) => filterSelector(inputValue, doneFn, '6'
)" /> )"
/>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<selector :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <selector
:borderless="!edit" v-model="positionExecutiveId" :label="`${'ตำแหน่งทางการบริหาร'}`" :class="getClass(edit)"
@update:modelValue="clickEditRow" emit-value map-options option-label="name" :outlined="edit"
:options="positionExecutiveOptions" option-value="id" hide-bottom-space use-input dense
input-debounce="0" @filter="(inputValue: any, lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionExecutiveId"
:label="`${'ตำแหน่งทางการบริหาร'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
option-label="name"
:options="positionExecutiveOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '7' doneFn: Function) => filterSelector(inputValue, doneFn, '7'
)" /> )"
/>
</div> </div>
<div class="col-xs-4 col-sm-4 col-md-4"> <div class="col-xs-4 col-sm-4 col-md-4">
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <!-- <q-input
:borderless="!edit" v-model="amount" :rules="[(val: string) => !!val || `${'กรุณากรอกเงินเดือน'}`]" :class="getClass(edit)"
:label="`${'เงินเดือน'}`" @update:modelValue="clickEditRow" type="number" hide-bottom-space /> :outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="amount"
:rules="[(val: string) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
:label="`${'เงินเดือน'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/> -->
<CurrencyInput
v-model="amount"
:edit="edit"
:options="{
currency: 'THB',
}"
:rules="[(val: string) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
:label="`${'เงินเดือน'}`"
/>
</div> </div>
<div class="col-xs-4 col-sm-4 col-md-4"> <div class="col-xs-4 col-sm-4 col-md-4">
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <CurrencyInput
:borderless="!edit" v-model="positionSalaryAmount" :label="`${'เงินประจำตำแหน่ง'}`" v-model="positionSalaryAmount"
@update:modelValue="clickEditRow" type="number" hide-bottom-space /> :edit="edit"
:options="{
currency: 'THB',
}"
:label="`${'เงินประจำตำแหน่ง'}`"
/>
<!-- <q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="positionSalaryAmount"
:label="`${'เงินประจำตำแหน่ง'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/> -->
</div> </div>
<div class="col-xs-4 col-sm-4 col-md-4"> <div class="col-xs-4 col-sm-4 col-md-4">
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <!-- <q-input
:borderless="!edit" v-model="mouthSalaryAmount" :label="`${'เงินค่าตอบแทนรายเดือน'}`" :class="getClass(edit)"
@update:modelValue="clickEditRow" type="number" hide-bottom-space /> :outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="mouthSalaryAmount"
:label="`${'เงินค่าตอบแทนรายเดือน'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/> -->
<CurrencyInput
v-model="mouthSalaryAmount"
:edit="edit"
:options="{
currency: 'THB',
}"
:label="`${'เงินค่าตอบแทนรายเดือน'}`"
/>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <q-input
:borderless="!edit" v-model="refCommandNo" hide-bottom-space :label="`${'เลขที่คำสั่ง'}`" :class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refCommandNo"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
:rules="[(val: string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`]" :rules="[(val: string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`]"
@update:modelValue="clickEditRow"> @update:modelValue="clickEditRow"
>
<template v-slot:append> <template v-slot:append>
<q-icon name="mdi-file" class="cursor-pointer" @click="resetFilter" /> <q-icon
name="mdi-file"
class="cursor-pointer"
@click="resetFilter"
/>
</template> </template>
</q-input> </q-input>
</div> </div>
@ -230,17 +493,41 @@
</div> --> </div> -->
<div class="row col-xs-12 col-sm-12 col-md-12"> <div class="row col-xs-12 col-sm-12 col-md-12">
<selector :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <selector
:borderless="!edit" v-model="refSelected" :label="`${'ต้นแบบ (template) เอกสารอ้างอิง'}`" :class="getClass(edit)"
@update:modelValue="clickEditRowRef" option-label="name" :options="refOptions" option-value="id" :outlined="edit"
hide-bottom-space use-input input-debounce="0" @filter="(inputValue: any, dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refSelected"
:label="`${'ต้นแบบ (template) เอกสารอ้างอิง'}`"
@update:modelValue="clickEditRowRef"
option-label="name"
:options="refOptions"
option-value="id"
hide-bottom-space
use-input
input-debounce="0"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, '8' doneFn: Function) => filterSelector(inputValue, doneFn, '8'
)" /> )"
/>
</div> </div>
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<q-input :class="getClass(edit)" :outlined="edit" dense lazy-rules :readonly="!edit" <q-input
:borderless="!edit" v-model="salaryRef" :label="`${'เอกสารอ้างอิง'}`" :class="getClass(edit)"
@update:modelValue="clickEditRow" type="textarea" hide-bottom-space /> :outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="salaryRef"
:label="`${'เอกสารอ้างอิง'}`"
@update:modelValue="clickEditRow"
type="textarea"
hide-bottom-space
/>
</div> </div>
</div> </div>
</q-scroll-area> </q-scroll-area>
@ -249,25 +536,49 @@
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<DialogFooter :cancel="clickCancel" :edit="clickEdit" :save="clickSave" :validate="validateData" <DialogFooter
:clickNext="clickNext" :clickPrevious="clickPrevious" :clickDelete="clickDelete" v-model:editvisible="edit" :cancel="clickCancel"
v-model:next="next" v-model:previous="previous" v-model:modalEdit="modalEdit" /> :edit="clickEdit"
:save="clickSave"
:validate="validateData"
:clickNext="clickNext"
:clickPrevious="clickPrevious"
:clickDelete="clickDelete"
v-model:editvisible="edit"
v-model:next="next"
v-model:previous="previous"
v-model:modalEdit="modalEdit"
/>
</q-form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
<HistoryTable :rows="rowsHistory" :columns="columnsHistory" :filter="filterHistory" <HistoryTable
:visible-columns="visibleColumnsHistory" v-model:modal="modalHistory" v-model:inputfilter="filterHistory" :rows="rowsHistory"
v-model:inputvisible="visibleColumnsHistory" v-model:tittle="tittleHistory"> :columns="columnsHistory"
:filter="filterHistory"
:visible-columns="visibleColumnsHistory"
v-model:modal="modalHistory"
v-model:inputfilter="filterHistory"
v-model:inputvisible="visibleColumnsHistory"
v-model:tittle="tittleHistory"
>
<template #columns="props"> <template #columns="props">
<q-tr :props="props"> <q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props"> <q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'date' || col.name == 'createdAt'" class="table_ellipsis"> <div
v-if="col.name == 'date' || col.name == 'createdAt'"
class="table_ellipsis"
>
{{ date2Thai(col.value) }} {{ date2Thai(col.value) }}
</div> </div>
<div v-else-if="col.name == 'positionSalaryAmount' || <div
col.name == 'mouthSalaryAmount' || v-else-if="
col.name == 'amount' col.name == 'positionSalaryAmount' ||
" class="table_ellipsis"> col.name == 'mouthSalaryAmount' ||
col.name == 'amount'
"
class="table_ellipsis"
>
{{ col.value == null ? "" : col.value.toLocaleString("en-US") }} {{ col.value == null ? "" : col.value.toLocaleString("en-US") }}
</div> </div>
<div v-else class="table_ellipsis"> <div v-else class="table_ellipsis">
@ -284,6 +595,7 @@ import { useRoute } from "vue-router";
import { useProfileDataStore } from "@/modules/04_registry/store"; import { useProfileDataStore } from "@/modules/04_registry/store";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import CurrencyInput from "@/components/CurruncyInput.vue";
import ProfileTable from "@/modules/04_registry/components/Table.vue"; import ProfileTable from "@/modules/04_registry/components/Table.vue";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue"; import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue";
@ -319,9 +631,10 @@ const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
const route = useRoute(); const route = useRoute();
const id = ref<string>(""); const id = ref<string>("");
const date = ref<Date>(new Date()); const date = ref<Date>(new Date());
const amount = ref<number | null>(null); const amount = ref<number>(0);
const positionSalaryAmount = ref<number | null>(null); // const salary = ref<number | null>(null);
const mouthSalaryAmount = ref<number | null>(null); const positionSalaryAmount = ref<number>(0);
const mouthSalaryAmount = ref<number>(0);
const ocId = ref<string>(); const ocId = ref<string>();
const positionId = ref<string>(); const positionId = ref<string>();
const positionLineId = ref<string>(); const positionLineId = ref<string>();
@ -648,23 +961,23 @@ const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]); const visibleColumns = ref<String[]>([]);
profileData.salary.columns.length == 0 profileData.salary.columns.length == 0
? (visibleColumns.value = [ ? (visibleColumns.value = [
"date", "date",
"amount", "amount",
"positionSalaryAmount", "positionSalaryAmount",
"mouthSalaryAmount", "mouthSalaryAmount",
"oc", "oc",
"position", "position",
"posNo", "posNo",
"positionLine", "positionLine",
"positionPathSide", "positionPathSide",
"positionType", "positionType",
"positionLevel", "positionLevel",
"positionExecutive", "positionExecutive",
"positionExecutiveSide", "positionExecutiveSide",
"salaryClass", "salaryClass",
"salaryRef", "salaryRef",
"refCommandNo", "refCommandNo",
]) ])
: (visibleColumns.value = profileData.salary.columns); : (visibleColumns.value = profileData.salary.columns);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -1238,7 +1551,7 @@ const fetchPosition = async () => {
positionLevelOptions.value = optionPositionLevels; positionLevelOptions.value = optionPositionLevels;
positionLevelOptionsFilter.value = optionPositionLevels; positionLevelOptionsFilter.value = optionPositionLevels;
}) })
.catch((e: any) => { }) .catch((e: any) => {})
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
@ -1794,7 +2107,7 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val, "full-width cursor-pointer": !val,
}; };
}; };
const resetFilter = () => { }; const resetFilter = () => {};
</script> </script>
<style lang="scss"> <style lang="scss">
.modalfix { .modalfix {

View file

@ -335,7 +335,7 @@
/> />
</div> --> </div> -->
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
<q-input <!-- <q-input
:class="getClass(edit)" :class="getClass(edit)"
:outlined="edit" :outlined="edit"
dense dense
@ -348,6 +348,15 @@
@update:modelValue="clickEditRow" @update:modelValue="clickEditRow"
type="number" type="number"
hide-bottom-space hide-bottom-space
/> -->
<CurrencyInput
v-model="amount"
:edit="edit"
:rules="[(val:string) => !!val || `${'กรุณากรอกค่าจ้าง'}`]"
:options="{
currency: 'THB',
}"
:label="`${'ค่าจ้าง'}`"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
@ -570,6 +579,7 @@ import { useRoute } from "vue-router";
import { useProfileDataStore } from "@/modules/04_registry/store"; import { useProfileDataStore } from "@/modules/04_registry/store";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import CurrencyInput from "@/components/CurruncyInput.vue";
import ProfileTable from "@/modules/04_registry/components/Table.vue"; import ProfileTable from "@/modules/04_registry/components/Table.vue";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue"; import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue";
@ -608,7 +618,7 @@ const {
dialogMessage, dialogMessage,
showLoader, showLoader,
hideLoader, hideLoader,
dialogConfirm dialogConfirm,
} = mixin; } = mixin;
const route = useRoute(); const route = useRoute();
const id = ref<string>(""); const id = ref<string>("");
@ -1694,9 +1704,9 @@ const templateDetail = async () => {
/** /**
* กดบนทกใน dialog * กดบนทกใน dialog
*/ */
const clickSave = () =>{ const clickSave = () => {
dialogConfirm($q,() => SaveData()) dialogConfirm($q, () => SaveData());
} };
const SaveData = async () => { const SaveData = async () => {
await myForm.value.validate().then(async (result: boolean) => { await myForm.value.validate().then(async (result: boolean) => {
if (result) { if (result) {