fix salary

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-03-26 10:23:50 +07:00
parent 931a25af8f
commit 3212193de2
5 changed files with 106 additions and 131 deletions

View file

@ -26,6 +26,7 @@ const {
messageError,
success,
findOrgNameHtml,
dialogConfirm,
} = useCounterMixin();
const empType = ref<string>(route.params.type.toString());
@ -43,6 +44,15 @@ const rows = ref<DataPosition[]>([]);
const rowsMain = ref<DataPosition[]>([]);
const keyword = ref<string>("");
const baseColumns = ref<QTableColumn[]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "commandDateAffect",
align: "left",
@ -52,10 +62,6 @@ const baseColumns = ref<QTableColumn[]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "commandDateSign",
@ -66,10 +72,24 @@ const baseColumns = ref<QTableColumn[]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => date2Thai(v),
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "posNumCodeSit",
align: "left",
label: "หน่วยงานที่ออกคำสั่ง",
sortable: false,
field: "posNumCodeSit",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posNumCodeSitAbb",
align: "left",
label: "ตัวย่อหน่วยงานที่ออกคำสั่ง",
sortable: false,
field: "posNumCodeSitAbb",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posNo",
@ -86,10 +106,6 @@ const baseColumns = ref<QTableColumn[]>([
? row.posNo
: "-";
},
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionName",
@ -99,10 +115,6 @@ const baseColumns = ref<QTableColumn[]>([
field: "positionName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionType",
@ -112,10 +124,6 @@ const baseColumns = ref<QTableColumn[]>([
field: "positionType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionLevel",
@ -134,8 +142,6 @@ const baseColumns = ref<QTableColumn[]>([
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionExecutive",
@ -145,8 +151,6 @@ const baseColumns = ref<QTableColumn[]>([
field: "positionExecutive",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "commandNo",
@ -161,8 +165,6 @@ const baseColumns = ref<QTableColumn[]>([
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "commandCode",
@ -175,8 +177,6 @@ const baseColumns = ref<QTableColumn[]>([
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "organization",
@ -184,7 +184,7 @@ const baseColumns = ref<QTableColumn[]>([
label: "สังกัด",
sortable: false,
field: "organization",
headerStyle: "font-size: 14px",
headerStyle: "font-size: 14px;min-width: 280px",
style: "font-size: 14px",
format(val, row) {
return findOrgName({
@ -195,8 +195,6 @@ const baseColumns = ref<QTableColumn[]>([
child4: row.orgChild4,
});
},
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "amount",
@ -215,10 +213,6 @@ const baseColumns = ref<QTableColumn[]>([
}`
: "-";
},
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "mouthSalaryAmount",
@ -229,10 +223,6 @@ const baseColumns = ref<QTableColumn[]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionSalaryAmount",
@ -243,10 +233,6 @@ const baseColumns = ref<QTableColumn[]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => Number(v).toLocaleString(),
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
@ -257,14 +243,13 @@ const baseColumns = ref<QTableColumn[]>([
field: "remark",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<string[]>([
"no",
"commandDateAffect",
"posNumCodeSit",
"posNumCodeSitAbb",
"posNo",
"positionName",
"positionType",
@ -309,6 +294,7 @@ async function fetchData() {
const data = res.data.result;
rowsMain.value = data;
rows.value = data;
serchDataTable();
})
.catch((err) => {
messageError($q, err);
@ -351,26 +337,39 @@ async function onSwapData(action: string, id: string) {
});
}
function onDeleteData(id: string, isDelete: boolean) {
dialogRemove($q, async () => {
showLoader();
const path = isDelete ? "/delete-renew" : "/delete";
await http
.post(config.API.salaryTemp + `${path}`, {
type: empType.value,
salaryId: id,
})
.then(async () => {
await fetchData();
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
function onConfirmDeleteData(id: string, isDelete: boolean) {
isDelete
? dialogConfirm(
$q,
() => {
onDeleteData(id, isDelete);
},
"ยืนยันการย้อนกลับข้อมูล",
"ต้องการยืนยันการย้อนกลับข้อมูลนี้ใช่หรือไม่?"
)
: dialogRemove($q, () => {
onDeleteData(id, isDelete);
});
});
}
async function onDeleteData(id: string, isDelete: boolean) {
showLoader();
const path = isDelete ? "/delete-renew" : "/delete";
await http
.post(config.API.salaryTemp + `${path}`, {
type: empType.value,
salaryId: id,
})
.then(async () => {
await fetchData();
success($q, isDelete ? "ย้อนกลับข้อมูลสำเร็จ" : "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function classColorRow(isDelete: boolean, isEdit: boolean, isEntry: boolean) {
@ -484,7 +483,7 @@ onMounted(() => {
:icon="props.row.isDelete ? 'mdi-refresh-circle' : 'delete'"
:color="props.row.isDelete ? 'orange' : 'red'"
@click.stop.pervent="
onDeleteData(props.row.id, props.row.isDelete)
onConfirmDeleteData(props.row.id, props.row.isDelete)
"
>
<q-tooltip>{{
@ -505,10 +504,10 @@ onMounted(() => {
: ''
"
>
<div
v-if="col.name === 'organization'"
class="text-html table_ellipsis"
>
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name === 'organization'" class="text-html">
{{
findOrgNameHtml({
root: props.row.orgRoot,
@ -519,10 +518,8 @@ onMounted(() => {
})
}}
</div>
<div
v-else-if="col.name === 'commandCode'"
class="table_ellipsis"
>
<div v-else-if="col.name === 'commandCode'">
{{ col.value ? col.value : "-" }}
</div>
<div v-else>