รวมไฟล์แก้งานงวด2

This commit is contained in:
Kittapath 2023-07-10 10:10:46 +07:00
parent 79889c9464
commit 2249097b07
89 changed files with 11287 additions and 7048 deletions

View file

@ -27,7 +27,7 @@
v-if="col.name == 'refCommandDate' || col.name == 'date'"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
@ -126,9 +126,9 @@
:readonly="!edit"
:borderless="!edit"
v-model="level"
:rules="[(val:string) => !!val || `${'กรุณาเลือกระดับความผิด'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกระดับการลงโทษทางวินัย'}`]"
hide-bottom-space
:label="`${'ระดับความผิด'}`"
:label="`${'ระดับการลงโทษทางวินัย'}`"
@update:modelValue="clickEditRow"
emit-value
map-options
@ -150,16 +150,35 @@
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refCommandNo"
:rules="[
(val:string) =>
!!val || `${'กรุณากรอกเอกสารอ้างอิง (เลขที่คำสั่ง)'}`,
]"
v-model="unStigma"
hide-bottom-space
:label="`${'เอกสารอ้างอิง (เลขที่คำสั่ง)'}`"
:label="`${'ล้างมลทิน'}`"
@update:modelValue="clickEditRow"
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
:class="getClass(edit)"
:outlined="edit"
dense
lazy-rules
:readonly="!edit"
:borderless="!edit"
v-model="refCommandNo"
hide-bottom-space
:label="`${'เลขที่คำสั่ง'}`"
:rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่คำสั่ง'}`]"
@update:modelValue="clickEditRow"
>
<template v-slot:append>
<q-icon
name="mdi-file"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<datepicker
menu-class-name="modalfix"
@ -182,11 +201,9 @@
dense
lazy-rules
:borderless="!edit"
:model-value="date2Thai(refCommandDate)"
:rules="[
(val:string) =>
!!val || `${'กรุณาเลือกเอกสารอ้างอิง (ลงวันที่)'}`,
]"
:model-value="
refCommandDate == null ? null : date2Thai(refCommandDate)
"
hide-bottom-space
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
>
@ -246,7 +263,7 @@
"
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
@ -346,8 +363,9 @@ const OpsFilter = ref<DisciplineOps>({
],
});
const detail = ref<string>();
const unStigma = ref<string>();
const refCommandNo = ref<string>();
const refCommandDate = ref<Date>(new Date());
const refCommandDate = ref<Date | null>(new Date());
const date = ref<Date>(new Date());
const myForm = ref<any>(); //form data input
const edit = ref<boolean>(false); // dialog
@ -363,9 +381,7 @@ const tittleHistory = ref<string>("ประวัติแก้ไขวิน
const filterHistory = ref<string>(""); //search data table history
const modalHistory = ref<boolean>(false); //modal
const checkValidate = ref<boolean>(false); //validate data
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const profileId = ref<string>(route.params.id.toString());
const rows = ref<RequestItemsObject[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
@ -373,6 +389,7 @@ profileData.discipline.columns.length == 0
? (visibleColumns.value = [
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
"date",
@ -404,7 +421,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "level",
align: "left",
label: "ระดับความผิด",
label: "ระดับการลงโทษทางวินัย",
sortable: true,
field: "level",
headerStyle: "font-size: 14px",
@ -412,10 +429,21 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "unStigma",
align: "left",
label: "ล้างมลทิน",
sortable: true,
field: "unStigma",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
@ -461,7 +489,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
{
name: "level",
align: "left",
label: "ระดับความผิด",
label: "ระดับการลงโทษทางวินัย",
sortable: true,
field: "level",
headerStyle: "font-size: 14px",
@ -469,10 +497,21 @@ const columnsHistory = ref<QTableProps["columns"]>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "unStigma",
align: "left",
label: "ล้างมลทิน",
sortable: true,
field: "unStigma",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "refCommandNo",
align: "left",
label: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
@ -517,6 +556,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
const visibleColumnsHistory = ref<String[]>([
"level",
"detail",
"unStigma",
"refCommandNo",
"refCommandDate",
"date",
@ -547,33 +587,33 @@ const filterSelector = (val: string, update: Function, refData: string) => {
};
const fetchData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.get(config.API.profileDisId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
level: e.level,
detail: e.detail,
refCommandNo: e.refCommandNo,
refCommandDate: new Date(e.refCommandDate),
date: new Date(e.date),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
loaderPage(true);
await http
.get(config.API.profileDisId(profileId.value))
.then((res) => {
let data = res.data.result;
rows.value = [];
data.map((e: ResponseObject) => {
rows.value.push({
id: e.id,
level: e.level,
detail: e.detail,
unStigma: e.unStigma,
refCommandNo: e.refCommandNo,
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
date: new Date(e.date),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
});
};
/**
@ -603,6 +643,7 @@ const getData = () => {
const row = rows.value[rowIndex.value];
level.value = row.level;
detail.value = row.detail;
unStigma.value = row.unStigma;
refCommandNo.value = row.refCommandNo;
refCommandDate.value = row.refCommandDate;
date.value = row.date;
@ -660,28 +701,28 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
if (profileId.value !== "") {
loaderPage(true);
await http
.post(config.API.profileDisId(profileId.value), {
id: id.value,
level: level.value,
detail: detail.value,
refCommandNo: refCommandNo.value,
refCommandDate: dateToISO(refCommandDate.value),
date: dateToISO(date.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
}
loaderPage(true);
await http
.post(config.API.profileDisId(profileId.value), {
id: id.value,
level: level.value,
detail: detail.value,
unStigma: unStigma.value,
refCommandNo: refCommandNo.value,
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
date: dateToISO(date.value),
})
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
});
};
/**
@ -694,8 +735,10 @@ const editData = async () => {
id: id.value,
level: level.value,
detail: detail.value,
unStigma: unStigma.value,
refCommandNo: refCommandNo.value,
refCommandDate: dateToISO(refCommandDate.value),
refCommandDate:
refCommandDate.value == null ? null : dateToISO(refCommandDate.value),
date: dateToISO(date.value),
})
.then((res) => {
@ -776,6 +819,7 @@ const selectData = async (props: DataProps) => {
rowIndex.value = props.rowIndex;
level.value = props.row.level;
detail.value = props.row.detail;
unStigma.value = props.row.unStigma;
refCommandNo.value = props.row.refCommandNo;
refCommandDate.value = props.row.refCommandDate;
date.value = props.row.date;
@ -792,8 +836,9 @@ const addData = () => {
edit.value = true;
level.value = "";
detail.value = "";
unStigma.value = "";
refCommandNo.value = "";
refCommandDate.value = new Date();
refCommandDate.value = null;
date.value = new Date();
};
@ -843,8 +888,10 @@ const clickHistory = async (row: RequestItemsObject) => {
id: e.id,
level: e.level,
detail: e.detail,
unStigma: e.unStigma,
refCommandNo: e.refCommandNo,
refCommandDate: new Date(e.refCommandDate),
refCommandDate:
e.refCommandDate == null ? null : new Date(e.refCommandDate),
date: new Date(e.date),
createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt),
@ -881,6 +928,7 @@ const getClass = (val: boolean) => {
"full-width cursor-pointer": !val,
};
};
const resetFilter = () => {};
</script>
<style lang="scss">
.modalfix {