Просмотр исходного кода

feat: 限制无权限查看大屏 / 修复左右切换大屏的title显示

@dayan_hjm 1 год назад
Родитель
Сommit
fe169bc320

+ 5 - 3
src/pages/gvc/view.jsx

@@ -47,6 +47,8 @@ class Gvc extends Component {
47
       manHourData: [
47
       manHourData: [
48
       ],
48
       ],
49
       manHourNum: 1,
49
       manHourNum: 1,
50
+      leftName:deleteCacheAndChangeUrl("left",false,true),
51
+      rightName:deleteCacheAndChangeUrl("right",false,true),
50
     };
52
     };
51
     this.timer = null //定时器,用于检测同步状态
53
     this.timer = null //定时器,用于检测同步状态
52
   }
54
   }
@@ -379,7 +381,7 @@ class Gvc extends Component {
379
   render() {
381
   render() {
380
     const stores = this.store.state;
382
     const stores = this.store.state;
381
     let { totalValue, yearDecline, yearSend, imgMsgData } = this.store.state;
383
     let { totalValue, yearDecline, yearSend, imgMsgData } = this.store.state;
382
-    let { LeftHtml, updateTime, changGif } = this.state;
384
+    let { LeftHtml, updateTime, changGif,leftName,rightName } = this.state;
383
     return (
385
     return (
384
       <div className={[styles.gvc_home + ' home_box ']}>
386
       <div className={[styles.gvc_home + ' home_box ']}>
385
         {/* 水印 */}
387
         {/* 水印 */}
@@ -388,7 +390,7 @@ class Gvc extends Component {
388
         }
390
         }
389
         {/* 右键切换大屏 */}
391
         {/* 右键切换大屏 */}
390
         {/* <Tooltip placement="bottom" title={"TLK运营数据中心 / TLK Plant Dashboard"}> */}
392
         {/* <Tooltip placement="bottom" title={"TLK运营数据中心 / TLK Plant Dashboard"}> */}
391
-        <Tooltip placement="bottom">
393
+        <Tooltip placement="bottom" title={rightName}>
392
           <img src={require("@assets/imgs/iconJpg/rightJ.png").default} alt="" className={"rightJ_png"} onClick={() => {
394
           <img src={require("@assets/imgs/iconJpg/rightJ.png").default} alt="" className={"rightJ_png"} onClick={() => {
393
             deleteCacheAndChangeUrl("right", (url) => {
395
             deleteCacheAndChangeUrl("right", (url) => {
394
               this.props.history.replace(url);
396
               this.props.history.replace(url);
@@ -396,7 +398,7 @@ class Gvc extends Component {
396
 
398
 
397
           }} />
399
           }} />
398
         </Tooltip>
400
         </Tooltip>
399
-        <Tooltip placement="bottom">
401
+        <Tooltip placement="bottom" title={leftName}>
400
           <img src={require("@assets/imgs/iconJpg/rightJL.png").default} alt="" className={"rightJ_png rightJ_png_L"} onClick={() => {
402
           <img src={require("@assets/imgs/iconJpg/rightJL.png").default} alt="" className={"rightJ_png rightJ_png_L"} onClick={() => {
401
             deleteCacheAndChangeUrl("left", (url) => {
403
             deleteCacheAndChangeUrl("left", (url) => {
402
               this.props.history.replace(url);
404
               this.props.history.replace(url);

+ 2 - 2
src/pages/tlk/component/oneSendView.jsx

@@ -90,7 +90,7 @@ class OneSendView extends Component {
90
         },
90
         },
91
         legend: {
91
         legend: {
92
           type: 'scroll',
92
           type: 'scroll',
93
-          data: ['预算产量(Monthly Budget)', '产量(Net Production)','计划完成率(Prodction Efflciebcy)'],
93
+          data: ['预算产量(Monthly Budget)', '产量(Net Production)','计划完成率(Production Efficiency)'],
94
           fontFamily:'DingTalkJinBuTi',
94
           fontFamily:'DingTalkJinBuTi',
95
           padding: [15, 0, 0, 0],
95
           padding: [15, 0, 0, 0],
96
           textStyle:{
96
           textStyle:{
@@ -235,7 +235,7 @@ class OneSendView extends Component {
235
             showAllSymbol: true,
235
             showAllSymbol: true,
236
             yAxisIndex: 1,
236
             yAxisIndex: 1,
237
             symbolSize: 6,
237
             symbolSize: 6,
238
-            name: '计划完成率(Prodction Efflciebcy)',
238
+            name: '计划完成率(Production Efficiency)',
239
             itemStyle: {
239
             itemStyle: {
240
                 normal: {
240
                 normal: {
241
                     color: "#8D93FF",
241
                     color: "#8D93FF",

+ 8 - 6
src/pages/tlk/view.jsx

@@ -2,7 +2,7 @@
2
  * @Author: dayan_hjm 
2
  * @Author: dayan_hjm 
3
  * @Date: 2023-10-25 10:32:44 
3
  * @Date: 2023-10-25 10:32:44 
4
  * @Last Modified by: dayan_hjm
4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2024-10-31 09:26:57
5
+ * @Last Modified time: 2024-11-13 10:22:55
6
  */
6
  */
7
 /*
7
 /*
8
  * @Author: dayan_hjm 
8
  * @Author: dayan_hjm 
@@ -55,6 +55,8 @@ class Home extends Component {
55
       manHourData: [
55
       manHourData: [
56
       ],
56
       ],
57
       manHourNum: 1,
57
       manHourNum: 1,
58
+      leftName:deleteCacheAndChangeUrl("left",false,true),
59
+      rightName:deleteCacheAndChangeUrl("right",false,true),
58
     };
60
     };
59
     this.timer = null //定时器,用于检测同步状态
61
     this.timer = null //定时器,用于检测同步状态
60
   }
62
   }
@@ -88,7 +90,6 @@ class Home extends Component {
88
     this.fontMsgChange();
90
     this.fontMsgChange();
89
     this.getUrl2()
91
     this.getUrl2()
90
     this.getUrl3();
92
     this.getUrl3();
91
-    this.getUrl();
92
     setTimeout(() => {
93
     setTimeout(() => {
93
       this.videoStart();
94
       this.videoStart();
94
     }, 200)
95
     }, 200)
@@ -188,6 +189,7 @@ class Home extends Component {
188
   }
189
   }
189
   async getUrl2() {
190
   async getUrl2() {
190
     await numberService().then(({ data = [], resultCode }) => {
191
     await numberService().then(({ data = [], resultCode }) => {
192
+      this.getUrl();
191
       if (+resultCode === 0) {
193
       if (+resultCode === 0) {
192
         let tailiTotal = 0, totalValue = 0, productInventory = 0, yearDecline = 0, yearSend = 0, annualPlan = 0, implementationOfThePlan = 0;
194
         let tailiTotal = 0, totalValue = 0, productInventory = 0, yearDecline = 0, yearSend = 0, annualPlan = 0, implementationOfThePlan = 0;
193
         data.map((x, i) => {
195
         data.map((x, i) => {
@@ -264,7 +266,7 @@ class Home extends Component {
264
   render() {
266
   render() {
265
     const stores = this.store.state;
267
     const stores = this.store.state;
266
     let { totalValue, yearDecline, yearSend, productInventory, annualPlan, implementationOfThePlan } = this.store.state;
268
     let { totalValue, yearDecline, yearSend, productInventory, annualPlan, implementationOfThePlan } = this.store.state;
267
-    let { changGif, updateTime, changNun, imgMsgData } = this.state;
269
+    let { changGif, updateTime, changNun, imgMsgData,leftName,rightName } = this.state;
268
     return (
270
     return (
269
       <div className={[styles.tlk_box + ' home_box ']}>
271
       <div className={[styles.tlk_box + ' home_box ']}>
270
         {/* 水印 */}
272
         {/* 水印 */}
@@ -272,14 +274,14 @@ class Home extends Component {
272
           window.urlConfig && window.urlConfig.SHOW_WATERMARK && <div className={"shuiYin"} style={{ backgroundImage: `url(${$store.app.markSrc})`, backgroundRepeat: 'repeat' }}></div>
274
           window.urlConfig && window.urlConfig.SHOW_WATERMARK && <div className={"shuiYin"} style={{ backgroundImage: `url(${$store.app.markSrc})`, backgroundRepeat: 'repeat' }}></div>
273
         }
275
         }
274
         {/* 右键切换大屏 */}
276
         {/* 右键切换大屏 */}
275
-        <Tooltip placement="bottom">
277
+        <Tooltip placement="bottom" title={rightName}>
276
           <img src={require("@assets/imgs/iconJpg/rightJ.png").default} alt="" className={"rightJ_png"} onClick={() => {
278
           <img src={require("@assets/imgs/iconJpg/rightJ.png").default} alt="" className={"rightJ_png"} onClick={() => {
277
             deleteCacheAndChangeUrl("right", (url) => {
279
             deleteCacheAndChangeUrl("right", (url) => {
278
               this.props.history.replace(url);
280
               this.props.history.replace(url);
279
             })
281
             })
280
           }} />
282
           }} />
281
         </Tooltip>
283
         </Tooltip>
282
-        <Tooltip placement="bottom">
284
+        <Tooltip placement="bottom" title={leftName}>
283
           <img src={require("@assets/imgs/iconJpg/rightJL.png").default} alt="" className={"rightJ_png rightJ_png_L"} onClick={() => {
285
           <img src={require("@assets/imgs/iconJpg/rightJL.png").default} alt="" className={"rightJ_png rightJ_png_L"} onClick={() => {
284
             deleteCacheAndChangeUrl("left", (url) => {
286
             deleteCacheAndChangeUrl("left", (url) => {
285
               this.props.history.replace(url);
287
               this.props.history.replace(url);
@@ -480,7 +482,7 @@ class Home extends Component {
480
                   </div>
482
                   </div>
481
                   <div className="topMsg_box">
483
                   <div className="topMsg_box">
482
                     <p className="topMsg_number_p topMsg_number_p_big">年度锂辉石计划执行率</p>
484
                     <p className="topMsg_number_p topMsg_number_p_big">年度锂辉石计划执行率</p>
483
-                    <p className="topMsg_number_p">Annual lithium pyroxene</p>
485
+                    <p className="topMsg_number_p">Annual spodumene</p>
484
                     <p className="topMsg_number_p" style={{ marginBottom: '0.05rem' }}>plan execution rate</p>
486
                     <p className="topMsg_number_p" style={{ marginBottom: '0.05rem' }}>plan execution rate</p>
485
                     <span className="topMsg_number" class="shu1">{getThousandNum(implementationOfThePlan, true)}</span>
487
                     <span className="topMsg_number" class="shu1">{getThousandNum(implementationOfThePlan, true)}</span>
486
                     <span className="topMsg_number_2">%</span>
488
                     <span className="topMsg_number_2">%</span>

+ 7 - 4
src/pages/tqcDataVHome/view.jsx

@@ -2,7 +2,7 @@
2
  * @Author: dayan_hjm 
2
  * @Author: dayan_hjm 
3
  * @Date: 2023-10-25 10:32:44 
3
  * @Date: 2023-10-25 10:32:44 
4
  * @Last Modified by: dayan_hjm
4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2024-11-11 14:14:26
5
+ * @Last Modified time: 2024-11-13 10:24:39
6
  */
6
  */
7
 /*
7
 /*
8
  * @Author: dayan_hjm 
8
  * @Author: dayan_hjm 
@@ -53,6 +53,9 @@ class Home extends Component {
53
       manHourData: [
53
       manHourData: [
54
       ],
54
       ],
55
       manHourNum: 1,
55
       manHourNum: 1,
56
+      leftName:deleteCacheAndChangeUrl("left",false,true),
57
+      rightName:deleteCacheAndChangeUrl("right",false,true),
58
+
56
     };
59
     };
57
     this.timer = null //定时器,用于检测同步状态
60
     this.timer = null //定时器,用于检测同步状态
58
   }
61
   }
@@ -252,7 +255,7 @@ class Home extends Component {
252
   render() {
255
   render() {
253
     const stores = this.store.state;
256
     const stores = this.store.state;
254
     let { totalValue, yearDecline, yearSend, productInventory } = this.store.state;
257
     let { totalValue, yearDecline, yearSend, productInventory } = this.store.state;
255
-    let { changGif, updateTime, changNun } = this.state;
258
+    let { changGif, updateTime, changNun,leftName,rightName } = this.state;
256
     return (
259
     return (
257
       <div className={"home_box"}>
260
       <div className={"home_box"}>
258
         {/* 水印 */}
261
         {/* 水印 */}
@@ -260,14 +263,14 @@ class Home extends Component {
260
           window.urlConfig && window.urlConfig.SHOW_WATERMARK && <div className={"shuiYin"} style={{ backgroundImage: `url(${$store.app.markSrc})`, backgroundRepeat: 'repeat' }}></div>
263
           window.urlConfig && window.urlConfig.SHOW_WATERMARK && <div className={"shuiYin"} style={{ backgroundImage: `url(${$store.app.markSrc})`, backgroundRepeat: 'repeat' }}></div>
261
         }
264
         }
262
         {/* 右键切换大屏 */}
265
         {/* 右键切换大屏 */}
263
-        <Tooltip placement="bottom">
266
+        <Tooltip placement="bottom" title={rightName}>
264
           <img src={require("@assets/imgs/iconJpg/rightJ.png").default} alt="" className={"rightJ_png"} onClick={() => {
267
           <img src={require("@assets/imgs/iconJpg/rightJ.png").default} alt="" className={"rightJ_png"} onClick={() => {
265
             deleteCacheAndChangeUrl("right", (url) => {
268
             deleteCacheAndChangeUrl("right", (url) => {
266
               this.props.history.replace(url);
269
               this.props.history.replace(url);
267
             })
270
             })
268
           }} />
271
           }} />
269
         </Tooltip>
272
         </Tooltip>
270
-        <Tooltip placement="bottom">
273
+        <Tooltip placement="bottom" title={leftName}>
271
           <img src={require("@assets/imgs/iconJpg/rightJL.png").default} alt="" className={"rightJ_png rightJ_png_L"} onClick={() => {
274
           <img src={require("@assets/imgs/iconJpg/rightJL.png").default} alt="" className={"rightJ_png rightJ_png_L"} onClick={() => {
272
             deleteCacheAndChangeUrl("left", (url) => {
275
             deleteCacheAndChangeUrl("left", (url) => {
273
               this.props.history.replace(url);
276
               this.props.history.replace(url);

+ 46 - 25
src/utils/util.js

@@ -34,11 +34,11 @@ export function getParams(url = "") {
34
 export function sortby(prop, rev = true) {
34
 export function sortby(prop, rev = true) {
35
   // prop 属性名
35
   // prop 属性名
36
   // rev  升序降序 默认升序
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
   return par;
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
   //统一保留2位小数
986
   //统一保留2位小数
987
   // num = Math.floor(num*100)/100;
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
   var TextBox8_all = num.toLocaleString();
989
   var TextBox8_all = num.toLocaleString();
990
   // var text8_sum = TextBox8_all.replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,'$1,');
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
   return TextBox8_all;
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
   const HasScreen = localStorage.getItem("tqcHasScreen").split(",") || [];
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
   let newHasScreen = [];
1019
   let newHasScreen = [];
1005
-  screenName.map(x=>{
1006
-    if(HasScreen.includes(x)){
1020
+  screenName.map(x => {
1021
+    if (HasScreen.includes(x)) {
1007
       newHasScreen.push(x)
1022
       newHasScreen.push(x)
1008
     }
1023
     }
1009
   })
1024
   })
1010
   console.log(newHasScreen)
1025
   console.log(newHasScreen)
1011
   //找到下一页的大屏
1026
   //找到下一页的大屏
1012
-  const currUrl = window.location.hash.split("#")[1];
1013
   let ai = 0;
1027
   let ai = 0;
1014
   for (let index = 0; index < newHasScreen.length; index++) {
1028
   for (let index = 0; index < newHasScreen.length; index++) {
1015
     const element = newHasScreen[index];
1029
     const element = newHasScreen[index];
1016
-    if(element == currUrl){
1030
+    if (element == currUrl) {
1017
       ai = index
1031
       ai = index
1018
     }
1032
     }
1019
   }
1033
   }
1020
   let newUrl = '';
1034
   let newUrl = '';
1021
-  if(next == 'right'){//向右切
1035
+  if (next == 'right') {//向右切
1022
     //当前地址在菜单数组中的index
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
   RouterCache.deleteCache(newUrl)
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