刘光辉
8 小时以前 cf11e63b659afcc9792ab3e395f1b45d844431a8
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
export type FillFieldType = 'checkbox' | 'date' | 'multiline' | 'select' | 'text';
export type FillFieldValue = boolean | string;
export type DateControlFormat = string;
 
export interface FillFieldData {
  checkboxGroupCode?: string;
  checkboxGroupMaxSelected?: null | number;
  checkboxGroupMinSelected?: number;
  formulaMessage?: string;
  formulaStatus?: 'ERROR' | 'MISSING_INPUT' | 'SUCCESS';
  readOnly?: boolean;
  required?: boolean;
  type: FillFieldType;
  value: FillFieldValue | null;
  valueSource?: string;
}
 
export interface FillDataResponse {
  fields: Record<string, FillFieldData>;
  pendingSourceSync?: SourceSynchronized;
  repeatGroups: RepeatGroup[];
  stepStructure?: StepFillStructure;
}
 
export interface FillStep {
  id: string;
  name: string;
  order: number;
}
 
export type StepProgressStatus = 'complete' | 'in-progress' | 'problem';
 
export const STEP_PROGRESS_LABELS: Record<StepProgressStatus, string> = {
  complete: '已完整',
  'in-progress': '填写中',
  problem: '有问题',
};
 
export interface StepProgress {
  missingCount: number;
  problemCount: number;
  status: StepProgressStatus;
  step: FillStep;
}
 
export interface StepFillStructure {
  configuration: {
    singleStep: boolean;
    steps: FillStep[];
  };
  controlSteps: Record<string, string>;
  repeatGroupSteps: Record<string, string>;
}
 
export interface SelectOption {
  display: string;
  value: string;
}
 
export interface DocumentField {
  alias: string;
  currentValue: FillFieldValue;
  dateFormat?: DateControlFormat;
  internalId: string;
  options: SelectOption[];
  tag: string;
  type: FillFieldType;
}
 
export interface FieldChange {
  tag: string;
  type: FillFieldType;
  value: FillFieldValue;
}
 
export interface FieldApplyResult {
  error?: string;
  ok: boolean;
  tag: string;
}
 
export interface SourceSyncDifference {
  bindingId: string;
  canClear?: boolean;
  changed: boolean;
  currentValue?: null | string;
  dataType: string;
  fieldCode: string;
  fieldName: string;
  previousValue?: null | string;
  previousFetchedTime?: null | string;
  sourceFetchedAt?: null | string;
  sourceFieldVersionId?: null | string;
  sourceProperty?: null | string;
  sourcePropertyRevision?: null | number;
  sourceOutcome?: null | string;
  sourceRecordId?: null | string;
  sourceRevisionId?: null | string;
  sourceType: 'CROSS_TEMPLATE' | 'LIMS_TASK';
  sourceValueId?: null | string;
}
 
export interface SourceSyncPreview {
  changedCount: number;
  differences: SourceSyncDifference[];
  previewToken: string;
  recordId: string;
  recordVersion: number;
  revisionId: string;
}
 
export interface SourceSyncCommand {
  clearReasons?: Record<string, string>;
  expectedRecordVersion: number;
  operationCode: string;
  previewToken: string;
}
 
export interface SourceSynchronized {
  changedCount: number;
  changedFieldCodes: string[];
  differences: SourceSyncDifference[];
  operationCode: string;
  recalculatedCount: number;
  recordId: string;
  recordVersion: number;
  revisionId: string;
}
 
export interface RepeatRow {
  deleteOperationCode?: string | null;
  deleteReason?: string | null;
  groupCode: string;
  rowId: string;
  rowOrder: number;
  status: 'ACTIVE' | 'DELETE_PREPARED' | 'PREPARED';
}
 
export interface RepeatGroup {
  activeRowCount: number;
  checkboxGroups?: Record<string, string>;
  groupCode: string;
  maxRows: number;
  minRows: number;
  rows: RepeatRow[];
}
 
export interface RepeatAppendForm {
  groupCode: string;
  operationCode: string;
}
 
export interface RepeatDeleteForm {
  groupCode: string;
  operationCode: string;
  reason: string;
  rowId: string;
}
 
export type RepeatRestoreForm = Omit<RepeatDeleteForm, 'reason'>;
 
export interface RepeatCloneSpec {
  beforeRowId?: string;
  groupCode: string;
  rowId: string;
}