ovineio/ovine

关于原使用 amis jssdk模式开发的 json,如何转为 ovine 的 js 模式?

gexMichael opened this issue · 1 comments

感谢官方提供的 ovine框架,这是一个很棒的专案。
参考官网手册改写原本的 json为 index.js 后,不知道如何修改 api 段的程序,我对前端只有基本概念,主要是后端开发,请问是否有相关文档或说明,如果能有一个简单的范例就更好了。

image

/* 以下是修改后的程序 /
export const schema = {
title: "分院維護",
type: "page",
body: {
type: "crud",
api: {
method: "post",
url: "http://x.x.x.x:5050/xapi/v2/zenBusiness/orm_api/3/",
data: {
page: "${page}",
perPage: "${perPage}",
id: "${id}",
field: "${field}",
keywords: "${keywords}",
_$_tableName: "zen_fields",
_$_pk: "fieldid",
_$_action: "P",
_$_query_filter: "1^10^fieldid^
^^^functiontag,tablename,fieldname",
},
dataType: "form",
},
syncLocation: false,
perPage: 10,
headerToolbar: [
{
type: "search-box",
name: "keywords",
align: "left",
placeholder: "关键字检索",
},
{
type: "columns-toggler",
align: "right",
},
{
type: "drag-toggler",
align: "right",
},
{
type: "pagination",
align: "right",
},
],
columns: [
{
name: "id",
label: "分院代號",
width: 20,
sortable: true,
type: "text",
},
{
name: "Category",
label: "分院類別",
width: 20,
sortable: false,
type: "text",
},
{
name: "CName",
label: "分院全稱",
width: 120,
sortable: false,
type: "text",
},
{
name: "NickName",
label: "簡稱",
width: 60,
sortable: true,
type: "text",
},
{
name: "Addr",
label: "分院地址",
width: 300,
sortable: false,
type: "text",
},
{
type: "operation",
label: "操作",
width: 100,
buttons: [
{
type: "button",
icon: "fa fa-times text-danger",
actionType: "ajax",
tooltip: "删除",
confirmText: "您确认要删除?",
api: {
method: "post",
url: "http://x.x.x.x:5050/xapi/v2/zenBusiness/orm_api/2/",
dataType: "form",
requestAdaptor:
'return {\n ...api,\n data: {\n ...api.data,\n _$_tableName: "clinic",\n _$_pk: "id",\n _$_action: "D"}\n}',
},
},
],
},
],
},
};

目前项目使用 jssdk 版本,并自行开发相关的架构程序,目前一切正常,本 issue Cloesd