diff --git a/src/executor/open/mallTemplate/pages/index.tsx b/src/executor/open/mallTemplate/pages/index.tsx index 0ff49c1df283c6d6338c49a10db90cecbb2815f8..4ee3a789d216dcc538f0e2fb32b8e6bf6cde8b56 100644 --- a/src/executor/open/mallTemplate/pages/index.tsx +++ b/src/executor/open/mallTemplate/pages/index.tsx @@ -689,6 +689,21 @@ const Provider: React.FC = ({ current, form, renderBody }) => { }); console.log(result); for (let item of result.data) { + // 如果tfields对应的fields本身存在,那tfield的值应与fields本身相同 + const keyMap: { [key: string]: string } = { + 'belongId': 'TbelongId', + 'count': 'Tcount', + 'icons': 'Ticons', + 'price': 'Tprice', + 'remark': 'Tremark', + 'title': 'Ttitle' + }; + + for (const key in item) { + if (keyMap[key] && item[key] !== undefined && item[key] !== null && item[key] !== '') { + item[keyMap[key]] = item[key]; + } + } item = removeTPrefix(item); } const coll = current.directory.resource.genColl('-clicks-count'); diff --git a/src/executor/tools/task/index.tsx b/src/executor/tools/task/index.tsx index a3fa64fbddc2f654c3796baf6c1b64f60fdf4721..dd54b867517c3e8404a1f1791ab3c84eb749b4a3 100644 --- a/src/executor/tools/task/index.tsx +++ b/src/executor/tools/task/index.tsx @@ -101,13 +101,16 @@ const TaskContent: React.FC = ({ current, finished }) => { var target = orgCtrl.targets.find( (item) => item.id == current.instance!.defineShareId, ); - const svc = new WorkFormService( - target ?? current.belong, - current.instanceData, - false, - ); - svc.init(); - return svc; + if (target) { + const svc = new WorkFormService( + target ?? current.belong, + current.instanceData, + false, + ); + svc.init(); + return svc; + } + }); const _loadMembers = async (task: schema.XWorkTask): Promise => { diff --git a/src/ts/core/work/index.ts b/src/ts/core/work/index.ts index e0ce5b1167fafdbd87cc856c943e9c7104427f55..32eb89e816da42aac1627074ec5f879c0b438576 100644 --- a/src/ts/core/work/index.ts +++ b/src/ts/core/work/index.ts @@ -500,9 +500,9 @@ export class Work extends Version implements IWork { data.fields[form.id] = await form.loadFields(); await form.correctAttributes(); //TODO:内置属性 暂时使用老版本,数据核更新后删除以下判断 - if (form.attributes.find((a) => a.options && a.options.isNative) != undefined) { - data.isNew = false; - } + // if (form.attributes.find((a) => a.options && a.options.isNative) != undefined) { + // data.isNew = false; + // } const matchedForm = pdata?.forms?.find( (f) => f.primaryId && f.primaryId === form.metadata?.primaryId, ); diff --git a/src/ts/core/work/instance.ts b/src/ts/core/work/instance.ts index af65d356ac95b20bb2acb60eedc6c489f910a95e..7b4566557aa5ab78789688469f86c0a3b25bc55a 100644 --- a/src/ts/core/work/instance.ts +++ b/src/ts/core/work/instance.ts @@ -59,11 +59,11 @@ export class Instance implements IInstance { this.data = eval(`(${instance.data})`); } } + var result = await kernel.queryWorkNodes({ + id: this.instance.defineId, + shareId: this.instance.defineShareId, + }); if (this.data.isNew) { - var result = await kernel.queryWorkNodes({ - id: this.instance.defineId, - shareId: this.instance.defineShareId, - }); if (result.success) { await this.ParseWorkNode(result.data); this.data = { ...this.data, node: result.data }; @@ -72,6 +72,7 @@ export class Instance implements IInstance { } } } + this._dataLoaded = true; } return this.data;