Appearance
informat.notification 系统通知
概述
使用informat.notification进行系统通知的操作。
queryNotificationListCount
查询系统通知列表总数
javascript
informat.notification.queryNotificationListCount(filter)| 参数 | 类型 | 描述 |
|---|---|---|
| filter | Filter | 过滤条件 |
过滤器中可以使用的字段列表
| 字段 | 类型 | 描述 |
|---|---|---|
| id | String | 系统通知ID |
| accountId | String | 账号ID |
| name | String | 名称 |
| type | String | 类型 |
| content | String | 内容 |
| isRead | Boolean | 是否已读 |
| isWebSend | String | web是否发送 |
| isDingTalkSend | String | 钉钉是否发送 |
| isFeishuSend | String | 飞书是否发送 |
| createTime | String | 创建时间 |
返回值
类型为Integer 返回系统通知总数
示例
javascript
const count = informat.notification.queryNotificationListCount({
conditionList: [
{
fieldId: 'accountId',
opt: 'eq',
value: 'x38s0fa436v69'
}
]
})
// 获取匹配到的列表
console.log('count:', count);queryNotificationList
查询系统通知列表
javascript
informat.notification.queryNotificationList(query)| 参数 | 类型 | 描述 |
|---|---|---|
| query | Query | 查询条件 |
过滤器中可以使用的字段列表
| 字段 | 类型 | 描述 |
|---|---|---|
| id | String | 系统通知ID |
| accountId | String | 账号ID |
| name | String | 名称 |
| type | String | 类型 |
| content | String | 内容 |
| isRead | Boolean | 是否已读 |
| isWebSend | String | web是否发送 |
| isDingTalkSend | String | 钉钉是否发送 |
| isFeishuSend | String | 飞书是否发送 |
| createTime | String | 创建时间 |
返回值
类型为Array<Notification> 返回系统通知列表
示例
javascript
const notificationList = informat.notification.queryNotificationList({
pageIndex: 1,
pageSize: 20,
filter: {
conditionList: [
{
fieldId: 'accountId',
opt: 'eq',
value: 'x38s0fa436v69'
}
]
}
})
// 获取系统通知列表
console.log('notificationList:', notificationList);updateNotification
更新系统通知
javascript
informat.notification.updateNotification(notification)| 参数 | 类型 | 描述 |
|---|---|---|
| notification | Notification | 系统通知 |
可以更新的字段列表
| 字段 | 类型 | 描述 |
|---|---|---|
| isWebSend | Boolean | Websocket是否已发送 |
| isWeworkSend | Boolean | 企业微信是否已发送 |
| isDingTalkSend | Boolean | 钉钉是否已发送 |
| isFeishuSend | Boolean | 飞书是否已发送 |
| isCustomSend | Boolean | 自定义通知是否已发送 |
返回值
类型为Integer 更新的记录数量
示例
javascript
informat.notification.updateNotification({
'id': 'e15ab1jmdjyl8',
'isWebSend': true,
'isWeworkSend': true,
'isDingTalkSend': true,
'isFeishuSend': true,
'isCustomSend': true
});deleteNotification
删除系统通知
javascript
informat.notification.deleteNotification(id)| 参数 | 类型 | 描述 |
|---|---|---|
| id | String | 系统通知ID |
返回值
类型为Integer 删除的记录数量
示例
javascript
informat.notification.deleteNotification('b8ynqdu6z31ry');queryCustomNotificationListCount
查询未发送自定义通知的系统通知列表总数
javascript
informat.notification.queryCustomNotificationListCount(filter)| 参数 | 类型 | 描述 |
|---|---|---|
| filter | Filter | 过滤条件 |
过滤器中可以使用的字段列表
| 字段 | 类型 | 描述 |
|---|---|---|
| id | String | 系统通知ID |
| accountId | String | 账号ID |
| name | String | 名称 |
| type | String | 类型 |
| content | String | 内容 |
| isWebSend | String | web是否发送 |
| isDingTalkSend | String | 钉钉是否发送 |
| isFeishuSend | String | 飞书是否发送 |
| createTime | String | 创建时间 |
返回值
类型为Integer 返回系统通知总数
示例
javascript
const count = informat.notification.queryCustomNotificationListCount({
conditionList: [
{
fieldId: 'accountId',
opt: 'eq',
value: 'x38s0fa436v69'
}
]
})
// 获取匹配到的列表
console.log('count:', count);queryCustomNotificationList
查询未发送自定义通知的系统通知列表
javascript
informat.notification.queryCustomNotificationList(query)| 参数 | 类型 | 描述 |
|---|---|---|
| query | Query | 查询条件 |
过滤器中可以使用的字段列表
| 字段 | 类型 | 描述 |
|---|---|---|
| id | String | 系统通知ID |
| accountId | String | 账号ID |
| name | String | 名称 |
| type | String | 类型 |
| content | String | 内容 |
| isWebSend | String | web是否发送 |
| isDingTalkSend | String | 钉钉是否发送 |
| isFeishuSend | String | 飞书是否发送 |
| createTime | String | 创建时间 |
返回值
类型为Array<Notification> 返回系统通知列表
示例
javascript
const notificationList = informat.notification.queryCustomNotificationList({
pageIndex: 1,
pageSize: 20,
filter: {
conditionList: [
{
fieldId: 'accountId',
opt: 'eq',
value: 'x38s0fa436v69'
}
]
}
})
// 获取匹配到的列表
console.log('notificationList:', notificationList);sendNotification
发送系统通知
javascript
informat.notification.sendNotification(notification)| 参数 | 类型 | 描述 |
|---|---|---|
| notification | NotificationForm | 系统通知表单 |
返回值
类型为String 返回系统通知ID
示例
javascript
const notificationId = informat.notification.sendNotification({
title: '通知标题',
content: '通知内容',
accountId: informat.app.userId(),
type: "openurl", // openurl||openrecord|openbpmntask
urlSetting: {
url: "https://next.informat.cn/",
"isAppURL": false
},
recordSetting: {
recordId: null,
moduleId: null,
},
bpmnTaskSetting: {
taskId: null,
moduleId: null
}
})
// 获取通知ID
console.log('notificationId:', notificationId);setCustomNotificationSent
设置自定义通知已发送
TIP
设置成功后 notificationSent.isCustomSend会修改为true(已发送)
javascript
informat.notification.setCustomNotificationSent(notificationId)| 参数 | 类型 | 描述 |
|---|---|---|
| notificationId | String | 通知ID |
示例
javascript
const notificationList = informat.notification.queryCustomNotificationList({
pageIndex: 1,
pageSize: 20,
filter: {
conditionList: [
{
fieldId: 'accountId',
opt: 'eq',
value: 'x38s0fa436v69'
}
]
}
})
notificationList.forEach(notification => {
console.log('notification:', notification);
// do smth
// 设置已发送
informat.notification.setCustomNotificationSent(notification.id)
});setThreadLocalEnableNotify
设置当前应用下是否启用通知的线程局部变量
javascript
informat.notification.setThreadLocalEnableNotify(enable)| 参数 | 类型 | 描述 |
|---|---|---|
| enable | Boolean | 是否启用通知 |
示例
javascript
informat.notification.setThreadLocalEnableNotify(true);isThreadLocalEnableNotify
获取当前应用下是否启用通知的线程局部变量
javascript
informat.notification.isThreadLocalEnableNotify()返回值
类型为Boolean 返回是否启用通知
示例
javascript
informat.notification.isThreadLocalEnableNotify();
