R实战-对导出数据进行评价-位置确定
list <- c("竣工工单考核预警")
table_l <- data.table(name=c("全触点竣工工单交付考核预警",
"城市区域工单交付考核预警",
"农村区域工单交付考核预警"),
table=c("net_onin_town_t",
"staff_oniurban_t",
"staff_onirural_t"))
udf_row_loc(table_l) # 表格行位置确定
for (i in (1:nrow(table_l))){
temp_table <- copy(get(table_l[,table][i]))
udf_excel_table(wb_current,list ,
table=temp_table , uni = FALSE,
rows_start = table_l[i,cumrow] + 6 + (i-1)7 , # 变动表格行确定
table_row = if(i>1){table_l[,cumrow]+i0}else{20} , skip_row=6 ,
multiples = i-1 ,
text=paste0(i,".",table_l[,name][i]) , # i-1起始写入
cond=FALSE , cond_1="" , cond_2="") # 条件格式
setColWidths(wb_current,list, cols= 3:13 , widths=9) # 设置多列列宽
全触点评价描述
if(i==1){
str_1 <- paste0(month(now()-ddays(1)),"月份截止",day(now()),"日,一日通工单",
net_onin_town_t[单位=="合计",一日通],"单,一日通占比",net_onin_town_t[单位=="合计",一日通占比],
",一日通占比不达标的单位为:")
str_2 <- (udf_order_str_link(as.list(net_onin_town_t[order(as.numeric(substr(一日通占比,1,3)))][
as.numeric(substr(一日通占比,1,3))<90,单位])))
str_3 <- paste0(net_onin_town_t[as.numeric(substr(百分百占比,1,3))==100,.N],"个经营单位订单百分百交付时限达标")
writeData(wb_current,list, paste0(str_1,str_2,";",str_3) ,
startRow = table_l[i,cumrow+rownum]+(i)*7+1 , startCol = 3) # 写入标题文本
}