บรรจุ แต่งตั้ง ย้าย โอน => ปรับ code และ load

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-19 16:14:43 +07:00
parent 9f4aeec575
commit 34dc306288
30 changed files with 1154 additions and 1429 deletions

View file

@ -1,23 +1,40 @@
<script setup lang="ts">
import { onMounted, ref, reactive } from "vue";
import { onMounted, ref } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive";
import type { DataProfile } from "@/modules/05_placement/interface/response/AppointMent";
import type { QForm } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue";
import CardProfile from "@/components/CardProfile.vue";
const modalPersonal = ref<boolean>(false);
const personId = ref<string>("");
/**
* importType
*/
import type { QForm } from "quasar";
import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive";
import type { DataProfile } from "@/modules/05_placement/interface/response/AppointMent";
/**
* importComponents
*/
import CardProfile from "@/components/CardProfile.vue"; // card
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const mixin = useCounterMixin();
const {
date2Thai,
messageError,
showLoader,
hideLoader,
success,
dialogConfirm,
} = useCounterMixin();
const paramsId = route.params.id;
const dataProfile = ref<DataProfile>();
@ -35,16 +52,6 @@ const date = ref<Date | null>(null);
const status = ref<string>("");
const avatar = ref<string>("");
const paramsId = route.params.id;
const {
date2Thai,
messageError,
showLoader,
hideLoader,
success,
dialogConfirm,
} = mixin;
const title = ref<ResponseTitle>({
fullname: "",
organizationPositionOld: "",
@ -52,10 +59,12 @@ const title = ref<ResponseTitle>({
positionTypeOld: "",
});
// id
const fecthappointmentByid = async () => {
/**
* fetch รายละเอยดการแตงต-เลอน-าย
*/
function fecthappointmentByid() {
showLoader();
await http
http
.get(config.API.appointmentByid(paramsId.toString()))
.then((res) => {
dataProfile.value = res.data.result as unknown as DataProfile;
@ -85,9 +94,11 @@ const fecthappointmentByid = async () => {
.finally(() => {
hideLoader();
});
};
}
//
/**
* นยนการบบทกขอมลลงบญชแนบทาย
*/
function putAppointment() {
dialogConfirm(
$q,
@ -105,26 +116,35 @@ function putAppointment() {
showLoader();
http
.put(config.API.appointmentByid(paramsId.toString()), data)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fecthappointmentByid();
await success($q, "บันทึกข้อมูลสำเร็จ");
edit.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fecthappointmentByid();
edit.value = false;
hideLoader();
});
},
"ต้องการแก้ไขข้อมูลหรือไม่?",
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย"
);
}
const cancel = () => {
/**
* ยกเลกการแกไขลงบญชแนบทาย
*/
function cancel() {
edit.value = false;
fecthappointmentByid();
myForm.value?.resetValidation();
};
fecthappointmentByid();
}
/**
* classInput
*/
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
@ -132,17 +152,8 @@ const getClass = (val: boolean) => {
};
};
function onclickViewinfo(id: string) {
modalPersonal.value = true;
personId.value = id;
}
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
onMounted(async () => {
await fecthappointmentByid();
onMounted(() => {
fecthappointmentByid();
});
</script>
<template>
@ -157,7 +168,7 @@ onMounted(async () => {
class="q-mr-sm"
@click="router.push(`/placement/appoint-promote`)"
/>
รายละเอยดการแตงต-เลอน-าย {{ title.fullname }}
รายละเอยดการแตงต-เลอน-าย{{ title.fullname }}
</div>
<CardProfile :data="dataProfile as DataProfile" />
@ -322,7 +333,7 @@ onMounted(async () => {
lazy-rules
mask="###,###,###,###"
reverse-fill-mask
class="inputgreen"
:class="getClass(edit)"
/>
</div>
</div>
@ -389,12 +400,6 @@ onMounted(async () => {
</div>
</q-form>
</q-card>
<PopupPersonal
:modal="modalPersonal"
:id="personId"
@update:modal="updatemodalPersonal"
/>
</template>
<style lang="scss" scope>
.q-img {

View file

@ -1,20 +1,29 @@
<script setup lang="ts">
import { ref, computed, watchEffect } from "vue";
import { ref, computed, watch } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { UserDataNew } from "@/modules/05_placement/interface/response/AppointMent";
import DialogHeader from "@/components/DialogHeader.vue";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importType
*/
import type { QTableProps } from "quasar";
import type { UserDataNew } from "@/modules/05_placement/interface/response/AppointMent";
/**
* importcomponents
*/
import DialogHeader from "@/components/DialogHeader.vue";
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
const $q = useQuasar();
const storeFn = useTransferDataStore();
const { statusText } = storeFn;
const mixin = useCounterMixin();
const {
showLoader,
success,
@ -22,16 +31,11 @@ const {
dialogConfirm,
hideLoader,
date2Thai,
} = mixin;
const $q = useQuasar();
const selected = ref<[]>([]);
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
} = useCounterMixin();
/**
* props
*/
const props = defineProps({
Modal: Boolean,
clickClose: Function,
@ -42,6 +46,15 @@ const props = defineProps({
filterKeyword2: String,
type: String,
});
const emit = defineEmits([
"update:filterKeyword2",
"update:type",
"update:selected",
]);
/**
* table
*/
const visibleColumns2 = ref<string[]>([
"no",
"citizenId",
@ -117,28 +130,36 @@ const columns2 = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const pageNext = (item: any) => {
const selected = ref<[]>([]);
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
function pageNext(item: any) {
props.nextPage?.(item?.id);
};
const emit = defineEmits([
"update:filterKeyword2",
"update:type",
"update:selected",
]);
const updateInput = (value: any) => {
}
/**
* ปเดท filter
*/
function updateInput(value: any) {
emit("update:filterKeyword2", value);
};
}
// const updateInputType = (value: string) => {
// emit("update:type", value);
// };
//
const Reset = () => {
/**
* เซตคาในชองคนหา
*/
function Reset() {
emit("update:filterKeyword2", "");
};
}
//
const sendToCommand = () => {
/**
* นยนสงไปออกคำส
*/
function sendToCommand() {
dialogConfirm($q, async () => {
let pId: string[] = [];
let Type = props.type as string;
@ -164,13 +185,16 @@ const sendToCommand = () => {
hideLoader();
});
});
};
}
watchEffect(() => {
if (props.Modal === true) {
selected.value = [];
watch(
() => props.Modal,
() => {
if (props.Modal === true) {
selected.value = [];
}
}
});
);
</script>
<template>
<q-dialog v-model="props.Modal">

View file

@ -1,35 +1,34 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import type { QTableProps } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import Dialogbody from "@/modules/05_placement/components/AppointMent/Dialogbody.vue";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importType
*/
import type {
listAppointType,
resData,
} from "@/modules/05_placement/interface/response/AppointMent";
import type { OpType } from "@/modules/05_placement/interface/response/Main";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import DialogOrgSelect from "@/components/Dialogs/DialogOrgSelect.vue";
/**
* importComponents
*/
import Dialogbody from "@/modules/05_placement/components/AppointMent/Dialogbody.vue"; //
import DialogOrgSelect from "@/components/Dialogs/DialogOrgSelect.vue"; //
const title = ref<string>("");
const posType = ref<string>("");
const posLevel = ref<string>("");
const position = ref<string>("");
const typeModal = ref<string | null>(null);
const dataRows = ref<any[]>([]);
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
const $q = useQuasar();
const modal = ref<boolean>(false);
const storeFn = useTransferDataStore();
const { statusText } = storeFn;
const mixin = useCounterMixin(); //
const {
showLoader,
hideLoader,
@ -37,37 +36,31 @@ const {
messageError,
date2Thai,
dialogRemove,
} = mixin;
} = useCounterMixin();
const posType = ref<string>("");
const posLevel = ref<string>("");
const position = ref<string>("");
const typeModal = ref<string | null>(null);
const dataRows = ref<any[]>([]);
const router = useRouter();
const rows = ref<listAppointType[]>([]);
const rows2 = ref<listAppointType[]>([]);
const modalTree = ref<boolean>(false);
const personal = ref<resData[]>([]);
const personalId = ref<string>("");
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
const listRecevice = ref<resData[]>([]);
const optionsType = ref<OpType[]>([]);
const type = ref<string>("");
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"fullname",
"organizationName",
"typeCommand",
"dateOfBirth",
"createdAt",
"status",
]);
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
});
/**
* Table
*/
const rows = ref<listAppointType[]>([]);
const rows2 = ref<listAppointType[]>([]);
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -151,37 +144,44 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
// input
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"fullname",
"organizationName",
"typeCommand",
"dateOfBirth",
"createdAt",
"status",
]);
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
});
/**
* เซ input
*/
const resetFilter = () => {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
};
// modal
const clickClose = () => {
modal.value = false;
};
// modal
const sendToCommand = () => {
modal.value = true;
filterKeyword2.value = "";
// fecthTypeOption();
};
// API
const fecthlistappointment = async () => {
/**
* fetch รายการแตงต-เลอน-าย
*/
function fecthlistappointment() {
showLoader();
rows.value = [];
await http
http
.get(config.API.appointmentMain())
.then((res) => {
let response = res.data.result;
listRecevice.value = response;
rows.value = response;
//
rows2.value = rows.value.filter(
(e: any) =>
e.root !== null &&
@ -202,48 +202,58 @@ const fecthlistappointment = async () => {
.finally(() => {
hideLoader();
});
};
}
//
const openModalTree = (data: any, type: string) => {
personalId.value = data.id;
modalTree.value = true;
typeModal.value = type;
dataRows.value = data;
posType.value = data.posTypeOldId;
posLevel.value = data.posLevelOldId;
position.value = data.positionOld;
};
//
const clickDelete = (id: string) => {
/**
* นยนการลบรายการแตงต-เลอน-าย
* @param id รายการแตงต-เลอน-าย
*/
function clickDelete(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.appointmentDelete(id))
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
.then(async () => {
await fecthlistappointment();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
fecthlistappointment();
hideLoader();
});
});
};
}
//
const nextPage = (id: string) => {
/**
* redirect ไปหนารายละเอยด
* @param id
*/
function nextPage(id: string) {
router.push({
path: `appoint-promote/detail/${id}`,
});
};
}
/**
* เป popup เลอกหนวยงาน
*/
function openModalTree(data: any, type: string) {
personalId.value = data.id;
typeModal.value = type;
dataRows.value = data;
posType.value = data.posTypeOldId;
posLevel.value = data.posLevelOldId;
position.value = data.positionOld;
modalTree.value = true;
}
/**
* นยนการเลอกหนวยงานทแตงต
*/
function onSave(data: any) {
console.log("not save", data);
const dataAppoint = {
// personalId: data.personalId,
node: data.node,
nodeId: data.nodeId,
orgRevisionId: data.orgRevisionId,
@ -262,19 +272,34 @@ function onSave(data: any) {
showLoader();
http
.put(config.API.appointmentPosition(personalId.value), dataAppoint)
.then((res) => {
.then(async () => {
await fecthlistappointment();
await success($q, "บันทึกข้อมูลสำเร็จ");
modalTree.value = false;
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
fecthlistappointment();
hideLoader();
});
}
/**
* เป popup งไปออกคำส
*/
function sendToCommand() {
modal.value = true;
filterKeyword2.value = "";
}
/**
* popup งไปออกคำส
*/
function clickClose() {
modal.value = false;
}
onMounted(() => {
fecthlistappointment();
});