Browse Source

fix: 解决error

develop
song 4 years ago
parent
commit
1d67797ada
  1. 3
      CHANGELOG.md
  2. 15
      src/config/yyInfo.js
  3. 20
      src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue
  4. 22
      src/pagesProject/project/components/ConfigInfo/components/Medicine.vue
  5. 145
      src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-11-23)
# 0.1.0 (2021-11-24)
### 🌟 新功能
范围|描述|commitId
@ -237,6 +237,7 @@
- | 数据存储,避免重复调用接口 | [d22308a](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/d22308a)
- | 整理代码 | [7a55315](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/7a55315)
- | 日历的更改 | [7353ac8](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/7353ac8)
时间轴显示修改 | 时间轴显示修改 | [40fa028](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/40fa028)
- | 测试接口 | [215e074](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/215e074)
- | 登[C录时提示登录时提示是否合并账号样式修改是否合并账号样式修改 | [4f75696](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/4f75696)
- | 组件文件夹新建 | [22bfe7b](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/22bfe7b)

15
src/config/yyInfo.js

@ -375,7 +375,7 @@ export const infoList = [
/**
* 药物使用记录
* 展示类型: showType: 1 标题+折叠, 2 直接展示
* 试题类型, type:1 单选, 3 数字输入框,4 数字输入框+单选,5 其他药物
* 试题类型, type:1 单选,2 时间,3 数字输入框,4 数字输入框+单选,5 其他药物
*/
export const medicineInfo = [
{
@ -386,7 +386,18 @@ export const medicineInfo = [
label: 'isTest',
type: 1,
value: null,
radioList: ['未作测评', '已测评'],
radioList: [
{ id: '0', value: '未作测评' },
{ id: '1', value: '已测评' },
],
},
{
name: '测评时间',
label: 'testAt',
type: 2,
value: null,
show: false,
chooseTime: false,
},
{
name: 'Mmse得分',

20
src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue

@ -11,6 +11,9 @@
</view>
<view class="flex flex-row">
<view v-if="index === 0" class="text-gray-400 mr-2">{{ patientName }}</view>
<view v-if="index === 1" class="mr-4">
<u-icon name="plus" @click="addMedicine(index)"></u-icon>
</view>
<u-icon name="arrow-up" v-if="item.open" @click="changeOpen(index)"></u-icon>
<u-icon name="arrow-down" v-else @click="changeOpen(index)"></u-icon>
</view>
@ -20,7 +23,7 @@
<view style="border: 1px solid #e5e5e5" v-if="index === 0">
<Info />
</view>
<Medicine @showToast="showToast" v-if="index === 1" />
<Medicine @showToast="showToast" ref="child" v-if="index === 1" />
<Caregiver @showToast="showToast" v-if="index === 2" />
<Family @showToast="showToast" v-if="index === 3" />
</view>
@ -46,10 +49,10 @@ export default {
data() {
return {
itemList: [
{ head: '基本信息', open: true, body: '123', img: 'https://www.tall.wiki/staticrec/yanyuan/menu1.png' },
{ head: '药物使用记录', open: false, body: '123', img: 'https://www.tall.wiki/staticrec/yanyuan/menu2.png' },
{ head: 'Zarit照顾者负担量表', open: false, body: '123', img: 'https://www.tall.wiki/staticrec/yanyuan/menu3.png' },
{ head: '家属成员', open: false, body: '123', img: 'https://www.tall.wiki/staticrec/yanyuan/menu4.png' },
{ head: '基本信息', open: true, img: 'https://www.tall.wiki/staticrec/yanyuan/menu1.png' },
{ head: '药物使用记录', open: false, img: 'https://www.tall.wiki/staticrec/yanyuan/menu2.png' },
{ head: 'Zarit照顾者负担量表', open: false, img: 'https://www.tall.wiki/staticrec/yanyuan/menu3.png' },
{ head: '家属成员', open: false, img: 'https://www.tall.wiki/staticrec/yanyuan/menu4.png' },
],
headStyle: {
borderBottom: '1px solid #f8f8f8',
@ -80,6 +83,13 @@ export default {
title,
});
},
//
addMedicine(index) {
if (this.itemList[index].open) {
this.$refs.child[0].addMedicine();
}
},
},
};
</script>

22
src/pagesProject/project/components/ConfigInfo/components/Medicine.vue

@ -1,7 +1,7 @@
<template>
<view class="px-3 bg-white">
<MedicineDetail @showToast="showToast" v-if="show" />
<view v-else>
<view>
<MedicineDetail :detail="detail" @showToast="showToast" v-if="show" />
<view>
<view v-for="(item, index) in itemList" :key="index" :style="headStyle" class="py-3">
<!-- 头部 -->
<view class="w-full flex flex-row items-center justify-between text-sm text-gray-500">
@ -16,7 +16,7 @@
</view>
<!-- 内容区 -->
<view v-if="item.open" class="w-full mt-3">
<MedicineDetail :detail="item" @showToast="showToast" />
<MedicineDetail :detail="item" @showToast="showToast" v-if="item && item.id" />
</view>
</view>
</view>
@ -32,14 +32,14 @@ export default {
components: { MedicineDetail },
data() {
return {
show: true,
show: false,
itemList: [],
headStyle: {
borderBottom: '1px solid #f8f8f8',
fontSize: '16px',
width: '100%',
},
patientName: '传小控',
detail: null,
};
},
@ -66,6 +66,14 @@ export default {
this.$emit('showToast', type, title);
},
//
addMedicine() {
this.show = true;
this.itemList.forEach(item => {
item.open = false;
});
},
/**
* 查询药物使用
* @param { String } projectId 项目id
@ -87,7 +95,7 @@ export default {
});
this.itemList = date;
}
this.setDate(date);
// this.setDate(date);
} catch (error) {
console.error('error: ', error);
}

145
src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue

@ -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,36 +115,78 @@ 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) {
item.checked = true;
item.value = null;
if (!this.show) {
this.updateMedicine(item);
} else {
this.params[item.label] = '未服用';
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;
}
} else {
item.value = e;
if (!this.show) {
this.updateMedicine(item);
} else {
this.params[item.label] = item.value;
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) {
this.updateMedicine(item);
} else {
this.params[item.label] = '未服用';
}
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 {
@ -237,6 +294,7 @@ export default {
item.checked = true;
}
break;
}
}
}
}
@ -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);

Loading…
Cancel
Save