โครงสร้าง สร้างคำสั่ง

This commit is contained in:
setthawutttty 2024-10-18 12:58:18 +07:00
parent 5d9131d5b7
commit 97a62de026
5 changed files with 150 additions and 104 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
@ -30,6 +30,7 @@ import DialogCreateCommandORG from "@/modules/18_command/components/DialogCreate
const $q = useQuasar();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
const store = useOrganizational();
const keycloakSystem = ref<string>("ORG_COMMAND");
/** ตัวแปร*/
const modalNewStructure = ref<boolean>(false); //
@ -126,6 +127,38 @@ function onClickHistory(id: string, name: string) {
count.value++;
}
async function workflowSystem() {
showLoader();
http
.get(config.API.workflowKeycloakSystem(keycloakSystem.value))
.then((res) => {
const data = res.data.result;
store.isOfficer = data.isOfficer;
store.isStaff = data.isStaff;
hideLoader();
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {});
}
watch(
() => store.typeOrganizational,
() => {
if (
store.typeOrganizational === "draft" &&
store.isOfficer === null &&
store.isStaff === null
) {
workflowSystem();
} else if (store.typeOrganizational === "draft") {
store.rootId = "";
}
}
);
/**
* lifecycleHook ทำงานเมอมการเรยกใช Components
*
@ -276,10 +309,14 @@ onMounted(async () => {
class="q-px-md"
/>
<q-btn
v-if="store.typeOrganizational === 'draft'"
v-if="
store.typeOrganizational === 'draft' &&
(store.isOfficer === true || store.isStaff === true)
"
flat
round
dense
:disable="store.isStaff == true && store.rootId == ''"
color="add"
icon="mdi-account-arrow-right"
@click.prevent="modalCommand = true"
@ -380,7 +417,10 @@ onMounted(async () => {
<DialogCreateCommandORG
v-model:modal="modalCommand"
command-type-code="C-PM-38"
:org-publish-date="store.orgPublishDate as Date | undefined"
:org-publish-date="store.orgPublishDate as Date||undefined"
v-model:is-officer="store.isOfficer as boolean"
v-model:is-staff="store.isStaff as boolean"
v-model:root-id="store.rootId"
/>
</template>