generated from ccsens_fe/uni-vue3-template
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.2 KiB
60 lines
2.2 KiB
<template>
|
|
<view>
|
|
<uni-easyinput :value="value" type="text" placeholder="请输入" @change="$emit('on-change', $event)" @confirm="$emit('on-change', $event)"
|
|
v-if="config.type === 'input'" />
|
|
|
|
<uni-datetime-picker type="datetime" :value="value" :modelValue="value" @change="$emit('on-change', $event)"
|
|
v-else-if="config.type === 'datetime'" />
|
|
|
|
<uni-data-checkbox :value="value" :localdata="config.range" @change="$emit('on-change', $event.detail.value)"
|
|
v-else-if="config.type === 'radio'" />
|
|
|
|
|
|
<uni-data-checkbox :value="value" :multiple="true" :localdata="config.range" @change="$emit('on-change', $event.detail.value)"
|
|
v-else-if="config.type === 'checkbox'" />
|
|
|
|
<uni-data-select :value="value" :modelValue="value" :localdata="config.range" @change="$emit('on-change', $event)"
|
|
v-else-if="config.type === 'select'"></uni-data-select>
|
|
|
|
<view v-else-if="config.type === 'text'" class="flex-1 flex justify-end uni-secondary-color u-font-sm" style="height: 35px;"
|
|
@click="$emit('on-click', config.text)">
|
|
{{ value }}
|
|
<uni-icons type="forward" v-if="config.rightArrow" size="16" />
|
|
</view>
|
|
|
|
<!-- 跳页面的 -->
|
|
<view v-else-if="config.type === 'page'" class="flex-1 flex justify-end uni-secondary-color u-font-sm" style="height: 35px;"
|
|
@click="onOpenPage">
|
|
<text class="u-m-r-20">{{ value || config.rightText }}</text>
|
|
<uni-icons type="forward" v-if="config.rightArrow" size="16" />
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { CODE_DICT } from '@/config/code'
|
|
import type { IConfig } from '@/config/code'
|
|
import { computed, inject } from 'vue'
|
|
import type { Ref } from 'vue'
|
|
|
|
interface IProps {
|
|
code: string
|
|
value: string | Array<string>
|
|
}
|
|
|
|
const firstAidId = inject<Ref<string>>('firstAidId')
|
|
const props = defineProps<IProps>()
|
|
defineEmits(['on-change'])
|
|
|
|
const config = computed<IConfig>(() => CODE_DICT[props.code])
|
|
|
|
// mrs nihss 等打开页面
|
|
// 并把code传过去
|
|
function onOpenPage() {
|
|
const name = CODE_DICT[props.code].page?.name
|
|
uni.$u.openPage(name, true, `code=${props.code}&firstAidId=${firstAidId?.value}`)
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
</style>
|
|
|