Merge branch 'nice_dev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-23 10:13:46 +07:00
commit 5228fb8b27
5 changed files with 99 additions and 191 deletions

View file

@ -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) => {
<q-tr
:props="props"
class="cursor-pointer"
@click="nextPage(props.row.profileId)"
@click.stop="nextPage(props.row.profileId)"
>
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
@ -648,13 +649,14 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
flat
round
dense
@click.stop
>
<q-menu transition-show="jump-down" transition-hide="jump-up">
<q-list dense style="min-width: 250px">
<q-item
clickable
v-close-popup
@click="clickmodalEdit(props.row)"
@click.stop="clickmodalEdit(props.row)"
>
<q-item-section
style="min-width: 0px"
@ -671,7 +673,7 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
<q-item
clickable
v-close-popup
@click="clickReject(props.row.profileId)"
@click.stop="clickReject(props.row.profileId)"
>
<q-item-section
style="min-width: 0px"
@ -690,7 +692,7 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
<q-item
clickable
v-close-popup
@click="clickDelete(props.row.profileId)"
@click.stop="clickDelete(props.row.profileId)"
>
<q-item-section
style="min-width: 0px"

View file

@ -2,6 +2,7 @@
import { onMounted, ref, watch } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
@ -9,21 +10,16 @@ const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
const organization = ref<string>(1);
const organizationOptions = ref<any>([{ id: 1, name: "ทั้งหมด" }]);
const visibleColumns = ref<string[]>([
"no",
// "citizenId",
// "name",
// "position",
// "level",
// "salary",
"organization",
// "insigniaType",
// "insigniaSend",
// "insigniaLevel",
// "dateSend",
]);
const props = defineProps({
roundId: {
type: String,
},
tab: {
type: String,
},
});
const visibleColumns = ref<string[]>(["no", "orgName"]);
//
const columns = ref<QTableProps["columns"]>([
{
@ -34,169 +30,43 @@ const columns = ref<QTableProps["columns"]>([
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<any[]>([
{
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<any[]>([]);
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"
/>
</div> -->
<div class="col-12 ">
<div class="col-12">
<q-table
ref="table"
:columns="columns"
@ -319,8 +189,8 @@ const paginationLabel = (start: string, end: string, total: string) => {
<q-td key="no" style="width: 50px" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="organization" style="width: 300px" :props="props">
{{ props.row.organization }}
<q-td key="orgName" style="width: 300px" :props="props">
{{ props.row.orgName }}
</q-td>
</q-tr>
</template>

View file

@ -37,7 +37,7 @@ const stat = ref<any>({
});
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"
/>
</div>
<div class="col-12"><q-separator/></div>
<div class="col-12"><q-separator /></div>
<div class="col-12 row bg-white">
<div class="fit q-px-md q-py-sm">
<div class="row col-12 q-col-gutter-sm fit">

View file

@ -11,6 +11,7 @@ const {
export const useInsigniaDataStore = defineStore("insignia", () => {
let optionsTypeOc = ref<any>([]);
let typeOc = ref<string>("")
const agency = ref<string>('')
let rows = ref<any>([])
const listinsignia = ref<any>([])
const typeinsignia = ref<number | string>("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,
};
});