From fec77cc34bb34fb76878ee04861815bc0505f669 Mon Sep 17 00:00:00 2001 From: baozhoutao Date: Thu, 31 Oct 2024 17:41:53 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[Bug]:=20=E9=9D=9E=E5=8F=97=E7=AE=A1?= =?UTF-8?q?=E8=BD=AF=E4=BB=B6=E5=8C=85=E5=85=83=E6=95=B0=E6=8D=AE=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E5=88=B0=E5=BA=93=E9=87=8C=EF=BC=8C=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=B9=E8=B1=A1=E7=9B=B8=E5=85=B3=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E5=89=8D=E5=8F=B0=E9=A1=B5=E9=9D=A2=E4=B8=8D?= =?UTF-8?q?=E7=94=9F=E6=95=88=20#7047?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/default/server/objects.core.js | 1 + .../triggers/object_actions.trigger.js | 21 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/services/standard-object-database/main/default/server/objects.core.js b/services/standard-object-database/main/default/server/objects.core.js index 17decb272d..c2cd677941 100644 --- a/services/standard-object-database/main/default/server/objects.core.js +++ b/services/standard-object-database/main/default/server/objects.core.js @@ -169,6 +169,7 @@ function _sendObjectMeta(objectConfig){ if(res){ // console.log('send object meta success', length); broker.broadcast("$packages.statisticsActivatedPackages", {}); + broker.emit(`translations.object.change`, {}); } }) _objectConfigs = []; diff --git a/services/standard-object-database/main/default/triggers/object_actions.trigger.js b/services/standard-object-database/main/default/triggers/object_actions.trigger.js index eebfd5fc55..1358f9058d 100644 --- a/services/standard-object-database/main/default/triggers/object_actions.trigger.js +++ b/services/standard-object-database/main/default/triggers/object_actions.trigger.js @@ -1,8 +1,8 @@ /* * @Author: sunhaolin@hotoa.com * @Date: 2022-05-28 11:07:57 - * @LastEditors: 孙浩林 sunhaolin@steedos.com - * @LastEditTime: 2024-05-11 13:57:23 + * @LastEditors: baozhoutao@steedos.com + * @LastEditTime: 2024-10-31 17:36:24 * @Description: */ const InternalData = require('@steedos/standard-objects').internalData; @@ -17,7 +17,22 @@ module.exports = { doc.visible; }, beforeUpdate: async function(){ - const { doc } = this; + const { doc, id } = this; + if(doc.label){ + const dbRecord = await this.getObject('object_actions').findOne(id); + + const amis_schema = doc.amis_schema || dbRecord.amis_schema; + + if(dbRecord && dbRecord.label != doc.label && amis_schema && _.isString(amis_schema) ){ + try { + const json = JSON.parse(amis_schema); + json.body[0].label = doc.label + doc.amis_schema = JSON.stringify(json) + } catch (error) { + console.log(error) + } + } + } delete doc.visible_type doc.visible; },