steedos-platform icon indicating copy to clipboard operation
steedos-platform copied to clipboard

[Feature]: 记录详情页支持配置相关表,显示对应的审批任务清单

Open hotlong opened this issue 1 year ago • 4 comments

Summary 摘要

目前可以配置审批单

Why should this be worked on? 此需求的应用场景?

业务

hotlong avatar Jan 30 '24 06:01 hotlong

能配置出一个例子就好

hotlong avatar Feb 04 '24 02:02 hotlong

  • 记录详细页微页面中把以下代码放到“相关”选项卡即可。
  • 思路:用一个service组件请求当前记录对应的instances记录,并把其_id值记录到作用域变量中,然后里面放一个关联到“审批任务”对象的相关表组件,配置crudDataFilter属性把上面记录在作用域中的变量值映射到子表组件内,最后配置相关表组件的发送适配器把过滤条件改为[\"instance\", \"=\", api.body.projectInstanceIds]
{
  "type": "service",
  "body": [
    {
      "type": "steedos-object-related-listview",
      "label": "相关表",
      "objectApiName": "${objectName}",
      "recordId": "${recordId}",
      "id": "u:09f75d152e21",
      "relatedObjectApiName": "instance_tasks",
      "requestAdaptor": "debugger;\napi.data = {\n    query: api.body.query.replace(/{__filters}/g, JSON.stringify([\"instance\", \"=\", api.body.projectInstanceIds])).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim())\n}\nreturn api;",
      "crudDataFilter": "debugger;\ncrud.api.data.projectInstanceIds = data.projectInstanceIds;\nreturn crud;\n",
      "visibleOn": "${projectInstanceIds}"
    }
  ],
  "id": "u:5931eb398c98",
  "messages": {
  },
  "api": {
    "url": "https://5000-aquamarine-horse-hv97g4tb.ws.vscode.steedos.cn/api/v1/instances?filters=[[%22record_ids/o%22,%22=%22,%22project%22],[%22record_ids/ids%22,%22=%22,[%2265c33a4c35add905cc836871_62620e4d87e5c50032d9bd25%22]]]&fields=[%22instance%22]",
    "method": "get",
    "messages": {
    },
    "requestAdaptor": "",
    "adaptor": "let items = payload.data.items;\nconsole.log(\"===items===\", items);\n\nreturn {\n    data: {\n        projectInstanceIds: _.map(items, \"_id\")\n    }\n}"
  }
}

上面的示例代码需要在刚发的版本v2.6.7-beta.11及以上才能生效,跑steedos-ee项目,运行效果如图: image

yinlianghui avatar Feb 08 '24 09:02 yinlianghui

审批子表右上角的新建按钮可以通过在项目中extend审批对象并修改按钮的显隐规则来处理: image

yinlianghui avatar Feb 08 '24 13:02 yinlianghui

审批子表右上角的新建按钮可以通过在项目中extend审批对象并修改按钮的显隐规则来处理: image

已经不用配置了,因为内核已经新加上这段代码了,默认规则变成只要审批任务作为子表列表右上角就隐藏新建按钮。

yinlianghui avatar Feb 08 '24 13:02 yinlianghui