Merge branch 'develop'

This commit is contained in:
Warunee Tamkoo 2025-03-24 12:00:33 +07:00
commit 773a47d9c6
3 changed files with 44 additions and 11 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref, computed } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
@ -10,6 +10,9 @@ const $q = useQuasar();
const { dialogConfirm } = useCounterMixin(); const { dialogConfirm } = useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const props = defineProps({
sysName: { type: String, require: true },
});
const isAcknowledge = ref<boolean>(false); const isAcknowledge = ref<boolean>(false);
const isConsider = ref<boolean>(true); const isConsider = ref<boolean>(true);
@ -19,6 +22,12 @@ const acknowledge = ref<boolean>(false);
const consider = ref<string>(""); const consider = ref<string>("");
const comment = ref<string>(""); const comment = ref<string>("");
const rejectName = computed(() =>
props.sysName && ["SYS_RESIGN", "SYS_RESIGN_EMP"].includes(props.sysName)
? "ยับยั้ง"
: "ไม่อนุมัติ"
);
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => {}); dialogConfirm($q, () => {});
} }
@ -52,8 +61,10 @@ function onCloseModal() {
label="รับทราบ" label="รับทราบ"
/> />
</div> </div>
<div v-if="!isAcknowledge && isConsider"> <div v-if="isConsider">
<div class="text-weight-bold">จารณา (อน/ไมอน)</div> <div class="text-weight-bold">
{{ `พิจารณา (อนุมัติ/${rejectName})` }}
</div>
<div class="q-pa-sm q-gutter-sm"> <div class="q-pa-sm q-gutter-sm">
<q-radio <q-radio
dense dense
@ -68,13 +79,13 @@ function onCloseModal() {
keep-color keep-color
color="primary" color="primary"
v-model="consider" v-model="consider"
label="ไม่อนุมัติ" :label="`${rejectName}`"
val="reject" val="reject"
/> />
</div> </div>
</div> </div>
<div v-if="!isAcknowledge && isComment"> <div v-if="isComment">
<div class="text-weight-bold">แสดงความเหนในเอกสาร</div> <div class="text-weight-bold">แสดงความเหนในเอกสาร</div>
<div class="q-pa-sm q-gutter-sm"> <div class="q-pa-sm q-gutter-sm">
<div class="col-12"> <div class="col-12">

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref, watch } from "vue"; import { reactive, ref, watch, computed } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
@ -20,10 +20,18 @@ const { dialogConfirm, showLoader, hideLoader, messageError } =
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const props = defineProps({ const props = defineProps({
stateId: { type: String, require: true }, stateId: { type: String, require: true },
keycloakId: { type: String, require: true },
sysName: { type: String, require: true },
fetchData: { type: Function, require: true }, fetchData: { type: Function, require: true },
type: { type: String, require: true }, type: { type: String, require: true },
}); });
const rejectName = computed(() =>
props.sysName && ["SYS_RESIGN", "SYS_RESIGN_EMP"].includes(props.sysName)
? "ยับยั้ง"
: "ไม่อนุมัติ"
);
/** table*/ /** table*/
const selected = ref<DataCommander[]>([]); const selected = ref<DataCommander[]>([]);
const rows = ref<DataCommander[]>([]); const rows = ref<DataCommander[]>([]);
@ -77,7 +85,10 @@ const formDataQuery = reactive<DataQuery>({
async function fetchLists() { async function fetchLists() {
showLoader(); showLoader();
await http await http
.put(config.API.workflow + `commander/${props.type}`, formDataQuery) .put(config.API.workflow + `commander/${props.type}`, {
...formDataQuery,
keycloakId: props.keycloakId,
})
.then(async (res) => { .then(async (res) => {
totalList.value = Math.ceil( totalList.value = Math.ceil(
res.data.result.total / formDataQuery.pageSize res.data.result.total / formDataQuery.pageSize
@ -281,10 +292,10 @@ function updatePagination(newPagination: Pagination) {
keep-color keep-color
color="primary" color="primary"
v-model="isApproveSetting" v-model="isApproveSetting"
label="ให้เลือกพิจารณา (อนุมัติ/ไม่อนุมัติ)" :label="`ให้เลือกพิจารณา (อนุมัติ/${rejectName})`"
/> />
</div> </div>
<div v-if="!isAcceptSetting"> <div>
<q-checkbox <q-checkbox
dense dense
keep-color keep-color

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { onMounted, ref, computed } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
@ -10,6 +10,7 @@ import type { Permission } from "@/components/Workflow/interface/index/Main";
import type { DataListState } from "@/components/Workflow/interface/response/Main"; import type { DataListState } from "@/components/Workflow/interface/response/Main";
import DialogSelectPerson from "@/components/Workflow/DialogSelectPerson.vue"; import DialogSelectPerson from "@/components/Workflow/DialogSelectPerson.vue";
import Keycloak from "keycloak-js";
const $q = useQuasar(); const $q = useQuasar();
const { dialogConfirm, showLoader, hideLoader, messageError } = const { dialogConfirm, showLoader, hideLoader, messageError } =
@ -20,9 +21,16 @@ const { id, sysName } = defineProps({
sysName: { type: String, require: true }, sysName: { type: String, require: true },
}); });
const rejectName = computed(() =>
sysName && ["SYS_RESIGN", "SYS_RESIGN_EMP"].includes(sysName)
? "ยับยั้ง"
: "ไม่อนุมัติ"
);
const stateId = ref<string>(""); //id state const stateId = ref<string>(""); //id state
const state = ref<number>(1); //state const state = ref<number>(1); //state
const isPermission = ref<boolean>(true); // Workflow const isPermission = ref<boolean>(true); // Workflow
const KeycloakId = ref<string>("");
const permission = ref<Permission>({ const permission = ref<Permission>({
isChangeState: false, /// isChangeState: false, ///
@ -62,6 +70,7 @@ async function fetchCheckState() {
isCancel: data.can_cancel, isCancel: data.can_cancel,
isSing: data.can_sing, isSing: data.can_sing,
}; };
KeycloakId.value = data.keycloakId;
}) })
.catch(() => { .catch(() => {
isPermission.value = false; isPermission.value = false;
@ -187,7 +196,7 @@ defineExpose({
? item.isApprove === true ? item.isApprove === true
? "อนุมัติ" ? "อนุมัติ"
: item.isApprove === false : item.isApprove === false
? "ไม่อนุมัติ" ? `${rejectName}`
: "" : ""
: "" : ""
}} }}
@ -236,5 +245,7 @@ defineExpose({
:state-id="stateId" :state-id="stateId"
:fetch-data="fetchCheckState" :fetch-data="fetchCheckState"
:type="typeSelectPerson" :type="typeSelectPerson"
:sys-name="sysName"
:keycloak-id="KeycloakId"
/> />
</template> </template>