From f41af9be6cf3a4edb8b222f6e351bfaa03362085 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期一, 17 一月 2022 13:56:18 +0800
Subject: [PATCH] update: 新增約訪記錄 api 串接

---
 PAMapp/components/Interview/InterviewAdd.vue  |   40 ++++++++++++++++++-
 PAMapp/shared/services/appointment.service.ts |   17 ++++++++
 PAMapp/shared/models/appointment.model.ts     |   11 +++++
 3 files changed, 64 insertions(+), 4 deletions(-)

diff --git a/PAMapp/components/Interview/InterviewAdd.vue b/PAMapp/components/Interview/InterviewAdd.vue
index 6cac922..f88210e 100644
--- a/PAMapp/components/Interview/InterviewAdd.vue
+++ b/PAMapp/components/Interview/InterviewAdd.vue
@@ -11,23 +11,40 @@
       ></DateTimePicker>
 
       <div class="mdTxt mb-10 mt-10">蝝赤蝝����</div>
-      <el-input type="textarea" :rows="5" placeholder="蝝赤�" resize="none">
+      <el-input
+        type="textarea"
+        :rows="5"
+        placeholder="隢撓�蝝赤蝝����"
+        resize="none"
+        v-model="content"
+      >
       </el-input>
 
       <div class="edit-appointment-record-btn">
           <el-button>����</el-button>
-          <el-button :disabled="!interviewTime">蝣箏��</el-button>
+          <el-button :disabled="!interviewTime || !content" @click="createInterviewRecord">蝣箏��</el-button>
       </div>
+
+      <PopUpFrame :isOpen.sync="isConfirmPopup"
+        @closePopUp="closeConfirmPopup">
+        <div class="text--center mdTxt">�憓���</div>
+        <div class="text--center mt-30">
+            <el-button @click="closeConfirmPopup" type="primary">蝣箏��</el-button>
+        </div>
+    </PopUpFrame>
   </div>
 </template>
 <script lang="ts">
-import { AppointmentLog } from '~/shared/models/appointment.model';
+import { AppointmentLog, InterviewRecordInfo } from '~/shared/models/appointment.model';
 import { Vue, Component, Prop } from 'nuxt-property-decorator';
 import authService from '~/shared/services/auth.service';
+import appointmentService from '~/shared/services/appointment.service';
 
 @Component
 export default class InterviewAdd extends Vue {
     interviewTime = '';
+    content = '';
+    isConfirmPopup = false;
 
     // @Prop()
     // myAppointmentReviewLogList!: AppointmentLog[];
@@ -39,6 +56,23 @@
     //   this.isUserLogin = authService.isUserLogin();
     // }
 
+    createInterviewRecord() {
+        const interviewRecordInfo: InterviewRecordInfo = {
+            content: this.content,
+            interviewDate: this.interviewTime,
+            appointmentId: +this.$route.params.appointmentId
+        }
+        appointmentService.createInterviewRecord(interviewRecordInfo).then(res => {
+            this.isConfirmPopup = true;
+        });
+
+    }
+
+    closeConfirmPopup() {
+        this.isConfirmPopup = false;
+        this.$router.go(-1);
+    }
+
 }
 </script>
 
diff --git a/PAMapp/shared/models/appointment.model.ts b/PAMapp/shared/models/appointment.model.ts
index c64645c..22e4e25 100644
--- a/PAMapp/shared/models/appointment.model.ts
+++ b/PAMapp/shared/models/appointment.model.ts
@@ -157,3 +157,14 @@
   message      : string;
   phone        : string;
 }
+
+export interface InterviewRecordInfo {
+  content: string;
+  interviewDate: string;
+  appointmentId: number;
+}
+
+export interface UpdateInterviewRecordInfo {
+  /** interviewRecord id */
+  id: number;
+}
\ No newline at end of file
diff --git a/PAMapp/shared/services/appointment.service.ts b/PAMapp/shared/services/appointment.service.ts
index 08ce8fc..083712a 100644
--- a/PAMapp/shared/services/appointment.service.ts
+++ b/PAMapp/shared/services/appointment.service.ts
@@ -1,6 +1,6 @@
 import { http } from "./httpClient";
 
-import { Appointment, AppointmentDetail, AppointmentMemoInfo, createdMemoInfo, EditAppointmentParams, ToCloseAppointment, ToDoneAppointment, ToInformAppointment, updatedMemoInfo } from "~/shared/models/appointment.model";
+import { Appointment, AppointmentDetail, AppointmentMemoInfo, createdMemoInfo, EditAppointmentParams,  InterviewRecordInfo, ToCloseAppointment, ToDoneAppointment, ToInformAppointment, updatedMemoInfo, UpdateInterviewRecordInfo } from "~/shared/models/appointment.model";
 
 class AppointmentService {
 
@@ -64,6 +64,21 @@
   async informAppointment(appointmentInformation: ToInformAppointment) {
     return http.post(`/notice/send`, appointmentInformation).then((res) => res.data);
   }
+
+  // �憓�赤閮��
+  async createInterviewRecord(interviewRecordInfo: InterviewRecordInfo) {
+    return http.post('/interview_record/create', interviewRecordInfo).then(res => res.data);
+  }
+
+  // 靽格蝝赤閮��
+  async updateInterviewRecord(updateInterviewRecordInfo: UpdateInterviewRecordInfo) {
+    return http.post('/interview_record/update', updateInterviewRecordInfo)
+  }
+
+  // ��蝝赤閮��
+  async deleteInterviewRecord(interviewRecordId) {
+    return http.delete(`/interview_record/'${interviewRecordId}`);
+  }
 }
 
 export default new AppointmentService();

--
Gitblit v1.8.0