update wrokflow
This commit is contained in:
parent
b4c7ee8129
commit
ecb5e6b7c3
11 changed files with 414 additions and 92 deletions
|
|
@ -13,38 +13,36 @@ const { dialogConfirm, showLoader, hideLoader, messageError } =
|
|||
useCounterMixin();
|
||||
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const { stateId } = defineProps({
|
||||
stateId: { type: String, require: true },
|
||||
const props = defineProps({
|
||||
dataUserComment: { type: Object, require: true },
|
||||
fetchData: { type: Function, require: true },
|
||||
});
|
||||
|
||||
const isAcceptSetting = ref<boolean>(false);
|
||||
const isApproveSetting = ref<boolean>(false);
|
||||
const isReasonSetting = ref<boolean>(false);
|
||||
|
||||
const stateUserCommentId = ref<string>("");
|
||||
const isAccept = ref<boolean>(false);
|
||||
const isApprove = ref<string>("");
|
||||
const reason = ref<string>("");
|
||||
|
||||
async function fetchData() {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.workflow + `comment-state-user`, { stateId: stateId })
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
isAcceptSetting.value = data.isAcceptSetting;
|
||||
isApproveSetting.value = data.isApproveSetting;
|
||||
isReasonSetting.value = data.isReasonSetting;
|
||||
|
||||
isAccept.value = data.isAccept;
|
||||
isApprove.value = data.isApprove ? "approve" : "";
|
||||
reason.value = data.reason;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
const data = props.dataUserComment;
|
||||
if (data) {
|
||||
stateUserCommentId.value = data.id;
|
||||
isAcceptSetting.value = data.isAcceptSetting;
|
||||
isApproveSetting.value = data.isApproveSetting;
|
||||
isReasonSetting.value = data.isReasonSetting;
|
||||
isAccept.value = data.isAccept;
|
||||
isApprove.value =
|
||||
data.isApprove === true
|
||||
? "approve"
|
||||
: data.isApprove === false
|
||||
? "reject"
|
||||
: "";
|
||||
reason.value = data.reason;
|
||||
}
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
|
|
@ -52,7 +50,7 @@ function onSubmit() {
|
|||
showLoader();
|
||||
await http
|
||||
.post(config.API.workflow + `comment`, {
|
||||
stateId: stateId,
|
||||
stateUserCommentId: stateUserCommentId.value,
|
||||
isAccept: isAcceptSetting.value ? isAccept.value : undefined,
|
||||
isApprove: isApproveSetting.value
|
||||
? isApprove.value === "approve"
|
||||
|
|
@ -62,6 +60,7 @@ function onSubmit() {
|
|||
reason: isReasonSetting.value ? reason.value : undefined,
|
||||
})
|
||||
.then(async () => {
|
||||
await props.fetchData?.();
|
||||
onCloseModal();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -135,6 +134,7 @@ watch(modal, (val) => {
|
|||
<div class="q-pa-sm q-gutter-sm">
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
dense
|
||||
outlined
|
||||
label="ความเห็น"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue