remove old sys
This commit is contained in:
parent
00db6b6619
commit
1f76194664
254 changed files with 88 additions and 98844 deletions
|
|
@ -1,155 +0,0 @@
|
|||
<script setup lang="ts">
|
||||
import { defineAsyncComponent, ref, onMounted } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const orderId_params = route.params.id;
|
||||
const orderId = ref<string>("");
|
||||
const step = ref<number>(0);
|
||||
const step01 = defineAsyncComponent(
|
||||
() => import("@/modules/13_salary/components/Command/step01.vue")
|
||||
);
|
||||
const step02 = defineAsyncComponent(
|
||||
() => import("@/modules/13_salary/components/Command/step02.vue")
|
||||
);
|
||||
const step03 = defineAsyncComponent(
|
||||
() => import("@/modules/13_salary/components/Command/step03.vue")
|
||||
);
|
||||
const step04 = defineAsyncComponent(
|
||||
() => import("@/modules/13_salary/components/Command/step04.vue")
|
||||
);
|
||||
|
||||
const nextStep = async () => {
|
||||
localStorage.setItem("currentStep", step.value.toString());
|
||||
if (orderId.value) {
|
||||
await http
|
||||
.put(config.API.nextStep(orderId.value))
|
||||
.then(() => {
|
||||
router.push(
|
||||
`/salary/command/detail/${orderId.value}?step=${step.value + 1}`
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const previousStep = async () => {
|
||||
localStorage.setItem("currentStep", step.value.toString());
|
||||
if (orderId.value) {
|
||||
await http
|
||||
.put(config.API.prevStep(orderId.value))
|
||||
.then(() => {
|
||||
router.push(
|
||||
`/salary/command/detail/${orderId.value}?step=${step.value - 1}`
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function destroyLocalStorage() {
|
||||
localStorage.clear();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
destroyLocalStorage();
|
||||
if (route.query.step) {
|
||||
step.value = Number(route.query.step);
|
||||
localStorage.setItem("currentStep", step.value.toString());
|
||||
} else {
|
||||
const currentStep = localStorage.getItem("currentStep");
|
||||
if (currentStep) {
|
||||
step.value = Number(currentStep);
|
||||
} else {
|
||||
step.value = 1;
|
||||
}
|
||||
}
|
||||
if (orderId_params !== undefined) {
|
||||
orderId.value = orderId_params.toString();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
<q-btn
|
||||
icon="mdi-arrow-left"
|
||||
unelevated
|
||||
round
|
||||
dense
|
||||
flat
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
@click="router.push(`/salary/command`)"
|
||||
/>
|
||||
ออกคำสั่งเลื่อนเงินเดือน/ค่าจ้าง
|
||||
</div>
|
||||
<q-card flat bordered class="col-12 q-my-sm q-mt-sm">
|
||||
<q-stepper
|
||||
v-model="step"
|
||||
ref="stepper"
|
||||
color="primary"
|
||||
animated
|
||||
class="step"
|
||||
header-class="bg-grey-1"
|
||||
>
|
||||
<q-step
|
||||
:name="1"
|
||||
title="รายละเอียดการออกคำสั่ง"
|
||||
prefix="1"
|
||||
:done="step > 1"
|
||||
:header-nav="step > 1"
|
||||
/>
|
||||
<q-step
|
||||
:name="2"
|
||||
title="เลือกรายชื่อ"
|
||||
prefix="2"
|
||||
:done="step > 2"
|
||||
:header-nav="step > 2"
|
||||
/>
|
||||
<q-step
|
||||
:name="3"
|
||||
title="เลือกรายชื่อส่งสำเนาคำสั่ง"
|
||||
prefix="3"
|
||||
:done="step > 3"
|
||||
:header-nav="step > 3"
|
||||
/>
|
||||
<q-step
|
||||
:name="4"
|
||||
title="รายละเอียดคำสั่งและแนบท้าย"
|
||||
prefix="4"
|
||||
:done="step > 4"
|
||||
:header-nav="step > 4"
|
||||
/>
|
||||
<template v-slot:message>
|
||||
<step01 v-if="step === 1" :next="nextStep" :previous="previousStep" />
|
||||
<step02 v-if="step === 2" :next="nextStep" :previous="previousStep" />
|
||||
<step03 v-if="step === 3" :next="nextStep" :previous="previousStep" />
|
||||
<step04 v-if="step === 4" :next="nextStep" :previous="previousStep" />
|
||||
</template>
|
||||
</q-stepper>
|
||||
</q-card>
|
||||
</template>
|
||||
<style>
|
||||
.q-stepper--horizontal .q-stepper__step-inner {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.step .q-stepper__tab--done .q-stepper__title,
|
||||
.step .q-stepper__tab--active .q-stepper__title {
|
||||
color: #35473c !important;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.step .q-stepper__header--standard-labels .q-stepper__tab {
|
||||
min-height: 60px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,725 +0,0 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import type { QForm } from "quasar";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import type { treeTab } from "@/modules/05_placement/interface/index/Main";
|
||||
import type { ResponseOrganiz } from "@/modules/05_placement/interface/response/Order";
|
||||
import type { complaintLists } from "@/modules/10_order/interface/response/Order";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
DataOption1,
|
||||
OrederResult,
|
||||
} from "@/modules/10_order/interface/index/Main";
|
||||
|
||||
import { useOrderPlacementDataStore } from "@/modules/10_order/store";
|
||||
|
||||
const DataStore = useOrderPlacementDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
date2Thai,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
success,
|
||||
dialogConfirm,
|
||||
dialogMessageNotify,
|
||||
} = mixin;
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const orderId = route.params.id;
|
||||
const orderId_paramsName = route.name;
|
||||
|
||||
const props = defineProps({
|
||||
next: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
previous: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
});
|
||||
const next = () => props.next();
|
||||
|
||||
const myForm = ref<QForm>();
|
||||
//option
|
||||
const typeOrderOption = ref<DataOption1[]>([]);
|
||||
const byOrderOptionMain = ref<DataOption1[]>([]);
|
||||
const byOrderOption = ref<DataOption1[]>([]);
|
||||
const CommandOption = ref<DataOption1[]>([]);
|
||||
const salaryRoundOptionMain = ref<DataOption1[]>([]);
|
||||
const salaryRoundOption = ref<DataOption1[]>([]);
|
||||
|
||||
//Main
|
||||
const typeOrder = ref<any>();
|
||||
const nameOrder = ref<any>("");
|
||||
const command = ref<number | "">();
|
||||
const dateYear = ref<number | null>(null);
|
||||
const dateCommand = ref<Date | null>(null);
|
||||
const byOrder = ref<string>("");
|
||||
const nameCommand = ref<any>();
|
||||
const positionCommand = ref<string>("");
|
||||
const year = ref<number>(0);
|
||||
const SalaryRound = ref<any>(null);
|
||||
|
||||
// 33-34-35
|
||||
const input33 = ref<string>("");
|
||||
const input34 = ref<string>("");
|
||||
const input35 = ref<string>("");
|
||||
|
||||
const typeOrderFilter = ref<any>({
|
||||
typeOrderOption: [],
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
if (orderId) {
|
||||
await fecthTypeOption("hasData");
|
||||
} else {
|
||||
await fecthTypeOption("noData");
|
||||
}
|
||||
});
|
||||
// เลือกคำสั่งโดย
|
||||
watch(byOrder, async () => {
|
||||
await http
|
||||
.get(config.API.approverOC(byOrder.value))
|
||||
.then((res) => {
|
||||
CommandOption.value = res.data.result;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
});
|
||||
//เลือกผู้ลงนาม
|
||||
watch(nameCommand, async () => {
|
||||
if (positionCommand.value === "" || positionCommand.value === undefined) {
|
||||
positionCommand.value = nameCommand.value.positionName;
|
||||
}
|
||||
});
|
||||
|
||||
const commandCodes = ref<string[]>([
|
||||
"C-PM-33",
|
||||
"C-PM-34",
|
||||
"C-PM-35",
|
||||
"C-PM-36",
|
||||
"C-PM-37",
|
||||
]);
|
||||
// เรียกคำสั่ง
|
||||
const fecthTypeOption = async (actions: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.typeOrder())
|
||||
.then((res) => {
|
||||
const response = res.data.result;
|
||||
const filterRes = response.filter((e: any) =>
|
||||
commandCodes.value.includes(e.commandCode)
|
||||
);
|
||||
|
||||
const data =
|
||||
orderId_paramsName === "OrderDetail" ||
|
||||
orderId_paramsName === "OrderAdd"
|
||||
? response
|
||||
: filterRes;
|
||||
|
||||
typeOrderOption.value = data.map((e: OrederResult) => ({
|
||||
id: e.id,
|
||||
name: e.name,
|
||||
category: e.category,
|
||||
commandCode: e.commandCode,
|
||||
fullname: e.name,
|
||||
}));
|
||||
typeOrderFilter.value = data.map((e: OrederResult) => ({
|
||||
id: e.id,
|
||||
name: e.name,
|
||||
category: e.category,
|
||||
commandCode: e.commandCode,
|
||||
fullname: e.name,
|
||||
}));
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await fecthCommand();
|
||||
if (actions == "hasData") {
|
||||
await fetchdetailOrder(); // เมื่อแก้ไขจะเรียกข้อมูลรายละเอียด
|
||||
}
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// เรียกรายละเอียดของคำสั่ง
|
||||
const fetchdetailOrder = async () => {
|
||||
let orderIdString = orderId.toString();
|
||||
await http
|
||||
.get(config.API.detailOrder(orderIdString))
|
||||
.then(async (res: any) => {
|
||||
const data = res.data.result;
|
||||
|
||||
const orderTypeCode = await data.orderTypeCode.toUpperCase();
|
||||
|
||||
typeOrder.value = typeOrderOption.value.find(
|
||||
(e) => e.id === data.orderTypeValue
|
||||
);
|
||||
nameOrder.value = data.orderTitle;
|
||||
command.value = data.orderNo;
|
||||
dateYear.value = Number(data.orderYear);
|
||||
dateCommand.value = data.orderDate;
|
||||
byOrder.value = data.orderBy;
|
||||
nameCommand.value = data.signatoryBy;
|
||||
positionCommand.value = data.signatoryPosition;
|
||||
SalaryRound.value = data.salaryPeriodId;
|
||||
year.value = Number(data.year);
|
||||
|
||||
fetchSalaryRound();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
// await fecthCommand();
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const fecthCommand = async () => {
|
||||
await http
|
||||
.get(config.API.organizationsOrder())
|
||||
.then((res) => {
|
||||
byOrderOptionMain.value = res.data.result;
|
||||
byOrderOption.value = res.data.result;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
};
|
||||
|
||||
function casePm(val: string) {
|
||||
switch (val) {
|
||||
case "C-PM-33":
|
||||
return "เลื่อนเงินเดือนและให้ข้าราชการกรุงเทพมหานครสามัญ ได้รับเงินเดือนสูงกว่าขั้นสูงของตำแหน่งที่ได้รับแต่งตั้ง";
|
||||
case "C-PM-34":
|
||||
return "ให้ข้าราชการกรุงเทพมหานครสามัญได้รับค่าตอบแทนพิเศษ";
|
||||
case "C-PM-35":
|
||||
return `เลื่อนเงินเดือนและให้ข้าราชการกรุงเทพมหานครสามัญที่เกษียณอายุราชการ ในสิ้นปีงบประมาณ พ.ศ. ${
|
||||
new Date().getFullYear() + 543
|
||||
} ได้รับเงินเดือนสูงกว่าชั้นสูงของตำแหน่งที่ได้รับแต่งตั้ง`;
|
||||
case "C-PM-36":
|
||||
return "เลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้าง สูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ";
|
||||
case "C-PM-37":
|
||||
return "ให้ลูกจ้างประจำกรุงเทพมหานครได้รับค่าตอบแทนพิเศษ";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function selectCMP(selectOrder: OrederResult) {
|
||||
if (selectOrder != null) {
|
||||
const orderTypeCode = await selectOrder.commandCode.toUpperCase();
|
||||
nameOrder.value = casePm(orderTypeCode);
|
||||
}
|
||||
}
|
||||
|
||||
// บันทึกข้อมูล
|
||||
const submit = async () => {
|
||||
let signBy = null;
|
||||
// หาคนออกคำสั่ง
|
||||
if (!nameCommand.value.length) {
|
||||
signBy = await nameCommand.value.name;
|
||||
} else if (nameCommand.value !== "") {
|
||||
signBy = await nameCommand.value;
|
||||
} else {
|
||||
const name2 = await CommandOption.value.find(
|
||||
(x: any) => x.name == nameCommand.value
|
||||
);
|
||||
signBy = await name2?.name;
|
||||
}
|
||||
|
||||
const orderByOrganizationName = await byOrderOption.value.find(
|
||||
(x: any) => x.id == byOrder.value
|
||||
)?.name;
|
||||
|
||||
const formdata = {
|
||||
orderTypeValue: typeOrder.value.id,
|
||||
orderTitle: nameOrder.value,
|
||||
orderNo:
|
||||
command.value == undefined || command.value == "" ? "" : command.value,
|
||||
orderYear: dateYear.value,
|
||||
orderDate: dateCommand.value,
|
||||
orderBy: byOrder.value,
|
||||
orderByOrganizationName: orderByOrganizationName,
|
||||
registerPosition: "",
|
||||
signatoryBy: signBy === "" ? nameCommand.value : signBy,
|
||||
signatoryPosition: positionCommand.value,
|
||||
year: year.value,
|
||||
salaryPeriodId: SalaryRound.value.id,
|
||||
salaryPeriod: SalaryRound.value.code,
|
||||
};
|
||||
// if (
|
||||
// typeOrder.value.commandCode == "C-PM-33" ||
|
||||
// typeOrder.value.commandCode == "C-PM-34" ||
|
||||
// typeOrder.value.commandCode == "C-PM-35"
|
||||
// ) {
|
||||
// Object.assign(formdata, {
|
||||
// // examRound: examRound.value,
|
||||
// // conclusionRegisterNo: conclusionRegisterNo.value,
|
||||
// // conclusionRegisterDate: conclusionRegisterDate.value,
|
||||
// // conclusionResultNo: conclusionResultNo.value.toString(),
|
||||
// // conclusionResultDate: conclusionResultDate.value,
|
||||
// });
|
||||
// }
|
||||
|
||||
// เช็คค่าว่าง
|
||||
// await myForm.value!.validate().then((result: boolean) => {
|
||||
// if (result) {
|
||||
dialogConfirm($q, () => {
|
||||
// ถ้ามี orderId ให้ อัพเดท ไม่มีให้สร้าง
|
||||
if (!orderId) {
|
||||
createListOrder(formdata, typeOrder.value.commandCode);
|
||||
} else {
|
||||
let orderIdString = orderId.toString();
|
||||
updateOrder(formdata, orderIdString, typeOrder.value.commandCode);
|
||||
}
|
||||
});
|
||||
// }
|
||||
// });
|
||||
};
|
||||
|
||||
// สร้างคำสัง
|
||||
const createListOrder = async (formData: Object, type: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.orderCPM(type), formData)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
localStorage.setItem("orderId", data.id);
|
||||
|
||||
router.push(`/salary/command/detail/${data.id}?step=${2}`); // สร้างเสร็จแล้วให้ไป Step 2
|
||||
|
||||
next();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const updateOrder = async (formData: Object, orderId: string, type: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.orderCPMUpdate(type, orderId), formData)
|
||||
.then(() => {
|
||||
next(); // แก้ไขเสร็จแล้วให้ไป Step 2
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
function filterSelector(val: any, update: Function, fullname: any) {
|
||||
switch (fullname) {
|
||||
case "typeOrderOption":
|
||||
update(() => {
|
||||
typeOrderOption.value = typeOrderFilter.value.filter(
|
||||
(v: any) => v.fullname.toLowerCase().indexOf(val.toLowerCase()) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
case "byOrderOption":
|
||||
update(() => {
|
||||
byOrderOption.value = byOrderOptionMain.value.filter(
|
||||
(v: any) => v.name.toLowerCase().indexOf(val.toLowerCase()) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
|
||||
case "SalaryRound":
|
||||
update(() => {
|
||||
salaryRoundOption.value = salaryRoundOptionMain.value.filter(
|
||||
(v: any) => v.name.toLowerCase().indexOf(val.toLowerCase()) > -1
|
||||
);
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* class จัดรูปแบบแสดงระหว่างข้อมูลที่แก้ไขหรือแสดงเฉยๆ
|
||||
* @param val ข้อมูล input สำหรับแก้ไขหรือไม่
|
||||
*/
|
||||
function getClass(val: boolean) {
|
||||
return {
|
||||
"full-width inputgreen cursor-pointer": val,
|
||||
"full-width cursor-pointer": !val,
|
||||
};
|
||||
}
|
||||
|
||||
/** ดึงข้อมูลเริ่มต้น */
|
||||
function fetchSalaryRound() {
|
||||
showLoader();
|
||||
http
|
||||
.get(
|
||||
config.API.salaryPeriod() +
|
||||
`?page=${1}&pageSise=${10}&keyword=${""}&year=${year.value}`
|
||||
)
|
||||
.then((res) => {
|
||||
const data = res.data.result.data;
|
||||
const list = data.map((e: any) => ({
|
||||
id: e.id,
|
||||
name:
|
||||
e.period === "SPECIAL"
|
||||
? "รอบพิเศษ"
|
||||
: e.period === "APR"
|
||||
? "รอบเมษายน"
|
||||
: e.period === "OCT"
|
||||
? "รอบตุลาคม"
|
||||
: "-",
|
||||
code: e.period,
|
||||
}));
|
||||
salaryRoundOptionMain.value = list;
|
||||
|
||||
if (SalaryRound.value) {
|
||||
SalaryRound.value = list.find((x: any) => x.id == SalaryRound.value);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-form greedy @submit.prevent @validation-success="submit">
|
||||
<div class="q-pa-md">
|
||||
<!-- Main -->
|
||||
<div class="row col-12 q-col-gutter-x-lg q-col-gutter-y-md">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<q-select
|
||||
:class="getClass(true)"
|
||||
outlined
|
||||
dense
|
||||
v-model="typeOrder"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกประเภทคำสั่ง'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'ประเภทคำสั่ง'}`"
|
||||
map-options
|
||||
option-label="fullname"
|
||||
:options="typeOrderOption"
|
||||
option-value="id"
|
||||
use-input
|
||||
input-debounce="0"
|
||||
lazy-rules
|
||||
@update:model-value="selectCMP(typeOrder)"
|
||||
@filter="(inputValue:any,
|
||||
doneFn:Function) => filterSelector(inputValue, doneFn,'typeOrderOption'
|
||||
) "
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
outlined
|
||||
autogrow
|
||||
lazy-rules
|
||||
dense
|
||||
v-model="nameOrder"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกคำสั่งเรื่อง'}`]"
|
||||
:label="`${'คำสั่งเรื่อง'}`"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div class="row col-xs-7 col-md-3">
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="command"
|
||||
hide-bottom-space
|
||||
:label="`${'คำสั่งเลขที่'}`"
|
||||
/>
|
||||
</div>
|
||||
<label class="col-1 flex justify-center items-center text-bold"
|
||||
>/</label
|
||||
>
|
||||
<div class="col-5">
|
||||
<datepicker
|
||||
v-model="dateYear"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
year-picker
|
||||
:enableTimePicker="false"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
:model-value="dateYear !== null ? dateYear + 543 : null"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอก พ.ศ.'}`]"
|
||||
:label="`${'พ.ศ.'}`"
|
||||
dense
|
||||
outlined
|
||||
>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-5 col-md-3">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="dateCommand"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
<template #year="{ year }">
|
||||
{{ year + 543 }}
|
||||
</template>
|
||||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
class="inputgreen"
|
||||
:model-value="
|
||||
dateCommand != null ? date2Thai(dateCommand) : null
|
||||
"
|
||||
:label="`${'วันที่คำสั่งมีผล'}`"
|
||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกวันที่คำสั่งมีผล'}`]"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<selector
|
||||
:class="getClass(true)"
|
||||
outlined
|
||||
dense
|
||||
v-model="byOrder"
|
||||
:rules="[(val: string) => !!val || `${'กรุณาเลือกคำสั่งโดย'}`]"
|
||||
emit-value
|
||||
hide-bottom-space
|
||||
:label="`${'คำสั่งโดย'}`"
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="byOrderOption"
|
||||
option-value="id"
|
||||
use-input
|
||||
lazy-rules
|
||||
input-debounce="0"
|
||||
@update:model-value="(nameCommand = ''), (positionCommand = '')"
|
||||
@filter="(inputValue:any,
|
||||
doneFn:Function) => filterSelector(inputValue, doneFn,'byOrderOption'
|
||||
) "
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="col-xs-12 col-md-6"
|
||||
v-if="byOrder !== '00000000-0000-0000-0000-000000000000'"
|
||||
>
|
||||
<selector
|
||||
:class="getClass(true)"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="nameCommand"
|
||||
:rules="[(val: string) => !!val || `${'กรุณาเลือกผู้มีอำนาจลงนาม'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'ผู้มีอำนาจลงนาม'}`"
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="CommandOption"
|
||||
option-value="id"
|
||||
use-input
|
||||
input-debounce="0"
|
||||
>
|
||||
<template v-if="CommandOption.length === 0" v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-primary">
|
||||
กรุณาเลือกคำสั่งโดยก่อน
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</selector>
|
||||
</div>
|
||||
<div
|
||||
class="col-xs-12 col-md-6"
|
||||
v-if="byOrder !== '00000000-0000-0000-0000-000000000000'"
|
||||
>
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="positionCommand"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่งผู้มีอำนาจลงนาม'}`]"
|
||||
:label="`${'ตำแหน่งผู้มีอำนาจลงนาม'}`"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="col-xs-12 col-md-6"
|
||||
v-if="byOrder == '00000000-0000-0000-0000-000000000000'"
|
||||
>
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
outlined
|
||||
lazy-rules
|
||||
dense
|
||||
v-model="nameCommand"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกผู้มีอำนาจลงนาม'}`]"
|
||||
:label="`${'ผู้มีอำนาจลงนาม'}`"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="col-xs-12 col-md-6"
|
||||
v-if="byOrder == '00000000-0000-0000-0000-000000000000'"
|
||||
>
|
||||
<q-input
|
||||
:class="getClass(true)"
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
v-model="positionCommand"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่งผู้มีอำนาจลงนาม'}`]"
|
||||
:label="`${'ตำแหน่งผู้มีอำนาจลงนาม'}`"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-2">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="year"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
year-picker
|
||||
:enableTimePicker="false"
|
||||
@update:model-value="fetchSalaryRound(), (SalaryRound = '')"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
:model-value="year === 0 ? null : Number(year) + 543"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
class="inputgreen"
|
||||
:rules="[(val: string) => !!val || `${'กรุณาเลือกปีงบประมาณ'}`]"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-4">
|
||||
<q-select
|
||||
class="inputgreen"
|
||||
outlined
|
||||
dense
|
||||
v-model="SalaryRound"
|
||||
:rules="[(val: string) => !!val || `${'กรุณาเลือกรอบการขึ้นเงินเดือน'}`]"
|
||||
hide-bottom-space
|
||||
:label="`${'รอบการขึ้นเงินเดือน'}`"
|
||||
option-label="name"
|
||||
:options="salaryRoundOption"
|
||||
option-value="id"
|
||||
use-input
|
||||
input-debounce="0"
|
||||
lazy-rules
|
||||
@filter="(inputValue:any,
|
||||
doneFn:Function) => filterSelector(inputValue, doneFn,'SalaryRound'
|
||||
) "
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<q-separator />
|
||||
<div class="flex justify-end q-pa-sm q-gutter-sm">
|
||||
<q-btn unelevated label="บันทึก" type="submit" color="public">
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-form>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.q-field--with-bottom {
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
.custom-header-table {
|
||||
max-height: 64vh;
|
||||
|
||||
.q-table tr:nth-child(odd) td {
|
||||
background: white;
|
||||
}
|
||||
|
||||
.q-table tr:nth-child(even) td {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.q-table thead tr {
|
||||
background: #ecebeb;
|
||||
}
|
||||
|
||||
.q-table thead tr th {
|
||||
position: sticky;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.q-table thead tr:last-child th {
|
||||
top: 48px;
|
||||
}
|
||||
|
||||
.q-table thead tr:first-child th {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,785 +0,0 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import type { QInput } from "quasar";
|
||||
import type { QTableProps, QForm } from "quasar";
|
||||
import type { ResponseData } from "@/modules/05_placement/interface/response/Order";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
|
||||
import CurruncyInput from "@/components/CurruncyInput.vue";
|
||||
|
||||
const props = defineProps({
|
||||
next: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
previous: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
});
|
||||
|
||||
const next = () => props.next();
|
||||
const previous = () => props.previous();
|
||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||
const {
|
||||
dialogMessageNotify,
|
||||
dialogConfirm,
|
||||
dialogRemove,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
success,
|
||||
} = mixin;
|
||||
|
||||
const route = useRoute();
|
||||
const $q = useQuasar();
|
||||
|
||||
const routeName = ref<string>(route.name ? route.name.toString() : "");
|
||||
const modalData = ref<any>({
|
||||
salaryAmount: null,
|
||||
positionSalaryAmount: null,
|
||||
monthSalaryAmount: null,
|
||||
remarkVertical: "",
|
||||
remarkHorizontal: "",
|
||||
});
|
||||
const myForm = ref<QForm | null>(null);
|
||||
const myFormAdd = ref<QForm | null>(null);
|
||||
const modal = ref<boolean>(false);
|
||||
const modalAdd = ref<boolean>(false);
|
||||
const titleName = ref<string>("");
|
||||
const filterRef = ref<QInput>();
|
||||
const filter = ref<string>("");
|
||||
const visibleColumns = ref<String[]>(["no", "idCard", "name", "education"]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
field: "no",
|
||||
sortable: false,
|
||||
},
|
||||
{
|
||||
name: "idCard",
|
||||
align: "left",
|
||||
label: "เลขประจำตัวประชาชน",
|
||||
field: "idCard",
|
||||
sortable: true,
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
align: "left",
|
||||
label: "ชื่อ-นามสกุล",
|
||||
field: "name",
|
||||
sortable: true,
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
// {
|
||||
// name: "education",
|
||||
// align: "left",
|
||||
// label: "วุฒิการศึกษาในการออกคำสั่ง",
|
||||
// field: "education",
|
||||
// sortable: true,
|
||||
// sort: (a: string, b: string) =>
|
||||
// a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
// },
|
||||
]);
|
||||
const rows = ref<ResponseData[]>([]);
|
||||
const rows2 = ref<ResponseData[]>([]);
|
||||
const selected = ref<ResponseData[]>([]);
|
||||
const orderTypeCode = ref<string>("");
|
||||
|
||||
onMounted(async () => {
|
||||
await conditionData();
|
||||
});
|
||||
|
||||
const conditionData = async () => {
|
||||
const id = route.params.id
|
||||
? route.params.id.toString()
|
||||
: localStorage.getItem("orderId")
|
||||
? localStorage.getItem("orderId")
|
||||
: null;
|
||||
if (id !== null) {
|
||||
await getData(id);
|
||||
await fetchOrder(id);
|
||||
}
|
||||
};
|
||||
// เรียกรายชื่อออกคำสั่ง
|
||||
const getData = async (id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.personsselectedOrder(id))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let list: ResponseData[] = [];
|
||||
data.map((r: ResponseData) => {
|
||||
list.push({
|
||||
education: r.education ?? "",
|
||||
idCard: r.idCard ?? "",
|
||||
name: r.name ?? "",
|
||||
personalId: r.personalId ?? "",
|
||||
selectStatus: r.selectStatus !== null ? r.selectStatus : false,
|
||||
sequence: r.sequence !== null ? r.sequence : 0,
|
||||
refRecordId: r.refRecordId,
|
||||
salaryAmount: r.salaryAmount,
|
||||
positionSalaryAmount: r.positionSalaryAmount,
|
||||
monthSalaryAmount: r.monthSalaryAmount,
|
||||
});
|
||||
});
|
||||
rows.value = list;
|
||||
selected.value = rows.value;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
//เรียกรายละเอียดของคำสั่ง
|
||||
const fetchOrder = async (id: string) => {
|
||||
await http
|
||||
.get(config.API.detailOrder(id))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
orderTypeCode.value = data.orderTypeCode;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
};
|
||||
// เช็คคำสั่ง
|
||||
const statuscode = computed(() => {
|
||||
if (
|
||||
orderTypeCode.value === "c-pm-01" ||
|
||||
orderTypeCode.value === "c-pm-02" ||
|
||||
orderTypeCode.value === "c-pm-03" ||
|
||||
orderTypeCode.value === "c-pm-04" ||
|
||||
orderTypeCode.value === "c-pm-05" ||
|
||||
orderTypeCode.value === "c-pm-06" ||
|
||||
orderTypeCode.value === "c-pm-07" ||
|
||||
orderTypeCode.value === "c-pm-08" ||
|
||||
orderTypeCode.value === "c-pm-09" ||
|
||||
orderTypeCode.value === "c-pm-14" ||
|
||||
orderTypeCode.value === "c-pm-21" ||
|
||||
orderTypeCode.value === "c-pm-22"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
// เช็คหมายเหตุ
|
||||
const checkNote = computed(() => {
|
||||
if (
|
||||
orderTypeCode.value === "c-pm-01" ||
|
||||
orderTypeCode.value === "c-pm-02" ||
|
||||
orderTypeCode.value === "c-pm-03" ||
|
||||
orderTypeCode.value === "c-pm-04"
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
// ยืนยันลบข้อมูลรายชื่อ
|
||||
const dialogDeleteData = async (id: string) => {
|
||||
dialogRemove($q, () => deleteData(id));
|
||||
};
|
||||
// ลบข้อมูลรายชื่อ API
|
||||
const deleteData = async (id: string) => {
|
||||
await http
|
||||
.delete(config.API.personsOrder(id))
|
||||
.then(() => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
await conditionData();
|
||||
});
|
||||
};
|
||||
// ปรับรายชื่อขึ้น
|
||||
const swapUp = async (id: string) => {
|
||||
await http
|
||||
.put(config.API.swapUpOrder(id))
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await conditionData();
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// ปรับรายชื่อลง
|
||||
const swapDown = async (id: string) => {
|
||||
await http
|
||||
.put(config.API.swapDownOrder(id))
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await conditionData();
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const upDown = async (value: any, up: boolean = true) => {
|
||||
if (up) {
|
||||
await swapUp(value.row.personalId);
|
||||
} else {
|
||||
await swapDown(value.row.personalId);
|
||||
}
|
||||
};
|
||||
// บันทึกเงินเดือน
|
||||
const saveModal = () => {
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then(async (result: boolean) => {
|
||||
if (result) {
|
||||
putSalary(modalData.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const personalId = ref<string>("");
|
||||
// เปิด popup เงินเดือน
|
||||
const selectModal = (e: any) => {
|
||||
titleName.value = e.name;
|
||||
personalId.value = e.personalId;
|
||||
modalOpenClose(e.personalId);
|
||||
};
|
||||
// เปิด popup เงินเดือน
|
||||
const modalOpenClose = async (personalId: string) => {
|
||||
modal.value = !modal.value;
|
||||
if (modal.value) {
|
||||
await fetchSalary(personalId);
|
||||
} else {
|
||||
titleName.value = "";
|
||||
}
|
||||
myForm.value?.reset();
|
||||
};
|
||||
// เรียกข้อมูลเงินเดือนตาม personalId
|
||||
const fetchSalary = async (personalId: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.salaryOrder(personalId))
|
||||
.then((res: any) => {
|
||||
const data = res.data.result;
|
||||
modalData.value = {
|
||||
salaryAmount:
|
||||
data.salaryAmount === 0 &&
|
||||
data.positionSalaryAmount === 0 &&
|
||||
data.monthSalaryAmount === 0
|
||||
? null
|
||||
: data.salaryAmount,
|
||||
positionSalaryAmount:
|
||||
data.salaryAmount === 0 &&
|
||||
data.positionSalaryAmount === 0 &&
|
||||
data.monthSalaryAmount === 0
|
||||
? null
|
||||
: data.positionSalaryAmount,
|
||||
monthSalaryAmount:
|
||||
data.salaryAmount === 0 &&
|
||||
data.positionSalaryAmount === 0 &&
|
||||
data.monthSalaryAmount === 0
|
||||
? null
|
||||
: data.monthSalaryAmount,
|
||||
remarkVertical: data.remarkVertical,
|
||||
remarkHorizontal: data.remarkHorizontal,
|
||||
};
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// ยืนยันการแก้ไขข้อมูลเงินเดือน
|
||||
const putSalary = async (salary: any) => {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
modalData.value.salaryAmount
|
||||
? modalData.value.salaryAmount
|
||||
: (modalData.value.salaryAmount = 0);
|
||||
modalData.value.positionSalaryAmount
|
||||
? modalData.value.positionSalaryAmount
|
||||
: (modalData.value.positionSalaryAmount = 0);
|
||||
modalData.value.monthSalaryAmount
|
||||
? modalData.value.monthSalaryAmount
|
||||
: (modalData.value.monthSalaryAmount = 0);
|
||||
// if (modalData.value.salaryAmount === null) {
|
||||
// modalData.value.salaryAmount = 0;
|
||||
// }
|
||||
// if (modalData.value.positionSalaryAmount === null) {
|
||||
// modalData.value.positionSalaryAmount = 0;
|
||||
// }
|
||||
// if (modalData.value.monthSalaryAmount === null) {
|
||||
// modalData.value.monthSalaryAmount = 0;
|
||||
// }
|
||||
await http
|
||||
.put(config.API.salaryOrder(personalId.value), modalData.value)
|
||||
.then(async () => {
|
||||
await conditionData();
|
||||
modal.value = false;
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
};
|
||||
// เปิด popup เพิ่มข้อมูลรายชื่อ
|
||||
const modalAddChange = async () => {
|
||||
modalAdd.value = !modalAdd.value;
|
||||
if (modalAdd.value == true) {
|
||||
const id = route.params.id
|
||||
? route.params.id.toString()
|
||||
: localStorage.getItem("orderId")
|
||||
? localStorage.getItem("orderId")
|
||||
: null;
|
||||
if (id !== null) {
|
||||
await fetchaddlist(id);
|
||||
}
|
||||
} else await conditionData();
|
||||
};
|
||||
// เรียกข้อมูลราขชื่อที่จะเพิ่ม
|
||||
const fetchaddlist = async (id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.personsOrder(id))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let list = [];
|
||||
list = data.map((r: ResponseData) => ({
|
||||
education: r.education ?? "",
|
||||
idCard: r.idCard ?? "",
|
||||
name: r.name ?? "",
|
||||
personalId: r.personalId ?? "",
|
||||
selectStatus: r.selectStatus !== null ? r.selectStatus : false,
|
||||
sequence: r.sequence !== null ? r.sequence : 0,
|
||||
refRecordId: r.refRecordId,
|
||||
}));
|
||||
rows2.value = list;
|
||||
selected.value = rows.value;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// ยืนยันการเพิ่มรายชื่อออกคำสั่ง
|
||||
const saveModalAdd = () => {
|
||||
if (myFormAdd.value !== null) {
|
||||
myFormAdd.value.validate().then(async (result: boolean) => {
|
||||
if (result && selected.value.length !== 0) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => {
|
||||
let data = [];
|
||||
data.push(...selected.value.map((e: any) => e.refRecordId));
|
||||
addlist(data);
|
||||
},
|
||||
"ยืนยันการเพิ่มรายชื่อออกคำสั่ง",
|
||||
"ต้องการยืนยันการเพิ่มรายชื่อออกคำสั่งนี้ใช่หรือไม่?"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
// เพิ่มรายชื่อ API
|
||||
const addlist = async (data: Object) => {
|
||||
const id = route.params.id
|
||||
? route.params.id.toString()
|
||||
: localStorage.getItem("orderId")
|
||||
? localStorage.getItem("orderId")
|
||||
: null;
|
||||
if (id !== null) {
|
||||
await http
|
||||
.post(config.API.personsOrder(id), data)
|
||||
.then(() => {
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
})
|
||||
.catch((e: any) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
modalAddChange();
|
||||
});
|
||||
}
|
||||
};
|
||||
// บันทึกข้อมูล step 2
|
||||
const save = async () => {
|
||||
const check = rows.value.find((x: any) => x.salaryAmount == 0);
|
||||
if (
|
||||
(selected.value.length > 0 && !check) ||
|
||||
(statuscode.value === true && selected.value.length > 0)
|
||||
) {
|
||||
dialogConfirm($q, () => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
next();
|
||||
});
|
||||
} else if (check && statuscode.value === false) {
|
||||
dialogMessageNotify($q, "ระบุรายละเอียดการเงินไม่ครบ");
|
||||
} else {
|
||||
dialogMessageNotify($q, "กรุณาเลือกรายชื่อ");
|
||||
}
|
||||
};
|
||||
|
||||
const refresh = async () => {
|
||||
// await conditionData();
|
||||
modalAddChange();
|
||||
selected.value = [];
|
||||
};
|
||||
|
||||
const resetFilter = () => {
|
||||
// reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
|
||||
filter.value = "";
|
||||
filterRef.value!.focus();
|
||||
};
|
||||
|
||||
const getClass = (val: boolean) => {
|
||||
return {
|
||||
"full-width inputgreen cursor-pointer": val,
|
||||
"full-width cursor-pointer": !val,
|
||||
};
|
||||
};
|
||||
const pagination = ref({
|
||||
// sortBy: "OrderDate,OrderType",
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="q-py-md q-pl-md" style="max-height: 68vh; overflow-y: scroll">
|
||||
<div class="col-12 row q-pb-sm items-center">
|
||||
<q-btn flat round color="primary" @click="refresh" icon="mdi-plus">
|
||||
<q-tooltip>เพิ่มข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<q-space />
|
||||
<div class="items-center" style="display: flex">
|
||||
<!-- ค้นหาข้อความใน table -->
|
||||
<q-input
|
||||
standout
|
||||
dense
|
||||
v-model="filter"
|
||||
ref="filterRef"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
style="max-width: 200px"
|
||||
class="q-ml-sm"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filter == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="filter !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="resetFilter"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
<!-- แสดงคอลัมน์ใน table -->
|
||||
<q-select
|
||||
v-model="visibleColumns"
|
||||
:display-value="$q.lang.table.columns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
:options="columns"
|
||||
options-dense
|
||||
option-value="name"
|
||||
map-options
|
||||
emit-value
|
||||
style="min-width: 140px"
|
||||
class="gt-xs q-ml-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<d-table
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
:visible-columns="visibleColumns"
|
||||
:filter="filter"
|
||||
row-key="name"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width />
|
||||
<q-th auto-width />
|
||||
<q-th auto-width />
|
||||
<q-th auto-width v-if="statuscode !== true" />
|
||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td auto-width>
|
||||
<q-btn
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
:color="props.rowIndex + 1 == 1 ? 'grey' : 'green'"
|
||||
:disable="props.rowIndex + 1 == 1"
|
||||
@click="upDown(props)"
|
||||
icon="mdi-arrow-up-bold"
|
||||
>
|
||||
<!-- <q-tooltip>เลื่อนลำดับขึ้น</q-tooltip> -->
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td auto-width>
|
||||
<q-btn
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
:color="rows.length == props.rowIndex + 1 ? 'grey' : 'red'"
|
||||
:disable="rows.length == props.rowIndex + 1"
|
||||
@click="upDown(props, false)"
|
||||
icon="mdi-arrow-down-bold"
|
||||
>
|
||||
<!-- <q-tooltip>เลื่อนลำดับลง</q-tooltip> -->
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td auto-width v-if="statuscode !== true">
|
||||
<q-btn
|
||||
v-if="props.row.salaryAmount === 0"
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="blue"
|
||||
@click="selectModal(props.row)"
|
||||
icon="mdi-cash-multiple"
|
||||
>
|
||||
<q-tooltip>เงินเดือน</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-else
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
@click="selectModal(props.row)"
|
||||
icon="mdi-information-outline"
|
||||
>
|
||||
<q-tooltip>เงินเดือน</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
|
||||
<q-td auto-width>
|
||||
<q-btn
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="red"
|
||||
@click="dialogDeleteData(props.row.personalId)"
|
||||
icon="mdi-delete"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">{{
|
||||
col.name == "no" ? props.rowIndex + 1 : col.value
|
||||
}}</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
<q-separator />
|
||||
<div class="flex justify-end q-pa-sm q-gutter-sm">
|
||||
<q-btn
|
||||
dense
|
||||
outline
|
||||
color="primary"
|
||||
icon="chevron_left"
|
||||
@click="previous"
|
||||
class="q-pr-md"
|
||||
label="กรอกรายละเอียด"
|
||||
>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
dense
|
||||
unelevated
|
||||
label="บันทึก"
|
||||
color="public"
|
||||
@click="save"
|
||||
class="q-px-md"
|
||||
>
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<!--********************************** เงินเดือน ********************************** -->
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card style="width: 50vw; max-width: 50vw">
|
||||
<q-form ref="myForm">
|
||||
<DialogHeader :tittle="titleName" :close="modalOpenClose" />
|
||||
<q-separator />
|
||||
<q-card-section class="q-pa-sm bg-grey-1">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<div class="col-xs-12">
|
||||
<div class="col-12 row q-py-sm q-col-gutter-sm">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<CurruncyInput
|
||||
:edit="true"
|
||||
:dense="true"
|
||||
v-model="modalData.salaryAmount"
|
||||
:label="`${'เงินเดือน'}`"
|
||||
:rules="[(val: any) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<CurruncyInput
|
||||
:edit="true"
|
||||
:dense="true"
|
||||
v-model="modalData.positionSalaryAmount"
|
||||
:label="`${'เงินประจำตำแหน่ง'}`"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<CurruncyInput
|
||||
:edit="true"
|
||||
:dense="true"
|
||||
v-model="modalData.monthSalaryAmount"
|
||||
:label="`${'เงินค่าตอบแทนรายเดือน'}`"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-12" v-if="checkNote">
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
v-model="modalData.remarkVertical"
|
||||
label="หมายเหตุแนวตั้ง"
|
||||
type="textarea"
|
||||
rows="2"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-12" v-if="checkNote">
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
v-model="modalData.remarkHorizontal"
|
||||
type="textarea"
|
||||
label="หมายเหตุแนวนอน"
|
||||
rows="2"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
dense
|
||||
unelevated
|
||||
label="บันทึก"
|
||||
color="public"
|
||||
@click="saveModal"
|
||||
class="q-px-md"
|
||||
>
|
||||
<!-- icon="mdi-content-save-outline" -->
|
||||
<q-tooltip>บันทึก</q-tooltip>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
<!--********************************** รายชื่อ ********************************** -->
|
||||
<q-dialog v-model="modalAdd" class="dialog" persistent>
|
||||
<q-card style="width: 50vw; max-width: 50vw">
|
||||
<q-form ref="myFormAdd">
|
||||
<DialogHeader tittle="รายชื่อในการออกคำสั่ง" :close="modalAddChange" />
|
||||
<q-separator color="grey-4" />
|
||||
<q-card-section
|
||||
style="max-height: 60vh"
|
||||
class="scroll q-pa-sm bg-grey-1"
|
||||
>
|
||||
<d-table
|
||||
:rows="rows2"
|
||||
:columns="columns"
|
||||
:visible-columns="visibleColumns"
|
||||
:filter="filter"
|
||||
row-key="name"
|
||||
:selection="'multiple'"
|
||||
v-model:selected="selected"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width>
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="props.selected"
|
||||
/>
|
||||
</q-th>
|
||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td>
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="props.selected"
|
||||
/>
|
||||
</q-td>
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>{{ col.name == "no" ? props.rowIndex + 1 : col.value }}</q-td
|
||||
>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</q-card-section>
|
||||
<q-separator color="grey-4" />
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
unelevated
|
||||
label="บันทึก"
|
||||
color="public"
|
||||
@click="saveModalAdd"
|
||||
class="q-px-md"
|
||||
>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
|
@ -1,673 +0,0 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import DialogOrgSelectOneStep from "@/components/Dialogs/DialogOrgSelectOneStep.vue";
|
||||
|
||||
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
|
||||
import type { QInput, QForm } from "quasar";
|
||||
import type { treeTab } from "@/modules/05_placement/interface/index/Main";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
ResponseOrganiz,
|
||||
ResponseCopyOrder,
|
||||
DataCopyOrder,
|
||||
} from "@/modules/10_order/interface/response/Order";
|
||||
import type { RequestCopyOrder } from "@/modules/05_placement/interface/request/Order";
|
||||
import { useRoute } from "vue-router";
|
||||
import type { DataOption } from "@/modules/10_order/interface/index/Main";
|
||||
|
||||
const props = defineProps({
|
||||
next: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
previous: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
});
|
||||
|
||||
const next = () => props.next();
|
||||
const previous = () => props.previous();
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||
const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin;
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const myForm = ref<QForm | null>(null);
|
||||
const filterRef = ref<QInput>();
|
||||
const filter = ref<string>("");
|
||||
|
||||
const modal = ref<boolean>(false);
|
||||
const search = ref<string>("");
|
||||
const expanded = ref<string[]>([]);
|
||||
const selected = ref<string>("");
|
||||
const nodesTree = ref<treeTab[]>([]);
|
||||
|
||||
const selectedModal = ref<ResponseOrganiz[]>([]);
|
||||
|
||||
const filterModal = ref<string>("");
|
||||
const visibleColumnsModal = ref<String[]>(["no", "idCard", "name", "position"]);
|
||||
const columnsModal = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "no",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
field: "no",
|
||||
sortable: false,
|
||||
},
|
||||
{
|
||||
name: "idCard",
|
||||
align: "left",
|
||||
label: "เลขประจำตัวประชาชน",
|
||||
field: "idCard",
|
||||
sortable: true,
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
align: "left",
|
||||
label: "ชื่อ-นามสกุล",
|
||||
field: "name",
|
||||
sortable: true,
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "position",
|
||||
align: "left",
|
||||
label: "ตำแหน่ง",
|
||||
field: "position",
|
||||
sortable: true,
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
|
||||
const rowsModal = ref<ResponseOrganiz[]>([]);
|
||||
|
||||
const optionSelect = ref<DataOption[]>([
|
||||
{ id: 1, name: "อีเมล" },
|
||||
{ id: 2, name: "กล่องข้อความ" },
|
||||
]);
|
||||
|
||||
const visibleColumns = ref<String[]>([
|
||||
"no",
|
||||
"idCard",
|
||||
"name",
|
||||
"position",
|
||||
"unit",
|
||||
"send",
|
||||
]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{ name: "no", align: "left", label: "ลำดับ", field: "no", sortable: false },
|
||||
{
|
||||
name: "idCard",
|
||||
align: "left",
|
||||
label: "เลขประจำตัวประชาชน",
|
||||
field: "idCard",
|
||||
sortable: true,
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
align: "left",
|
||||
label: "ชื่อ-นามสกุล",
|
||||
field: "name",
|
||||
sortable: true,
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "position",
|
||||
align: "left",
|
||||
label: "ตำแหน่ง",
|
||||
field: "position",
|
||||
sortable: true,
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "unit",
|
||||
align: "left",
|
||||
label: "หน่วยงาน",
|
||||
field: "unit",
|
||||
sortable: true,
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "send",
|
||||
align: "left",
|
||||
label: "ช่องทางการส่งสำเนา",
|
||||
field: "send",
|
||||
sortable: true,
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
|
||||
const rows = ref<DataCopyOrder[]>([]);
|
||||
|
||||
const editRows = ref<DataCopyOrder[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
await conditionId();
|
||||
});
|
||||
|
||||
const listModal = async (id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.copyOrderPersonsId(id))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let list: ResponseOrganiz[] = [];
|
||||
data.map((r: ResponseOrganiz) => {
|
||||
list.push({
|
||||
firstName: r.firstName ?? "",
|
||||
idCard: r.idCard ?? "",
|
||||
lastName: r.lastName ?? "",
|
||||
name: r.name ?? "",
|
||||
position: r.position ?? "",
|
||||
prefixId: r.prefixId ?? "",
|
||||
profileId: r.profileId ?? "",
|
||||
unit: r.unit ?? "",
|
||||
});
|
||||
});
|
||||
rowsModal.value = list;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// เช็คค่า orderid
|
||||
const conditionId = async () => {
|
||||
const id = route.params.id
|
||||
? route.params.id.toString()
|
||||
: localStorage.getItem("orderId")
|
||||
? localStorage.getItem("orderId")
|
||||
: null;
|
||||
if (id !== null) {
|
||||
await getData(id);
|
||||
}
|
||||
};
|
||||
// เรียก้อมูลใน Table
|
||||
const getData = async (id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.copyOrderId(id))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let list: DataCopyOrder[] = [];
|
||||
data.map((r: ResponseCopyOrder) => {
|
||||
let selectCopyOrder = [];
|
||||
if (r.emailChannel) {
|
||||
selectCopyOrder.push(1);
|
||||
}
|
||||
if (r.inboxChannel) {
|
||||
selectCopyOrder.push(2);
|
||||
}
|
||||
list.push({
|
||||
personalId: r.personalId ?? "",
|
||||
name: r.name ?? "",
|
||||
idCard: r.idCard ?? "",
|
||||
position: r.position ?? "",
|
||||
unit: r.unit ?? "",
|
||||
send: "",
|
||||
mutiselect: selectCopyOrder,
|
||||
});
|
||||
});
|
||||
if (editRows.value.length > 0) {
|
||||
list.map((r: DataCopyOrder) => {
|
||||
editRows.value.map((e: DataCopyOrder) => {
|
||||
if (r.personalId == e.personalId) {
|
||||
r.mutiselect = e.mutiselect;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
rows.value = list;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// เลือกรายชื่อจากหน่วยงาน
|
||||
const saveData = async () => {
|
||||
const id = route.params.id
|
||||
? route.params.id.toString()
|
||||
: localStorage.getItem("orderId")
|
||||
? localStorage.getItem("orderId")
|
||||
: null;
|
||||
if (id !== null) {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.copyOrderPersonsId(id), selectedModal.value)
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await conditionId();
|
||||
clickClose();
|
||||
// hideLoader();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const resetFilter = () => {
|
||||
// reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
|
||||
filter.value = "";
|
||||
filterRef.value!.focus();
|
||||
};
|
||||
|
||||
const getClass = (val: boolean) => {
|
||||
return {
|
||||
"full-width inputgreen cursor-pointer": val,
|
||||
"full-width cursor-pointer": !val,
|
||||
};
|
||||
};
|
||||
|
||||
const clickClose = async () => {
|
||||
modal.value = false;
|
||||
};
|
||||
// เปิด popup เพิ่มข้อมูล
|
||||
const clickAdd = async () => {
|
||||
await nodeTree();
|
||||
selected.value = "";
|
||||
rowsModal.value = [];
|
||||
selectedModal.value = [];
|
||||
modal.value = true;
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.reset();
|
||||
}
|
||||
};
|
||||
// ยืนยันการลบข้อมูล
|
||||
const clickDelete = (id: string) => {
|
||||
dialogRemove($q, () => deleteData(id));
|
||||
};
|
||||
// โหลดโครงสร้าง tree
|
||||
const nodeTree = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.profileOrganizRoot)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
nodesTree.value = data;
|
||||
if (data.length > 0) {
|
||||
expanded.value = [data[0].id];
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
// เลือกหน่วยงาน
|
||||
const onSelected = async (id: string) => {
|
||||
await listModal(id);
|
||||
};
|
||||
// ลบข้อมูลรายชื่อ
|
||||
const deleteData = async (id: string) => {
|
||||
await http
|
||||
.delete(config.API.copyOrderId(id))
|
||||
.then((res) => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
// hideLoader();
|
||||
await conditionId();
|
||||
});
|
||||
};
|
||||
// บันทึกข้อมูล step 3
|
||||
const saveDataCopyOrder = async () => {
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then(async (result: boolean) => {
|
||||
if (result) {
|
||||
await fetchSaveCopyOrder();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
// บันทึกข้อมูล step 3 API
|
||||
const fetchSaveCopyOrder = async () => {
|
||||
let list: RequestCopyOrder[] = [];
|
||||
rows.value.map((r: DataCopyOrder) => {
|
||||
list.push({
|
||||
personalId: r.personalId,
|
||||
emailChannel: r.mutiselect.includes(1),
|
||||
inboxChannel: r.mutiselect.includes(2),
|
||||
});
|
||||
});
|
||||
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.copyOrder, list)
|
||||
.then(() => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
next();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const updateData = (row: DataCopyOrder) => {
|
||||
editRows.value.push(row);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="q-py-md q-pl-md" style="max-height: 68vh; overflow-y: scroll">
|
||||
<div class="col-12 row q-py-sm items-center">
|
||||
<q-btn flat round color="primary" @click="clickAdd" icon="mdi-plus">
|
||||
<q-tooltip>เพิ่มข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<q-space />
|
||||
<div class="items-center" style="display: flex">
|
||||
<!-- ค้นหาข้อความใน table -->
|
||||
<q-input
|
||||
standout
|
||||
dense
|
||||
v-model="filter"
|
||||
ref="filterRef"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
style="max-width: 200px"
|
||||
class="q-ml-sm"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filter == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="filter !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="resetFilter"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
<!-- แสดงคอลัมน์ใน table -->
|
||||
<q-select
|
||||
v-model="visibleColumns"
|
||||
:display-value="$q.lang.table.columns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
:options="columns"
|
||||
options-dense
|
||||
option-value="name"
|
||||
map-options
|
||||
emit-value
|
||||
style="min-width: 140px"
|
||||
class="gt-xs q-ml-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<q-form ref="myForm">
|
||||
<d-table
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
:visible-columns="visibleColumns"
|
||||
:filter="filter"
|
||||
row-key="idCard"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width />
|
||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td auto-width>
|
||||
<q-btn
|
||||
dense
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="red"
|
||||
@click="clickDelete(props.row.personalId)"
|
||||
icon="mdi-delete"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
<q-td key="no" :props="props">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</q-td>
|
||||
<q-td key="idCard" :props="props">
|
||||
{{ props.row.idCard }}
|
||||
</q-td>
|
||||
<q-td key="name" :props="props">
|
||||
{{ props.row.name }}
|
||||
</q-td>
|
||||
<q-td key="position" :props="props">
|
||||
{{ props.row.position }}
|
||||
</q-td>
|
||||
<q-td key="unit" :props="props">
|
||||
{{ props.row.unit }}
|
||||
</q-td>
|
||||
<q-td key="send" :props="props">
|
||||
<q-select
|
||||
:class="getClass(true)"
|
||||
hide-bottom-space
|
||||
multiple
|
||||
:outlined="true"
|
||||
dense
|
||||
v-model="props.row.mutiselect"
|
||||
:rules="[
|
||||
(val:string) => !!val || `${'กรุณาเลือกช่องทางการส่งสำเนา'}`,
|
||||
(val:string) =>
|
||||
val.length > 0 || `${'กรุณาเลือกช่องทางการส่งสำเนา'}`,
|
||||
]"
|
||||
:label="`${'เลือกช่องทางการส่งสำเนา'}`"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="optionSelect"
|
||||
option-value="id"
|
||||
input-debounce="0"
|
||||
color="primary"
|
||||
@update:model-value="() => updateData(props.row)"
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-black">
|
||||
ไม่พบข้อมูลที่ค้นหา
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</q-form>
|
||||
</div>
|
||||
<q-separator />
|
||||
<div class="flex justify-end q-pa-sm q-gutter-sm">
|
||||
<q-btn
|
||||
dense
|
||||
outline
|
||||
color="primary"
|
||||
icon="chevron_left"
|
||||
@click="previous"
|
||||
class="q-pr-md"
|
||||
label="เลือกรายชื่อ"
|
||||
>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
dense
|
||||
unelevated
|
||||
label="บันทึก"
|
||||
color="public"
|
||||
@click="saveDataCopyOrder"
|
||||
class="q-px-md"
|
||||
>
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <q-dialog v-model="modal" persistent full-width>
|
||||
<q-card>
|
||||
<DialogHeader tittle="เลือกรายชื่อตามหน่วยงาน" :close="clickClose" />
|
||||
<q-separator />
|
||||
<q-card-section class="q-pa-sm bg-grey-1">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<div class="col-xs-12 col-sm-5 row">
|
||||
<q-card flat bordered class="fit q-pa-sm">
|
||||
<q-scroll-area visible style="height: 70vh">
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
v-model="search"
|
||||
placeholder="ค้นหา"
|
||||
class="q-mb-sm"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="mdi-magnify" />
|
||||
</template>
|
||||
</q-input>
|
||||
<q-tree
|
||||
:nodes="nodesTree"
|
||||
dense
|
||||
node-key="id"
|
||||
v-model:selected="selected"
|
||||
v-model:expanded="expanded"
|
||||
no-selection-unset
|
||||
selected-color="primary"
|
||||
@update:selected="onSelected"
|
||||
default-expand-all
|
||||
/>
|
||||
</q-scroll-area>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-7">
|
||||
<div class="col-12 row q-py-sm items-center">
|
||||
<q-space />
|
||||
<div class="items-center" style="display: flex">
|
||||
<q-input
|
||||
standout
|
||||
dense
|
||||
v-model="filterModal"
|
||||
ref="filterRef"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
style="max-width: 200px"
|
||||
class="q-ml-sm"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filterModal == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="filterModal !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="resetFilter"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<q-select
|
||||
v-model="visibleColumnsModal"
|
||||
:display-value="$q.lang.table.columns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
:options="columnsModal"
|
||||
options-dense
|
||||
option-value="name"
|
||||
map-options
|
||||
emit-value
|
||||
style="min-width: 150px"
|
||||
class="gt-xs q-ml-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<d-table
|
||||
:rows="rowsModal"
|
||||
:columns="columnsModal"
|
||||
:visible-columns="visibleColumnsModal"
|
||||
:filter="filterModal"
|
||||
row-key="profileId"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedModal"
|
||||
>
|
||||
<template v-slot:header-selection="scope">
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="scope.selected"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template v-slot:body-selection="scope">
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="scope.selected"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template v-slot:body-cell="props">
|
||||
<q-td :props="props">
|
||||
<div v-if="props.col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
{{ props.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
unelevated
|
||||
label="บันทึก"
|
||||
color="public"
|
||||
@click="saveData"
|
||||
class="q-px-md"
|
||||
/>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-dialog> -->
|
||||
|
||||
<DialogOrgSelectOneStep
|
||||
v-model:modal="modal"
|
||||
:title="'เลือกรายชื่อตามหน่วยงาน'"
|
||||
v-model:selectedModal="selectedModal"
|
||||
:saveData="saveData"
|
||||
/>
|
||||
</template>
|
||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue