- ผูก api ออกคำสั่งให้ครบ loop

- แก้ label
This commit is contained in:
Warunee Tamkoo 2023-08-21 18:31:23 +07:00
parent b1c37ad2e0
commit 8f16fadeea
9 changed files with 196 additions and 86 deletions

View file

@ -29,6 +29,7 @@ const config = ref<any>({
// API_PROBATION_URI: "https://ehr.joolsoft.com/v1",
API_PROBATION_URI: "https://bmaehr.joolsoft.com/nodeapi/v1",
// API_PROBATION_URI: "http://192.168.1.151:7776/v1",
API_REPORT2_URI: "https://bma-ehr.frappet.synology.me/api/v2",
},
test: {
API_URI: "http://localhost:5010/api/v1",
@ -50,6 +51,7 @@ const config = ref<any>({
MEET_URI: "meet.frappet.com",
API_RETIREMENT_URI: `${window.location.protocol}//${window.location.host}/api/v1`,
API_PROBATION_URI: "https://bmaehr.joolsoft.com/nodeapi/v1",
API_REPORT2_URI: `${window.location.protocol}//${window.location.host}/api/v2`,
},
});
@ -78,6 +80,9 @@ const API_URI_ORG_TREE = ref<string>(config.value[env.value].API_URI_ORG_TREE);
const API_PROBATION_URI = ref<string>(
config.value[env.value].API_PROBATION_URI
);
const API_REPORT2_URI = ref<string>(
config.value[env.value].API_REPORT2_URI
);
export default {
env: env.value,
@ -93,4 +98,5 @@ export default {
MEET_URI: MEET_URI.value,
API_RETIREMENT_URI: API_RETIREMENT_URI.value,
API_PROBATION_URI: API_PROBATION_URI.value,
API_REPORT2_URI: API_REPORT2_URI.value,
};

View file

@ -0,0 +1,10 @@
/**
* api
*/
import env from "../index";
const reportOrder = `${env.API_REPORT2_URI}/report/order`;
export default {
reportOrderCover: (fileType: string, id: string) => `${reportOrder}/cover/${fileType}/${id}`,
reportOrderAttachment: (fileType: string, id: string) => `${reportOrder}/attachment/${fileType}/${id}`,
};

View file

@ -40,6 +40,9 @@ import insignia from "./api/07_insignia/api.insignia";
/** API dashboard */
import message from "./api/00_dashboard/api.message";
/** API reports */
import reports from "./api/reports/api.report";
// environment variables
export const compettitivePanel = import.meta.env.VITE_COMPETITIVE_EXAM_PANEL;
export const qualifyDisableExamPanel = import.meta.env
@ -80,6 +83,9 @@ const API = {
//dashboard
...message,
//reports
...reports,
};
export default {

View file

@ -47,7 +47,7 @@
<q-card bordered class="row col-12 text-dark q-mt-sm">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark">
แกไขขอมลเพอลงบญช
แกไขขอมลเพอลงบญชแนบทาย
</div>
<q-space />
<div class="q-gutter-sm" v-if="!edit">

View file

@ -1,6 +1,7 @@
<template>
<div class="toptitle text-dark col-12 row items-center">
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" @click="router.go(-1), destroyLocalStorage()" />
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm"
@click="router.go(-1), destroyLocalStorage()" />
ออกคำส
</div>
<q-card flat bordered class="col-12 q-my-sm q-mt-sm">
@ -60,7 +61,7 @@ onUnmounted(() => {
const nextStep = async () => {
stepper.value!.next();
localStorage.setItem("currentStep", step.value.toString());
localStorage.setItem("currentStep", (step.value + 1).toString());
if (orderId.value) {
await http
.put(config.API.nextStep(orderId.value))
@ -74,7 +75,7 @@ const nextStep = async () => {
};
const previousStep = async () => {
stepper.value!.previous();
localStorage.setItem("currentStep", step.value.toString());
localStorage.setItem("currentStep", (step.value - 1).toString());
if (orderId.value) {
await http
.put(config.API.prevStep(orderId.value))

View file

@ -203,20 +203,22 @@ onMounted(async () => {
fecthTypeOption("noData");
}
});
watch(byOrder, async () => {
await http
.get(config.API.approverOC(byOrder.value))
.then((res: any) => {
CommandOption.value = res.data.result;
console.log(CommandOption.value);
// console.log(CommandOption.value);
})
.catch((e: any) => {
console.log(e);
});
});
watch(nameCommand, async () => {
console.log(nameCommand.value);
console.log(positionCommand.value);
// console.log(nameCommand.value);
// console.log(positionCommand.value);
if (positionCommand.value === "" || positionCommand.value === undefined) {
positionCommand.value = nameCommand.value.positionName;
@ -250,12 +252,13 @@ const fecthTypeOption = async (actions: string) => {
hideLoader();
});
};
const fetchdetailOrder = async () => {
let orderIdString = orderId.toString();
await http
.get(config.API.detailOrder(orderIdString))
.then((res: any) => {
console.log(typeOrderOption.value);
// console.log(typeOrderOption.value);
const data = res.data.result;
typeOrder.value = typeOrderOption.value.find(
@ -268,7 +271,7 @@ const fetchdetailOrder = async () => {
byOrder.value = data.orderBy;
nameCommand.value = data.signatoryBy;
positionCommand.value = data.signatoryPosition;
console.log(nameCommand.value);
// console.log("nameCommand===>",nameCommand.value);
examRound.value = data.examRound;
conclusionRegisterNo.value = data.conclusionRegisterNo;
@ -307,6 +310,19 @@ const fecthExamRoundOption = async () => {
};
const submit = async () => {
console.log("nameCommand ===>", nameCommand.value);
let signBy = null;
if (!nameCommand.value.length) {
signBy = await nameCommand.value.name;
} else {
const name2 = await CommandOption.value.find((x: any) => x.id == nameCommand.value.id);
signBy = await name2?.name;
console.log("signBy", signBy);
}
const orderByOrganizationName = await byOrderOption.value.find((x:any)=>x.id == byOrder.value)?.name;
const formdata = {
orderTypeValue: typeOrder.value.id,
orderTitle: nameOrder.value,
@ -315,13 +331,30 @@ const submit = async () => {
orderYear: dateYear.value,
orderDate: dateCommand.value,
orderBy: byOrder.value,
orderByOrganizationName: orderByOrganizationName,
registerPosition: "",
signatoryBy:
nameCommand.value.id === undefined
? nameCommand.value
: nameCommand.value.id,
signatoryBy: signBy,
signatoryPosition: positionCommand.value,
};
// {
// "orderTypeValue": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
// "orderTitle": "string",
// "orderNo": "string",
// "orderYear": 0,
// "orderDate": "2023-08-21T09:46:54.354Z",
// "orderBy": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
// "orderByOrganizationName": "string",
// "signatoryBy": "string",
// "signatoryPosition": "string",
// "examRound": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
// "registerPosition": "string",
// "conclusionRegisterNo": "string",
// "conclusionRegisterDate": "2023-08-21T09:46:54.354Z",
// "conclusionResultNo": "string",
// "conclusionResultDate": "2023-08-21T09:46:54.354Z"
// }
if (
typeOrder.value.commandCode == "C-PM-01" ||
typeOrder.value.commandCode == "C-PM-02" ||
@ -448,7 +481,7 @@ const updateOrder = async (formData: Object, orderId: string) => {
.then((res) => {
console.log(res);
next();
success($q, "แก้ไขข้อมูลสำเร็จ");
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
@ -486,7 +519,8 @@ const getClass = (val: boolean) => {
</div>
<div class="row col-xs-7 col-md-3 q-col-gutter-x-xs">
<div class="col-6">
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="command" hide-bottom-space :label="`${'คำสั่งเลขที่'}`"/>
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="command" hide-bottom-space
:label="`${'คำสั่งเลขที่'}`" />
</div>
<label class="col-1 flex justify-center items-center text-bold">/</label>
<div class="col-5">
@ -527,7 +561,7 @@ const getClass = (val: boolean) => {
<selector :class="getClass(true)" outlined dense lazy-rules v-model="byOrder"
:rules="[(val: string) => !!val || `${'กรุณาเลือกคำสั่งโดย'}`]" emit-value hide-bottom-space
:label="`${'คำสั่งโดย'}`" map-options option-label="name" :options="byOrderOption" option-value="id" use-input
input-debounce="0" @update:model-value="(nameCommand = ''), (positionCommand = '')" />
input-debounce="0" @update:model-value="(nameCommand = ''), (positionCommand = ''), (console.log(byOrder))" />
</div>
<div class="col-xs-12 col-md-6">
<selector :class="getClass(true)" outlined dense lazy-rules v-model="nameCommand"
@ -1009,7 +1043,7 @@ const getClass = (val: boolean) => {
:rules="[(val) => !!val || `${'กรุณากรอกให้ดำรงตำแหน่ง ณ'}`]" :label="`${'ให้ดำรงตำแหน่ง ณ'}`"
hide-bottom-space />
</div>
<div class="col-xs-12 col-md-4">
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="experimentOc" :rules="[
(val) =>
@ -1019,58 +1053,58 @@ const getClass = (val: boolean) => {
</div>
<div class="col-md-4"></div>
<div class="col-xs-12 col-md-4">
<datepicker menu-class-name="modalfix" v-model="experimentformDate" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0">
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input outlined dense class="full-width datepicker" :model-value="experimentformDate != null
? date2Thai(experimentformDate)
: null
" :label="`${'ทดลองปฏิบัติหน้าที่ราชการตั้งแต่วันที่ '}`" :rules="[
<div class="col-xs-12 col-md-4">
<datepicker menu-class-name="modalfix" v-model="experimentformDate" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0">
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input outlined dense class="full-width datepicker" :model-value="experimentformDate != null
? date2Thai(experimentformDate)
: 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>
<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-4">
<datepicker menu-class-name="modalfix" v-model="experimenttoDate" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0">
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input outlined dense class="full-width datepicker" :model-value="experimenttoDate != null ? date2Thai(experimenttoDate) : null
" :label="`${'ทดลองปฏิบัติหน้าที่ราชการถึงวันที่ '}`" :rules="[
<div class="col-xs-12 col-md-4">
<datepicker menu-class-name="modalfix" v-model="experimenttoDate" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0">
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input outlined dense class="full-width datepicker" :model-value="experimenttoDate != null ? date2Thai(experimenttoDate) : 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-md-4"></div>
<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-md-4"></div>
<div class="col-xs-12 col-md-4">
<selector :class="getClass(true)" outlined dense lazy-rules v-model="chairman"
@ -1097,7 +1131,9 @@ const getClass = (val: boolean) => {
typeOrder.commandCode === 'C-PM-12'
">
<div class="col-xs-12 col-md-4">
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="committeeOc" :rules="[(val) => !!val || `${'กรุณาเลือกชื่อหน่วยงาน (อนุสนธิคำสั่ง)'}`]" :label="`${'ชื่อหน่วยงาน (อนุสนธิคำสั่ง)'}`" hide-bottom-space />
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="committeeOc"
:rules="[(val) => !!val || `${'กรุณาเลือกชื่อหน่วยงาน (อนุสนธิคำสั่ง)'}`]"
:label="`${'ชื่อหน่วยงาน (อนุสนธิคำสั่ง)'}`" hide-bottom-space />
<!-- <selector :class="getClass(true)" outlined dense lazy-rules v-model="committeeOc"
:rules="[(val: string) => !!val || `${'กรุณาเลือกหน่วยงาน (อนุสนธิคำสั่ง)'}`]" hide-bottom-space
@ -1105,7 +1141,9 @@ const getClass = (val: boolean) => {
:options="committeeOcOption" option-value="id" use-input input-debounce="0" /> -->
</div>
<div class="col-xs-12 col-md-4">
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="committeeOrder" :rules="[(val) => !!val || `${'กรุณาเลือกอนุสนธิคำสั่งที่'}`]" :label="`${'อนุสนธิคำสั่งที่'}`" hide-bottom-space />
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="committeeOrder"
:rules="[(val) => !!val || `${'กรุณาเลือกอนุสนธิคำสั่งที่'}`]" :label="`${'อนุสนธิคำสั่งที่'}`"
hide-bottom-space />
<!-- <selector :class="getClass(true)" outlined dense lazy-rules v-model="committeeOrder"
:rules="[(val: string) => !!val || `${'กรุณาเลือกอนุสนธิคำสั่งที่'}`]" hide-bottom-space
@ -1137,7 +1175,8 @@ const getClass = (val: boolean) => {
<!-- C-PM-13 -->
<div class="row col-6 q-col-gutter-x-lg q-col-gutter-y-md" v-if="typeOrder.commandCode === 'C-PM-13'">
<div class="col-xs-12 col-md-12">
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="receiveOc" :rules="[(val) => !!val || `${'กรุณาเลือกชื่อหน่วยงาน'}`]" :label="`${'ชื่อหน่วยงาน'}`" hide-bottom-space />
<q-input :class="getClass(true)" outlined dense lazy-rules v-model="receiveOc"
:rules="[(val) => !!val || `${'กรุณาเลือกชื่อหน่วยงาน'}`]" :label="`${'ชื่อหน่วยงาน'}`" hide-bottom-space />
<!-- <selector :class="getClass(true)" outlined dense lazy-rules v-model="receiveOc"
:rules="[(val: string) => !!val || `${'กรุณาเลือกหน่วยงาน'}`]" hide-bottom-space
@ -1222,6 +1261,8 @@ const getClass = (val: boolean) => {
</div>
</template>
<style>.q-field--with-bottom {
<style>
.q-field--with-bottom {
padding-bottom: 0px;
}</style>
}
</style>

View file

@ -114,7 +114,7 @@ const getData = async (id: string) => {
.get(config.API.personsselectedOrder(id))
.then((res) => {
const data = res.data.result;
console.log(data);
// console.log(data);
let list: ResponseData[] = [];
data.map((r: ResponseData) => {
list.push({

View file

@ -260,7 +260,7 @@ const saveData = async () => {
.post(config.API.copyOrderPersonsId(id), selectedModal.value)
.then((res) => {
// const data = res.data.result;
console.log(res);
// console.log(res);
})
.catch((e) => {
messageError($q, e);

View file

@ -10,7 +10,7 @@ import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin();
const { date2Thai, messageError, showLoader, hideLoader, dialogConfirm } = mixin;
const { date2Thai, messageError, showLoader, hideLoader, dialogConfirm, success } = mixin;
const route = useRoute();
const $q = useQuasar();
@ -26,40 +26,82 @@ const date = ref<Date>(new Date());
const fileOrder = ref<any>(null);
const fileTailer = ref<any>(null);
const OrderPDF = ref<string>("");
const TailerPDF = ref<string>("");
const OrderPDFUpload = ref<string>("");
const TailerPDFUpload = ref<string>("");
const orderCoverPdf = ref<string>("");
const orderCoverDocs = ref<string>("");
const orderAttachmentPdf = ref<string>("");
const orderAttachmentXlsx = ref<string>("");
const statusOrder = ref<string>();
const orderId = ref<string>(orderId_params.toString());
onMounted(async () => {
if (orderId.value) {
fetchReportCover('pdf', orderId.value);
fetchReportCover('docx', orderId.value);
fetchReportAttachment('pdf', orderId.value);
fetchReportAttachment('xlsx', orderId.value);
fetchAttachment(orderId.value);
fecthstatusOrder(orderId.value);
}
});
const fetchReportCover = async (type: string, orderId: string) => {
showLoader();
await http
.get(config.API.reportOrderCover(type, orderId))
.then(async (res) => {
if (type == 'pdf') {
orderCoverPdf.value = res.data.result;
viewPDF(orderCoverPdf.value);
} else {
orderCoverDocs.value = res.data.result;
}
})
.catch((e) => {
// messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const fetchReportAttachment = async (type: string, orderId: string) => {
showLoader();
await http
.get(config.API.reportOrderAttachment(type, orderId))
.then(async (res) => {
if (type == 'pdf') {
orderAttachmentPdf.value = res.data.result;
} else {
orderAttachmentXlsx.value = res.data.result;
}
})
.catch((e) => {
// messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const fetchAttachment = async (orderId: string) => {
showLoader();
await http
.get(config.API.attachmentOrder(orderId))
.then(async (res) => {
let response = res.data.result;
// console.log(response);
order.value = response.orderNo;
years.value = Number(response.orderYear);
if (response.date !== undefined) {
date.value = response.date;
}
if (response.orderFileUrl !== null) {
// OrderPDF.value = response.orderFileUrl;
OrderPDFUpload.value = response.orderFileUrl;
viewPDF(OrderPDF.value);
}
if (response.attachmentFileUrl !== null) {
// TailerPDF.value = response.attachmentFileUrl;
TailerPDFUpload.value = response.attachmentFileUrl;
}
})
@ -70,6 +112,7 @@ const fetchAttachment = async (orderId: string) => {
hideLoader();
});
};
const fecthstatusOrder = async (orderId: string) => {
await http
.get(config.API.orderReady(orderId))
@ -78,7 +121,7 @@ const fecthstatusOrder = async (orderId: string) => {
statusOrder.value = status.result;
})
.catch((e) => {
console.log(e);
messageError($q, e);
});
};
const viewPDF = async (pdf: string) => {
@ -104,10 +147,10 @@ const viewPDFUpload = async (pdf: string) => {
watch(tab, () => {
// console.log(tab.value);
if (tab.value === "main") {
viewPDF(OrderPDF.value);
viewPDF(orderCoverPdf.value);
}
if (tab.value === "second") {
viewPDF(TailerPDF.value);
viewPDF(orderAttachmentPdf.value);
}
});
@ -159,6 +202,7 @@ const save = () => {
});
}
};
const putOrderData = async () => {
const orderData = {
orderNo: order.value,
@ -168,10 +212,10 @@ const putOrderData = async () => {
await http
.put(config.API.attachmentOrder(orderId.value), orderData)
.then((res) => {
console.log(res);
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
console.log(e);
messageError($q, e);
});
};
@ -246,11 +290,11 @@ const viewFileUpload = async (url: string) => {
<q-tooltip>ดาวนโหลด</q-tooltip>
<q-menu>
<q-list style="min-width: 150px">
<q-item clickable v-close-popup>
<q-item clickable v-close-popup type="a" :href="orderCoverPdf" target="_blank">
<q-item-section avatar><q-icon color="red" name="mdi-file-pdf" /></q-item-section>
<q-item-section>ไฟล .PDF</q-item-section>
</q-item>
<q-item clickable v-close-popup>
<q-item clickable v-close-popup type="a" :href="orderCoverDocs" 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>
@ -265,11 +309,11 @@ const viewFileUpload = async (url: string) => {
<q-tooltip>ดาวนโหลด</q-tooltip>
<q-menu>
<q-list style="min-width: 150px">
<q-item clickable v-close-popup>
<q-item clickable v-close-popup type="a" :href="orderAttachmentPdf" target="_blank">
<q-item-section avatar><q-icon color="red" name="mdi-file-pdf" /></q-item-section>
<q-item-section>ไฟล .PDF</q-item-section>
</q-item>
<q-item clickable v-close-popup>
<q-item clickable v-close-popup type="a" :href="orderAttachmentXlsx" target="_blank">
<q-item-section avatar><q-icon color="green-7" name="mdi-file-excel" /></q-item-section>
<q-item-section>ไฟล .xls</q-item-section>
</q-item>
@ -332,7 +376,8 @@ const viewFileUpload = async (url: string) => {
@click="viewFileUpload(OrderPDFUpload)">
<q-tooltip>ไฟลคำส</q-tooltip>
</q-btn>
<q-btn type="a" :href="OrderPDFUpload" size="12px" flat dense color="red" icon="mdi-download" target="_blank">
<q-btn type="a" :href="OrderPDFUpload" size="12px" flat dense color="red" icon="mdi-download"
target="_blank">
<q-tooltip>ดาวนโหลดเอกสารแนบทาย</q-tooltip>
</q-btn>
</div>
@ -350,7 +395,8 @@ const viewFileUpload = async (url: string) => {
@click="viewFileUpload(TailerPDFUpload)">
<q-tooltip>ไฟลคำส</q-tooltip>
</q-btn>
<q-btn type="a" :href="TailerPDFUpload" size="12px" flat dense color="red" icon="mdi-download" target="_blank">
<q-btn type="a" :href="TailerPDFUpload" size="12px" flat dense color="red" icon="mdi-download"
target="_blank">
<q-tooltip>ดาวนโหลดเอกสารแนบทาย</q-tooltip>
</q-btn>
</div>