门诊号码管理修改关闭给予保存提示

This commit is contained in:
2025-11-24 10:45:27 +08:00
parent 97a29a31c5
commit 61749aee4d
2 changed files with 48 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
<template> <template>
<div>
<!-- Windows XP风格窗口布局600px固定宽度 --> <!-- Windows XP风格窗口布局600px固定宽度 -->
<div class="outpatient-no-management-wrapper"> <div class="outpatient-no-management-wrapper">
<div class="outpatient-no-management"> <div class="outpatient-no-management">
@@ -143,6 +144,7 @@
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
</div>
</template> </template>
<script setup name="outpatientNoManagement"> <script setup name="outpatientNoManagement">
@@ -238,7 +240,40 @@ function onStartNoChange(row) {
} }
function onClose() { function onClose() {
// 检查是否有未保存的数据变动
const hasUnsavedChanges = tableData.value.some(row => row._dirty || row._editing)
if (hasUnsavedChanges) {
// 有未保存的数据,提示用户
const message = '窗口数据有变动是否进行保存操作?'
if (proxy.$modal?.confirm) {
proxy.$modal.confirm(message).then(() => {
// 用户选择保存
onSave()
// 等待保存完成后关闭页面
setTimeout(() => {
proxy.$tab.closePage() proxy.$tab.closePage()
}, 800)
}).catch(() => {
// 用户选择不保存,直接关闭
proxy.$tab.closePage()
})
} else {
// 降级方案:使用原生 confirm
if (confirm(message)) {
onSave()
setTimeout(() => {
proxy.$tab.closePage()
}, 800)
} else {
proxy.$tab.closePage()
}
}
} else {
// 没有未保存的数据,直接关闭
proxy.$tab.closePage()
}
} }
function tableRowClassName({ row }) { function tableRowClassName({ row }) {

View File

@@ -189,7 +189,7 @@
</template> </template>
<script setup name="Index"> <script setup name="Index">
import { ref, onMounted } from 'vue'; import { ref, onMounted, onActivated } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import Chart from 'chart.js/auto'; import Chart from 'chart.js/auto';
import { import {
@@ -214,6 +214,10 @@ function getExpirationWarningCount() {
let chartInstance = null; let chartInstance = null;
onActivated(() => {
getExpirationWarningCount();
})
onMounted(() => { onMounted(() => {
getExpirationWarningCount(); getExpirationWarningCount();