Browse Source

feat: 完善家属成员接口

develop
song 4 years ago
parent
commit
dcd811057e
  1. 1
      CHANGELOG.md
  2. 15
      src/apis/yanyuan.js
  3. 25
      src/config/yyInfo.js
  4. 6
      src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue
  5. 100
      src/pagesProject/project/components/ConfigInfo/components/Family.vue
  6. 80
      src/pagesProject/project/components/ConfigInfo/components/FamilyDetail.vue
  7. 23
      src/pagesProject/project/components/ConfigInfo/components/Medicine.vue
  8. 34
      src/pagesProject/project/components/ConfigInfo/components/MedicineDetail.vue

1
CHANGELOG.md

@ -175,6 +175,7 @@
- | 监听时间基本点 | [033fca0](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/033fca0)
- | 角色显示状态修改 | [7d3b906](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/7d3b906)
- | 角色栏修改 | [19228d6](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/19228d6)
- | 解决error | [2acacaa](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/2acacaa)
- | 解决error | [1d67797](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/1d67797)
- | 解决时间轴报错 | [da1eece](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/da1eece)
- | 设置时间轴自动滚动到当前位置 | [a3474f8](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a3474f8)

15
src/apis/yanyuan.js

@ -15,10 +15,6 @@ const install = (Vue, vm) => {
// 体验账号升级
vm.$u.api.upgradeTrainee = param => vm.$u.post(`${yanyuan}/trainee/upgrade`, param);
// 申请成为家属
vm.$u.api.applyFamily = param => vm.$u.post(`${yanyuan}/family/apply`, param);
// 查询个人信息
vm.$u.api.getPersonalInfo = () => vm.$u.post(`${yanyuan}/family/personal`);
// 绑定工具箱
vm.$u.api.bindTool = param => vm.$u.post(`${yanyuan}/tool/bind`, param);
// 用户身份判断
@ -41,6 +37,17 @@ const install = (Vue, vm) => {
// 修改药物使用
vm.$u.api.updateMedicine = param => vm.$u.post(`${yanyuan}/medicine/update`, param);
// 申请成为家属
vm.$u.api.applyFamily = param => vm.$u.post(`${yanyuan}/family/apply`, param);
// 审核家属成员
vm.$u.api.auditFamily = param => vm.$u.post(`${yanyuan}/family/auditFamily`, param);
// 查询个人信息
vm.$u.api.getPersonalInfo = () => vm.$u.post(`${yanyuan}/family/personal`);
// 查询待审核家属成员数量
vm.$u.api.queryAuditNum = param => vm.$u.post(`${yanyuan}/family/queryAuditNum`, param);
// 查询家属成员列表
vm.$u.api.queryFamilyList = param => vm.$u.post(`${yanyuan}/family/queryList`, param);
// 查询训练计划详情
vm.$u.api.getTrainDetail = param => vm.$u.post(`${yanyuan}/trainPlan/detail`, param);
};

25
src/config/yyInfo.js

@ -540,35 +540,38 @@ export const careInfo = [
export const familyInfo = [
{
name: '微信头像',
value: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
value: null,
label: 'avatarUrl',
},
{
name: '成员姓名',
value: '张三',
value: null,
label: 'name',
},
{
name: '成员电话',
value: '15233335566',
},
{
name: '成员关系',
value: '父亲',
value: null,
label: 'phone',
},
{
name: '性别',
value: '男',
value: null,
label: 'sex',
},
{
name: '年龄',
value: '56岁',
value: null,
label: 'age',
},
{
name: '职业',
value: '技术人员',
value: null,
label: 'jobTitle',
},
{
name: '文化程度',
value: '大专或大学',
value: null,
label: 'educateLevel',
},
];

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

@ -12,7 +12,7 @@
<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>
<u-icon name="plus" @click="add(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>
@ -85,9 +85,9 @@ export default {
},
//
addMedicine(index) {
add(index) {
if (this.itemList[index].open) {
this.$refs.child[0].addMedicine();
this.$refs.child[0].add();
}
},
},

100
src/pagesProject/project/components/ConfigInfo/components/Family.vue

@ -1,26 +1,102 @@
<template>
<view style="border: 1px solid #e5e5e5">
<view class="flex flex-col text-sm" v-for="(family, index) in familyInfo" :key="index">
<view class="flex justify-between items-center p-3 border-b">
<text>{{ family.name }}</text>
<u-avatar :src="family.avatar" v-if="family.name === '微信头像'" mode="square"></u-avatar>
<text v-else class="text-gray-400">{{ family.value }}</text>
<view>
<FamilyDetail :detail="detail" @showToast="showToast" v-if="show" @closeAdd="closeAdd" />
<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">
<view class="flex justify-between flex-1 items-center">
<u-avatar class="ml-3" :src="item.avatarUrl" size="54"></u-avatar>
<text class="mr-3">{{ item.name }}</text>
</view>
<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>
</view>
<!-- 内容区 -->
<view v-if="item.open" class="w-full mt-3">
<FamilyDetail :detail="item" @showToast="showToast" @queryFamilyList="queryFamilyList" v-if="item && item.familyId" />
</view>
</view>
</view>
<view class="p-4">
<u-button type="primary" class="m-4">通过</u-button>
<u-button type="error" class="m-4">不通过</u-button>
</view>
</view>
</template>
<script>
import { familyInfo } from '@/config/yyInfo';
import { mapGetters } from 'vuex';
import FamilyDetail from './FamilyDetail';
export default {
name: 'Info',
components: { FamilyDetail },
data() {
return { familyInfo };
return {
show: false,
itemList: [],
headStyle: {
borderBottom: '1px solid #f8f8f8',
fontSize: '16px',
width: '100%',
},
detail: null,
index: 0,
};
},
computed: mapGetters('project', ['projectId']),
mounted() {
this.queryFamilyList();
},
methods: {
//
changeOpen(index) {
this.index = index;
this.show = false;
this.itemList.forEach((item, i) => {
if (i === index) {
if (!item.open) {
this.queryFamilyList();
}
item.open = !item.open;
} else {
item.open = false;
}
});
},
//
showToast(type, title) {
this.$emit('showToast', type, title);
},
/**
* 查询药物使用
* @param { String } projectId 项目id
*/
async queryFamilyList() {
try {
const params = { projectId: this.projectId };
const date = await this.$u.api.queryFamilyList(params);
if (!date.length) {
this.show = true;
} else {
this.show = false;
date.forEach((item, index) => {
if (index === this.index) {
item.open = true;
} else {
item.open = false;
}
});
this.itemList = date;
}
} catch (error) {
console.error('error: ', error);
}
},
},
};
</script>

80
src/pagesProject/project/components/ConfigInfo/components/FamilyDetail.vue

@ -0,0 +1,80 @@
<template>
<view style="border: 1px solid #e5e5e5">
<view class="flex flex-col text-sm" v-for="(family, index) in familyInfo" :key="index">
<view class="flex justify-between items-center p-3 border-b">
<text>{{ family.name }}</text>
<u-avatar :src="family.value" mode="square" v-if="family.label === 'avatarUrl'"></u-avatar>
<view v-else-if="family.label === 'sex'" class="text-gray-400">
{{ family.value === 1 ? '男' : family.value === 2 ? '女' : '' }}
</view>
<text v-else class="text-gray-400">{{ family.value }}</text>
</view>
</view>
<view class="flex flex-col p-4" v-if="detail.auditStatus === '0'">
<u-button type="primary" class="mb-4" @click="auditFamily(1)">通过</u-button>
<u-button type="error" @click="auditFamily(2)">不通过</u-button>
</view>
<view class="flex flex-col p-4" v-else>
<u-button :plain="true">
{{ detail.auditStatus === '1' ? '审核通过' : '审核未通过' }}
</u-button>
</view>
</view>
</template>
<script>
import { mapGetters } from 'vuex';
import { familyInfo } from '@/config/yyInfo';
export default {
name: 'Info',
props: { detail: { type: Object, default: null } },
data() {
return { familyInfo };
},
computed: mapGetters('project', ['projectId']),
mounted() {
if (this.detail && this.detail.familyId) {
this.setDate(this.detail);
}
},
methods: {
setDate(date) {
if (!date || !date.familyId) return;
const { familyInfo } = this;
for (let i = 0; i < familyInfo.length; i++) {
const item = familyInfo[i];
item.value = date[item.label];
}
},
/**
* 审核家属成员
* @param { String } auditStatus 审核状态(1审核通过 2审核未通过)
* @param { String } projectId 项目id
* @param { String } relationId 关系id
*/
async auditFamily(auditStatus) {
try {
const params = {
auditStatus,
projectId: this.projectId,
relationId: this.detail.relationId,
};
await this.$u.api.auditFamily(params);
this.$emit('showToast', 'success', '审核成功');
this.$emit('queryFamilyList');
} catch (error) {
console.error('error: ', error);
this.$emit('showToast', 'error', '审核失败');
}
},
},
};
</script>
<style lang="scss" scoped></style>

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

@ -1,13 +1,12 @@
<template>
<view>
<MedicineDetail :detail="detail" @showToast="showToast" v-if="show" />
<MedicineDetail :detail="detail" @showToast="showToast" v-if="show" @closeAdd="closeAdd" />
<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">
<view class="flex flex-row items-center">
药物使用记录
<text v-if="item.testAt">{{ item.testAt }}</text>
{{ item.createAt }}
</view>
<view class="flex flex-row">
<u-icon name="arrow-up" v-if="item.open" @click="changeOpen(index)"></u-icon>
@ -40,6 +39,7 @@ export default {
width: '100%',
},
detail: null,
index: 0,
};
},
@ -52,8 +52,13 @@ export default {
methods: {
//
changeOpen(index) {
this.index = index;
this.show = false;
this.itemList.forEach((item, i) => {
if (i === index) {
if (!item.open) {
this.queryMedicine();
}
item.open = !item.open;
} else {
item.open = false;
@ -67,13 +72,20 @@ export default {
},
//
addMedicine() {
add() {
this.show = true;
this.itemList.forEach(item => {
item.open = false;
});
},
//
async closeAdd() {
console.log('关闭添加窗口');
this.show = false;
await this.queryMedicine();
},
/**
* 查询药物使用
* @param { String } projectId 项目id
@ -87,7 +99,7 @@ export default {
} else {
this.show = false;
date.forEach((item, index) => {
if (index === 0) {
if (index === this.index) {
item.open = true;
} else {
item.open = false;
@ -95,7 +107,6 @@ export default {
});
this.itemList = date;
}
// this.setDate(date);
} catch (error) {
console.error('error: ', error);
}

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

@ -97,7 +97,6 @@ import { medicineInfo } from '@/config/yyInfo';
export default {
name: 'Info',
props: { detail: { type: Object, default: null } },
data() {
@ -107,12 +106,12 @@ export default {
params: {},
otherName: {
label: 'sevName',
value: '',
value: null,
name: '其他药物',
},
otherMedicine: {
label: 'sevMedicine',
value: '',
value: null,
name: '其他药物服用情况',
},
paramsDay: {
@ -131,6 +130,10 @@ export default {
mounted() {
if (this.detail && this.detail.id) {
this.setDate(this.detail);
this.show = false;
} else {
this.setEmpty();
this.show = true;
}
},
@ -192,6 +195,7 @@ export default {
},
changeOther(item) {
console.log(this.show);
if (!this.show) {
this.updateMedicine(item);
} else {
@ -211,6 +215,7 @@ export default {
await this.$u.api.addMedicine(params);
this.$emit('showToast', 'success', '药物使用添加成功');
this.show = false;
this.$emit('closeAdd');
} catch (error) {
console.error('error: ', error);
this.$emit('showToast', 'error', '药物使用添加失败');
@ -264,6 +269,26 @@ export default {
if (isComplete) return true;
},
//
setEmpty() {
const { medicineInfo, otherName, otherMedicine } = this;
otherName.value = null;
otherMedicine.value = null;
for (let i = 0; i < medicineInfo.length; i++) {
const info = medicineInfo[i];
for (let j = 0; j < info.date.length; j++) {
const item = info.date[j];
if (item.type === 2) {
item.chooseTime = false;
}
if (item.type === 4) {
item.checked = false;
}
item.value = null;
}
}
},
//
setDate(date) {
if (!date || !date.id) return;
@ -289,6 +314,7 @@ export default {
default: {
if (date[item.label] !== '未服用') {
item.value = date[item.label];
item.checked = false;
} else {
item.value = null;
item.checked = true;
@ -306,7 +332,7 @@ export default {
*/
async updateMedicine(item) {
try {
const params = { projectId: this.projectId };
const params = { id: this.detail.id };
params[item.label] = item.value;
await this.$u.api.updateMedicine(params);
} catch (error) {

Loading…
Cancel
Save