เพิ่มคำสั่งแต่งตั้ง เลื่อน ย้ายจากราชกิจจาฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-07-18 11:57:30 +07:00
parent db8046efdb
commit fa13be0a3e
10 changed files with 217 additions and 117 deletions

View file

@ -192,7 +192,9 @@ const baseColumns = ref<QTableColumn[]>([
field: "commandNo",
format(val, row) {
return row.commandNo && row.commandYear
? `${row.commandNo}/${Number(row.commandYear) + 543}`
? row.commandType !== "C-PM-47"
? `${row.commandNo}/${Number(row.commandYear) + 543}`
: `${row.commandNo}`
: "";
},
headerStyle: "font-size: 14px",
@ -968,7 +970,8 @@ onMounted(async () => {
v-if="isLeave == false && checkPermission($route)?.attrIsUpdate"
flat
:disable="
props.row.commandId !== null && props.row.commandId !== ''
(props.row.commandId !== null && props.row.commandId !== '') ||
props.row.commandType === 'C-PM-47'
"
:color="props.row.commandId ? 'grey' : 'edit'"
dense

View file

@ -197,7 +197,9 @@ const baseColumns = ref<QTableColumn[]>([
field: "commandNo",
format(val, row) {
return row.commandNo && row.commandYear
? `${row.commandNo}/${Number(row.commandYear) + 543}`
? row.commandType !== "C-PM-47"
? `${row.commandNo}/${Number(row.commandYear) + 543}`
: `${row.commandNo}`
: "";
},
headerStyle: "font-size: 14px",
@ -928,7 +930,8 @@ onMounted(async () => {
v-if="isLeave == false && checkPermission($route)?.attrIsUpdate"
flat
:disable="
props.row.commandId !== null && props.row.commandId !== ''
(props.row.commandId !== null && props.row.commandId !== '') ||
props.row.commandType === 'C-PM-47'
"
:color="props.row.commandId ? 'grey' : 'edit'"
dense

View file

@ -277,6 +277,7 @@ function sendToCommand() {
/** ฟังก์ชันเลือกประเภทคำสั่ง */
function filterSelectOrder() {
const data = rowsData.value;
selected.value = [];
rows.value = data.filter((v: PersonData) => {
switch (commandType.value) {
@ -289,6 +290,8 @@ function filterSelectOrder() {
case "C-PM-07":
return v.typeCommand === "MOVE";
case "C-PM-47":
return v.posTypeName === "บริหาร" || v.posTypeName === "อำนวยการ";
default:
return [];
}
@ -329,7 +332,10 @@ watch(
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"
e.code === "C-PM-05" ||
e.code === "C-PM-39" ||
e.code === "C-PM-07" ||
e.code === "C-PM-47"
);
}
}

View file

@ -40,7 +40,10 @@ const props = defineProps({
const commandOp = ref<ListCommand[]>([]); //
const commandType = ref<string>(""); //
const commandNo = ref<string>(""); //
const commandCode = ref<string>(""); //
const commandYear = ref<number>(new Date().getFullYear()); //
const commandVolume = ref<string>(""); //
const commandChapter = ref<string>(""); //
const rows = ref<DataListCommand[]>([]); //
const selected = ref<DataOrder[]>([]); // id
@ -189,7 +192,10 @@ function createCommand(isRedirect: boolean) {
const body = {
commandYear: commandYear.value,
commandNo: commandNo.value,
commandNo:
commandCode.value !== "C-PM-47"
? commandNo.value
: `${commandVolume.value}/${commandChapter.value}`,
commandTypeId: commandType.value,
persons: !props.notPerson ? data : [],
};
@ -284,6 +290,8 @@ function clearValue() {
selectCreate.value = "NEW";
selected.value = [];
filter.value = "";
commandVolume.value = "";
commandChapter.value = "";
}
/** ฟังก์ชันดึงข้อมูลคำสั่ง */
@ -294,6 +302,7 @@ async function fetchCommandType() {
(v: ListCommand) => v.code == props.commandTypeCode
);
commandType.value = commandOp.value[0].id;
commandCode.value = commandOp.value[0].code;
}
/**
@ -374,7 +383,7 @@ watch(
<q-separator />
<div v-if="selectCreate == 'NEW'" class="row q-mt-sm q-col-gutter-sm">
<div class="col-12">
<div class="col-12 q-col-gutter-sm">
<q-select
class="inputgreen"
v-model="commandType"
@ -400,53 +409,78 @@ watch(
</template>
</q-select>
</div>
<div class="col-6">
<q-input
class="inputgreen"
outlined
dense
v-model="commandNo"
:label="`${'คำสั่งเลขที่'}`"
/>
</div>
<label class="col-1 flex justify-center items-center text-bold"
>/</label
>
<div class="col-5">
<datepicker
menu-class-name="modalfix"
v-model="commandYear"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
class="inputgreen"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
:model-value="commandYear == null ? null : commandYear + 543"
:label="`${'พ.ศ.'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
<div class="row col-12 q-col-gutter-sm">
<div class="col-6" v-if="commandCode !== 'C-PM-47'">
<q-input
class="inputgreen"
outlined
dense
v-model="commandNo"
:label="`${'คำสั่งเลขที่'}`"
/>
</div>
<label
class="col-1 flex justify-center items-center text-bold"
v-if="commandCode !== 'C-PM-47'"
>/
</label>
<div class="col-4" v-if="commandCode === 'C-PM-47'">
<q-input
class="inputgreen"
outlined
dense
v-model="commandVolume"
:label="`${'เล่มที่'}`"
/>
</div>
<div class="col-4" v-if="commandCode === 'C-PM-47'">
<q-input
class="inputgreen"
outlined
dense
v-model="commandChapter"
:label="`${'ตอนที่'}`"
/>
</div>
<div :class="commandCode === 'C-PM-47' ? 'col-4' : 'col-5'">
<datepicker
menu-class-name="modalfix"
v-model="commandYear"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
class="inputgreen"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
:model-value="
commandYear == null ? null : commandYear + 543
"
:label="`${'พ.ศ.'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
</div>

View file

@ -10,7 +10,6 @@ import { updateCurrentPage } from "@/utils/function";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type { Pagination } from "@/modules/18_command/interface/index/Main";
import DialogFormCommand from "@/modules/18_command/components/Main/DialogFormCommand.vue";
@ -24,7 +23,6 @@ const {
hideLoader,
success,
messageError,
date2Thai,
dialogRemove,
dialogConfirm,
} = useCounterMixin();

View file

@ -36,6 +36,7 @@ const props = defineProps({
});
const commandId = ref<string>(route.params.id.toString()); //ID
const commandCode = ref<string>(""); //
//
let formData = reactive<FormDataDetail>({
issue: null, //
@ -48,6 +49,8 @@ let formData = reactive<FormDataDetail>({
commandExcecuteDate: null, //
isBangkok: null, //
});
const commandVolume = ref<string>(""); //
const commandChapter = ref<string>(""); //
const modalPreview = ref<boolean>(false); //
const isIdofficer = ref<boolean>(false); // .
@ -73,6 +76,10 @@ async function onSubmit() {
await http
.put(config.API.commandAction(commandId.value, "tab1"), {
...formData,
commandNo:
commandCode.value === "C-PM-47"
? `${commandVolume.value}/${commandChapter.value}`
: formData.commandNo,
commandAffectDate: convertDateToAPI(formData.commandAffectDate),
commandExcecuteDate: convertDateToAPI(formData.commandExcecuteDate),
})
@ -106,6 +113,10 @@ onMounted(async () => {
formData.isBangkok = !isIdofficer.value
? null
: props.formCommandList.isBangkok;
commandCode.value = props.formCommandList.commandCode;
const [volume, chapter] = props.formCommandList.commandNo.split("/");
commandVolume.value = volume || "";
commandChapter.value = chapter || "";
});
</script>
@ -126,62 +137,93 @@ onMounted(async () => {
/>
</div>
<div class="col-4 row">
<div class="col-6">
<q-input
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
outlined
dense
v-model="formData.commandNo"
hide-bottom-space
:label="`${'คำสั่งเลขที่'}`"
@update:model-value="onCheckChangeData()"
/>
</div>
<label class="col-1 flex justify-center items-center text-bold">
/
</label>
<div class="col-5">
<datepicker
v-model="formData.commandYear"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
@update:model-value="onCheckChangeData()"
<div :class="commandCode !== 'C-PM-47' ? 'col-4' : 'col-12'">
<div class="col-12 row q-col-gutter-sm">
<div class="col-6" v-if="commandCode !== 'C-PM-47'">
<q-input
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
outlined
dense
v-model="formData.commandNo"
hide-bottom-space
:label="`${'คำสั่งเลขที่'}`"
@update:model-value="onCheckChangeData()"
/>
</div>
<label
class="col-1 flex justify-center items-center text-bold"
v-if="commandCode !== 'C-PM-47'"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
:model-value="
formData.commandYear == null
? null
: formData.commandYear + 543
"
:label="`${'พ.ศ.'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
/
</label>
<div class="col-4" v-if="commandCode === 'C-PM-47'">
<q-input
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
outlined
dense
v-model="commandVolume"
hide-bottom-space
:label="`${'เล่มที่'}`"
@update:model-value="onCheckChangeData()"
/>
</div>
<div class="col-4" v-if="commandCode === 'C-PM-47'">
<q-input
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
outlined
dense
v-model="commandChapter"
hide-bottom-space
:label="`${'ตอนที่'}`"
@update:model-value="onCheckChangeData()"
/>
</div>
<div :class="commandCode !== 'C-PM-47' ? 'col-5' : 'col-4'">
<datepicker
v-model="formData.commandYear"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
@update:model-value="onCheckChangeData()"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
:model-value="
formData.commandYear == null
? null
: formData.commandYear + 543
"
:label="`${'พ.ศ.'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
</div>
@ -278,7 +320,7 @@ onMounted(async () => {
</div>
<!-- เนอหาคำสงสวนต -->
<div class="col-12">
<div class="col-12" v-if="commandCode !== 'C-PM-47'">
<q-input
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
@ -293,7 +335,7 @@ onMounted(async () => {
</div>
<!-- เนอหาคำสงสวนกลาง -->
<div class="col-12">
<div class="col-12" v-if="commandCode !== 'C-PM-47'">
<q-input
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
@ -310,7 +352,7 @@ onMounted(async () => {
</div>
<!-- เนอหาคำสงสวนทาย -->
<div class="col-12">
<div class="col-12" v-if="commandCode !== 'C-PM-47'">
<q-input
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
@ -324,7 +366,10 @@ onMounted(async () => {
/>
</div>
<div class="col-12 q-gutter-sm" v-if="isIdofficer">
<div
class="col-12 q-gutter-sm"
v-if="isIdofficer && commandCode !== 'C-PM-47'"
>
<q-radio
:disable="store.readonly"
keep-color

View file

@ -30,6 +30,7 @@ interface FormCommandList {
status: string;
commandTypeName: string;
commandNo: string;
commandCode: string;
commandYear: Date | null;
detailHeader: string;
detailBody: string;

View file

@ -17,6 +17,8 @@ interface DataListCommand {
id: string;
status: string;
issue?: string;
commandCode?: string;
commandType?: string;
}
interface DataCommandType {

View file

@ -25,7 +25,11 @@ export const useCommandListStore = defineStore("commandListStore", () => {
sortable: false,
field: "commandNo",
format(val, row) {
return val ? `${val}/${row.commandYear + 543}` : "-";
return val
? row.commandType !== "C-PM-47"
? `${val}/${row.commandYear + 543}`
: `${val}`
: "-";
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",

View file

@ -48,6 +48,7 @@ let formCommandList = reactive<FormCommandList>({
status: "",
commandTypeName: "",
commandNo: "",
commandCode: "",
commandYear: null,
detailHeader: "",
detailBody: "",
@ -77,7 +78,6 @@ async function fetchDataCommandList() {
.get(config.API.commandAction(commandId.value, "tab1"))
.then(async (res) => {
const data = await res.data.result;
formCommandList = data;
statusCheck.value = data.commandCode == "C-PM-10" ? true : false;
store.dataCommand = data;
@ -124,6 +124,7 @@ onMounted(async () => {
<q-card class="q-mt-sm">
<q-card-section style="padding: 0px">
<q-separator />
<q-tabs
v-model="tabs"
inline-label
@ -136,7 +137,10 @@ onMounted(async () => {
:key="index"
:name="tab.name"
:label="tab.label"
:disable="statusCheck && tab.name == 'ListPersons'"
:disable="
(statusCheck && tab.name == 'ListPersons') ||
(commandCode === 'C-PM-47' && tab.name === 'Attached')
"
/>
</q-tabs>
<q-separator />