|
@@ -169,7 +169,9 @@ export default {
|
|
|
showConfirm: true,
|
|
|
isSuccessUpload: 0, //是否上传成功 0: 不在上传 1: 上传过程中 2: 上传成功
|
|
|
isShowTip: false,
|
|
|
- showType: -1 // 1 诊断 2 药品 3检验套餐 4检验细项 5检查 6手术和操作
|
|
|
+ showType: -1, // 1 诊断 2 药品 3检验套餐 4检验细项 5检查 6手术和操作
|
|
|
+ editCount: -1, // 页面会否被编辑 >0被编辑 =0 未编辑
|
|
|
+ startCount: -1
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -182,6 +184,13 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ form: {
|
|
|
+ handler(newName, oldName) {
|
|
|
+ this.editCount++;
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true
|
|
|
}
|
|
|
},
|
|
|
created: function() {
|
|
@@ -244,26 +253,45 @@ export default {
|
|
|
console.log(error);
|
|
|
});
|
|
|
}
|
|
|
+ setTimeout(() => {
|
|
|
+ this.startCount = this.editCount;
|
|
|
+ }, 500);
|
|
|
},
|
|
|
mounted() {},
|
|
|
beforeRouteLeave(to, from, next) {
|
|
|
- if (this.isSuccessUpload === 1) {
|
|
|
- this.$confirm('文件正在上传,是否确定返回?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- cancelButtonClass: 'cancel',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- next();
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
- // this.warning('还有未保存的文件,是否确定返回?');
|
|
|
- } else if (this.isSuccessUpload === 2) {
|
|
|
- this.$confirm('还有未保存的文件,是否确定返回?', '提示', {
|
|
|
+ // if (this.isSuccessUpload === 1) {
|
|
|
+ // this.$confirm('文件正在上传,是否确定返回?', '提示', {
|
|
|
+ // confirmButtonText: '确定',
|
|
|
+ // cancelButtonText: '取消',
|
|
|
+ // cancelButtonClass: 'cancel',
|
|
|
+ // type: 'warning'
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+ // next();
|
|
|
+ // })
|
|
|
+ // .catch(() => {});
|
|
|
+ // // this.warning('还有未保存的文件,是否确定返回?');
|
|
|
+ // } else if (this.isSuccessUpload === 2) {
|
|
|
+ // this.$confirm('还有未保存的文件,是否确定返回?', '提示', {
|
|
|
+ // confirmButtonText: '确定',
|
|
|
+ // cancelButtonText: '取消',
|
|
|
+ // cancelButtonClass: 'cancel',
|
|
|
+ // type: 'warning'
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+ // next();
|
|
|
+ // })
|
|
|
+ // .catch(() => {});
|
|
|
+ // } else {
|
|
|
+ // next();
|
|
|
+ // }
|
|
|
+
|
|
|
+ if (this.startCount !== this.editCount) {
|
|
|
+ this.$confirm('还有未保存的内容,确定要退出当前页面吗?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
- cancelButtonClass: 'cancel',
|
|
|
+ cancelButtonClass: 'leaveBtn',
|
|
|
+ customClass: 'leaveBox',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
.then(() => {
|