update workflow

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-10-18 14:51:42 +07:00
parent 1eead8c579
commit 6bc00f9064
3 changed files with 13 additions and 6 deletions

View file

@ -16,7 +16,7 @@ const { dialogConfirm, showLoader, hideLoader, messageError } =
useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true });
const { stateId, fetchData } = defineProps({
const props = defineProps({
stateId: { type: String, require: true },
fetchData: { type: Function, require: true },
});
@ -91,14 +91,14 @@ function onSubmit() {
showLoader();
await http
.post(config.API.workflow + `add-step`, {
stateId: stateId,
stateId: props.stateId,
profileId: selected.value[0].id,
isAcceptSetting: isAcceptSetting.value,
isApproveSetting: isApproveSetting.value,
isReasonSetting: isReasonSetting.value,
})
.then(async () => {
await fetchData?.();
await props.fetchData?.();
onCloseModal();
})
.catch((err) => {

View file

@ -47,7 +47,10 @@ async function fetchCheckState() {
await fetchData();
const data = await res.data.result;
stateId.value = data.stateId;
state.value = data.stateNo === 4 ? 5 : data.stateNo;
state.value =
data.stateNo === itemState.value.length
? data.stateNo + 1
: data.stateNo;
permission.value = {
isChangeState: data.can_change_state,
isOperate: data.can_operate,

View file

@ -34,7 +34,7 @@ const id = ref<string>(
const myform = ref<QForm | null>(null); //form
const tranferOrg = ref(""); //
const dateCommand = ref<Date>(new Date()); //
const dateLeave = ref<Date>(new Date()); //
const dateLeave = ref<Date | null>(null); //
const noteReason = ref(""); //
const modal = ref<boolean>(false); // dialog
@ -83,10 +83,14 @@ async function onSubmit() {
$q,
() => {
showLoader();
const formData = new FormData();
formData.append("Location", tranferOrg.value);
formData.append("SendDate", dateToISO(dateCommand.value));
formData.append("ActiveDate", dateToISO(dateLeave.value));
formData.append(
"ActiveDate",
dateLeave.value !== null ? dateToISO(dateLeave.value) : ""
);
formData.append("Reason", noteReason.value);
formData.append("file", files.value);