เพิ่มเงื่อนไข เพิ่มและแก้ไข เครื่องราชฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-01 16:22:34 +07:00
parent 1a294be701
commit 8c13173bbb
3 changed files with 47 additions and 7 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, ref, watch, reactive } from "vue";
import { onMounted, ref, computed, reactive } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
@ -228,6 +228,14 @@ onMounted(async () => {
}
}
});
const checkStatus = computed(() => {
if (
DataStore.roleUser === "insignia1" &&
(DataStore.requestStatus == "st1" || DataStore.requestStatus == "st4")
) {
return true;
} else return false;
});
const changtypeOc = () => {
if (props.fecthInsigniaByOc) {
props.fecthInsigniaByOc(
@ -663,7 +671,12 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
color="add"
icon="mdi-plus"
@click="clickmodalAdd"
v-if="DataStore.isLock !== true"
v-if="
(DataStore.isLock == false &&
DataStore.requestStatus == 'st5' &&
DataStore.roleUser == 'admin') ||
checkStatus == true
"
>
<q-tooltip>เพ</q-tooltip>
</q-btn>
@ -728,7 +741,14 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width v-if="DataStore.isLock !== true" />
<q-th
auto-width
v-if="
(DataStore.isLock == false &&
DataStore.requestStatus == 'st5') ||
checkStatus == true
"
/>
</q-tr>
</template>
<template v-slot:body="props">
@ -770,7 +790,15 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
<q-td key="dateSend" :props="props">
{{ props.row.dateSend }}
</q-td>
<q-td auto-width v-if="DataStore.isLock !== true">
<q-td
auto-width
v-if="
(DataStore.isLock == false &&
DataStore.requestStatus == 'st5' &&
DataStore.roleUser == 'admin') ||
checkStatus == true
"
>
<q-btn
v-if="
roleUser == 'admin' ||

View file

@ -53,6 +53,7 @@ const checkRole = async () => {
} else {
roleUser.value = "admin";
}
DataStore.roleUser = roleUser.value;
}
};
@ -157,8 +158,9 @@ const fecthInsigniaByOc = async (
requestNote.value = res.data.result.requestNote;
requestStatus.value = res.data.result.requestStatus;
await DataStore.fetchData(res.data.result.items);
DataStore.isLock = await res.data.result.isLock;
DataStore.requestId = await res.data.result.requestId;
await DataStore.fetchDataInsignia(res.data.result);
// DataStore.isLock = await res.data.result.isLock;
// DataStore.requestId = await res.data.result.requestId;
})
.catch((err) => {
messageError($q, err);

View file

@ -7,7 +7,9 @@ const { date2Thai } = mixin;
export const useInsigniaDataStore = defineStore("insignia", () => {
const isLock = ref<boolean>(false)
const roleUser = ref<string>("")
const requestId = ref<string>("")
const requestStatus = ref<string>("")
let optionsTypeOc = ref<any>([]);
let typeOc = ref<string>("");
const agency = ref<string>("");
@ -49,6 +51,11 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
filtertypeInsignia();
} else rows.value = [];
};
const fetchDataInsignia = async (data: any) => {
isLock.value = data.isLock;
requestId.value = data.requestId;
requestStatus.value = data.requestStatus;
}
const fetchOption = (op: any) => {
if (agency.value !== null) {
typeOc.value = agency.value;
@ -128,7 +135,10 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
selectEmployeeClass,
employeeClass,
employeeClassOps,
fetchDataInsignia,
isLock,
requestId
requestId,
roleUser,
requestStatus,
};
});