低代码工具,支持 ChatGPT
文档不经常更新,新功能使用方法可查看 releases
使用 lowcode 原有代码片段功能,可以随意预置 Prompt,支持 EJS 模板语法,可快速创建分析代码、重构代码、代码添加注释等 Prompt。
拉到最底部,配置 chatGPT 字段:
commandPrompt 既右键菜单选择模板后发送的内容,支持 EJS 模板语法。
viewPrompt 为 代码片段或者区块物料可视化详情页点 Ask ChatGPT 按钮后发送的内容。
很好的解决了代码变量的命名难题。
复制接口 id
生成的 ts 类型可能不完全正确,需要手动调整
复制 json 数据,比如:
{
"code": 0,
"message": "成功",
"result": {
"records": [
{
"id": 137,
"code": "mechanisms",
"name": "外部机构",
"internalType": 0,
"needArea": 0,
"assetTypes": [],
"serviceLines": [
{
"serviceLineCode": "CESHI",
"serviceLineName": "测试勿动",
"status": 1
}
]
}
],
"total": 105,
"size": 10,
"current": 1,
"orders": [],
"optimizeCountSql": true,
"hitCount": false,
"countId": null,
"maxLimit": null,
"searchCount": true,
"pages": 11
}
}需要手动调整参数,接口地址
复制 ts 类型,比如:
[{ name: string; code: string }]复制 json 数据,比如:
{
"code": 0,
"message": "成功",
"result": {
"records": [
{
"id": 137,
"code": "mechanisms",
"name": "外部机构",
"internalType": 0,
"needArea": 0,
"assetTypes": [],
"serviceLines": [
{
"serviceLineCode": "CESHI",
"serviceLineName": "测试勿动",
"status": 1
}
]
}
],
"total": 105,
"size": 10,
"current": 1,
"orders": [],
"optimizeCountSql": true,
"hitCount": false,
"countId": null,
"maxLimit": null,
"searchCount": true,
"pages": 11
}
}下载 mock 项目
因为墙的原因下载不了的话,可以使用下面仓库地址下载:
https://gitee.com/lowcode-scaffold/lowcode-mock.git (不要直接 clone,用下图的方式)
复制接口 id
复制 ts 类型,比如(不需要复制 export interface IFetchOrgnizationListResult):
{
/**
* 0:成功,其他:失败
*/
code: number;
message: string;
result: {
/**
* 当前页数
*/
current: number;
hitCount: boolean;
optimizeCountSql: boolean;
orders: string[];
/**
* 总页数
*/
pages: number;
/**
* 记录
*/
records: {
id: number;
/**
* 组织名称
*/
orgNodeName: string;
/**
* 组织编码
*/
orgNodeCode: string;
/**
* 组织名称全路径
*/
fullPath: string;
}[];
searchCount: boolean;
/**
* 每页展示数
*/
size: number;
/**
* 总数据条数
*/
total: number;
};
}同理,复制 json,选择对应的命令选项。
建议所有的前端项目共用同一个 mock 项目,避免频繁切换项目,以及接口冲突。不同的项目在 routes 目录下创建相应的文件。
选择列表页区块
配置表单
生成代码
若后端已经提供 yapi 接口文档,可以同时使用根据 yapi 接口文档生成请求方法的功能:
根据生成的 ts 类型,可直接生成对应 mock 服务。
{
"filters": [
{
"label": "商户",
"key": "merchant",
"component": "input",
"placeholder": "输入查询"
},
{
"key": "orderNo",
"label": "订单号",
"component": "input",
"placeholder": "输入查询"
},
{
"key": "status",
"label": "订单状态",
"component": "select",
"placeholder": "请选择"
},
{
"label": "收货手机号",
"key": "mobile",
"component": "select",
"placeholder": "输入查询"
},
{
"key": "time",
"label": "时间",
"component": "select"
}
],
"columns": [
{
"title": "订单号",
"dataIndex": "orderNo",
"key": "orderNo",
"slot": true
},
{
"title": "订单付款时间",
"dataIndex": "payTime",
"key": "payTime"
},
{
"title": "订单状态",
"dataIndex": "orderStatus",
"key": "orderStatus"
},
{
"title": "订单金额",
"dataIndex": "orderAmount",
"key": "orderAmount"
},
{
"title": "商户",
"dataIndex": "merchantInfo",
"key": "merchantInfo",
"slot": true
},
{
"title": "客户信息",
"dataIndex": "customerInfo",
"key": "customerInfo",
"slot": true
},
{
"title": "关联合同",
"dataIndex": "contractInfo",
"key": "contractInfo",
"slot": true
}
],
"includeModifyModal": false,
"pagination": {
"show": true,
"page": "page",
"size": "size",
"total": "result.total"
},
"fetchName": "fetchTableList",
"result": "[\"result\"][\"records\"]",
"serviceName": "getTableList",
"modifyModal": {
"formItems": [
{
"showMore": true,
"component": "textarea",
"required": true
}
]
}
}选择表单区块,配置 Schema 表单
创建新的区块
配置 Schema 表单:复制旧区块的 schema.json 内容覆盖到当前区块的 schema.json 文件内。将 schema 字段内容导入网页 https://xrender.fun/~demos/docs-generator-demo-0 中重新配置。
