ออกคำสั่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-10-24 16:09:11 +07:00
parent c6acb3e2b8
commit d9561ee830
2 changed files with 151 additions and 82 deletions

View file

@ -103,7 +103,7 @@ const columns = ref<QTableProps["columns"]>([
{ {
name: "datetext", name: "datetext",
align: "left", align: "left",
label: "วันที่ดำเนินการ", label: "วันที่ยื่น",
sortable: true, sortable: true,
field: "datetext", field: "datetext",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",

View file

@ -46,12 +46,11 @@ const {
/** ตัวแปร */ /** ตัวแปร */
const modalPersonal = ref<boolean>(false); const modalPersonal = ref<boolean>(false);
const personId = ref<string>(""); const personId = ref<string>("");
// const roleUser = ref<string>(""); const roleUser = ref<string>("");
const dataProfile = ref<DataProfile>(); const dataProfile = ref<DataProfile>();
const id = ref<string>(route.params.id.toString()); const id = ref<string>(route.params.id.toString());
const myForm = ref<QForm | null>(null); const myForm = ref<QForm | null>(null);
const myFormConfirm = ref<QForm | null>(null);
const edit = ref<boolean>(false); const edit = ref<boolean>(false);
const conditions = ref<boolean>(false); const conditions = ref<boolean>(false);
const dataDetail = ref<any>({ const dataDetail = ref<any>({
@ -95,13 +94,21 @@ const reasonReign = ref<string>("");
const dateBreak = ref<Date | null>(null); const dateBreak = ref<Date | null>(null);
const isCheckData = computed(() => { const isCheckData = computed(() => {
console.log(workflowRef.value?.permission.isOperate);
if ( if (
organizationPositionOld.value !== "" && organizationPositionOld.value !== "" &&
positionTypeOld.value !== "" && positionTypeOld.value !== "" &&
positionLevelOld.value !== "" && positionLevelOld.value !== "" &&
posNo.value !== "" && posNo.value !== "" &&
salary.value !== 0 && salary.value !== 0 &&
date.value !== null date.value !== null &&
(workflowRef.value?.permission.isOperate
? dataDetail.value.commanderReject !== null
: true) &&
(workflowRef.value?.permission.isSign
? dataDetail.value.oligarchReject !== null
: true)
) { ) {
return true; return true;
} else return false; } else return false;
@ -140,8 +147,12 @@ const columns = ref<QTableProps["columns"]>([
]); ]);
/**เปิด-ปิด modal */ /**เปิด-ปิด modal */
const closeModal = () => (modal.value = false); function closeModal() {
const openModal = () => (modal.value = true); modal.value = false;
}
function openModal() {
modal.value = true;
}
const file = ref<any>(null); const file = ref<any>(null);
const fileList = ref<FileList[]>([]); const fileList = ref<FileList[]>([]);
@ -175,8 +186,8 @@ async function fetchData(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.resingByid(id)) .get(config.API.resingByid(id))
.then((res: any) => { .then(async (res) => {
const data = res.data.result; const data = await res.data.result;
dataProfile.value = data as DataProfile; dataProfile.value = data as DataProfile;
let list: TypeFile[] = []; let list: TypeFile[] = [];
@ -215,80 +226,87 @@ async function fetchData(id: string) {
} }
/**Pop up */ /**Pop up */
function popUp(action: "pass" | "passNot") { function popUp(action: "pass" | "passNot", type: string) {
reasonReign.value = ""; reasonReign.value = "";
dateBreak.value = null; dateBreak.value = null;
actionPass.value = action === "pass"; actionPass.value = action === "pass";
roleUser.value = type;
openModal(); openModal();
} }
//pop up //pop up
// function conditionPopup() { function onSubmit() {
// if (myFormConfirm.value !== null) { if (actionPass.value) {
// myFormConfirm.value.validate().then(async (check) => { confirmpopUp();
// if (check) { } else {
// if (actionPass.value) { rejectpopUp();
// await confirmpopUp(); }
// } else {
// await rejectpopUp(); // if (myFormConfirm.value !== null) {
// } // myFormConfirm.value.validate().then(async (check) => {
// } // if (check) {
// });
// } // }
// } // });
// }
}
//pop up //pop up
// async function confirmpopUp() { async function confirmpopUp() {
// dialogConfirm( dialogConfirm(
// $q, $q,
// async () => { async () => {
// const body = { showLoader();
// reason: reasonReign.value, const body = {
// }; reason: reasonReign.value,
// await http };
// .put(config.API.resignConfirm(roleUser.value, id.value), body) await http
// .then(() => { .put(config.API.resignConfirm(roleUser.value, id.value), body)
// success($q, ""); .then(async () => {
// closeModal(); await fetchData(id.value);
// }) closeModal();
// .catch((e) => { success($q, "การอนุญาตสำเร็จ");
// messageError($q, e); })
// }) .catch((e) => {
// .finally(() => { messageError($q, e);
// fetchData(id.value); })
// }); .finally(() => {
// }, hideLoader();
// "", });
// " ?" },
// ); "ยืนยันการอนุญาต",
// } "ต้องการยืนยันการอนุญาตการลานี้หรือไม่ ?"
);
}
//pop up //pop up
// async function rejectpopUp() { async function rejectpopUp() {
// dialogConfirm( dialogConfirm(
// $q, $q,
// async () => { async () => {
// const body = { showLoader();
// reason: reasonReign.value, const body = {
// date: dateBreak.value, reason: reasonReign.value,
// }; date: dateBreak.value,
// await http };
// .put(config.API.resignReject(roleUser.value, id.value), body) await http
// .then(() => { .put(config.API.resignReject(roleUser.value, id.value), body)
// success($q, ""); .then(async () => {
// closeModal(); await fetchData(id.value);
// }) closeModal();
// .catch((e) => { success($q, "การยับยั้งสำเร็จ");
// messageError($q, e); })
// }) .catch((e) => {
// .finally(() => { messageError($q, e);
// fetchData(id.value); })
// }); .finally(() => {
// }, hideLoader();
// "", });
// " ?" },
// ); "ยืนยันการยับยั้ง",
// } "ต้องการยืนยันการยับยั้งนี้หรือไม่ ?"
);
}
/** /**
* กดยกเล * กดยกเล
@ -316,8 +334,8 @@ function onSubmitConditions() {
isNoBurden: isNoBurden.value, isNoBurden: isNoBurden.value,
isDiscipline: isDiscipline.value, isDiscipline: isDiscipline.value,
}) })
.then(() => { .then(async () => {
fetchData(id.value); await fetchData(id.value);
success($q, "บันทึกเงื่อนไขต่าง ๆ สำเร็จ"); success($q, "บันทึกเงื่อนไขต่าง ๆ สำเร็จ");
conditions.value = false; conditions.value = false;
}) })
@ -350,16 +368,16 @@ function onSubmitAttached() {
showLoader(); showLoader();
http http
.put(config.API.resingByid(id.value), formData) .put(config.API.resingByid(id.value), formData)
.then(() => { .then(async () => {
edit.value = false; await fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ"); success($q, "บันทึกข้อมูลสำเร็จ");
edit.value = false;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) })
.finally(async () => { .finally(() => {
await fetchData(id.value); hideLoader();
await hideLoader();
}); });
}); });
} }
@ -523,7 +541,7 @@ function removeFile(fileName: string) {
onMounted(async () => { onMounted(async () => {
fetchData(id.value); fetchData(id.value);
fetchFile(); fetchFile();
const user = await tokenParsed(); // const user = await tokenParsed();
// if (user) { // if (user) {
// const commander = await user.role.includes("commander"); // const commander = await user.role.includes("commander");
// const oligarch = await user.role.includes("oligarch"); // const oligarch = await user.role.includes("oligarch");
@ -926,7 +944,7 @@ onMounted(async () => {
</q-card> </q-card>
<!-- ผลการพจารณาของการเจาหนาทของหนวยงาน --> <!-- ผลการพจารณาของการเจาหนาทของหนวยงาน -->
<q-card bordered class="row col-12 text-dark q-mt-sm"> <!-- <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="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark"> <div class="q-pl-sm text-weight-bold text-dark">
ผลการพจารณาของการเจาหนาทของหนวยงาน ผลการพจารณาของการเจาหนาทของหนวยงาน
@ -968,7 +986,7 @@ onMounted(async () => {
</div> </div>
</div> </div>
</div> </div>
</q-card> </q-card> -->
<!-- ผลการพจารณาของผงคบบญชา --> <!-- ผลการพจารณาของผงคบบญชา -->
<q-card bordered class="row col-12 text-dark q-mt-sm"> <q-card bordered class="row col-12 text-dark q-mt-sm">
@ -976,7 +994,29 @@ onMounted(async () => {
<div class="q-pl-sm text-weight-bold text-dark"> <div class="q-pl-sm text-weight-bold text-dark">
ผลการพจารณาของผงคบบญชา ผลการพจารณาของผงคบบญชา
</div> </div>
<q-space />
<div class="q-gutter-x-sm" v-if="workflowRef?.permission.isOperate">
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass', 'commander')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot', 'commander')"
/>
</div>
</div> </div>
<div class="col-12"><q-separator /></div> <div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md"> <div class="row col-12 q-pa-md">
<div class="col-12 row bg-white q-col-gutter-md"> <div class="col-12 row bg-white q-col-gutter-md">
@ -1020,6 +1060,27 @@ onMounted(async () => {
<div class="q-pl-sm text-weight-bold text-dark"> <div class="q-pl-sm text-weight-bold text-dark">
ผลการพจารณาของผอำนาจ ผลการพจารณาของผอำนาจ
</div> </div>
<q-space />
<div class="q-gutter-x-sm" v-if="workflowRef?.permission.isSign">
<q-btn
outline
color="primary"
dense
icon-right="check"
class="q-px-sm"
label="อนุญาต"
@click="popUp('pass', 'oligarch')"
/>
<q-btn
outline
color="red"
dense
icon-right="close"
class="q-px-sm"
label="ยับยั้ง"
@click="popUp('passNot', 'oligarch')"
/>
</div>
</div> </div>
<div class="col-12"><q-separator /></div> <div class="col-12"><q-separator /></div>
<div class="row col-12 q-pa-md"> <div class="row col-12 q-pa-md">
@ -1307,7 +1368,7 @@ onMounted(async () => {
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card style="width: 800px"> <q-card style="width: 800px">
<q-form ref="myFormConfirm"> <q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader <DialogHeader
:tittle="`${actionPass ? 'อนุญาตการลาออก' : 'ยับยั้งการลาออก'}`" :tittle="`${actionPass ? 'อนุญาตการลาออก' : 'ยับยั้งการลาออก'}`"
:close="closeModal" :close="closeModal"
@ -1324,6 +1385,7 @@ onMounted(async () => {
v-model="reasonReign" v-model="reasonReign"
:label="`${'กรอกความคิดเห็น/เหตุผล'}`" :label="`${'กรอกความคิดเห็น/เหตุผล'}`"
type="textarea" type="textarea"
class="inputgreen"
/> />
</div> </div>
<div class="col-xs-12 col-sm-12 col-md-12" v-if="!actionPass"> <div class="col-xs-12 col-sm-12 col-md-12" v-if="!actionPass">
@ -1343,6 +1405,7 @@ onMounted(async () => {
<q-input <q-input
outlined outlined
dense dense
class="inputgreen"
:model-value=" :model-value="
dateBreak !== null ? date2Thai(dateBreak) : null dateBreak !== null ? date2Thai(dateBreak) : null
" "
@ -1354,6 +1417,7 @@ onMounted(async () => {
<q-icon <q-icon
name="event" name="event"
class="cursor-pointer" class="cursor-pointer"
color="primary"
:style=" :style="
edit edit
? 'color: var(--q-primary)' ? 'color: var(--q-primary)'
@ -1368,6 +1432,11 @@ onMounted(async () => {
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-actions align="right" class="bg-white text-teal">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
<!-- <DialogFooter :editvisible="true" :save="conditionPopup" /> --> <!-- <DialogFooter :editvisible="true" :save="conditionPopup" /> -->
</q-form> </q-form>
</q-card> </q-card>