diff --git a/src/modules/07_insignia/components/5_Borrow/DialogForm.vue b/src/modules/07_insignia/components/5_Borrow/DialogForm.vue index 8bab40b01..94b60c3d9 100644 --- a/src/modules/07_insignia/components/5_Borrow/DialogForm.vue +++ b/src/modules/07_insignia/components/5_Borrow/DialogForm.vue @@ -114,10 +114,16 @@ const fetchOrgList = async () => { await http .get(config.API.typeOc()) .then(async (response: any) => { - OrgList.value = response.data.result.map((e: any) => ({ + const orgArr = response.data.result.map((e: any) => ({ id: e.organizationId, name: e.organizationName })) + + if (props.action == 'editData') { + OrgList.value = [{id: "00000000-0000-0000-0000-000000000000", name: 'สำนักนายกรัฐมนตรี'},...orgArr] + } else { + OrgList.value = orgArr + } }) .catch((err) => { messageError($q, err) diff --git a/src/modules/07_insignia/components/5_Borrow/Main.vue b/src/modules/07_insignia/components/5_Borrow/Main.vue index d7339f75b..866b9c7fb 100644 --- a/src/modules/07_insignia/components/5_Borrow/Main.vue +++ b/src/modules/07_insignia/components/5_Borrow/Main.vue @@ -48,7 +48,7 @@ const fecthRound = async () => { let data = res.data.result; selectRoundAllOption.value = [{ name: "ทั้งหมด", - id: "all", + id: "00000000-0000-0000-0000-000000000000", year: 0, }] @@ -252,7 +252,7 @@ const columns = ref([ { name: "returnDate", align: "left", - label: "วันที่ยืม", + label: "วันที่คืน", field: "returnDate", sortable: true, sort: (a: string, b: string) => @@ -280,45 +280,23 @@ watch(tab, async () => { fecthlistInsignia(); }); -const selectorInsignia = () => { - fecthlistInsignia(); +const selectorInsignia = async() => { + const dataCopy = await DataStore.listInsignia; + rows.value = DataStore.insignia != '' ? dataCopy.filter((x:any)=>x.requestInsigniaId == DataStore.insignia): dataCopy }; -const selectorRound = (round: string) => { - selectRound.value = round; -}; +// const selectorRound = (round: string) => { +// selectRound.value = round; +// }; const rows = ref([]); - const fecthlistInsignia = async () => { showLoader(); await http .get(config.API.insigniaManageBorrowList(Number(roundYear.value), tab.value)) - .then((res) => { - let data = res.data.result; - rows.value = []; - rows.value = data.map((e: any) => ({ - id: e.id, - citizenId: e.citizenId, - prefix: e.prefix, - position: e.position, - // status: DataStore.status(e.status), - name: e.fullName, - type: e.requestInsignia, - employeeType: DataStore.profileType(e.profileType), - profileType: e.profileType, - page: e.page, - number: e.no, - vatnumber: e.number, - datepay: date2Thai(e.datePayment), - typepay: e.typePayment, - address: e.address, - borrowOrganization: e.borrowOrganization, - borrowDate: e.borrowDate !== null ? date2Thai(e.borrowDate) : '-', - returnOrganization: e.returnOrganization, - returnDate: e.returnDate !== null ? date2Thai(e.returnDate) : '-', - returnReason: e.returnReason !== null ? e.returnReason : '-', - })); + .then(async (res) => { + await DataStore.fetchlistinsignia(res.data.result) + rows.value = DataStore.rows }) .catch((err) => { console.log(err); @@ -350,6 +328,7 @@ const editData = (id: any) => { profileId.value = id; action.value = "editData"; modal.value = true; + }; const resetFilter = () => { @@ -377,12 +356,12 @@ const resetFilter = () => {
-
+
{ {{ props.rowIndex + 1 }}
-
+
+
@@ -470,7 +450,7 @@ const resetFilter = () => { {{ props.rowIndex + 1 }}
-
+
@@ -519,7 +499,7 @@ const resetFilter = () => { {{ props.rowIndex + 1 }}
-
+
@@ -536,8 +516,9 @@ const resetFilter = () => {
- +