Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-07-15 14:49:46 +07:00
commit 8aec1781bf
5 changed files with 57 additions and 57 deletions

View file

@ -28,6 +28,10 @@ const props = defineProps({
textReport: {
type: String,
},
isRules: {
type: Boolean,
default: true,
},
});
watch(props, () => {
if (modal.value === true && props.textReport == "") {
@ -68,7 +72,7 @@ function closeModal() {
outlined
dense
lazy-rules
:rules="[(val:string) => !!val || `กรุณากรอก${label}`]"
:rules="isRules ? [(val:string) => !!val || `กรุณากรอก${label}`] : []"
v-model="reason"
:label="`${label}`"
/>

View file

@ -1,9 +1,13 @@
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import { useRouter } from "vue-router";
import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import { updateCurrentPage } from "@/utils/function";
/** importType*/
import type {
@ -13,12 +17,10 @@ import type {
} from "@/modules/01_masterdata/interface/index/Main";
import type { FormFilterAssignment } from "@/modules/01_masterdata/interface/request/Main";
import type { ResAssignment } from "@/modules/01_masterdata/interface/response/Main";
import Summary from "@/modules/01_masterdata/components/Indicators/Summary.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import Summary from "@/modules/01_masterdata/components/Indicators/Summary.vue";
const $q = useQuasar();
const router = useRouter();
const { showLoader, hideLoader, dialogRemove, success, messageError } =
@ -65,33 +67,12 @@ const formFilter = reactive<FormFilterAssignment>({
const totalList = ref<number>(0); //
const maxPage = ref<number>(1);
const indicatorTotal = ref<any[]>([
{
value: "kpiPlan",
label: "ตัวชี้วัดตามแผน",
color: "edit",
},
{
value: "kpiRole",
label: "ตัวชี้วัดตามตำแหน่ง",
color: "primary",
},
{
value: "kpiSpecial",
label: "ตัวชี้วัดงานอื่นๆ ที่ได้รับมอบหมาย",
color: "blue",
},
{
value: "total",
label: "ทั้งหมด",
color: "red",
},
]);
function fetchList() {
/** ฟังก์ชันดึงข้อมูลรายการงานอื่นๆ ที่ได้รับมอบหมาย*/
async function fetchList() {
showLoader();
rows.value = [];
formFilter.year = formFilter.year ? formFilter.year.toString() : null;
http
await http
.post(config.API.kpiSpecial + `/search-edit`, {
...formFilter,
keyword: formFilter.keyword.trim(),
@ -103,24 +84,36 @@ function fetchList() {
})
.catch((err) => {
messageError($q, err);
rows.value = [];
})
.finally(() => {
hideLoader();
});
}
/**
* งกนเปดดรายละเอยดงานทไดบมอบหมาย
* @param id รหสงานทไดบมอบหมาย
*/
function onClickView(id: string = "") {
router.push(`/masterdata/indicator-assignment/${id}`);
}
/**
* งกนลบงานทไดบมอบหมาย
* @param id รหสงานทไดบมอบหมาย
*/
function onClickDelete(id: string) {
dialogRemove($q, () => {
dialogRemove($q, async () => {
showLoader();
http
await http
.delete(config.API.kpiSpecial + `/${id}`)
.then(() => {
fetchList();
.then(async () => {
formFilter.page = await updateCurrentPage(
formFilter.page,
maxPage.value,
rows.value.length
);
await fetchList();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
@ -149,27 +142,8 @@ watch(
}
);
function getTotal() {
http
.post(config.API.indicatorSummary)
.then((res) => {
const data = res.data.result;
indicatorTotal.value = indicatorTotal.value.map((indicator) => {
return {
...indicator,
total: data[indicator.value],
};
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
}
onMounted(() => {
getTotal();
fetchList();
onMounted(async () => {
await fetchList();
});
</script>

View file

@ -63,6 +63,7 @@ const dialogTitle = ref<string>("อนุญาต"); // Title ของ Dialog
const dialogLabel = ref<string>("เหตุผล"); // Label Dialog
const modalAdd = ref<boolean>(false); // Modal
const typeAdd = ref<string>(""); // COMMANDER, APPROVER
const isRules = ref<boolean>(true); //
/** Form รายละเอียดข้อมูล*/
const formData = reactive<FormData>({
id: "", //Id
@ -446,14 +447,17 @@ async function checkLeaveType(leaveTypeId: string, formData: FormData) {
async function openModal(data: string) {
if (data === "approve") {
modalApprove.value = true;
isRules.value = false;
dialogTitle.value = "อนุญาต";
}
if (data === "UnApprove") {
modalApprove.value = true;
dialogTitle.value = "ไม่อนุญาต";
isRules.value = true;
}
if (data === "authority") {
modalApprove.value = true;
isRules.value = true;
dialogTitle.value = "ความคิดเห็นของผู้บังคับบัญชา";
dialogLabel.value = "ความคิดเห็น";
}
@ -1229,7 +1233,8 @@ onMounted(async () => {
v-model:modal="modalApprove"
:title="dialogTitle"
:label="dialogLabel"
:savaForm="clickSave"
:sava-form="clickSave"
:is-rules="isRules"
/>
<DialogAddCommander

View file

@ -6,6 +6,7 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
import { updateCurrentPage } from "@/utils/function";
import { useCounterMixin } from "@/stores/mixin";
import { useLeaveHistoryDataStore } from "@/modules/09_leave/stores/LeaveHistoryStore";
@ -186,6 +187,11 @@ function onDeleteLeaveBeginning(id: string) {
await http
.delete(config.API.leaveBeginning + `/${id}`)
.then(async () => {
formFilter.page = await updateCurrentPage(
formFilter.page,
maxPage.value,
rows.value.length
);
await fetchDataLeaveBeginning();
success($q, "ลบข้อมูลสำเร็จ");
})

View file

@ -6,6 +6,7 @@ import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useCommandListStore } from "@/modules/18_command/store/ListStore";
import { updateCurrentPage } from "@/utils/function";
import http from "@/plugins/http";
import config from "@/app.config";
@ -83,6 +84,11 @@ function onReCommand(id: string) {
await http
.put(config.API.commandAction(id, "resume"))
.then(async () => {
page.value = await updateCurrentPage(
page.value,
store.maxPage,
store.rows.length
);
await fetchListCommand();
success($q, "ดึงไปทำคำสั่งใหม่สำเร็จ");
})
@ -105,6 +111,11 @@ function onDeleteCommand(id: string) {
await http
.delete(config.API.command + `/${id}`)
.then(async () => {
page.value = await updateCurrentPage(
page.value,
store.maxPage,
store.rows.length
);
await fetchListCommand();
success($q, "ลบรายการสำเร็จ");
})