From 080ef0b4e895dec66b60be784dc40543add207d5 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 27 Jun 2024 18:15:20 +0700 Subject: [PATCH] updated portfolio --- src/api/KPI/api.kpis.ts | 3 +- src/api/api.development.ts | 9 ++++ src/app.config.ts | 2 + src/modules/13_portfolio/views/Add.vue | 66 ++++++++++++------------- src/modules/13_portfolio/views/Main.vue | 33 +++++++------ 5 files changed, 63 insertions(+), 50 deletions(-) create mode 100644 src/api/api.development.ts diff --git a/src/api/KPI/api.kpis.ts b/src/api/KPI/api.kpis.ts index 7e32d04..9e5752d 100644 --- a/src/api/KPI/api.kpis.ts +++ b/src/api/KPI/api.kpis.ts @@ -11,6 +11,7 @@ const KpiFile = `${env.API_URI}/salary/file`; const KpiEvaluationInfo = `${env.API_URI}/kpi/evaluation`; const Kpiorg = `${env.API_URI}/org/profile/commander`; +const Kpi = `${env.API_URI}/kpi`; const KpiUser = `${env.API_URI}/kpi/user`; const kpiAchievement = `${env.API_URI}/kpi/user/achievement`; const kpiReason = `${env.API_URI}/kpi/reason`; @@ -60,5 +61,5 @@ export default { sendToSummary: (id: string) => `${kpiEvaluation}/summary/${id}`, updatePoint: (id: string) => `${kpiEvaluation}/point/${id}`, openPoint: (id: string) => `${kpiEvaluation}/open/${id}`, - kpiReport: (id: string) => `${kpiEvaluation}/report/${id}`, + kpiReport: (id: string) => `${Kpi}/report/kpi9/${id}`, }; diff --git a/src/api/api.development.ts b/src/api/api.development.ts new file mode 100644 index 0000000..63a9c04 --- /dev/null +++ b/src/api/api.development.ts @@ -0,0 +1,9 @@ +import env from "./index"; + +const development = `${env.API_URI}/development`; + +export default { + // portfolio + portfolio: `${development}/portfolio`, + portfolioId: (id: string) => `${development}/portfolio/${id}`, +}; diff --git a/src/app.config.ts b/src/app.config.ts index 44b71ec..31e50f1 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -12,6 +12,7 @@ import org from "./api/org/api.org"; import scholarship from "./api/scholarship/api.scholarship"; import kpi from "./api/KPI/api.kpis"; import probation from "./api/probation/api.probation"; +import development from "./api/api.development"; const API = { ...testtest, @@ -25,6 +26,7 @@ const API = { ...scholarship, ...kpi, ...probation, + ...development, }; export default { diff --git a/src/modules/13_portfolio/views/Add.vue b/src/modules/13_portfolio/views/Add.vue index bce88f2..ce21b3b 100644 --- a/src/modules/13_portfolio/views/Add.vue +++ b/src/modules/13_portfolio/views/Add.vue @@ -18,7 +18,7 @@ const { success, messageError, showLoader, hideLoader, dialogConfirm } = mixin; const route = useRoute(); const files = ref(); const name = ref(""); -const description = ref(""); +const detail = ref(""); const id = ref(""); const nameFile = ref(""); const routeName = router.currentRoute.value.name; @@ -49,22 +49,22 @@ const saveData = async () => { */ const createTransfer = async () => { showLoader(); - const formData = new FormData(); - formData.append("Organization", name.value); - formData.append("Reason", description.value); - formData.append("file", files.value); - // await http - // .post(config.API.listtransfer(), formData) - // .then((res: any) => { - // success($q, "บันทึกข้อมูลสำเร็จ"); - // router.push(`/transfer`); - // }) - // .catch((e: any) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // }); + // const formData = new FormData(); + // formData.append("name", name.value); + // formData.append("detail", detail.value); + // formData.append("file", files.value); + await http + .post(config.API.portfolio, { name: name.value, detail: detail.value }) + .then((res: any) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + router.push(`/portfolio`); + }) + .catch((e: any) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }; /** @@ -72,21 +72,21 @@ const createTransfer = async () => { * @param id ไอดีของข้อมูล */ const fecthData = async (id: string) => { - // showLoader(); - // await http - // .get(config.API.transferByid(id)) - // .then((res: any) => { - // let data = res.data.result; - // name.value = data.organization; - // description.value = data.reason; - // files.value = data.docs; - // }) - // .catch((e: any) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // }); + showLoader(); + await http + .get(config.API.portfolioId(id)) + .then((res: any) => { + let data = res.data.result; + name.value = data.organization; + detail.value = data.reason; + files.value = data.docs; + }) + .catch((e: any) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }; /** @@ -153,7 +153,7 @@ function fileOpen(url: string) { " dense outlined - v-model="description" + v-model="detail" label="รายละเอียดเอกสาร/ผลงาน" hide-bottom-space type="textarea" diff --git a/src/modules/13_portfolio/views/Main.vue b/src/modules/13_portfolio/views/Main.vue index 26438a2..7be953d 100644 --- a/src/modules/13_portfolio/views/Main.vue +++ b/src/modules/13_portfolio/views/Main.vue @@ -24,7 +24,7 @@ const pagination = ref({ */ const filter = ref(""); const rows = ref([]); -const visibleColumns = ref(["no", "name", "description"]); +const visibleColumns = ref(["no", "name", "detail"]); const columns = ref([ { name: "no", @@ -45,11 +45,11 @@ const columns = ref([ style: "font-size: 14px; width:5px;", }, { - name: "description", + name: "detail", align: "left", label: "รายละเอียดเอกสาร/ผลงาน", sortable: true, - field: "description", + field: "detail", headerStyle: "font-size: 14px", style: "font-size: 14px; width:5px;", }, @@ -64,17 +64,18 @@ onMounted(async () => { //นำข้อมูลมาแสดง const fecthList = async () => { - // showLoader(); - // await http - // .get(config.API.listUserTransfer()) - // .then((res: any) => { - // }) - // .catch((e: any) => { - // messageError($q, e); - // }) - // .finally(() => { - // hideLoader(); - // }); + showLoader(); + await http + .get(config.API.portfolio) + .then((res: any) => { + rows.value = res.data.result; + }) + .catch((e: any) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }; /** @@ -211,7 +212,7 @@ const clickBack = () => { v-for="col in props.cols" :key="col.name" :props="props" - @click="router.push(`/transfer/` + props.row.id)" + @click="router.push(`/portfolio/` + props.row.id)" >
{{ props.rowIndex + 1 }} @@ -227,7 +228,7 @@ const clickBack = () => {