บรรจุ แต่งตั้ง ย้าย โอน => ปรับ 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

@ -7,13 +7,16 @@ import http from "@/plugins/http";
import config from "@/app.config";
import keycloak from "@/plugins/keycloak";
/**
* impotyType
*/
import type { resApiData } from "@/modules/05_placement/interface/response/OhterMain";
import type { QForm } from "quasar";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
/** importComponents*/
import CardProfile from "@/components/CardProfile.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
@ -50,10 +53,12 @@ const date = ref<Date | null>(null);
const militaryDate = ref<Date | null>(null);
const reason = ref<string>("");
//-----(fetch data by id)-----//
const fetchData = async () => {
/**
* fetch รายละเอยดรายการอนๆ
*/
function fetchData() {
showLoader();
await http
http
.get(config.API.otherByid(paramsId.toString()))
.then((res: resApiData) => {
const data = res.data.result;
@ -83,10 +88,12 @@ const fetchData = async () => {
hideLoader();
edit.value = false;
});
};
}
//-----(update)-----//
const onSubmit = async () => {
/**
* นยนการบนทกขอมลเพอลงบญชแนบทาย
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
@ -117,13 +124,16 @@ const onSubmit = async () => {
"ต้องการแก้ไขข้อมูลหรือไม่?",
"แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย"
);
};
}
const cancel = () => {
/**
* ยกเลกการแกไขขอมลเพอลงบญชแนบทาย
*/
function cancel() {
edit.value = false;
fetchData();
myForm.value?.resetValidation();
};
}
const getClass = (val: boolean) => {
return {
@ -136,7 +146,7 @@ onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
}
await fetchData();
fetchData();
});
</script>
@ -310,7 +320,7 @@ onMounted(async () => {
:outlined="edit"
dense
:readonly="!edit"
class="inputgreen"
:class="getClass(edit)"
hide-bottom-space
:borderless="!edit"
:label="`${'เงินเดือน'}`"

View file

@ -1,35 +1,30 @@
<script setup lang="ts">
import { ref, computed, watchEffect } from "vue";
import { ref, computed, watchEffect, watch } from "vue";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importComponents
*/
import DialogHeader from "@/components/DialogHeader.vue";
/**
* importStore
*/
import { useTransferDataStore } from "@/modules/05_placement/store";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
const storeFn = useTransferDataStore();
const { statusText } = storeFn;
const mixin = useCounterMixin();
const {
showLoader,
success,
messageError,
dialogConfirm,
findOrgName,
date2Thai,
} = mixin;
const $q = useQuasar();
const selected = ref<any>([]);
const checkSelected = computed(() => {
if (selected.value.length === 0 || props.type === "") {
return true;
}
});
const storeFn = useTransferDataStore();
const { statusText } = storeFn;
const { showLoader, success, messageError, dialogConfirm, date2Thai } =
useCounterMixin();
/**
* props
*/
const props = defineProps({
Modal: Boolean,
clickClose: Function,
@ -40,6 +35,22 @@ const props = defineProps({
filterKeyword2: String,
type: String,
});
const emit = defineEmits([
"update:filterKeyword2",
"update:type",
"update:selected",
]);
const selected = ref<any>([]);
const checkSelected = computed(() => {
if (selected.value.length === 0 || props.type === "") {
return true;
}
});
/**
* Table
*/
const visibleColumns2 = ref<string[]>([
"no",
"fullname",
@ -120,57 +131,67 @@ const columns2 = ref<QTableProps["columns"]>([
format: (val) => statusText(val),
},
]);
const emit = defineEmits([
"update:filterKeyword2",
"update:type",
"update:selected",
]);
const updateInput = (value: any) => {
/**
* update filter
*/
function updateInput(value: any) {
emit("update:filterKeyword2", value);
};
}
const updateInputType = (value: any) => {
/**
* update ประเภทคำส
*/
function updateInputType(value: any) {
emit("update:type", value);
};
//
const Reset = () => {
emit("update:filterKeyword2", "");
};
// modal
const clickAddlist = () => {
dialogConfirm($q, () => addOther());
};
}
//
const addOther = async () => {
let pId: string[] = [];
let Type = props.type as string;
selected.value.forEach((e: any) => {
pId.push(e.id);
});
let data = {
id: pId,
};
showLoader();
await http
.put(config.API.otherReport(Type), data)
.then(() => {
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
props.fecthlistOthet?.();
selected.value = [];
props.clickClose?.();
/**
* เซตคาในชองคนหา
*/
function Reset() {
emit("update:filterKeyword2", "");
}
/**
* นยนการสงไปออกคำส
*/
function clickAddlist() {
dialogConfirm($q, async () => {
let pId: string[] = [];
let Type = props.type as string;
selected.value.forEach((e: any) => {
pId.push(e.id);
});
};
watchEffect(() => {
if (props.Modal === true) {
selected.value = [];
let data = {
id: pId,
};
showLoader();
await http
.put(config.API.otherReport(Type), data)
.then(() => {
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
props.fecthlistOthet?.();
selected.value = [];
props.clickClose?.();
});
});
}
watch(
() => props.Modal,
() => {
if (props.Modal === true) {
selected.value = [];
}
}
});
);
// filter OptionsType
const OptionsTypeFn = ref<any>([]);
function filterFnOptionsType(val: string, update: any) {

View file

@ -23,7 +23,6 @@ import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const router = useRouter();
const storeFn = useTransferDataStore();
const mixin = useCounterMixin();
const { statusText } = storeFn;
const {
showLoader,
@ -32,19 +31,20 @@ const {
messageError,
date2Thai,
dialogRemove,
findOrgName,
} = mixin;
} = useCounterMixin();
const modal = ref<boolean>(false);
const type = ref<string>("");
const optionsType = ref<OpType[]>([]);
/**
* Table
*/
const rows = ref<listMain[]>([]);
const rows2 = ref<listMain[]>([]);
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
const visibleColumns = ref<string[]>([
"no",
"fullname",
@ -127,15 +127,24 @@ const columns = ref<QTableProps["columns"]>([
format: (val) => statusText(val),
},
]);
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
});
//----( API)------//
const fecthlistOthet = async () => {
/**
* fetch รายการอนๆ
*/
function fecthlistOthet() {
showLoader();
await http
http
.get(config.API.otherMain())
.then((res) => {
let response = res.data.result;
rows.value = response;
//
rows2.value = rows.value.filter(
(e: listMain) =>
e.status !== "REPORT" &&
@ -155,14 +164,18 @@ const fecthlistOthet = async () => {
.finally(() => {
hideLoader();
});
};
//----()------//
const fecthTypeOption = async () => {
}
/**
* fetch รายการขอมลประเภทคำส
*/
function fecthTypeOption() {
showLoader();
type.value = "";
await http
http
.get(config.API.typeOrder())
.then((res) => {
// C-PM-08 C-PM-09
optionsType.value = res.data.result.filter(
(e: OpType) =>
e.commandCode === "C-PM-08" || e.commandCode === "C-PM-09"
@ -174,33 +187,43 @@ const fecthTypeOption = async () => {
.finally(() => {
hideLoader();
});
};
}
//----( input)------//
const resetFilter = () => {
/**
* เซตขอมลในชอง input
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
};
}
//----( Dialog)------//
const popup = () => {
/**
* เป popup งไปออกคำสงอนๆ
*/
function popup() {
modal.value = true;
filterKeyword2.value = "";
fecthTypeOption();
type.value = "";
};
// fetch
fecthTypeOption();
}
//----( modal)------//
const clickClose = () => {
/**
* popup งไปออกคำสงอนๆ
*/
function clickClose() {
modal.value = false;
};
}
//----( Dialog )------//
const clickDelete = (id: string) => {
dialogRemove($q, async () => {
/**
* นยนการลบรายการอนๆ
* @param id รายการอนๆ
*/
function clickDelete(id: string) {
dialogRemove($q, () => {
showLoader();
await http
http
.delete(config.API.otherByid(id))
.then(async () => {
await fecthlistOthet();
@ -213,21 +236,17 @@ const clickDelete = (id: string) => {
hideLoader();
});
});
};
}
//----()------//
const nextPage = (id: string) => {
/**
* redialect รายละเอยดรายการอนๆ
* @param id รายการอนๆ
*/
function nextPage(id: string) {
router.push({
path: `/placement/other/detail/${id}`,
});
};
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
});
}
onMounted(() => {
fecthlistOthet();
@ -361,6 +380,7 @@ onMounted(() => {
</div>
</div>
</q-card>
<Dialogbody
v-model:Modal="modal"
:clickClose="clickClose"