MCPcopy Create free account
hub / github.com/ConnectAI-E/TalkBase / parseOneField

Method parseOneField

utils/BaseSchema/dataWriter.ts:77–118  ·  view source on GitHub ↗
(field: IFieldMeta)

Source from the content-addressed store, hash-verified

75 }
76
77 parseOneField(field: IFieldMeta) {
78 const itemValue = this.getItem(field.name) as any;
79 if (!itemValue) {
80 return null;
81 }
82 //文本
83 if (field.type === 1) {
84 return this.exportText(itemValue);
85 }
86 //数字
87 if (
88 field.type === 2 ||
89 field.type === 99004 ||
90 field.type === 99003 ||
91 field.type === 99002 ||
92 field.type === 13
93 ) {
94 return this.exportNumber(itemValue);
95 }
96 //单选
97 if (field.type === 3) {
98 const labelId = this.findSelectLabelId(field, itemValue);
99 return this.exportSelect(itemValue, labelId);
100 }
101 // //多选
102 if (field.type === 4) {
103 const labelMeta = itemValue.map((v: string) => {
104 const labelId = this.findSelectLabelId(field, v);
105 return [v, labelId];
106 });
107 return labelMeta.map((v: any) => this.exportSelect(v[0], v[1]));
108 }
109 // 复选框
110 if (field.type === 7) {
111 return this.exportBoolean(itemValue);
112 }
113 // url
114 if (field.type === 15) {
115 return this.exportUrl(itemValue);
116 }
117 return null;
118 }
119
120 get recordFormat() {
121 const fields = this.tableInfo.fields;

Callers 2

recordFormatMethod · 0.95
dataWriter.spec.tsFile · 0.80

Calls 7

getItemMethod · 0.95
exportTextMethod · 0.95
exportNumberMethod · 0.95
findSelectLabelIdMethod · 0.95
exportSelectMethod · 0.95
exportBooleanMethod · 0.95
exportUrlMethod · 0.95

Tested by

no test coverage detected