JS_调整飞书多维表格中的数据 JS_调整飞书多维表格中的数据_使用的AW// 飞书应用配置 const APP_IDXXX;const APP_SECRETXXX;// 表格配置 const APP_TOKENXXX;const TABLE_IDXXX;// 技术支持姓名 const rpa_coachstartTrigger.data.rpa_coach;// 获取 tenant_access_token asyncfunctiongetTenantAccessToken(){const urlhttps://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal;const headers{Content-Type:application/json; charsetutf-8};const data{app_id: APP_ID, app_secret: APP_SECRET};const responseawait fetch(url,{method:POST, headers, body: JSON.stringify(data)});const resultawait response.json();if(result.code0){returnresult.tenant_access_token;}else{throw new Error(获取token失败: ${result.msg});}}// 查询技术支持人员的工作负荷 asyncfunctionqueryRpaCoachWorkload(token, rpa_coach){const urlhttps://open.feishu.cn/open-apis/bitable/v1/apps/${APP_TOKEN}/tables/${TABLE_ID}/records/search;const headers{Authorization:Bearer ${token},Content-Type:application/json; charsetutf-8};const data{view_id:vewSz3NSZh, field_names:[RPA教练,工作负荷], filter:{conjunction:and, conditions:[{field_name:RPA教练, operator:is, value:[rpa_coach]}]}};const responseawait fetch(url,{method:POST, headers, body: JSON.stringify(data)});const resultawait response.json();if(result.code0){const recordsresult.data?.items||[];if(records.length0){const recordrecords[0];const workloadrecord.fields?.[工作负荷];const record_idrecord.record_id;return{rpa_coach, workload, record_id};}else{// 不抛异常返回特殊标识return{rpa_coach, workload: null, record_id: null, message:未找到对应RPA教练的工作负荷记录};}}else{throw new Error(查询记录失败: ${result.msg});}}// 更新技术支持人员工作负荷 asyncfunctionupdateRpaCoachWorkloadRecord(token, record_id, updated_workload){const urlhttps://open.feishu.cn/open-apis/bitable/v1/apps/${APP_TOKEN}/tables/${TABLE_ID}/records/${record_id};const headers{Authorization:Bearer ${token},Content-Type:application/json; charsetutf-8};const data{fields:{工作负荷:updated_workload}};const responseawait fetch(url,{method:PUT, headers, body: JSON.stringify(data)});const resultawait response.json();return{success: result.code0, code: result.code, msg: result.msg};}asyncfunctionupdateRpaCoachWorkloadSafe(){const tokenawait getTenantAccessToken();const query_resultawait queryRpaCoachWorkload(token, rpa_coach);if(query_result.record_idnull){// 未找到记录直接返回该信息return{rpa_coach: rpa_coach, update_msg:未找到对应RPA教练的工作负荷记录};}const record_idquery_result.record_id;const current_workloadquery_result.workload;const updated_workloadcurrent_workload -1;const update_resultawait updateRpaCoachWorkloadRecord(token, record_id, updated_workload);return{rpa_coach: rpa_coach, previous_workload: current_workload, updated_workload, update_success: update_result.success, update_code: update_result.code, update_msg: update_result.msg};}returnupdateRpaCoachWorkloadSafe();

相关新闻

最新新闻

Komorebi 五分钟装好 Linux 动态壁纸

Komorebi 五分钟装好 Linux 动态壁纸

Komorebi 五分钟装好 Linux 动态壁纸 【免费下载链接】komorebi A beautiful and customizable wallpapers manager for Linux 项目地址: https://gitcode.com/gh_mirrors/kom/komorebi 每天解锁屏幕,桌面背景还是那张灰蓝渐变,换张静态图也就到此…

2026/8/24 22:08:37
2条命令跑通手机号查QQ:phone2qq上手记

2条命令跑通手机号查QQ:phone2qq上手记

2条命令跑通手机号查QQ:phone2qq上手记 【免费下载链接】phone2qq 项目地址: https://gitcode.com/gh_mirrors/ph/phone2qq 室友在找当年高三注册的QQ,只记得当时收验证码用的手机号,账号本体早忘了。phone2qq就是干这事的&#xff1…

2026/8/24 22:08:37
GyroFlow 陀螺仪防抖:3 步把抖成渣的手持视频救回来

GyroFlow 陀螺仪防抖:3 步把抖成渣的手持视频救回来

GyroFlow 陀螺仪防抖:3 步把抖成渣的手持视频救回来 【免费下载链接】gyroflow Video stabilization using gyroscope data 项目地址: https://gitcode.com/GitHub_Trending/gy/gyroflow 手持视频防抖软件里,GyroFlow 的思路最不一样:…

2026/8/24 22:08:37
lxmusic-source-all 洛雪音源汇总:22 个开源音源的完整使用指南

lxmusic-source-all 洛雪音源汇总:22 个开源音源的完整使用指南

lxmusic-source-all 洛雪音源汇总:22 个开源音源的完整使用指南 【免费下载链接】lxmusic-source-all 洛雪音源汇总 项目地址: https://gitcode.com/gh_mirrors/lx/lxmusic-source-all lxmusic-source-all 是洛雪音乐的开源音源汇总仓库,一次收录…

2026/8/24 22:08:37
codex 安装前置软件

codex 安装前置软件

先决条件 1.安装git (1).Git - Install for macOS 1.macos install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 回车 输入密码,等着安装就好了. 2 .Git - Install for macOS 2.安装Nodejs 下…

2026/8/24 22:08:37
React Native 文件选择实战:react-native-document-picker 从选文件到另存为的完整指南

React Native 文件选择实战:react-native-document-picker 从选文件到另存为的完整指南

React Native 文件选择实战:react-native-document-picker 从选文件到另存为的完整指南 【免费下载链接】react-native-document-picker Document Picker and Viewer for React Native 项目地址: https://gitcode.com/gh_mirrors/re/react-native-document-picker…

2026/8/24 22:03:37