Browse Source

fix: 解决error

develop
song 4 years ago
parent
commit
b1975e5fc2
  1. 3
      CHANGELOG.md
  2. 9
      src/apis/yanyuan.js
  3. 207
      src/components/Info/Info.vue
  4. 108
      src/config/yyInfo.js
  5. 21
      src/pagesProject/project/components/ConfigInfo/ConfigInfo.vue
  6. 176
      src/pagesProject/project/components/ConfigInfo/components/Caregiver.vue
  7. 249
      src/pagesProject/project/components/ConfigInfo/components/CaregiverDetail.vue
  8. 8
      src/pagesProject/project/components/ConfigInfo/components/Family.vue
  9. 8
      src/pagesProject/project/components/ConfigInfo/components/Medicine.vue
  10. 38
      src/pagesProject/project/components/Evaluated/EvaluatedNLCP.vue
  11. 2
      src/pagesProject/project/components/Evaluated/components/UCharts.vue
  12. 5
      src/pagesProject/project/components/NotEvaluated/NotEvaluated.vue
  13. 2
      src/pagesProject/project/components/Roles/Roles.vue
  14. 7
      src/pagesProject/project/components/TimeLine/component/TimeStatus.vue
  15. 2
      src/pagesProject/project/project.vue
  16. 54
      src/pagesYanyuan/assess/assess.vue
  17. 3
      src/pagesYanyuan/assess/components/Test/components/TestMain.vue
  18. 3
      src/pagesYanyuan/assess/components/Test/components/TitlePosition.vue
  19. 27
      src/store/yanyuan/mutations.js
  20. 3
      src/store/yanyuan/state.js
  21. 2
      src/uni.scss

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-11-24)
# 0.1.0 (2021-11-26)
### 🌟 新功能
范围|描述|commitId
@ -179,6 +179,7 @@
- | 解决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)
- | 解决部分bug | [067bd0b](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/067bd0b)
- | 设置时间轴自动滚动到当前位置 | [a3474f8](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a3474f8)
- | 跳转详情页返回路径修改 | [c5e17c0](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c5e17c0)
- | 项目列表排序修改 | [fd3c3ac](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/fd3c3ac)

9
src/apis/yanyuan.js

@ -54,6 +54,15 @@ const install = (Vue, vm) => {
// 查询训练计划详情
vm.$u.api.getTrainDetail = param => vm.$u.post(`${yanyuan}/trainPlan/detail`, param);
// 添加负担量表
vm.$u.api.addZarit = param => vm.$u.post(`${yanyuan}/zarit/add`, param);
// 计算Zarit分数
vm.$u.api.calculateScore = param => vm.$u.post(`${yanyuan}/zarit/calculate`, param);
// 查询负担量表历史记录
vm.$u.api.queryZaritHistory = param => vm.$u.post(`${yanyuan}/zarit/queryHistory`, param);
// 查询照顾者负担表列表
vm.$u.api.queryZaritList = param => vm.$u.post(`${yanyuan}/zarit/queryList`, param);
};
export default { install };

207
src/components/Info/Info.vue

@ -13,7 +13,6 @@
<view v-if="colItem.type === 1">
<u-radio-group v-model="colItem.value">
<u-radio
class="mb-2"
@change="change($event, index, itemIndex, colItem.type)"
v-for="(radioItem, radioIndex) in colItem.radioList"
:key="radioIndex"
@ -138,7 +137,6 @@
<view>饮酒种类</view>
<u-radio-group v-model="colItem.classesValue" class="my-2">
<u-radio
class="mb-2"
@change="changeInput($event, index, itemIndex, 'classesValue')"
v-for="(radioItem, classRadioIndex) in colItem.radioList"
:key="classRadioIndex"
@ -194,7 +192,6 @@
<view>饮茶种类</view>
<u-radio-group v-model="colItem.classesValue" class="my-2">
<u-radio
class="mb-2"
@change="changeInput($event, index, itemIndex, 'classesValue')"
v-for="(radioItem, classIndex) in colItem.classesList"
:key="classIndex"
@ -206,7 +203,6 @@
<view>饮茶频率</view>
<u-radio-group v-model="colItem.frequencyValue" class="my-2">
<u-radio
class="mb-2"
@change="changeInput($event, index, itemIndex, 'frequencyValue')"
v-for="(radioItem, frequencyIndex) in colItem.frequencyList"
:key="frequencyIndex"
@ -221,7 +217,6 @@
<view v-if="colItem.type === 14">
<u-radio-group v-model="colItem.value">
<u-radio
class="mb-2"
@change="change($event, index, itemIndex, colItem.type)"
v-for="(radioItem, radioIndex) in colItem.radioList"
:key="radioIndex"
@ -244,7 +239,10 @@
<u-picker
@confirm="change($event, index, itemIndex, colItem.type)"
v-model="colItem.show"
:default-time="colItem.value"
mode="time"
:start-year="startYear"
:end-year="endYear"
:params="paramsDay"
:title="colItem.name"
></u-picker>
@ -271,24 +269,10 @@
mode="single-column"
:list="colItem.radioList"
@confirm="change($event, index, itemIndex, colItem.type)"
:default-value="[0]"
:default-value="[colItem.defaultValue]"
:title="colItem.name"
></u-select>
</view>
<!-- 日期: 年月日时 -->
<view v-if="colItem.type === 6">
<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="paramsHour"
:title="colItem.name"
></u-picker>
</view>
<!-- 多列下拉选框 -->
<view v-if="colItem.type === 7">
<view @click="changeShow(index, itemIndex)">
@ -300,7 +284,7 @@
mode="mutil-column"
:list="colItem.radioList"
@confirm="change($event, index, itemIndex, colItem.type)"
:default-value="[70, 100]"
:default-value="colItem.defaultValue"
title="低血压/高血压"
></u-select>
</view>
@ -326,6 +310,7 @@
v-model="colItem.show"
:params="paramsArea"
:title="colItem.name"
:area-code="colItem.defaultValue"
></u-picker>
</view>
</view>
@ -354,14 +339,6 @@ export default {
minute: false,
second: false,
},
paramsHour: {
year: true,
month: true,
day: true,
hour: true,
minute: false,
second: false,
},
paramsArea: {
province: true,
city: true,
@ -371,7 +348,17 @@ export default {
};
},
computed: mapGetters('project', ['projectId']),
computed: {
...mapGetters('project', ['projectId']),
startYear() {
var date = new Date();
return date.getFullYear() - 130;
},
endYear() {
var date = new Date();
return date.getFullYear();
},
},
mounted() {
if (this.personalInfo && this.personalInfo.userName) {
@ -401,11 +388,9 @@ export default {
}
case 5: {
//
console.log('e: ', e);
let checkerList = info.value;
console.log('checkerList: ', checkerList);
if (checkerList.length) {
const i = checkerList.findIndex(item => item === e.name);
const i = checkerList.findIndex(item => item === e.name || item.substring(0, 2) === e.name);
if (i < 0) {
checkerList.push(e.name);
} else {
@ -420,15 +405,10 @@ export default {
info.showOther = true;
} else {
info.showOther = false;
info.otherValue = null;
}
break;
}
case 6: {
// ()
const valueHour = e.year + '-' + e.month + '-' + e.day + '-' + e.hour;
info.value = valueHour;
break;
}
case 7: {
//
info.value = e[0].value + '/' + e[1].value;
@ -439,6 +419,7 @@ export default {
info.value = e.province.label + e.city.label;
info.hospitalCityId = e.city.value;
info.hospitalProvinceId = e.province.value;
info.defaultValue = [e.province.value, e.city.value];
break;
}
case 99: {
@ -448,15 +429,6 @@ export default {
}
default: {
info.value = e;
// if (e === '' || e === '' || e === '') {
// info.value = 0;
// }
// if (e === '' || e === '' || e === '') {
// info.value = 1;
// }
// if (e === '' || e === '') {
// info.value = 2;
// }
if (type === 1) {
if (e === '其他') {
info.showOther = true;
@ -494,7 +466,11 @@ export default {
}
}
info[type] = e;
this.$emit('saveInfo', info);
if (!this.isEdit) {
this.$emit('saveInfo', info);
} else {
this.updateTrainee(info);
}
},
//
@ -550,9 +526,12 @@ export default {
item.showOther = false;
}
}
if (item.type === 4) {
const index = item.radioList.findIndex(list => list.value === date[item.label]);
item.defaultValue = index;
}
if (item.type === 5) {
const array = date[item.label].split(',');
console.log('array: ', array);
item.value = array;
for (let i = 0; i < item.checkList.length; i++) {
const A = item.checkList[i];
@ -561,11 +540,59 @@ export default {
if (A.name === arr) {
A.checked = true;
}
if (A.name === arr.substring(0, 2) && A.name === '其他') {
A.checked = true;
item.showOther = true;
item.otherValue = arr.split(':')[1];
}
}
}
}
if (item.type === 7) {
item.value = date.minBloodPressure + '/' + date.maxBloodPressure;
item.defaultValue = [date.minBloodPressure, date.maxBloodPressure];
}
if (item.type === 9) {
item.defaultValue = [date.hospitalProvinceId, date.hospitalCityId];
}
if (item.type === 10 && date[item.label] === 1) {
item.value1 = date.insomnicPeriod;
}
if (item.type === 11) {
if (date[item.label] === 1) {
item.value1 = date.quitPeriod;
}
if (date[item.label] === 2) {
item.value2 = date.sustainPeriod;
item.value3 = date.averageNum;
}
}
if (item.type === 12) {
if (date[item.label] === 1) {
item.value1 = date.abstinencePeriod;
}
if (date[item.label] === 2) {
item.showClasses = true;
const list = item.radioList.find(list => list === date.drinkType);
if (list) {
item.classesValue = date.drinkType;
} else {
item.classesValue = '其他';
item.showOther = true;
item.otherValue = date.drinkType;
}
}
}
if (item.type === 13) {
if (date[item.label] === 1) {
item.value1 = date.quitTea;
}
if (date[item.label] === 2) {
item.value2 = date.continuePeriod;
item.showClasses = true;
item.classesValue = date.teaType;
item.frequencyValue = date.teaPeriod;
}
}
}
}
@ -576,14 +603,12 @@ export default {
*/
async updateTrainee(item) {
try {
console.log('item: ', item);
if (!this.validationRequired(item)) return;
const params = this.setParams(item);
await this.$u.api.updateTrainee(params);
this.$emit('showToast', 'success', `${item.name}修改成功`);
} catch (error) {
console.log('error: ', error);
this.$emit('showToast', 'error', `${item.name}修改失败`);
console.error('error: ', error);
this.$t.ui.showToast(`${item.name}修改失败`);
}
},
@ -593,6 +618,40 @@ export default {
this.$t.ui.showToast(`请填写其他${item.name}`);
return;
}
if (item.type === 10 || item.type === 11 || item.type === 12 || item.type === 13) {
if (item.value === 1 && !item.value1) {
this.$t.ui.showToast(`请填写${item.name}`);
return;
}
}
if (item.showClasses && !item.classesValue) {
this.$t.ui.showToast(`请填写${item.name}种类`);
return;
}
if (item.type === 13) {
if (item.showClasses && !item.frequencyValue) {
this.$t.ui.showToast(`请填写${item.name}频率`);
return;
}
}
if (item.type === 11) {
if (item.value === 2) {
if (!item.value2) {
this.$t.ui.showToast(`请填写烟龄`);
return;
}
if (!item.value3) {
this.$t.ui.showToast(`请填写每天抽烟数量`);
return;
}
}
}
if (item.type === 13) {
if (item.value === 2 && !item.value2) {
this.$t.ui.showToast(`请填写持续喝茶时长`);
return;
}
}
return true;
},
@ -621,6 +680,39 @@ export default {
arrValue = item.value.toString();
params[item.label] = arrValue;
}
//
if (item.type === 9) {
params.hospitalCityId = item.hospitalCityId;
params.hospitalProvinceId = item.hospitalProvinceId;
}
//
if (item.type === 10) {
params.insomnicPeriod = item.value1;
}
//
if (item.type === 11) {
params.quitPeriod = item.value1;
params.sustainPeriod = item.value2;
params.averageNum = item.value3;
}
//
if (item.type === 12) {
params.abstinencePeriod = item.value1;
if (item.classesValue) {
params.drinkType = item.classesValue;
if (item.classesValue === '其他' && item.showOther && item.otherValue) {
params.drinkType = item.otherValue;
}
}
}
//
if (item.type === 13) {
params.quitTea = item.value1;
params.continuePeriod = item.value2;
params.teaType = item.classesValue;
params.teaPeriod = item.frequencyValue;
}
return params;
},
},
@ -628,10 +720,3 @@ export default {
</script>
<style lang="scss" scoped></style>
<style>
/* .radio-style >>> .uni-radio-input {
width: 1rem !important;
height: 1rem !important;
} */
</style>

108
src/config/yyInfo.js

@ -11,6 +11,17 @@ const bloodPressure = () => {
return results;
};
// 受教育年限
const educateYears = () => {
let item = null;
let results = [];
for (let i = 0; i < 31; i++) {
item = { value: i.toString(), label: i.toString() };
results.push(item);
}
return results;
};
/**
* 基本信息
* 展示类型: showType: 1 标题+折叠, 2 直接展示
@ -37,7 +48,7 @@ export const infoList = [
{ id: 0, value: '未知' },
],
value: null,
show: false,
show: true,
},
{
name: '出生日期',
@ -70,7 +81,7 @@ export const infoList = [
type: 1,
radioList: ['干部', '军人', '技术人员', '农民', '工人', '运动员', '个体商业人员', '其他'],
value: null,
show: false,
show: true,
showOther: false,
otherValue: null,
},
@ -81,7 +92,7 @@ export const infoList = [
type: 1,
radioList: ['文盲', '小学', '初中', '高中或中专', '大学或大专', '大学以上', '其他'],
value: null,
show: false,
show: true,
showOther: false,
otherValue: null,
},
@ -90,39 +101,9 @@ export const infoList = [
label: 'educateDate',
showType: 2,
type: 4,
radioList: [
{ value: 1, label: 1 },
{ value: 2, label: 2 },
{ value: 3, label: 3 },
{ value: 4, label: 4 },
{ value: 5, label: 5 },
{ value: 6, label: 6 },
{ value: 7, label: 7 },
{ value: 8, label: 8 },
{ value: 9, label: 9 },
{ value: 10, label: 10 },
{ value: 11, label: 11 },
{ value: 12, label: 12 },
{ value: 13, label: 13 },
{ value: 14, label: 14 },
{ value: 15, label: 15 },
{ value: 16, label: 16 },
{ value: 17, label: 17 },
{ value: 18, label: 18 },
{ value: 19, label: 19 },
{ value: 20, label: 20 },
{ value: 21, label: 21 },
{ value: 22, label: 22 },
{ value: 23, label: 23 },
{ value: 24, label: 24 },
{ value: 25, label: 25 },
{ value: 26, label: 26 },
{ value: 27, label: 27 },
{ value: 28, label: 28 },
{ value: 29, label: 29 },
{ value: 30, label: 30 },
],
radioList: educateYears(),
value: null,
defaultValue: 14,
show: false,
},
{
@ -132,7 +113,7 @@ export const infoList = [
type: 1,
radioList: ['城市', '农村', '郊区'],
value: null,
show: false,
show: true,
},
],
[
@ -140,7 +121,7 @@ export const infoList = [
name: '出现认知障碍时间',
label: 'appearTime',
showType: 2,
type: 6,
type: 2,
value: null,
show: false,
},
@ -148,7 +129,7 @@ export const infoList = [
name: '首次诊断痴呆时间',
label: 'diagnoseTime',
showType: 2,
type: 6,
type: 2,
value: null,
show: false,
},
@ -159,7 +140,7 @@ export const infoList = [
type: 1,
radioList: ['阿尔茨海默病', '路易体痴呆', '额颞痴呆', '血管性痴呆', '混合性痴呆', '其他'],
value: null,
show: false,
show: true,
showOther: false,
otherValue: null,
},
@ -171,6 +152,7 @@ export const infoList = [
showType: 2,
type: 7,
value: null,
defaultValue: [70, 100],
show: false,
radioList: bloodPressure(),
},
@ -191,7 +173,7 @@ export const infoList = [
type: 1,
radioList: ['强', '中', '低'],
value: null,
show: false,
show: true,
},
{
name: 'APOE基因',
@ -204,7 +186,7 @@ export const infoList = [
{ id: '2', value: '不知道' },
],
value: '否',
show: false,
show: true,
},
],
[
@ -228,7 +210,7 @@ export const infoList = [
{ name: '其他', checked: false, disabled: false },
],
value: [],
show: false,
show: true,
showOther: false,
otherValue: null,
},
@ -252,7 +234,7 @@ export const infoList = [
{ name: '其他', checked: false, disabled: false },
],
value: [],
show: false,
show: true,
showOther: false,
otherValue: null,
},
@ -265,7 +247,7 @@ export const infoList = [
type: 10,
value: 0,
value1: null,
show: false,
show: true,
},
{
name: '吸烟',
@ -276,7 +258,7 @@ export const infoList = [
value1: null,
value2: null,
value3: null,
show: false,
show: true,
},
{
name: '饮酒',
@ -285,7 +267,7 @@ export const infoList = [
type: 12,
value: 0,
value1: null,
show: false,
show: true,
showClasses: false,
classesValue: null,
radioList: ['白酒', '啤酒', '红酒', '其他'],
@ -300,7 +282,7 @@ export const infoList = [
value: 0,
value1: null,
value2: null,
show: false,
show: true,
showClasses: false,
classesValue: null,
classesList: ['绿茶', '红茶', '不定'],
@ -317,7 +299,7 @@ export const infoList = [
{ id: 1, value: '是' },
],
value: '否',
show: false,
show: true,
},
{
name: '饮食喜好',
@ -329,10 +311,10 @@ export const infoList = [
{ id: 1, value: '荤菜' },
],
value: null,
show: false,
show: true,
},
{
name: '炒菜放油多少',
name: '炒菜多油',
label: 'isMoreOil',
showType: 1,
type: 14,
@ -341,7 +323,7 @@ export const infoList = [
{ id: 1, value: '是' },
],
value: '否',
show: false,
show: true,
},
],
[
@ -367,6 +349,7 @@ export const infoList = [
showType: 2,
type: 9,
value: null,
defaultValue: ['14', '1401'],
show: false,
hospitalCityId: null,
hospitalProvinceId: null,
@ -384,6 +367,7 @@ export const infoList = [
{ value: '其他', label: '其他' },
],
value: null,
defaultValue: 0,
show: false,
},
],
@ -500,55 +484,75 @@ export const medicineInfo = [
/**
* 照顾者信息
* 展示类型: showType: 1 标题+折叠, 2 直接展示
* 试题类型, type:1 单选,2 日期(年月日),3 数字输入框,4 单列下拉框,5 多选,6 日期(年月日时),7 多列下拉选框, 8 文本输入框 9 多列地区选择 11 吸烟 12 饮酒 13 饮茶
* 试题类型, type:1 单选, 3 数字输入框, 8 文本输入框
*/
export const careInfo = [
[
{
name: '姓名',
label: 'careName',
showType: 2,
type: 8,
value: null,
show: false,
},
{
name: '性别',
label: 'careSex',
showType: 1,
type: 1,
radioList: ['男', '女'],
value: null,
show: true,
},
{
name: '年龄',
label: 'careAge',
showType: 2,
type: 3,
value: null,
show: false,
},
{
name: '职业',
label: 'jobTitle',
showType: 1,
type: 1,
radioList: ['干部', '军人', '技术人员', '农民', '工人', '运动员', '个体商业人员', '其他'],
value: null,
showOther: false,
otherValue: null,
show: true,
},
{
name: '文化程度',
label: 'educateLevel',
showType: 1,
type: 1,
radioList: ['文盲', '小学', '初中', '高中或中专', '大学或大专', '大学以上', '其他'],
value: null,
showOther: false,
otherValue: null,
show: true,
},
{
name: '持续照顾时间',
label: 'carePeriod',
showType: 2,
type: 3,
value: null,
show: false,
},
{
name: '与患者关系',
label: 'careRelation',
showType: 1,
type: 1,
radioList: ['子女', '兄弟姐妹', '父母', '伴侣', '孙辈', '朋友', '其他'],
value: null,
showOther: false,
otherValue: null,
show: true,
},
],
];

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

@ -5,7 +5,7 @@
<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">
<view class="flex flex-row items-center">
<view class="flex flex-1 items-center" @click="changeOpen(index)">
<img class="w-5 h-5 mr-2" :src="item.img" alt="" />
{{ item.head }}
</view>
@ -13,7 +13,7 @@
<view v-if="index === 0 && personalInfo && personalInfo.userName" class="text-gray-400 mr-2">
{{ personalInfo.userName }}
</view>
<view v-if="index === 1" class="mr-4">
<view v-if="index === 1 || index === 2" class="mr-4">
<u-icon name="plus" @click="add(index)"></u-icon>
</view>
<u-icon name="arrow-up" v-if="item.open" @click="changeOpen(index)"></u-icon>
@ -23,10 +23,10 @@
<!-- 内容区 -->
<view v-if="item.open" class="w-full mt-3">
<view style="border: 1px solid #e5e5e5" v-if="index === 0">
<Info :personalInfo="personalInfo" @showToast="showToast" />
<Info :personalInfo="personalInfo" />
</view>
<Medicine @showToast="showToast" ref="child" v-if="index === 1" />
<Caregiver @showToast="showToast" v-if="index === 2" />
<Medicine @showToast="showToast" ref="medicineChild" v-if="index === 1" />
<Caregiver @showToast="showToast" ref="caregiverChild" v-if="index === 2" />
<Family @showToast="showToast" v-if="index === 3" />
</view>
</view>
@ -98,8 +98,15 @@ export default {
//
add(index) {
if (this.itemList[index].open) {
this.$refs.child[0].add();
if (index === 1) {
if (this.itemList[index].open) {
this.$refs.medicineChild[0].add();
}
}
if (index === 2) {
if (this.itemList[index].open) {
this.$refs.caregiverChild[0].add();
}
}
},

176
src/pagesProject/project/components/ConfigInfo/components/Caregiver.vue

@ -1,70 +1,152 @@
<template>
<view style="border: 1px solid #e5e5e5">
<view v-for="(item, index) in careInfo" :key="index">
<template v-for="(colItem, itemIndex) in item">
<u-collapse
v-if="colItem.showType === 1"
:key="itemIndex"
:head-style="headStyle"
:body-style="bodyStyle"
:accordion="false"
class="border-b"
>
<u-collapse-item :title="colItem.name" :open="false">
<!-- 单选 -->
<view v-if="colItem.type === 1">
<u-radio-group v-model="colItem.value">
<u-radio
class="mb-2"
@change="change($event, index, itemIndex, colItem.type)"
v-for="(radioItem, radioIndex) in colItem.radioList"
:key="radioIndex"
:name="radioItem"
>
{{ radioItem }}
</u-radio>
</u-radio-group>
<view>
<CaregiverDetail :detail="zaritDetail" :disabled="false" @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" @click="changeOpen(index)">
<!-- 姓名+分数 -->
<view class="flex justify-between flex-1 items-center ml-3 font-bold">
{{ item.careName }}
<view class="mr-3">
得分
<text class="text-blue-500">{{ item.zaritPoint || 0 }}</text>
</view>
</u-collapse-item>
</u-collapse>
<view v-else :key="itemIndex" class="flex justify-between items-center text-sm border-b">
<view class="ml-4 my-3">{{ colItem.name }}</view>
<!-- 数字输入框 -->
<view v-if="colItem.type === 3" class="pr-7">
<u-input v-model="colItem.value" type="number" :clearable="false" input-align="right" />
</view>
<!-- input 文本输入框 -->
<view v-if="colItem.type === 8" class="pr-7">
<u-input v-model="colItem.value" :clearable="false" input-align="right" />
<view class="flex flex-row">
<u-icon name="arrow-up" v-if="item.open"></u-icon>
<u-icon name="arrow-down" v-else></u-icon>
</view>
</view>
</template>
<!-- 内容区 -->
<view v-if="item.open" class="w-full mt-3">
<CaregiverDetail @showToast="showToast" v-if="item && item.id" :detail="item" :disabled="true" />
</view>
</view>
</view>
<u-button type="primary" class="m-4">开始填表</u-button>
</view>
</template>
<script>
import { careInfo } from '@/config/yyInfo';
import { mapState, mapGetters, mapMutations } from 'vuex';
import CaregiverDetail from './CaregiverDetail';
export default {
name: 'Info',
components: { CaregiverDetail },
data() {
return {
show: false,
itemList: [],
headStyle: {
backgroundColor: '#fff',
height: '46px',
paddingLeft: '1rem',
fontSize: '0.875rem',
borderBottom: '1px solid #f8f8f8',
fontSize: '16px',
width: '100%',
},
bodyStyle: { paddingLeft: '1rem' },
careInfo,
index: 0,
zaritDetail: null,
};
},
watch: {
isTest(val) {
if (val) {
this.queryZaritList();
this.setIsTest(false);
}
},
},
computed: {
...mapState('yanyuan', ['isTest']),
...mapGetters('project', ['projectId']),
},
mounted() {
this.queryZaritList();
},
methods: {
change(e, index, itemIndex, type) {
console.log('type: ', type);
this.careInfo[index][itemIndex].value = e;
...mapMutations('yanyuan', ['setIsTest']),
//
changeOpen(index) {
this.index = index;
this.show = false;
this.itemList.forEach((item, i) => {
if (i === index) {
if (!item.open) {
this.queryZaritList();
}
item.open = !item.open;
} else {
item.open = false;
}
});
},
//
showToast(type, title) {
this.$emit('showToast', type, title);
},
//
async add() {
this.itemList.forEach(item => {
item.open = false;
});
// this.show = true;
await this.queryZaritHistory();
},
//
async closeAdd() {
console.log('关闭添加窗口');
this.show = false;
await this.queryZaritList();
},
/**
* 查询照顾者负担表列表
* @param { String } projectId 项目id
*/
async queryZaritList() {
try {
const params = { projectId: this.projectId };
const date = await this.$u.api.queryZaritList(params);
if (!date.length) {
await this.queryZaritHistory();
} 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);
this.$t.ui.showToast(error.msg || '照顾者负担表列表查询失败');
}
},
/**
* 查询负担量表历史记录
* @param { String } projectId 项目id
*/
async queryZaritHistory() {
try {
const params = { projectId: this.projectId };
const date = await this.$u.api.queryZaritHistory(params);
this.zaritDetail = date;
this.show = true;
} catch (error) {
console.error('error: ', error);
this.$t.ui.showToast(error.msg || '负担量表历史记录查询失败');
}
},
},
};

249
src/pagesProject/project/components/ConfigInfo/components/CaregiverDetail.vue

@ -0,0 +1,249 @@
<template>
<view style="border: 1px solid #e5e5e5">
<view v-for="(item, index) in careInfo" :key="index">
<template v-for="(colItem, itemIndex) in item">
<view v-if="!disabled" :key="itemIndex">
<view v-if="colItem.showType === 1" class="flex flex-col text-sm ml-4 border-b">
<view class="my-3 flex justify-between items-center" @click="changeShow(index, itemIndex)">
{{ colItem.name }}
<u-icon name="arrow-up" class="mx-2" color="#909399" v-if="colItem.show"></u-icon>
<u-icon name="arrow-down" class="mx-2" color="#909399" v-else></u-icon>
</view>
<view v-if="colItem.show">
<!-- 单选 -->
<view v-if="colItem.type === 1">
<u-radio-group v-model="colItem.value">
<u-radio
class="mb-2"
@change="change($event, index, itemIndex, colItem.type)"
v-for="(radioItem, radioIndex) in colItem.radioList"
:key="radioIndex"
:name="radioItem"
>
{{ radioItem }}
</u-radio>
</u-radio-group>
<u-input
v-if="colItem.showOther"
:placeholder="`请输入其他${colItem.name}`"
v-model="colItem.otherValue"
:clearable="false"
@blur="change(colItem.otherValue, index, itemIndex, 99)"
/>
</view>
</view>
</view>
<view v-else :key="itemIndex" class="flex justify-between items-center text-sm border-b">
<view class="ml-4 my-3">{{ colItem.name }}</view>
<!-- 数字输入框 -->
<view v-if="colItem.type === 3" class="pr-7">
<u-input
v-model="colItem.value"
type="number"
:clearable="false"
input-align="right"
@blur="change($event, index, itemIndex, colItem.type)"
/>
</view>
<!-- input 文本输入框 -->
<view v-if="colItem.type === 8" class="pr-7">
<u-input
v-model="colItem.value"
:clearable="false"
input-align="right"
@blur="change($event, index, itemIndex, colItem.type)"
/>
</view>
</view>
</view>
<view v-else :key="itemIndex">
<view class="flex justify-between text-sm py-3 px-4 border-b items-center">
{{ colItem.name }}
<view>{{ colItem.value }}</view>
</view>
</view>
</template>
</view>
<view class="p-4" v-if="!disabled">
<u-button type="primary" @click="submit">开始填表</u-button>
</view>
</view>
</template>
<script>
import { mapGetters, mapMutations, mapActions } from 'vuex';
import { careInfo } from '@/config/yyInfo';
export default {
name: 'Info',
props: { detail: { type: Object, default: null }, disabled: { type: Boolean, default: false } },
data() {
return {
headStyle: {
backgroundColor: '#fff',
height: '46px',
paddingLeft: '1rem',
fontSize: '0.875rem',
},
bodyStyle: { paddingLeft: '1rem' },
careInfo,
show: true,
params: {},
};
},
computed: mapGetters('project', ['projectId']),
mounted() {
if (this.detail) {
this.setDate(this.detail);
this.show = false;
} else {
this.show = true;
}
},
methods: {
...mapMutations('yanyuan', ['setCode', 'setReportId']),
...mapActions('yanyuan', ['handleQuestion']),
changeShow(index, itemIndex) {
this.careInfo[index][itemIndex].show = !this.careInfo[index][itemIndex].show;
},
change(e, index, itemIndex, type) {
const info = this.careInfo[index][itemIndex];
switch (type) {
case 99: {
info.otherValue = e;
// this.params[info.label] = e;
break;
}
default: {
if (info.label === 'careSex') {
// this.params[info.label] = e === '' ? 1 : 2;
}
if (e === '其他') {
info.showOther = true;
} else {
info.showOther = false;
}
info.value = e;
// this.params[info.label] = e;
break;
}
}
},
//
setDate(date) {
const { careInfo } = this;
for (let i = 0; i < careInfo.length; i++) {
const info = careInfo[i];
for (let j = 0; j < info.length; j++) {
const item = info[j];
if (item.label === 'careSex') {
item.value = date[item.label] === 1 ? '男' : date[item.label] === 2 ? '女' : null;
} else {
if (item.type === 1 && item.radioList && item.radioList.length) {
const list = item.radioList.find(list => list === date[item.label]);
if (list) {
item.value = date[item.label];
} else {
item.value = '其他';
item.showOther = true;
item.otherValue = date[item.label];
}
} else {
item.value = date[item.label];
}
}
}
}
},
/**
* 添加负担量表
* @param { Object } params
*/
async submit() {
try {
if (!this.validationRequired(this.params)) return;
const params = this.params;
params.projectId = this.projectId;
const data = await this.$u.api.addZarit(params);
if (data) {
this.setReportId(data);
this.setCode('ZARIT');
await this.startAssess(data);
}
} catch (error) {
console.error('error: ', error);
}
},
//
validationRequired() {
let isComplete = true;
for (let i = 0; i < careInfo.length; i++) {
const info = careInfo[i];
for (let j = 0; j < info.length; j++) {
const item = info[j];
if (item.showOther && !item.otherValue) {
this.$t.ui.showToast(`请填写其他${item.name}`);
isComplete = false;
break;
}
if (!item.value) {
this.$t.ui.showToast(`请填写${item.name}`);
isComplete = false;
break;
}
//
this.setParams(item);
}
if (!isComplete) {
break;
}
}
if (isComplete) return true;
},
//
setParams(item) {
this.params[item.label] = item.value;
if (item.label === 'careSex') {
this.params[item.label] = item.value === '男' ? 1 : 2;
}
if (item.value === '其他') {
this.params[item.label] = item.otherValue;
}
},
/**
* 开始填表
* @param { string } code 题目code NLCP:脑力测评 ZARIT:照顾者负担量表
* @param { number } num 题号
* @param { string } reportId 测评ID 脑力测评ID或zaritID
*/
async startAssess(id) {
try {
const params = {
code: 'ZARIT',
reportId: id,
num: '1',
};
const data = await this.handleQuestion(params);
console.log('data: ', data);
uni.navigateTo({ url: '/pagesYanyuan/assess/assess' });
} catch (error) {
console.error('error: ', error);
}
},
},
};
</script>
<style lang="scss" scoped></style>

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

@ -4,14 +4,14 @@
<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">
<view class="w-full flex flex-row items-center justify-between text-sm text-gray-500" @click="changeOpen(index)">
<view class="flex justify-between flex-1 items-center font-bold">
<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>
<u-icon name="arrow-up" v-if="item.open"></u-icon>
<u-icon name="arrow-down" v-else></u-icon>
</view>
</view>
<!-- 内容区 -->

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

@ -4,13 +4,13 @@
<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">
<view class="w-full flex flex-row items-center justify-between text-sm text-gray-500" @click="changeOpen(index)">
<view class="flex flex-row items-center font-bold">
{{ item.createAt }}
</view>
<view class="flex flex-row">
<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>
<u-icon name="arrow-up" v-if="item.open"></u-icon>
<u-icon name="arrow-down" v-else></u-icon>
</view>
</view>
<!-- 内容区 -->

38
src/pagesProject/project/components/Evaluated/EvaluatedNLCP.vue

@ -1,7 +1,19 @@
<template>
<view class="charts-box">
<view class="flex justify-between">
<text class="font-bold">{{ task.name }}</text>
<view>
<u-rate
:count="task.data.mentalTest.gradeResult"
v-model="task.data.mentalTest.gradeResult"
:disabled="true"
:size="26"
:gutter="2"
active-color="#1890FF"
>
<!-- v-if="!task.data.showDetail" -->
</u-rate>
<text class="mx-2 font-bold">{{ task.name }}</text>
</view>
<u-icon name="arrow-up" color="#909399" v-if="task.data.showDetail" @click="changeShowState"></u-icon>
<u-icon name="arrow-down" color="#909399" v-else @click="changeShowState"></u-icon>
</view>
@ -15,19 +27,17 @@
:ref="obj.id"
:max="obj.max"
/>
</view>
<view class="mt-2">
<view>测评结果</view>
<u-rate
:count="task.data.mentalTest.gradeResult"
v-model="task.data.mentalTest.gradeResult"
:disabled="true"
:size="26"
:gutter="2"
active-color="#1890FF"
></u-rate>
<view class="mt-2">
<view>测评结果</view>
<u-rate
:count="task.data.mentalTest.gradeResult"
v-model="task.data.mentalTest.gradeResult"
:disabled="true"
:size="26"
:gutter="2"
active-color="#1890FF"
></u-rate>
</view>
</view>
</view>
</template>

2
src/pagesProject/project/components/Evaluated/components/UCharts.vue

@ -71,7 +71,7 @@ export default {
context: uni.createCanvasContext(this.canvasId, this),
type: 'radar',
fontSize: 11,
padding: [20, 0, 0, 0],
padding: [-20, -15, -40, -10],
legend: { show: false },
background: '#FFFFFF',
pixelRatio: this.pixelRatio,

5
src/pagesProject/project/components/NotEvaluated/NotEvaluated.vue

@ -22,6 +22,7 @@ export default {
methods: {
...mapActions('yanyuan', ['handleQuestion']),
...mapMutations('yanyuan', ['setCode']),
...mapMutations('task', ['setTask']),
/**
@ -34,13 +35,13 @@ export default {
try {
const { task } = this;
this.setTask(task);
this.setCode('NLCP');
const params = {
code: 'NLCP',
reportId: task.id,
num: '1',
};
const data = await this.handleQuestion(params);
console.log('data: ', data);
await this.handleQuestion(params);
uni.navigateTo({ url: '/pagesYanyuan/assess/assess' });
} catch (error) {
console.error('error: ', error);

2
src/pagesProject/project/components/Roles/Roles.vue

@ -22,7 +22,7 @@
>
<view
class="tab-children u-skeleton-fillet u-font-14"
:style="{ 'border-bottom': item.id === roleId ? '2px solid #0284c7;' : '' }"
:style="{ 'border-bottom': item.id === roleId ? '2px solid #1890ff;' : '' }"
>
{{ item.name }}
</view>

7
src/pagesProject/project/components/TimeLine/component/TimeStatus.vue

@ -1,10 +1,7 @@
<template>
<view class="u-font-14">
<view
class="flex items-center justify-center rounded-full icon-column"
:style="{ color: orderStyle.color }"
@click="changeStatus(task.process, $event)"
>
<view class="flex items-center justify-center rounded-full icon-column" :style="{ color: orderStyle.color }">
<!-- @click="changeStatus(task.process, $event)" -->
<!-- 1进行中 2暂停中 3已完成 -->
<u-circle-progress
:percent="orderStyle.persent - 0"

2
src/pagesProject/project/project.vue

@ -223,7 +223,7 @@ export default {
timeNode: query.timeNode || timeNode,
timeUnit: query.timeUnit || timeUnit,
// queryNum: query.queryNum || 3,
queryNum: 1,
queryNum: 3,
queryType: query.queryType,
projectId,
templateCode: project.templateCode,

54
src/pagesYanyuan/assess/assess.vue

@ -39,14 +39,14 @@ export default {
computed: {
...mapState('project', ['project']),
...mapState('yanyuan', ['questionInfo', 'optionId']),
...mapState('yanyuan', ['questionInfo', 'optionId', 'code', 'reportId']),
...mapState('task', ['task']),
...mapGetters('user', ['userId']),
},
methods: {
...mapMutations('task', ['setIsEvaluated']),
...mapMutations('yanyuan', ['setQuestionInfo', 'setAssessResult', 'setOptionId']),
...mapMutations('yanyuan', ['setQuestionInfo', 'setAssessResult', 'setOptionId', 'setIsTest']),
...mapActions('yanyuan', ['handleQuestion']),
//
@ -56,12 +56,12 @@ export default {
//
setParams() {
const { optionId, questionInfo, task } = this;
const { questionInfo, task, code, optionId, reportId } = this;
this.param = {
code: 'NLCP',
code: code,
optionId: optionId,
questionId: questionInfo.id,
reportId: task.id,
reportId: code === 'NLCP' ? task.id : reportId,
};
return this.param;
},
@ -91,15 +91,19 @@ export default {
}
},
//
//
async next() {
const { questionInfo, task } = this;
const { questionInfo, task, code, reportId } = this;
if (questionInfo.numStatus === 2) {
await this.submitAnswer();
if (code === 'NLCP') {
await this.submitAnswer();
} else {
await this.calculateScore();
}
} else {
const params = {
code: 'NLCP',
reportId: task.id,
code,
reportId: code === 'NLCP' ? task.id : reportId,
num: questionInfo.num + 1,
};
await this.handleQuestion(params);
@ -115,11 +119,33 @@ export default {
this.$refs.uTips.show({
title: '答案提交成功, 即将返回上一页',
type: 'success',
duration: '2000',
duration: '3000',
});
setTimeout(() => {
this.backProject();
}, 3000);
} catch (error) {
console.error('error: ', error);
this.$t.ui.showToast(error.msg || '提交失败');
}
},
// Zarit
async calculateScore() {
try {
const params = { careId: this.reportId };
const data = await this.$u.api.calculateScore(params);
this.$refs.uTips.show({
title: `提交成功, Zarit分数为${data.score}`,
type: 'success',
duration: '3000',
});
setTimeout(() => {
this.back();
}, 2000);
if (this.code === 'ZARIT') {
this.setIsTest(true);
this.$t.page.back();
}
}, 3000);
} catch (error) {
console.error('error: ', error);
this.$t.ui.showToast(error.msg || '提交失败');
@ -127,7 +153,7 @@ export default {
},
//
back() {
backProject() {
this.setIsEvaluated(true);
const { name, id, url } = this.project;

3
src/pagesYanyuan/assess/components/Test/components/TestMain.vue

@ -9,7 +9,8 @@
:name="item.id"
:class="[`col-span-${item.col}`]"
>
{{ item.content }}
<text v-if="item.showType === 0">{{ item.content }}</text>
<img class="w-full" :src="item.content" v-else />
</u-radio>
</u-radio-group>
</view>

3
src/pagesYanyuan/assess/components/Test/components/TitlePosition.vue

@ -11,7 +11,8 @@
<view class="grid" :class="item.contents.length > 4 ? 'grid-cols-3' : item.contents.length > 1 ? 'grid-cols-2' : ''">
<view v-for="(con, conIndex1) in item.contents" :key="conIndex1">
<view v-if="con.showType === 1">
<img class="w-full" style="height: 10rem" :src="con.content" />
<!-- style="height: 10rem" -->
<img class="w-full" :src="con.content" />
</view>
</view>
</view>

27
src/store/yanyuan/mutations.js

@ -97,6 +97,33 @@ const mutations = {
setOptionId(state, data) {
state.optionId = data;
},
/**
* 设置code
* @param {boolean} state
* @param {object} data
*/
setCode(state, data) {
state.code = data;
},
/**
* 设置测评ID 脑力测评ID或zaritID
* @param {boolean} state
* @param {object} data
*/
setReportId(state, data) {
state.reportId = data;
},
/**
* 设置zarit是否测评
* @param {object} state
* @param {array} show
*/
setIsTest(state, show) {
state.isTest = show;
},
};
export default mutations;

3
src/store/yanyuan/state.js

@ -11,6 +11,9 @@ const state = {
questionInfo: null, // 试题信息
assessResult: null, // 测评结果
optionId: '', // 选项id
code: 'NLCP',
reportId: '', // 测评ID 脑力测评ID或zaritID
isTest: false, // zarit是否测评
};
export default state;

2
src/uni.scss

@ -15,7 +15,7 @@
@import './common/styles/tailwind.scss';
/* 颜色变量 */ /* 行为相关颜色 */
$uni-color-primary: #0284c7;
$uni-color-primary: #1890ff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;

Loading…
Cancel
Save