1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| <template>
| <div>
| <el-table :data="items" border size="small">
| <el-table-column prop="item" label="条目" width="220" />
| <el-table-column label="评分" align="center" width="120">
| <template slot-scope="scope">
| <el-select v-if="editing" v-model="scope.row.score" size="small">
| <el-option v-for="s in scoreOptions" :key="s" :label="s" :value="s" />
| </el-select>
| <span v-else>{{ scope.row.score }}</span>
| </template>
| </el-table-column>
| </el-table>
| <div style="margin-top:10px;font-size:14px">MRS总分:{{ totalScore }}</div>
| </div>
| </template>
| <script>
| export default {
| name:"MRSScoreTable",
| props:{ value:{ type:Object, default:()=>({}) }, editing:Boolean },
| data(){ return { scoreOptions:[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1] }; },
| computed:{
| items(){
| const names=["潮热出汗","心脏不适","睡眠障碍","情绪抑郁","易激惹","焦虑","体力/精力下降","性功能","泌尿系症状","阴道干涩","关节肌肉不适"];
| return names.map((n,i)=>({ item:n, key:'mrs_'+i, score:this.value['mrs_'+i]||0 }));
| },
| totalScore(){ return this.items.reduce((s,i)=>s+i.score,0).toFixed(1); },
| },
| watch:{
| items:{ deep:true, handler(v){
| const obj={...this.value, mrsTotal:this.totalScore};
| v.forEach(i=>{ obj[i.key]=i.score; });
| this.$emit('input',obj);
| }},
| },
| };
| </script>
|
|