diff --git a/src/modules/13_salary/components/SalaryChart/DialogFormMain.vue b/src/modules/13_salary/components/SalaryChart/DialogFormMain.vue index 3ea058bd8..0f3dbb862 100644 --- a/src/modules/13_salary/components/SalaryChart/DialogFormMain.vue +++ b/src/modules/13_salary/components/SalaryChart/DialogFormMain.vue @@ -79,6 +79,7 @@ const salaryTypeOption = ref([ { id: "EMPLOYEE", name: "ลูกจ้างประจำกรุงเทพมหานคร" }, ]); +const posType = ref([]); const salaryPosTypeOption = ref([]); const salaryPosLevelOption = ref([]); @@ -100,6 +101,7 @@ async function fetchPosType() { await http .get(config.API.salaryPosType) .then((res) => { + posType.value = res.data.result; const listOption = res.data.result.map((e: SalaryPosType) => ({ id: e.id, name: e.posTypeName, @@ -111,19 +113,18 @@ async function fetchPosType() { }); } -async function fetchPosLevel() { - await http - .get(config.API.salaryPosLevel) - .then((res) => { - const listOption = res.data.result.map((e: SalaryPosLevel) => ({ - id: e.id, - name: e.posLevelName, - })); - salaryPosLevelOption.value = listOption; - }) - .catch((err) => { - messageError($q, err); - }); +async function fetchPosLevel(id: string) { + const filterLevel = posType.value.find((e: SalaryPosType) => e.id === id); + const listOption = + filterLevel?.posLevels.map((e: SalaryPosLevel) => ({ + id: e.id, + name: e.posLevelName, + })) || []; + + salaryPosLevelOption.value = listOption; + if (!listOption.some((e: DataOption) => e.id === formData.posLevelId)) { + formData.posLevelId = ""; + } } async function fetchSalaryDetail(id: string) { @@ -132,7 +133,6 @@ async function fetchSalaryDetail(id: string) { .get(config.API.salaryChartByid(id)) .then((res) => { const data = res.data.result; - console.log(data); formData.salaryType = data.salaryType; formData.posTypeId = data.posTypeId; formData.posLevelId = data.posLevelId; @@ -167,9 +167,6 @@ watch( if (salaryPosTypeOption.value.length === 0) { await fetchPosType(); } - if (salaryPosLevelOption.value.length === 0) { - await fetchPosLevel(); - } if (props.typeAction === "edit") { await showLoader(); @@ -177,6 +174,7 @@ watch( salaryId.value = props.data.id; await fetchDocumentFile(props.data.id); await fetchSalaryDetail(props.data.id); + await fetchPosLevel(props.data.posTypeId); } } } @@ -293,7 +291,7 @@ function onClickDeleteFile(fileName: string) { showLoader(); await http .delete(config.API.salaryChartDelFile(salaryId.value, fileName)) - .then((res) => { + .then(() => { setTimeout(() => { fetchDocumentFile(salaryId.value); success($q, "ลบไฟล์สำเร็จ"); @@ -371,319 +369,336 @@ async function downloadFile(url: string, type: string, fileName: string) { -
-
-
- -
+
+
+
+
+ +
-
- -
+
+ +
-
- -
+
+ +
+
+ +
+ +
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + + +
+ +
+ +
+
- -
- -
- บันทึกข้อมูล - - - - -
- -
- - - - - -
- -
- - - - - -
- -
-
- -
- -
- อัปโหลดเอกสารอ้างอิง -
-
-
-
- +
+
+ +
- - - -
+ + + +
-
- - - {{ file.name }} - -
-
- - ดาวน์โหลดไฟล์ - -
-
- ลบไฟล์ -
-
-
-
-
-
+
+ + + {{ file.name }} + +
+
+ + ดาวน์โหลดไฟล์ + +
+
+ ลบไฟล์ +
+
+
+
+
+
-
- ไม่มีรายการเอกสาร -
+
+ + ไม่มีรายการเอกสาร + +
+
+
- +
- - - บันทึกข้อมูล - diff --git a/src/modules/13_salary/components/SalaryChart/DialogFormRate.vue b/src/modules/13_salary/components/SalaryChart/DialogFormRate.vue index 71d3fbc40..24bef00a4 100644 --- a/src/modules/13_salary/components/SalaryChart/DialogFormRate.vue +++ b/src/modules/13_salary/components/SalaryChart/DialogFormRate.vue @@ -23,7 +23,6 @@ const { } = useCounterMixin(); const salaryId = ref(route.params.id.toString()); -const salaryRateId = ref(""); const modal = defineModel("modal", { required: true }); const props = defineProps({ @@ -85,9 +84,23 @@ const title = computed(() => { function closeDialog() { modal.value = !modal.value; + clearFormData(); +} + +function clearFormData() { + formData.salaryId = ""; + formData.salary = null; + formData.salaryHalf = null; + formData.salaryHalfSpecial = null; + formData.salaryFull = null; + formData.salaryFullSpecial = null; + formData.salaryFullHalf = null; + formData.salaryFullHalfSpecial = null; + formData.isNext = false; } function onClickSubmit() { + console.log(formData.salaryHalfSpecial); const hasError = []; for (const key in ObjectRef) { if (Object.prototype.hasOwnProperty.call(ObjectRef, key)) { @@ -118,7 +131,9 @@ function createSalaryRate() { : Number(formData.salaryHalf.replace(/,/g, "")), //0.5 ขั้น salaryHalfSpecial: - typeof formData.salaryHalfSpecial === "number" + formData.salaryHalfSpecial === "" || formData.salaryHalfSpecial === null + ? null + : typeof formData.salaryHalfSpecial === "number" ? formData.salaryHalfSpecial : Number(formData.salaryHalfSpecial.replace(/,/g, "")), //0.5 ขั้น(เงินพิเศษ) @@ -128,7 +143,9 @@ function createSalaryRate() { : Number(formData.salaryFull.replace(/,/g, "")), //1 ขั้น salaryFullSpecial: - typeof formData.salaryFullSpecial === "number" + formData.salaryFullSpecial === "" || formData.salaryFullSpecial === null + ? null + : typeof formData.salaryFullSpecial === "number" ? formData.salaryFullSpecial : Number(formData.salaryFullSpecial.replace(/,/g, "")), //1 ขั้น(เงินพิเศษ) @@ -138,7 +155,10 @@ function createSalaryRate() { : Number(formData.salaryFullHalf.replace(/,/g, "")), //1.formData5 ขั้น salaryFullHalfSpecial: - typeof formData.salaryFullHalfSpecial === "number" + formData.salaryFullHalfSpecial === "" || + formData.salaryFullHalfSpecial === null + ? null + : typeof formData.salaryFullHalfSpecial === "number" ? formData.salaryFullHalfSpecial : Number(formData.salaryFullHalfSpecial.replace(/,/g, "")), //1.5 ขั้น(เงินพิเศษ) isNext: formData.isNext, //*ทะลุขั้น @@ -233,7 +253,6 @@ watch( label="เงินพิเศษ" mask="###,###,###,###" reverse-fill-mask - :rules="[(val) => !!val || `${'เงินพิเศษ'}`]" lazy-rules hide-bottom-space /> @@ -261,7 +280,6 @@ watch( label="เงินพิเศษ" mask="###,###,###,###" reverse-fill-mask - :rules="[(val) => !!val || `${'เงินพิเศษ'}`]" lazy-rules hide-bottom-space /> @@ -289,7 +307,6 @@ watch( label="เงินพิเศษ" mask="###,###,###,###" reverse-fill-mask - :rules="[(val) => !!val || `${'เงินพิเศษ'}`]" lazy-rules hide-bottom-space /> diff --git a/src/modules/13_salary/interface/response/Main.ts b/src/modules/13_salary/interface/response/Main.ts index 64ff0437c..ec030f287 100644 --- a/src/modules/13_salary/interface/response/Main.ts +++ b/src/modules/13_salary/interface/response/Main.ts @@ -30,6 +30,7 @@ interface SalaryPosType { id: string; posTypeName: string; posTypeRank: string; + posLevels: SalaryPosLevel[]; } interface SalaryPosLevel { diff --git a/src/modules/13_salary/views/salaryChart.vue b/src/modules/13_salary/views/salaryChart.vue index 0e9219c18..abe3d7983 100644 --- a/src/modules/13_salary/views/salaryChart.vue +++ b/src/modules/13_salary/views/salaryChart.vue @@ -41,7 +41,7 @@ const columns = ref([ name: "salaryType", align: "left", label: "ประเภทผัง", - sortable: false, + sortable: true, field: "salaryType", headerStyle: "font-size: 14px", style: "font-size: 14px", @@ -49,7 +49,7 @@ const columns = ref([ { name: "posType", align: "left", - label: "เลขที่ตำแหน่ง", + label: "ประเภทตำแหน่ง", sortable: true, field: "posType", headerStyle: "font-size: 14px", @@ -60,6 +60,7 @@ const columns = ref([ align: "left", label: "ระดับ", field: "posLevel", + sortable: true, headerStyle: "font-size: 14px", style: "font-size: 14px", }, @@ -121,7 +122,7 @@ const itemMenu = ref([ /** queryString*/ const formQuery = reactive({ page: 1, //*หน้า - pageSize: 2, //*จำนวนแถวต่อหน้า + pageSize: 10, //*จำนวนแถวต่อหน้า keyword: "", //keyword ค้นหา }); const maxPage = ref(1); diff --git a/src/modules/13_salary/views/salaryRate.vue b/src/modules/13_salary/views/salaryRate.vue index 17d1c9655..b1a929125 100644 --- a/src/modules/13_salary/views/salaryRate.vue +++ b/src/modules/13_salary/views/salaryRate.vue @@ -85,6 +85,15 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, + { + name: "isNext", + align: "left", + label: "ทะลุขั้น", + sortable: true, + field: "isNext", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, ]); /** List Mune*/ @@ -123,52 +132,14 @@ async function fetchListSalalyRate() { `?page=${page}&pageSize=${pageSize}&keyword=${keyword}` ) .then((res) => { - console.log(res); rows.value = res.data.result.data; }) .catch((err) => { - // messageError($q, err); + messageError($q, err); }) .finally(() => { hideLoader(); }); - // const data = [ - // { - // id: "0bc687ad-4273-4aa1-8d8a-65f45e743644", - // salary: 100, - // salaryHalf: 100, - // salaryHalfSpecial: 100, - // salaryFull: 100, - // salaryFullSpecial: 100, - // salaryFullHalf: 100, - // salaryFullHalfSpecial: 100, - // isNext: false, - // }, - // { - // id: "0bc687ad-4273-4aa1-8d8a-65f45e743666", - // salary: 200, - // salaryHalf: 200, - // salaryHalfSpecial: 200, - // salaryFull: 200, - // salaryFullSpecial: 200, - // salaryFullHalf: 200, - // salaryFullHalfSpecial: 200, - // isNext: false, - // }, - // { - // id: "0bc687ad-4273-4aa1-8d8a-65f45e743677", - // salary: 300, - // salaryHalf: 300, - // salaryHalfSpecial: 300, - // salaryFull: 300, - // salaryFullSpecial: 300, - // salaryFullHalf: 300, - // salaryFullHalfSpecial: 300, - // isNext: false, - // }, - // ]; - - // rows.value = data; } /** @@ -229,7 +200,7 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => { class="q-mr-sm" @click="router.go(-1)" /> - รายการผังบัญชีเงินเดือน + อัตราเงินเดือน
@@ -313,6 +284,13 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => { : col.value.toLocaleString() }} +
+ +
{{ col.value ? col.value.toLocaleString() : "-" }}