表单组件默认值如何取表单其他组件内容
表单怎么设置一个字段默认值,是取当前表单另外几个字段的值组合。
例如:标识subject,默认值代码如下:
return this.data.subject_1+"_"+this.workContext.getWork().creatorPerson+"_"+this.workContext.getWork().createTime;
可以正常取到流程实例的创建人和时间,但无法取到标识为subject_1的值(显示undefined)。
https://www.o2oa.net/forum/data/attachment/forum/202301/30/63d7916f7e1e2.png
报销流程的测试:
{
"$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": "测试"
}
return this.data.subject_1+"_"+this.workContext.getWork().creatorPerson+"_"+this.workContext.getWork().createTime;
就这样写,没问题。
但是您第一次拟稿进来subject_1是没有数据的,所以undefined,您可以在subject_1这个字段的change事件里增加脚本,给subject赋值,this.data.subject=this.data.subject_1+"_"+this.workContext.getWork().creatorPerson+"_"+this.workContext.getWork().createTime; 论坛管理员 发表于 2023-2-14 09:58
return this.data.subject_1+"_"+this.workContext.getWork().creatorPerson+"_"+this.workContext.getWork ...
我理解了,问题已解决,谢谢! :handshake
页:
[1]