fix workflow

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-10-21 15:37:18 +07:00
parent aa987f839c
commit 32da0e7107
5 changed files with 86 additions and 30 deletions

View file

@ -18,6 +18,7 @@ const modal = defineModel<boolean>("modal", { required: true });
const props = defineProps({
stateId: { type: String, require: true },
fetchData: { type: Function, require: true },
type: { type: String, require: true },
});
/** table*/
@ -72,7 +73,7 @@ const isReasonSetting = ref<boolean>(false);
async function fetchLists() {
showLoader();
await http
.get(config.API.workflow + `commander`)
.get(config.API.workflow + `commander/${props.type}`)
.then(async (res) => {
rows.value = res.data.result;
})

View file

@ -16,7 +16,10 @@ const $q = useQuasar();
const { dialogConfirm, showLoader, hideLoader, messageError } =
useCounterMixin();
const { id, sysName } = defineProps({
const isCheckData = defineModel<boolean>("isCheckData", {
default: true,
});
const props = defineProps({
id: { type: String, require: true },
sysName: { type: String, require: true },
});
@ -38,12 +41,13 @@ const itemState = ref<DataListState[]>([]);
const modalSelectPerson = ref<boolean>(false);
const modalApprove = ref<boolean>(false);
const typeSelectPerson = ref<string>("");
async function fetchCheckState() {
await http
.post(config.API.workflow + `check-user-now`, {
refId: id,
system: sysName,
refId: props.id,
system: props.sysName,
})
.then(async (res) => {
await fetchData();
@ -71,8 +75,8 @@ async function fetchCheckState() {
async function fetchData() {
await http
.post(config.API.workflow + `check-state-all`, {
refId: id,
system: sysName,
refId: props.id,
system: props.sysName,
})
.then(async (res) => {
const data = await res.data.result;
@ -88,8 +92,8 @@ function onChangeState() {
showLoader();
await http
.post(config.API.workflow + `state-next`, {
refId: id,
system: sysName,
refId: props.id,
system: props.sysName,
})
.then(async () => {
await fetchCheckState();
@ -115,7 +119,7 @@ defineExpose({
<template>
<q-card bordered class="row col-12" v-if="isPermission">
<div class="bg-grey-1 q-pa-sm col-12 row items-center">
<div class="q-pl-sm text-weight-bold text-dark">Workflow</div>
<div class="q-pl-sm text-weight-bold text-dark">สถานะการดำเนนเรอง</div>
<q-space />
</div>
<div class="col-12"><q-separator /></div>
@ -205,16 +209,36 @@ defineExpose({
</q-list>
</div>
<div v-if="permission.isOperate && state === index + 1">
<div
v-if="permission.isOperate && state === index + 1"
class="row q-gutter-x-sm"
>
<q-btn
@click.prevent="modalSelectPerson = true"
label="ส่งไปผู้บังคับบัญชา/ผู้มีอำนาจ"
@click.prevent="
(modalSelectPerson = true), (typeSelectPerson = 'operate')
"
label="ส่งไปผู้บังคับบัญชา"
color="public"
/>
<q-btn
@click.prevent="
(modalSelectPerson = true), (typeSelectPerson = 'sign')
"
label="ผู้มีอำนาจ"
color="public"
/>
</div>
<div v-if="permission.isChangeState && state === index + 1">
<q-btn
:disable="
props.sysName === 'REGISTRY_PROFILE'
? state === itemState.length - 1
? !isCheckData
: false
: !isCheckData
"
@click.prevent="onChangeState"
label="ดำเนินการต่อ"
color="primary"
@ -231,6 +255,7 @@ defineExpose({
v-model:modal="modalSelectPerson"
:state-id="stateId"
:fetch-data="fetchCheckState"
:type="typeSelectPerson"
/>
<DialogApprove