Skip to content

Commit

Permalink
医疗界面错误信息提示
Browse files Browse the repository at this point in the history
  • Loading branch information
M2030123 committed Sep 8, 2023
1 parent b3bca64 commit ec20651
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/components/用户界面/reservationdoctor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default defineComponent({
const currentDate=new Date();
const oneWeekLater = new Date(currentDate);
oneWeekLater.setDate(currentDate.getDate() + 7);
oneWeekLater.setDate(currentDate.getDate() + 14);
// console.log(dateObject);
// const month = dateObject.getMonth(); // 获取月份,0 表示一月,1 表示二月,以此类推
Expand Down
37 changes: 19 additions & 18 deletions src/components/管理员界面/tablemedical.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,7 @@
</el-table-column>
</el-table><br>
</div>
<!-- Edit Medical Dialog -->
<el-dialog v-model="editDialogVisible" title="编辑医疗信息" >
<el-form :model="editedMedicalRecord" label-width="80px">
<!-- 表单内容 -->
<el-form-item label="医疗时间">
<el-date-picker v-model="editedMedicalRecord.treatTime" type="datetime" placeholder="选择医疗时间"></el-date-picker>
</el-form-item>
<el-form-item label="医疗内容">
<el-input v-model="editedMedicalRecord.category"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="editDialogVisible = false">取消</el-button>
<el-button type="primary" @click="editMedicalRecord">保存</el-button>
</div>
</el-dialog>


<!-- Postpone Medical Dialog -->
<el-dialog v-model="postponeDialogVisible" title="延期医疗时间" >
Expand All @@ -80,7 +65,7 @@

<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import { ElButton, ElButtonGroup, ElTable, ElTableColumn, ElTag } from 'element-plus'
import { ElButton, ElButtonGroup, ElTable, ElTableColumn, ElTag,ElMessage } from 'element-plus'
import medical from '@/api/cw_yh_yl_jk'
interface MedicalRecord {
Expand Down Expand Up @@ -208,8 +193,19 @@ const deleteRow = async (index: number) => {
const approveRow = async (index: number) => {
try {
const response = await medical.approveMedicalApplication(tableData.value[index].petId, tableData.value[index].vetId, tableData.value[index].reserveTime);
location.reload(); // 这里会刷新整个页面
ElMessage.success({
message: '修改成功!',
duration: 1000 // 持续显示时间(毫秒)
});
setTimeout(() => {
location.reload(); // 这里会刷新整个页面
}, 1000);
} catch (error) {
ElMessage.error({
message: '必须在预约日期后完成!',
duration: 1000 // 持续显示时间(毫秒)
});
console.error('同意(完成)数据失败:', error);
}
};
Expand All @@ -224,10 +220,15 @@ const postponeRow = async (index: number) => {
};
const postponeMedicalApplication = async(newReserveTime) => {
if (newReserveTime.getDay() == 0||newReserveTime.getDay() == 6) {
ElMessage.warning('预约时间必须在工作日内');
return; // 不继续执行
}
try {
const response = await medical.postponeMedicalApplication(postponeMedicalApplication.value.petId, postponeMedicalApplication.value.vetId, postponeMedicalApplication.value.reserveTime, newReserveTime);
location.reload(); // 这里会刷新整个页面
} catch (error) {
ElMessage.warning('预约时间必须在两周内');
console.error('延期数据失败:', error);
}
}
Expand Down

1 comment on commit ec20651

@VictorHuu
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#54

Please sign in to comment.