Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop
This commit is contained in:
commit
17515b3cb0
1 changed files with 48 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, ref, reactive, computed } from "vue";
|
||||
import { onMounted, ref, reactive, computed, readonly } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
|
|
@ -20,7 +20,9 @@ import DialogUpdateCouple from "@/modules/04_registryPerson/components/Dialog/06
|
|||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const typeEmp = ref<string>("");
|
||||
const typeEmp = ref<string>(
|
||||
route.name === "registryNewRequestEditEmpDetail" ? "employee" : ""
|
||||
);
|
||||
const store = useRequestEditStore();
|
||||
const {
|
||||
dialogConfirm,
|
||||
|
|
@ -72,8 +74,6 @@ const isCheckData = computed(() => {
|
|||
/** function fetch ข้อมูลคำร้องแก้ไข*/
|
||||
async function fetchDataRequest() {
|
||||
showLoader();
|
||||
typeEmp.value =
|
||||
route.name === "registryNewRequestEditEmpDetail" ? "employee" : "";
|
||||
await http
|
||||
.get(
|
||||
config.API.requestEditByType(
|
||||
|
|
@ -86,6 +86,7 @@ async function fetchDataRequest() {
|
|||
|
||||
formData.status = data.status;
|
||||
formData.remark = data.remark;
|
||||
|
||||
if (data.status !== "PENDING") {
|
||||
isReadOnly.value = true;
|
||||
} else {
|
||||
|
|
@ -239,8 +240,22 @@ function topicConvert(type: string) {
|
|||
}
|
||||
}
|
||||
|
||||
const isStaff = ref<boolean>(false);
|
||||
function fetchCheckIsofficer() {
|
||||
if (typeEmp.value === "employee") {
|
||||
http
|
||||
.get(config.API.workflowKeycloakSystem("REGISTRY_PROFILE_EMP"))
|
||||
.then((res) => {
|
||||
isStaff.value = res.data.result.isStaff;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchDataRequest();
|
||||
await Promise.all([fetchDataRequest(), fetchCheckIsofficer()]);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -261,8 +276,14 @@ onMounted(async () => {
|
|||
<q-space />
|
||||
<q-btn
|
||||
v-if="
|
||||
workflowRef?.permission.isUpdate &&
|
||||
topicConvert(dataRequest.topic) !== ''
|
||||
(typeEmp !== 'employee' &&
|
||||
workflowRef?.permission.isUpdate &&
|
||||
topicConvert(dataRequest.topic) !== '' &&
|
||||
!isReadOnly) ||
|
||||
(typeEmp === 'employee' &&
|
||||
isStaff &&
|
||||
topicConvert(dataRequest.topic) !== '' &&
|
||||
!isReadOnly)
|
||||
"
|
||||
color="public"
|
||||
:label="topicConvert(dataRequest.topic)"
|
||||
|
|
@ -413,11 +434,17 @@ onMounted(async () => {
|
|||
<q-select
|
||||
:class="
|
||||
classInput(
|
||||
isReadOnly || !workflowRef?.permission.isUpdate
|
||||
isReadOnly ||
|
||||
(typeEmp === 'employee' && !isStaff) ||
|
||||
(typeEmp !== 'employee' &&
|
||||
!workflowRef?.permission.isUpdate)
|
||||
)
|
||||
"
|
||||
:readonly="
|
||||
isReadOnly || !workflowRef?.permission.isUpdate
|
||||
isReadOnly ||
|
||||
(typeEmp === 'employee' && !isStaff) ||
|
||||
(typeEmp !== 'employee' &&
|
||||
!workflowRef?.permission.isUpdate)
|
||||
"
|
||||
v-model="formData.status"
|
||||
label="สถานะ"
|
||||
|
|
@ -450,11 +477,17 @@ onMounted(async () => {
|
|||
<q-input
|
||||
:class="
|
||||
classInput(
|
||||
isReadOnly || !workflowRef?.permission.isUpdate
|
||||
isReadOnly ||
|
||||
(typeEmp === 'employee' && !isStaff) ||
|
||||
(typeEmp !== 'employee' &&
|
||||
!workflowRef?.permission.isUpdate)
|
||||
)
|
||||
"
|
||||
:readonly="
|
||||
isReadOnly || !workflowRef?.permission.isUpdate
|
||||
isReadOnly ||
|
||||
(typeEmp === 'employee' && !isStaff) ||
|
||||
(typeEmp !== 'employee' &&
|
||||
!workflowRef?.permission.isUpdate)
|
||||
"
|
||||
v-model="formData.remark"
|
||||
label="หมายเหตุ"
|
||||
|
|
@ -467,7 +500,10 @@ onMounted(async () => {
|
|||
|
||||
<div
|
||||
class="row col-12 justify-end"
|
||||
v-if="!isReadOnly && workflowRef?.permission.isUpdate"
|
||||
v-if="
|
||||
(!isReadOnly && workflowRef?.permission.isUpdate) ||
|
||||
(typeEmp === 'employee' && isStaff && !isReadOnly)
|
||||
"
|
||||
>
|
||||
<q-btn label="บันทึก" color="secondary" type="submit"
|
||||
><q-tooltip>บันทึก</q-tooltip></q-btn
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue