diff --git a/CCFlow/CCFlow/WF/Todolist.htm b/CCFlow/CCFlow/WF/Todolist.htm index 1acf47fe..4faafc7b 100644 --- a/CCFlow/CCFlow/WF/Todolist.htm +++ b/CCFlow/CCFlow/WF/Todolist.htm @@ -78,7 +78,46 @@ BindTable(); }); + //定义排序函数 + function dateData(property, bol) { //property是你需要排序传入的key,bol为true时是升序,false为降序 + return function (a, b) { + var value1 = a[property]; + var value2 = b[property]; + // console.log("定义排序函数", a, b, property, bol, value1, Date.parse(value1)) + + if (bol) { + // 升序 + return Date.parse(value1) - Date.parse(value2); + } else { + // 降序 + return Date.parse(value2) - Date.parse(value1) + } + + } + } + let num =0 + function clickSort(type) { + num ++ + // console.log("触发点击排序", type) + // console.log("打印数据11111", data); //监听message事件,打印一下看数据格式 + let value = "" + if (type == "发起日期") { + value ="RDT" + } + if (type == "送达日期") { + value = "ADT" + } + if (num % 2 == 0) { + data.sort(dateData(value, true)) + } else { + data.sort(dateData(value, false)) + } + // console.log("打印数据33333333333333", data[0], data.sort(dateData("RDT", true))); //监听message事件,打印一下看数据格式 + + BindTable(); + + } function SearchIt() { if (keyword == null) @@ -137,8 +176,8 @@ } - tablet += "" + window.lang.fqrq + ""; - tablet += "" + window.lang.sdrq + ""; + tablet += "" + window.lang.fqrq + ""; + tablet += "" + window.lang.sdrq + ""; tablet += "" + window.lang.qixian + ""; tablet += "" + window.lang.zhuangtai + ""; tablet += "" + window.lang.leixing + "";