yukiruby0245 发表于 2023-1-30 17:44:20

表单组件默认值如何取表单其他组件内容

表单怎么设置一个字段默认值,是取当前表单另外几个字段的值组合。
例如:标识subject,默认值代码如下:

return this.data.subject_1+"_"+this.workContext.getWork().creatorPerson+"_"+this.workContext.getWork().createTime;


可以正常取到流程实例的创建人和时间,但无法取到标识为subject_1的值(显示undefined)。




论坛管理员 发表于 2023-1-31 09:55:38

您写错了呀,您贴出来的脚本上是 this.data.subject_1,但是实际表单贴图上又是this.workContext().get().subject_1

yukiruby0245 发表于 2023-2-1 14:19:10

论坛管理员 发表于 2023-1-31 09:55
您写错了呀,您贴出来的脚本上是 this.data.subject_1,但是实际表单贴图上又是this.workContext().get().s ...

这两个都试了,都无法带出值。请问正确的代码应该是什么?

论坛管理员 发表于 2023-2-1 15:49:37

this.data.subject_1   这个就是正确的写法

yukiruby0245 发表于 2023-2-1 15:58:01

论坛管理员 发表于 2023-2-1 15:49
this.data.subject_1   这个就是正确的写法

这么写完,是undefined,会是什么原因?

yukiruby0245 发表于 2023-2-2 08:47:27

论坛管理员 发表于 2023-2-1 15:49
this.data.subject_1   这个就是正确的写法

return this.data.subject_1+"_"+this.workContext.getWork().creatorPerson+"_报销_"+this.workContext.getWork().createTime;





哪里有问题吗?

论坛管理员 发表于 2023-2-2 09:36:34

undefined说明您没有这个字段,您可以去流程实例维护里看一下,是否有这个字段

yukiruby0245 发表于 2023-2-3 10:06:17

论坛管理员 发表于 2023-2-2 09:36
undefined说明您没有这个字段,您可以去流程实例维护里看一下,是否有这个字段

...


帮忙看下,这个算是有这个字段吗?

yukiruby0245 发表于 2023-2-3 10:16:06

yukiruby0245 发表于 2023-2-3 10:06
帮忙看下,这个算是有这个字段吗?
补充报销流程的测试:
{
      "$attachmentList": [],
      "$work": {
                "activityArrivedTime": "2023-02-03 10:15:27",
                "activityName": "质量审核",
                "application": "c5d8d18b-1af6-4b91-af1d-671ce9cac2d6",
                "applicationAlias": "",
                "applicationName": "财务管理",
                "creatorIdentity": "夏乔乔@8_A0383@I",
                "creatorPerson": "夏乔乔@A0383@P",
                "creatorUnit": "数字化@8@U",
                "creatorUnitLevelName": "科技/数字化",
                "job": "92a581c8-8fcd-4a50-8d3e-82106f30ddee",
                "manualTaskIdentityText": "顾聪聪",
                "process": "18119c3e-7b99-4ccb-9710-e43f8abb4686",
                "processAlias": "",
                "processName": "费用报销申请单",
                "serial": "",
                "startTime": "2023-02-03 10:15:17",
                "startTimeMonth": "2023-02",
                "title": "undefined_夏乔乔_报销_undefined",
                "updateTime": "2023-02-03 10:15:27",
                "workId": "e9858451-26c2-46b4-9f84-7efc54c3dab5"
      },
      "attachment": [],
      "bdid": "",
      "bdmc": "",
      "bxzl": "雇员报销",
      "calendarEnd": "",
      "calendarStart": "",
      "datagrid": {
                "data": []
      },
      "dept": [
                {
                        "distinguishedName": "数字化@8@U",
                        "dn": "数字化@8@U",
                        "id": "687fd094-fa03-4951-adfb-93c8e241cd8f",
                        "level": 2,
                        "levelName": "科技/数字化",
                        "name": "数字化",
                        "typeList": [
                              "部门"
                        ],
                        "unique": "8"
                }
      ],
      "djzs": 2,
      "explain": "",
      "khyh": "测试",
      "kmmc": "",
      "name": [
                {
                        "distinguishedName": "夏乔乔@A0383@P",
                        "dn": "夏乔乔@A0383@P",
                        "employee": "A0383",
                        "genderType": "m",
                        "id": "5b5b36e0-c1dc-46e4-8665-93fc5923522a",
                        "mail": "qiaoqiao.xia@andertechs.com",
                        "mobile": "13911485786",
                        "name": "夏乔乔",
                        "officePhone": "",
                        "qq": "",
                        "unique": "A0383",
                        "weixin": ""
                }
      ],
      "note": "",
      "number": 0,
      "number_1": 1,
      "objectName": "测试",
      "radio": "现金",
      "select": "质量认证、检测",
      "select_2": "普通发票",
      "skzh": "测试",
      "subject": "undefined_夏乔乔_报销_undefined",
      "subject_1": "测试报销流程标题",
      "textfield": "测试",
      "textfield_1": "测试",
      "title": "",
      "zhmc": "测试"
}

yukiruby0245 发表于 2023-2-7 14:52:43

论坛管理员 发表于 2023-2-2 09:36
undefined说明您没有这个字段,您可以去流程实例维护里看一下,是否有这个字段

...

能帮忙看下吗
页: [1] 2
查看完整版本: 表单组件默认值如何取表单其他组件内容