mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-28 21:20:28 +00:00
feat: 适配 webtable
This commit is contained in:
parent
aa135c0554
commit
91f17024de
@ -312,7 +312,7 @@ designer.addPropsReducer((props: any, node: Node) => {
|
||||
const newParam: any = {};
|
||||
if (item.options && item.options.params && item.options.params.length) {
|
||||
item.options.params.map((element: any) => {
|
||||
if (element.name) {
|
||||
if (element.name && element.value) {
|
||||
newParam[element.name] = element.value;
|
||||
}
|
||||
});
|
||||
|
||||
@ -4,15 +4,6 @@ import fetchJsonp from 'fetch-jsonp';
|
||||
import bzbRequest from '@ali/bzb-request';
|
||||
import { serialize, buildUrl, parseUrl } from '@ali/b3-one/lib/url';
|
||||
|
||||
import { Table, schema } from '@ali/ui-table';
|
||||
|
||||
const webTable = new Table('yida');
|
||||
webTable.init(schema);
|
||||
window._webTable = webTable;
|
||||
// webTable.on('ready', () => {
|
||||
// window._webTable = webTable;
|
||||
// });
|
||||
|
||||
export function get(dataAPI, params = {}, headers = {}, otherProps = {}) {
|
||||
headers = {
|
||||
Accept: 'application/json',
|
||||
@ -180,13 +171,31 @@ export function bzb(apiCode, params, otherProps = {}) {
|
||||
}
|
||||
|
||||
export async function webTableProxy(req) {
|
||||
const { _webTable } = window;
|
||||
if (!_webTable) {
|
||||
const data = await { success: false, content: 'web table 尚未加载' };
|
||||
return data;
|
||||
console.log(req);
|
||||
const { VisualEngine } = window;
|
||||
const { Bus, Table } = VisualEngine;
|
||||
if (Table) {
|
||||
const { options } = req;
|
||||
const { params, OneAPIConfig } = options;
|
||||
const { code } = OneAPIConfig;
|
||||
const sheetId = OneAPIConfig['x-model'];
|
||||
const sheet = await Table.find({ id: sheetId });
|
||||
const result = await sheet.instance.fetch({ code }, params);
|
||||
// const result = await Table.find({ id: 'vip_info' });
|
||||
return result;
|
||||
}
|
||||
// const { name } = req;
|
||||
// const data = await _webTable.fetch({ id: name });
|
||||
const data = await _webTable.find({ id: 'one' });
|
||||
return data;
|
||||
return new Promise((resolve, reject) => {
|
||||
Bus.emitter.on('table.ready', async (table) => {
|
||||
// const { name } = req;
|
||||
// const result = table.fetch({ id: name });
|
||||
const { options } = req;
|
||||
const { params, OneAPIConfig } = options;
|
||||
const { code } = OneAPIConfig;
|
||||
const sheetId = OneAPIConfig['x-model'];
|
||||
const sheet = await table.find({ id: sheetId });
|
||||
const result = await sheet.instance.fetch({ code }, params);
|
||||
// const result = await Table.find({ id: 'vip_info' });
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user