UI => ส่งคนไประบบออกคำสั่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-27 15:59:13 +07:00
parent 3ca0390b87
commit fc75e315f5
19 changed files with 816 additions and 842 deletions

View file

@ -242,7 +242,7 @@ onMounted(() => {
:readonly="!edit"
:borderless="!edit"
v-model="educationOld"
:rules="[(val) => !!val || `${'กรุณากรอกวุฒิการศึกษา'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกวุฒิการศึกษา'}`]"
hide-bottom-space
:label="`${'วุฒิการศึกษา'}`"
type="text"
@ -265,7 +265,7 @@ onMounted(() => {
:readonly="!edit"
:borderless="!edit"
v-model="organizationPositionOld"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง/สังกัด'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่ง/สังกัด'}`]"
hide-bottom-space
:label="`${'ตำแหน่ง/สังกัด'}`"
type="textarea"
@ -283,7 +283,7 @@ onMounted(() => {
:readonly="!edit"
:borderless="!edit"
v-model="positionTypeOld"
:rules="[(val) => !!val || `${'กรุณากรอกประเภทตำแหน่ง'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกประเภทตำแหน่ง'}`]"
hide-bottom-space
:label="`${'ประเภทตำแหน่ง'}`"
/>
@ -299,7 +299,7 @@ onMounted(() => {
:readonly="!edit"
:borderless="!edit"
v-model="positionLevelOld"
:rules="[(val) => !!val || `${'กรุณากรอกระดับตำแหน่ง'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกระดับตำแหน่ง'}`]"
hide-bottom-space
:label="`${'ระดับตำแหน่ง'}`"
/>
@ -315,7 +315,7 @@ onMounted(() => {
:readonly="!edit"
:borderless="!edit"
v-model="posNo"
:rules="[(val) => !!val || `${'กรุณากรอกเลขที่'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่'}`]"
hide-bottom-space
:label="`${'เลขที่'}`"
/>
@ -363,7 +363,7 @@ onMounted(() => {
:borderless="!edit"
:readonly="!edit"
:model-value="date !== null ? date2Thai(date) : null"
:rules="[(val) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]"
hide-bottom-space
:label="`${'ดำรงตำแหน่งในระดับปัจจุบันเมื่อ'}`"
>

View file

@ -1,25 +1,21 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { ref, watch, type PropType } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCommandMainStore } from "@/modules/18_command/store/Main";
import type { QTableProps } from "quasar";
import type { UserData } from "@/modules/05_placement/interface/response/AppointMent";
import type { ListCommand } from "@/modules/18_command/interface/index/Main";
import type { PersonData } from "@/modules/05_placement/interface/index/Main";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
const $q = useQuasar();
const storeCommand = useCommandMainStore();
const mixin = useCounterMixin();
const {
showLoader,
success,
messageError,
dialogConfirm,
hideLoader,
date2Thai,
} = mixin;
const { dialogConfirm, date2Thai } = mixin;
const props = defineProps({
Modal: Boolean,
@ -27,7 +23,7 @@ const props = defineProps({
fetchData: Function,
nextPage: Function,
optionsType: Array,
rows2: Array,
rows2: Array as PropType<PersonData[]>,
filterKeyword2: String,
type: String,
});
@ -37,15 +33,22 @@ const emit = defineEmits([
"update:selected",
]);
const selected = ref<[]>([]); //
const rows = ref<PersonData[]>([]); //
const selected = ref<PersonData[]>([]); //
const visibleColumns2 = ref<string[]>([
"no",
"citizenId",
"fullname",
"organizationName",
"typeCommand",
"dateOfBirth",
]);
const commandType = ref<string>(""); //
const commandMainOp = ref<ListCommand[]>([]); //
const commandOp = ref<ListCommand[]>([]); //
const modalCommand = ref<boolean>(false); //
/**
* ปเดทคคนหา
* @param value ตำคนหา
@ -89,6 +92,18 @@ const columns2 = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "typeCommand",
align: "left",
label: "ประเภทคำสั่ง",
sortable: true,
field: "typeCommand",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val: string) => {
return val === "SLIP" ? "เลื่อน" : val === "MOVE" ? "ย้าย" : "-";
},
},
{
name: "dateOfBirth",
align: "left",
@ -100,7 +115,7 @@ const columns2 = ref<QTableProps["columns"]>([
},
]);
function updateInput(value: any) {
function updateInput(value: string) {
emit("update:filterKeyword2", value);
}
@ -116,29 +131,40 @@ function Reset() {
*/
function clickAddlist() {
dialogConfirm($q, async () => {
let pId: string[] = [];
let Type = props.type as string;
selected.value.forEach((e: UserData) => {
pId.push(e.id);
});
let data = {
id: pId,
};
showLoader();
await http
.post(config.API.appointEmployeeOrder(Type), data)
.then(async () => {
await props.fetchData?.();
await props.clickClose?.();
await success($q, "บันทึกสำเร็จ");
selected.value = [];
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
modalCommand.value = true;
await props.clickClose?.();
});
}
/** ฟังก์ชันเลือกประเภทคำสั่ง */
function filterSelectOrder() {
const data = props.rows2 ? props.rows2 : [];
selected.value = [];
rows.value = data.filter((v: PersonData) => {
switch (commandType.value) {
case "C-PM-22":
return v.typeCommand === "SLIP";
case "C-PM-24":
return v.typeCommand === "MOVE";
default:
return [];
}
});
}
/**
* ลเตอร คำส
* @param val าจาก Input
* @param update Funtion quasar
*/
function filterSelector(val: string, update: Function) {
update(() => {
commandType.value = val ? "" : commandType.value;
commandOp.value = commandMainOp.value.filter(
(v: ListCommand) => v.name.indexOf(val) > -1
);
});
}
@ -149,159 +175,208 @@ function clickAddlist() {
*/
watch(
() => props.Modal,
() => {
async () => {
if (props.Modal === true) {
rows.value = props.rows2 ? props.rows2 : [];
selected.value = [];
commandType.value = "";
const data = await storeCommand.getCommandTypes();
commandMainOp.value = data.filter(
(e: ListCommand) => e.code === "C-PM-22" || e.code === "C-PM-24"
);
}
}
);
</script>
<template>
<q-dialog v-model="props.Modal">
<q-card style="width: 1200px; max-width: 80vw">
<DialogHeader :tittle="'ส่งไปออกคำสั่ง'" :close="clickClose" />
<q-separator />
<q-card-section>
<div class="row justify-between">
<div class="col-5"></div>
<div class="col-5">
<q-toolbar style="padding: 0">
<q-input
borderless
outlined
dense
debounce="300"
:model-value="filterKeyword2"
@update:model-value="updateInput"
placeholder="ค้นหา"
style="width: 850px; max-width: auto"
>
<template v-slot:append>
<q-icon v-if="filterKeyword2 == ''" name="search" />
<q-icon
v-if="filterKeyword2 !== ''"
name="clear"
class="cursor-pointer"
@click="Reset"
/>
</template>
</q-input>
<q-form greedy @submit.prevent @validation-success="clickAddlist">
<DialogHeader :tittle="'ส่งไปออกคำสั่ง'" :close="clickClose" />
<q-separator />
<q-card-section>
<div class="row q-col-gutter-sm">
<div class="row col-12">
<q-select
v-model="visibleColumns2"
multiple
outlined
v-model="commandType"
dense
options-dense
:display-value="$q.lang.table.columns"
outlined
label="ประเภทคำสั่ง"
:options="commandOp"
option-label="name"
option-value="code"
emit-value
map-options
:options="columns2"
option-value="name"
options-cover
style="min-width: 150px"
class="gt-xs q-ml-sm"
/>
</q-toolbar>
</div>
</div>
<d-table
:columns="columns2"
:rows="rows2"
:filter="filterKeyword2"
row-key="profileId"
flat
:visible-columns="visibleColumns2"
selection="multiple"
v-model:selected="selected"
>
<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" class="cursor-pointer">
<q-td auto-width>
<q-checkbox
keep-color
color="primary"
use-input
style="width: 350px; max-width: auto"
@update:model-value="filterSelectOrder"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn
) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
<q-space />
<div class="row q-col-gutter-sm">
<q-input
borderless
outlined
dense
v-model="props.selected"
debounce="300"
:model-value="filterKeyword2"
@update:model-value="updateInput"
placeholder="ค้นหา"
>
<template v-slot:append>
<q-icon v-if="filterKeyword2 == ''" name="search" />
<q-icon
v-if="filterKeyword2 !== ''"
name="clear"
class="cursor-pointer"
@click="Reset"
/>
</template>
</q-input>
<q-select
v-model="visibleColumns2"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns2"
option-value="name"
options-cover
style="min-width: 150px"
/>
</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.firstName
? `${props.row.prefix ?? ""}${
props.row.firstName ?? ""
} ${props.row.lastName ?? ""}`
: "-"
}}
</div>
</div>
</div>
<!-- <div v-else-if="col.name == 'status'">
<div class="col-12">
<d-table
:columns="columns2"
:rows="rows"
:filter="filterKeyword2"
row-key="profileId"
flat
:visible-columns="visibleColumns2"
selection="multiple"
v-model:selected="selected"
>
<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
keep-color
color="primary"
dense
v-model="props.selected"
/>
</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.firstName
? `${props.row.prefix ?? ""}${
props.row.firstName ?? ""
} ${props.row.lastName ?? ""}`
: "-"
}}
</div>
<!-- <div v-else-if="col.name == 'status'">
{{ props.row.status ? statusText(props.row.status) : "-" }}
</div> -->
<div v-else-if="col.name == 'dateOfBirth'">
{{
props.row.dateOfBirth
? date2Thai(props.row.dateOfBirth)
: "-"
}}
</div>
<div v-else-if="col.name == 'organizationName'">
<div class="col-4">
<div class="text-weight-medium">
{{ props.row.root !== null ? props.row.root : "-" }}
{{
props.row.rootShortName !== null
? `(${props.row.rootShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{
props.row.nodeName !== null ? props.row.nodeName : ""
}}
{{
props.row.nodeShortName !== null
? `(${props.row.nodeShortName}${props.row.posMasterNo})`
: ""
}}
</div>
</div>
</div>
<div v-else-if="col.name == 'createdAt'">
{{
props.row.createdAt ? date2Thai(props.row.createdAt) : "-"
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
label="ส่งไปออกคำสั่ง"
@click="clickAddlist"
color="public"
:disable="selected.length === 0"
><q-tooltip>งไปออกคำส</q-tooltip></q-btn
>
</q-card-actions>
<div v-else-if="col.name == 'dateOfBirth'">
{{
props.row.dateOfBirth
? date2Thai(props.row.dateOfBirth)
: "-"
}}
</div>
<div v-else-if="col.name == 'organizationName'">
<div class="col-4">
<div class="text-weight-medium">
{{ props.row.root !== null ? props.row.root : "-" }}
{{
props.row.rootShortName !== null
? `(${props.row.rootShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{
props.row.nodeName !== null
? props.row.nodeName
: ""
}}
{{
props.row.nodeShortName !== null
? `(${props.row.nodeShortName}${props.row.posMasterNo})`
: ""
}}
</div>
</div>
</div>
<div v-else-if="col.name == 'createdAt'">
{{
props.row.createdAt
? date2Thai(props.row.createdAt)
: "-"
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
label="ส่งไปออกคำสั่ง"
type="submit"
color="public"
:disable="selected.length === 0 || commandType === ''"
><q-tooltip>งไปออกคำส</q-tooltip></q-btn
>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
<!-- dialog สรางคำส -->
<DialogCreateCommand
v-model:modal="modalCommand"
:command-type-code="commandType"
:persons-id="selected.map((r) => r.id)"
/>
</template>

View file

@ -226,7 +226,7 @@ onMounted(() => {
:readonly="!edit"
:borderless="!edit"
v-model="educationOld"
:rules="[(val) => !!val || `${'กรุณากรอกวุฒิการศึกษา'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกวุฒิการศึกษา'}`]"
hide-bottom-space
:label="`${'วุฒิการศึกษา'}`"
type="text"
@ -249,7 +249,7 @@ onMounted(() => {
:readonly="!edit"
:borderless="!edit"
v-model="organizationPositionOld"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง/สังกัด'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่ง/สังกัด'}`]"
hide-bottom-space
:label="`${'ตำแหน่ง/สังกัด'}`"
type="textarea"
@ -267,7 +267,7 @@ onMounted(() => {
:readonly="!edit"
:borderless="!edit"
v-model="positionTypeOld"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งประเภท'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่งประเภท'}`]"
hide-bottom-space
:label="`${'ตำแหน่งประเภท'}`"
/>
@ -283,7 +283,7 @@ onMounted(() => {
:readonly="!edit"
:borderless="!edit"
v-model="positionLevelOld"
:rules="[(val) => !!val || `${'กรุณากรอกระดับตำแหน่ง'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกระดับตำแหน่ง'}`]"
hide-bottom-space
:label="`${'ระดับตำแหน่ง'}`"
/>
@ -299,7 +299,7 @@ onMounted(() => {
:readonly="!edit"
:borderless="!edit"
v-model="posNo"
:rules="[(val) => !!val || `${'กรุณากรอกเลขที่'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่'}`]"
hide-bottom-space
:label="`${'เลขที่'}`"
/>
@ -347,7 +347,7 @@ onMounted(() => {
:borderless="!edit"
:readonly="!edit"
:model-value="date !== null ? date2Thai(date) : null"
:rules="[(val) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]"
hide-bottom-space
:label="`${'ดำรงตำแหน่งในระดับปัจจุบันเมื่อ'}`"
>

View file

@ -1,31 +1,27 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { ref, watch, type PropType } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCommandMainStore } from "@/modules/18_command/store/Main";
/**
* importType
*/
/** importType*/
import type { QTableProps } from "quasar";
import type { UserDataNew } from "@/modules/05_placement/interface/response/AppointMent";
import type { PersonData } from "@/modules/05_placement/interface/index/Main";
import type { ListCommand } from "@/modules/18_command/interface/index/Main";
/**
* importcomponents
*/
/** importcomponents*/
import DialogHeader from "@/components/DialogHeader.vue";
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
const $q = useQuasar();
const storeFn = useTransferDataStore();
const storeCommand = useCommandMainStore();
const { statusText } = storeFn;
const {
showLoader,
success,
messageError,
dialogConfirm,
hideLoader,
date2Thai,
} = useCounterMixin();
@ -38,7 +34,7 @@ const props = defineProps({
fetchData: Function,
nextPage: Function,
optionsType: Array,
rows2: Array,
rows2: Array as PropType<PersonData[]>,
filterKeyword2: String,
type: String,
});
@ -51,6 +47,8 @@ const emit = defineEmits([
/**
* table
*/
const rows = ref<PersonData[]>([]); //
const selected = ref<PersonData[]>([]); //
const visibleColumns2 = ref<string[]>([
"no",
"citizenId",
@ -126,227 +124,286 @@ const columns2 = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const selected = ref<[]>([]);
const commandType = ref<string>(""); //
const commandMainOp = ref<ListCommand[]>([]); //
const commandOp = ref<ListCommand[]>([]); //
const modalCommand = ref<boolean>(false);
/**
* ไปหนารายละเอยดทเลอก
* @param item
* @param id รายการทองการดรายละเอยด
*/
function pageNext(item: any) {
props.nextPage?.(item?.id);
function pageNext(id: string) {
props.nextPage?.(id);
}
/**
* ปเดท filter
*/
function updateInput(value: any) {
/** อัปเดท filter*/
function updateInput(value: string) {
emit("update:filterKeyword2", value);
}
/**
* เซตคาในชองคนหา
*/
/** รีเซ็ตค่าในช่องค้นหา*/
function Reset() {
emit("update:filterKeyword2", "");
}
/**
* นยนสงไปออกคำส
*/
/** ยืนยันส่งไปออกคำสั่ง*/
function sendToCommand() {
dialogConfirm($q, async () => {
let pId: string[] = [];
let Type = props.type as string;
selected.value.forEach((e: UserDataNew) => {
pId.push(e.id);
});
let data = {
id: pId,
};
showLoader();
await http
.put(config.API.apppointmentReport(Type), data)
.then(async () => {
await props.fetchData?.();
await props.clickClose?.();
await success($q, "บันทึกสำเร็จ");
selected.value = [];
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
modalCommand.value = true;
await props.clickClose?.();
});
}
/** ฟังก์ชันเลือกประเภทคำสั่ง */
function filterSelectOrder() {
const data = props.rows2 ? props.rows2 : [];
selected.value = [];
rows.value = data.filter((v: PersonData) => {
switch (commandType.value) {
case "C-PM-05":
return v.typeCommand === "APPOINT";
case "C-PM-39":
return v.typeCommand === "SLIP";
case "C-PM-07":
return v.typeCommand === "MOVE";
default:
return [];
}
});
}
/**
* ลเตอร คำส
* @param val าจาก Input
* @param update Funtion quasar
*/
function filterSelector(val: string, update: Function) {
update(() => {
commandType.value = val ? "" : commandType.value;
commandOp.value = commandMainOp.value.filter(
(v: ListCommand) => v.name.indexOf(val) > -1
);
});
}
/**
* เม props.modal เป true
*
* กำหนดให selected เปนคาวาง
*/
watch(
() => props.Modal,
() => {
async () => {
if (props.Modal === true) {
rows.value = props.rows2 ? props.rows2 : [];
selected.value = [];
commandType.value = "";
const data = await storeCommand.getCommandTypes();
commandMainOp.value = data.filter(
(e: ListCommand) =>
e.code === "C-PM-05" || e.code === "C-PM-39" || e.code === "C-PM-07"
);
}
}
);
</script>
<template>
<q-dialog v-model="props.Modal">
<q-card style="width: 1200px; max-width: 80vw">
<DialogHeader :tittle="'ส่งไปออกคำสั่ง'" :close="clickClose" />
<q-separator />
<q-card-section>
<div class="row justify-between">
<div class="col-5"></div>
<div class="col-5">
<q-toolbar style="padding: 0">
<q-input
borderless
outlined
dense
debounce="300"
:model-value="filterKeyword2"
@update:model-value="updateInput"
placeholder="ค้นหา"
style="width: 850px; max-width: auto"
>
<template v-slot:append>
<q-icon v-if="filterKeyword2 == ''" name="search" />
<q-icon
v-if="filterKeyword2 !== ''"
name="clear"
class="cursor-pointer"
@click="Reset"
/>
</template>
</q-input>
<q-form greedy @submit.prevent @validation-success="sendToCommand">
<DialogHeader :tittle="'ส่งไปออกคำสั่ง'" :close="clickClose" />
<q-separator />
<q-card-section>
<div class="row q-col-gutter-sm">
<div class="row col-12">
<q-select
v-model="visibleColumns2"
multiple
outlined
v-model="commandType"
dense
options-dense
:display-value="$q.lang.table.columns"
outlined
label="ประเภทคำสั่ง"
:options="commandOp"
option-label="name"
option-value="code"
emit-value
map-options
:options="columns2"
option-value="name"
options-cover
style="min-width: 150px"
class="gt-xs q-ml-sm"
/>
</q-toolbar>
</div>
</div>
<d-table
:columns="columns2"
:rows="rows2"
:filter="filterKeyword2"
row-key="profileId"
flat
:visible-columns="visibleColumns2"
selection="multiple"
v-model:selected="selected"
>
<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" class="cursor-pointer">
<q-td auto-width>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="pageNext(props.row)"
use-input
style="width: 350px; max-width: auto"
@update:model-value="filterSelectOrder"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn
) "
>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'fullname'">
{{
props.row.firstName
? `${props.row.prefix ?? ""}${
props.row.firstName ?? ""
} ${props.row.lastName ?? ""}`
: "-"
}}
</div>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
<q-space />
<div class="row q-col-gutter-sm">
<q-input
borderless
outlined
dense
debounce="300"
:model-value="filterKeyword2"
@update:model-value="updateInput"
placeholder="ค้นหา"
>
<template v-slot:append>
<q-icon v-if="filterKeyword2 == ''" name="search" />
<q-icon
v-if="filterKeyword2 !== ''"
name="clear"
class="cursor-pointer"
@click="Reset"
/>
</template>
</q-input>
<q-select
v-model="visibleColumns2"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns2"
option-value="name"
options-cover
style="min-width: 150px"
/>
</div>
</div>
<div v-else-if="col.name == 'status'">
{{ props.row.status ? statusText(props.row.status) : "-" }}
</div>
<div v-else-if="col.name == 'dateOfBirth'">
{{
props.row.dateOfBirth
? date2Thai(props.row.dateOfBirth)
: "-"
}}
</div>
<div v-else-if="col.name == 'organizationName'">
<div class="col-4">
<div class="text-weight-medium">
{{ props.row.root !== null ? props.row.root : "-" }}
{{
props.row.rootShortName !== null
? `(${props.row.rootShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{
props.row.nodeName !== null ? props.row.nodeName : ""
}}
{{
props.row.nodeShortName !== null
? `(${props.row.nodeShortName}${props.row.posMasterNo})`
: ""
}}
</div>
</div>
</div>
<div v-else-if="col.name == 'createdAt'">
{{
props.row.createdAt ? date2Thai(props.row.createdAt) : "-"
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
label="ส่งไปออกคำสั่ง"
@click="sendToCommand"
color="public"
:disable="selected.length === 0"
>
<q-tooltip>งไปออกคำส</q-tooltip>
</q-btn>
</q-card-actions>
<div class="col-12">
<d-table
:columns="columns2"
:rows="rows"
:filter="filterKeyword2"
row-key="profileId"
flat
:visible-columns="visibleColumns2"
selection="multiple"
v-model:selected="selected"
>
<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" class="cursor-pointer">
<q-td auto-width>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="pageNext(props.row.id)"
>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'fullname'">
{{
props.row.firstName
? `${props.row.prefix ?? ""}${
props.row.firstName ?? ""
} ${props.row.lastName ?? ""}`
: "-"
}}
</div>
<div v-else-if="col.name == 'status'">
{{
props.row.status ? statusText(props.row.status) : "-"
}}
</div>
<div v-else-if="col.name == 'dateOfBirth'">
{{
props.row.dateOfBirth
? date2Thai(props.row.dateOfBirth)
: "-"
}}
</div>
<div v-else-if="col.name == 'organizationName'">
<div class="col-4">
<div class="text-weight-medium">
{{ props.row.root !== null ? props.row.root : "-" }}
{{
props.row.rootShortName !== null
? `(${props.row.rootShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{
props.row.nodeName !== null
? props.row.nodeName
: ""
}}
{{
props.row.nodeShortName !== null
? `(${props.row.nodeShortName}${props.row.posMasterNo})`
: ""
}}
</div>
</div>
</div>
<div v-else-if="col.name == 'createdAt'">
{{
props.row.createdAt
? date2Thai(props.row.createdAt)
: "-"
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
label="ส่งไปออกคำสั่ง"
type="submit"
color="public"
:disable="selected.length === 0 || commandType === ''"
>
<q-tooltip>งไปออกคำส</q-tooltip>
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
<!-- dialog สรางคำส -->
<DialogCreateCommand
v-model:modal="modalCommand"
:command-type-code="commandType"
:persons-id="selected.map((r) => r.id)"
/>
</template>

View file

@ -4,8 +4,6 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importType
@ -17,22 +15,15 @@ import type { officerType } from "@/modules/05_placement/interface/response/offi
* importComponents
*/
import DialogHeader from "@/components/DialogHeader.vue";
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
/**
* use
*/
const $q = useQuasar();
const { statusText } = useTransferDataStore();
const {
showLoader,
success,
messageError,
dialogConfirm,
hideLoader,
findOrgNameOld,
findPosMasterNoOld,
date2Thai,
} = useCounterMixin();
const { dialogConfirm, findOrgNameOld, findPosMasterNoOld, date2Thai } =
useCounterMixin();
/**
* props
@ -186,32 +177,15 @@ const visibleColumns2 = ref<string[]>([
"status",
]);
const selected = ref<officerType[]>([]); //
const modalCommand = ref<boolean>(false);
/**
* นยนการสงไปออกคำส
*/
/** ยืนยันการส่งไปออกคำสั่ง*/
function saveOrder() {
dialogConfirm(
$q,
() => {
const id = selected.value.map((item) => item.id);
const body = {
id,
};
showLoader();
http
.post(config.API.officerMainReport(), body)
.then(async () => {
await props.getData?.();
await success($q, "ส่งไปออกคำสั่งช่วยราชการสำเร็จ");
props.closeModal?.();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
props.closeModal?.();
modalCommand.value = true;
},
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
@ -222,20 +196,17 @@ function saveOrder() {
* ปเดทคคนหา
* @param value ตำคนหา
*/
function updateInput(value: any) {
function updateInput(value: string) {
emit("update:filterKeyword2", value);
}
/**
* เซตคาในชองคนหา
*/
/** รีเซ็ตค่าในช่องค้นหา*/
function Reset() {
emit("update:filterKeyword2", "");
}
/**
* เม props.modal เป true
*
* กำหนดให selected เปนคาวาง
*/
watch(
@ -358,4 +329,10 @@ watch(
</q-card-actions>
</q-card>
</q-dialog>
<DialogCreateCommand
v-model:modal="modalCommand"
:command-type-code="'C-PM-15'"
:persons-id="selected.map((r) => r.id)"
/>
</template>

View file

@ -1,26 +1,24 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { ref, watch, type PropType } from "vue";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importComponents
*/
import DialogHeader from "@/components/DialogHeader.vue";
/**
* importStore
*/
import { useTransferDataStore } from "@/modules/05_placement/store";
import { useCounterMixin } from "@/stores/mixin";
import { useCommandMainStore } from "@/modules/18_command/store/Main";
import type { QTableProps } from "quasar";
import type { ListCommand } from "@/modules/18_command/interface/index/Main";
import type { listMain } from "@/modules/05_placement/interface/response/OhterMain";
/** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue";
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
const $q = useQuasar();
const storeCommand = useCommandMainStore();
const storeFn = useTransferDataStore();
const { statusText } = storeFn;
const { showLoader, success, messageError, dialogConfirm, date2Thai } =
useCounterMixin();
const { dialogConfirm, date2Thai } = useCounterMixin();
/**
* props
@ -31,7 +29,7 @@ const props = defineProps({
resetFilter: Function,
fecthlistOthet: Function,
optionsType: Array,
rows2: Array,
rows2: Array as PropType<listMain[]>,
filterKeyword2: String,
type: String,
});
@ -41,12 +39,9 @@ const emit = defineEmits([
"update:selected",
]);
const selected = ref<any[]>([]); //
const OptionsTypeFn = ref<any[]>([]); //
/**
* Table
*/
//Table
const rows = ref<listMain[]>([]); //
const selected = ref<listMain[]>([]); //
const visibleColumns2 = ref<string[]>([
"no",
"fullname",
@ -128,18 +123,14 @@ const columns2 = ref<QTableProps["columns"]>([
},
]);
/**
* update filter
*/
function updateInput(value: any) {
emit("update:filterKeyword2", value);
}
const commandType = ref<string>(""); //
const commandMainOp = ref<ListCommand[]>([]); //
const commandOp = ref<ListCommand[]>([]); //
const modalCommand = ref<boolean>(false); //
/**
* update ประเภทคำส
*/
function updateInputType(value: any) {
emit("update:type", value);
/** update filter*/
function updateInput(value: string) {
emit("update:filterKeyword2", value);
}
/**
@ -154,62 +145,40 @@ function Reset() {
*/
function clickAddlist() {
dialogConfirm($q, async () => {
let pId: string[] = [];
let Type = props.type as string;
selected.value.forEach((e: any) => {
pId.push(e.id);
});
let data = {
id: pId,
};
showLoader();
await http
.put(config.API.otherReport(Type), data)
.then(() => {
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
props.fecthlistOthet?.();
selected.value = [];
props.clickClose?.();
});
modalCommand.value = true;
props.clickClose?.();
});
}
/**
* filter OptionsType
* @param val คำคนหา
* @param update Function
* ลเตอร คำส
* @param val าจาก Input
* @param update Funtion quasar
*/
function filterFnOptionsType(val: string, update: Function) {
if (val == "") {
update(() => {
OptionsTypeFn.value = props.optionsType || [];
});
} else {
update(() => {
if (props.optionsType) {
OptionsTypeFn.value = props.optionsType.filter(
(e: any) => e.name.search(val) !== -1
);
}
});
}
function filterSelector(val: string, update: Function) {
update(() => {
commandType.value = val ? "" : commandType.value;
commandOp.value = commandMainOp.value.filter(
(v: ListCommand) => v.name.indexOf(val) > -1
);
});
}
/**
* เม props.modal เป true
*
* เม props.modal เป tru
* กำหนดให selected เปนคาวาง
*/
watch(
() => props.Modal,
() => {
async () => {
if (props.Modal === true) {
rows.value = props.rows2 ? props.rows2 : [];
selected.value = [];
commandType.value = "";
const data = await storeCommand.getCommandTypes();
commandMainOp.value = data.filter(
(e: ListCommand) => e.code === "C-PM-08" || e.code === "C-PM-09"
);
}
}
);
@ -218,27 +187,32 @@ watch(
<template>
<q-dialog v-model="props.Modal">
<q-card style="width: 1200px; max-width: 80vw">
<DialogHeader :tittle="'ส่งไปออกคำสั่งอื่นๆ'" :close="props.clickClose" />
<q-separator />
<q-card-section>
<div class="row justify-between">
<div class="col-5">
<q-toolbar style="padding: 0">
<q-form greedy @submit.prevent @validation-success="clickAddlist">
<DialogHeader
:tittle="'ส่งไปออกคำสั่งอื่นๆ'"
:close="props.clickClose"
/>
<q-separator />
<q-card-section>
<div class="row q-col-gutter-sm">
<div class="row col-12">
<q-select
outlined
v-model="commandType"
dense
:model-value="type"
@update:model-value="updateInputType"
:options="OptionsTypeFn"
outlined
label="ประเภทคำสั่ง"
style="width: 400px; max-width: auto"
:options="commandOp"
option-label="name"
option-value="code"
emit-value
map-options
option-label="name"
option-value="id"
use-input
@filter="filterFnOptionsType"
><template v-slot:no-option>
style="width: 350px; max-width: auto"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn
) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
@ -246,104 +220,111 @@ watch(
</q-item>
</template>
</q-select>
</q-toolbar>
</div>
<div class="col-5">
<q-toolbar style="padding: 0">
<q-input
borderless
outlined
dense
debounce="300"
:model-value="filterKeyword2"
@update:model-value="updateInput"
placeholder="ค้นหา"
style="width: 850px; max-width: auto"
<q-space />
<div class="row q-col-gutter-sm">
<q-input
borderless
outlined
dense
debounce="300"
:model-value="filterKeyword2"
@update:model-value="updateInput"
placeholder="ค้นหา"
>
<template v-slot:append>
<q-icon v-if="filterKeyword2 == ''" name="search" />
<q-icon
v-if="filterKeyword2 !== ''"
name="clear"
class="cursor-pointer"
@click="Reset"
/>
</template>
</q-input>
<q-select
v-model="visibleColumns2"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns2"
option-value="name"
options-cover
style="min-width: 150px"
/>
</div>
</div>
<div class="col-12">
<d-table
:columns="columns2"
:rows="props.rows2"
:filter="filterKeyword2"
row-key="profileId"
flat
:visible-columns="visibleColumns2"
selection="multiple"
v-model:selected="selected"
>
<template v-slot:append>
<q-icon v-if="filterKeyword2 == ''" name="search" />
<q-icon
v-if="filterKeyword2 !== ''"
name="clear"
class="cursor-pointer"
@click="Reset"
<template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
v-model="scope.selected"
/>
</template>
</q-input>
<q-select
v-model="visibleColumns2"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns2"
option-value="name"
options-cover
style="min-width: 150px"
class="gt-xs q-ml-sm"
/>
</q-toolbar>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
<div
v-else
:class="
col.name === 'affiliation' ? 'table_ellipsis' : ''
"
>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</div>
<d-table
:columns="columns2"
:rows="props.rows2"
:filter="filterKeyword2"
row-key="profileId"
flat
:visible-columns="visibleColumns2"
selection="multiple"
v-model:selected="selected"
>
<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" class="cursor-pointer">
<q-td>
<q-checkbox
keep-color
color="primary"
dense
v-model="props.selected"
/>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
<div
v-else
:class="col.name === 'affiliation' ? 'table_ellipsis' : ''"
>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
label="ส่งไปออกคำสั่ง"
@click="clickAddlist"
:disable="selected.length === 0"
color="public"
>
<q-tooltip>งไปออกคำส</q-tooltip>
</q-btn>
</q-card-actions>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn
label="ส่งไปออกคำสั่ง"
type="submit"
:disable="selected.length === 0 || commandType === ''"
color="public"
>
<q-tooltip>งไปออกคำส</q-tooltip>
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
<DialogCreateCommand
v-model:modal="modalCommand"
:command-type-code="commandType"
:persons-id="selected.map((r) => r.id)"
/>
</template>

View file

@ -9,9 +9,7 @@ import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* impotyType
*/
/** impotyType*/
import type { resApiData } from "@/modules/05_placement/interface/response/OhterMain";
import type { QForm } from "quasar";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
@ -237,7 +235,7 @@ onMounted(async () => {
:readonly="!edit"
:borderless="!edit"
v-model="educationOld"
:rules="[(val) => !!val || `${'กรุณากรอกวุฒิการศึกษา'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกวุฒิการศึกษา'}`]"
hide-bottom-space
:label="`${'วุฒิการศึกษา'}`"
type="text"
@ -258,7 +256,7 @@ onMounted(async () => {
:readonly="!edit"
:borderless="!edit"
v-model="organizationPositionOld"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง/สังกัด'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่ง/สังกัด'}`]"
hide-bottom-space
:label="`${'ตำแหน่ง/สังกัด'}`"
type="textarea"
@ -275,7 +273,7 @@ onMounted(async () => {
:readonly="!edit"
:borderless="!edit"
v-model="positionTypeOld"
:rules="[(val) => !!val || `${'กรุณากรอกประเภทตำแหน่ง'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกประเภทตำแหน่ง'}`]"
hide-bottom-space
:label="`${'ประเภทตำแหน่ง'}`"
/>
@ -291,7 +289,7 @@ onMounted(async () => {
:readonly="!edit"
:borderless="!edit"
v-model="positionLevelOld"
:rules="[(val) => !!val || `${'กรุณากรอกระดับตำแหน่ง'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกระดับตำแหน่ง'}`]"
hide-bottom-space
:label="`${'ระดับตำแหน่ง'}`"
/>
@ -307,7 +305,7 @@ onMounted(async () => {
:readonly="!edit"
:borderless="!edit"
v-model="posNo"
:rules="[(val) => !!val || `${'กรุณากรอกเลขที่'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่'}`]"
hide-bottom-space
:label="`${'เลขที่'}`"
/>
@ -355,7 +353,7 @@ onMounted(async () => {
:readonly="!edit"
:borderless="!edit"
:model-value="date !== null ? date2Thai(date) : null"
:rules="[(val) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]"
hide-bottom-space
:label="`${'ตั้งแต่วัน'}`"
>

View file

@ -3,8 +3,6 @@ import { ref, watchEffect } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type { ResponseRow } from "@/modules/05_placement/interface/response/Receive";
@ -12,19 +10,14 @@ import type { ResponseRow } from "@/modules/05_placement/interface/response/Rece
import { useTransferDataStore } from "@/modules/05_placement/store";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
const transferStore = useTransferDataStore();
const { statusText } = transferStore;
const $q = useQuasar();
const selected = ref<ResponseRow[]>([]);
const mixin = useCounterMixin();
const {
showLoader,
success,
messageError,
dialogConfirm,
hideLoader,
date2Thai,
} = mixin;
const { dialogConfirm, date2Thai } = mixin;
/**
* props
@ -128,54 +121,33 @@ const visibleColumns2 = ref<string[]>([
"status",
]);
/**
* งกนยนยนการสงออกคำส
*/
const modalCommand = ref<boolean>(false); ///
/** ฟังก์ชันยืนยันการส่งออกคำสั่ง*/
function saveOrder() {
dialogConfirm(
$q,
async () => {
const id = selected.value.map((r: ResponseRow) => r.id);
const body = {
id,
};
showLoader();
await http
.post(config.API.receiveReport, body)
.then(async () => {
await props.fecthlistRecevice?.();
success($q, "ส่งไปออกคำสั่งรับโอนสำเร็จ");
props.clickClose?.();
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
props?.clickClose?.();
modalCommand.value = true;
},
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
);
}
/**
* งกนอปเดทคาในชองคนหา
*/
function updateInput(value: any) {
/** ฟังก์ชันอัปเดทค่าในช่องค้นหา*/
function updateInput(value: string) {
emit("update:filterKeyword2", value);
}
/**
* งกนรเซตคาในชองคนหา
*/
/** ฟังก์ชันรีเซ็ตค่าในช่องค้นหา*/
function onReset() {
emit("update:filterKeyword2", "");
}
/**
* เม props.modal เป true
*
* กำหนดให selected เปนคาวาง
*/
watchEffect(() => {
@ -334,4 +306,10 @@ watchEffect(() => {
</q-card-actions>
</q-card>
</q-dialog>
<DialogCreateCommand
v-model:modal="modalCommand"
:command-type-code="'C-PM-14'"
:persons-id="selected.map((r) => r.id)"
/>
</template>

View file

@ -2,42 +2,23 @@
import { ref, computed, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
/**
* impportType
*/
/** impportType*/
import type { QTableProps } from "quasar";
import type { officerType } from "@/modules/05_placement/interface/response/officer";
/**
* importComponents
*/
/** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue";
/**
* importStore
*/
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
const $q = useQuasar();
const { statusText } = useTransferDataStore();
const mixin = useCounterMixin();
const {
showLoader,
success,
messageError,
dialogConfirm,
hideLoader,
findPosMasterNoOld,
date2Thai,
} = mixin;
const { dialogConfirm, findPosMasterNoOld, date2Thai } = mixin;
/**
* props
*/
/** props*/
const props = defineProps({
Modal: Boolean,
closeModal: Function,
@ -47,9 +28,7 @@ const props = defineProps({
});
const emit = defineEmits(["update:filterKeyword2", "update:selected"]);
/**
* table
*/
//table
const selected = ref<officerType[]>([]);
const columns2 = ref<QTableProps["columns"]>([
{
@ -155,41 +134,22 @@ const visibleColumns2 = ref<string[]>([
"status",
]);
/**
* chech การเลอกรายชอสงตวกล
*/
const modalCommand = ref<boolean>(false); ///
/** chech การเลือกรายชื่อส่งตัวกลับ*/
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
/**
* นยนการสงออกคำสงสงตวกล
*/
/** ยืนยันการส่งออกคำสั่งส่งตัวกลับ*/
function saveOrder() {
dialogConfirm(
$q,
async () => {
const id = selected.value.map((item) => item.id);
const body = {
id,
};
showLoader();
await http
.post(config.API.repatriationMainReport(), body)
.then(async () => {
await props.getData?.();
await success($q, "ส่งไปออกคำสั่งส่งตัวกลับสำเร็จ");
props.closeModal?.();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
props.closeModal?.();
modalCommand.value = true;
},
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
@ -204,9 +164,7 @@ function updateInput(value: string | number | null) {
emit("update:filterKeyword2", value);
}
/**
* เซตคาในชองคนหา
*/
/** รีเซ็ตค่าในช่องค้นหา*/
function Reset() {
emit("update:filterKeyword2", "");
}
@ -330,4 +288,10 @@ watch(
</q-card-actions>
</q-card>
</q-dialog>
<DialogCreateCommand
v-model:modal="modalCommand"
:command-type-code="'C-PM-16'"
:persons-id="selected.map((r) => r.id)"
/>
</template>

View file

@ -226,7 +226,6 @@ interface DataProfile {
child3ShortName: string | null;
child4: string | null;
child4ShortName: string | null;
child1Old?: string | null;
child1ShortNameOld?: string | null;
child2Old?: string | null;
@ -235,7 +234,6 @@ interface DataProfile {
child3ShortNameOld?: string | null;
child4Old?: string | null;
child4ShortNameOld?: string | null;
createdAt: string | Date;
dateEnd: string | Date;
dateStart: string | Date;
@ -340,9 +338,9 @@ interface PersonData {
deferment: boolean;
statusName: string;
organizationName: string;
id: string;
}
export type {
DataOption,
DataOptionInsignia,
@ -368,7 +366,7 @@ export type {
ListDataText,
ListMenu,
DataEducation,
PersonData
PersonData,
};
export { AddressDataDefualt, FamilyDataDefualt };

View file

@ -23,6 +23,7 @@ interface listMain {
amountOld: number;
positionDate: Date;
leaveDate: Date;
id: string;
}
//ข้อมูลจาก api
interface listMainAPI {

View file

@ -9,19 +9,16 @@ import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importType
*/
/** importType*/
import type {
listAppointType,
resData,
} from "@/modules/05_placement/interface/response/AppointMent";
import type { OpType } from "@/modules/05_placement/interface/response/Main";
import type { QTableProps } from "quasar";
import type { PersonData } from "@/modules/05_placement/interface/index/Main";
/**
* importComponents
*/
/** importComponents*/
import Dialogbody from "@/modules/05_placement/components/AppointMent/DialogOrders.vue"; //
import DialogOrgSelect from "@/components/Dialogs/DialogOrgSelect.vue"; //
@ -52,11 +49,9 @@ const listRecevice = ref<resData[]>([]); //ข้อมูลรายการ
const optionsType = ref<OpType[]>([]);
const type = ref<string>("");
/**
* Table
*/
const rows = ref<listAppointType[]>([]); //--
const rows2 = ref<listAppointType[]>([]); //
//table
const rows = ref<PersonData[]>([]); //--
const rows2 = ref<PersonData[]>([]); //
const filterKeyword = ref<string>(""); //--
const filterKeyword2 = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
@ -159,18 +154,14 @@ const pagination = ref({
rowsPerPage: 10,
});
/**
* เซตคำคนหารายการ
*/
/** รีเซ็ตคำค้นหารายการ*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
}
/**
* fetch รายการแตงต-เลอน-าย
*/
/** fetch รายการแต่งตั้ง-เลื่อน-ย้าย*/
async function fecthlistappointment() {
showLoader();
await http
@ -234,9 +225,7 @@ function nextPage(id: string) {
});
}
/**
* เป popup เลอกหนวยงาน
*/
/** เปิด popup เลือกหน่วยงาน*/
function openModalTree(data: any, type: string) {
personalId.value = data.id;
typeModal.value = type;
@ -247,9 +236,7 @@ function openModalTree(data: any, type: string) {
modalTree.value = true;
}
/**
* นยนการเลอกหนวยงานทแตงต
*/
/** ยืนยันการเลือกหน่วยงานที่แต่งตั้ง*/
function onSave(data: any) {
const dataAppoint = {
node: data.node,
@ -283,24 +270,18 @@ function onSave(data: any) {
});
}
/**
* เป popup งไปออกคำส
*/
/** เปิด popup ส่งไปออกคำสั่ง*/
function sendToCommand() {
modal.value = true;
filterKeyword2.value = "";
}
/**
* popup งไปออกคำส
*/
/** ปิด popup ส่งไปออกคำสั่ง*/
function clickClose() {
modal.value = false;
}
/**
* ทำงานเมอมการเรยกใช Components
*/
/** ทำงานเมื่อมีการเรียกใช้ Components*/
onMounted(() => {
fecthlistappointment();
});
@ -582,9 +563,9 @@ onMounted(() => {
v-model:type="type"
:click-close="clickClose"
:options-type="optionsType"
:rows2="rows2"
:next-page="nextPage"
:fetch-data="fecthlistappointment"
:rows2="rows2"
/>
<DialogOrgSelect

View file

@ -10,11 +10,8 @@ import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type {
listAppointType,
resData,
} from "@/modules/05_placement/interface/response/AppointMent";
import type { PersonData } from "@/modules/05_placement/interface/index/Main";
import type { resData } from "@/modules/05_placement/interface/response/AppointMent";
import type { OpType } from "@/modules/05_placement/interface/response/Main";
import DialogOrgSelectEmployee from "@/components/Dialogs/DialogOrgSelectEmployee.vue"; //
@ -49,8 +46,8 @@ const optionsType = ref<OpType[]>([]);
const type = ref<string>("");
// Table
const rows = ref<listAppointType[]>([]); //
const rows2 = ref<listAppointType[]>([]); //
const rows = ref<PersonData[]>([]); //
const rows2 = ref<PersonData[]>([]); //
const filterKeyword = ref<string>(""); //
const filterKeyword2 = ref<string>(""); //
const visibleColumns = ref<string[]>([
@ -59,6 +56,7 @@ const visibleColumns = ref<string[]>([
"fullname",
"organizationName",
"dateOfBirth",
"typeCommand",
"createdAt",
"status",
]);
@ -114,6 +112,18 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "typeCommand",
align: "left",
label: "ประเภทคำสั่ง",
sortable: true,
field: "typeCommand",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val: string) => {
return val === "SLIP" ? "เลื่อน" : val === "MOVE" ? "ย้าย" : "-";
},
},
{
name: "createdAt",
align: "left",
@ -527,9 +537,9 @@ onMounted(() => {
v-model:type="type"
:click-close="clickClose"
:options-type="optionsType"
:rows2="rows2"
:next-page="nextPage"
:fetch-data="fecthlistappointment"
:rows2="rows2"
/>
<DialogOrgSelectEmployee

View file

@ -32,8 +32,6 @@ const {
} = useCounterMixin();
const modal = ref<boolean>(false);
const type = ref<string>("");
const optionsType = ref<OpType[]>([]);
/**
* Table
@ -163,29 +161,6 @@ async function fecthlistOthet() {
});
}
/**
* fetch รายการขอมลประเภทคำส
*/
function fecthTypeOption() {
showLoader();
type.value = "";
http
.get(config.API.typeOrder())
.then((res) => {
// C-PM-08 C-PM-09
optionsType.value = res.data.result.filter(
(e: OpType) =>
e.commandCode === "C-PM-08" || e.commandCode === "C-PM-09"
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* เซตขอมลในชอง input
*/
@ -200,9 +175,6 @@ function resetFilter() {
function popup() {
modal.value = true;
filterKeyword2.value = "";
type.value = "";
// fetch
fecthTypeOption();
}
/**
@ -380,9 +352,7 @@ onMounted(() => {
<Dialogbody
v-model:Modal="modal"
v-model:filter-keyword2="filterKeyword2"
v-model:type="type"
:click-close="clickClose"
:options-type="optionsType"
:rows2="rows2"
:fecthlistOthet="fecthlistOthet"
/>

View file

@ -9,6 +9,8 @@ import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
import DialogHeader from "@/modules/06_retirement/components/DialogHeader.vue";
/** use */
@ -98,7 +100,6 @@ const columns2 = ref<QTableProps["columns"]>([
format: (val) => statusText(val),
},
]);
/** คอลัมน์ที่แสดง */
const visibleColumns2 = ref<string[]>([
"no",
@ -118,6 +119,8 @@ const props = defineProps({
filterKeyword2: String,
});
const modalCommand = ref<boolean>(false);
/**
* งกนการ Selected Data
*/
@ -131,34 +134,15 @@ const checkSelected = computed(() => {
function saveOrder() {
dialogConfirm(
$q,
() => Ordersave(),
() => {
modalCommand.value = true;
props.closeModal?.();
},
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
);
}
//
async function Ordersave() {
const id = selected.value.map((r) => r.id);
const body = {
id,
};
showLoader();
await http
.post(config.API.outReport, body)
.then((res: any) => {
success($q, "ส่งไปออกคำสั่งสำเร็จ");
props.closeModal?.();
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
props.fecthlistRecevice?.();
hideLoader();
});
}
const emit = defineEmits(["update:filterKeyword2", "update:selected"]);
function updateInput(value: any) {
emit("update:filterKeyword2", value);
@ -275,4 +259,10 @@ watchEffect(() => {
</q-card-actions>
</q-card>
</q-dialog>
<DialogCreateCommand
v-model:modal="modalCommand"
:command-type-code="'C-PM-18'"
:persons-id="selected.map((r) => r.id)"
/>
</template>

View file

@ -309,7 +309,7 @@ onMounted(async () => {
lazy-rules
mask="###,###,###,###"
reverse-fill-mask
class="inputgreen"
:class="getClass(edit)"
/>
</div>
</div>

View file

@ -1,21 +1,20 @@
<script setup lang="ts">
import { ref, computed, watchEffect } from "vue";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
/** use */
const $q = useQuasar();
const selected = ref<ResponseItems[]>([]);
const mixin = useCounterMixin();
const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin;
const { dialogConfirm } = mixin;
/** props*/
const props = defineProps({
@ -26,16 +25,14 @@ const props = defineProps({
filterKeyword2: String,
});
/**
* งกนการ Selected Data
*/
/** ฟังก์ชั่นการ Selected Data*/
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
/** คอลัมน์ */
//Table
const columns2 = ref<QTableProps["columns"]>([
{
name: "no",
@ -136,8 +133,6 @@ const columns2 = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
/** คอลัมน์ที่แสดง */
const visibleColumns2 = ref<string[]>([
"no",
"prefix",
@ -150,36 +145,20 @@ const visibleColumns2 = ref<string[]>([
"statustext",
]);
const modalCommand = ref<boolean>(false);
/** popup ยืนยันส่งัว */
function saveOrder() {
dialogConfirm(
$q,
() => Ordersave(),
() => {
props.closeModal?.();
modalCommand.value = true;
},
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
);
}
/** ส่งไปออกคำสั่ง */
async function Ordersave() {
const id = selected.value.map((r) => r.id);
const body = {
id,
};
showLoader();
await http
.post(config.API.resignReport, body)
.then((res: any) => {
success($q, "ส่งไปออกคำสั่งลาออกสำเร็จ");
props.closeModal?.();
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
props.fecthlist?.();
hideLoader();
});
}
const emit = defineEmits(["update:filterKeyword2", "update:selected"]);
function updateInput(value: any) {
@ -305,4 +284,10 @@ watchEffect(() => {
</q-card-actions>
</q-card>
</q-dialog>
<DialogCreateCommand
v-model:modal="modalCommand"
:command-type-code="'C-PM-17'"
:persons-id="selected.map((r) => r.id)"
/>
</template>

View file

@ -1183,7 +1183,7 @@ onMounted(async () => {
:borderless="!edit"
v-model="location"
:rules="[
(val) => !!val || `${'กรุณากรอกสถานที่ยื่นขอลาออกจากราชการ'}`,
(val:string) => !!val || `${'กรุณากรอกสถานที่ยื่นขอลาออกจากราชการ'}`,
]"
hide-bottom-space
:label="`${'สถานที่ยื่นขอลาออกจากราชการ'}`"
@ -1214,7 +1214,7 @@ onMounted(async () => {
:borderless="!edit"
:model-value="date !== null ? date2Thai(date) : null"
:rules="[
(val) =>
(val:string) =>
!!val || `${'กรุณาเลือก วันที่ยื่นขอลาออกจากราชการ'}`,
]"
hide-bottom-space
@ -1247,7 +1247,7 @@ onMounted(async () => {
:borderless="!edit"
v-model="reason"
:rules="[
(val) => !!val || `${'กรุณากรอกเหตุผลที่ลาออกจากราชการ'}`,
(val:string) => !!val || `${'กรุณากรอกเหตุผลที่ลาออกจากราชการ'}`,
]"
hide-bottom-space
:label="`${'เหตุผลที่ลาออกจากราชการ (หมายเหตุแนวตั้ง)'}`"

View file

@ -235,7 +235,7 @@ async function getListCommandDraf() {
await http
.get(
config.API.commandList +
`?page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}&year=${commandYear.value}&keyword=${filter.value}&status=DRAFT`
`?page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}&year=${commandYear.value}&keyword=${filter.value}&status=DRAFT&commandTypeId=${commandType.value}`
)
.then(async (res) => {
totalList.value = Math.ceil(
@ -280,6 +280,15 @@ watch(modal, () => {
fetchCommandType();
}
});
watch(
() => selectCreate.value,
async () => {
if (selectCreate.value == "DRAF") {
getListCommandDraf();
}
}
);
</script>
<template>