diff --git a/src/api/07_insignia/api.insignia.ts b/src/api/07_insignia/api.insignia.ts index fd15b5c1b..3ccc46095 100644 --- a/src/api/07_insignia/api.insignia.ts +++ b/src/api/07_insignia/api.insignia.ts @@ -21,6 +21,7 @@ export default { insigniaReject: (profileId: string) => `${insignia}/request/status/reject/${profileId}`, insigniaDelete: (profileId: string) => `${insignia}/request/status/delete/${profileId}`, insigniaEdit: (profileId: string) => `${insignia}/request/${profileId}`, + insigniaNosend: (insigniaPeriodId: any) => `${insignia}/request/org/no-send/${insigniaPeriodId}`, insigniaAgency: () => `${insignia}/request/agency`, insigniaDashboard: (insigniaPeriodId: string) => `${insignia}/request/dashboard/${insigniaPeriodId}`, diff --git a/src/modules/07_insignia/components/2_Manage/Tab1.vue b/src/modules/07_insignia/components/2_Manage/Tab1.vue index c4e30e4c4..c93438b62 100644 --- a/src/modules/07_insignia/components/2_Manage/Tab1.vue +++ b/src/modules/07_insignia/components/2_Manage/Tab1.vue @@ -193,10 +193,11 @@ const props = defineProps({ }); onMounted(async () => { - if (DataStore.typeOc == "") { - organization.value = DataStore.optionsTypeOc[2].id; - DataStore.typeOc = organization.value; - } else organization.value = DataStore.typeOc; + // if (DataStore.typeOc == "") { + // // organization.value = DataStore.optionsTypeOc[2].id; + // DataStore.typeOc = organization.value; + // } else organization.value = DataStore.typeOc; + organization.value = DataStore.typeOc; organizationOptions.value = DataStore.optionsTypeOc; if (organization.value !== "" || organization.value !== undefined) { if (props.fecthInsigniaByOc) { @@ -608,7 +609,7 @@ const paginationLabel2 = (start: string, end: string, total: string) => { {{ props.rowIndex + 1 }} @@ -648,13 +649,14 @@ const paginationLabel2 = (start: string, end: string, total: string) => { flat round dense + @click.stop > { { (1); -const organizationOptions = ref([{ id: 1, name: "ทั้งหมด" }]); -const visibleColumns = ref([ - "no", - // "citizenId", - // "name", - // "position", - // "level", - // "salary", - "organization", - // "insigniaType", - // "insigniaSend", - // "insigniaLevel", - // "dateSend", -]); +const props = defineProps({ + roundId: { + type: String, + }, + tab: { + type: String, + }, +}); + +const visibleColumns = ref(["no", "orgName"]); // หัวตาราง const columns = ref([ { @@ -34,169 +30,43 @@ const columns = ref([ field: "no", headerStyle: "font-size: 14px", style: "font-size: 14px", - width: "0px", }, - // { - // name: "citizenId", - // align: "left", - // label: "เลขบัตรประชาชน", - // sortable: true, - // field: "citizenId", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, - // { - // name: "name", - // align: "left", - // label: "ชื่อ-นามสกุล", - // sortable: true, - // field: "name", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, - // { - // name: "position", - // align: "left", - // label: "ตำแหน่ง", - // sortable: true, - // field: "position", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, - // { - // name: "level", - // align: "left", - // label: "อันดับ/ระดับ", - // sortable: true, - // field: "level", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, - // { - // name: "salary", - // align: "left", - // label: "เงินเดือน", - // sortable: true, - // field: "salary", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, { - name: "organization", + name: "orgName", align: "left", label: "หน่วยงาน", sortable: true, - field: "organization", + field: "orgName", headerStyle: "font-size: 14px", style: "font-size: 14px", - width: "100px", - }, - // { - // name: "insigniaType", - // align: "left", - // label: "ประเภทเครื่องราชฯ ปัจจุบัน", - // sortable: true, - // field: "insigniaType", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, - // { - // name: "insigniaSend", - // align: "left", - // label: "ประเภทเครื่องราชฯ ที่ยื่นขอ", - // sortable: true, - // field: "insigniaSend", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, - // { - // name: "insigniaLevel", - // align: "left", - // label: "ชั้นเครื่องราชฯ", - // sortable: true, - // field: "insigniaLevel", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, - // { - // name: "dateSend", - // align: "left", - // label: "วันที่ยื่นขอ", - // sortable: true, - // field: "dateSend", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, -]); -// ข้อมูลตาราง (จำลอง) -const rows = ref([ - { - no: "1", - citizenId: "1xxxxxxxxxx", - name: "นายใจดี ยอดใจ ", - position: "นักวิชาการพัสดุ", - level: "1", - salary: "15000", - organization: "บริหาร", - insigniaType: "ทวีติยาภรณ์ช้างเผือก", - insigniaSend: "ตริตาภรณ์ช้างเผือก", - insigniaLevel: "ต่ำกว่าสายสะพาย", - dateSend: "31 ม.ค. 2566", - }, - { - no: "2", - citizenId: "1xxxxxxxxxx", - name: "นายจักกริน บัณฑิต", - position: "นักวิชาการพัสดุ", - level: "ปฏิบัติการ", - salary: "15000", - organization: "บริหาร", - insigniaType: "ทวีติยาภรณ์ช้างเผือก", - insigniaSend: "ตริตาภรณ์ช้างเผือก", - insigniaLevel: "ต่ำกว่าสายสะพาย", - dateSend: "31 ม.ค. 2566", - }, - { - no: "3", - citizenId: "1xxxxxxxxxx", - name: "นางสาวกัณฐิมา กาฬสินธุ์", - position: "นักจัดการงานทั่วไป", - level: "ปฏิบัติการ", - salary: "15000", - organization: "บริหาร", - insigniaType: "ทวีติยาภรณ์ช้างเผือก", - insigniaSend: "ตริตาภรณ์ช้างเผือก", - insigniaLevel: "ต่ำกว่าสายสะพาย", - dateSend: "31 ม.ค. 2566", - }, - { - no: "4", - citizenId: "1xxxxxxxxxx", - name: "นางสาวเมขลา กระจ่างมนตรี", - position: "นักจัดการงานทั่วไป", - level: "ปฏิบัติการ", - salary: "15000", - organization: "บริหาร", - insigniaType: "ทวีติยาภรณ์ช้างเผือก", - insigniaSend: "ตริตาภรณ์ช้างเผือก", - insigniaLevel: "ต่ำกว่าสายสะพาย", - dateSend: "31 ม.ค. 2566", }, ]); +const rows = ref([]); onMounted(async () => { - await fecthAgency(); + await fecthOrg(); +}); +watch(props, async () => { + if (props.tab === "organization") { + await fecthOrg(); + } }); -const fecthAgency = async () => { +const fecthOrg = async () => { showLoader(); await http - .get(config.API.insigniaAgency()) + .get(config.API.insigniaNosend(props.roundId)) .then((res) => { console.log(res); + let data = res.data.result; + rows.value = data.map((e: any) => ({ + orgId: e.orgId, + orgName: e.orgName, + })); + console.log(rows.value); }) .catch((err) => { - messageError($q, eer); + messageError($q, err); }) .finally(() => { hideLoader(); @@ -289,7 +159,7 @@ const paginationLabel = (start: string, end: string, total: string) => { class="col-xs-12 col-sm-3 col-md-2" /> --> -
+
{ {{ props.rowIndex + 1 }} - - {{ props.row.organization }} + + {{ props.row.orgName }} diff --git a/src/modules/07_insignia/components/2_Manage/listManage.vue b/src/modules/07_insignia/components/2_Manage/listManage.vue index 255d452a9..9a6b91b7f 100644 --- a/src/modules/07_insignia/components/2_Manage/listManage.vue +++ b/src/modules/07_insignia/components/2_Manage/listManage.vue @@ -37,7 +37,7 @@ const stat = ref({ }); onMounted(async () => { await fecthlistRound(); - await fecthType(); + await fecthAgency(); }); const fecthlistRound = async () => { await http @@ -46,7 +46,9 @@ const fecthlistRound = async () => { optionRound.value = res.data.result.map((e: any) => ({ id: e.period_id, year: e.period_year, - name: `รอบการเสนอพระราชทานเครื่องราช ${e.period_name} ปี ${e.period_year} `, + name: `รอบการเสนอพระราชทานเครื่องราชรอบที่ ${e.period_round} ปี ${ + e.period_year + 543 + } `, })); // console.log(optionRound.value); // const lastIndex = optionRound.value.length; @@ -59,24 +61,6 @@ const fecthlistRound = async () => { messageError($q, err); }); }; -const fecthType = async () => { - await http - .get(config.API.typeOc()) - .then((res) => { - optiontypeOc.value = res.data.result.map((e: any) => ({ - id: e.organizationId, - name: e.organizationName, - })); - DataStore.optionsTypeOc = optiontypeOc.value; - }) - .catch((err) => { - console.log(err); - messageError($q, err); - }) - .finally(() => { - loading.value = true; - }); -}; const fecthStat = async (id: string) => { showLoader(); await http @@ -91,6 +75,40 @@ const fecthStat = async (id: string) => { hideLoader(); }); }; +const fecthAgency = async () => { + showLoader(); + await http + .get(config.API.insigniaAgency()) + .then(async (res) => { + DataStore.agency = res.data.result; + await fecthType(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +}; +const fecthType = async () => { + await http + .get(config.API.typeOc()) + .then((res) => { + optiontypeOc.value = res.data.result.map((e: any) => ({ + id: e.organizationId, + name: e.organizationName, + })); + DataStore.fetchOption(optiontypeOc.value); + // DataStore.optionsTypeOc = ; + }) + .catch((err) => { + console.log(err); + messageError($q, err); + }) + .finally(() => { + loading.value = true; + }); +}; const changround = () => { fecthStat(round.value); fecthInsigniaByOc(round.value, DataStore.typeOc, "officer", tab.value); @@ -153,7 +171,7 @@ const fecthInsigniaByOc = async ( @update:model-value="changround" />
-
+
diff --git a/src/modules/07_insignia/store.ts b/src/modules/07_insignia/store.ts index fa21123a3..b3651dda9 100644 --- a/src/modules/07_insignia/store.ts +++ b/src/modules/07_insignia/store.ts @@ -11,6 +11,7 @@ const { export const useInsigniaDataStore = defineStore("insignia", () => { let optionsTypeOc = ref([]); let typeOc = ref("") + const agency = ref('') let rows = ref([]) const listinsignia = ref([]) const typeinsignia = ref("all"); @@ -36,6 +37,17 @@ export const useInsigniaDataStore = defineStore("insignia", () => { listinsignia.value = await rows.value filtertypeInsignia() } else rows.value = [] + } + const fetchOption = (op: any) => { + console.log(agency.value); + console.log(op); + if (agency.value !== null) { + typeOc.value = agency.value + optionsTypeOc.value = op.filter((e: any) => e.id == agency.value + ) + } else { optionsTypeOc.value = op, typeOc.value = op[2].id } + console.log(optionsTypeOc.value); + } @@ -45,16 +57,19 @@ export const useInsigniaDataStore = defineStore("insignia", () => { const double_name = [ ...new Set(listinsignia.value.map((item: any) => item.insigniaType)), ]; + typeinsigniaOptions.value = [{ id: "all", name: "ทั้งหมด" }] for (let i = 1; i <= double_name.length; i++) { const type = double_name[i - 1]; const listtype = { id: type, name: type, }; + // typeinsigniaOptions.value = [{ id: "all", name: "ทั้งหมด" }] typeinsigniaOptions.value.push(listtype) } } else typeinsigniaOptions.value = [{ id: "all", name: "ทั้งหมด" }] }; + const searchFilterTable = async () => { if (typeinsignia.value !== undefined && typeinsignia.value !== null) { if (typeinsignia.value === "all") { @@ -73,7 +88,9 @@ export const useInsigniaDataStore = defineStore("insignia", () => { rows, typeinsigniaOptions, typeinsignia, + agency, fetchData, + fetchOption, searchFilterTable, }; });