ปรับรายการผังบัญชีเงินเดือนข้าราชการ

This commit is contained in:
setthawutttty 2024-03-07 13:31:58 +07:00
parent c3ff2a270e
commit c9dfcc755f
3 changed files with 43 additions and 63 deletions

View file

@ -49,7 +49,7 @@ const props = defineProps({
const salaryId = ref<string>(""); const salaryId = ref<string>("");
const formData = reactive<FormData>({ const formData = reactive<FormData>({
salaryType: "", //* (OFFICER->"",EMPLOYEE->"") name: "", //*
posTypeId: "", //* posTypeId: "", //*
posLevelId: "", //* posLevelId: "", //*
isActive: false, //* isActive: false, //*
@ -61,21 +61,16 @@ const formData = reactive<FormData>({
}); });
/** ตัวแปร ref สำหรับแสดง validate */ /** ตัวแปร ref สำหรับแสดง validate */
const salaryTypeRef = ref<Object | null>(null); const nameRef = ref<Object | null>(null);
const posTypeRef = ref<Object | null>(null); const posTypeRef = ref<Object | null>(null);
const posLevelRef = ref<Object | null>(null); const posLevelRef = ref<Object | null>(null);
const ObjectRef: ObjectSalaryRef = { const ObjectRef: ObjectSalaryRef = {
salaryType: salaryTypeRef, name: nameRef,
posTypId: posTypeRef, posTypId: posTypeRef,
posLevelId: posLevelRef, posLevelId: posLevelRef,
}; };
const salaryTypeOption = ref<DataOption[]>([
{ id: "OFFICER", name: "ข้าราชการกรุงเทพมหานครสามัญ" },
{ id: "EMPLOYEE", name: "ลูกจ้างประจำกรุงเทพมหานคร" },
]);
const posType = ref<SalaryPosType[]>([]); const posType = ref<SalaryPosType[]>([]);
const salaryPosTypeOption = ref<DataOption[]>([]); const salaryPosTypeOption = ref<DataOption[]>([]);
const salaryPosLevelOption = ref<DataOption[]>([]); const salaryPosLevelOption = ref<DataOption[]>([]);
@ -130,7 +125,7 @@ async function fetchSalaryDetail(id: string) {
.get(config.API.salaryChartByid(id)) .get(config.API.salaryChartByid(id))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
formData.salaryType = data.salaryType; formData.name = data.name;
formData.posTypeId = data.posTypeId; formData.posTypeId = data.posTypeId;
formData.posLevelId = data.posLevelId; formData.posLevelId = data.posLevelId;
formData.isActive = data.isActive; formData.isActive = data.isActive;
@ -191,7 +186,7 @@ function closeDialog() {
} }
function clearFormData() { function clearFormData() {
formData.salaryType = ""; formData.name = "";
formData.posTypeId = ""; formData.posTypeId = "";
formData.posLevelId = ""; formData.posLevelId = "";
formData.isSpecial = false; formData.isSpecial = false;
@ -263,21 +258,17 @@ function checkEndDate() {
<div class="col-md-12"> <div class="col-md-12">
<div class="row col-12 q-col-gutter-sm"> <div class="row col-12 q-col-gutter-sm">
<div class="col-xs-12 col-md-3"> <div class="col-xs-12 col-md-3">
<q-select <q-input
:readonly="isReadonly" :readonly="isReadonly"
ref="salaryTypeRef" ref="nameRef"
dense dense
hide-bottom-space hide-bottom-space
outlined outlined
option-label="name" v-model="formData.name"
option-value="id" label="ชื่อผังบัญชีอัตราเงินเดือน"
emit-value la
map-options
v-model="formData.salaryType"
:options="salaryTypeOption"
label="ประเภทผังบัญชีเงินเดือน"
:rules="[ :rules="[
(val) => !!val || 'กรุณาเลือกประเภทผังบัญชีเงินเดือน', (val) => !!val || 'กรุณากรอกชื่อผังบัญชีอัตราเงินเดือน',
]" ]"
lazy-rules lazy-rules
/> />

View file

@ -23,7 +23,7 @@ interface ItemsMenu {
type: string; type: string;
} }
interface ObjectSalaryRef { interface ObjectSalaryRef {
salaryType: object | null; name: object | null;
posTypId: object | null; posTypId: object | null;
posLevelId: object | null; posLevelId: object | null;
@ -43,7 +43,7 @@ interface ObjectSalaryRateRef {
} }
interface FormData{ interface FormData{
salaryType:string name:string
posTypeId:string posTypeId:string
posLevelId:string posLevelId:string
isActive:boolean isActive:boolean

View file

@ -13,13 +13,13 @@ import type {
} from "@/modules/13_salary/interface/index/Main"; } from "@/modules/13_salary/interface/index/Main";
import type { Salary } from "@/modules/13_salary/interface/response/Main"; import type { Salary } from "@/modules/13_salary/interface/response/Main";
import type { FormQuerySalary } from "@/modules/13_salary/interface/request/Main"; import type { FormQuerySalary } from "@/modules/13_salary/interface/request/Main";
import DialogFormUpload from '@/modules/13_salary/components/SalaryChart/DialogUpload.vue' import DialogFormUpload from "@/modules/13_salary/components/SalaryChart/DialogUpload.vue";
import DialogFormMain from "@/modules/13_salary/components/SalaryChart/DialogFormMain.vue"; import DialogFormMain from "@/modules/13_salary/components/SalaryChart/DialogFormMain.vue";
/** importStore*/ /** importStore*/
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const isActive = ref<boolean>(false) const isActive = ref<boolean>(false);
const $q = useQuasar(); const $q = useQuasar();
const router = useRouter(); const router = useRouter();
const { const {
@ -31,38 +31,29 @@ const {
success, success,
} = useCounterMixin(); } = useCounterMixin();
const total = ref<number>() const total = ref<number>();
/** modalDialog*/ /** modalDialog*/
const modalDialogFormMain = ref<boolean>(false); const modalDialogFormMain = ref<boolean>(false);
const modalUpload = ref<boolean>(false); const modalUpload = ref<boolean>(false);
const rowId = ref<string>('') const rowId = ref<string>("");
/** Table*/ /** Table*/
const rows = ref<Salary[]>([]); const rows = ref<Salary[]>([]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "salaryType", name: "name",
align: "left", align: "left",
label: "ประเภทผัง", label: "ชื่อผังบัญชีอัตราเงินเดือน",
sortable: true, sortable: true,
field: "salaryType", field: "name",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "posType", name: "posList",
align: "left", align: "left",
label: "ประเภทตำแหน่ง", label: "ประเภทผังบัญชีเงินเดือน",
sortable: true,
field: "posType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posLevel",
align: "left",
label: "ระดับ",
field: "posLevel",
sortable: true, sortable: true,
field: "posList",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
@ -86,9 +77,8 @@ const columns = ref<QTableProps["columns"]>([
}, },
]); ]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"salaryType", "name",
"posType", "posList",
"posLevel",
"startDate", "startDate",
"isActive", "isActive",
]); ]);
@ -102,8 +92,8 @@ const itemMenu = ref<ItemsMenu[]>([
type: "edit", type: "edit",
}, },
{ {
label: "อัปโหลดเอกสารอ้างอิง", label: "เอกสารอ้างอิง",
icon: "mdi-upload", icon: "mdi-file-document-outline",
color: "teal", color: "teal",
type: "upload", type: "upload",
}, },
@ -149,11 +139,10 @@ async function fetchListSalaly() {
`?page=${page}&pageSize=${pageSize}&keyword=${keyword}` `?page=${page}&pageSize=${pageSize}&keyword=${keyword}`
) )
.then((res) => { .then((res) => {
total.value = res.data.result.total total.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize); maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize);
const data = res.data.result.data; const data = res.data.result.data;
rows.value = data; rows.value = data;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -168,7 +157,7 @@ const dataRow = ref<Salary>();
async function onClickSalary(type: string, data: Salary | null) { async function onClickSalary(type: string, data: Salary | null) {
modalDialogFormMain.value = !modalDialogFormMain.value; modalDialogFormMain.value = !modalDialogFormMain.value;
typeAction.value = type; typeAction.value = type;
if (data) { if (data) {
dataRow.value = data; dataRow.value = data;
} }
@ -208,11 +197,11 @@ async function onClickDelete(id: string) {
}); });
} }
async function onClickUpload(type: string,id: string,active:boolean) { async function onClickUpload(type: string, id: string, active: boolean) {
modalUpload.value = true modalUpload.value = true;
typeAction.value = type; typeAction.value = type;
rowId.value = id rowId.value = id;
isActive.value = active isActive.value = active;
} }
onMounted(async () => { onMounted(async () => {
@ -305,6 +294,10 @@ async function filterFn(page: number) {
size="24px" size="24px"
/> />
</div> </div>
<div v-else-if="col.name === 'posList'" class="column">
<div class="col text-weight-medium">{{ props.row.posType }}</div>
<div class="col text-weight-light">{{ props.row.isSpecial ? `${props.row.posLevel} (ฉ)` : `${props.row.posLevel}` }}</div>
</div>
<div v-else-if="col.name === 'salaryType'"> <div v-else-if="col.name === 'salaryType'">
{{ {{
col.value === "OFFICER" col.value === "OFFICER"
@ -315,9 +308,6 @@ async function filterFn(page: number) {
<div v-else-if="col.name === 'startDate'"> <div v-else-if="col.name === 'startDate'">
{{ col.value ? date2Thai(col.value) : "" }} {{ col.value ? date2Thai(col.value) : "" }}
</div> </div>
<div v-else-if="col.name === 'posLevel'">
{{ props.row.isSpecial ? `${col.value} (ฉ)` : `${col.value}` }}
</div>
<div v-else> <div v-else>
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</div> </div>
@ -344,7 +334,11 @@ async function filterFn(page: number) {
: item.type === 'salaryRate' : item.type === 'salaryRate'
? onClickSalaryRate(props.row.id) ? onClickSalaryRate(props.row.id)
: item.type === 'upload' : item.type === 'upload'
? onClickUpload('edit',props.row.id,props.row.isActive) ? onClickUpload(
'edit',
props.row.id,
props.row.isActive
)
: item.type === 'copy' : item.type === 'copy'
? onClickCoppy(props.row.id) ? onClickCoppy(props.row.id)
: null : null
@ -369,11 +363,7 @@ async function filterFn(page: number) {
> >
<q-item-section> <q-item-section>
<div class="row items-center"> <div class="row items-center">
<q-icon <q-icon color="red" size="17px" name="delete" />
color="red"
size="17px"
name="delete"
/>
<div class="q-pl-md">ลบ</div> <div class="q-pl-md">ลบ</div>
</div> </div>
</q-item-section> </q-item-section>
@ -414,7 +404,6 @@ async function filterFn(page: number) {
:fetchData="fetchListSalaly" :fetchData="fetchListSalaly"
:isActive="isActive" :isActive="isActive"
/> />
</template> </template>
<style scoped></style> <style scoped></style>