From c6efe264b0271804ea67fc276a63db61c23071f7 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 16 Oct 2024 11:30:09 +0700 Subject: [PATCH 1/6] =?UTF-8?q?=E0=B8=AA=E0=B9=88=E0=B8=87=E0=B8=AD?= =?UTF-8?q?=E0=B8=AD=E0=B8=81=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88?= =?UTF-8?q?=E0=B8=87=20=3D=3D>=20=E0=B9=82=E0=B8=84=E0=B8=A3=E0=B8=87?= =?UTF-8?q?=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../02_organization/components/TreeTable.vue | 20 -- src/modules/02_organization/views/main.vue | 45 ++- .../components/DialogCreateCommandORG.vue | 303 ++++++++++++++++-- 3 files changed, 296 insertions(+), 72 deletions(-) diff --git a/src/modules/02_organization/components/TreeTable.vue b/src/modules/02_organization/components/TreeTable.vue index fc9fca910..142c4f773 100644 --- a/src/modules/02_organization/components/TreeTable.vue +++ b/src/modules/02_organization/components/TreeTable.vue @@ -28,7 +28,6 @@ import DialogMovePos from "@/modules/02_organization/components/DialogMovePos.vu import DialogHistoryPos from "@/modules/02_organization/components/DialogHistoryPos.vue"; // ประวัติตำแหน่ง import DialogSelectPerson from "@/modules/02_organization/components/DialogSelectPerson.vue"; // เลือกคนครอง import DialogSuccession from "@/modules/02_organization/components/DialogSuccession.vue"; // สืบทอดตำแหน่ง -import DialogCreateCommandORG from "@/modules/18_command/components/DialogCreateCommandORG.vue"; const $q = useQuasar(); const store = useOrganizational(); @@ -252,7 +251,6 @@ const columnsExpand = ref([ ]); const dialogPosition = ref(false); //ตำแหน่ง -const modalCommand = ref(false); //สร้างคำสั่ง /** * function openPopup เพิ่มอัตรากำลัง @@ -542,18 +540,6 @@ watch( ดาวน์โหลด - - ส่งไปออกคำสั่ง - -
@@ -905,12 +891,6 @@ watch( - - - diff --git a/src/modules/18_command/components/DialogCreateCommandORG.vue b/src/modules/18_command/components/DialogCreateCommandORG.vue index 701ad93a2..8b0e04a8c 100644 --- a/src/modules/18_command/components/DialogCreateCommandORG.vue +++ b/src/modules/18_command/components/DialogCreateCommandORG.vue @@ -8,7 +8,12 @@ import { useRouter } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useCommandMainStore } from "@/modules/18_command/store/Main"; -import type { ListCommand } from "@/modules/18_command/interface/index/Main"; +/** importType*/ +import type { QTableProps } from "quasar"; +import type { + ListCommand, + DataOption, +} from "@/modules/18_command/interface/index/Main"; import DialogHeader from "@/components/DialogHeader.vue"; @@ -28,6 +33,7 @@ const { const modal = defineModel("modal", { required: true }); const props = defineProps({ commandTypeCode: String, // ไอดีประเภทคำสั่ง + orgPublishDate: { type: Date, defult: undefined }, }); const commandOp = ref([]); // ประเภทคำสั่ง @@ -36,33 +42,100 @@ const commandNo = ref(""); //คำสั่งเลขที่ const commandYear = ref(new Date().getFullYear()); const commandAffectDate = ref(null); //วันที่ลงนาม const commandExcecuteDate = ref(null); //วันที่คำสั่งมีผล +const group = ref(""); //กลุ่ม +const isCheckOrgPublishDate = ref(false); //เช็คค่าของวันที่คำสั่งมีผล +const groupOp = ref([]); +const groupDataOp = ref([ + { + id: "1.1", + name: "กลุ่มที่ 1.1 : ปฏิบัติงาน ชำนาญงาน ปฏิบัติการ ชำนาญการ", + }, + { + id: "1.2", + name: "กลุ่มที่ 1.2 : อาวุโส ชำนาญการพิเศษ อำนวยการต้น", + }, + { + id: "2", + name: "กลุ่มที่ 2 : ทักษะพิเศษ เชี่ยวชาญ ทรงคุณวุฒิ อำนวยการสูง บริหารต้น บริหารสูง", + }, +]); + +//Table +const rows = ref([]); +const selected = ref([]); +const columns = ref([ + { + name: "posMasterNo", + align: "left", + label: "ตำแหน่งเลขที่", + sortable: false, + field: "posMasterNo", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "positionName", + align: "left", + label: "ตำแหน่งในสายงาน", + field: "positionName", + sortable: false, + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "posTypeName", + align: "left", + label: "ประเภทตำแหน่ง", + sortable: false, + field: "posTypeName", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "posLevelName", + align: "left", + label: "ระดับตำแหน่ง", + sortable: false, + field: "posLevelName", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, + { + name: "positionIsSelected", + align: "left", + label: "คนครอง", + sortable: false, + field: "positionIsSelected", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, +]); /** ฟังก์ชันบันทึกและไปยังหน้าคำสั่ง*/ function onSubmit() { dialogConfirm($q, async () => { - showLoader(); - const body = { - commandYear: commandYear.value, - commandNo: commandNo.value, - commandTypeId: commandType.value, - commandAffectDate: commandAffectDate.value, - commandExcecuteDate: commandExcecuteDate.value, - persons: [], - }; - - await http - .post(config.API.command + `/person`, body) - .then(async (res) => { - const id = await res.data.result; - router.push(`/command/edit/${id}`); - modal.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); + // showLoader(); + // const body = { + // commandYear: commandYear.value, + // commandNo: commandNo.value, + // commandTypeId: commandType.value, + // commandAffectDate: commandAffectDate.value, + // commandExcecuteDate: commandExcecuteDate.value, + // persons: [], + // }; + // await http + // .post(config.API.command + `/person`, body) + // .then(async (res) => { + // const id = await res.data.result; + // router.push(`/command/edit/${id}`); + // modal.value = false; + // }) + // .catch((e) => { + // messageError($q, e); + // }) + // .finally(() => { + // hideLoader(); + // }); }); } @@ -76,6 +149,10 @@ function closeModal() { commandYear.value = new Date().getFullYear(); commandAffectDate.value = null; commandExcecuteDate.value = null; + group.value = ""; + isCheckOrgPublishDate.value = false; + rows.value = []; + selected.value = []; } /** ฟังก์ชันดึงข้อมูลคำสั่ง */ @@ -88,9 +165,66 @@ async function fetchCommandType() { commandType.value = commandOp.value[0].id; } +/** + * ฟังก์ชันต้นหาข้อมูลของ Option ขอสถานะ + * @param val ค่าที่ต้องการฟิลเตอร์ + * @param update อัพเดทค่า + * @param refData ดาต้าที่ต้องการฟิลเตอร์ + */ +function filterOption(val: string, update: Function) { + update(() => { + group.value = val ? "" : group.value; + groupOp.value = groupDataOp.value.filter( + (v: DataOption) => v.name.indexOf(val) > -1 + ); + }); +} + +/** + * ฟังก์ชันเลือกกลุ่ม + * @param val กลุ่มที่ต้องการค้นหา + */ +function updateGroup(val: string) { + const data = [ + { + id: "1", + posMasterNo: "สกก.1", + positionName: "นักบริหาร", + posTypeName: "บริหาร", + posLevelName: "ปฏิบัติงาน", + positionIsSelected: "นายศรัณย์ ศิลาดี", + group: "1.1", + }, + { + id: "2", + posMasterNo: "สกก.2", + positionName: "นักบริหาร", + posTypeName: "บริหาร", + posLevelName: "อำนวยการต้น", + positionIsSelected: "นางสาวพรทิพย์ กาญจนา", + group: "1.2", + }, + { + id: "3", + posMasterNo: "สกก.3", + positionName: "นักบริหาร", + posTypeName: "บริหาร", + posLevelName: "อำนวยการสูง", + positionIsSelected: "", + group: "2", + }, + ]; + + rows.value = data.filter((e: any) => e.group === val); +} + watch(modal, () => { if (modal.value) { fetchCommandType(); + if (props.orgPublishDate) { + commandExcecuteDate.value = props.orgPublishDate; + isCheckOrgPublishDate.value = true; + } } }); @@ -128,6 +262,8 @@ watch(modal, () => {
+ +
{ - +
{
+
{
+
{ :locale="'th'" autoApply :enableTimePicker="false" - class="inputgreen" + :class="!isCheckOrgPublishDate ? 'inputgreen' : ''" + :readonly="isCheckOrgPublishDate" > From 825d99e22e8e7ff2284f5553207b9864dc7fa960 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 17 Oct 2024 11:23:28 +0700 Subject: [PATCH 4/6] api workflow --- .../Workflow/DialogSelectPerson.vue | 45 +++++++++++-------- src/components/Workflow/Main.vue | 13 +++--- src/interface/response/workflow/Main.ts | 39 ++++++++++++++++ 3 files changed, 73 insertions(+), 24 deletions(-) create mode 100644 src/interface/response/workflow/Main.ts diff --git a/src/components/Workflow/DialogSelectPerson.vue b/src/components/Workflow/DialogSelectPerson.vue index b49d61687..88c80b3ae 100644 --- a/src/components/Workflow/DialogSelectPerson.vue +++ b/src/components/Workflow/DialogSelectPerson.vue @@ -22,14 +22,7 @@ const { stateId, fetchData } = defineProps({ /** table*/ const selected = ref([]); -const rows = ref([ - { - fullName: "นายศรัณย์ ศิลาดี", - position: "นักบริหาร", - posType: "บริหาร(สูง)", - organization: "", - }, -]); +const rows = ref([]); const columns = ref([ { name: "fullName", @@ -37,6 +30,9 @@ const columns = ref([ label: "ชื่อ-นามสกุล", sortable: true, field: "fullName", + format(val, row) { + return `${row.prefix}${row.firstName} ${row.lastName}`; + }, headerStyle: "font-size: 14px", style: "font-size: 14px", }, @@ -49,15 +45,15 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, - { - name: "posType", - align: "left", - label: "ประเภทตำแหน่ง", - sortable: true, - field: "posType", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, + // { + // name: "posType", + // align: "left", + // label: "ประเภทตำแหน่ง", + // sortable: true, + // field: "posType", + // headerStyle: "font-size: 14px", + // style: "font-size: 14px", + // }, { name: "organization", align: "left", @@ -73,7 +69,20 @@ const isAcceptSetting = ref(false); const isApproveSetting = ref(false); const isReasonSetting = ref(false); -function fetchLists() {} +async function fetchLists() { + showLoader(); + await http + .get(config.API.workflow + `commander`) + .then(async (res) => { + rows.value = res.data.result; + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} function onSubmit() { dialogConfirm($q, async () => { diff --git a/src/components/Workflow/Main.vue b/src/components/Workflow/Main.vue index 5197c3241..8ccf93e46 100644 --- a/src/components/Workflow/Main.vue +++ b/src/components/Workflow/Main.vue @@ -6,6 +6,8 @@ import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; +import type { DataListState } from "@/interface/response/workflow/Main"; + import DialogSelectPerson from "@/components/Workflow/DialogSelectPerson.vue"; import DialogApprove from "@/components/Workflow/DialogApprove.vue"; @@ -19,7 +21,7 @@ const { id, sysName } = defineProps({ }); const stateId = ref(""); //id state ปัจุบัน -const state = ref(2); //state ปัจุบัน +const state = ref(1); //state ปัจุบัน const isChangeState = ref(false); //ส่งไปยังผู้บังคับบัญชา/ผู้มีอำนาจ const isOperate = ref(true); //เปลี่ยนสถานะ (state) เอกสารได้ @@ -31,10 +33,9 @@ const isCancel = ref(true); //ลบเอกสารได้ (ถ้ const modalSelectPerson = ref(false); const modalApprove = ref(false); -const itemState = ref([]); +const itemState = ref([]); async function fetchData() { - console.log(id, sysName); await http .post(config.API.workflow + `check-state-all`, { refId: id, @@ -129,7 +130,7 @@ onMounted(async () => { :color="state < index + 1 ? 'grey-4' : ''" > -
+
{ :key="index" > - {{ item.createdFullName }} + + {{ `${item.prefix}${item.firstName} ${item.lastName}` }} {{ diff --git a/src/interface/response/workflow/Main.ts b/src/interface/response/workflow/Main.ts new file mode 100644 index 000000000..99b0da399 --- /dev/null +++ b/src/interface/response/workflow/Main.ts @@ -0,0 +1,39 @@ +interface DataListState { + stateId: string; + stateName: string; + stateNo: number; + stateUserComments: StateUserComments[]; +} + +interface StateUserComments { + createdAt: string; + createdFullName: string; + createdUserId: string; + id: string; + isAccept: boolean | null; + isAcceptSetting: boolean | null; + isApprove: boolean | null; + isApproveSetting: boolean | null; + isReasonSetting: boolean | null; + lastUpdateFullName: string; + lastUpdateUserId: string; + lastUpdatedAt: string; + order: null; + profileId: string; + reason: string; + stateId: string; + firstName: string; + lastName: string; + prefix: string; +} + +interface DataCommander { + firstName: string; + id: string; + lastName: string; + orgRoot: string; + position: string; + prefix: string; +} + +export type { DataListState, DataCommander }; From f251ae03d7958ccbe5eec7e391ebe1da3f10e01f Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 17 Oct 2024 13:37:13 +0700 Subject: [PATCH 5/6] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20work?= =?UTF-8?q?flow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Workflow/Main.vue | 86 ++++++++++--------- src/interface/index/Main.ts | 0 src/interface/index/workflow/Main.ts | 10 +++ .../components/Transfer/TransferDetail.vue | 14 ++- 4 files changed, 66 insertions(+), 44 deletions(-) create mode 100644 src/interface/index/Main.ts create mode 100644 src/interface/index/workflow/Main.ts diff --git a/src/components/Workflow/Main.vue b/src/components/Workflow/Main.vue index 8ccf93e46..35703d950 100644 --- a/src/components/Workflow/Main.vue +++ b/src/components/Workflow/Main.vue @@ -6,6 +6,7 @@ import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; +import type { Permission } from "@/interface/index/workflow/Main"; import type { DataListState } from "@/interface/response/workflow/Main"; import DialogSelectPerson from "@/components/Workflow/DialogSelectPerson.vue"; @@ -23,17 +24,44 @@ const { id, sysName } = defineProps({ const stateId = ref(""); //id state ปัจุบัน const state = ref(1); //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 isPermission = ref(true); //การเข้าถึง Workflow +const permission = ref({ + isChangeState: false, //ส่งไปยังผู้บังคับบัญชา/ผู้มีอำนาจ + isOperate: false, //เปลี่ยนสถานะ (state) เอกสารได้ + isView: false, //ดูเอกสารได้ + isUpdate: false, //แก้ไขเอกสารได้ + isDelete: false, //ลบเอกสารได้ (ถ้ามี) + isCancel: false, //ลบเอกสารได้ (ถ้ามี) +}); +const itemState = ref([]); const modalSelectPerson = ref(false); const modalApprove = ref(false); -const itemState = ref([]); +async function fetchCheckState() { + await http + .post(config.API.workflow + `check-user-now`, { + refId: id, + system: sysName, + }) + .then(async (res) => { + await fetchData(); + const data = await res.data.result; + stateId.value = data.stateId; + state.value = data.stateNo === 4 ? 5 : data.stateNo; + permission.value = { + isChangeState: data.can_change_state, + isOperate: data.can_operate, + isView: data.can_view, + isUpdate: data.can_update, + isDelete: data.can_delete, + isCancel: data.can_cancel, + }; + }) + .catch(() => { + isPermission.value = false; + }); +} async function fetchData() { await http @@ -50,28 +78,6 @@ async function fetchData() { }); } -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(); @@ -81,7 +87,7 @@ function onChangeState() { system: sysName, }) .then(async () => { - await Promise.all([fetchData(), fetchCheckState()]); + await fetchCheckState(); }) .catch((err) => { messageError($q, err); @@ -92,17 +98,17 @@ function onChangeState() { }); } -async function fetchAllFunction() { - await Promise.all([fetchData(), fetchCheckState()]); -} - onMounted(async () => { - await fetchAllFunction(); + await fetchCheckState(); +}); + +defineExpose({ + permission, }); From 59498c083544777fe24ac14e61c1b582661a35b6 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 17 Oct 2024 13:57:33 +0700 Subject: [PATCH 6/6] =?UTF-8?q?=E0=B9=82=E0=B8=84=E0=B8=A3=E0=B8=87?= =?UTF-8?q?=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87=20=3D>=20fix=20?= =?UTF-8?q?=E0=B8=AA=E0=B8=81=E0=B8=88.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/02_organization/components/TreeMain.vue | 9 ++++++++- .../02_organization/interface/response/organizational.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/02_organization/components/TreeMain.vue b/src/modules/02_organization/components/TreeMain.vue index b8ad0c228..cfb53cde5 100644 --- a/src/modules/02_organization/components/TreeMain.vue +++ b/src/modules/02_organization/components/TreeMain.vue @@ -436,8 +436,15 @@ watch( class="row col-12 text-dark items-center q-py-xs q-pl-sm rounded-borders my-list" >
-
+
{{ prop.node.orgTreeName }} + {{ prop.node.isOfficer ? "(สกจ.)" : "" }}
{{ prop.node.orgCode == null ? null : prop.node.orgCode }} diff --git a/src/modules/02_organization/interface/response/organizational.ts b/src/modules/02_organization/interface/response/organizational.ts index 34b1dc941..4bb9717f8 100644 --- a/src/modules/02_organization/interface/response/organizational.ts +++ b/src/modules/02_organization/interface/response/organizational.ts @@ -35,6 +35,7 @@ interface OrgTree { orgTreePhoneIn: string; orgTreeFax: string; orgRevisionId: string; + isOfficer: boolean; children: OrgTree[]; }