Browse Source

feat: 平车详情弹窗

main
wally 2 years ago
parent
commit
2235539dac
  1. 68
      components/CarInfo/CarInfo.vue
  2. 10
      config/service.ts
  3. 34
      pages/patient-list/patient-list.vue
  4. BIN
      static/images/angle.png
  5. BIN
      static/images/power.png
  6. BIN
      static/images/vibrate.png
  7. BIN
      static/images/weight.png

68
components/CarInfo/CarInfo.vue

@ -0,0 +1,68 @@
<template>
<uni-card :is-shadow="false" :border="false" style="width: 40vw" padding="10px">
<template v-slot:title>
<view class="text-center u-font-16 font-bold uni-mt-10 uni-mb-4">{{ currentCar?.carNo }}</view>
<view class="text-center u-font-13">{{ CAR_STATUS[currentCar!.online] }}</view>
</template>
<view class="list flex">
<view class="item flex-1">
<image class="item-icon" src="@/static/images/angle.png" mode="scaleToFill" />
<text>{{ currentCar?.sensorAngleV || '-' }}</text>
</view>
<view class="item">
<image class="item-icon" src="@/static/images/vibrate.png" mode="scaleToFill" />
<text>{{ currentCar?.sensorVibrate || '-' }}</text>
</view>
<view class="item">
<image class="item-icon" src="@/static/images/weight.png" mode="scaleToFill" />
<text>{{ currentCar?.sensorWeight || '-' }}</text>
</view>
<view class="item">
<image class="item-icon" src="@/static/images/power.png" mode="scaleToFill" />
<text>{{ currentCar?.sensorPower + '%' || '-' }}</text>
</view>
</view>
<template v-slot:actions>
<view class="flex justify-between uni-mb-16">
<u-button size="medium" type="primary" shape="circle" class="bg-main" @click="onCancel">关闭</u-button>
</view>
</template>
</uni-card>
</template>
<script lang="ts" setup>
import { useServiceStore } from '@/store/modules/service';
import { computed } from 'vue';
import { CAR_STATUS } from '@/config/service'
const emits = defineEmits(['on-cancel'])
const service = useServiceStore()
const currentCar = computed(() => service.currentCar)
// cancel
function onCancel() { emits('on-cancel') }
</script>
<style lang="scss" scoped>
.item {
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
padding: 1em;
background-color: #f6f6f9;
margin: 1em 0.5em;
border-radius: 8px;
.item-icon {
width: 2em;
height: 2em;
margin-bottom: 0.5em;
}
}
</style>

10
config/service.ts

@ -15,9 +15,7 @@ export function GET_GENDER_TEXT_BY_CODE(code: number): string | undefined {
} }
// 急救状态 // 急救状态
export const AID_STATUS = { export const AID_STATUS = { 0: '创建', 1: '待审核', 2: '审核通过', 3: '审核拒绝' }
0: '创建',
1: '待审核', // 平车状态
2: '审核通过', export const CAR_STATUS = { 0: '离线', 1: '在线' }
3: '审核拒绝',
}

34
pages/patient-list/patient-list.vue

@ -34,8 +34,15 @@
</uni-grid-item> </uni-grid-item>
</uni-grid> </uni-grid>
<image class="create-user" src="@/static/images/bed.png" mode="scaleToFill" /> <!-- 🛏 -->
<image class="create-user" src="@/static/images/bed.png" mode="scaleToFill" @click="openCarInfo" />
</view> </view>
<!-- 平车详情弹窗 -->
<uni-popup ref="popupRef" background-color="transparent" style="z-index: 9999;">
<CarInfo @on-cancel="popupRef.close()" />
</uni-popup>
</view> </view>
</template> </template>
@ -50,6 +57,7 @@ import { onReachBottom } from '@dcloudio/uni-app'
const serviceStore = useServiceStore() const serviceStore = useServiceStore()
const { pagination, updatePagination, resetPagination } = usePagination() const { pagination, updatePagination, resetPagination } = usePagination()
const popupRef = ref()
const data = ref<IPatient[]>([]) const data = ref<IPatient[]>([])
const keywords = ref('') const keywords = ref('')
const searchHeight = ref(100) const searchHeight = ref(100)
@ -57,9 +65,18 @@ const searchHeight = ref(100)
const currentAidId = computed(() => serviceStore.currentPatient?.firstAidId) const currentAidId = computed(() => serviceStore.currentPatient?.firstAidId)
function onClickItem(event) { function onClickItem(event) {
const item = data[event.detail.index] console.log(event.detail);
serviceStore.setCurrentPatient(item) const { index } = event.detail
if (index === 0) {
//
uni.$u.openPage('detail2') uni.$u.openPage('detail2')
} else {
//
const item = data.value[index - 1]
serviceStore.setCurrentPatient(item)
uni.$u.openPage('detail1')
}
} }
function onSearch(searchValue: string) { function onSearch(searchValue: string) {
@ -78,14 +95,23 @@ async function getAidList() {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
}
//
function openCarInfo() {
popupRef.value.open()
} }
// search
function onSearchLoad(height: number) { function onSearchLoad(height: number) {
searchHeight.value = height searchHeight.value = height
} }
//
onSearch('') onSearch('')
//
onReachBottom(() => { onReachBottom(() => {
console.log('reach bottom', pagination); console.log('reach bottom', pagination);
if (pagination.nextPage === 0) { if (pagination.nextPage === 0) {

BIN
static/images/angle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

BIN
static/images/power.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

BIN
static/images/vibrate.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

BIN
static/images/weight.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Loading…
Cancel
Save