12 changed files with 1557 additions and 448 deletions
@ -0,0 +1,394 @@ |
|||
<template> |
|||
<div> |
|||
<div> |
|||
<div |
|||
class="item-container" |
|||
v-for="(item, index) in questions" |
|||
:key="index" |
|||
> |
|||
<div class="item-title">{{ item.index }}. {{ item.question }}</div> |
|||
<div class="item-radio-box"> |
|||
<el-radio-group v-model="form[`topic${item.index}`]"> |
|||
<el-radio |
|||
v-for="(criteria, index) in item.criteria" |
|||
:key="index" |
|||
:label="criteria.value" |
|||
>{{ criteria.label }} |
|||
</el-radio> |
|||
</el-radio-group> |
|||
</div> |
|||
</div> |
|||
<div class="submit-box"> |
|||
<el-button class="submit-box-but" type="primary" @click="submitForm" |
|||
>提交</el-button |
|||
> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: "PHQ9", |
|||
props: ["scaleCode"], |
|||
data() { |
|||
return { |
|||
form: {}, |
|||
questions: [ |
|||
{ |
|||
index: 1, |
|||
question: "以下哪一项能够最准确描述你在过去六个月所感受到的疼痛", |
|||
criteria: [ |
|||
{ label: "无疼痛", value: 1 }, |
|||
{ label: "轻微", value: 2 }, |
|||
{ label: "中等", value: 3 }, |
|||
{ label: "中等至严重", value: 4 }, |
|||
{ label: "严重", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 2, |
|||
question: "以下哪一项能够最准确描述你在过去一个月所感受到的疼痛", |
|||
criteria: [ |
|||
{ label: "无疼痛", value: 1 }, |
|||
{ label: "轻微", value: 2 }, |
|||
{ label: "中等", value: 3 }, |
|||
{ label: "中等至严重", value: 4 }, |
|||
{ label: "严重", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 3, |
|||
question: "总体来说,在过去六个月期间你感到十分焦虑吗", |
|||
criteria: [ |
|||
{ label: "完全没有", value: 1 }, |
|||
{ label: "小部分时间", value: 2 }, |
|||
{ label: "有时", value: 3 }, |
|||
{ label: "大部分时间", value: 4 }, |
|||
{ label: "全部时间", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 4, |
|||
question: |
|||
"如果你必须在背部维持现状不变的情况下继续生活,你会有什么感受", |
|||
criteria: [ |
|||
{ label: "十分愉快", value: 1 }, |
|||
{ label: "某种程度上愉快", value: 2 }, |
|||
{ label: "没有愉快或不愉快", value: 3 }, |
|||
{ label: "某种程度不愉快", value: 4 }, |
|||
{ label: "十分不愉快", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 5, |
|||
question: "你现时的活动能力如何", |
|||
criteria: [ |
|||
{ label: "只限于床上", value: 1 }, |
|||
{ label: "基本上不活动", value: 2 }, |
|||
{ label: "轻度的运动及劳动,如家务活", value: 3 }, |
|||
{ label: "中度的运动及劳动,如骑车", value: 4 }, |
|||
{ label: "活动不受限制", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 6, |
|||
question: "你在穿上衣服后的外观如何", |
|||
criteria: [ |
|||
{ label: "很好", value: 1 }, |
|||
{ label: "好", value: 2 }, |
|||
{ label: "可以接受", value: 3 }, |
|||
{ label: "差劲", value: 4 }, |
|||
{ label: "十分差劲", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 7, |
|||
question: |
|||
"在过去六个月期间你曾感到十分沮丧以至于任何事物也不能让你开心吗", |
|||
criteria: [ |
|||
{ label: "总是", value: 1 }, |
|||
{ label: "经常", value: 2 }, |
|||
{ label: "有时", value: 3 }, |
|||
{ label: "很少数时间", value: 4 }, |
|||
{ label: "完全没有", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 8, |
|||
question: "你在休息时背部有疼痛吗", |
|||
criteria: [ |
|||
{ label: "总是有", value: 1 }, |
|||
{ label: "经常有", value: 2 }, |
|||
{ label: "有时有", value: 3 }, |
|||
{ label: "很少数时间有", value: 4 }, |
|||
{ label: "完全没有", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 9, |
|||
question: "你现阶段在工作单位/学校的活动能力为多少", |
|||
criteria: [ |
|||
{ label: "正常的100%", value: 1 }, |
|||
{ label: "正常的75%", value: 2 }, |
|||
{ label: "正常的50%", value: 3 }, |
|||
{ label: "正常的25%", value: 4 }, |
|||
{ label: "正常的0%", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 10, |
|||
question: "以下哪一项最能够描述你躯干的外观", |
|||
criteria: [ |
|||
{ label: "很好", value: 1 }, |
|||
{ label: "好", value: 2 }, |
|||
{ label: "可以接受", value: 3 }, |
|||
{ label: "差劲", value: 4 }, |
|||
{ label: "十分差劲", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 11, |
|||
question: "下列哪一项最能准确地描述你因背部疼痛而所需要服用的药物", |
|||
criteria: [ |
|||
{ label: "无", value: 1 }, |
|||
{ label: "一般止痛药(每星期服用一次或更少)", value: 2 }, |
|||
{ label: "一般止痛药(天天服用)", value: 3 }, |
|||
{ label: "特效止痛药(每星期服用一次或更少)", value: 4 }, |
|||
{ label: "特效止痛药(天天服用)", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 12, |
|||
question: "你的背部疼痛是否影响你做家务的能力", |
|||
criteria: [ |
|||
{ label: "没有影响", value: 1 }, |
|||
{ label: "少许影响", value: 2 }, |
|||
{ label: "有时有影响", value: 3 }, |
|||
{ label: "常有影响", value: 4 }, |
|||
{ label: "总是有影响", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 13, |
|||
question: "总体来说,你在过去六个月期间感到安宁和平静吗", |
|||
criteria: [ |
|||
{ label: "一直", value: 1 }, |
|||
{ label: "大多数时间", value: 2 }, |
|||
{ label: "有时", value: 3 }, |
|||
{ label: "很少数时间", value: 4 }, |
|||
{ label: "完全没有", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 14, |
|||
question: "你是否感到你背部的状况对你的人际关系构成影响", |
|||
criteria: [ |
|||
{ label: "没有影响", value: 1 }, |
|||
{ label: "少许影响", value: 2 }, |
|||
{ label: "某种程度上有影响", value: 3 }, |
|||
{ label: "很大程度上有影响", value: 4 }, |
|||
{ label: "非常有影响", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 15, |
|||
question: "你以及/或你家人是否因为你背部的问题而在经济方面遇到困难", |
|||
criteria: [ |
|||
{ label: "极有", value: 1 }, |
|||
{ label: "很大程度上有", value: 2 }, |
|||
{ label: "某种程度上有", value: 3 }, |
|||
{ label: "少许", value: 4 }, |
|||
{ label: "没有", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 16, |
|||
question: "总体来说,在过去六个月时间你是否感到失落和灰心", |
|||
criteria: [ |
|||
{ label: "完全没有", value: 1 }, |
|||
{ label: "很少数时间", value: 2 }, |
|||
{ label: "有时", value: 3 }, |
|||
{ label: "经常", value: 4 }, |
|||
{ label: "绝大多数时间", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 17, |
|||
question: |
|||
"在过去三个月时间你是否因背痛而向学校/公司请假?如有,共有多少天", |
|||
criteria: [ |
|||
{ label: "0天", value: 1 }, |
|||
{ label: "1天", value: 2 }, |
|||
{ label: "2天", value: 3 }, |
|||
{ label: "3天", value: 4 }, |
|||
{ label: "4天或以上", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 18, |
|||
question: "你背部的状况是否阻碍你和家人/朋友外出", |
|||
criteria: [ |
|||
{ label: "从来没有", value: 1 }, |
|||
{ label: "很少数时间", value: 2 }, |
|||
{ label: "有时", value: 3 }, |
|||
{ label: "经常", value: 4 }, |
|||
{ label: "总是", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 19, |
|||
question: "你现在背部的状况是否让你觉得自己仍有吸引力", |
|||
criteria: [ |
|||
{ label: "是,很有吸引力", value: 1 }, |
|||
{ label: "是,某种程度上有吸引力", value: 2 }, |
|||
{ label: "可能有,也可能没有", value: 3 }, |
|||
{ label: "否,没有什么吸引力", value: 4 }, |
|||
{ label: "否,完全没有吸引力", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 20, |
|||
question: "总体来说,你在过去的六个月里感到愉快吗", |
|||
criteria: [ |
|||
{ label: "完全没有", value: 1 }, |
|||
{ label: "很少数时间", value: 2 }, |
|||
{ label: "有时", value: 3 }, |
|||
{ label: "大多数时间", value: 4 }, |
|||
{ label: "所有时间", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 21, |
|||
question: "你对你背部治疗的成效感到满意吗", |
|||
criteria: [ |
|||
{ label: "十分满意", value: 1 }, |
|||
{ label: "满意", value: 2 }, |
|||
{ label: "满意,也可能不满意", value: 3 }, |
|||
{ label: "不满意", value: 4 }, |
|||
{ label: "非常不满意", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 22, |
|||
question: "如果你的背部再次遇到同类情况你是否接受同样的治疗", |
|||
criteria: [ |
|||
{ label: "一定会", value: 1 }, |
|||
{ label: "可能会", value: 2 }, |
|||
{ label: "不清楚", value: 3 }, |
|||
{ label: "可能不会", value: 4 }, |
|||
{ label: "一定不会", value: 5 }, |
|||
], |
|||
}, |
|||
], |
|||
scaleData: {}, |
|||
}; |
|||
}, |
|||
created() { |
|||
this.treatmentId = this.$route.query.treatmentId; // 诊疗id |
|||
let scaleData = localStorage.getItem("scaleData"); // 获取上次填写的数据 |
|||
// 如果scaleData存在,则解析成对象,否则创建一个空对象 |
|||
this.scaleData = scaleData |
|||
? JSON.parse(scaleData) |
|||
: { |
|||
[this.treatmentId]: {}, |
|||
}; |
|||
|
|||
// 如果scaleData[this.treatmentId]不存在,则创建一个空对象 |
|||
if (!this.scaleData[this.treatmentId]) { |
|||
this.scaleData[this.treatmentId] = {}; |
|||
} |
|||
this.form = this.scaleData[this.treatmentId][this.scaleCode] || {}; // 将上次填写的数据赋值给form |
|||
}, |
|||
methods: { |
|||
// 维度得分计算: |
|||
// 每个维度的得分是该维度内所有问题得分的平均值。例如,功能维度包含多个问题,将这些问题的得分相加后除以问题数量,得到该维度的平均得分。 |
|||
|
|||
// 总得分计算: |
|||
// SRS-22量表的总得分是五个维度得分的平均值。 |
|||
submitForm() { |
|||
let score = 0; |
|||
// 功能/活动 第5、9、12、15、18题 |
|||
// 疼痛 第1、2、8、11、17题 |
|||
// 自我形象/外观 第4、6、10、14、19题 |
|||
// 心理健康 第3、7、13、16、20题 |
|||
// 治疗满意度 第21、22题 |
|||
|
|||
// 2. 维度得分计算: |
|||
// 每个维度的得分是该维度内所有问题得分的平均值。例如,功能维度包含多个问题,将这些问题的得分相加后除以问题数量,得到该维度的平均得分。 |
|||
// 计算各维度得分 |
|||
const calculateDimensionScore = (questionIndices) => { |
|||
let sum = 0; |
|||
let count = 0; |
|||
questionIndices.forEach((index) => { |
|||
if (this.form[`topic${index}`] !== undefined) { |
|||
sum += this.form[`topic${index}`]; |
|||
count++; |
|||
} |
|||
}); |
|||
return count > 0 ? sum / count : 0; |
|||
}; |
|||
// 各维度对应的题号 |
|||
const dimensions = { |
|||
function: [5, 9, 12, 15, 18], // 功能/活动 |
|||
pain: [1, 2, 8, 11, 17], // 疼痛 |
|||
appearance: [4, 6, 10, 14, 19], // 自我形象/外观 |
|||
mentalHealth: [3, 7, 13, 16, 20], // 心理健康 |
|||
satisfaction: [21, 22], // 治疗满意度 |
|||
}; |
|||
// 计算各维度得分 |
|||
const dimensionScores = { |
|||
function: calculateDimensionScore(dimensions.function), |
|||
pain: calculateDimensionScore(dimensions.pain), |
|||
appearance: calculateDimensionScore(dimensions.appearance), |
|||
mentalHealth: calculateDimensionScore(dimensions.mentalHealth), |
|||
satisfaction: calculateDimensionScore(dimensions.satisfaction), |
|||
}; |
|||
|
|||
// 3. 总得分计算: |
|||
// SRS-22量表的总得分是五个维度得分的平均值 |
|||
// 计算总得分 |
|||
const totalScore = |
|||
(dimensionScores.function + |
|||
dimensionScores.pain + |
|||
dimensionScores.appearance + |
|||
dimensionScores.mentalHealth + |
|||
dimensionScores.satisfaction) / |
|||
5; |
|||
console.log("totalScore", totalScore); |
|||
|
|||
// 存储数据 |
|||
this.scaleData[this.treatmentId][this.scaleCode] = this.form; |
|||
localStorage.setItem("scaleData", JSON.stringify(this.scaleData)); |
|||
// // 将数据传递给父组件 |
|||
this.$emit("getScaleResult", totalScore, this.scaleCode); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped src="@/assets/styles/common.css"></style> |
|||
|
|||
<style scoped> |
|||
.item-title { |
|||
font-size: 20px; |
|||
font-weight: bold; |
|||
color: #3d3d3d; |
|||
line-height: 26px; |
|||
} |
|||
.item-radio-box { |
|||
margin: 16px 0px; |
|||
} |
|||
>>> .el-radio__label { |
|||
font-size: 18px; |
|||
color: #555555; |
|||
line-height: 20px; |
|||
} |
|||
.submit-box { |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
.submit-box-but { |
|||
width: 200px; |
|||
} |
|||
} |
|||
</style> |
After Width: | Height: | Size: 21 KiB |
@ -0,0 +1,146 @@ |
|||
<template> |
|||
<div> |
|||
<!-- |
|||
1. 后方视角(SET 1) |
|||
图形1 图形2 图形3 图形4 图形5 |
|||
2. 弯腰时从上方视角(SET 2) |
|||
图形1 图形2 图形3 图形4 图形5 |
|||
3. 前方视角(根据性别选择 SET 3) |
|||
图形1 图形2 图形3 图形4 图形5 |
|||
--> |
|||
<div> |
|||
<div style=""> |
|||
<img src="./TAPS.png" alt="" /> |
|||
</div> |
|||
|
|||
<div |
|||
class="item-container" |
|||
v-for="(item, index) in questions" |
|||
:key="index" |
|||
> |
|||
<div class="item-title">{{ item.index }}. {{ item.question }}</div> |
|||
<div class="item-radio-box"> |
|||
<el-radio-group v-model="form[`topic${item.index}`]"> |
|||
<el-radio |
|||
v-for="(criteria, index) in item.criteria" |
|||
:key="index" |
|||
:label="criteria.value" |
|||
>{{ criteria.label }} |
|||
</el-radio> |
|||
</el-radio-group> |
|||
</div> |
|||
</div> |
|||
<div class="submit-box"> |
|||
<el-button class="submit-box-but" type="primary" @click="submitForm" |
|||
>提交</el-button |
|||
> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: "phq", |
|||
props: ["scaleCode"], |
|||
data() { |
|||
return { |
|||
form: {}, |
|||
questions: [ |
|||
{ |
|||
index: 1, |
|||
question: "后方视角(SET 1)", |
|||
criteria: [ |
|||
{ label: "图形1", value: 1 }, |
|||
{ label: "图形2", value: 2 }, |
|||
{ label: "图形3", value: 3 }, |
|||
{ label: "图形4", value: 4 }, |
|||
{ label: "图形5", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 2, |
|||
question: "弯腰时从上方视角(SET 2)", |
|||
criteria: [ |
|||
{ label: "图形1", value: 1 }, |
|||
{ label: "图形2", value: 2 }, |
|||
{ label: "图形3", value: 3 }, |
|||
{ label: "图形4", value: 4 }, |
|||
{ label: "图形5", value: 5 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 3, |
|||
question: "前方视角(根据性别选择 SET 3)", |
|||
criteria: [ |
|||
{ label: "图形1", value: 1 }, |
|||
{ label: "图形2", value: 2 }, |
|||
{ label: "图形3", value: 3 }, |
|||
{ label: "图形4", value: 4 }, |
|||
{ label: "图形5", value: 5 }, |
|||
], |
|||
}, |
|||
], |
|||
scaleData: {}, |
|||
}; |
|||
}, |
|||
created() { |
|||
this.treatmentId = this.$route.query.treatmentId; // 诊疗id |
|||
let scaleData = localStorage.getItem("scaleData"); // 获取上次填写的数据 |
|||
// 如果scaleData存在,则解析成对象,否则创建一个空对象 |
|||
this.scaleData = scaleData |
|||
? JSON.parse(scaleData) |
|||
: { |
|||
[this.treatmentId]: {}, |
|||
}; |
|||
|
|||
// 如果scaleData[this.treatmentId]不存在,则创建一个空对象 |
|||
if (!this.scaleData[this.treatmentId]) { |
|||
this.scaleData[this.treatmentId] = {}; |
|||
} |
|||
this.form = this.scaleData[this.treatmentId][this.scaleCode] || {}; // 将上次填写的数据赋值给form |
|||
}, |
|||
methods: { |
|||
submitForm() { |
|||
let score = 0; |
|||
// 计算总分, topic${i}属性不一定存在,先校验是否存在 |
|||
for (let i = 1; i <= 8; i++) { |
|||
if (this.form[`topic${i}`] !== undefined) { |
|||
score += this.form[`topic${i}`]; |
|||
} |
|||
} |
|||
// 存储数据 |
|||
this.scaleData[this.treatmentId][this.scaleCode] = this.form; |
|||
localStorage.setItem("scaleData", JSON.stringify(this.scaleData)); |
|||
// 将数据传递给父组件 |
|||
this.$emit("getScaleResult", score, this.scaleCode); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped src="@/assets/styles/common.css"></style> |
|||
|
|||
<style scoped> |
|||
.item-title { |
|||
font-size: 20px; |
|||
font-weight: bold; |
|||
color: #3d3d3d; |
|||
line-height: 26px; |
|||
} |
|||
.item-radio-box { |
|||
margin: 16px 0px; |
|||
} |
|||
>>> .el-radio__label { |
|||
font-size: 18px; |
|||
color: #555555; |
|||
line-height: 20px; |
|||
} |
|||
.submit-box { |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
.submit-box-but { |
|||
width: 200px; |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,146 @@ |
|||
<template> |
|||
<div> |
|||
<div> |
|||
<!-- |
|||
1、肩部 |
|||
肩膀的不对称性,轻微差异1分,2分有差异,3分差异性很大 |
|||
2、肩胛骨 |
|||
肩胛骨的对称性,轻微差异1分,差异较大2分 |
|||
3、腰部 |
|||
腰部的对称性,轻微差异1分,2分有差异,3分差异性很大,4分差异性很大 |
|||
4、半胸 |
|||
上半身不对称的状况,以上胸椎的区域为主,主要看譬如肩胛骨的凸侧,以及肋骨的变化,轻微差异1分,差异较大2分 |
|||
--> |
|||
<div |
|||
class="item-container" |
|||
v-for="(item, index) in questions" |
|||
:key="index" |
|||
> |
|||
<div class="item-title">{{ item.index }}. {{ item.question }}</div> |
|||
<div class="item-radio-box"> |
|||
<el-radio-group v-model="form[`topic${item.index}`]"> |
|||
<el-radio |
|||
v-for="(criteria, index) in item.criteria" |
|||
:key="index" |
|||
:label="criteria.value" |
|||
>{{ criteria.label }} |
|||
</el-radio> |
|||
</el-radio-group> |
|||
</div> |
|||
</div> |
|||
<div class="submit-box"> |
|||
<el-button class="submit-box-but" type="primary" @click="submitForm" |
|||
>提交</el-button |
|||
> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: "PHQ9", |
|||
props: ["scaleCode"], |
|||
data() { |
|||
return { |
|||
form: {}, |
|||
questions: [ |
|||
{ |
|||
index: 1, |
|||
question: "肩部-肩膀的不对称性", |
|||
criteria: [ |
|||
{ label: "轻微差异", value: 1 }, |
|||
{ label: "有差异", value: 2 }, |
|||
{ label: "差异性很大", value: 3 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 2, |
|||
question: "肩胛骨-肩胛骨的对称性", |
|||
criteria: [ |
|||
{ label: "轻微差异", value: 1 }, |
|||
{ label: "差异较大", value: 2 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 3, |
|||
question: "腰部-腰部的对称性", |
|||
criteria: [ |
|||
{ label: "轻微差异", value: 1 }, |
|||
{ label: "有差异", value: 2 }, |
|||
{ label: "差异性很大", value: 3 }, |
|||
{ label: "差异性很大", value: 4 }, |
|||
], |
|||
}, |
|||
{ |
|||
index: 4, |
|||
question: "半胸-上半身不对称的状况", |
|||
criteria: [ |
|||
{ label: "轻微差异", value: 1 }, |
|||
{ label: "差异较大", value: 2 }, |
|||
], |
|||
}, |
|||
], |
|||
scaleData: {}, |
|||
}; |
|||
}, |
|||
created() { |
|||
this.treatmentId = this.$route.query.treatmentId; // 诊疗id |
|||
let scaleData = localStorage.getItem("scaleData"); // 获取上次填写的数据 |
|||
// 如果scaleData存在,则解析成对象,否则创建一个空对象 |
|||
this.scaleData = scaleData |
|||
? JSON.parse(scaleData) |
|||
: { |
|||
[this.treatmentId]: {}, |
|||
}; |
|||
|
|||
// 如果scaleData[this.treatmentId]不存在,则创建一个空对象 |
|||
if (!this.scaleData[this.treatmentId]) { |
|||
this.scaleData[this.treatmentId] = {}; |
|||
} |
|||
this.form = this.scaleData[this.treatmentId][this.scaleCode] || {}; // 将上次填写的数据赋值给form |
|||
}, |
|||
methods: { |
|||
submitForm() { |
|||
let score = 0; |
|||
// 计算总分, topic${i}属性不一定存在,先校验是否存在 |
|||
for (let i = 1; i <= 7; i++) { |
|||
if (this.form[`topic${i}`] !== undefined) { |
|||
score += this.form[`topic${i}`]; |
|||
} |
|||
} |
|||
// 存储数据 |
|||
this.scaleData[this.treatmentId][this.scaleCode] = this.form; |
|||
localStorage.setItem("scaleData", JSON.stringify(this.scaleData)); |
|||
// 将数据传递给父组件 |
|||
this.$emit("getScaleResult", score, this.scaleCode); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped src="@/assets/styles/common.css"></style> |
|||
|
|||
<style scoped> |
|||
.item-title { |
|||
font-size: 20px; |
|||
font-weight: bold; |
|||
color: #3d3d3d; |
|||
line-height: 26px; |
|||
} |
|||
.item-radio-box { |
|||
margin: 16px 0px; |
|||
} |
|||
>>> .el-radio__label { |
|||
font-size: 18px; |
|||
color: #555555; |
|||
line-height: 20px; |
|||
} |
|||
.submit-box { |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
.submit-box-but { |
|||
width: 200px; |
|||
} |
|||
} |
|||
</style> |
File diff suppressed because it is too large
Loading…
Reference in new issue