Refactoring code module 05_placement

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-19 15:02:44 +07:00
parent 202fbf27b6
commit 4678ead38e
75 changed files with 3110 additions and 10795 deletions

View file

@ -15,8 +15,8 @@ import type {
ResponseRow,
} from "@/modules/05_placement/interface/response/Receive";
import Dialogbody from "@/modules/05_placement/components/Receive/Dialogbody.vue";
import DialogHeader from "@/modules/05_placement/components/Receive/DialogHeader.vue";
import Dialogbody from "@/modules/05_placement/components/Receive/DialogOrders.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogOrgSelect from "@/components/Dialogs/DialogOrgSelect.vue";
const $q = useQuasar();
@ -34,27 +34,27 @@ const {
} = mixin;
const dataRecevice = ref<ResponseData[]>([]); //
const filters = ref<ResponseRow[]>([]); //
const dataRows = ref<ResponseRow>(); //
const modal = ref<boolean>(false); // popup
const modalupload = ref<boolean>(false); // popup
const modalTree = ref<boolean>(false); // popup
const dataRows = ref<any[]>([]);
const rows2 = ref<ResponseRow[]>([]);
const modal = ref<boolean>(false);
const modalupload = ref<boolean>(false);
const modalTree = ref<boolean>(false);
const myForm = ref<any>();
const personal = ref<ResponseData[]>([]);
const personalId = ref<string>("");
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
const files = ref<any>();
const filters = ref<ResponseRow[]>([]);
const rows = ref<ResponseRow[]>([]);
const posType = ref<string>("");
const posLevel = ref<string>("");
const position = ref<string>("");
const personal = ref<ResponseData[]>([]); //
const personalId = ref<string>(""); //
const files = ref<any>(); //
const posType = ref<string>(""); //
const posLevel = ref<string>(""); //
const position = ref<string>(""); //
const type = ref<string | null>(null);
//Table
const rows = ref<ResponseRow[]>([]); //
const rows2 = ref<ResponseRow[]>([]); //
const filterKeyword = ref<string>(""); //
const filterKeyword2 = ref<string>(""); //
const visibleColumns = ref<string[]>([
"no",
"citizenId",
@ -143,6 +143,9 @@ const columns = ref<QTableProps["columns"]>([
},
]);
/**
* งกนดงขอมลรายการรบโอน
*/
async function fecthlistRecevice() {
showLoader();
await http
@ -189,45 +192,58 @@ function onSubmitDoc() {
});
}
//
const resetFilter = () => {
/**
* งกนบรเซตคาในฟลเตอร
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
};
//
const clickClose = () => {
}
/**
* งกนป popup ออกคำส
*/
function clickClose() {
modal.value = false;
filterKeyword2.value = "";
};
//
const clickCloseUpload = () => {
}
/**
* งกนป popup ปเดตไฟล
*/
function clickCloseUpload() {
modalupload.value = false;
files.value = null;
};
//
const openModalTree = (id: string, data: any) => {
}
/**
* งกนเป popup เลอกหนวยงานทบโอน
*/
function openModalTree(id: string, data: any) {
personalId.value = id;
personal.value = dataRecevice.value.filter((e: ResponseData) => e.id === id);
dataRows.value = data;
modalTree.value = true;
type.value = null;
dataRows.value = data;
// console.log("data===>", data);
posType.value = data.posTypeOldId;
posLevel.value = data.posLevelOldId;
position.value = data.positionOld;
};
//
const openUpload = (id: string) => {
}
/**
* งกนเป popup ปเดตไฟล
* @param id รายการทองการอปเดตไฟล
*/
function openUpload(id: string) {
personalId.value = id;
modalupload.value = true;
};
//
const openDelete = (id: string) => {
}
/**
* งกนยนยนการลบขอม
* @param id รายการทองการลบ
*/
function openDelete(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
@ -241,16 +257,24 @@ const openDelete = (id: string) => {
hideLoader();
});
});
};
}
//
const nextPage = (id: string) => {
/**
* งกนไปหนารายละเอยด
* @param id รายการทองการดรายละเอยก
*/
function nextPage(id: string) {
router.push({
path: `/placement/receive/${id}`,
});
};
}
const popup = () => {
/**
* งกนสงไปออกคำส
*
* นหารายชอออกคำสงตามสถานะ อน (APPROVE)
*/
function openModalOrder() {
const row = filters.value.filter(
(r: any) =>
(r.status == "WAITTING" ||
@ -267,10 +291,9 @@ const popup = () => {
rows2.value = row;
modal.value = true;
};
}
function onSave(data: any) {
console.log("not save", data);
const dataAppoint = {
node: data.node,
nodeId: data.nodeId,
@ -303,6 +326,9 @@ function onSave(data: any) {
});
}
/**
* ทำงานเมอมการเรยกใช Components
*/
onMounted(() => {
fecthlistRecevice();
});
@ -331,7 +357,7 @@ onMounted(() => {
round
color="add"
icon="mdi-account-arrow-right"
@click="popup()"
@click="openModalOrder()"
>
<q-tooltip>งไปออกคำสงรบโอน</q-tooltip>
</q-btn>
@ -550,34 +576,23 @@ onMounted(() => {
</div>
</q-card>
<!-- ออกคำส -->
<Dialogbody
v-model:Modal="modal"
:clickClose="clickClose"
:rows2="rows2"
v-model:filterKeyword2="filterKeyword2"
:fecthlistRecevice="fecthlistRecevice"
:nextPage="nextPage"
/>
<!-- ปโหลดเอกสาร -->
<q-dialog v-model="modalupload">
<q-card style="width: 600px">
<q-form greedy @submit.prevent @validation-success="onSubmitDoc">
<DialogHeader title="อัปโหลดเอกสาร" :close="clickCloseUpload" />
<DialogHeader tittle="อัปโหลดเอกสาร" :close="clickCloseUpload" />
<q-separator />
<q-card-section class="q-py-sm">
<div class="col-12 row items-center q-col-gutter-sm">
<div class="col-12">
<q-file
ref="myForm"
outlined
dense
v-model="files"
label="อัปโหลดเอกสาร"
lazy-rules
:rules="[
(val) => val || 'กรุณาเลือกไฟล์หนังสือถึงหน่วยงานที่รับโอน',
(val:string) => val || 'กรุณาเลือกไฟล์หนังสือถึงหน่วยงานที่รับโอน',
]"
hide-bottom-space
>
@ -599,6 +614,16 @@ onMounted(() => {
</q-card>
</q-dialog>
<!-- ออกคำส -->
<Dialogbody
v-model:modal="modal"
v-model:filter-keyword2="filterKeyword2"
:click-close="clickClose"
:rows2="rows2"
:fecthlist-recevice="fecthlistRecevice"
:next-page="nextPage"
/>
<!-- เลอกหนวยงานทบโอน -->
<DialogOrgSelect
:title="`เลือกหน่วยงานที่รับโอน`"