From 3055a08dbaa3f71ab370dccc3a18ae8da9d7d9fb Mon Sep 17 00:00:00 2001 From: AnandaTon <125332905+anandaAiemvong@users.noreply.github.com> Date: Tue, 8 Aug 2023 21:37:33 +0700 Subject: [PATCH] =?UTF-8?q?ui/api=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B9=80=E0=B8=AB=E0=B8=A3=E0=B8=B5=E0=B8=A2?= =?UTF-8?q?=E0=B8=8D=E0=B8=88=E0=B8=B1=E0=B8=81=E0=B8=A3=E0=B8=9E=E0=B8=A3?= =?UTF-8?q?=E0=B8=A3=E0=B8=94=E0=B8=B4=E0=B8=A1=E0=B8=B2=E0=B8=A5=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/1_Proposals/addProposals.vue | 49 +- .../components/1_Proposals/listProposals.vue | 4 + .../components/1_Proposals/addProposals.vue | 368 ++++++++++++++ .../components/1_Proposals/listProposals.vue | 468 ++++++++++++++++++ src/modules/09_coin/router.ts | 34 ++ 5 files changed, 887 insertions(+), 36 deletions(-) create mode 100644 src/modules/09_coin/components/1_Proposals/addProposals.vue create mode 100644 src/modules/09_coin/components/1_Proposals/listProposals.vue diff --git a/src/modules/07_insignia/components/1_Proposals/addProposals.vue b/src/modules/07_insignia/components/1_Proposals/addProposals.vue index 8d90236b4..24b001041 100644 --- a/src/modules/07_insignia/components/1_Proposals/addProposals.vue +++ b/src/modules/07_insignia/components/1_Proposals/addProposals.vue @@ -208,7 +208,7 @@ const edit = ref(false); const dateStart = ref(new Date()); const dateEnd = ref(new Date()); const yearly = ref(new Date().getFullYear()); -const files = ref([]); +const files = ref(); const fileDocDataUpload = ref([]); const roundInsig = ref(""); const datelast = ref(1); @@ -257,30 +257,6 @@ const updateYear = async (e: number) => { yearly.value = e; }; -const uploadDocData = async () => { - const formData = new FormData(); - if (fileDocDataUpload.value.length > 0) { - fileDocDataUpload.value.forEach((file: any) => { - formData.append("", file); - }); - showLoader(); - await http - .put(config.API.RoundInsignia(id.value), formData) - .then((res) => {}) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - hideLoader(); - success($q, "บันทึกข้อมูลสำเร็จ"); - clickBack(); - }); - } else { - success($q, "บันทึกข้อมูลสำเร็จ"); - clickBack(); - } -}; - const editData = async (id: string) => { const formData = new FormData(); formData.append("Name", roundInsig.value); @@ -292,14 +268,15 @@ const editData = async (id: string) => { if (dateEnd.value !== null) { formData.append("endDate", dateToISO(dateEnd.value)); } - formData.append("file", files.value.toString()); + // files.value.forEach((file: any) => { + // formData.append("file", file); + // }); + formData.append("file", files.value); console.log(formData); showLoader(); await http .put(config.API.editRoundInsignia(id)) - .then(async () => { - await uploadDocData(); - }) + .then(async () => {}) .catch((e) => { messageError($q, e); }) @@ -345,17 +322,17 @@ const addData = async () => { if (dateEnd.value !== null) { formData.append("endDate", dateToISO(dateEnd.value)); } - formData.append("file", files.value.toString()); - console.log(formData); + console.log(files.value); + // files.value.forEach((file: any) => { + // formData.append("file", file); + // }); + formData.append("file", files.value); + console.log(files.value); showLoader(); await http .post(config.API.listRoundInsignia("insignia"), formData) - .then(async (res) => { - const data = res.data.result; - id.value = data.id; - await uploadDocData(); - }) + .then(async (res) => {}) .catch((e) => { messageError($q, e); }) diff --git a/src/modules/07_insignia/components/1_Proposals/listProposals.vue b/src/modules/07_insignia/components/1_Proposals/listProposals.vue index d40c5ec29..2c132ed72 100644 --- a/src/modules/07_insignia/components/1_Proposals/listProposals.vue +++ b/src/modules/07_insignia/components/1_Proposals/listProposals.vue @@ -406,6 +406,10 @@ const clickAdd = () => { router.push({ name: "roundAdd" }); }; +const clickProposals = (id: string) => { + // window.open(config.API.exportInsigniaDoc(id)); +}; + // ค้นหาในตาราง const filterKeyword = ref(""); const filterRef = ref(null); diff --git a/src/modules/09_coin/components/1_Proposals/addProposals.vue b/src/modules/09_coin/components/1_Proposals/addProposals.vue new file mode 100644 index 000000000..d889ddd5b --- /dev/null +++ b/src/modules/09_coin/components/1_Proposals/addProposals.vue @@ -0,0 +1,368 @@ + + diff --git a/src/modules/09_coin/components/1_Proposals/listProposals.vue b/src/modules/09_coin/components/1_Proposals/listProposals.vue new file mode 100644 index 000000000..d9d5793b9 --- /dev/null +++ b/src/modules/09_coin/components/1_Proposals/listProposals.vue @@ -0,0 +1,468 @@ + + + + + diff --git a/src/modules/09_coin/router.ts b/src/modules/09_coin/router.ts index d555454b2..ede52ede8 100644 --- a/src/modules/09_coin/router.ts +++ b/src/modules/09_coin/router.ts @@ -4,6 +4,10 @@ const Main = () => import("@/modules/09_coin/views/Main.vue"); const CoinHistory = () => import("@/modules/09_coin/components/Coin.vue"); +const coinProposals = () => + import("@/modules/09_coin/components/1_Proposals/listProposals.vue"); +const coinRoundAdd = () => + import("@/modules/09_coin/components/1_Proposals/addProposals.vue"); export default [ { @@ -16,6 +20,36 @@ export default [ Role: "coin", }, }, + { + path: "/coin/round-proposals", + name: "coinProposals", + component: coinProposals, + meta: { + Auth: true, + Key: [8.2], + Role: "coin", + }, + }, + { + path: "/coin/round-add", + name: "coinRoundAdd", + component: coinRoundAdd, + meta: { + Auth: true, + Key: [8.2], + Role: "coin", + }, + }, + { + path: "/coin/round-add/:id", + name: "coinRoundEdit", + component: coinRoundAdd, + meta: { + Auth: true, + Key: [8.2], + Role: "coin", + }, + }, { path: "/coin/history", name: "coinHistory",