Browse Source

有未保存的数据时提示

liudan 1 month ago
parent
commit
3a4eefc779

+ 37 - 18
src/pages/entryWrite/page/Entry/prescription/addPrescription/addPrescription.vue

@@ -445,27 +445,42 @@ export default {
 
         // 切换
         bindPickerChange: function (active) {
-            this.setData(
-                {
-                    active: active,
-                },
-                () => {
-                    this.syncPageScrollLock();
-                    this.bindPickerChangeHttp(active); // 验证是否有西药草药权限
-                    let { select } = this;
-                    if (select === 1) {
-                        this.historicalDiagnosis.childFun(); // 历史处方
-                    }
+            const tabFn = () => {
+                this.setData(
+                    {
+                        active: active,
+                    },
+                    () => {
+                        this.syncPageScrollLock();
+                        this.bindPickerChangeHttp(active); // 验证是否有西药草药权限
+                        let { select } = this;
+                        if (select === 1) {
+                            this.historicalDiagnosis.childFun(); // 历史处方
+                        }
 
-                    if (select === 2) {
-                        this.templateDiagnostic.childFun(); // 处方模板
-                    }
+                        if (select === 2) {
+                            this.templateDiagnostic.childFun(); // 处方模板
+                        }
 
-                    if (select === 3) {
-                        this.medicalOrderSet.childFun(); // 医嘱套
+                        if (select === 3) {
+                            this.medicalOrderSet.childFun(); // 医嘱套
+                        }
                     }
-                }
-            );
+                );
+            }
+            if(this.$refs.customDiagnostics.unSaveData()){
+                Dialog.confirm({
+                    title: '提示',
+                    message: '有未保存的医嘱,是否继续?',
+                    context: this
+                }).then(() => {
+                    tabFn();
+                }).catch(() => {
+                    // 取消
+                });
+                return;
+            }
+            tabFn();
         },
 
         // 获取诊断列表(03050033)
@@ -786,6 +801,9 @@ export default {
     flex-direction: row;
     justify-content: space-between; 
     background-color: #fff;
+    border-bottom: 1px solid #edf1f6;
+    font-weight: 700;
+    color: #222;
 }
 .categoryTab .categoryTabItem{
     flex: 1;
@@ -796,5 +814,6 @@ export default {
 }
 .categoryTab .categoryTabItem.active{
     color: #1687ff;
+    border-bottom: 2px solid #1687ff;
 }
 </style>

+ 3 - 0
src/pages/entryWrite/page/Entry/prescription/addPrescription/customDiagnostics/customDiagnostics.vue

@@ -86,6 +86,9 @@ export default {
      * 组件的方法列表
      */
     methods: {
+        unSaveData: function () {
+            return this.$refs.western?.totalSelected > 0 || this.$refs.grass?.gList?.length > 0;
+        },
         ready: function (options) {
             console.log(this.gListData);
         },