+
@@ -181,7 +210,7 @@ watch(modal, (val) => {
type="submit"
:disable="
selected.length === 0 ||
- (!isAcknowledge && !isConsider && !isComment)
+ (!isAcceptSetting && !isApproveSetting && !isReasonSetting)
"
>
diff --git a/src/components/Workflow/Main.vue b/src/components/Workflow/Main.vue
index ef2ed51ec..5197c3241 100644
--- a/src/components/Workflow/Main.vue
+++ b/src/components/Workflow/Main.vue
@@ -3,74 +3,100 @@ import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
+import http from "@/plugins/http";
+import config from "@/app.config";
import DialogSelectPerson from "@/components/Workflow/DialogSelectPerson.vue";
import DialogApprove from "@/components/Workflow/DialogApprove.vue";
const $q = useQuasar();
-const { dialogConfirm } = useCounterMixin();
+const { dialogConfirm, showLoader, hideLoader, messageError } =
+ useCounterMixin();
const { id, sysName } = defineProps({
id: { type: String, require: true },
sysName: { type: String, require: true },
});
-const state = ref
(1);
-const isChangeState = ref(false);
-const isOperate = ref(false);
+const stateId = ref(""); //id state ปัจุบัน
+const state = ref(2); //state ปัจุบัน
+
+const isChangeState = ref(false); //ส่งไปยังผู้บังคับบัญชา/ผู้มีอำนาจ
+const isOperate = ref(true); //เปลี่ยนสถานะ (state) เอกสารได้
+const isView = ref(true); //ดูเอกสารได้
+const isUpdate = ref(true); //แก้ไขเอกสารได้
+const isDelete = ref(true); //ลบเอกสารได้ (ถ้ามี)
+const isCancel = ref(true); //ลบเอกสารได้ (ถ้ามี)
-const rowsOperate = ref([
- {
- fullName: "ชื่อนาม - สกุล",
- comment: "ความเห็น",
- position: " บริหาร - ต้น ",
- status: "อนุมัติ",
- },
-]);
const modalSelectPerson = ref(false);
const modalApprove = ref(false);
-const itemState = ref([
- {
- stateNo: 1,
- stateName: "Darft",
- },
- {
- stateNo: 2,
- stateName: "Operate",
- },
- {
- stateNo: 3,
- stateName: "Finish",
- },
-]);
+const itemState = ref([]);
-function fetchData() {
+async function fetchData() {
console.log(id, sysName);
- const data = {
- stateNo: 1,
- step: 1,
- can_view: true,
- can_update: true,
- can_operate: true,
- can_change_state: true,
- can_delete: false,
- can_cancel: false,
- };
-
- state.value = data.stateNo;
- isChangeState.value = data.can_change_state;
- isOperate.value = data.can_operate;
+ await http
+ .post(config.API.workflow + `check-state-all`, {
+ refId: id,
+ system: sysName,
+ })
+ .then(async (res) => {
+ const data = await res.data.result;
+ itemState.value = data;
+ })
+ .catch((err) => {
+ messageError($q, err);
+ });
}
-function onConfirmDraft() {
- dialogConfirm($q, () => {
- state.value++;
+async function fetchCheckState() {
+ await http
+ .post(config.API.workflow + `check-user-now`, {
+ refId: id,
+ system: sysName,
+ })
+ .then(async (res) => {
+ const data = await res.data.result;
+ stateId.value = data.stateId;
+ state.value = data.stateNo;
+ isChangeState.value = data.can_change_state;
+ isOperate.value = data.can_operate;
+ isView.value = data.can_view;
+ isUpdate.value = data.can_update;
+ isDelete.value = data.can_delete;
+ isCancel.value = data.can_cancel;
+ })
+ .catch((err) => {
+ messageError($q, err);
+ });
+}
+
+function onChangeState() {
+ dialogConfirm($q, async () => {
+ showLoader();
+ await http
+ .post(config.API.workflow + `state-next`, {
+ refId: id,
+ system: sysName,
+ })
+ .then(async () => {
+ await Promise.all([fetchData(), fetchCheckState()]);
+ })
+ .catch((err) => {
+ messageError($q, err);
+ })
+ .finally(() => {
+ hideLoader();
+ });
});
}
-onMounted(() => {
- fetchData();
+async function fetchAllFunction() {
+ await Promise.all([fetchData(), fetchCheckState()]);
+}
+
+onMounted(async () => {
+ await fetchAllFunction();
});
@@ -103,14 +129,11 @@ onMounted(() => {
:color="state < index + 1 ? 'grey-4' : ''"
>
-
+
@@ -120,31 +143,44 @@ onMounted(() => {
-
+
-
+
{{ item.fullName }}
- {{ `(${item.position})` }}
+ >{{ item.createdFullName }}
+
+
{{
- item.comment
+ item.isReasonSetting ? item.reason : ""
}}
- {{ item.status }}
-
+
{
/>
-
+
@@ -166,7 +202,11 @@ onMounted(() => {
-
+
-
+
diff --git a/src/modules/05_placement/components/Transfer/TransferDetail.vue b/src/modules/05_placement/components/Transfer/TransferDetail.vue
index c9e4fdb21..d9f921005 100644
--- a/src/modules/05_placement/components/Transfer/TransferDetail.vue
+++ b/src/modules/05_placement/components/Transfer/TransferDetail.vue
@@ -686,7 +686,7 @@ onMounted(async () => {
-
+