This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-04-17 10:07:15 +07:00
parent bf175c7750
commit 8a5a9f3e20
4 changed files with 168 additions and 183 deletions

View file

@ -134,7 +134,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "posTypeName",
align: "left",
label: "ประเภทตำเเหน่ง",
label: "ตำแหน่งประเภท",
sortable: true,
field: "posTypeName",
headerStyle: "font-size: 14px",

View file

@ -7,28 +7,20 @@ import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useOrganizational } from "@/modules/02_organization/store/organizational";
/**
* importType
*/
/** importType*/
import type { QTableProps } from "quasar";
import type { DataSortPos } from "@/modules/02_organization/interface/index/organizational";
/**
* importComponents
*/
/** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue";
/**
* use
*/
/** use*/
const $q = useQuasar();
const store = useOrganizational();
const { dialogConfirm, showLoader, success, hideLoader, messageError } =
useCounterMixin();
/**
* props
*/
/** props*/
const modal = defineModel<boolean>("sortPosition", { required: true });
const props = defineProps({
fetchDataTable: Function,
@ -56,9 +48,7 @@ function onDrop(from: number, to: number) {
rows.value.splice(to, 0, rows.value.splice(from, 1)[0]);
}
/**
* function นทกการจดลำด
*/
/** function บันทึกการจัดลำดับ*/
function save() {
dialogConfirm($q, () => {
const data = rows.value;
@ -84,9 +74,7 @@ function save() {
});
}
/**
* function เรยกรายการขอมลตำแหน
*/
/** function เรียกรายการข้อมูลตำแหน่ง*/
function getData() {
showLoader();
http
@ -103,7 +91,7 @@ function getData() {
const dataList = res.data.result.data;
const dataMap = dataList.map((item: any) => ({
id: item.id,
name: `${item.orgShortname}${
name: `${item.orgShortname} ${
item.posMasterNoPrefix ? item.posMasterNoPrefix : ""
}${item.posMasterNo ? item.posMasterNo : ""}${
item.posMasterNoSuffix ? item.posMasterNoSuffix : ""
@ -123,9 +111,7 @@ function getData() {
});
}
/**
* callback function ทำงานเม modal = true ทำการเรยกขอมลตำแหน
*/
/** callback function ทำงานเมื่อ modal = true ทำการเรียกข้อมูลตำแหน่ง*/
watch(
() => modal.value,
() => {
@ -135,6 +121,7 @@ watch(
}
);
</script>
<template>
<template>
<q-dialog v-model="modal" persistent>

View file

@ -96,7 +96,7 @@ export const useOrganizational = defineStore("organizationalStore", () => {
posMasterNo:
e.orgShortname +
(e.posMasterNoPrefix ? e.posMasterNoPrefix : "") +
(e.posMasterNo ? e.posMasterNo : "") +
(e.posMasterNo ? ` ${e.posMasterNo }`: "") +
(e.posMasterNoSuffix ? e.posMasterNoSuffix : ""),
positionName: e.isSit ? e.profilePosition : e.positionName,
posTypeName: e.isSit ? e.profilePostype : e.posTypeName,

View file

@ -185,167 +185,165 @@ watch(
<template>
<q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 85%">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<Header :tittle="`เลื่อนขั้น`" :close="close" />
<q-separator />
<Header :tittle="`เลื่อนขั้น`" :close="close" />
<q-separator />
<q-card-section class="scroll" style="max-height: 80vh">
<div class="q-gutter-y-sm">
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-select
class="inputgreen"
v-model="type"
label="เลื่อนขั้น"
dense
outlined
emit-value
map-options
option-label="name"
option-value="id"
:options="typeRangeOps"
:rules="[(val:string) => !!val || `${'กรุณาเลือก ขั้น'}`]"
lazy-rules
hide-bottom-space
@update:model-value="chengType()"
style="min-width: 140px"
/>
<q-space />
<q-input
standout
dense
v-model="keyword"
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
<div class="col-12">
<d-table
ref="table"
:columns="columns"
:rows="rows"
row-key="id"
flat
bordered
:paging="true"
dense
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
selection="multiple"
v-model:selected="selectedData"
>
<template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.selected"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<q-checkbox
v-model="props.selected"
keep-color
color="primary"
dense
/>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name === 'fullName'">
{{
`${props.row.prefix}${props.row.firstName} ${props.row.lastName}`
}}
</div>
<div
v-else-if="col.name == 'organization'"
class="text-html"
>
{{ findOrgNameHtml(props.row) }}
</div>
<div v-else-if="col.name == 'amount'">
{{ Number(props.row.amount).toLocaleString() }}
</div>
<div v-else-if="col.name == 'isSuspension'">
<q-icon
v-if="props.row.isSuspension !== null"
:name="props.row.isSuspension ? 'done' : 'close'"
:color="props.row.isSuspension ? 'primary' : 'red'"
size="24px"
/>
<div v-else-if="props.row.isSuspension == null">
{{ props.row.isSuspension == null ? "-" : "" }}
</div>
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
<div class="col-12">
<q-checkbox
v-if="type === 'FULL'"
keep-color
label="สำรอง"
dense
v-model="isReserve"
/>
<q-input
v-if="type === 'NONE'"
outlined
dense
v-model="note"
label="หมายเหตุ"
type="textarea"
:class="inputEdit(isReadonly)"
/>
</div>
<q-card-section class="scroll" style="max-height: 80vh">
<div class="q-gutter-y-sm">
<div class="row items-center q-gutter-x-sm q-pb-sm">
<q-select
class="inputgreen"
v-model="type"
label="เลื่อนขั้น"
dense
outlined
emit-value
map-options
option-label="name"
option-value="id"
:options="typeRangeOps"
:rules="[(val:string) => !!val || `${'กรุณาเลือก ขั้น'}`]"
lazy-rules
hide-bottom-space
@update:model-value="chengType()"
style="min-width: 140px"
/>
<q-space />
<q-input
standout
dense
v-model="keyword"
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
:disable="selectedData.length === 0 || type === ''"
type="submit"
color="secondary"
label="บันทึก"
/>
</q-card-actions>
</q-form>
<div class="col-12">
<d-table
ref="table"
:columns="columns"
:rows="rows"
row-key="id"
flat
bordered
:paging="true"
dense
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
selection="multiple"
v-model:selected="selectedData"
>
<template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.selected"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<q-checkbox
v-model="props.selected"
keep-color
color="primary"
dense
/>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name === 'fullName'">
{{
`${props.row.prefix}${props.row.firstName} ${props.row.lastName}`
}}
</div>
<div
v-else-if="col.name == 'organization'"
class="text-html"
>
{{ findOrgNameHtml(props.row) }}
</div>
<div v-else-if="col.name == 'amount'">
{{ Number(props.row.amount).toLocaleString() }}
</div>
<div v-else-if="col.name == 'isSuspension'">
<q-icon
v-if="props.row.isSuspension !== null"
:name="props.row.isSuspension ? 'done' : 'close'"
:color="props.row.isSuspension ? 'primary' : 'red'"
size="24px"
/>
<div v-else-if="props.row.isSuspension == null">
{{ props.row.isSuspension == null ? "-" : "" }}
</div>
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
<div class="col-12">
<q-checkbox
v-if="type === 'FULL'"
keep-color
label="สำรอง"
dense
v-model="isReserve"
/>
<q-input
v-if="type === 'NONE'"
outlined
dense
v-model="note"
label="หมายเหตุ"
type="textarea"
:class="inputEdit(isReadonly)"
/>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
:disable="selectedData.length === 0 || type === ''"
@click="onSubmit"
color="secondary"
label="บันทึก"
/>
</q-card-actions>
</q-card>
</q-dialog>
</template>