|
|
@ -1,85 +1,87 @@ |
|
|
|
<template> |
|
|
|
<view style="border: 1px solid #e5e5e5"> |
|
|
|
<view v-for="(item, index) in medicineInfo" :key="index"> |
|
|
|
<view class="pl-4 py-3 font-bold border-b">{{ item.title }}</view> |
|
|
|
<template v-for="(colItem, itemIndex) in item.date"> |
|
|
|
<view :key="itemIndex" class="flex justify-between mx-4 items-center text-sm border-b"> |
|
|
|
<view class="my-3">{{ colItem.name }}</view> |
|
|
|
<!-- 单选 --> |
|
|
|
<view v-if="colItem.type === 1"> |
|
|
|
<u-radio-group v-model="colItem.value" class="flex items-center"> |
|
|
|
<u-radio |
|
|
|
@change="change(radioIndex, index, itemIndex, colItem.type)" |
|
|
|
v-for="(radioItem, radioIndex) in colItem.radioList" |
|
|
|
:key="radioIndex" |
|
|
|
:name="radioItem.id" |
|
|
|
> |
|
|
|
{{ radioItem.value }} |
|
|
|
</u-radio> |
|
|
|
</u-radio-group> |
|
|
|
</view> |
|
|
|
<!-- 日期:年月日 --> |
|
|
|
<view v-if="colItem.type === 2"> |
|
|
|
<view v-if="colItem.chooseTime"> |
|
|
|
<view @click="changeShow(index, itemIndex)"> |
|
|
|
<text :class="colItem.value ? '' : 'text-gray-350'">{{ colItem.value || '请选择' }} </text> |
|
|
|
<u-icon name="arrow-right" class="mx-2" color="#909399"></u-icon> |
|
|
|
<view> |
|
|
|
<view v-for="(item, index) in medicineInfo" :key="index"> |
|
|
|
<view class="pl-4 py-3 font-bold border-b">{{ item.title }}</view> |
|
|
|
<template v-for="(colItem, itemIndex) in item.date"> |
|
|
|
<view :key="itemIndex" class="flex justify-between mx-4 items-center text-sm border-b"> |
|
|
|
<view class="my-3">{{ colItem.name }}</view> |
|
|
|
<!-- 单选 --> |
|
|
|
<view v-if="colItem.type === 1"> |
|
|
|
<u-radio-group v-model="colItem.value" class="flex items-center"> |
|
|
|
<u-radio |
|
|
|
@change="change(radioIndex, index, itemIndex, colItem.type)" |
|
|
|
v-for="(radioItem, radioIndex) in colItem.radioList" |
|
|
|
:key="radioIndex" |
|
|
|
:name="radioItem.id" |
|
|
|
> |
|
|
|
{{ radioItem.value }} |
|
|
|
</u-radio> |
|
|
|
</u-radio-group> |
|
|
|
</view> |
|
|
|
<!-- 日期:年月日 --> |
|
|
|
<view v-if="colItem.type === 2"> |
|
|
|
<view v-if="colItem.chooseTime"> |
|
|
|
<view @click="changeShow(index, itemIndex)"> |
|
|
|
<text :class="colItem.value ? '' : 'text-gray-350'">{{ colItem.value || '请选择' }} </text> |
|
|
|
<u-icon name="arrow-right" class="ml-2" color="#909399"></u-icon> |
|
|
|
</view> |
|
|
|
<u-picker |
|
|
|
@confirm="change($event, index, itemIndex, colItem.type)" |
|
|
|
v-model="colItem.show" |
|
|
|
mode="time" |
|
|
|
:params="paramsDay" |
|
|
|
:title="colItem.name" |
|
|
|
></u-picker> |
|
|
|
</view> |
|
|
|
<u-picker |
|
|
|
@confirm="change($event, index, itemIndex, colItem.type)" |
|
|
|
v-model="colItem.show" |
|
|
|
mode="time" |
|
|
|
:params="paramsDay" |
|
|
|
:title="colItem.name" |
|
|
|
></u-picker> |
|
|
|
<view class="text-gray-350 pr-3" v-else>无需填写</view> |
|
|
|
</view> |
|
|
|
<!-- 数字输入框 --> |
|
|
|
<view v-if="colItem.type === 3" class="pr-3"> |
|
|
|
<u-input |
|
|
|
v-model="colItem.value" |
|
|
|
type="number" |
|
|
|
:clearable="false" |
|
|
|
input-align="right" |
|
|
|
@blur="change(colItem.value, index, itemIndex, colItem.type)" |
|
|
|
/> |
|
|
|
</view> |
|
|
|
<!-- 数字输入框+单选 --> |
|
|
|
<view v-if="colItem.type === 4" class="flex flex-nowrap items-center"> |
|
|
|
<u-input |
|
|
|
:clearable="false" |
|
|
|
class="flex-1 mr-3" |
|
|
|
v-model="colItem.value" |
|
|
|
placeholder="每日总剂量(单位: mg)" |
|
|
|
type="number" |
|
|
|
input-align="center" |
|
|
|
@focus="cancelChecked(index, itemIndex)" |
|
|
|
@blur="change(colItem.value, index, itemIndex, colItem.type)" |
|
|
|
/> |
|
|
|
<u-checkbox-group @change="change($event, index, itemIndex, 99)"> |
|
|
|
<u-checkbox v-model="colItem.checked" shape="circle">未服用</u-checkbox> |
|
|
|
</u-checkbox-group> |
|
|
|
</view> |
|
|
|
<view class="text-gray-350 pr-3" v-else>无需填写</view> |
|
|
|
</view> |
|
|
|
<!-- 数字输入框 --> |
|
|
|
<view v-if="colItem.type === 3" class="pr-3"> |
|
|
|
<u-input |
|
|
|
v-model="colItem.value" |
|
|
|
type="number" |
|
|
|
:clearable="false" |
|
|
|
input-align="right" |
|
|
|
@blur="change(colItem.value, index, itemIndex, colItem.type)" |
|
|
|
/> |
|
|
|
</view> |
|
|
|
<!-- 数字输入框+单选 --> |
|
|
|
<view v-if="colItem.type === 4" class="flex flex-nowrap items-center"> |
|
|
|
<u-input |
|
|
|
:clearable="false" |
|
|
|
class="flex-1 mr-3" |
|
|
|
v-model="colItem.value" |
|
|
|
placeholder="每日总剂量(单位: mg)" |
|
|
|
type="number" |
|
|
|
input-align="center" |
|
|
|
@focus="cancelChecked(index, itemIndex)" |
|
|
|
@blur="change(colItem.value, index, itemIndex, colItem.type)" |
|
|
|
/> |
|
|
|
<u-checkbox-group @change="change($event, index, itemIndex, 99)"> |
|
|
|
<u-checkbox v-model="colItem.checked" shape="circle">未服用</u-checkbox> |
|
|
|
</u-checkbox-group> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<view class="w-full h-2 bg-gray-100" v-if="index !== medicineInfo.length - 1"></view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<view class="w-full h-2 bg-gray-100" v-if="index !== medicineInfo.length - 1"></view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="flex flex-nowrap border-b mx-4 py-1"> |
|
|
|
<u-input :clearable="false" style="width: 100px" placeholder="其他药物" v-model="otherName.value" @blur="changeOther(otherName)" /> |
|
|
|
<u-input |
|
|
|
:clearable="false" |
|
|
|
class="flex-1" |
|
|
|
placeholder="每日总剂量(单位: mg)" |
|
|
|
type="number" |
|
|
|
v-model="otherMedicine.value" |
|
|
|
@blur="changeOther(otherMedicine)" |
|
|
|
/> |
|
|
|
</view> |
|
|
|
<view class="flex flex-nowrap border-b mx-4 py-1"> |
|
|
|
<u-input :clearable="false" style="width: 100px" placeholder="其他药物" v-model="otherName.value" @blur="changeOther(otherName)" /> |
|
|
|
<u-input |
|
|
|
:clearable="false" |
|
|
|
class="flex-1" |
|
|
|
placeholder="每日总剂量(单位: mg)" |
|
|
|
type="number" |
|
|
|
v-model="otherMedicine.value" |
|
|
|
@blur="changeOther(otherMedicine)" |
|
|
|
/> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="p-4"> |
|
|
|
<u-button type="primary" @click="addMedicine" v-if="!detail || !detail.id">添加</u-button> |
|
|
|
<view class="p-4"> |
|
|
|
<u-button type="primary" @click="addMedicine" v-if="!detail || !detail.id">添加</u-button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
@ -246,19 +248,19 @@ export default { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isComplete) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.otherName.value) { |
|
|
|
this.$t.ui.showToast(`请填写${this.otherName.name}`); |
|
|
|
isComplete = false; |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.otherMedicine.value) { |
|
|
|
this.$t.ui.showToast(`请填写${this.otherMedicine.name}`); |
|
|
|
isComplete = false; |
|
|
|
return; |
|
|
|
} |
|
|
|
// if (!isComplete) { |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// if (!this.otherName.value) { |
|
|
|
// this.$t.ui.showToast(`请填写${this.otherName.name}`); |
|
|
|
// isComplete = false; |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// if (!this.otherMedicine.value) { |
|
|
|
// this.$t.ui.showToast(`请填写${this.otherMedicine.name}`); |
|
|
|
// isComplete = false; |
|
|
|
// return; |
|
|
|
// } |
|
|
|
if (isComplete) return true; |
|
|
|
}, |
|
|
|
|
|
|
|