# ebdform组件说明

### 1、新建表单组件

```typescript
<CorsComponent
        app="@weapp/ebdform"
        compName="FormCreateContainer"
        visible={visible}
        appId={appId}//应用id
        groupId={"-1"}//默认分组为全部
        onClose={onClose}
        onAfterSave={onAfterSave} //(data: any, fn: Function, type: string, source: string) => void; 		
  typeFilter={typeFilter}//可选，(datas: FormInfoItem[]) => FormInfoItem[]; // 过滤需要显示哪些类型
    />
```

### 2、表单列表获取接口

```typescript
//接口
const res: FormList[] = await ajax({
        url: `/api/bs/ebuilder/form/obj/getList/${appId}?apid=${appId}`,
        method: 'get',
        ebBusinessId: this.appId,
      });
//FormList[]返回示例
[
    {
        "id": "923125691877711872",//表单id（objId）
        "createTime": 1698131950000,
        "updateTime": 1702258127000,
        "creator": "5140559816915791414",
        "tenantKey": "t2k74i3rjo",
        "deleteType": 0,
        "appId": "615058352157843457",//应用id
        "objName": "111",//表单名称
        "showName": "111",//表单显示名称
        "dnTemplate": "<p>123123</p>",
        "dnEnable": "1",
        "isHiddenHeader": 0,
        "status": 0,
        "showOrder": 0,//顺序
        "tableType": "",
        "permissionId": "922704583213621249",
        "formId": "923125696197844992",//业务表单id
        "groupId": "-1",/** 分组信息 */'-1', /** 全部分组 */
        "hasOldPage": 0,
        "openMatter": 0,
        "matterRightPass": 0,
        "matterSingle": "0",
        "matterIcon": "Icon-e-builder-o",
        "autoSave": 0,
        "dnEdit": 0,
        "quickEdit": 0,
        "isNewLayout": "true",
        "isAdvance": false,
        "publicRightTable": 1,
        "enableComment": 1,
        "enableLog": 1,
        "vformSourceName": "",
        "enableFullSearch": false,
        "fullSearch": "1",
        "readCardMatter": "1",
        "createCardMatter": "2",
        "isPhysical": false,
        "groupKey": 0,
        "enableFollow": 0,
        "enableFileDelete": 0,
        "expFilenameEnable": false,
        "hiddenFormTitle": 0,
        "flowAllowSet": 0,
        "authAllowSet": 0,
        "messageAllowSet": 0,
        "followOrder": 99999,
        "followHidden": 0,
        "shareOrder": 99999,
        "shareHidden": 0,
        "pageNameAllIn": 0,
        "enableLike": 0,
        "enableLikeLimit": 0,
        "likeLimit": 0,
        "firstLike": 0,
        "thirdPartyFlag": 0,
        "showPageName": "111",
        "associatedAuthorization": 0,
        "customFieldStateChange": 1,
        "showLikeUser": 0,
        "myCreate": true,/** 是否为我创建的页面 */
        "order": 0,
        "name": "111",    }
]
```

表单类型

```typescript
export enum TableType {
  Physical = 'physical', // 自定义独立表,即物理表
  Virtual = 'virtual', // 虚拟表单
  Default = '',
  VForm = 'vform' // 新虚拟表单
}

export const TableTypebyForm: any = {
  [FormTypes.Empty]: TableType.Default,
  [FormTypes.Excel]: TableType.Default,
  [FormTypes.XML]: TableType.Default,
  [FormTypes.VForm]: TableType.VForm,
  [FormTypes.Virtual]: TableType.Virtual,
};
```

### 3、  组件字段批量管理组件，属性继承[表单](https://weapp.yunteams.cn/sp/form/components/FieldManage)

[图片附件未整合: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABZEAAAKmCAYAAAA8b9BdAAAgAElEQVR4nOzdf1yVdZ7//+ehxPyBTAhGKTagFUwm1SSZhN+...]

```typescript
<CorsComponent
        weId={`${this.props.weId || ''}_2nxere`}
        app="@weapp/ebdform"
        compName="FieldManager"
        formId='923125696197844992'//业务表单id
        dialogMode='false'//是否为弹框模式
        //customParam={}//自定义参数
      />
```

| module | 模块标识'ebuilderform' | string | Y | - |
| --- | --- | --- | --- | --- |
| apiModule | 接口请求 module 标识，默认"ebuilder/form" | string | N | - |
| customParam | 接口自定义参数 | Record\<string, any\> | N | - |
| getStore | 获取字段管理 store | (store: FieldManageStore) =\> void | N | - |
| dialogMode | 是否为弹框模式 | boolean | N | true |

### 4、  复制表单接口

```typescript
ajax({
      url: `/api/bs/ebuilder/form/obj/copyForm?apid=${rowData?.appId}`,//应用id
      method: 'post',
      data: format2FormData({//FormData格式传参
        objId: data.id,//表单id
        name: data.name,//表单名称objName
        tableName: data.tableName,//可选，表格视图名称
        showName: data.showName,//表单显示名showName
      }),
```

### 5、  删除表单接口

```typescript
ajax({                url:`/api/bs/ebuilder/form/obj/delete/${data.objId}?apid=${data.appId}`,
          params: {
            tpaid: data.objId,//表单id
          },
          method: 'get',
          headers: {
              ebBusinessId:data.appId || '10000000000000000',
        },//表单id或者应用id都可以
        });
```
