fix workflow

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-03-21 17:41:16 +07:00
parent 6c72cc5538
commit e3abae0a5e
3 changed files with 44 additions and 11 deletions

View file

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

View file

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

View file

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