{
"appId": "2683eebd-34a5-41fd-a379-72cb608ee7fc",
"name": "综合字段测试表",
"alias": "combined_test",
"fields": [
// ==========================================
// 文本类型 (Text) 测试
// ==========================================
{
"name": "标题 (单行文本)",
"alias": "title",
"type": "Text",
"description": "适用于简短的名字或标题",
"config": {
"textMode": "singleLine"
}
},
{
"name": "备注 (多行文本)",
"alias": "remarks",
"type": "Text",
"description": "适用于长段落的纯文本输入",
"config": {
"textMode": "multiLine"
}
},
{
"name": "详细说明 (Markdown)",
"alias": "description_md",
"type": "Text",
"description": "支持 Markdown 语法的富文本排版",
"config": {
"textMode": "markdown"
}
},
// ==========================================
// 基础时间字段 (作为 DateFormula 的引用来源)
// ==========================================
{
"name": "开始时间",
"alias": "start_time",
"type": "DateTime",
"config": {
"format": "YYYY-MM-DD HH:mm"
}
},
{
"name": "结束时间",
"alias": "end_time",
"type": "DateTime",
"config": {
"format": "YYYY-MM-DD HH:mm"
}
},
{
"name": "偏移量(天)",
"alias": "offset_days",
"type": "Number",
"config": {
"precision": 0
}
},
// ==========================================
// 日期公式 (DateFormula) 测试
// ==========================================
{
"name": "工时计算 (dateDiff)",
"alias": "work_hours",
"type": "DateFormula",
"description": "计算结束时间与开始时间的差值,单位为小时",
"config": {
"formulaType": "dateDiff",
"startTime": {
"source": "field",
"field": "start_time"
},
"endTime": {
"source": "field",
"field": "end_time"
},
"outputUnit": "h",
"precision": 1
}
},
{
"name": "预计完成时间 (dateOffset)",
"alias": "expected_finish_time",
"type": "DateFormula",
"description": "基于开始时间加上数值字段指定的偏移天数",
"config": {
"formulaType": "dateOffset",
"targetTime": {
"source": "field",
"field": "start_time"
},
"offset": "+$offset_days$d"
}
},
{
"name": "距离结束还有几天 (dateNowDiff)",
"alias": "days_remaining",
"type": "DateFormula",
"description": "目标时间减去当前时刻",
"config": {
"formulaType": "dateNowDiff",
"targetTime": {
"source": "field",
"field": "end_time"
},
"direction": "targetMinusNow",
"outputUnit": "d",
"precision": 0
}
}
]
}
curl --location 'https://api.mingdao.com/v3/app/worksheets' \
--header 'HAP-Appkey: bb185b7d216a1714' \
--header 'HAP-Sign: YzhkZjBkYWEwNzQ2NmU3ODEzN2I4YjhhYWQzZGUwODg1YTY3YWJiOTBjODI2ODJlM2RhOGU2Nzk1ZTIxZTA3Zg==' \
--header 'Content-Type: application/json' \
--data '{
"appId": "2683eebd-34a5-41fd-a379-72cb608ee7fc",
"name": "综合字段测试表",
"alias": "combined_test",
"fields": [
// ==========================================
// 文本类型 (Text) 测试
// ==========================================
{
"name": "标题 (单行文本)",
"alias": "title",
"type": "Text",
"description": "适用于简短的名字或标题",
"config": {
"textMode": "singleLine"
}
},
{
"name": "备注 (多行文本)",
"alias": "remarks",
"type": "Text",
"description": "适用于长段落的纯文本输入",
"config": {
"textMode": "multiLine"
}
},
{
"name": "详细说明 (Markdown)",
"alias": "description_md",
"type": "Text",
"description": "支持 Markdown 语法的富文本排版",
"config": {
"textMode": "markdown"
}
},
// ==========================================
// 基础时间字段 (作为 DateFormula 的引用来源)
// ==========================================
{
"name": "开始时间",
"alias": "start_time",
"type": "DateTime",
"config": {
"format": "YYYY-MM-DD HH:mm"
}
},
{
"name": "结束时间",
"alias": "end_time",
"type": "DateTime",
"config": {
"format": "YYYY-MM-DD HH:mm"
}
},
{
"name": "偏移量(天)",
"alias": "offset_days",
"type": "Number",
"config": {
"precision": 0
}
},
// ==========================================
// 日期公式 (DateFormula) 测试
// ==========================================
{
"name": "工时计算 (dateDiff)",
"alias": "work_hours",
"type": "DateFormula",
"description": "计算结束时间与开始时间的差值,单位为小时",
"config": {
"formulaType": "dateDiff",
"startTime": {
"source": "field",
"field": "start_time"
},
"endTime": {
"source": "field",
"field": "end_time"
},
"outputUnit": "h",
"precision": 1
}
},
{
"name": "预计完成时间 (dateOffset)",
"alias": "expected_finish_time",
"type": "DateFormula",
"description": "基于开始时间加上数值字段指定的偏移天数",
"config": {
"formulaType": "dateOffset",
"targetTime": {
"source": "field",
"field": "start_time"
},
"offset": "+$offset_days$d"
}
},
{
"name": "距离结束还有几天 (dateNowDiff)",
"alias": "days_remaining",
"type": "DateFormula",
"description": "目标时间减去当前时刻",
"config": {
"formulaType": "dateNowDiff",
"targetTime": {
"source": "field",
"field": "end_time"
},
"direction": "targetMinusNow",
"outputUnit": "d",
"precision": 0
}
}
]
}'{
"data": {
"worksheetId": "worksheet123"
},
"success": true
}