9 changed files with 1644 additions and 220 deletions
@ -0,0 +1,985 @@ |
|||||
|
<template> |
||||
|
<div class="test"> |
||||
|
<div bordered class="list-box" v-for="(item, index) in test" :key="index"> |
||||
|
<template v-for="(listItem, listIndex) in item"> |
||||
|
<template v-if="listItem.code === 'ZQTH-SJ'"> |
||||
|
<Talk :key="listIndex" @changeHeigt="changeHeigt" /> |
||||
|
</template> |
||||
|
<template v-else> |
||||
|
<div |
||||
|
class="bg-white list-item" |
||||
|
:key="listIndex" |
||||
|
v-if=" |
||||
|
itemIsShow(listItem.Fcode, listItem.isShow, listItem.level) && itemNoShow(listItem.NFcode, listItem.noShow, listItem.level) |
||||
|
" |
||||
|
> |
||||
|
<div class="w-full flex flex-nowrap justify-between items-center"> |
||||
|
<div class="flex items-center" v-if="listItem.title" style="font-size: 16px"> |
||||
|
<!-- {{ listItem.title }} |
||||
|
<span v-if="listItem.isTrue" style="color: red; font-size: 20px">*</span> --> |
||||
|
<div class="flex items-center" v-if="listItem.type !== -1"> |
||||
|
<view class="putong-title">{{ listItem.title }}</view> |
||||
|
<span v-if="listItem.isTrue" style="color: red; font-size: 20px">*</span> |
||||
|
</div> |
||||
|
<div class="flex items-center" v-else> |
||||
|
<view class="shu"></view> |
||||
|
<view class="shu-title">{{ listItem.title }}</view> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="flex flex-1 justify-end" :style="{marginLeft: listItem.title ? '' : '24rpx'}"> |
||||
|
<!-- 自动计算 --> |
||||
|
<span v-if="listItem.type === 0" style="color: rgba(0, 0, 0, 0.45)"> |
||||
|
{{ listItem.code === 'JBXX-BMI' ? getBMI : getCount }} |
||||
|
</span> |
||||
|
<!-- 输入框 --> |
||||
|
<template v-else-if="listItem.type === 1"> |
||||
|
<u-input |
||||
|
:border="true" |
||||
|
:clearable="false" |
||||
|
style="width: 200rpx" |
||||
|
placeholder="请输入" |
||||
|
input-align="right" |
||||
|
:value="listItem.value" |
||||
|
@blur="changeIpt($event, listItem.code, index, listIndex)" |
||||
|
/> |
||||
|
</template> |
||||
|
<!-- 单选 --> |
||||
|
<u-radio-group :value="listItem.value" v-else-if="listItem.type === 2" style="margin-right: -24rpx"> |
||||
|
<u-radio |
||||
|
@change="changeRadio($event, listItem.code, index, listIndex)" |
||||
|
v-for="radioValue in listItem.itemList" |
||||
|
:key="radioValue" |
||||
|
:name="radioValue" |
||||
|
> |
||||
|
<span :style="{ color: listItem.value === radioValue ? '#1890ff' : '' }">{{ radioValue }}</span> |
||||
|
</u-radio> |
||||
|
</u-radio-group> |
||||
|
<!-- 单选(竖向排列) --> |
||||
|
<u-radio-group :value="listItem.value" v-else-if="listItem.type === 21" class="flex flex-col w-full"> |
||||
|
<div v-for="radioValue in listItem.itemList" :key="radioValue" style="width: 105%"> |
||||
|
<view class="flex justify-between"> |
||||
|
<view class="flex-1"> |
||||
|
<span :style="{ color: listItem.value === radioValue ? '#1890ff' : '' }">{{ radioValue }}</span> |
||||
|
</view> |
||||
|
<u-radio |
||||
|
style="display: block;margin-left: 0; height: 40px; line-height: 40px" |
||||
|
:name="radioValue" |
||||
|
:key="radioValue" |
||||
|
@change="changeRadio($event, listItem.code, index, listIndex)" |
||||
|
> |
||||
|
</u-radio> |
||||
|
</view> |
||||
|
<div |
||||
|
v-if=" |
||||
|
listItem.code === 'ZLFA-FBJZ' && |
||||
|
listItem.value === '其他原因所致的缺血性卒中(SOE)' && |
||||
|
radioValue === '其他原因所致的缺血性卒中(SOE)' |
||||
|
" |
||||
|
class="flex ml-2 mb-2 items-center" |
||||
|
> |
||||
|
<div>是否烟雾病:</div> |
||||
|
<u-radio-group :value="listItem.ywbValue"> |
||||
|
<u-radio @change="changeYWBRadio($event, listItem.ywbCode, index, listIndex)" name="是"> 是 </u-radio> |
||||
|
<u-radio @change="changeYWBRadio($event, listItem.ywbCode, index, listIndex)" name="否"> 否 </u-radio> |
||||
|
</u-radio-group> |
||||
|
</div> |
||||
|
</div> |
||||
|
</u-radio-group> |
||||
|
<!-- 单选(横向三列) --> |
||||
|
<u-radio-group :value="listItem.value" v-else-if="listItem.type === 22" class="flex w-full"> |
||||
|
<div |
||||
|
v-for="(radioValue, radioIndex) in listItem.itemList" |
||||
|
:key="radioValue" |
||||
|
style="width: 105%" |
||||
|
class="flex" |
||||
|
:class="{ |
||||
|
'text-left': radioIndex % 3 === 0, |
||||
|
'text-center': (radioIndex - 1) % 3 === 0, |
||||
|
'text-right': (radioIndex + 1) % 3 === 0, |
||||
|
'flex-wrap': radioIndex > 3, |
||||
|
'flex-nowrap': radioIndex <= 3, |
||||
|
}" |
||||
|
> |
||||
|
<view class="flex-1" :style="{ color: listItem.value === radioValue ? '#1890ff' : '' }">{{ radioValue }}</view> |
||||
|
<u-radio |
||||
|
@change="changeRadio($event, listItem.code, index, listIndex)" |
||||
|
style="margin-left: 0; height: 40px; line-height: 40px" |
||||
|
:name="radioValue" |
||||
|
> |
||||
|
</u-radio> |
||||
|
</div> |
||||
|
</u-radio-group> |
||||
|
<!-- 单选(带分数输入框) --> |
||||
|
<u-radio-group :value="listItem.value" v-else-if="listItem.type === 23" class="flex flex-col flex-wrap w-full"> |
||||
|
<template v-if="listItem.code !== 'JRZL-SQ-ASPECT'"> |
||||
|
<div |
||||
|
v-for="(radioValue, radioIndex) in listItem.listItem" |
||||
|
:key="radioIndex" |
||||
|
class="flex flex-1 items-center" |
||||
|
style="height: 44px" |
||||
|
> |
||||
|
<u-radio |
||||
|
style="margin-left: 0; height: 40px; line-height: 40px" |
||||
|
:style="{ color: listItem.value === radioValue ? '#1890ff' : '' }" |
||||
|
:value="radioValue.type" |
||||
|
@change="changeRadio($event, listItem.code, index, listIndex)" |
||||
|
> |
||||
|
{{ radioValue.name }} |
||||
|
</u-radio> |
||||
|
<div v-if="radioValue.showIpt"> |
||||
|
<u-input |
||||
|
:border="true" |
||||
|
:clearable="false" |
||||
|
:value="radioValue.value" |
||||
|
placeholder="请输入" |
||||
|
style="width: 100rpx !important" |
||||
|
@click="iptChangeRadio('score', listItem.code, index, listIndex)" |
||||
|
@blur="changeScroeNum($event, radioValue.min, radioValue.max, radioValue.code, index, listIndex, radioIndex)" |
||||
|
/>分 |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
<div v-else style="flex flex-nowrap items-center"> |
||||
|
<div style="height: 44px;line-height: 44px"> |
||||
|
<u-radio |
||||
|
style="margin-left: 0" |
||||
|
:style="{ color: listItem.value === 'score' ? '#1890ff' : '' }" |
||||
|
name="score" |
||||
|
@change="changeRadio('score', listItem.code, index, listIndex)" |
||||
|
> |
||||
|
<div class="flex items-center" :style="{ color: listItem.value === 'score' ? '#1890ff' : '' }"> |
||||
|
CT<u-input |
||||
|
:border="true" |
||||
|
:clearable="false" |
||||
|
:value="listItem.listItem[0].value" |
||||
|
placeholder="请输入" |
||||
|
style="width: 100rpx !important" |
||||
|
@click="iptChangeRadio('score', listItem.code, index, listIndex)" |
||||
|
@blur=" |
||||
|
changeScroeNum( |
||||
|
$event, |
||||
|
listItem.listItem[0].min, |
||||
|
listItem.listItem[0].max, |
||||
|
listItem.listItem[0].code, |
||||
|
index, |
||||
|
listIndex, |
||||
|
0, |
||||
|
) |
||||
|
" |
||||
|
/>分,MRI<u-input |
||||
|
:border="true" |
||||
|
:clearable="false" |
||||
|
:value="listItem.listItem[1].value" |
||||
|
placeholder="请输入" |
||||
|
style="width: 100rpx !important" |
||||
|
@click="iptChangeRadio('score', listItem.code, index, listIndex)" |
||||
|
@blur=" |
||||
|
changeScroeNum( |
||||
|
$event, |
||||
|
listItem.listItem[1].min, |
||||
|
listItem.listItem[1].max, |
||||
|
listItem.listItem[1].code, |
||||
|
index, |
||||
|
listIndex, |
||||
|
1, |
||||
|
) |
||||
|
" |
||||
|
/>分 |
||||
|
</div> |
||||
|
</u-radio> |
||||
|
</div> |
||||
|
<u-radio |
||||
|
style="margin-left: 0; height: 40px; line-height: 40px" |
||||
|
name="noScore" |
||||
|
@change="changeRadio('noScore', listItem.code, index, listIndex)" |
||||
|
> |
||||
|
<span :style="{ color: listItem.value === 'noScore' ? '#1890ff' : '' }">未评</span> |
||||
|
</u-radio> |
||||
|
</div> |
||||
|
</u-radio-group> |
||||
|
<!-- 单选(竖向排列带分数输入框) --> |
||||
|
<u-radio-group :value="listItem.value" v-else-if="listItem.type === 24" class="flex flex-col w-full"> |
||||
|
<div class="flex items-center justify-between" style="width: 105%" v-for="(radioValue, radioIndex) in listItem.itemList" :key="radioIndex"> |
||||
|
<view class="flex items-center flex-1" style="height: 78rpx;line-height: 78rpx"> |
||||
|
<view>{{ radioValue.name }}</view> |
||||
|
<div v-if="radioValue.showIpt" class="flex items-center ml-1 mr-1"> |
||||
|
<!-- :disabled="listItem.value !== radioValue.name" --> |
||||
|
<u-input |
||||
|
:clearable="false" |
||||
|
:value="radioValue.value" |
||||
|
:type="radioValue.unit ? 'number' : 'text'" |
||||
|
:placeholder="radioValue.min && radioValue.max ? `请输入${radioValue.min}-${radioValue.max}` : '请输入'" |
||||
|
style="width: 300rpx !important" |
||||
|
:custom-style="{fontSize: '28rpx'}" |
||||
|
@click="iptChangeRadio(radioValue.name, listItem.code, index, listIndex)" |
||||
|
@blur=" |
||||
|
changeRadioScore( |
||||
|
$event, |
||||
|
radioValue.code, |
||||
|
index, |
||||
|
listIndex, |
||||
|
radioIndex, |
||||
|
radioValue.unit, |
||||
|
radioValue.min, |
||||
|
radioValue.max, |
||||
|
) |
||||
|
" |
||||
|
/> |
||||
|
<span>{{ radioValue.unit }}</span> |
||||
|
</div> |
||||
|
</view> |
||||
|
<u-radio |
||||
|
class="flex items-center" |
||||
|
label-size="28" |
||||
|
:style="{ color: listItem.value === radioValue ? '#1890ff' : '' }" |
||||
|
:name="radioValue.name" |
||||
|
@change="changeRadio($event, listItem.code, index, listIndex)" |
||||
|
> |
||||
|
</u-radio> |
||||
|
</div> |
||||
|
</u-radio-group> |
||||
|
<!-- 多选 --> |
||||
|
<u-checkbox-group |
||||
|
v-else-if="listItem.type === 3" |
||||
|
@change="changeCheck($event, listItem.code, index, listIndex, false, listItem.showOther)" |
||||
|
:class="{ 'justify-between': listItem.checkType - 0 === 4 }" |
||||
|
class="w-full flex flex-row flex-wrap" |
||||
|
> |
||||
|
<div |
||||
|
v-for="(check, checkIndex) in listItem.itemIsChecked" |
||||
|
:key="checkIndex" |
||||
|
:style="{ minWidth: listItem.checkType - 0 === 3 ? '33%' : listItem.checkType - 0 === 2 ? '50%' : 0 }" |
||||
|
class="w-full my-2 flex flex-1 flex-col items-start justify-center" |
||||
|
> |
||||
|
<view class="flex"> |
||||
|
<view :style="{ color: check.isChecked ? '#1890ff' : '' }" style="width: 628rpx"> |
||||
|
{{ listItem.itemList[checkIndex] }} |
||||
|
</view> |
||||
|
<u-checkbox v-model="check.isChecked" :name="listItem.itemList[checkIndex]"> |
||||
|
</u-checkbox> |
||||
|
</view> |
||||
|
<u-input |
||||
|
:border="true" |
||||
|
:clearable="false" |
||||
|
:value="listItem.iptValue" |
||||
|
v-if="listItem.showIpt && listItem.showIptItem === listItem.itemList[checkIndex]" |
||||
|
@blur="changeOther($event, listItem.iptCode, index, listIndex)" |
||||
|
placeholder="请输入" |
||||
|
style="width: 200rpx" |
||||
|
/> |
||||
|
</div> |
||||
|
</u-checkbox-group> |
||||
|
<!-- 多选特殊类型 --> |
||||
|
<div v-else-if="listItem.type === 31" class="w-full"> |
||||
|
<div v-for="(checkTest, checkIndex) in listItem.checkList" :key="checkTest.title"> |
||||
|
<div>{{ checkTest.title }}</div> |
||||
|
<u-checkbox-group |
||||
|
:class="{ 'justify-between': listItem.checkType - 0 === 4 }" |
||||
|
class="w-full flex flex-row flex-wrap" |
||||
|
@change="changeCheck($event, checkTest.code, index, listIndex, checkIndex)" |
||||
|
> |
||||
|
<div |
||||
|
style="min-width: 33%" |
||||
|
class="my-2 flex items-center" |
||||
|
v-for="(check, isCheckIndex) in checkTest.itemIsChecked" |
||||
|
:key="check" |
||||
|
> |
||||
|
<u-checkbox v-model="check.isChecked" :name="checkTest.itemList[isCheckIndex]"> |
||||
|
<!-- itemIsChecked,itemList --> |
||||
|
<span :style="{ color: check.isChecked ? '#1890ff' : '' }"> |
||||
|
{{ check }} |
||||
|
</span> |
||||
|
</u-checkbox> |
||||
|
<u-input |
||||
|
:border="true" |
||||
|
:clearable="false" |
||||
|
@bulr="changeCheckIpt($event, checkTest.iptCode, index, listIndex, checkIndex)" |
||||
|
:value="checkTest.iptValue" |
||||
|
placeholder="请输入" |
||||
|
style="width: 200rpx" |
||||
|
v-if="checkTest.showIpt && checkTest.showValue === checkTest.itemList[isCheckIndex]" |
||||
|
/> |
||||
|
</div> |
||||
|
</u-checkbox-group> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!-- 时间选择 --> |
||||
|
<div |
||||
|
v-else-if="listItem.type === 4" |
||||
|
@click="openTimeSelect(listItem.title, listItem.code, index, listIndex, listItem.value)" |
||||
|
class="flex items-center" |
||||
|
> |
||||
|
<span class="mr-3" v-if="listItem.value"> |
||||
|
{{ $moment(+listItem.value).format('YYYY-MM-DD HH:mm') }} |
||||
|
</span> |
||||
|
<span class="mr-3 gray-text" v-else>请选择时间</span> |
||||
|
<!-- <img src="@/static/icon/time.png" style="height: 20px" /> --> |
||||
|
<u-icon name="arrow-right" color="#70798C" size="28"></u-icon> |
||||
|
</div> |
||||
|
<!-- 展开底部下拉框 --> |
||||
|
<div |
||||
|
v-else-if="listItem.type === 5" |
||||
|
style="min-width: 160px; width: auto; justify-content: flex-end; height: 30px" |
||||
|
class="flex items-center" |
||||
|
@click="openDropDown(listItem.title, listItem.itemList, listItem.code, index, listIndex, listItem.value)" |
||||
|
> |
||||
|
<span style="margin-right: 10px;color: #bbb" v-if="listItem.value">{{ listItem.value }}</span> |
||||
|
<span style="margin-right: 10px;color: #bbb" v-else>请选择</span> |
||||
|
<!-- <img src="@/static/icon/right.png" style="height: 20px" /> --> |
||||
|
<u-icon name="arrow-right" color="#70798C" size="28"></u-icon> |
||||
|
</div> |
||||
|
<!-- 带有最大最小值限制的输入框 --> |
||||
|
<div v-else-if="listItem.type === 7" class="flex items-center"> |
||||
|
<div v-if="numIndex === index && numItemIndex === listIndex" class="mr-1 font-12 text-red"> |
||||
|
<span v-if="exceed === 'max'"> 超过最大值{{ listItem.max }} </span> |
||||
|
<span v-else-if="exceed === 'min'"> 超过最小值{{ listItem.min }} </span> |
||||
|
</div> |
||||
|
<span v-if="listItem.beforeUnit">{{ listItem.beforeUnit }}</span> |
||||
|
<u-input |
||||
|
input-align="right" |
||||
|
:clearable="false" |
||||
|
type="number" |
||||
|
:value="listItem.value" |
||||
|
placeholder="请输入" |
||||
|
style="width: 200rpx" |
||||
|
@change="changeNum($event, listItem.min, listItem.max, listItem.code, index, listIndex)" |
||||
|
@blur="inputNumBlur($event, listItem.code, listItem.min, listItem.max, index, listIndex)" |
||||
|
/> |
||||
|
<span v-if="listItem.unit">{{ listItem.unit }}</span> |
||||
|
</div> |
||||
|
<!-- 带已评输入框的单选 --> |
||||
|
<u-radio-group |
||||
|
:class="{ 'w-full': !listItem.title }" |
||||
|
v-else-if="listItem.type === 71" |
||||
|
:value="listItem.value" |
||||
|
class="flex-1 flex items-center" |
||||
|
> |
||||
|
<u-radio |
||||
|
:name="radioValue.name" |
||||
|
v-for="(radioValue, radioIndex) in listItem.listItem" |
||||
|
:key="radioValue.name" |
||||
|
class="ipt-radio" |
||||
|
style="height: 40px;line-height: 40px" |
||||
|
@change="changeRadio($event, listItem.code, index, listIndex)" |
||||
|
> |
||||
|
<u-input |
||||
|
:border="true" |
||||
|
:clearable="false" |
||||
|
v-if="radioValue.name === '已评'" |
||||
|
:style="{ |
||||
|
color: listItem.value !== '已评' ? 'rgba(0,0,0,0.25)' : '', |
||||
|
background: listItem.value !== '已评' ? '#eee' : '', |
||||
|
}" |
||||
|
type="number" |
||||
|
:value="radioValue.value" |
||||
|
placeholder="请输入" |
||||
|
class="ipt-radio" |
||||
|
style="width: 200rpx" |
||||
|
@click="iptChangeRadio(radioValue.name, listItem.code, index, listIndex)" |
||||
|
@blur="changeScroeNum($event, listItem.min, listItem.max, radioValue.code, index, listIndex, radioIndex)" |
||||
|
/> |
||||
|
<view v-else style="height: 40px;line-height: 40px" :style="{ color: listItem.value === radioValue.name ? '#1890ff' : '' }">{{ radioValue.name }}</view> |
||||
|
</u-radio> |
||||
|
</u-radio-group> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
</template> |
||||
|
</div> |
||||
|
<u-picker mode="time" v-model="show" :title="title" :params="timeSelectparams" @confirm="chooseTime"></u-picker> |
||||
|
<u-picker mode="selector" v-model="showDrop" :range="dropList" :default-selector="[0]" @confirm="chooseSelector"></u-picker> |
||||
|
<u-toast ref="uToast" /> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { mapState } from 'vuex'; |
||||
|
import Talk from './component/Talk.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { Talk }, |
||||
|
props: { |
||||
|
testIndex: { |
||||
|
type: Number, |
||||
|
default: 0, |
||||
|
}, |
||||
|
list: { |
||||
|
type: Array, |
||||
|
default: () => [], |
||||
|
}, |
||||
|
answerList: { |
||||
|
type: Object, |
||||
|
default: () => {}, |
||||
|
}, |
||||
|
canChange: { |
||||
|
type: Boolean, |
||||
|
default: false, |
||||
|
}, |
||||
|
}, |
||||
|
data: () => ({ |
||||
|
test: [], // 试题数组 |
||||
|
radioStyle: { |
||||
|
// 单选试题竖向排列时的样式 |
||||
|
display: 'block', |
||||
|
width: '100%', |
||||
|
marginLeft: '0', |
||||
|
height: '40px', |
||||
|
lineHeight: '40px', |
||||
|
}, |
||||
|
timeValue: '', |
||||
|
title: '', // 时间选择器组件的标题 |
||||
|
timeIndex: 0, // 当前时间选择器对应试题的 index 位置 |
||||
|
timeItemIndex: 0, // 当前时间选择器对应试题的 index 位置 |
||||
|
timeCode: '', // 当前时间选择器对应试题的 code |
||||
|
show: false, // 是否显示时间选择器组件 |
||||
|
ZQTHSJ: null, // 知情谈话时间 |
||||
|
timeSelectparams: { |
||||
|
// 时间选择器可以选择那个时间 |
||||
|
year: true, |
||||
|
month: true, |
||||
|
day: true, |
||||
|
hour: true, |
||||
|
minute: true, |
||||
|
second: false, |
||||
|
}, |
||||
|
dropTitle: '', |
||||
|
dropList: [], |
||||
|
dropCode: '', |
||||
|
dropIndex: '', |
||||
|
dropItemIndex: '', |
||||
|
dValue: '', |
||||
|
showDrop: false, |
||||
|
numIndex: '', |
||||
|
numItemIndex: '', |
||||
|
exceed: '', |
||||
|
}), |
||||
|
computed: { |
||||
|
...mapState('carbasics', ['firstAidId']), |
||||
|
getBMI() { |
||||
|
let height = 0; |
||||
|
let weight = 0; |
||||
|
for (let key in this.test) { |
||||
|
for (let i in this.test[key]) { |
||||
|
if (this.test[key][i].code === 'RYPG-height' && this.test[key][i].value) { |
||||
|
height = this.test[key][i].value - 0; |
||||
|
} else if (this.test[key][i].code === 'RYPG-weight' && this.test[key][i].value) { |
||||
|
weight = this.test[key][i].value - 0; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (height && weight) { |
||||
|
return (weight / (((height / 100) * height) / 100)).toFixed(2); |
||||
|
} else { |
||||
|
return 0; |
||||
|
} |
||||
|
}, |
||||
|
getCount() { |
||||
|
let num = 0; |
||||
|
for (let key in this.test) { |
||||
|
for (let i in this.test[key]) { |
||||
|
if (this.test[key][i].code === 'TSCX-AVM-SIZE') { |
||||
|
// ['<3cm(1 分)', '3-6cm(2 分)', '>6cm(3 分)'] |
||||
|
if (this.test[key][i].value === '<3cm(1 分)') { |
||||
|
num += 1; |
||||
|
} else if (this.test[key][i].value === '3-6cm(2 分)') { |
||||
|
num += 2; |
||||
|
} else if (this.test[key][i].value === '>6cm(3 分)') { |
||||
|
num += 3; |
||||
|
} |
||||
|
} else if (this.test[key][i].code === 'TSCX-AVM-features') { |
||||
|
// ['大脑非功能区(0 分)', '大脑功能区(1 分)'] |
||||
|
if (this.test[key][i].value === '大脑非功能区(0 分)') { |
||||
|
num += 0; |
||||
|
} else if (this.test[key][i].value === '大脑功能区(1 分)') { |
||||
|
num += 1; |
||||
|
} |
||||
|
} else if (this.test[key][i].code === 'TSCX-AVM-SEAT') { |
||||
|
// ['浅表部(0 分)', '深部(1 分)'] |
||||
|
if (this.test[key][i].value === '浅表部(0 分)') { |
||||
|
num += 0; |
||||
|
} else if (this.test[key][i].value === '深部(1 分)') { |
||||
|
num += 1; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return num; |
||||
|
}, |
||||
|
}, |
||||
|
methods: { |
||||
|
changeHeigt() { |
||||
|
// this.$emit('getCollaoseHeight', this.testIndex); |
||||
|
}, |
||||
|
/** |
||||
|
* 判断当前 item 是否显示 |
||||
|
* 根据 显示条件: isShow 是否和父级code: Fcode 的值相等判断 |
||||
|
* 如果 Fcode 和 isShow 都不存在,则直接返回true,显示当前item |
||||
|
* 如果 Fcode 和 isShow 都存在,而且 (父级code存在且父级code的value和isShow值相等) 则返回ture |
||||
|
* 否则返回false |
||||
|
*/ |
||||
|
itemIsShow(code, isShow, level) { |
||||
|
if (!level) { |
||||
|
if (code && isShow) { |
||||
|
for (let i = 0; i < this.test.length; i++) { |
||||
|
const item = this.test[i]; |
||||
|
if (item) { |
||||
|
for (let j = 0; j < item.length; j++) { |
||||
|
const jtem = item[j]; |
||||
|
if (jtem.code === code && jtem.value === isShow) { |
||||
|
return true; |
||||
|
} else if (i === this.test.length - 1 && j === item.length) { |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
return true; |
||||
|
} |
||||
|
} else { |
||||
|
if (this.answerList && this.answerList[code]) { |
||||
|
const value = this.answerList[code]; |
||||
|
if (Array.isArray(value)) { |
||||
|
for (var i = 0; i < value.length; i++) { |
||||
|
if (value[i] === isShow) { |
||||
|
return true; |
||||
|
} else if (i === value.length - 1) { |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
return value === isShow; |
||||
|
} |
||||
|
} else { |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
/** |
||||
|
* 判断当前试题是否显示 |
||||
|
* 不是根据父级试题选了哪一项而显示,而是根据父级试题没选哪一项而显示 |
||||
|
* 比如 选了 '死亡',不能再出现'出院带药'等试题,选了其他选项则可以出现 |
||||
|
* 需要根据 @param level 来判断父级试题与当前题是否处于同一分类下 |
||||
|
* 并且 父级 题目的 答案不一定是字符串,也有可能是数组 |
||||
|
*/ |
||||
|
itemNoShow(NFcode, noShow, level) { |
||||
|
if (level && NFcode && noShow) { |
||||
|
for (let i = 0; i < this.test.length; i++) { |
||||
|
const item = this.test[i]; |
||||
|
for (let j = 0; j < item.length; j++) { |
||||
|
const jtem = item[j]; |
||||
|
if (jtem.code === NFcode) { |
||||
|
return this.judgeType(jtem.value, noShow); |
||||
|
} else if (i === this.test.length - 1 && j === item.length) { |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
|
// 判断传入的值是字符串还是数组,并 根据 两者是否相等或 包含 返回true |
||||
|
// 有相同项 则 返回false 不显示当前试题 |
||||
|
judgeType(Fvalue, value) { |
||||
|
if (Array.isArray(Fvalue)) { |
||||
|
for (var i = 0; i < Fvalue.length; i++) { |
||||
|
if (Fvalue[i] === value) { |
||||
|
return false; |
||||
|
} else if (i === Fvalue.length - 1) { |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
return Fvalue !== value; |
||||
|
} |
||||
|
}, |
||||
|
/** |
||||
|
* 修改输入框内容 |
||||
|
* 先获取到 this.test 数组(props接收的值不能在当前界面修改,所以用将list的值赋值给了 test ,渲染界面也是用的 test) |
||||
|
* 通过 index 修改掉 test 数组后,存储答案给服务端 |
||||
|
*/ |
||||
|
changeIpt(e, code, index, itemIndex) { |
||||
|
this.Rerender(e, index, itemIndex); |
||||
|
this.setAnswer(code, e); |
||||
|
}, |
||||
|
/** |
||||
|
* 修改单选框内容 |
||||
|
* 和输入框操作一样 |
||||
|
*/ |
||||
|
changeRadio(e, code, index, itemIndex) { |
||||
|
this.Rerender(e, index, itemIndex); |
||||
|
// if (this.canChange) { |
||||
|
// this.$emit('getCollaoseHeight', this.testIndex); |
||||
|
// } |
||||
|
this.setAnswer(code, e); |
||||
|
}, |
||||
|
// 修改是否是烟雾病的题时, |
||||
|
changeYWBRadio(e, code, index, itemIndex) { |
||||
|
let Arr = [...this.test]; |
||||
|
Arr[index][itemIndex].ywbValue = e; |
||||
|
this.test = [...Arr]; |
||||
|
this.setAnswer(code, e); |
||||
|
}, |
||||
|
// 修改试题时,重新赋值test,达到重新渲染界面的目的 |
||||
|
Rerender(value, index, itemIndex) { |
||||
|
let Arr = [...this.test]; |
||||
|
Arr[index][itemIndex].value = value; |
||||
|
console.log('Arr[index][itemIndex].value: ', Arr[index][itemIndex].value); |
||||
|
this.test = [...Arr]; |
||||
|
}, |
||||
|
// 修改带评分输入框的单选题内的输入框 |
||||
|
changeRadioScore(e, code, index, itemIndex, radioIndex, unit, min, max) { |
||||
|
let num = e; |
||||
|
if (unit && max) { |
||||
|
if (num || num - 0 === 0) { |
||||
|
if (num < min) { |
||||
|
// this.$message.warning('最低数值为:' + min); |
||||
|
this.$refs.uToast.show({ |
||||
|
title: '最低数值为:' + min, |
||||
|
type: 'warning', |
||||
|
}); |
||||
|
num = min; |
||||
|
} else if (num > max) { |
||||
|
// this.$message.warning('最高数值为:' + max); |
||||
|
this.$refs.uToast.show({ |
||||
|
title: '最高数值为:' + max, |
||||
|
type: 'warning', |
||||
|
}); |
||||
|
num = max; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
let Arr = [...this.test]; |
||||
|
Arr[index][itemIndex].itemList[radioIndex].value = num; |
||||
|
this.test = [...Arr]; |
||||
|
this.setAnswer(code, num); |
||||
|
}, |
||||
|
/** |
||||
|
* 修改多选框内容 |
||||
|
* 因为多选的类型有分成了几种特殊类型 |
||||
|
* 所以需要判断某些参数是否存在 |
||||
|
*/ |
||||
|
changeCheck(e, code, index, itemIndex, checkIndex, other) { |
||||
|
let val = [...e]; |
||||
|
if (!checkIndex && checkIndex !== 0) { |
||||
|
let Arr = [...this.test]; |
||||
|
const answerList = Arr[index][itemIndex] |
||||
|
val = []; |
||||
|
for(let i = 0; i < Arr[index][itemIndex].itemList.length; i++) { |
||||
|
if(answerList.itemIsChecked[i].isChecked) { |
||||
|
val.push(Arr[index][itemIndex].itemList[i]) |
||||
|
} |
||||
|
} |
||||
|
// if (other && e.length) { |
||||
|
// for (let i = 0; i < e.length; i++) { |
||||
|
// if (e[i] === other) { |
||||
|
// val = [other]; |
||||
|
// } |
||||
|
// } |
||||
|
// } |
||||
|
Arr[index][itemIndex].value = [...val]; |
||||
|
this.Rerender(val, index, itemIndex); |
||||
|
} else { |
||||
|
let Arr = [...this.test]; |
||||
|
Arr[index][itemIndex].checkList[checkIndex].value = val; |
||||
|
this.test = [...Arr]; |
||||
|
} |
||||
|
const codeAndAnswerList = [ |
||||
|
{ |
||||
|
questionCode: code, |
||||
|
answer: val, |
||||
|
}, |
||||
|
]; |
||||
|
const setParams = { |
||||
|
codeAndAnswerList, |
||||
|
firstAidId: this.firstAidId, |
||||
|
}; |
||||
|
uni.$u.api.setRecord(setParams); |
||||
|
}, |
||||
|
// 判断当前多选题得选项是否可选 |
||||
|
isDisabled(check, value, other) { |
||||
|
let status = false; |
||||
|
if (value.length && other) { |
||||
|
for (let i = 0; i < value.length; i++) { |
||||
|
if (value[i] && value[i] === other) { |
||||
|
status = true; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (check === other) { |
||||
|
return false; |
||||
|
} else { |
||||
|
return status; |
||||
|
} |
||||
|
}, |
||||
|
// 获取当前多选框的内容是否已选中 |
||||
|
getCheckIsCheck(list, value) { |
||||
|
let status = true; |
||||
|
for (let key in list) { |
||||
|
if (list[key] === value) { |
||||
|
status = true; |
||||
|
} |
||||
|
} |
||||
|
return status; |
||||
|
}, |
||||
|
// 修改其他的输入框内容 |
||||
|
changeOther(e, code, index, itemIndex) { |
||||
|
let Arr = [...this.test]; |
||||
|
Arr[index][itemIndex].iptValue = e; |
||||
|
this.test = [...Arr]; |
||||
|
this.setAnswer(code, e); |
||||
|
}, |
||||
|
// 特殊类型的多选题的其他输入框审的改变事件 |
||||
|
changeCheckIpt(e, code, index, listIndex, checkIndex) { |
||||
|
let Arr = [...this.test]; |
||||
|
Arr[index][listIndex].checkList[checkIndex].iptValue = e; |
||||
|
this.test = [...Arr]; |
||||
|
this.setAnswer(code, e); |
||||
|
}, |
||||
|
// 打开时间选择器组件 |
||||
|
async openTimeSelect(title, code, index, listIndex, time) { |
||||
|
this.timeValue = time ? time : 0; |
||||
|
this.title = title; |
||||
|
this.timeIndex = index; |
||||
|
this.timeItemIndex = listIndex; |
||||
|
this.timeCode = code; |
||||
|
this.show = true; |
||||
|
if (code === 'YJJL-CTendTime') { |
||||
|
const codeList = ['ZQTH-SJ']; |
||||
|
const param = { |
||||
|
codeList, |
||||
|
firstAidId: this.firstAidId, |
||||
|
}; |
||||
|
const data = await this.$u.api.getRecord(param); |
||||
|
this.ZQTHSJ = data.record['ZQTH-SJ'] && data.record['ZQTH-SJ'].length ? data.record['ZQTH-SJ'][0] : null; |
||||
|
} |
||||
|
}, |
||||
|
// 时间选择器组件选择了时间 |
||||
|
chooseTime(time) { |
||||
|
const timeValue = this.$moment(`${time.year}-${time.month}-${time.day} ${time.hour}:${time.minute}:00`).valueOf(); |
||||
|
if (this.timeCode === 'YJJL-CTendTime' && this.ZQTHSJ && timeValue - 0 < this.ZQTHSJ - 0) { |
||||
|
// this.$message.error('CT完成时间不能晚于签署知情同意书时间,请重新选择'); |
||||
|
this.$refs.uToast.show({ |
||||
|
title: 'CT完成时间不能晚于签署知情同意书时间,请重新选择', |
||||
|
type: 'warning', |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
this.Rerender(timeValue, this.timeIndex, this.timeItemIndex); |
||||
|
this.setAnswer(this.timeCode, timeValue); |
||||
|
this.show = false; |
||||
|
}, |
||||
|
// 打开底部下拉 |
||||
|
openDropDown(title, list, code, index, itemIndex, value) { |
||||
|
this.dropTitle = title; |
||||
|
this.dropList = list; |
||||
|
this.dropCode = code; |
||||
|
this.dropIndex = index; |
||||
|
this.dropItemIndex = itemIndex; |
||||
|
this.dValue = value; |
||||
|
this.showDrop = true; |
||||
|
}, |
||||
|
// 底部下拉选中 |
||||
|
chooseSelector(e) { |
||||
|
this.Rerender(this.dropList[e], this.dropIndex, this.dropItemIndex); |
||||
|
this.setAnswer(this.dropCode, this.dropList[e]); |
||||
|
}, |
||||
|
/** |
||||
|
* 修改数字输入框,存在最大最小值 |
||||
|
* 小于最小值,则存储最小值 |
||||
|
* 大于最大值,则存储最大值 |
||||
|
* 否则存储当前拿到的值 |
||||
|
*/ |
||||
|
changeNum(e, min, max, code, index, itemIndex) { |
||||
|
let num = 0; |
||||
|
if (e || e - 0 === 0) { |
||||
|
if (e < min) { |
||||
|
this.numIndex = index; |
||||
|
this.numItemIndex = itemIndex; |
||||
|
this.exceed = 'min'; |
||||
|
num = min; |
||||
|
} else if (e > max) { |
||||
|
this.numIndex = index; |
||||
|
this.numItemIndex = itemIndex; |
||||
|
this.exceed = 'max'; |
||||
|
num = max; |
||||
|
} else { |
||||
|
this.numIndex = null; |
||||
|
this.numItemIndex = null; |
||||
|
this.exceed = ''; |
||||
|
num = e; |
||||
|
} |
||||
|
} |
||||
|
this.Rerender(num, index, itemIndex); |
||||
|
}, |
||||
|
// 分数数据框失去焦点后,取消警告提示,因为值自己会改到最大/最小值 |
||||
|
inputNumBlur(e, code, min, max, index, itemIndex) { |
||||
|
this.changeNum(e, min, max, code, index, itemIndex) |
||||
|
this.numIndex = null; |
||||
|
this.numItemIndex = null; |
||||
|
this.exceed = ''; |
||||
|
if (code) { |
||||
|
if (code === 'RYPG-systolicPressure') { |
||||
|
// 收缩压 |
||||
|
const maxNum = this.getPressure(1); // 舒张压 |
||||
|
if (e < maxNum && maxNum) { |
||||
|
// this.$message.error('收缩压必须大于舒张压,请重新填写'); |
||||
|
this.$refs.uToast.show({ |
||||
|
title: '收缩压必须大于舒张压,请重新填写', |
||||
|
type: 'warning', |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
} else if (code === 'RYPG-diastolicPressure') { |
||||
|
// 舒张压 |
||||
|
const minNum = this.getPressure(0); // 收缩压 |
||||
|
if (e > minNum && minNum) { |
||||
|
// this.$message.error('舒张压必须小于收缩压,请重新填写'); |
||||
|
this.$refs.uToast.show({ |
||||
|
title: '舒张压必须小于收缩压,请重新填写', |
||||
|
type: 'warning', |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
this.setAnswer(code, e); |
||||
|
} |
||||
|
}, |
||||
|
// 获取当前收缩压/舒张压的值 0:收缩压,1:舒张压 |
||||
|
getPressure(type) { |
||||
|
const { list } = this; |
||||
|
let num = 0; |
||||
|
for (let i = 0; i < list.length; i++) { |
||||
|
const item = list[i]; |
||||
|
for (let k = 0; k < item.length; k++) { |
||||
|
const obj = item[k]; |
||||
|
if ((obj.code === 'RYPG-systolicPressure' && type === 0) || (obj.code === 'RYPG-diastolicPressure' && type === 1)) { |
||||
|
num = obj.value - 0; |
||||
|
return num; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// 修改评分的输入框 |
||||
|
changeScroeNum(e, min, max, code, index, itemIndex, radioIndex) { |
||||
|
let num = 0; |
||||
|
if (e || e - 0 === 0) { |
||||
|
if (e < min) { |
||||
|
num = min; |
||||
|
} else if (e > max) { |
||||
|
num = max; |
||||
|
} else { |
||||
|
num = e; |
||||
|
} |
||||
|
} |
||||
|
let Arr = [...this.test]; |
||||
|
Arr[index][itemIndex].listItem[radioIndex].value = num; |
||||
|
this.test = [...Arr]; |
||||
|
this.setAnswer(code, num); |
||||
|
}, |
||||
|
// 点击分数输入框时,将当前输入框的选项改为选中状态 |
||||
|
iptChangeRadio(value, code, index, itemIndex) { |
||||
|
this.Rerender(value, index, itemIndex); |
||||
|
this.setAnswer(code, value); |
||||
|
}, |
||||
|
// 存储提交答案 |
||||
|
setAnswer(questionCode, value) { |
||||
|
const params = { |
||||
|
codeAndAnswerList: [ |
||||
|
{ |
||||
|
questionCode, |
||||
|
answer: [value], |
||||
|
}, |
||||
|
], |
||||
|
firstAidId: this.firstAidId, |
||||
|
}; |
||||
|
uni.$u.api.setRecord(params); |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
list: { |
||||
|
handler() { |
||||
|
this.test = [...this.list]; |
||||
|
}, |
||||
|
deep: true, |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
// 组件周期函数--监听组件挂载完毕 |
||||
|
mounted() { |
||||
|
const that = this |
||||
|
this.$nextTick(()=> { |
||||
|
that.changeHeigt(); |
||||
|
}) |
||||
|
}, |
||||
|
created() { |
||||
|
this.test = [...this.list]; |
||||
|
}, |
||||
|
// 组件周期函数--监听组件数据更新之前 |
||||
|
beforeUpdate() {}, |
||||
|
// 组件周期函数--监听组件数据更新之后 |
||||
|
updated() {}, |
||||
|
// 组件周期函数--监听组件激活(显示) |
||||
|
activated() {}, |
||||
|
// 组件周期函数--监听组件停用(隐藏) |
||||
|
deactivated() {}, |
||||
|
// 组件周期函数--监听组件销毁之前 |
||||
|
beforeDestroy() {}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
/deep/.u-radio__label { |
||||
|
margin-left: 0 !important; |
||||
|
margin-right: 0 !important; |
||||
|
} |
||||
|
.putong-title { |
||||
|
margin-left: 24rpx; |
||||
|
font-size: 32rpx; |
||||
|
font-family: OPPOSans-Bold, OPPOSans; |
||||
|
font-weight: bold; |
||||
|
color: #3e3d4d; |
||||
|
} |
||||
|
.shu { |
||||
|
width: 16rpx; |
||||
|
height: 40rpx; |
||||
|
background: linear-gradient(136deg, #7bc0ff 0%, #4d88ff 100%); |
||||
|
border-radius: 40rpx; |
||||
|
opacity: 1; |
||||
|
margin-right: 8rpx; |
||||
|
} |
||||
|
.shu-title { |
||||
|
font-size: 36rpx; |
||||
|
font-family: Open Sans-Bold, Open Sans; |
||||
|
font-weight: bold; |
||||
|
color: #3e3d4d; |
||||
|
} |
||||
|
.ipt-radio view { |
||||
|
height: 33px; |
||||
|
line-height: 33px; |
||||
|
} |
||||
|
.list-box { |
||||
|
border-radius: 4px; |
||||
|
overflow: hidden; |
||||
|
box-sizing: border-box; |
||||
|
margin: 0; |
||||
|
padding: 0 32rpx; |
||||
|
color: rgba(0, 0, 0, 0.65); |
||||
|
font-size: 14px; |
||||
|
font-variant: tabular-nums; |
||||
|
line-height: 1.5; |
||||
|
list-style: none; |
||||
|
font-feature-settings: 'tnum'; |
||||
|
position: relative; |
||||
|
} |
||||
|
.list-item { |
||||
|
min-height: 60px; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
padding: 24rpx 0; |
||||
|
border-bottom: 1px solid #eee; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,411 @@ |
|||||
|
<template> |
||||
|
<div class="inner" style="padding-top: 42px; padding-bottom: 50rpx"> |
||||
|
<Demonstration /> |
||||
|
<div class="w-full" v-for="(item, index) in testList" :key="index"> |
||||
|
<template v-if="item.testType === 1"> |
||||
|
<Test |
||||
|
:testIndex="index" |
||||
|
@getCollaoseHeight="getCollaoseHeight" |
||||
|
:can-change="false" |
||||
|
:answer-list="answerList" |
||||
|
v-if="type" |
||||
|
class="w-full" |
||||
|
:list="item.content" |
||||
|
/> |
||||
|
</template> |
||||
|
<template v-if="item.testType === 2"> |
||||
|
<view class="list-item"> |
||||
|
<view class="flex items-center"> |
||||
|
<view class="shu"></view> |
||||
|
<view class="shu-title">{{ item.testTitle }}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<!-- <u-collapse |
||||
|
:head-style="headerStyle" |
||||
|
:item-style="itemStyle" |
||||
|
class="mb-2 w-full" |
||||
|
v-if="item.testType === 2" |
||||
|
:bordered="false" |
||||
|
expand-icon-position="right" |
||||
|
:ref="'collapseView' + index" |
||||
|
> --> |
||||
|
<!-- <template #expandIcon="props"> |
||||
|
<u-icon type="down" :rotate="props.isActive ? 0 : -180" /> |
||||
|
</template> --> |
||||
|
<!-- <u-collapse-item :open="true" class="w-full" :title="item.testTitle" :style="customStyle"> --> |
||||
|
<Test |
||||
|
:testIndex="index" |
||||
|
@getCollaoseHeight="getCollaoseHeight" |
||||
|
:can-change="true" |
||||
|
:answer-list="answerList" |
||||
|
v-if="type" |
||||
|
class="w-full" |
||||
|
:list="item.content" |
||||
|
/> |
||||
|
<!-- </u-collapse-item> |
||||
|
</u-collapse> --> |
||||
|
</template> |
||||
|
</div> |
||||
|
<div class="ocr-open-box" @click="openOcr">OCR</div> |
||||
|
<u-modal v-model="showBasic" title="确定选择后将提交识别到的内容" :show-cancel-button="true" @confirm="submitBasicData"> |
||||
|
<view class="slot-content"> |
||||
|
<scroll-view scroll-y style="height: 750rpx"> |
||||
|
<div v-for="(item, index) in basicList" :key="index" class="modal-content flex justify-between items-center"> |
||||
|
<u-checkbox v-model="item.checked" :name="item.questionCode"> |
||||
|
<div>{{ item.name }}</div> |
||||
|
</u-checkbox> |
||||
|
<div class="flex items-center fz-16">{{ item.answer }}</div> |
||||
|
</div> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
</u-modal> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { mapState } from 'vuex'; |
||||
|
import Mixin from './mixin'; |
||||
|
import cloneDeep from 'lodash/cloneDeep'; |
||||
|
import Demonstration from 'components/Demonstration/Demonstration'; |
||||
|
|
||||
|
export default { |
||||
|
components: { Demonstration }, |
||||
|
mixins: [Mixin], |
||||
|
data: () => ({ |
||||
|
testList: [], |
||||
|
customStyle: 'background: #fff;border-radius: 4px;border: 0;overflow: hidden', |
||||
|
headerStyle: { |
||||
|
height: '54px', |
||||
|
lineHeight: '30px', |
||||
|
fontSize: '18px', |
||||
|
padding: '0 16px', |
||||
|
/* color: #1890ff; */ |
||||
|
color: 'rgba(0, 0, 0, 0.65)', |
||||
|
fontWeight: 'bold', |
||||
|
backgroundColor: '#fff', |
||||
|
}, |
||||
|
itemStyle: { marginBottom: '8px' }, |
||||
|
type: 'RYPG', |
||||
|
afterStr: '主要治疗', |
||||
|
beforeStr: '基本信息', |
||||
|
answerList: {}, |
||||
|
showBasic: false, |
||||
|
codeAndTitle: [], |
||||
|
basicList: [], |
||||
|
}), |
||||
|
computed: { ...mapState('carbasics', ['InputCode', 'firstAidId', 'isRefresh', 'basicData', 'detailValueType']) }, |
||||
|
methods: { |
||||
|
// 打开ocr界面 |
||||
|
openOcr() { |
||||
|
uni.navigateTo({ url: '/pages/camera/camera' }); |
||||
|
}, |
||||
|
// 获取到所有的code,调用接口获取答案 |
||||
|
async getAnswer() { |
||||
|
const codeList = []; |
||||
|
for (let key in this.codeValue) { |
||||
|
if (key === this.type) { |
||||
|
for (let value in this.codeValue[key]) { |
||||
|
codeList.push(value); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
const param = { |
||||
|
codeList, |
||||
|
firstAidId: this.firstAidId, |
||||
|
}; |
||||
|
const answer = await this.$u.api.getRecord(param); |
||||
|
this.answerList = answer.record; |
||||
|
this.reassign(answer.record); |
||||
|
}, |
||||
|
// 给试题赋值(以前答过) |
||||
|
reassign(recordList) { |
||||
|
for (let key in this.codeValue[this.type]) { |
||||
|
for (let value in recordList) { |
||||
|
if (key === value) { |
||||
|
if (Array.isArray(this.codeValue[this.type][key])) { |
||||
|
this.codeValue[this.type][key] = recordList[value]; |
||||
|
break; |
||||
|
} else { |
||||
|
this.codeValue[this.type][key] = recordList[value][0]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 给list赋值试题数组 |
||||
|
this.reassignList(); |
||||
|
// 增加checkedList的选中状态,不然多选框默认不选中,需要修改list数组的状态,所以只能放在给list赋值之后 |
||||
|
this.changeCheckStatus(); |
||||
|
// 获取所有试题的code和title |
||||
|
this.getAllCodeAndTitle(); |
||||
|
// 获取对应当前type的试题数组 |
||||
|
this.getTest(); |
||||
|
}, |
||||
|
// 判断当前多选是否选中,选中时需要修改当前的选中状态为ture |
||||
|
changeCheckStatus() { |
||||
|
for (let i = 0; i < this.list.length; i++) { |
||||
|
const item = this.list[i]; |
||||
|
if (item.testList.length) { |
||||
|
for (let j = 0; j < item.testList.length; j++) { |
||||
|
const itemJ = item.testList[j]; |
||||
|
if (itemJ.content.length) { |
||||
|
for (let k = 0; k < itemJ.content.length; k++) { |
||||
|
const itemK = itemJ.content[k]; |
||||
|
if (itemK.length) { |
||||
|
for (let m = 0; m < itemK.length; m++) { |
||||
|
if (Array.isArray(itemK[m].value)) { |
||||
|
for (let n = 0; n < itemK[m].itemList.length; n++) { |
||||
|
const itemN = itemK[m].itemList[n]; |
||||
|
itemK[m].itemIsChecked[n].isChecked = this.getCheckedStatus(itemN, itemK[m].value); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// 获取当前选项是否选中 |
||||
|
getCheckedStatus(item, valueList) { |
||||
|
for (let i = 0; i < valueList.length; i++) { |
||||
|
if (valueList[i] === item) { |
||||
|
return true; |
||||
|
} else if (i === valueList.length - 0) { |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// 获取试题 |
||||
|
// 因为试题的每个题的答案默认绑定的是codeList的每个code 对应的value |
||||
|
// 所以需要先定义codeList,然后再调用getTest |
||||
|
getTest() { |
||||
|
for (let i = 0; i < this.list.length; i++) { |
||||
|
if (this.list[i].name === this.type) { |
||||
|
this.testList = [...this.list[i].testList]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// 获取所有试题的题目和code |
||||
|
getAllCodeAndTitle() { |
||||
|
let Arr = []; |
||||
|
for (let i = 0; i < this.list.length; i++) { |
||||
|
const item = this.list[i]; |
||||
|
if (item.testList.length) { |
||||
|
for (let j = 0; j < item.testList.length; j++) { |
||||
|
const itemJ = item.testList[j]; |
||||
|
if (itemJ.content.length) { |
||||
|
for (let k = 0; k < itemJ.content.length; k++) { |
||||
|
const itemK = itemJ.content[k]; |
||||
|
if (itemK.length) { |
||||
|
for (let m = 0; m < itemK.length; m++) { |
||||
|
const itemM = itemK[m]; |
||||
|
const itemMm = itemK[m - 1]; |
||||
|
let obj = null; |
||||
|
if (itemM.code && itemM.title) { |
||||
|
obj = { |
||||
|
code: itemM.code, |
||||
|
title: itemM.title, |
||||
|
}; |
||||
|
} else if (itemM.code && !itemM.title) { |
||||
|
obj = { |
||||
|
code: itemM.code, |
||||
|
title: itemMm.title, |
||||
|
}; |
||||
|
} |
||||
|
if (obj) { |
||||
|
Arr.push(obj); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.codeAndTitle = Arr; |
||||
|
}, |
||||
|
// 通过code,获取试题的title信息 |
||||
|
getNameByCode() { |
||||
|
let Arr = [...this.basicList]; |
||||
|
for (let k = 0; k < Arr.length; k++) { |
||||
|
for (let i = 0; i < this.codeAndTitle.length; i++) { |
||||
|
const item = this.codeAndTitle[i]; |
||||
|
if (Arr[k].questionCode === item.code) { |
||||
|
Arr[k].name = item.title; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.basicList = [...Arr]; |
||||
|
}, |
||||
|
// 获取到试题的答案后,判断类型,返回正确格式 时间戳/数组/字符串 |
||||
|
getAnswerByType(obj) { |
||||
|
let answer = obj.answer; |
||||
|
if (typeof (answer - 0) === 'number') { |
||||
|
obj.type === 0; // 时间格式 |
||||
|
answer = this.$moment(answer - 0).format('YYYY-MM-DD HH:mm'); |
||||
|
} else if (Array.isArray(answer)) { |
||||
|
let str = ''; |
||||
|
for (let i = 0; i < answer.length; i++) { |
||||
|
if (i === answer.length - 0) { |
||||
|
str += answer[i]; |
||||
|
} else { |
||||
|
str = str + answer[i] + ','; |
||||
|
} |
||||
|
} |
||||
|
obj.type === 1; // 数组格式 |
||||
|
answer = str; |
||||
|
} else { |
||||
|
obj.type === 2; // 字符串格式 |
||||
|
} |
||||
|
obj.answer = answer; |
||||
|
return obj; |
||||
|
}, |
||||
|
// 重新计算面板高度 |
||||
|
getCollaoseHeight(index) { |
||||
|
const that = this; |
||||
|
// 获取到需要重新计算的面板 |
||||
|
this.$nextTick(() => { |
||||
|
that.$refs[`collapseView${index}`][0].init(); |
||||
|
setTimeout(() => { |
||||
|
that.$refs[`collapseView${index}`][0].init(); |
||||
|
}, 200); |
||||
|
}); |
||||
|
}, |
||||
|
// 点击modal框的确定,提交识别到,并且选择确定提交的数据 |
||||
|
// 提交数据之后重新请求当前界面的答案然后回显 |
||||
|
async submitBasicData() { |
||||
|
let codeAndAnswerList = []; |
||||
|
for (let i = 0; i < this.basicList.length; i++) { |
||||
|
const item = this.basicList[i]; |
||||
|
if (item.checked) { |
||||
|
let obj = { |
||||
|
questionCode: item.questionCode, |
||||
|
answer: this.basicData[i].answer, |
||||
|
}; |
||||
|
codeAndAnswerList.push(obj); |
||||
|
} |
||||
|
} |
||||
|
const param = { |
||||
|
codeAndAnswerList, |
||||
|
firstAidId: this.firstAidId, |
||||
|
}; |
||||
|
await this.$u.api.setRecord(param); |
||||
|
this.getAnswer(); |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
isRefresh() { |
||||
|
let Arr = []; |
||||
|
const basicData = cloneDeep(this.basicData); |
||||
|
for (let i = 0; i < basicData.length; i++) { |
||||
|
Arr.push(basicData[i]); |
||||
|
} |
||||
|
for (let i = 0; i < Arr.length; i++) { |
||||
|
Arr[i] = this.getAnswerByType(Arr[i]); |
||||
|
} |
||||
|
this.basicList = [...Arr]; |
||||
|
this.getNameByCode(); |
||||
|
this.showBasic = true; |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
// 页面周期函数--监听页面加载 |
||||
|
onLoad(query) { |
||||
|
if (query.name) { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: query.name, |
||||
|
}); |
||||
|
} |
||||
|
this.type = this.InputCode; |
||||
|
console.log('this.type: ', this.type); |
||||
|
// if (this.type === 'RYPG') { |
||||
|
// this.afterStr = '主要治疗'; |
||||
|
// this.beforeStr = '基本信息'; |
||||
|
// } else if (this.type === 'SSXG') { |
||||
|
// this.afterStr = '出院记录'; |
||||
|
// this.beforeStr = '入院评估'; |
||||
|
// } else if (this.type === 'CYJL') { |
||||
|
// this.afterStr = '无数据'; |
||||
|
// this.beforeStr = '主要治疗'; |
||||
|
// } |
||||
|
// this.tips = '正在获取试题...'; |
||||
|
this.getAnswer(); |
||||
|
}, |
||||
|
// 页面周期函数--监听页面初次渲染完成 |
||||
|
onReady() {}, |
||||
|
// 页面周期函数--监听页面显示(not-nvue) |
||||
|
onShow() {}, |
||||
|
// 页面周期函数--监听页面隐藏 |
||||
|
onHide() {}, |
||||
|
// 页面周期函数--监听页面卸载 |
||||
|
onUnload() {}, |
||||
|
// 页面处理函数--监听用户下拉动作 |
||||
|
onPullDownRefresh() { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
}, |
||||
|
// 页面处理函数--监听用户上拉触底 |
||||
|
onReachBottom() {}, |
||||
|
// 页面处理函数--监听页面滚动(not-nvue) |
||||
|
/* onPageScroll(event) {}, */ |
||||
|
// 页面处理函数--用户点击右上角分享 |
||||
|
/* onShareAppMessage(options) {}, */ |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.list-item { |
||||
|
min-height: 60px; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
padding: 24rpx 0; |
||||
|
margin: 0 32rpx; |
||||
|
border-bottom: 1px solid #eee; |
||||
|
} |
||||
|
.shu { |
||||
|
width: 16rpx; |
||||
|
height: 40rpx; |
||||
|
background: linear-gradient(136deg, #7bc0ff 0%, #4d88ff 100%); |
||||
|
border-radius: 40rpx; |
||||
|
opacity: 1; |
||||
|
margin-right: 8rpx; |
||||
|
} |
||||
|
.shu-title { |
||||
|
font-size: 36rpx; |
||||
|
font-family: Open Sans-Bold, Open Sans; |
||||
|
font-weight: bold; |
||||
|
color: #3e3d4d; |
||||
|
} |
||||
|
.modal-content { |
||||
|
padding: 16px; |
||||
|
} |
||||
|
.slot-content { |
||||
|
font-size: 28rpx; |
||||
|
color: rgba(0, 0, 0, 0.85); |
||||
|
padding-left: 30rpx; |
||||
|
} |
||||
|
.ocr-open-box { |
||||
|
z-index: 11; |
||||
|
position: fixed; |
||||
|
right: 0; |
||||
|
top: 40%; |
||||
|
height: 40px; |
||||
|
width: 40px; |
||||
|
font-size: 16px; |
||||
|
background: #1890ff; |
||||
|
color: white; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
border-radius: 20px 20px 0 20px; |
||||
|
box-shadow: 0 0 4px #1890ff; |
||||
|
} |
||||
|
.inner { |
||||
|
/* background-color: #ededed; */ |
||||
|
min-height: 100vh; |
||||
|
} |
||||
|
</style> |
After Width: | Height: | Size: 19 KiB |
Loading…
Reference in new issue