From a99886eb9c73018235e2c373f3d82a2b0b2311d5 Mon Sep 17 00:00:00 2001
From: zhangchen <1652267879@qq.com>
Date: 星期二, 16 九月 2025 13:36:40 +0800
Subject: [PATCH] Merge branch 'ID1766-添加推送登录功能' into test
---
src/views/mobile/bedsideAuxiliaryScreen/components/EndDialysis/index.vue | 360 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 360 insertions(+), 0 deletions(-)
diff --git a/src/views/mobile/bedsideAuxiliaryScreen/components/EndDialysis/index.vue b/src/views/mobile/bedsideAuxiliaryScreen/components/EndDialysis/index.vue
new file mode 100644
index 0000000..a292564
--- /dev/null
+++ b/src/views/mobile/bedsideAuxiliaryScreen/components/EndDialysis/index.vue
@@ -0,0 +1,360 @@
+<template>
+ <div class="end-dialysis-container">
+ <el-dialog
+ v-model="show"
+ center
+ title="结束透析"
+ width="80%"
+ :show-close="false"
+ class="end-dialysis-dialog"
+ :destroy-on-close="true"
+ :close-on-click-modal="false"
+ >
+ <template #header>
+ <div class="end-dialysis-header">
+ <span class="header-title">结束透析</span>
+ <img
+ :src="closeImg"
+ class="header-close"
+ @click="handleCancel"
+ alt=""
+ />
+ </div>
+ </template>
+ <div class="end-dialysis-content" v-loading="loading">
+ <el-form :model="formData" size="large">
+ <el-row :gutter="10">
+ <el-col :span="24">
+ <el-form-item label="结束时间">
+ <el-row>
+ <el-col :span="8">
+ <el-date-picker
+ v-model="formData.endData"
+ :clearable="false"
+ type="date"
+ placeholder="选择日期"
+ format="YYYY/MM/DD"
+ value-format="YYYY-MM-DD"
+ style="width: 100%"
+ />
+ </el-col>
+ <el-col :span="8">
+ <el-time-select
+ :clearable="false"
+ v-model="formData.endTime"
+ start="00:00"
+ step="00:01"
+ end="23:59"
+ placeholder="选择时间"
+ style="width: 100%"
+ />
+ </el-col>
+ <el-col :span="3">
+ <el-button type="primary" @click="addTime(1)"
+ >时间+1</el-button
+ >
+ </el-col>
+ <el-col :span="3">
+ <el-button type="primary" @click="addTime(0.5)"
+ >时间+0.5</el-button
+ >
+ </el-col>
+ </el-row>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="10">
+ <el-col :span="8">
+ <el-form-item label="下机护士">
+ <el-select
+ style="width: 100%"
+ v-model="formData.endDownNurse"
+ placeholder="请选择"
+ >
+ <el-option
+ v-for="item in nurseOptions"
+ :key="item.code"
+ :label="item.userName"
+ :disabled="item.isValid === 0"
+ :value="item.code"
+ >
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="回血(ml/min)">
+ <el-input style="width: 100%" v-model="formData.endHuixue" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ </div>
+ <template #footer>
+ <div class="my-button cancel" @click="handleCancel">取消</div>
+ <div
+ class="my-button confirm"
+ :class="loading ? 'cancel' : ''"
+ @click="handleConfirm"
+ >
+ 确认
+ </div>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script lang="ts">
+import { computed, reactive, toRefs } from "vue";
+import closeImg from "@/img/close.png";
+import {
+ addDefaultEndRowApi,
+ updateEndRowApi,
+} from "@/api/patient_hemo_med_start/index";
+import type { RecordData } from "@/api/patient_hemo_med_start/types/index.type";
+import { useBedsideAuxiliaryScreenStore } from "@/store/bedsideAuxiliaryScreen";
+import dayjs from "dayjs";
+import { getUsersByRoleCodeApi } from "@/api/user/index";
+import { ElMessage } from "element-plus";
+
+interface FormData {
+ id: number;
+ recordCode: string;
+ endTime: string;
+ endDownNurse: string;
+ endDownNurseName: string;
+ lastTimeMonitorDataTime: string;
+ endHuixue: string;
+ endData: string;
+}
+
+interface State {
+ show: boolean;
+ loading: boolean;
+ formData: FormData;
+ nurseOptions: any[];
+ defaultEndTime: string;
+}
+export default {
+ name: "EndDialysis",
+ setup() {
+ const bedsideAuxiliaryScreenStore = useBedsideAuxiliaryScreenStore();
+
+ const state = reactive<State>({
+ show: false,
+ loading: false,
+ formData: {
+ id: 0,
+ recordCode: "",
+ endTime: "",
+ endDownNurse: "",
+ endDownNurseName: "",
+ lastTimeMonitorDataTime: "",
+ endHuixue: "",
+ endData: "",
+ },
+ nurseOptions: [],
+ defaultEndTime: "", // 默认的日期,原始数据,用于计算
+ });
+
+ const recordCode = computed(() => {
+ return bedsideAuxiliaryScreenStore.deviceData.underTreatment.透析单编号;
+ });
+
+ const clientCode = computed(() => {
+ return bedsideAuxiliaryScreenStore.deviceData.客户编号;
+ });
+
+ const userCode = computed(() => {
+ return bedsideAuxiliaryScreenStore.userInfo.userCode;
+ });
+
+ const openDialog = async () => {
+ state.loading = true;
+ state.show = true;
+ try {
+ const { data } = await addDefaultEndRowApi(
+ `recordCode=${recordCode.value}`
+ );
+
+ const dataCopy = JSON.parse(JSON.stringify(data));
+ const notLs = [null, ""];
+
+ if (notLs.includes(data.endDownNurse)) {
+ dataCopy.endDownNurse = userCode.value;
+ }
+
+ if (notLs.includes(data.endTime)) {
+ dataCopy.endTime = dayjs().format("HH:mm");
+ // @ts-ignore
+ dataCopy.endData = dayjs().format("YYYY-MM-DD");
+ state.defaultEndTime = dayjs().format("YYYY-MM-DD HH:mm");
+ } else {
+ dataCopy.endTime = dayjs(data.endTime).format("HH:mm");
+ // @ts-ignore
+ dataCopy.endData = dayjs(data.endTime).format("YYYY-MM-DD");
+ state.defaultEndTime = dayjs(data.endTime).format("YYYY-MM-DD HH:mm");
+ }
+ state.formData = dataCopy as unknown as FormData;
+ await getNurses();
+ } catch (error) {
+ setTimeout(() => {
+ state.show = false;
+ }, 1000);
+ } finally {
+ state.loading = false;
+ }
+ };
+
+ const handleCancel = () => {
+ state.show = false;
+ };
+
+ const handleConfirm = async () => {
+ if (state.loading) return false;
+ state.loading = true;
+ try {
+ const paramsData = Object.assign({}, state.formData, {
+ endTime: dayjs(
+ `${state.formData.endData} ${state.formData.endTime}`
+ ).format("YYYY-MM-DD HH:mm:ss"),
+ });
+ await updateEndRowApi(paramsData as unknown as RecordData);
+ ElMessage.success("操作成功!");
+ state.show = false;
+ } finally {
+ state.loading = false;
+ }
+ };
+
+ const addTime = (hourNum: number) => {
+ if (["", null].includes(state.formData.lastTimeMonitorDataTime))
+ return false;
+ const addDate = addHours(
+ state.formData.lastTimeMonitorDataTime + "",
+ hourNum
+ );
+ state.formData.endData = dayjs(addDate).format("YYYY-MM-DD");
+ state.formData.endTime = dayjs(addDate).format("HH:mm");
+ };
+
+ const addHours = (dateStr: string, hours: number): string => {
+ return dayjs(dateStr).add(hours, "hour").format("YYYY-MM-DD HH:mm:ss");
+ };
+
+ /**
+ * 获取护士数据
+ */
+ const getNurses = async () => {
+ const { data } = await getUsersByRoleCodeApi(
+ `clientCode=${clientCode.value}&roleClass=nurse`
+ );
+ state.nurseOptions = data;
+ };
+
+ return {
+ ...toRefs(state),
+ closeImg,
+ handleCancel,
+ handleConfirm,
+ openDialog,
+ addTime,
+ };
+ },
+};
+</script>
+
+<style lang="less" scoped>
+.end-dialysis-container {
+ ::v-deep(.el-dialog) {
+ padding: 0;
+ border-radius: 6px;
+ overflow: hidden;
+ }
+ ::v-deep(.el-dialog__footer) {
+ padding: 4px;
+ }
+ ::v-deep(.el-upload-dragger) {
+ height: 65px;
+ padding: 0 !important;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ ::v-deep(.el-upload-dragger .el-icon--upload) {
+ display: none;
+ }
+ ::v-deep(.el-dialog__header) {
+ padding-bottom: 6px;
+ }
+ .end-dialysis-header {
+ position: relative;
+ height: 16px;
+ background: #769aff;
+ .header-title {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translateX(-50%) translateY(-50%);
+ font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
+ font-weight: 500;
+ font-size: 8px;
+ color: #ffffff;
+ line-height: 11px;
+ text-align: center;
+ }
+ .header-close {
+ position: absolute;
+ top: 50%;
+ transform: translateY(-50%);
+ right: 6px;
+ width: 15px;
+ height: 15px;
+ transition: transform 0.2s;
+
+ &:active {
+ opacity: 0.6;
+ transform: translateY(-50%) scale(0.95);
+ }
+ }
+ }
+ .end-dialysis-content {
+ padding: 0 12px 0px 12px;
+ margin-bottom: 4px;
+ border-bottom: 1px solid #d8d8d8;
+ }
+ .my-button {
+ display: inline-block;
+ border-radius: 2px;
+ padding: 0px 10px;
+ font-family: PingFangSC, PingFang SC;
+ font-weight: 500;
+ font-size: 7px;
+ color: #ffffff;
+ line-height: 16px;
+ letter-spacing: 1px;
+ text-align: center;
+ font-style: normal;
+ transition: transform 0.1s ease, opacity 0.1s ease;
+ cursor: pointer;
+ &:active {
+ transform: scale(0.95);
+ opacity: 0.8;
+ }
+
+ &:not(:first-child) {
+ margin-left: 6px;
+ }
+
+ &.confirm {
+ background: #769aff;
+ }
+ &.cancel {
+ background: #bbc6dd;
+ }
+ &.refresh {
+ background: #e6a23c;
+ }
+ }
+}
+</style>
\ No newline at end of file
--
Gitblit v1.8.0