fixing insignia deputy

This commit is contained in:
Warunee Tamkoo 2025-05-14 21:02:56 +07:00
parent cc1927a2f4
commit ae9e989a14
5 changed files with 31 additions and 13 deletions

View file

@ -308,7 +308,11 @@ const person = ref<DataManageList>();
/** เช็คสถานนะแสดงปุ่มเพิ่ม*/
const checkStatus = computed(() => {
if (
DataStore.isStaff &&
((DataStore.isOfficer &&
DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === organization.value && v.isDeputy === true
) > -1) ||
DataStore.isStaff) &&
(DataStore.requestStatus == "st1" || DataStore.requestStatus == "st4")
) {
return true;
@ -846,9 +850,10 @@ function clearInsigniaFilters(name: string) {
watch(
() => DataStore.typeOc,
async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
() => {
filterOrganizationOP.value = DataStore.optionsTypeOc;
organization.value = DataStore.typeOc;
DataStore.selectOrganization = DataStore.typeOc;
}
);
@ -890,6 +895,7 @@ function onClickViewInfo(type: string, id: string, empClass: string) {
onMounted(async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = DataStore.typeOc;
DataStore.selectOrganization = DataStore.typeOc;
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {

View file

@ -269,7 +269,8 @@ function onSearch() {
/*** Hook*/
onMounted(async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
organization.value = DataStore.typeOc;
DataStore.selectOrganization = DataStore.typeOc;
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
isDeputy.value = await (DataStore.optionsTypeOc.findIndex(
@ -293,6 +294,7 @@ watch(
async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
DataStore.selectOrganization = DataStore.typeOc;
}
);
</script>

View file

@ -271,15 +271,17 @@ function onSearch() {
watch(
() => DataStore.typeOc,
async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
filterOrganizationOP.value = DataStore.optionsTypeOc;
organization.value = DataStore.typeOc;
DataStore.selectOrganization = DataStore.typeOc;
}
);
/** Hook*/
onMounted(async () => {
filterOrganizationOP.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
filterOrganizationOP.value = DataStore.optionsTypeOc;
organization.value = DataStore.typeOc;
DataStore.selectOrganization = DataStore.typeOc;
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
isDeputy.value = await (DataStore.optionsTypeOc.findIndex(

View file

@ -47,6 +47,8 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
const isOfficer = ref<boolean>(false);
const isStaff = ref<boolean>(false);
const isDirector = ref<boolean>(false);
const isDeputy = ref<boolean>(false);
const selectOrganization = ref<string>("");
/** option รายงาน */
const optionReport = ref<OptionReport[]>([
@ -285,5 +287,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
isStaff,
isOfficer,
isDirector,
isDeputy,
selectOrganization,
};
});

View file

@ -158,6 +158,7 @@ async function fecthAgency(id: string) {
})
.then((res) => {
DataStore.agency = res.data.result.rootId;
DataStore.selectOrganization = res.data.result.rootId;
DataStore.typeOc = DataStore.agency;
})
.catch((err) => {
@ -190,6 +191,7 @@ async function fetchCheckIsofficer() {
DataStore.isStaff = data.isStaff;
DataStore.isOfficer = data.isOfficer;
DataStore.isDirector = data.isDirector;
DataStore.isDeputy = data.isDeputy;
})
.catch((err) => {
messageError($q, err);
@ -556,7 +558,7 @@ onUnmounted(() => {
>
<div
v-if="
(DataStore.isStaff && requestStatus == 'st4') ||
(((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex((v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) && requestStatus == 'st4') ||
(DataStore.isDirector && requestStatus == 'st5')
"
class="q-pa-md q-gutter-sm"
@ -634,7 +636,7 @@ onUnmounted(() => {
<q-toolbar class="q-py-md text-right">
<q-file
v-if="DataStore.isStaff && checkPermission($route)?.attrIsUpdate"
v-if="((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex((v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) && checkPermission($route)?.attrIsUpdate"
bg-color="white"
clearable
outlined
@ -665,7 +667,7 @@ onUnmounted(() => {
flat
round
color="primary"
v-if="DataStore.isStaff && checkPermission($route)?.attrIsGet"
v-if="checkPermission($route)?.attrIsGet"
:href="document"
target="_blank"
>
@ -684,9 +686,11 @@ onUnmounted(() => {
>
</div>
<q-space />
<q-btn
v-if="
DataStore.isStaff &&
((DataStore.isOfficer && DataStore.optionsTypeOc.findIndex(
(v: OptionData) => v.id === DataStore.selectOrganization && v.isDeputy === true) > -1) || DataStore.isStaff) &&
(requestStatus == 'st1' || requestStatus == 'st4') &&
checkPermission($route)?.attrIsUpdate
"