|
|
@ -12,12 +12,29 @@ |
|
|
|
@change="change(radioIndex, index, itemIndex, colItem.type)" |
|
|
|
v-for="(radioItem, radioIndex) in colItem.radioList" |
|
|
|
:key="radioIndex" |
|
|
|
:name="radioItem" |
|
|
|
:name="radioItem.id" |
|
|
|
> |
|
|
|
{{ radioItem }} |
|
|
|
{{ 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> |
|
|
|
<u-picker |
|
|
|
@confirm="change($event, index, itemIndex, colItem.type)" |
|
|
|
v-model="colItem.show" |
|
|
|
mode="time" |
|
|
|
:params="paramsDay" |
|
|
|
:title="colItem.name" |
|
|
|
></u-picker> |
|
|
|
</view> |
|
|
|
<view class="text-gray-350 pr-7" v-else>无需填写</view> |
|
|
|
</view> |
|
|
|
<!-- 数字输入框 --> |
|
|
|
<view v-if="colItem.type === 3" class="pr-7"> |
|
|
|
<u-input |
|
|
@ -69,7 +86,7 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="p-4"> |
|
|
|
<u-button type="primary" @click="addMedicine" v-if="show">添加</u-button> |
|
|
|
<u-button type="primary" @click="addMedicine" v-if="!detail || !detail.id">添加</u-button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
@ -80,6 +97,9 @@ import { medicineInfo } from '@/config/yyInfo'; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'Info', |
|
|
|
|
|
|
|
props: { detail: { type: Object, default: null } }, |
|
|
|
|
|
|
|
data() { |
|
|
|
return { |
|
|
|
medicineInfo, |
|
|
@ -95,23 +115,61 @@ export default { |
|
|
|
value: '', |
|
|
|
name: '其他药物服用情况', |
|
|
|
}, |
|
|
|
paramsDay: { |
|
|
|
year: true, |
|
|
|
month: true, |
|
|
|
day: true, |
|
|
|
hour: true, |
|
|
|
minute: true, |
|
|
|
second: true, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
computed: mapGetters('project', ['projectId']), |
|
|
|
|
|
|
|
mounted() { |
|
|
|
this.queryMedicine(); |
|
|
|
if (this.detail && this.detail.id) { |
|
|
|
this.setDate(this.detail); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
changeShow(index, itemIndex) { |
|
|
|
this.medicineInfo[index].date[itemIndex].show = !this.medicineInfo[index].date[itemIndex].show; |
|
|
|
}, |
|
|
|
|
|
|
|
cancelChecked(index, itemIndex) { |
|
|
|
this.medicineInfo[index].date[itemIndex].checked = false; |
|
|
|
}, |
|
|
|
|
|
|
|
change(e, index, itemIndex, type) { |
|
|
|
let item = this.medicineInfo[index].date[itemIndex]; |
|
|
|
if (type === 99) { |
|
|
|
|
|
|
|
switch (type) { |
|
|
|
case 1: { |
|
|
|
// 单选 |
|
|
|
item.value = e; |
|
|
|
this.medicineInfo[0].date[1].chooseTime = e === 1 ? true : false; |
|
|
|
if (!this.show) { |
|
|
|
this.updateMedicine(item); |
|
|
|
} else { |
|
|
|
this.params[item.label] = item.value; |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
case 2: { |
|
|
|
// 日期选择器 |
|
|
|
const valueDay = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second; |
|
|
|
item.value = valueDay; |
|
|
|
if (!this.show) { |
|
|
|
this.updateMedicine(item); |
|
|
|
} else { |
|
|
|
this.params[item.label] = item.value; |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
case 99: { |
|
|
|
item.checked = true; |
|
|
|
item.value = null; |
|
|
|
if (!this.show) { |
|
|
@ -119,13 +177,17 @@ export default { |
|
|
|
} else { |
|
|
|
this.params[item.label] = '未服用'; |
|
|
|
} |
|
|
|
} else { |
|
|
|
break; |
|
|
|
} |
|
|
|
default: { |
|
|
|
item.value = e; |
|
|
|
if (!this.show) { |
|
|
|
this.updateMedicine(item); |
|
|
|
} else { |
|
|
|
this.params[item.label] = item.value; |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
@ -137,25 +199,6 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询药物使用 |
|
|
|
* @param { String } projectId 项目id |
|
|
|
*/ |
|
|
|
async queryMedicine() { |
|
|
|
try { |
|
|
|
const params = { projectId: this.projectId }; |
|
|
|
const date = await this.$u.api.queryMedicine(params); |
|
|
|
if (!date.length) { |
|
|
|
this.show = true; |
|
|
|
} else { |
|
|
|
this.show = false; |
|
|
|
} |
|
|
|
this.setDate(date); |
|
|
|
} catch (error) { |
|
|
|
console.error('error: ', error); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 添加药物使用 |
|
|
|
* @param { Object } params |
|
|
@ -181,14 +224,20 @@ export default { |
|
|
|
const info = this.medicineInfo[i]; |
|
|
|
for (let j = 0; j < info.date.length; j++) { |
|
|
|
const item = info.date[j]; |
|
|
|
if (item.type !== 4) { |
|
|
|
if (!item.value) { |
|
|
|
if (item.type === 2) { |
|
|
|
if (item.chooseTime && !item.value) { |
|
|
|
this.$t.ui.showToast(`请选择测评时间`); |
|
|
|
isComplete = false; |
|
|
|
} |
|
|
|
break; |
|
|
|
} else if (item.type === 4) { |
|
|
|
if (!item.value && !item.checked) { |
|
|
|
this.$t.ui.showToast(`请填写${item.name}`); |
|
|
|
isComplete = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (!item.value && !item.checked) { |
|
|
|
if (!item.value) { |
|
|
|
this.$t.ui.showToast(`请填写${item.name}`); |
|
|
|
isComplete = false; |
|
|
|
break; |
|
|
@ -199,6 +248,9 @@ export default { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isComplete) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.otherName.value) { |
|
|
|
this.$t.ui.showToast(`请填写${this.otherName.name}`); |
|
|
|
isComplete = false; |
|
|
@ -223,13 +275,18 @@ export default { |
|
|
|
for (let j = 0; j < info.date.length; j++) { |
|
|
|
const item = info.date[j]; |
|
|
|
switch (item.type) { |
|
|
|
case 1: |
|
|
|
item.value = date[item.label] === '0' ? '未作测评' : '已测评'; |
|
|
|
case 2: { |
|
|
|
if (date[item.label]) { |
|
|
|
item.value = date[item.label]; |
|
|
|
item.chooseTime = true; |
|
|
|
} |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
} |
|
|
|
case 3: { |
|
|
|
item.value = date[item.label]; |
|
|
|
break; |
|
|
|
default: |
|
|
|
} |
|
|
|
default: { |
|
|
|
if (date[item.label] !== '未服用') { |
|
|
|
item.value = date[item.label]; |
|
|
|
} else { |
|
|
@ -240,6 +297,7 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -250,7 +308,6 @@ export default { |
|
|
|
try { |
|
|
|
const params = { projectId: this.projectId }; |
|
|
|
params[item.label] = item.value; |
|
|
|
console.log('params: ', params); |
|
|
|
await this.$u.api.updateMedicine(params); |
|
|
|
} catch (error) { |
|
|
|
console.error('error: ', error); |
|
|
|