方案比较
原能力
对照需求比较不同方案的适用场景、代价和可能影响,保留并列选择。(细化版 p.2–3)
首选项目
SurveyJS Form Library(MIT(Form Library))。 SurveyJS Form Library
匹配范围
矩阵或排序表单让当事人对方案逐项评分和反馈。
源码
SurveyJS Form Library · class QuestionMatrixModel
packages/survey-core/src/question_matrix.ts · 351–364 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
export class QuestionMatrixModel
extends Question
implements IMatrixData, IMatrixCellsOwner {
protected generatedVisibleRows: Array<MatrixRowModel> = null;
public visibleRowsChangedCallback: () => void;
private isRowChanging = false;
private cellsValue: MatrixCells;
protected createColumnValues(): any {
return this.createItemValues("columns");
}
constructor(name: string) {
super(name);
SurveyJS Form Library · class QuestionRankingModel
packages/survey-core/src/question_ranking.ts · 23–36 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
export class QuestionRankingModel extends QuestionCheckboxModel {
private domNode: HTMLElement = null;
private dragOrClickHelper: DragOrClickHelper;
constructor(name: string) {
super(name);
this.dragOrClickHelper = new DragOrClickHelper(this.startDrag);
}
protected onPropertyValueChanged(name: string, oldValue: any, newValue: any): void {
super.onPropertyValueChanged(name, oldValue, newValue);
if (name === "selectToRankEnabled") {
this.clearValue(true);
this.setDragDropRankingChoices();
this.updateRankingChoicesSync();
实现与验收要点
指标定义与不可比结论,避免代替本人作决定。