บรรจุ แต่งตั้ง ย้าย โอน => ปรับ code และ load
This commit is contained in:
parent
9f4aeec575
commit
34dc306288
30 changed files with 1154 additions and 1429 deletions
|
|
@ -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="`${'เงินเดือน'}`"
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue