สิทธิ tab
This commit is contained in:
parent
067a32f436
commit
aeab8ae15a
15 changed files with 122 additions and 24 deletions
|
|
@ -6,6 +6,7 @@ const finish = `${env.API_PROBATION_URI}/assign`;
|
|||
const evaluate = `${env.API_PROBATION_URI}`;
|
||||
const appointMain = `${env.API_PROBATION_URI}/appoint`;
|
||||
const orgProfile = `${env.API_URI}/org`;
|
||||
const probation = `${env.API_URI}/probation`;
|
||||
|
||||
export default {
|
||||
competencyOptions: (personalId: string) =>
|
||||
|
|
@ -88,5 +89,7 @@ export default {
|
|||
appointMain,
|
||||
appointMainList:(id:string)=>`${appointMain}/list/${id}`,
|
||||
|
||||
orgProfileDirector:`${orgProfile}/profile/commander-director`
|
||||
orgProfileDirector:`${orgProfile}/profile/commander-director`,
|
||||
|
||||
permissionsCheck:(id:string)=>`${probation}/permissions/${id}`
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,21 +1,25 @@
|
|||
<script setup lang="ts">
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { ref, computed, watch, onMounted } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import genReport from "@/plugins/genreport";
|
||||
import type {
|
||||
AppointTopic,
|
||||
AppointTopicMain,
|
||||
} from "@/modules/05_placement/interface/index/Main";
|
||||
|
||||
import genReport from "@/plugins/genreport";
|
||||
|
||||
const $q = useQuasar();
|
||||
const isEdit = ref<boolean>(false);
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const probationStore = useProbationDataStore();
|
||||
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
|
|
@ -1116,7 +1120,10 @@ onMounted(async () => {
|
|||
|
||||
<div v-if="!isEdit">
|
||||
<q-btn
|
||||
v-if="!checkRoutePermisson"
|
||||
v-if="
|
||||
!checkRoutePermisson &&
|
||||
probationStore.dataPermissions?.tab1.isEdit
|
||||
"
|
||||
dense
|
||||
flat
|
||||
round
|
||||
|
|
@ -1185,7 +1192,8 @@ onMounted(async () => {
|
|||
<q-select
|
||||
:readonly="
|
||||
!isEdit &&
|
||||
appointTopic?.id !== ''
|
||||
appointTopic?.id !== '' &&
|
||||
routeName !== 'probationWorkAdd'
|
||||
"
|
||||
outlined
|
||||
dense
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ onMounted(async () => {
|
|||
|
||||
<div v-if="status == false">
|
||||
<q-btn
|
||||
v-if="!checkRoutePermisson"
|
||||
v-if="!checkRoutePermisson && probationStore.dataPermissions?.tab4.isEdit"
|
||||
dense
|
||||
flat
|
||||
round
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ onMounted(async () => {
|
|||
<div>แบบประเมินผล (คณะกรรมการ)</div>
|
||||
<div v-if="status == false">
|
||||
<q-btn
|
||||
v-if="!checkRoutePermisson"
|
||||
v-if="!checkRoutePermisson && probationStore.dataPermissions?.tab5.isEdit"
|
||||
dense
|
||||
flat
|
||||
round
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ onMounted(() => {
|
|||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:readonly="!status || checkRoutePermisson"
|
||||
:readonly="!status || checkRoutePermisson || probationStore.dataPermissions?.tab6.isEdit == false"
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
|
|
@ -350,7 +350,7 @@ onMounted(() => {
|
|||
<q-input
|
||||
outlined
|
||||
dense
|
||||
:readonly="!status || checkRoutePermisson"
|
||||
:readonly="!status || checkRoutePermisson || probationStore.dataPermissions?.tab6.isEdit == false"
|
||||
class="full-width datepicker"
|
||||
:model-value="
|
||||
date_start != null ? date2Thai(date_start) : null
|
||||
|
|
@ -377,7 +377,7 @@ onMounted(() => {
|
|||
v-model="date_finish"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:readonly="!status || checkRoutePermisson"
|
||||
:readonly="!status || checkRoutePermisson || probationStore.dataPermissions?.tab6.isEdit == false"
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
|
|
@ -429,7 +429,7 @@ onMounted(() => {
|
|||
class="col-xs-12 col-sm-6"
|
||||
dense
|
||||
borderless
|
||||
:readonly="!status || checkRoutePermisson"
|
||||
:readonly="!status || checkRoutePermisson || probationStore.dataPermissions?.tab6.isEdit == false"
|
||||
emit-value
|
||||
map-options
|
||||
option-label="label"
|
||||
|
|
@ -458,7 +458,7 @@ onMounted(() => {
|
|||
]"
|
||||
hide-bottom-space
|
||||
:options="optionsResult"
|
||||
:readonly="!status || checkRoutePermisson"
|
||||
:readonly="!status || checkRoutePermisson || probationStore.dataPermissions?.tab6.isEdit == false"
|
||||
dense
|
||||
borderless
|
||||
emit-value
|
||||
|
|
@ -501,7 +501,7 @@ onMounted(() => {
|
|||
dense
|
||||
borderless
|
||||
outlined
|
||||
:readonly="!status || checkRoutePermisson"
|
||||
:readonly="!status || checkRoutePermisson || probationStore.dataPermissions?.tab6.isEdit == false"
|
||||
class="bg-white"
|
||||
type="textarea"
|
||||
v-model="reson"
|
||||
|
|
@ -554,7 +554,7 @@ onMounted(() => {
|
|||
menu-class-name="modalfix"
|
||||
v-model="chairman_dated"
|
||||
:locale="'th'"
|
||||
:readonly="!status || checkRoutePermisson"
|
||||
:readonly="!status || checkRoutePermisson || probationStore.dataPermissions?.tab6.isEdit == false"
|
||||
autoApply
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
|
|
@ -616,7 +616,7 @@ onMounted(() => {
|
|||
:locale="'th'"
|
||||
autoApply
|
||||
borderless
|
||||
:readonly="!status || checkRoutePermisson"
|
||||
:readonly="!status || checkRoutePermisson || probationStore.dataPermissions?.tab6.isEdit == false"
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
>
|
||||
|
|
@ -679,7 +679,7 @@ onMounted(() => {
|
|||
v-model="director2_dated"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
:readonly="!status || checkRoutePermisson"
|
||||
:readonly="!status || checkRoutePermisson || probationStore.dataPermissions?.tab6.isEdit == false"
|
||||
borderless
|
||||
:enableTimePicker="false"
|
||||
week-start="0"
|
||||
|
|
@ -723,7 +723,7 @@ onMounted(() => {
|
|||
|
||||
<q-toolbar
|
||||
class="text-primary"
|
||||
v-if="action == 'add' && !checkRoutePermisson"
|
||||
v-if="action == 'add' && !checkRoutePermisson && probationStore.dataPermissions?.tab6.isEdit"
|
||||
>
|
||||
<q-space />
|
||||
<q-btn label="บันทึก" color="secondary" @click="savaForm" />
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ onMounted(async () => {
|
|||
<div>แบบบันทึกผล (ผู้ดูเเล)</div>
|
||||
<div v-if="status == false">
|
||||
<q-btn
|
||||
v-if="!checkRoutePermisson"
|
||||
v-if="!checkRoutePermisson && probationStore.dataPermissions?.tab2.isEdit"
|
||||
dense
|
||||
flat
|
||||
round
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ onMounted(async () => {
|
|||
<div>แบบบันทึกผล (ผู้บังคับบัญชา)</div>
|
||||
<div v-if="status == false">
|
||||
<q-btn
|
||||
v-if="!checkRoutePermisson"
|
||||
v-if="!checkRoutePermisson && probationStore.dataPermissions?.tab3.isEdit"
|
||||
dense
|
||||
flat
|
||||
round
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { useRoute } from "vue-router";
|
|||
const tabHead = ref<string>("save1");
|
||||
const route = useRoute();
|
||||
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");
|
||||
|
||||
/** รับค่ามาจากหน้าหลัก */
|
||||
const props = defineProps({
|
||||
FileDownload: {
|
||||
|
|
@ -28,6 +29,12 @@ const props = defineProps({
|
|||
return "Default function";
|
||||
},
|
||||
},
|
||||
checkPermission: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return true;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/** เรียกใช้ฟังชั่นจากหน้าหลัก */
|
||||
|
|
@ -102,7 +109,7 @@ function nextPage() {
|
|||
</q-tabs>
|
||||
<div>
|
||||
<q-btn
|
||||
v-if="!checkRoutePermisson"
|
||||
v-if="!checkRoutePermisson && props.checkPermission"
|
||||
color="blue"
|
||||
flat
|
||||
dense
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ onMounted(async () => {
|
|||
:add-data="addData"
|
||||
:loop="probationStore.tabs.length"
|
||||
:FileDownload="FileDownload"
|
||||
:checkPermission="probationStore?.dataPermissions?.tab2?.isEdit as boolean"
|
||||
/>
|
||||
<q-tab-panels
|
||||
v-model="tab"
|
||||
|
|
@ -162,6 +163,7 @@ onMounted(async () => {
|
|||
color="primary"
|
||||
label="สร้างแบบบันทึกผล"
|
||||
@click="addData"
|
||||
:disable="probationStore.dataPermissions?.tab2.isEdit == false"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ onMounted(async () => {
|
|||
:add-data="addData"
|
||||
:loop="probationStore.tabs.length"
|
||||
:FileDownload="FileDownload"
|
||||
:checkPermission="probationStore?.dataPermissions?.tab3?.isEdit as boolean"
|
||||
/>
|
||||
<q-tab-panels
|
||||
v-model="tab"
|
||||
|
|
@ -178,6 +179,7 @@ onMounted(async () => {
|
|||
color="primary"
|
||||
label="สร้างแบบบันทึกผล"
|
||||
@click="addData"
|
||||
:disable="probationStore.dataPermissions?.tab3.isEdit == false"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ onMounted(() => {
|
|||
:loop="tabs.length"
|
||||
:add-data="addData"
|
||||
:FileDownload="FileDownload"
|
||||
:checkPermission="probationStore?.dataPermissions?.tab4?.isEdit as boolean"
|
||||
/>
|
||||
|
||||
<q-tab-panels
|
||||
|
|
@ -157,7 +158,8 @@ onMounted(() => {
|
|||
color="primary"
|
||||
label="สร้างแบบประเมิน"
|
||||
@click="addData"
|
||||
/>
|
||||
:disable="probationStore.dataPermissions?.tab4.isEdit == false"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ const changeTab = (tabVal: string) => {
|
|||
:loop="tabs.length"
|
||||
:add-data="addData"
|
||||
:FileDownload="FileDownload"
|
||||
:checkPermission="probationStore?.dataPermissions?.tab5?.isEdit as boolean"
|
||||
/>
|
||||
|
||||
<q-tab-panels
|
||||
|
|
@ -134,6 +135,7 @@ const changeTab = (tabVal: string) => {
|
|||
color="primary"
|
||||
label="สร้างแบบประเมิน"
|
||||
@click="addData"
|
||||
:disable="probationStore.dataPermissions?.tab5.isEdit == false"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
<script setup lang="ts">
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ref, defineAsyncComponent, onMounted } from "vue";
|
||||
import { ref, defineAsyncComponent, onMounted, reactive } from "vue";
|
||||
import { useProbationDataStore } from "@/modules/05_placement/storeProbation";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
const DataStore = useProbationDataStore();
|
||||
|
||||
const ProbationFormAssign = defineAsyncComponent(
|
||||
|
|
@ -42,9 +49,24 @@ const SummaryScore = defineAsyncComponent(
|
|||
() => import("@/modules/05_placement/components/probation/SummaryScore.vue")
|
||||
);
|
||||
|
||||
const $q = useQuasar();
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
date2Thai,
|
||||
dateToISO,
|
||||
success,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
dialogConfirm,
|
||||
} = mixin;
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const checkRoutePermisson = ref<boolean>(route.name == "probationFormDetail");
|
||||
|
||||
const assignId = ref<string>(route.params.form as string);
|
||||
const drawer = ref<boolean>(true);
|
||||
const activeTab = ref<string>("");
|
||||
const personalId = ref<string>(route.params.personalId.toString());
|
||||
|
|
@ -66,8 +88,22 @@ function clickBack() {
|
|||
DataStore.mainTab = "tab1";
|
||||
}
|
||||
|
||||
async function getPermissions() {
|
||||
await http
|
||||
.get(config.API.permissionsCheck(assignId.value))
|
||||
.then(async (res) => {
|
||||
const data = await res.data.data;
|
||||
DataStore.dataPermissions = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
/** เมื่อเริ่มโหลดหน้า ให้ tab เป็น tab1 */
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
await getPermissions();
|
||||
if (DataStore.mainTab) {
|
||||
activeTab.value = DataStore.mainTab;
|
||||
} else activeTab.value = "tab1";
|
||||
|
|
@ -120,6 +156,7 @@ onMounted(() => {
|
|||
v-ripple
|
||||
:active="activeTab == 'tab1'"
|
||||
@click="changeTab('tab1')"
|
||||
:disable="DataStore.dataPermissions?.tab1.isView == false"
|
||||
>
|
||||
<q-item-section>แบบมอบหมายงาน ฯ</q-item-section>
|
||||
</q-item>
|
||||
|
|
@ -132,6 +169,7 @@ onMounted(() => {
|
|||
v-ripple
|
||||
:active="activeTab == 'tab2'"
|
||||
@click="changeTab('tab2')"
|
||||
:disable="DataStore.dataPermissions?.tab2.isView == false"
|
||||
>
|
||||
<q-item-section>
|
||||
แบบบันทึกผล
|
||||
|
|
@ -139,6 +177,7 @@ onMounted(() => {
|
|||
<div class="text-caption text-grey-7">(ผู้ดูแล)</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-item
|
||||
dense
|
||||
class="q-py-sm"
|
||||
|
|
@ -147,6 +186,7 @@ onMounted(() => {
|
|||
v-ripple
|
||||
:active="activeTab == 'tab8'"
|
||||
@click="changeTab('tab8')"
|
||||
:disable="DataStore.dataPermissions?.tab3.isView == false"
|
||||
>
|
||||
<q-item-section>
|
||||
แบบบันทึกผล
|
||||
|
|
@ -163,6 +203,7 @@ onMounted(() => {
|
|||
v-ripple
|
||||
:active="activeTab == 'tab3'"
|
||||
@click="changeTab('tab3')"
|
||||
:disable="DataStore.dataPermissions?.tab4.isView == false"
|
||||
>
|
||||
<q-item-section>
|
||||
แบบประเมินผล<br />
|
||||
|
|
@ -178,6 +219,7 @@ onMounted(() => {
|
|||
v-ripple
|
||||
:active="activeTab == 'tab4'"
|
||||
@click="changeTab('tab4')"
|
||||
:disable="DataStore.dataPermissions?.tab5.isView == false"
|
||||
>
|
||||
<q-item-section>
|
||||
แบบประเมินผล<br />
|
||||
|
|
@ -193,6 +235,7 @@ onMounted(() => {
|
|||
v-ripple
|
||||
:active="activeTab == 'tab5'"
|
||||
@click="changeTab('tab5')"
|
||||
:disable="DataStore.dataPermissions?.tab6.isView == false"
|
||||
>
|
||||
<q-item-section> แบบรายงาน<br />การประเมินฯ </q-item-section>
|
||||
</q-item>
|
||||
|
|
@ -205,6 +248,7 @@ onMounted(() => {
|
|||
v-ripple
|
||||
:active="activeTab == 'tab6'"
|
||||
@click="changeTab('tab6')"
|
||||
:disable="DataStore.dataPermissions?.tab7.isView == false"
|
||||
>
|
||||
<q-item-section> ผลการประเมินการ ฯ </q-item-section>
|
||||
</q-item>
|
||||
|
|
|
|||
|
|
@ -360,6 +360,24 @@ interface AppointTopicMain {
|
|||
status: string;
|
||||
directors: AppointTopic[];
|
||||
}
|
||||
|
||||
interface TabPermissions {
|
||||
isEdit: boolean;
|
||||
isView: boolean;
|
||||
}
|
||||
|
||||
interface DataPermissions {
|
||||
tab1: TabPermissions;
|
||||
tab2: TabPermissions;
|
||||
tab3: TabPermissions;
|
||||
tab4: TabPermissions;
|
||||
tab5: TabPermissions;
|
||||
tab6: TabPermissions;
|
||||
tab7: TabPermissions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export type {
|
||||
DataOption,
|
||||
DataOptionInsignia,
|
||||
|
|
@ -387,7 +405,9 @@ export type {
|
|||
DataEducation,
|
||||
PersonData,
|
||||
AppointTopic,
|
||||
AppointTopicMain
|
||||
AppointTopicMain,
|
||||
DataPermissions,
|
||||
TabPermissions
|
||||
};
|
||||
|
||||
export { AddressDataDefualt, FamilyDataDefualt };
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { reactive, ref } from "vue";
|
||||
|
||||
import type {
|
||||
DataPermissions,
|
||||
TabPermissions,
|
||||
} from "@/modules/05_placement/interface/index/Main";
|
||||
|
||||
export const useProbationDataStore = defineStore("probationStore", () => {
|
||||
const dataPermissions = ref<DataPermissions>();
|
||||
|
||||
const assign = ref<any>([]);
|
||||
const evaluate = ref<any>([]);
|
||||
const tabs = ref<any>([]);
|
||||
|
|
@ -104,5 +111,6 @@ export const useProbationDataStore = defineStore("probationStore", () => {
|
|||
behavior_no1,
|
||||
behavior_no2,
|
||||
behavior_no3,
|
||||
dataPermissions
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue