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

View file

@ -47,7 +47,10 @@ async function fetchCheckState() {
await fetchData(); await fetchData();
const data = await res.data.result; const data = await res.data.result;
stateId.value = data.stateId; 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 = { permission.value = {
isChangeState: data.can_change_state, isChangeState: data.can_change_state,
isOperate: data.can_operate, isOperate: data.can_operate,

View file

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