รายละเอียดคำสั่ง => API
This commit is contained in:
parent
d21be61715
commit
5316a945a8
5 changed files with 343 additions and 84 deletions
|
|
@ -1,8 +1,12 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRoute } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useCommandDetail } from "@/modules/18_command/store/DetailStore";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { DataOption } from "@/modules/18_command/interface/index/Main";
|
||||
|
|
@ -10,23 +14,33 @@ import type { DataOption } from "@/modules/18_command/interface/index/Main";
|
|||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
const $q = useQuasar();
|
||||
const { dialogConfirm, dialogMessageNotify } = useCounterMixin();
|
||||
const route = useRoute();
|
||||
const store = useCommandDetail();
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
dialogConfirm,
|
||||
dialogMessageNotify,
|
||||
} = useCounterMixin();
|
||||
|
||||
const step = ref<number>(4); //ขั้นตอนการลงนาม
|
||||
const commandId = ref<string>(route.params.id.toString()); //ID คำสั่ง
|
||||
|
||||
const { fetchData } = defineProps({
|
||||
fetchData: { type: Function, require: true },
|
||||
});
|
||||
const step = defineModel<number>("step", { required: true }); //ขั้นตอนการลงนาม
|
||||
|
||||
//แบบร่าง
|
||||
const isDraft = ref<boolean>(false); //ทำแบบร่างเสร็จสิ้น
|
||||
const isCheckDraft = defineModel<boolean>("isDraft", { required: true });
|
||||
|
||||
// แบบร่าง
|
||||
const isCheckDraft = ref<boolean>(true); //เช็คทำแบบร่างเสร็จสิ้น
|
||||
const isAttachment = ref<boolean>(true); //เช็คบัญชีแนบท้าย
|
||||
const isAttachment = defineModel<boolean>("isAttachment", { required: true }); //เช็คบัญชีแนบท้าย
|
||||
const fileUploadOrder = ref<any>(null); //ไฟล์คำสั่ง
|
||||
const fileUploadTailer = ref<any>(null); //ไฟล์เอกสารแนบท้าย
|
||||
const fileOrder = ref<any>(null); //ไฟล์คำสั่ง
|
||||
const fileTailer = ref<any>(null); //ไฟล์เอกสารแนบท้าย
|
||||
const orderNo = ref<string>(""); //เลขที่คำสั่ง
|
||||
const affectDate = ref<Date | null>(null); //วันที่ลงนาม
|
||||
const excecuteDate = ref<Date | null>(null); //วันที่คำสั่งมีผล
|
||||
|
||||
const modalSelect = ref<boolean>(false); //popup เลือกผู้บังคับบัญชา/ผู้มีอำนาจออกคำสั่ง
|
||||
const typeFilter = ref<string>("firstname");
|
||||
const search = ref<string>("");
|
||||
|
|
@ -98,10 +112,11 @@ const isCheckOrder = ref<boolean>(true); //เช็ครอออกคำส
|
|||
*/
|
||||
function onConfirmDraft() {
|
||||
if (
|
||||
orderNo.value !== "" ||
|
||||
affectDate.value !== null ||
|
||||
excecuteDate.value !== null
|
||||
store?.dataCommand?.commandNo !== "" &&
|
||||
store?.dataCommand?.commandAffectDate !== null &&
|
||||
store?.dataCommand?.commandExcecuteDate !== null
|
||||
) {
|
||||
modalSelect.value = true;
|
||||
} else {
|
||||
dialogMessageNotify(
|
||||
$q,
|
||||
|
|
@ -115,10 +130,23 @@ function onSearchData() {}
|
|||
function onConfirmSendToCommander() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => {
|
||||
step.value++;
|
||||
isCheckDraft.value = true;
|
||||
onCloseDialog();
|
||||
async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.command + `/draft/${commandId.value}`, {
|
||||
sign: true,
|
||||
})
|
||||
.then(async () => {
|
||||
await fetchData?.();
|
||||
isCheckDraft.value = true;
|
||||
onCloseDialog();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
},
|
||||
"ยืนยันการส่งไปยังผู้บังคับบัญชา/ผู้มีอำนาจ",
|
||||
"คุณต้องการส่งไปยังผู้บังคับบัญชา/ผู้มีอำนาจใช่หรือไม่?"
|
||||
|
|
@ -144,15 +172,17 @@ function onCloseDialog() {
|
|||
modalSelect.value = false;
|
||||
modalComment.value = false;
|
||||
}
|
||||
|
||||
onMounted(() => {});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="q-px-lg q-py-md">
|
||||
<q-timeline color="blue-5">
|
||||
<q-timeline :color="store.status === 'CANCEL' ? 'grey-4' : 'blue-5'">
|
||||
<!-- แบบร่าง -->
|
||||
<q-timeline-entry
|
||||
title="แบบร่าง"
|
||||
:icon="step === 1 ? 'mdi-pencil' : step > 1 ? 'done' : ''"
|
||||
:icon="step === 1 ? 'mdi-pencil' : step > 1 ? 'done' : 'mdi-numeric-1'"
|
||||
>
|
||||
<div class="row q-col-gutter-sm">
|
||||
<div :class="isAttachment ? 'col-12' : 'col-6'">
|
||||
|
|
@ -182,6 +212,7 @@ function onCloseDialog() {
|
|||
</q-btn>
|
||||
</div>
|
||||
<q-file
|
||||
v-if="step === 1"
|
||||
outlined
|
||||
dense
|
||||
v-model="fileUploadOrder"
|
||||
|
|
@ -189,6 +220,7 @@ function onCloseDialog() {
|
|||
hide-bottom-space
|
||||
:rules="[(val:string) => val || 'กรุณาเลือกไฟล์ไฟล์คำสั่ง']"
|
||||
accept=".pdf"
|
||||
:readonly="store.readonly"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="attach_file" />
|
||||
|
|
@ -218,6 +250,7 @@ function onCloseDialog() {
|
|||
</div>
|
||||
|
||||
<q-file
|
||||
v-if="step === 1"
|
||||
outlined
|
||||
dense
|
||||
v-model="fileUploadTailer"
|
||||
|
|
@ -225,22 +258,52 @@ function onCloseDialog() {
|
|||
hide-bottom-space
|
||||
:rules="[(val:string) => val || 'กรุณาเลือกไฟล์เอกสารแนบท้าย']"
|
||||
accept=".pdf"
|
||||
:readonly="store.readonly"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="attach_file" />
|
||||
</template>
|
||||
</q-file>
|
||||
</div>
|
||||
|
||||
<div class="row col-12" v-if="!store.readonly">
|
||||
<q-space />
|
||||
<q-btn
|
||||
icon="mdi-upload"
|
||||
label="อัปโหลดเอกสารส"
|
||||
:color="
|
||||
fileUploadOrder == null ||
|
||||
(isAttachment && fileUploadTailer === null)
|
||||
? 'grey-5'
|
||||
: 'blue-5'
|
||||
"
|
||||
:disable="
|
||||
fileUploadOrder == null ||
|
||||
(isAttachment && fileUploadTailer === null)
|
||||
"
|
||||
>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-12" v-if="!isCheckDraft">
|
||||
<div
|
||||
class="col-12"
|
||||
v-if="!isCheckDraft && fileOrder && (isAttachment || fileTailer)"
|
||||
>
|
||||
<q-btn
|
||||
v-if="!store.readonly"
|
||||
@click.prevent="onConfirmDraft"
|
||||
label="เลือกผู้บังคับบัญชา/ผู้มีอำนาจออกคำสั่ง"
|
||||
color="public"
|
||||
:disable="fileOrder === null || fileTailer === null"
|
||||
:color="
|
||||
fileOrder === null || (isAttachment && fileTailer === null)
|
||||
? 'grey-5'
|
||||
: 'public'
|
||||
"
|
||||
:disable="
|
||||
fileOrder === null || (isAttachment && fileTailer === null)
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -249,7 +312,7 @@ function onCloseDialog() {
|
|||
<!-- รอผู้มีอำนาจลงนามอนุมัติ -->
|
||||
<q-timeline-entry
|
||||
title="รอผู้มีอำนาจลงนามอนุมัติ"
|
||||
:icon="step === 2 ? 'mdi-pencil' : step > 2 ? 'done' : ''"
|
||||
:icon="step === 2 ? 'mdi-pencil' : step > 2 ? 'done' : 'mdi-numeric-2'"
|
||||
:color="step < 2 ? 'grey-4' : ''"
|
||||
>
|
||||
<div class="row q-col-gutter-sm" v-if="isCheckDraft">
|
||||
|
|
@ -273,7 +336,7 @@ function onCloseDialog() {
|
|||
index === rowsAuthority.length - 1 && item.comment === ''
|
||||
"
|
||||
>
|
||||
<q-item-label caption>
|
||||
<q-item-label caption v-if="!store.readonly">
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
|
|
@ -306,7 +369,7 @@ function onCloseDialog() {
|
|||
<!-- รอออกคำสั่ง -->
|
||||
<q-timeline-entry
|
||||
title="รอออกคำสั่ง"
|
||||
:icon="step === 3 ? 'mdi-pencil' : step > 3 ? 'done' : ''"
|
||||
:icon="step === 3 ? 'mdi-pencil' : step > 3 ? 'done' : 'mdi-numeric-3'"
|
||||
:color="step < 3 ? 'grey-4' : ''"
|
||||
>
|
||||
<!-- <div class="row q-col-gutter-sm" v-if="isCheckAuthority">
|
||||
|
|
@ -317,10 +380,10 @@ function onCloseDialog() {
|
|||
<!-- รอออกคำสั่ง -->
|
||||
<q-timeline-entry
|
||||
title="ออกคำสั่งเสร็จสิ้น"
|
||||
:icon="step === 4 ? 'mdi-pencil' : step > 4 ? 'done' : ''"
|
||||
:icon="step === 4 ? 'mdi-pencil' : step > 4 ? 'done' : 'mdi-numeric-4'"
|
||||
:color="step < 4 ? 'grey-4' : ''"
|
||||
>
|
||||
<div class="row q-col-gutter-sm" v-if="isCheckOrder">
|
||||
<div class="row q-col-gutter-sm" v-if="step === 4">
|
||||
<div class="q-pa-md q-gutter-sm">
|
||||
<q-btn
|
||||
color="blue-5"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue