From 298074da1f5b3fac9ed9a232aa3bb28e0b46ab5c Mon Sep 17 00:00:00 2001 From: zhaoyz <11@22.com> Date: Tue, 23 Apr 2024 09:42:25 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/patient.ts | 17 + src/router/index.ts | 40 +- src/router/routes.ts | 4 +- src/stores/remote-ws-store.ts | 214 +++ src/stores/user-info-store.ts | 2 - src/views/index.vue | 57 +- src/views/login/login.vue | 851 +++++----- src/views/remote-manage/chart/chart-ecg.vue | 344 ++-- src/views/remote-manage/chart/chart-line.vue | 185 +-- .../remote-manage/part/message-item-part.vue | 64 +- src/views/remote-manage/part/message-part.vue | 58 +- .../remote-manage/part/remote-dialog.vue | 130 +- .../remote-manage/part/remote-item-part.vue | 202 ++- src/views/remote-manage/part/remote-part.vue | 341 ++-- src/views/remote-manage/remote-control.vue | 1443 ++++++++--------- src/views/remote-manage/remote-manage.vue | 253 +-- src/views/remote-manage/remote-thumbnail.vue | 82 +- 17 files changed, 2093 insertions(+), 2194 deletions(-) create mode 100644 src/api/patient.ts create mode 100644 src/stores/remote-ws-store.ts diff --git a/src/api/patient.ts b/src/api/patient.ts new file mode 100644 index 0000000..1adaa35 --- /dev/null +++ b/src/api/patient.ts @@ -0,0 +1,17 @@ +import request from "@/utils/request"; + +const patientInfoUrl = "/admin/medicine/getPatientInfo"; + +export function getPatientInfo(name: string, id: string, date: string) { + return new Promise((resolve, reject) => { + request.postForm(patientInfoUrl, { + patientName: name, + idNum: id, + date: date + }) + }).then((res: any) => { + console.log(res.data) + }).catch(error => { + reject(error) + }) +} \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 7230c80..2ae2c50 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -10,7 +10,7 @@ const router = createRouter({ router.beforeEach((to, from, next) => { const loginInfo = useLoginStore().getlogin() - const isLogin = loginInfo.isLogin +// const isLogin = loginInfo.isLogin // 普通用户 const commonUser = [ '/login', @@ -49,31 +49,31 @@ router.beforeEach((to, from, next) => { '/logs-manage/logs-manage' ] const isViewRoute = () => { - let release = false - switch (loginInfo.permissions) { - case '超级管理员': - release = true - break; - case '高级管理员': - release = SeniorAdmin.some((p: string) => p === to.path) - break; - case '中级管理员': - release = IntermediateAdmin.some((p: string) => p === to.path) - break; - case '普通用户': - release = commonUser.some((p: string) => p === to.path) - break; - default: - break; - } + let release = true + /*switch (loginInfo.permissions) { + case '超级管理员': + release = true + break; + case '高级管理员': + release = SeniorAdmin.some((p: string) => p === to.path) + break; + case '中级管理员': + release = IntermediateAdmin.some((p: string) => p === to.path) + break; + case '普通用户': + release = commonUser.some((p: string) => p === to.path) + break; + default: + break; + }*/ return release } if(to.fullPath ==='/login') { next() return } - if (!isLogin) next('/login') // 重定向登录页 - else if(!isViewRoute()) { + /*if (!isLogin) next('/login') // 重定向登录页 + else */if(!isViewRoute()) { ElMessage.error('无权访问!') next(from.fullPath) }else next() diff --git a/src/router/routes.ts b/src/router/routes.ts index 047133e..4624a73 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -1,6 +1,6 @@ export const constantRoute=[ - { path: '/:pathMatch(.*)*', name: 'not-found', redirect: '/home' }, + { path: '/:pathMatch(.*)*', name: 'not-found', redirect: '/login' }, { path: '/login', name: '登录', @@ -8,7 +8,7 @@ export const constantRoute=[ }, { path: '/', - redirect: '/home', + redirect: '/login', component: () => import('@/views/index.vue'), children: [ { diff --git a/src/stores/remote-ws-store.ts b/src/stores/remote-ws-store.ts new file mode 100644 index 0000000..0e586ab --- /dev/null +++ b/src/stores/remote-ws-store.ts @@ -0,0 +1,214 @@ +import {defineStore} from "pinia"; +import {Session} from "@/utils/storage"; + +const vitalUrl = "ws://localhost:5173/socket.io/admin/rax/vitalSignsMedicine?token=" + Session.getToken() +const medicineUrl = "ws://localhost:5173/socket.io/admin/rax/addMedicine?token=" + Session.getToken() +const chatUrl = "ws://localhost:5173/socket.io/admin/rax/chatRoom?token=" + Session.getToken() + +export const useRemoteWsStore = defineStore("remoteWs", { + state: () => { + return { + patient: {} as any, + remoteTasks: [] as any, + remoteTasksCap: 10, + currentTaskIndex: 0, + varMedicine: ["丙泊酚", "舒芬太尼", "瑞芬太尼", "顺阿曲库胺"], + fixedMedicine: ["尼卡地平", "艾司洛尔", "麻黄素", "阿托品"], + exceptionType: ["BIS_except", "DBP_except", "EtCO2_except", "HR_except", "SBP_except", "ST_except"], + exceptionMsg: { + "BIS_except": "脑电双频指数异常", "DBP_except": "舒张压异常", "EtCO2_except": "呼气末二氧化碳异常", + "HR_except": "心率异常", "SBP_except": "收缩压异常", "ST_except": "ST异常" + }, + } + }, + actions: { + initRemoteTask() { + if (this.remoteTasks.length <= 0) { + for (let i = 0; i < 10; i++) { + this.remoteTasks.push({ + isRemote: false, + isException: false, + taskName: "", + server: "", + serverun: "", + serverps: "", + patient: "", + patientId: "", + date: "", + log: [], + index: i + }) + } + } + return this.remoteTasks + }, + resetRemoteTask(i: number) { + this.remoteTasks[i] = Object.assign(this.remoteTasks[i], { + isRemote: false, + isException: false, + taskName: "", + server: "", + serverun: "", + serverps: "", + patient: "", + patientId: "", + date: "", + log: [], + index: i, + message: [] + }) + }, + getActiveRemoteTask() { + for (let i = 0; i < this.remoteTasks.length; i++) { + if (this.remoteTasks[i].isRemote) return i + } + }, + setRemoteLog(log: any, i: number) { + this.remoteTasks[i].log.push(log) + }, + createConnect(name: string, id: string, date: string) { + if (!this.patient[name + id + date]) { + const vitalWS = new WebSocket(vitalUrl) + const medicineWS = new WebSocket(medicineUrl) + const chatWS = new WebSocket(chatUrl) + vitalWS.onopen = function () { + vitalWS.send(JSON.stringify({ + patientName: name, + idNum: id, + date: date + })) + } + medicineWS.onopen = function () { + medicineWS.send(JSON.stringify({ + patientName: name, + idNum: id, + date: date + })) + } + chatWS.onopen = function () { + chatWS.send(JSON.stringify({ + patientName: name, + idNum: id, + date: date + })) + } + this.patient[name + id + date] = { + vitalWS, + medicineWS, + chatWS + } + } + }, + disconnect(name: string, id: string, date: string) { + const patient: any = this.patient[name + id + date] + if (patient) { + patient.vitalWS.close() + patient.medicineWS.close() + patient.chatWS.close() + delete this.patient[name + id + date] + } + }, + subscribeVital(name: string, id: string, date: string, cb: any) { + const patient: any = this.patient[name + id + date] + if (patient) { + patient.vitalWS.onmessage = cb + patient.vitalCB = cb + } else { + cb({ + status: 1, + msg: "已断开连接" + }) + } + }, + unsubscribeVital(name: string, id: string, date: string) { + const patient: any = this.patient[name + id + date] + if (patient && patient.vitalWS) { + patient.vitalWS.onmessage = undefined; + patient.vitalCB = undefined; + } + }, + sendMsg(name: string, id: string, date: string, msg: string, cb: any) { + const patient: any = this.patient[name + id + date] + if (patient) { + const params = { + patientName: name, + idNum: id, + date: date, + msg + } + patient.chatWS.send(JSON.stringify(params)) + cb({ + status: 0 + }) + } else { + cb({ + status: 1, + msg: "已断开连接" + }) + } + }, + subscribeChat(name: string, id: string, date: string, cb: any) { + const patient: any = this.patient[name + id + date] + if (patient) { + patient.chatCB = cb + patient.chatWS.onmessage = cb + } else { + cb({ + status: 1, + msg: "已断开连接" + }) + } + }, + unsubscribeChat(name: string, id: string, date: string) { + const patient: any = this.patient[name + id + date] + patient.chatCB = undefined; + patient.chatWS.onmessage = undefined; + }, + sendMedicine(args: { + name: string, + id: string, + date: string, + flag: string, + medicine: string, + value: string + }, cb: any) { + const patient: any = this.patient[args.name + args.id + args.date] + if (patient) { + const params = { + patientName: args.name, + idNum: args.id, + date: args.date, + flag: args.flag, + medicine: args.medicine, + value: args.value + } + patient.medicineWS.send(JSON.stringify(params)) + cb({ + status: 0 + }) + } else { + cb({ + status: 1, + msg: "已断开连接" + }) + } + }, + subscribeMedicine(name: string, id: string, date: string, cb: any) { + const patient = this.patient[name + id + date] + if (patient) { + patient.medicineCB = cb + patient.medicineWS.onmessage = cb + } else { + cb({ + status: 1, + msg: "已断开连接" + }) + } + }, + unsubscribeMedicine(name: string, id: string, date: string) { + const patient: any = this.patient[name + id + date] + patient.medicineCB = undefined; + patient.medicineWS.onmessage = undefined; + } + } +}) \ No newline at end of file diff --git a/src/stores/user-info-store.ts b/src/stores/user-info-store.ts index e0d25c8..0f99bff 100644 --- a/src/stores/user-info-store.ts +++ b/src/stores/user-info-store.ts @@ -4,7 +4,6 @@ export const useLoginStore = defineStore('login', { state: () => { return { login: { - isLogin: false, account: '', name: '', /** @@ -13,7 +12,6 @@ export const useLoginStore = defineStore('login', { * 医院中级管理员: 首页、患者管理、远程管理 * 医院普通用户: 首页、患者管理 */ - permissions: '', hospital: '' } as any } diff --git a/src/views/index.vue b/src/views/index.vue index 4233d57..464c5f1 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -82,32 +82,37 @@ getHospitalsData().then((res: any) => { const menus = [] as any switch (userInfo.permissions) { - case '超级管理员': - menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) - menus.push({label: '权限管理', path: '/permissions-manage', icon: 'icon-users'}) - menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) - menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) - menus.push({label: '后台管理', path: '/system-manage', icon: 'icon-houtaiguanli'}) - menus.push({label: '系统管理', path: '/logs-manage', icon: 'icon-setting'}) - break; - case '高级管理员': - menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) - menus.push({label: '权限管理', path: '/permissions-manage', icon: 'icon-users'}) - menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) - menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) - menus.push({label: '系统管理', path: '/logs-manage', icon: 'icon-setting'}) - break; - case '中级管理员': - menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) - menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) - menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) - break; - case '普通用户': - menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) - menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) - break; - default: - break; + case '超级管理员': + menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) + menus.push({label: '权限管理', path: '/permissions-manage', icon: 'icon-users'}) + menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) + menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) + menus.push({label: '后台管理', path: '/system-manage', icon: 'icon-houtaiguanli'}) + menus.push({label: '系统管理', path: '/logs-manage', icon: 'icon-setting'}) + break; + case '高级管理员': + menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) + menus.push({label: '权限管理', path: '/permissions-manage', icon: 'icon-users'}) + menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) + menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) + menus.push({label: '系统管理', path: '/logs-manage', icon: 'icon-setting'}) + break; + case '中级管理员': + menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) + menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) + menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) + break; + case '普通用户': + menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) + menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) + break; + default: + menus.push({label: '首页', path: '/home', icon: 'icon-shouye'}) + menus.push({label: '权限管理', path: '/permissions-manage', icon: 'icon-users'}) + menus.push({label: '患者管理', path: '/patients-manage', icon: 'icon-renyuanguanli'}) + menus.push({label: '远程管理', path: '/remote-manage', icon: 'icon-anquanbaozhang'}) + menus.push({label: '后台管理', path: '/system-manage', icon: 'icon-houtaiguanli'}) + menus.push({label: '系统管理', path: '/logs-manage', icon: 'icon-setting'}) } const isShowUserInfoDrawer = ref(false) diff --git a/src/views/login/login.vue b/src/views/login/login.vue index a176562..0d292c4 100644 --- a/src/views/login/login.vue +++ b/src/views/login/login.vue @@ -1,127 +1,127 @@ diff --git a/src/views/remote-manage/chart/chart-ecg.vue b/src/views/remote-manage/chart/chart-ecg.vue index 8e223d1..9484df1 100644 --- a/src/views/remote-manage/chart/chart-ecg.vue +++ b/src/views/remote-manage/chart/chart-ecg.vue @@ -1,197 +1,181 @@ diff --git a/src/views/remote-manage/chart/chart-line.vue b/src/views/remote-manage/chart/chart-line.vue index 5b829bf..a875cda 100644 --- a/src/views/remote-manage/chart/chart-line.vue +++ b/src/views/remote-manage/chart/chart-line.vue @@ -5,102 +5,73 @@ diff --git a/src/views/remote-manage/remote-control.vue b/src/views/remote-manage/remote-control.vue index d02b8ae..a64a745 100644 --- a/src/views/remote-manage/remote-control.vue +++ b/src/views/remote-manage/remote-control.vue @@ -481,7 +481,7 @@ const viewPatientInfo = () => { }, 0) } const backRemote = () => { - router.back() + router.back(); } const playPause = () => { if (liveVideo.value.paused) { diff --git a/src/views/remote-manage/remote-manage.vue b/src/views/remote-manage/remote-manage.vue index 8adaabe..c3dbc20 100644 --- a/src/views/remote-manage/remote-manage.vue +++ b/src/views/remote-manage/remote-manage.vue @@ -46,11 +46,14 @@ onMounted(() => { function initRemoteTask() { remoteTask.value = remoteWsStore.initRemoteTask() + remotePartRef.value.showData(remoteWsStore.currentTaskIndex); } const viewThumbnail = () => { router.push({ - path: '/remote-manage/remote-thumbnail' + path: '/remote-manage/remote-thumbnail', + query: { + } }) } // 打开任务连接弹窗 diff --git a/src/views/remote-manage/remote-thumbnail.vue b/src/views/remote-manage/remote-thumbnail.vue index ea93345..29c0db8 100644 --- a/src/views/remote-manage/remote-thumbnail.vue +++ b/src/views/remote-manage/remote-thumbnail.vue @@ -39,12 +39,11 @@ const remoteTask = ref([] as any); const remoteWsStore = useRemoteWsStore(); onMounted(() => { - console.log("remoteThumbnail", remoteWsStore.remoteTasks) remoteTask.value = remoteWsStore.remoteTasks; }) const openRemote = (params: any) => { - router.push('/remote-manage/remote-manage') + router.push('/remote-manage/remote-manage'); } const addLogAfter = (index: number) => { messageItemPartRef.value[index].scrollToBottom() From 7273a8550317a08e41dcecfd22441a801ab828ad Mon Sep 17 00:00:00 2001 From: zhaoyz <11@22.com> Date: Tue, 23 Apr 2024 18:31:46 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/daily-plan.ts | 13 + src/api/patient.ts | 12 +- src/utils/date-util.ts | 96 +++--- src/views/home/index.vue | 350 +++++++++++---------- src/views/home/record-form.vue | 239 +++++++------- src/views/home/week-calendar.vue | 518 ++++++++++++++++--------------- 6 files changed, 650 insertions(+), 578 deletions(-) create mode 100644 src/api/daily-plan.ts diff --git a/src/api/daily-plan.ts b/src/api/daily-plan.ts new file mode 100644 index 0000000..c0a216d --- /dev/null +++ b/src/api/daily-plan.ts @@ -0,0 +1,13 @@ +import request from "@/utils/request"; + +const addDailyPlanUrl = "/admin/dailyPlan/addDailyPlan"; + +export function addDailyPlan(param: any) { + return new Promise((resolve, reject) => { + request.postForm(addDailyPlanUrl, param).then((res: any) => { + resolve(res.data); + }).catch(err => { + reject(err); + }) + }) +} \ No newline at end of file diff --git a/src/api/patient.ts b/src/api/patient.ts index 1adaa35..2913f63 100644 --- a/src/api/patient.ts +++ b/src/api/patient.ts @@ -8,10 +8,10 @@ export function getPatientInfo(name: string, id: string, date: string) { patientName: name, idNum: id, date: date - }) - }).then((res: any) => { - console.log(res.data) - }).catch(error => { - reject(error) - }) + }).then((res: any) => { + resolve(res.data); + }).catch(error => { + reject(error); + }); + }); } \ No newline at end of file diff --git a/src/utils/date-util.ts b/src/utils/date-util.ts index bcf51e1..666f5ec 100644 --- a/src/utils/date-util.ts +++ b/src/utils/date-util.ts @@ -22,55 +22,68 @@ export function dateFormater(formater: string, time?: any) { /** * 获取指定月份天数 - * @param {*} time - * @returns + * @param {*} time + * @returns */ export function getMonthDays(time: any) { - if (!time) time = new Date(); - const now = new Date(time); - const year = now.getFullYear(); - const month = now.getMonth() + 1; + if (!time) time = new Date(); + const now = new Date(time); + const year = now.getFullYear(); + const month = now.getMonth() + 1; - const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; + const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; - const daysInMonth = month === 2 - ? isLeapYear ? 29 : 28 - : month === 4 || month === 6 || month === 9 || month === 11 - ? 30 - : 31; + const daysInMonth = month === 2 + ? isLeapYear ? 29 : 28 + : month === 4 || month === 6 || month === 9 || month === 11 + ? 30 + : 31; - return daysInMonth; + return daysInMonth; } /** * 获取当前日期的周几 i:1,2,3,4,5,6,7 * @returns */ -export function getFirstDayOfWeek(date: Date, i: number) { - if (i < 1 || i > 7) { - return null; - } - const day = date.getDay() || 7; - return new Date(date.getFullYear(), date.getMonth(), date.getDate() + i - day); +export function getFirstDayOfWeek(date: string | Date | number, i: number) { + let temp: any; + if (!(date instanceof Date)) { + if (typeof date == "number") { + temp = new Date(date); + } else { + const s = date.replace(/-/g, "/"); + temp = new Date(s); + } + } else { + temp = new Date(date.getTime()) + } + if (i < 1 || i > 7) { + return null; + } + const day = temp.getDay() || 7; + return new Date(temp.getFullYear(), temp.getMonth(), temp.getDate() + i - day); } + /** * 获取当前日期是周几 * @returns */ const weekArray = ['周天', '周一', '周二', '周三', '周四', '周五', '周六']; -export function getCurrentDate(date: any) { - let myDate = new Date(); - if (date) { - if (date instanceof Date) { - myDate = date; - } else { - date = date.replace(/-/g, '/'); - myDate = new Date(date); - } - } - const days = myDate.getDay(); - return weekArray[days]; +export function getCurrentDate(date: any) { + let myDate = new Date(); + if (date) { + if (date instanceof Date) { + myDate = date; + } else { + date = date.replace(/-/g, '/'); + myDate = new Date(date); + } + } + + const days = myDate.getDay(); + return weekArray[days]; } /** @@ -78,17 +91,20 @@ export function getCurrentDate(date: any) { * @returns */ export function getDays(date: any, days: number) { - if (date) { - if (!(date instanceof Date)) { - date = date.replace(/-/g, '/'); - date = new Date(date); - } + if (date) { + let temp: any; + if (!(date instanceof Date)) { + date = date.replace(/-/g, '/'); + temp = new Date(date); + } else { + temp = new Date(date.getTime()); + } - const time = date.setDate(date.getDate() + days); // 天数 - return new Date(time); - } + const time = temp.setDate(temp.getDate() + days); + return new Date(time); + } } export function getEndOfMonth(year: number, month: number) { - return new Date(year, month, 0).getDate() + return new Date(year, month, 0).getDate() } \ No newline at end of file diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 400e49b..56283d7 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,66 +1,67 @@ diff --git a/src/views/home/record-form.vue b/src/views/home/record-form.vue index 60a963a..7a4f508 100644 --- a/src/views/home/record-form.vue +++ b/src/views/home/record-form.vue @@ -1,146 +1,147 @@ diff --git a/src/views/home/week-calendar.vue b/src/views/home/week-calendar.vue index 50bb104..3369b91 100644 --- a/src/views/home/week-calendar.vue +++ b/src/views/home/week-calendar.vue @@ -1,304 +1,332 @@ From 68902cc8f1afab7a09481fc5282b957662dd8ff0 Mon Sep 17 00:00:00 2001 From: zhaoyz <11@22.com> Date: Wed, 24 Apr 2024 14:09:29 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/daily-plan.ts | 48 +++++++++++++++++++- src/views/home/index.vue | 17 ++++++- src/views/home/record-form.vue | 64 ++++++++++++++++++-------- src/views/home/week-calendar.vue | 78 ++++++++++++++++---------------- 4 files changed, 147 insertions(+), 60 deletions(-) diff --git a/src/api/daily-plan.ts b/src/api/daily-plan.ts index c0a216d..ef5a23e 100644 --- a/src/api/daily-plan.ts +++ b/src/api/daily-plan.ts @@ -1,8 +1,12 @@ import request from "@/utils/request"; -const addDailyPlanUrl = "/admin/dailyPlan/addDailyPlan"; +const addDailyPlanUrl = "/admin/dailyPlan/saveOrUpdate"; +const getDailyPlanListUrl = "/admin/dailyPlan/getListByDate"; +const deleteByIdUrl = "/admin/dailyPlan/deleteById"; +const getPlanDateListUrl = "/admin/dailyPlan/getPlanDateList"; +const getTodoCountByDateUrl = "/admin/dailyPlan/getTodoCountByDate"; -export function addDailyPlan(param: any) { +export function saveOrUpdate(param: any) { return new Promise((resolve, reject) => { request.postForm(addDailyPlanUrl, param).then((res: any) => { resolve(res.data); @@ -10,4 +14,44 @@ export function addDailyPlan(param: any) { reject(err); }) }) +} + +export function getDailyPlanList(date: string) { + return new Promise((resolve, reject) => { + request.postForm(getDailyPlanListUrl, {date}).then((res: any) => { + resolve(res.data); + }).catch(err => { + reject(err); + }) + }) +} + +export function deleteById(id: string) { + return new Promise((resolve, reject) => { + request.postForm(deleteByIdUrl, {id}).then((res: any) => { + resolve(res.data); + }).catch(err => { + reject(err); + }) + }) +} + +export function getPlanDateList(startDate: string, endDate: string) { + return new Promise((resolve, reject) => { + request.postForm(getPlanDateListUrl, {startDate, endDate}).then((res: any) => { + resolve(res.data); + }).catch(err => { + reject(err); + }) + }) +} + +export function getTodoCountByDate(date: string) { + return new Promise((resolve, reject) => { + request.postForm(getTodoCountByDateUrl, {date}).then((res: any) => { + resolve(res.data); + }).catch(err => { + reject(err); + }) + }); } \ No newline at end of file diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 56283d7..befb5a5 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -59,7 +59,7 @@