Closed
Description
通过这个字段可以获取当前条目的所有字段的 id、名称、类型
{
"字段1的id": ["字段1的名称", "字段1的类型"],
"字段2的id": ["字段2的名称", "字段2的类型"],
"字段3的id": ["字段3的名称", "字段3的类型"],
"字段4的id": ["字段4的名称", "字段4的类型"]
}
{
"field1": ["Name1", "Type1"],
"field2": ["Name2", "Type2"],
"field3": ["Name3", "Type3"],
"field4": ["Name4", "Type4"]
}
然后就能实现:
- 获取所有复选框字段,统计总数
- 判断各个复选框是否勾选,统计勾选数
- 计算得出勾选比例
或者别的什么方案也行,目的是能获取到条目的所有字段的 id、名称、类型
目前想要实现类似的逻辑会非常繁琐且不通用:
.action{$total:= 4} .action{/* 填列数 */}
.action{$count:= 0}
.action{/* 有多少列就填多少组 */}
.action{$state1:= index . "早起"}
.action{$state2:= index . "运动"}
.action{$state3:= index . "阅读"}
.action{$state4:= index . "日报"}
.action{if eq $state1 "√"}
.action{$count = add1 $count}
.action{end}
.action{if eq $state2 "√"}
.action{$count = add1 $count}
.action{end}
.action{if eq $state3 "√"}
.action{$count = add1 $count}
.action{end}
.action{if eq $state4 "√"}
.action{$count = add1 $count}
.action{end}
.action{$width:= floor (mulf (divf $count $total) 100)}
.action{$transparency:= addf (mulf (divf $count $total) 0.8) 0.2}
<div style="display: flex; justify-content: flex-end; height: 100%;">
<span style="font-size: 100%; margin-right: 4px;">.action{$width}%</span>
<span style="background-color: rgba(175,184,193,0.2); width: 100%; display: inline-block;height: 12px;border-radius: 6px;align-self: center;overflow: hidden;">
<span style="text-align: right; font-size: 12px; width: .action{$width}%; background-color: rgba(45,164,78,.action{$transparency}); display: inline-block;height: inherit;vertical-align: top;"></span>
</span>
</div>
Metadata
Metadata
Assignees
Labels
No labels