From 1dcefbd40a93202f28c132f7b7d1736d9d37a601 Mon Sep 17 00:00:00 2001 From: "STW_TTTY\\stwtt" Date: Fri, 9 Aug 2024 11:07:14 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=A7=E0=B8=B4=E0=B8=99=E0=B8=B1=E0=B8=A2?= =?UTF-8?q?=20=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5?= =?UTF-8?q?=E0=B8=9E=E0=B8=B7=E0=B9=89=E0=B8=99=E0=B8=90=E0=B8=B2=E0=B8=99?= =?UTF-8?q?=20=E0=B8=AA=E0=B8=B4=E0=B8=97=E0=B8=98=E0=B8=B4=E0=B9=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../6_BasicInformation/Channel/AddPage.vue | 72 ------ .../6_BasicInformation/Channel/EditPage.vue | 64 ----- .../6_BasicInformation/Channel/Form.vue | 85 ------- .../6_BasicInformation/Channel/MainPage.vue | 149 ++++++++++- .../Director/DialogEdit.vue | 237 ++++++++++++++++++ .../6_BasicInformation/Director/MainPage.vue | 90 +++++-- 6 files changed, 446 insertions(+), 251 deletions(-) delete mode 100644 src/modules/11_discipline/components/6_BasicInformation/Channel/AddPage.vue delete mode 100644 src/modules/11_discipline/components/6_BasicInformation/Channel/EditPage.vue delete mode 100644 src/modules/11_discipline/components/6_BasicInformation/Channel/Form.vue create mode 100644 src/modules/11_discipline/components/6_BasicInformation/Director/DialogEdit.vue diff --git a/src/modules/11_discipline/components/6_BasicInformation/Channel/AddPage.vue b/src/modules/11_discipline/components/6_BasicInformation/Channel/AddPage.vue deleted file mode 100644 index f7ccfbf1b..000000000 --- a/src/modules/11_discipline/components/6_BasicInformation/Channel/AddPage.vue +++ /dev/null @@ -1,72 +0,0 @@ - - diff --git a/src/modules/11_discipline/components/6_BasicInformation/Channel/EditPage.vue b/src/modules/11_discipline/components/6_BasicInformation/Channel/EditPage.vue deleted file mode 100644 index 45e3650c2..000000000 --- a/src/modules/11_discipline/components/6_BasicInformation/Channel/EditPage.vue +++ /dev/null @@ -1,64 +0,0 @@ - - diff --git a/src/modules/11_discipline/components/6_BasicInformation/Channel/Form.vue b/src/modules/11_discipline/components/6_BasicInformation/Channel/Form.vue deleted file mode 100644 index 2526d688c..000000000 --- a/src/modules/11_discipline/components/6_BasicInformation/Channel/Form.vue +++ /dev/null @@ -1,85 +0,0 @@ - - diff --git a/src/modules/11_discipline/components/6_BasicInformation/Channel/MainPage.vue b/src/modules/11_discipline/components/6_BasicInformation/Channel/MainPage.vue index cc92edf38..bf6c8b280 100644 --- a/src/modules/11_discipline/components/6_BasicInformation/Channel/MainPage.vue +++ b/src/modules/11_discipline/components/6_BasicInformation/Channel/MainPage.vue @@ -9,6 +9,14 @@ import http from "@/plugins/http"; import type { typeItem } from "@/modules/11_discipline/interface/response/channel"; import { checkPermission } from "@/utils/permissions"; +import Header from "@/components/DialogHeader.vue"; + +const modal = ref(false); +const isEdit = ref(false); +const isRead = ref(false); +const isId = ref(""); +const channel = ref(""); + const dataStore = useDisciplineChannelDataStore(); const mixin = useCounterMixin(); const { dialogRemove, showLoader, messageError, hideLoader, success } = mixin; @@ -39,9 +47,27 @@ const pagination = ref({ /** * clickไปหน้าเพิ่มchanel */ -function clickAdd() { - dataStore.getType(""); - router.push(`/discipline/channel/add`); +function clickAdd(check: boolean) { + modal.value = true; + isEdit.value = check; +} +/** + * clickไปหน้าเพิ่มchanel + */ +function clickEdit(check: boolean, id: string, name: string) { + modal.value = true; + isEdit.value = check; + isId.value = id; + channel.value = name; +} +/** + * clickไปหน้าเพิ่มchanel + */ +function clickRead(check: boolean, name: string) { + modal.value = true; + isEdit.value = check; + isRead.value = true; + channel.value = name; } /** get data */ @@ -96,6 +122,42 @@ function editPage(data: typeItem) { dataStore.getType(data.name); router.push(`/discipline/channel/${data.id}`); } + +function closeDialog() { + modal.value = false; + channel.value = ""; + isId.value = ""; + isRead.value = false; +} + +function inputEdit(val: boolean) { + return { + "full-width cursor-pointer ": val, + "full-width cursor-pointer inputgreen": !val, + }; +} + +function onSubmit() { + const url = isEdit.value + ? config.API.complaintChannelbyId(isId.value) + : config.API.complaintChannel(); + showLoader(); + http[isEdit.value ? "put" : "post"](url, { + name: channel.value, + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + getComplaintChanal(); + closeDialog(); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); +} + /**เมื่อเริ่มโหลดหน้า เรียกใช้ฟังชั่น*/ onMounted(() => { getComplaintChanal(); @@ -109,9 +171,9 @@ onMounted(() => {
{ >
+ + + + +
+ + + + + + + + + บันทึกข้อมูล + + + +