From 3a56a133d4e06a75632ffd171ce5b125c9d51b72 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 24 九月 2024 14:37:32 +0800
Subject: [PATCH] 装机&放弃 逻辑新增state
---
src/views/ecg/doctor/components/DevInstallPanel.vue | 85 +++++++++++++++++++++++++++++++++++++-----
1 files changed, 74 insertions(+), 11 deletions(-)
diff --git a/src/views/ecg/doctor/components/DevInstallPanel.vue b/src/views/ecg/doctor/components/DevInstallPanel.vue
index 031373b..7361809 100644
--- a/src/views/ecg/doctor/components/DevInstallPanel.vue
+++ b/src/views/ecg/doctor/components/DevInstallPanel.vue
@@ -8,7 +8,10 @@
v-loading="formLoading"
>
<el-form-item label="璁惧缂栧彿" prop="devId">
- <el-input v-model="formData.devId" placeholder="璇疯緭鍏ヨ澶囩紪鍙�" />
+ <el-input v-model="formData.devId" placeholder="璇疯緭鍏ヨ澶囩紪鍙�" @input="getDevInfo"/>
+ </el-form-item>
+ <el-form-item label="璁惧鎻忚堪" prop="">
+ {{deviceInfo.brand + " " + deviceInfo.model}}
</el-form-item>
<el-form-item label="瑁呮満鏃堕棿" prop="rentTime">
<el-date-picker
@@ -23,13 +26,21 @@
</el-form-item>
</el-form>
<el-button @click="submitForm" type="primary" :disabled="formLoading">瑁呮満瀹屾垚</el-button>
- <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+ <el-button @click="resetForm()">閲� 缃�</el-button>
+ <el-button @click="printBill()">鎵撳嵃灏忕エ</el-button>
+ <el-button @click="cancelInstall" :disabled="formLoading">鏀惧純瑁呮満</el-button>
- <!-- 鍖荤敓鎷嗘満鍒楄〃 -->
+ <!-- 鍖荤敓瑁呮満鍒楄〃 -->
<ContentWrap>
- <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" @current-change="onCurChange" >
+ <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" @row-click="onRowClick" >
<el-table-column label="id" align="center" prop="id" />
+ <el-table-column label="瑁呮満鎯呭喌" align="center" prop="cancelled" >
+ <template #default="scope">
+ <span v-if="scope.row.jobType === 10">"宸茶鏈�"</span>
+ <span v-if="scope.row.jobType === 30">"宸叉斁寮�"</span>
+ </template>
+ </el-table-column>
<!-- <el-table-column label="浣滀笟绫诲瀷" align="center" prop="jobType" />-->
<!-- <el-table-column label="鍖荤敓缂栧彿" align="center" prop="docId" />-->
<el-table-column label="鍖荤敓鍚嶇О" align="center" width="auto" prop="docName" />
@@ -40,7 +51,8 @@
label="浣滀笟鏃堕棿"
align="center"
prop="jobTime"
- :formatter="timeFormatter"
+ :formatter="dateFormatter"
+ width="180px"
/>
<!-- <el-table-column label="浣滀笟姒傝" align="center" prop="summary" />-->
<el-table-column label="澶囨敞" align="center" prop="remark" />
@@ -52,6 +64,7 @@
:formatter="dateFormatter"
/>
-->
+<!--
<el-table-column label="鎿嶄綔" align="center" min-width="120px">
<template #default="scope">
<el-button
@@ -72,6 +85,7 @@
</el-button>
</template>
</el-table-column>
+-->
</el-table>
<!-- 鍒嗛〉 -->
<Pagination
@@ -91,6 +105,7 @@
import {isStringEmpty} from "@/utils/stringUtil";
import {dateFormatter, timeFormatter} from "@/utils/formatTime";
import {JobRecordApi, JobRecordVO} from "@/api/ecg/jobrecord";
+import {DeviceApi, DeviceVO} from "@/api/ecg/devmanage";
/** 瑁呮満鎷嗘満 琛ㄥ崟 */
defineComponent({ name: 'DevInstallPanel' })
@@ -113,8 +128,8 @@
const formData = ref({
id: undefined,
devId: undefined,
- patId: patient.value.patId,
- patName: patient.value.patName,
+ patId: patient.value?.patId,
+ patName: patient.value?.patName,
rentTime: new Date().getTime(),
returnTime: undefined,
interference: undefined,
@@ -129,6 +144,16 @@
patName: [{ required: true, message: '鐩墠娌℃湁鎮h��', trigger: 'blur' }]
})
const formRef = ref() // 琛ㄥ崟 Ref
+
+const deviceInfo = ref<DeviceVO> ({
+ id: 0,
+ devId: '',
+ category: '',
+ brand: '',
+ model: '',
+ purchaseDate: 0,
+ lost: 0,
+})
/** 鎻愪氦琛ㄥ崟 */
const submitForm = async () => {
@@ -156,13 +181,29 @@
}
}
+const cancelInstall = async () => {
+ const data = formData.value as unknown as DevRentVO
+ if (formData.value.id === null || formData.value.id === undefined) {
+ const result = await DevRentApi.devCancel(data)
+ formData.value.id = result
+ message.success(t('鎿嶄綔鎴愬姛'))
+ } else {
+ await DevRentApi.devCancel(data)
+ message.success(t('鎿嶄綔鎴愬姛'))
+ }
+ // 鍙戦�佹搷浣滄垚鍔熺殑浜嬩欢
+ emit('success')
+ resetForm()
+ getList()
+}
+
/** 閲嶇疆琛ㄥ崟 */
const resetForm = () => {
formData.value = {
id: undefined,
devId: undefined,
- patId: patient.value.patId,
- patName: patient.value.patName,
+ patId: patient.value?.patId,
+ patName: patient.value?.patName,
rentTime: new Date().getTime(),
returnTime: undefined,
interference: undefined,
@@ -186,7 +227,7 @@
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
- jobType: 0,
+ jobType: [10, 30],
docId: undefined,
docName: undefined,
devId: undefined,
@@ -197,6 +238,7 @@
remark: undefined,
createTime: []
})
+
/** 鏌ヨ鍒楄〃 */
const getList = async () => {
loading.value = true
@@ -209,7 +251,7 @@
}
}
-const onCurChange = (cur) => {
+const onRowClick = (cur) => {
if (cur !== null)
getSelectedRent( cur.rentId )
}
@@ -218,6 +260,27 @@
formData.value = await DevRentApi.getDevRent(rentId)
}
+const printBill = async () => {
+ ElNotification({
+ title: '娓╅Θ鎻愮ず',
+ message: '寰呭疄鐜帮紒',
+ type: 'warning'
+ })
+}
+
+const getDevInfo = async () => {
+ deviceInfo.value.category = ''
+ deviceInfo.value.brand = ''
+ deviceInfo.value.model = ''
+ if (isStringEmpty(formData.value.devId))
+ return
+
+ const data = await DeviceApi.getDeviceByDevId(formData.value.devId!)
+ console.info( data )
+ if ( null !== data)
+ deviceInfo.value = data
+}
+
/** 鍒濆鍖� **/
onMounted(() => {
getList()
--
Gitblit v1.9.3