From 6569d4fd53d3475431199d11523e41a299605cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89?= <814457906@qq.com> Date: Wed, 20 Mar 2024 11:31:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/obtainendtime.js | 35 ++++++++++++++ src/views/manage/continueSigning/index.vue | 53 +++++--------------- src/views/manage/newSigning/index.vue | 50 +++++-------------- src/views/manage/signRecord/index.vue | 56 ++++++++++++---------- 4 files changed, 90 insertions(+), 104 deletions(-) create mode 100644 src/utils/obtainendtime.js diff --git a/src/utils/obtainendtime.js b/src/utils/obtainendtime.js new file mode 100644 index 0000000..b502b83 --- /dev/null +++ b/src/utils/obtainendtime.js @@ -0,0 +1,35 @@ +//获取endtime +function obtainendtime(starttime, item) { + let currentDate = new Date(starttime) + let nextDate + console.log(item) + if (item.packageTermUnit == '年') { + currentDate.setFullYear(currentDate.getFullYear() + Number(item.packageTerm)); + currentDate.setDate(currentDate.getDate() - 1); + let nextYear = currentDate.getFullYear(); + let nextMonth = checkMonth(currentDate.getMonth() + 1);// 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1 + let nextday = checkMonth(currentDate.getDate()) + nextDate = nextYear + "-" + nextMonth + "-" + nextday; // "2019-05" + } else if (item.packageTermUnit == '月') { + currentDate.setMonth(currentDate.getMonth() + Number(item.packageTerm)); // 加一个月 + currentDate.setDate(currentDate.getDate() - 1); // 减一天 + let nextYear = currentDate.getFullYear(); + let nextMonth = checkMonth(currentDate.getMonth() + 1);// 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1 + let nextday = checkMonth(currentDate.getDate()) + nextDate = nextYear + "-" + nextMonth + "-" + nextday; // "2019-05" + } else if (item.packageTermUnit == '日') { + currentDate = new Date(currentDate.setDate(currentDate.getDate() + Number(item.packageTerm))); + let nextYear = currentDate.getFullYear(); + let nextMonth = checkMonth(currentDate.getMonth() + 1);// 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1 + let nextday = checkMonth(currentDate.getDate()) + nextDate = nextYear + "-" + nextMonth + "-" + nextday; // "2019-05" + } + return nextDate +} +function checkMonth(i) { + if (i < 10) { + i = "0" + i; + } + return i; +} +export { obtainendtime } diff --git a/src/views/manage/continueSigning/index.vue b/src/views/manage/continueSigning/index.vue index 103df3f..9f83bef 100644 --- a/src/views/manage/continueSigning/index.vue +++ b/src/views/manage/continueSigning/index.vue @@ -140,6 +140,7 @@ import { getById } from '@/api/manage/signRecord.js' import { getAge } from "@/utils/age"; +import { obtainendtime } from "@/utils/obtainendtime"; import { getToken } from '@/utils/auth' export default { dicts: ['hardware_type'], @@ -226,49 +227,13 @@ export default { this.signPackage = { ...this.signPackage, ...resp.data } this.signPackage.serviceStartTime = `${year}-${month}-${day}` this.signPackage.servicePackageId = resp.data.id - this.obtainendtime(this.signPackage) + this.signPackage.serviceEndTime = obtainendtime(this.signPackage.serviceStartTime, this.signPackage) }) }) }, - //获取endtime - obtainendtime(item) { - if (item.packageTermUnit == '年') { - const nextdate = new Date(this.signPackage.serviceStartTime); - nextdate.setFullYear(nextdate.getFullYear() + Number(item.packageTerm)); - nextdate.setDate(nextdate.getDate() - 1); - let nextYear = nextdate.getFullYear(); - let nextMonth = this.checkMonth(nextdate.getMonth() + 1);// 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1 - let nextday = this.checkMonth(nextdate.getDate()) - let nextDate = nextYear + "-" + nextMonth + "-" + nextday; // "2019-05" - this.signPackage.serviceEndTime = nextDate - } else if (item.packageTermUnit == '月') { - const currentDate = new Date(this.signPackage.serviceStartTime); - currentDate.setMonth(currentDate.getMonth() + Number(item.packageTerm)); // 加一个月 - currentDate.setDate(currentDate.getDate() - 1); // 减一天 - let nextYear = currentDate.getFullYear(); - let nextMonth = this.checkMonth(currentDate.getMonth() + 1);// 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1 - let nextday = this.checkMonth(currentDate.getDate()) - let nextDate = nextYear + "-" + nextMonth + "-" + nextday; // "2019-05" - this.signPackage.serviceEndTime = nextDate - } else if (item.packageTermUnit == '日') { - let currentDate = new Date(this.signPackage.serviceStartTime) - currentDate = new Date(currentDate.setDate(currentDate.getDate() + Number(item.packageTerm))); - let nextYear = currentDate.getFullYear(); - let nextMonth = this.checkMonth(currentDate.getMonth() + 1);// 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1 - let nextday = this.checkMonth(currentDate.getDate()) - let nextDate = nextYear + "-" + nextMonth + "-" + nextday; // "2019-05" - this.signPackage.serviceEndTime = nextDate - } - }, - checkMonth(i) { - if (i < 10) { - i = "0" + i; - } - return i; - }, //选择开始时间 changestarttime(item) { - this.obtainendtime(this.signPackage) + this.signPackage.serviceEndTime = obtainendtime(item, this.signPackage) }, //续约 signupload() { @@ -297,7 +262,11 @@ export default { cancelButtonText: '取消', type: 'success' }).then(() => { - this.$router.go(-1); + this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => { + this.$router.push({ + path: "/patient/signRecord", + }); + }) }).catch(() => { this.$modal.msgSuccess("签约成功"); }); @@ -318,7 +287,11 @@ export default { }, handlePictureCardPreview(file) { }, goback() { - this.$router.go(-1); + this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => { + this.$router.push({ + path: "/patient/signRecord", + }); + }) }, } }; diff --git a/src/views/manage/newSigning/index.vue b/src/views/manage/newSigning/index.vue index 521f960..e377697 100644 --- a/src/views/manage/newSigning/index.vue +++ b/src/views/manage/newSigning/index.vue @@ -131,6 +131,7 @@ import { servicepackageinfo } from '@/api/manage/signRecord.js' import { getToken } from '@/utils/auth' +import { obtainendtime } from "@/utils/obtainendtime"; export default { dicts: ['hardware_type'], name: "newSigning", @@ -199,39 +200,7 @@ export default { month >= 1 && month <= 9 ? (month = "0" + month) : ""; day >= 0 && day <= 9 ? (day = "0" + day) : ""; this.signPackage.serviceStartTime = `${year}-${month}-${day}` - if (item.packageTermUnit == '年') { - const nextdate = new Date(this.signPackage.serviceStartTime); - nextdate.setFullYear(nextdate.getFullYear() + Number(item.packageTerm)); - nextdate.setDate(nextdate.getDate() - 1); - let nextYear = nextdate.getFullYear(); - let nextMonth = this.checkMonth(nextdate.getMonth() + 1);// 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1 - let nextday = this.checkMonth(nextdate.getDate()) - let nextDate = nextYear + "-" + nextMonth + "-" + nextday; // "2019-05" - this.signPackage.serviceEndTime = nextDate - } else if (item.packageTermUnit == '月') { - const currentDate = new Date(this.signPackage.serviceStartTime); - currentDate.setMonth(currentDate.getMonth() + Number(item.packageTerm)); // 加一个月 - currentDate.setDate(currentDate.getDate() - 1); // 减一天 - let nextYear = currentDate.getFullYear(); - let nextMonth = this.checkMonth(currentDate.getMonth() + 1);// 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1 - let nextday = this.checkMonth(currentDate.getDate()) - let nextDate = nextYear + "-" + nextMonth + "-" + nextday; // "2019-05" - this.signPackage.serviceEndTime = nextDate - } else if (item.packageTermUnit == '日') { - let currentDate = new Date(this.signPackage.serviceStartTime) - currentDate = new Date(currentDate.setDate(currentDate.getDate() + Number(item.packageTerm))); - let nextYear = currentDate.getFullYear(); - let nextMonth = this.checkMonth(currentDate.getMonth() + 1);// 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1 - let nextday = this.checkMonth(currentDate.getDate()) - let nextDate = nextYear + "-" + nextMonth + "-" + nextday; // "2019-05" - this.signPackage.serviceEndTime = nextDate - } - }, - checkMonth(i) { - if (i < 10) { - i = "0" + i; - } - return i; + this.signPackage.serviceEndTime = obtainendtime(this.signPackage.serviceStartTime, item) }, //签约 signupload() { @@ -253,10 +222,11 @@ export default { cancelButtonText: '取消', type: 'success' }).then(() => { - // this.$router.go(-1); - this.$router.push({ - path: "/patient/signRecord", - }); + this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => { + this.$router.push({ + path: "/patient/signRecord", + }); + }) }).catch(() => { this.$modal.msgSuccess("签约成功"); }); @@ -287,7 +257,11 @@ export default { handlePictureCardPreview(file) { }, goback() { - this.$router.go(-1); + this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => { + this.$router.push({ + path: "/patient/signRecord", + }); + }) }, } }; diff --git a/src/views/manage/signRecord/index.vue b/src/views/manage/signRecord/index.vue index 460167a..50edb23 100644 --- a/src/views/manage/signRecord/index.vue +++ b/src/views/manage/signRecord/index.vue @@ -411,26 +411,28 @@ export default { this.getList(); }, handlenewsign(row) { - this.$router.push({ - path: "/patient/newSigning", - query: { - departmentId: row.departmentId, - patientName: row.patientName, - patientPhone: row.patientPhone, - visitMethod: row.visitMethod, - signDiagnosis: row.signDiagnosis, - visitSerialNumber: row.visitSerialNumber, - hospitalAgencyName: row.hospitalAgencyName, - hospitalAgencyId: row.hospitalAgencyId, - inHospitalNumber: row.inHospitalNumber, - departmentName: row.departmentName, - paymentStatus: row.paymentStatus, - sex: row.sex, - age: row.birthDate ? getAge(row.birthDate) : '', - patientId: row.patientId, - createTime: row.createTime, - }, - }); + this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => { + this.$router.replace({ + path: "/patient/newSigning", + query: { + departmentId: row.departmentId, + patientName: row.patientName, + patientPhone: row.patientPhone, + visitMethod: row.visitMethod, + signDiagnosis: row.signDiagnosis, + visitSerialNumber: row.visitSerialNumber, + hospitalAgencyName: row.hospitalAgencyName, + hospitalAgencyId: row.hospitalAgencyId, + inHospitalNumber: row.inHospitalNumber, + departmentName: row.departmentName, + paymentStatus: row.paymentStatus, + sex: row.sex, + age: row.birthDate ? getAge(row.birthDate) : '', + patientId: row.patientId, + createTime: row.createTime, + }, + }); + }) }, selectAgencyinfo() { let query = { @@ -501,12 +503,14 @@ export default { }, //续约 handleContinue(row) { - this.$router.push({ - path: "/patient/continueSigning", - query: { - patientSignRecordId: row.id, - }, - }); + this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => { + this.$router.replace({ + path: "/patient/continueSigning", + query: { + patientSignRecordId: row.id, + }, + }); + }) }, /** 详情操作 */ handleAuthRole(row) {