diff --git a/CHANGELOG.md b/CHANGELOG.md index 61874c3..382fdb3 100644 --- a/CHANGELOG.md +++ b/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) diff --git a/src/config/yyInfo.js b/src/config/yyInfo.js index 849dba2..c595e62 100644 --- a/src/config/yyInfo.js +++ b/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得分', diff --git a/src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue b/src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue index 6fe5f2a..9375506 100644 --- a/src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue +++ b/src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue @@ -11,6 +11,9 @@ {{ patientName }} + + + @@ -20,7 +23,7 @@ - + @@ -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(); + } + }, }, }; diff --git a/src/pagesProject/project/components/ConfigInfo/components/Medicine.vue b/src/pagesProject/project/components/ConfigInfo/components/Medicine.vue index b3c6d1c..ce6b711 100644 --- a/src/pagesProject/project/components/ConfigInfo/components/Medicine.vue +++ b/src/pagesProject/project/components/ConfigInfo/components/Medicine.vue @@ -1,7 +1,7 @@ @@ -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);