mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-17 19:23:41 +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 = {};
|
const newParam: any = {};
|
||||||
if (item.options && item.options.params && item.options.params.length) {
|
if (item.options && item.options.params && item.options.params.length) {
|
||||||
item.options.params.map((element: any) => {
|
item.options.params.map((element: any) => {
|
||||||
if (element.name) {
|
if (element.name && element.value) {
|
||||||
newParam[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 bzbRequest from '@ali/bzb-request';
|
||||||
import { serialize, buildUrl, parseUrl } from '@ali/b3-one/lib/url';
|
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 = {}) {
|
export function get(dataAPI, params = {}, headers = {}, otherProps = {}) {
|
||||||
headers = {
|
headers = {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
@ -180,13 +171,31 @@ export function bzb(apiCode, params, otherProps = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function webTableProxy(req) {
|
export async function webTableProxy(req) {
|
||||||
const { _webTable } = window;
|
console.log(req);
|
||||||
if (!_webTable) {
|
const { VisualEngine } = window;
|
||||||
const data = await { success: false, content: 'web table 尚未加载' };
|
const { Bus, Table } = VisualEngine;
|
||||||
return data;
|
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;
|
||||||
}
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
Bus.emitter.on('table.ready', async (table) => {
|
||||||
// const { name } = req;
|
// const { name } = req;
|
||||||
// const data = await _webTable.fetch({ id: name });
|
// const result = table.fetch({ id: name });
|
||||||
const data = await _webTable.find({ id: 'one' });
|
const { options } = req;
|
||||||
return data;
|
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