เพิ่มคำสั่งรักษาการแทนและยกเลิกลาออก
This commit is contained in:
parent
30562f176e
commit
abdbb586c5
2 changed files with 188 additions and 41 deletions
|
|
@ -127,6 +127,10 @@ const result = ref<string>("");
|
|||
const refRaw = ref<string>("");
|
||||
const complaintId = ref<string>("");
|
||||
|
||||
// C-PM-40
|
||||
const actStartDate = ref<Date | null>(null);
|
||||
const actEndDate = ref<Date | null>(null);
|
||||
|
||||
const typeOrderFilter = ref<any>({
|
||||
typeOrderOption: [],
|
||||
});
|
||||
|
|
@ -155,6 +159,34 @@ watch(nameCommand, async () => {
|
|||
positionCommand.value = nameCommand.value.positionName;
|
||||
}
|
||||
});
|
||||
const mainCommandCodes = ref<string[]>([
|
||||
"C-PM-01",
|
||||
"C-PM-02",
|
||||
"C-PM-03",
|
||||
"C-PM-04",
|
||||
"C-PM-05",
|
||||
"C-PM-06",
|
||||
"C-PM-07",
|
||||
"C-PM-08",
|
||||
"C-PM-09",
|
||||
"C-PM-10",
|
||||
"C-PM-11",
|
||||
"C-PM-12",
|
||||
"C-PM-13",
|
||||
"C-PM-14",
|
||||
"C-PM-15",
|
||||
"C-PM-16",
|
||||
"C-PM-17",
|
||||
"C-PM-18",
|
||||
"C-PM-21",
|
||||
"C-PM-22",
|
||||
"C-PM-23",
|
||||
"C-PM-24",
|
||||
"C-PM-38",
|
||||
"C-PM-39",
|
||||
"C-PM-40",
|
||||
"C-PM-41",
|
||||
]);
|
||||
|
||||
const commandCodes = ref<string[]>([
|
||||
"C-PM-19",
|
||||
|
|
@ -180,11 +212,14 @@ const fecthTypeOption = async (actions: string) => {
|
|||
const filterRes = response.filter((e: any) =>
|
||||
commandCodes.value.includes(e.commandCode)
|
||||
);
|
||||
const mainFilterRes = response.filter((e: any) =>
|
||||
mainCommandCodes.value.includes(e.commandCode)
|
||||
);
|
||||
|
||||
const data =
|
||||
orderId_paramsName === "OrderDetail" ||
|
||||
orderId_paramsName === "OrderAdd"
|
||||
? response
|
||||
? mainFilterRes
|
||||
: filterRes;
|
||||
|
||||
typeOrderOption.value = data.map((e: OrederResult) => ({
|
||||
|
|
@ -254,6 +289,7 @@ const fetchdetailOrder = async () => {
|
|||
book.value = data.militaryCommandNo;
|
||||
bookDate.value = data.militaryCommanDate;
|
||||
//10
|
||||
|
||||
if (data.orderTypeCode === "c-pm-10") {
|
||||
nodeTree();
|
||||
}
|
||||
|
|
@ -296,6 +332,9 @@ const fetchdetailOrder = async () => {
|
|||
result.value = data.result;
|
||||
refRaw.value = data.refRaw;
|
||||
complaintId.value = data.complaintId;
|
||||
|
||||
actStartDate.value = data.actStartDate;
|
||||
actEndDate.value = data.actEndDate;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -443,6 +482,10 @@ const selectCMP = async (selectOrder: OrederResult) => {
|
|||
refRaw.value = "";
|
||||
|
||||
complaintId.value = "";
|
||||
|
||||
// 40
|
||||
actStartDate.value = null;
|
||||
actEndDate.value = null;
|
||||
};
|
||||
|
||||
// เรียกรอบการสอบ
|
||||
|
|
@ -622,6 +665,11 @@ const onSubmit = async () => {
|
|||
result: result.value,
|
||||
refRaw: refRaw.value,
|
||||
});
|
||||
} else if (typeOrder.value.commandCode == "C-PM-40") {
|
||||
Object.assign(formdata, {
|
||||
actStartDate: actStartDate.value,
|
||||
actEndDate: actEndDate.value,
|
||||
});
|
||||
}
|
||||
|
||||
// เช็คค่าว่าง
|
||||
|
|
@ -2374,6 +2422,100 @@ const getClass = (val: boolean) => {
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- C-PM-40 -->
|
||||
<div
|
||||
class="row col-12 q-col-gutter-x-lg q-col-gutter-y-md"
|
||||
v-if="typeOrder != null && typeOrder.commandCode === 'C-PM-40'"
|
||||
>
|
||||
<div class="col-xs-12 col-md-3">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="actStartDate"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
:max-date="actEndDate"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
</template>
|
||||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
outlined
|
||||
dense
|
||||
class="full-width datepicker"
|
||||
:model-value="
|
||||
actStartDate != null ? date2Thai(actStartDate) : null
|
||||
"
|
||||
:label="`${'วันที่เริ่มรักษาการ'}`"
|
||||
:rules="[
|
||||
(val) => !!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 class="col-xs-12 col-md-3">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="actEndDate"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
:min-date="actStartDate"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
</template>
|
||||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
outlined
|
||||
dense
|
||||
class="full-width datepicker"
|
||||
:model-value="
|
||||
actEndDate != null ? date2Thai(actEndDate) : null
|
||||
"
|
||||
:label="`${'วันที่สิ้นสุดรักษาการ'}`"
|
||||
:rules="[
|
||||
(val) => !!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>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
|
|
|
|||
|
|
@ -77,23 +77,8 @@ const attachmentStatus = computed(() => {
|
|||
code.value != "c-pm-30" &&
|
||||
code.value != "c-pm-31" &&
|
||||
code.value != "c-pm-32" &&
|
||||
code.value != "c-pm-38"
|
||||
? true
|
||||
: false;
|
||||
});
|
||||
|
||||
// เช็คว่าต้องไป gen report ที่ server เพิ่มไหม code ที่เพิ่มคือคำสั่งใหม่ที่ต้องไป gen report อีกรอบ
|
||||
const genReportStatus = computed(() => {
|
||||
return code.value == "c-pm-19" ||
|
||||
code.value == "c-pm-20" ||
|
||||
code.value == "c-pm-25" ||
|
||||
code.value == "c-pm-26" ||
|
||||
code.value == "c-pm-27" ||
|
||||
code.value == "c-pm-28" ||
|
||||
code.value == "c-pm-29" ||
|
||||
code.value == "c-pm-30" ||
|
||||
code.value == "c-pm-31" ||
|
||||
code.value == "c-pm-32"
|
||||
code.value != "c-pm-38" &&
|
||||
code.value != "c-pm-41"
|
||||
? true
|
||||
: false;
|
||||
});
|
||||
|
|
@ -127,20 +112,20 @@ const downloadCover = async (type: string) => {
|
|||
};
|
||||
|
||||
// โหลด เอกสารแนบท้าย
|
||||
const downloadAttachment = async (type: string) => {
|
||||
// if (type === "xlsx") {
|
||||
// genReportXLSX(
|
||||
// dataAttachmentxlxs.value,
|
||||
// `เอกสารแนบท้าย คำสั่ง ${orderName.value}`,
|
||||
// type
|
||||
// );
|
||||
// } else {
|
||||
genReport(
|
||||
dataAttachment.value,
|
||||
`เอกสารแนบท้าย คำสั่ง ${orderName.value}`,
|
||||
type
|
||||
);
|
||||
// }
|
||||
const downloadAttachment = async (type: string, sub: string = "docx") => {
|
||||
if (sub === "xlsx") {
|
||||
genReportXLSX(
|
||||
dataAttachment.value,
|
||||
`เอกสารแนบท้าย คำสั่ง ${orderName.value}`,
|
||||
type
|
||||
);
|
||||
} else {
|
||||
genReport(
|
||||
dataAttachment.value,
|
||||
`เอกสารแนบท้าย คำสั่ง ${orderName.value}`,
|
||||
type
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const dataCover = ref<any>();
|
||||
|
|
@ -167,7 +152,7 @@ const fetchReportAttachment = async (type: string, orderId: string) => {
|
|||
await http
|
||||
.get(config.API.reportOrderAttachment(type, orderId, code.value))
|
||||
.then(async (res) => {
|
||||
genPDf(res.data.result);
|
||||
genPDf(res.data.result, code.value == "c-pm-40" ? "xlsx" : "docx");
|
||||
dataAttachment.value = res.data.result;
|
||||
})
|
||||
.catch(async (e) => {
|
||||
|
|
@ -187,9 +172,9 @@ const fetchReportAttachment = async (type: string, orderId: string) => {
|
|||
// });
|
||||
};
|
||||
|
||||
function genPDf(data: any) {
|
||||
function genPDf(data: any, type: string = "docx") {
|
||||
axios
|
||||
.post(config.API.reportTemplate + `/docx`, data, {
|
||||
.post(config.API.reportTemplate + `/${type}`, data, {
|
||||
headers: {
|
||||
accept: "application/pdf",
|
||||
"content-Type": "application/json",
|
||||
|
|
@ -539,7 +524,12 @@ const viewFileUpload = async (url: string) => {
|
|||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="downloadAttachment('pdf')"
|
||||
@click="
|
||||
downloadAttachment(
|
||||
'pdf',
|
||||
code == 'c-pm-40' ? 'xlsx' : 'docx'
|
||||
)
|
||||
"
|
||||
>
|
||||
<!-- type="a"
|
||||
:href="orderAttachmentPdf"
|
||||
|
|
@ -552,15 +542,30 @@ const viewFileUpload = async (url: string) => {
|
|||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="downloadAttachment('docx')"
|
||||
@click="
|
||||
downloadAttachment(
|
||||
code == 'c-pm-40' ? 'xlsx' : 'docx',
|
||||
code == 'c-pm-40' ? 'xlsx' : 'docx'
|
||||
)
|
||||
"
|
||||
>
|
||||
<!-- type="a"
|
||||
:href="orderAttachmentXlsx"
|
||||
target="_blank" -->
|
||||
<q-item-section avatar
|
||||
><q-icon color="blue" name="mdi-file-word"
|
||||
/></q-item-section>
|
||||
<q-item-section>ไฟล์ .docx</q-item-section>
|
||||
<q-item-section avatar>
|
||||
<q-icon
|
||||
v-if="code == 'c-pm-40'"
|
||||
color="green"
|
||||
name="mdi-file-excel-outline"
|
||||
/>
|
||||
<q-icon v-else color="blue" name="mdi-file-word" />
|
||||
</q-item-section>
|
||||
<q-item-section
|
||||
>ไฟล์
|
||||
{{
|
||||
code == "c-pm-40" ? ".xlsx" : ".docx"
|
||||
}}</q-item-section
|
||||
>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue