From 2ee6dbdf6de76fdf9bc9e567c77ebe0edcd1e464 Mon Sep 17 00:00:00 2001 From: baozhoutao Date: Tue, 2 Jan 2024 09:42:49 +0800 Subject: [PATCH 1/3] Update release.yml --- .github/workflows/release.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25d602775..91d1bb2e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -127,20 +127,11 @@ jobs: if: ${{ startsWith(steps.branch-name.outputs.tag, '1.3') && steps.version.outputs.is_stable == 'true' }} run: | npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN - yarn lerna publish from-package --registry https://registry.npmjs.org --yes + yarn lerna publish from-package --registry https://registry.npmjs.org --yes --dist-tag 1.3 env: CI: false NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - - name: Merge 1.3 -> master - if: ${{ startsWith(steps.branch-name.outputs.tag, '1.3') }} - uses: devmasx/merge-branch@master - with: - type: now - from_branch: 1.3 - target_branch: master - github_token: ${{ github.token }} - - name: Sleep 60s, wait for npm cache uses: juliangruber/sleep-action@v1 with: From 3d9845e75ba86f910e22aecd01a65e2d07fed89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B7=E4=BA=AE=E8=BE=89?= Date: Wed, 3 Jan 2024 15:24:29 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96lookup=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=EF=BC=8C=E6=8E=A5=E6=94=B6=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=99=A8=E8=84=9A=E6=9C=AC=E4=B8=8D=E5=A5=BD=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/converter/amis/fields/lookup.js | 51 ++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/packages/@steedos-widgets/amis-lib/src/lib/converter/amis/fields/lookup.js b/packages/@steedos-widgets/amis-lib/src/lib/converter/amis/fields/lookup.js index e4d63b707..5862cd658 100644 --- a/packages/@steedos-widgets/amis-lib/src/lib/converter/amis/fields/lookup.js +++ b/packages/@steedos-widgets/amis-lib/src/lib/converter/amis/fields/lookup.js @@ -64,6 +64,54 @@ export function getReferenceToSync(field) { } export function getLookupSapceUserTreeSchema(isMobile){ + let apiAdaptor = ` + if (payload.data.treeCache == true) { + return payload; + } + const records = payload.data.options; + const treeRecords = []; + const getChildren = (records, childrenIds) => { + if (!childrenIds) { + return; + } + const children = _.filter(records, (record) => { + return _.includes(childrenIds, record.value) + }); + _.each(children, (item) => { + if (item.children) { + item.children = getChildren(records, item.children) + } + }) + return children; + } + + const getRoot = (records) => { + for (var i = 0; i < records.length; i++) { + records[i].noParent = 0; + if (!!records[i].parent) { + biaozhi = 1 + for (var j = 0; j < records.length; j++) { + if (records[i].parent == records[j].value) + biaozhi = 0; + } + if (biaozhi == 1) records[i].noParent = 1; + } else records[i].noParent = 1; + } + } + getRoot(records); + console.log(records) + + _.each(records, (record) => { + if (record.noParent == 1) { + treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) })); + } + }); + console.log(treeRecords) + + payload.data.options = treeRecords; + payload.data.treeCache = true; + return payload; + `; const treeSchema = { "type": "input-tree", "className":"steedos-select-user-tree", @@ -74,8 +122,7 @@ export function getLookupSapceUserTreeSchema(isMobile){ "headers": { "Authorization": "Bearer ${context.tenantId},${context.authToken}" }, - "adaptor": "if (payload.data.treeCache == true) {\n return payload;\n }\n const records = payload.data.options;\n const treeRecords = [];\n const getChildren = (records, childrenIds) => {\n if (!childrenIds) {\n return;\n }\n const children = _.filter(records, (record) => {\n return _.includes(childrenIds, record.value)\n });\n _.each(children, (item) => {\n if (item.children) {\n item.children = getChildren(records, item.children)\n }\n })\n return children;\n }\n\n const getRoot = (records) => {\n for (var i = 0; i < records.length; i++){\n records[i].noParent = 0;\n if (!!records[i].parent) {\n biaozhi = 1\n for (var j = 0; j < records.length; j++){\n if (records[i].parent == records[j].value)\n biaozhi = 0;\n }\n if (biaozhi == 1) records[i].noParent = 1;\n } else records[i].noParent = 1;\n }\n }\n getRoot(records);\n console.log(records)\n\n _.each(records, (record) => {\n if (record.noParent ==1) {\n treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));\n }\n });\n console.log(treeRecords)\n\n payload.data.options = treeRecords;\n payload.data.treeCache = true;\n return payload;\n ", - "requestAdaptor": "\n ", + "adaptor": apiAdaptor, "data": { "query": "{options:organizations(filters:[\"hidden\", \"!=\", true],sort:\"sort_no desc\"){value:_id label:name,parent,children}}" }, From ca4d674be738fea24c54491523dca921020c352d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B7=E4=BA=AE=E8=BE=89?= Date: Wed, 3 Jan 2024 16:01:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix=20=E5=9B=A0=E4=B8=BA=E7=BC=93=E5=AD=98?= =?UTF-8?q?=EF=BC=8C=E6=9C=89=E6=97=B6=E4=BA=BA=E5=91=98=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E6=A0=91=E6=97=A0=E6=B3=95=E5=B1=95=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/steedos/steedos-platform/issues/6111 --- .../amis-lib/src/lib/converter/amis/fields/lookup.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/@steedos-widgets/amis-lib/src/lib/converter/amis/fields/lookup.js b/packages/@steedos-widgets/amis-lib/src/lib/converter/amis/fields/lookup.js index 5862cd658..2ceea6d92 100644 --- a/packages/@steedos-widgets/amis-lib/src/lib/converter/amis/fields/lookup.js +++ b/packages/@steedos-widgets/amis-lib/src/lib/converter/amis/fields/lookup.js @@ -65,10 +65,15 @@ export function getReferenceToSync(field) { export function getLookupSapceUserTreeSchema(isMobile){ let apiAdaptor = ` - if (payload.data.treeCache == true) { + // console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload)); + const records = payload.data.options; + let isTreeOptionsComputed = false; + if(records.length === 1 && records[0].children){ + isTreeOptionsComputed = true; + } + if(isTreeOptionsComputed){ return payload; } - const records = payload.data.options; const treeRecords = []; const getChildren = (records, childrenIds) => { if (!childrenIds) { @@ -109,7 +114,6 @@ export function getLookupSapceUserTreeSchema(isMobile){ console.log(treeRecords) payload.data.options = treeRecords; - payload.data.treeCache = true; return payload; `; const treeSchema = {