Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block

...

title

脚本如下:

if(cell === null){ return "-"; }

if(rowData[0] === "品单价") {

        var rowsData = rows.data();

         if(rowsData[7][1]===null || rowsData[7][1]===0){

                return "-";

          }

return (rowsData[0][1]/rowsData[7][1]).toFixed(0);

}

if(rowData[0] === "折扣") {

          var rowsData = rows.data();

          if(rowsData[8][2]===null || rowsData[8][2]===0|| rowsData[8][1]===null || rowsData[8][1]===0){

                 return "-";

           }

        return (((rowsData[0][1]/rowsData[8][1])-(rowsData[0][2]/rowsData[8][2]))*100).toFixed(0)+"%";

}

return cell;

特定维度顺序进行排序
CASE 大类
when '鞋' then 1
when '上衣' then 2
when '长裤' then 3
END DESC
Code Block
languagejs
title值处理
VSUtils.comdifyValue(cell);  // 千分位,返回字符串
VSUtils.processValue(value, 2);  // 保留2位小数,返回字符串