点击计划下发,要给任务状态的下拉框为空的赋值1(实际值),js提示是对了,但是没有插值成功 // 获取当前按钮的位置信息(标题栏) var location = this.options.location; var btnCr = FR.cellStr2ColumnRow(location); console.log("按钮位置(标题栏):", btnCr); // 获取表格内所有下拉框控件 var temp = ""; var arr =contentPane.getWidgetsByName("comboBox0"); console.log("找到的下拉框总数:", arr.length); // 检查下拉框数组是否存在且有元素 if (arr && arr.length > 0) { // 遍历所有下拉框 for (var i = 0; i < arr.length; i++) { var currentValue = arr[i].getValue(); console.log("值",currentValue); // 如果值为空,则设置为1 if (currentValue === null || currentValue === undefined || currentValue === "") { arr[i].setValue(1); temp += "第" + (i + 1) + "个下拉框已设置为1; "; } else { temp += "第" + (i + 1) + "个下拉框值为: " + currentValue + "; "; } } } else { // 当没有找到下拉框时的处理 temp = "未找到下拉框控件"; // 如果需要在没有下拉框时创建或设置默认值,可以在这里添加逻辑 // 注意:通常getWidgetsByName返回空数组表示没有找到控件,无法直接设置值 } // 显示处理结果 alert(temp); // 刷新报表使更改生效 setTimeout(() => { _g().refreshAllSheets(); }, 100);
|