|
|
@@ -34,11 +34,11 @@ export function getParams(url = "") {
|
|
34
|
34
|
export function sortby(prop, rev = true) {
|
|
35
|
35
|
// prop 属性名
|
|
36
|
36
|
// rev 升序降序 默认升序
|
|
37
|
|
- return function(a, b) {
|
|
38
|
|
- var val1 = a[prop];
|
|
39
|
|
- var val2 = b[prop];
|
|
40
|
|
- return rev ? val1 - val2 : val2 - val1;
|
|
41
|
|
- }
|
|
|
37
|
+ return function (a, b) {
|
|
|
38
|
+ var val1 = a[prop];
|
|
|
39
|
+ var val2 = b[prop];
|
|
|
40
|
+ return rev ? val1 - val2 : val2 - val1;
|
|
|
41
|
+ }
|
|
42
|
42
|
}
|
|
43
|
43
|
|
|
44
|
44
|
/**下载文件*/
|
|
|
@@ -981,53 +981,74 @@ export function mapTree2(tree, c_name, la_name, isChildren = false, fathers) {
|
|
981
|
981
|
return par;
|
|
982
|
982
|
}
|
|
983
|
983
|
|
|
984
|
|
-export function getThousandNum(num,need100){
|
|
985
|
|
- if(!num){return 0}
|
|
|
984
|
+export function getThousandNum(num, need100) {
|
|
|
985
|
+ if (!num) { return 0 }
|
|
986
|
986
|
//统一保留2位小数
|
|
987
|
987
|
// num = Math.floor(num*100)/100;
|
|
988
|
|
- num = Number(need100 ? (num*100).toFixed(2) : num.toFixed(2));
|
|
|
988
|
+ num = Number(need100 ? (num * 100).toFixed(2) : num.toFixed(2));
|
|
989
|
989
|
var TextBox8_all = num.toLocaleString();
|
|
990
|
990
|
// var text8_sum = TextBox8_all.replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,'$1,');
|
|
991
|
|
- if(TextBox8_all.split('.')[1] && TextBox8_all.split('.')[1].length == 1){
|
|
992
|
|
- TextBox8_all = TextBox8_all+'0'
|
|
993
|
|
- }else if (!TextBox8_all.split('.')[1]){
|
|
994
|
|
- TextBox8_all = TextBox8_all+'.00'
|
|
|
991
|
+ if (TextBox8_all.split('.')[1] && TextBox8_all.split('.')[1].length == 1) {
|
|
|
992
|
+ TextBox8_all = TextBox8_all + '0'
|
|
|
993
|
+ } else if (!TextBox8_all.split('.')[1]) {
|
|
|
994
|
+ TextBox8_all = TextBox8_all + '.00'
|
|
995
|
995
|
}
|
|
996
|
996
|
return TextBox8_all;
|
|
997
|
997
|
}
|
|
998
|
998
|
|
|
999
|
999
|
//大屏转跳-去除缓存
|
|
1000
|
|
-export function deleteCacheAndChangeUrl(next='left',callback){
|
|
1001
|
|
- const screenName = ["/home/operation","/home/gvc","/home/tlk"];
|
|
|
1000
|
+export function deleteCacheAndChangeUrl(next = 'left', callback, needName) {//needName 获取名称
|
|
|
1001
|
+ const screenName = ["/home/operation", "/home/gvc", "/home/tlk"];
|
|
|
1002
|
+ const names = ["运营数据中心", "产供销价值链", "TLK运营数据中心 / TLK Plant Dashboard"];
|
|
1002
|
1003
|
const HasScreen = localStorage.getItem("tqcHasScreen").split(",") || [];
|
|
|
1004
|
+ const currUrl = window.location.hash.split("#")[1];
|
|
|
1005
|
+ //检测是否含有当前页面的路径
|
|
|
1006
|
+ if (!HasScreen.includes(currUrl)) {
|
|
|
1007
|
+ message.error("您没有当前路径的权限!").then(() => {
|
|
|
1008
|
+ setTimeout(() => {
|
|
|
1009
|
+ if(HasScreen && HasScreen[0]){
|
|
|
1010
|
+ window.location = window.location.origin + '/transfer.html#'+HasScreen[0];
|
|
|
1011
|
+ }else{
|
|
|
1012
|
+ window.location = window.location.origin + '/transfer.html#/login';
|
|
|
1013
|
+ }
|
|
|
1014
|
+ }, 300)
|
|
|
1015
|
+ })
|
|
|
1016
|
+ return
|
|
|
1017
|
+ }
|
|
1003
|
1018
|
//排序菜单路径
|
|
1004
|
1019
|
let newHasScreen = [];
|
|
1005
|
|
- screenName.map(x=>{
|
|
1006
|
|
- if(HasScreen.includes(x)){
|
|
|
1020
|
+ screenName.map(x => {
|
|
|
1021
|
+ if (HasScreen.includes(x)) {
|
|
1007
|
1022
|
newHasScreen.push(x)
|
|
1008
|
1023
|
}
|
|
1009
|
1024
|
})
|
|
1010
|
1025
|
console.log(newHasScreen)
|
|
1011
|
1026
|
//找到下一页的大屏
|
|
1012
|
|
- const currUrl = window.location.hash.split("#")[1];
|
|
1013
|
1027
|
let ai = 0;
|
|
1014
|
1028
|
for (let index = 0; index < newHasScreen.length; index++) {
|
|
1015
|
1029
|
const element = newHasScreen[index];
|
|
1016
|
|
- if(element == currUrl){
|
|
|
1030
|
+ if (element == currUrl) {
|
|
1017
|
1031
|
ai = index
|
|
1018
|
1032
|
}
|
|
1019
|
1033
|
}
|
|
1020
|
1034
|
let newUrl = '';
|
|
1021
|
|
- if(next == 'right'){//向右切
|
|
|
1035
|
+ if (next == 'right') {//向右切
|
|
1022
|
1036
|
//当前地址在菜单数组中的index
|
|
1023
|
|
- newUrl = newHasScreen[ai+1] || newHasScreen[0]
|
|
1024
|
|
- }else{
|
|
1025
|
|
- newUrl = newHasScreen[ai-1] || newHasScreen[newHasScreen.length-1]
|
|
|
1037
|
+ newUrl = newHasScreen[ai + 1] || newHasScreen[0]
|
|
|
1038
|
+ } else {
|
|
|
1039
|
+ newUrl = newHasScreen[ai - 1] || newHasScreen[newHasScreen.length - 1]
|
|
1026
|
1040
|
}
|
|
|
1041
|
+ const sIndex = screenName.findIndex(b => b === newUrl);
|
|
|
1042
|
+ let newName = names[sIndex];
|
|
1027
|
1043
|
RouterCache.deleteCache(newUrl)
|
|
1028
|
|
- setTimeout(()=>{
|
|
1029
|
|
- callback && callback(newUrl)
|
|
1030
|
|
- },300)
|
|
|
1044
|
+ console.log(111111111111)
|
|
|
1045
|
+ if (needName) {
|
|
|
1046
|
+ return newName
|
|
|
1047
|
+ } else {
|
|
|
1048
|
+ setTimeout(() => {
|
|
|
1049
|
+ callback && callback(newUrl)
|
|
|
1050
|
+ }, 300)
|
|
|
1051
|
+ }
|
|
1031
|
1052
|
}
|
|
1032
|
1053
|
|
|
1033
|
1054
|
|