Procházet zdrojové kódy

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

@dayan_hjm před 1 rokem
rodič
revize
fe169bc320

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

@@ -47,6 +47,8 @@ class Gvc extends Component {
47 47
       manHourData: [
48 48
       ],
49 49
       manHourNum: 1,
50
+      leftName:deleteCacheAndChangeUrl("left",false,true),
51
+      rightName:deleteCacheAndChangeUrl("right",false,true),
50 52
     };
51 53
     this.timer = null //定时器,用于检测同步状态
52 54
   }
@@ -379,7 +381,7 @@ class Gvc extends Component {
379 381
   render() {
380 382
     const stores = this.store.state;
381 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 385
     return (
384 386
       <div className={[styles.gvc_home + ' home_box ']}>
385 387
         {/* 水印 */}
@@ -388,7 +390,7 @@ class Gvc extends Component {
388 390
         }
389 391
         {/* 右键切换大屏 */}
390 392
         {/* <Tooltip placement="bottom" title={"TLK运营数据中心 / TLK Plant Dashboard"}> */}
391
-        <Tooltip placement="bottom">
393
+        <Tooltip placement="bottom" title={rightName}>
392 394
           <img src={require("@assets/imgs/iconJpg/rightJ.png").default} alt="" className={"rightJ_png"} onClick={() => {
393 395
             deleteCacheAndChangeUrl("right", (url) => {
394 396
               this.props.history.replace(url);
@@ -396,7 +398,7 @@ class Gvc extends Component {
396 398
 
397 399
           }} />
398 400
         </Tooltip>
399
-        <Tooltip placement="bottom">
401
+        <Tooltip placement="bottom" title={leftName}>
400 402
           <img src={require("@assets/imgs/iconJpg/rightJL.png").default} alt="" className={"rightJ_png rightJ_png_L"} onClick={() => {
401 403
             deleteCacheAndChangeUrl("left", (url) => {
402 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 91
         legend: {
92 92
           type: 'scroll',
93
-          data: ['预算产量(Monthly Budget)', '产量(Net Production)','计划完成率(Prodction Efflciebcy)'],
93
+          data: ['预算产量(Monthly Budget)', '产量(Net Production)','计划完成率(Production Efficiency)'],
94 94
           fontFamily:'DingTalkJinBuTi',
95 95
           padding: [15, 0, 0, 0],
96 96
           textStyle:{
@@ -235,7 +235,7 @@ class OneSendView extends Component {
235 235
             showAllSymbol: true,
236 236
             yAxisIndex: 1,
237 237
             symbolSize: 6,
238
-            name: '计划完成率(Prodction Efflciebcy)',
238
+            name: '计划完成率(Production Efficiency)',
239 239
             itemStyle: {
240 240
                 normal: {
241 241
                     color: "#8D93FF",

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

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm 
3 3
  * @Date: 2023-10-25 10:32:44 
4 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 8
  * @Author: dayan_hjm 
@@ -55,6 +55,8 @@ class Home extends Component {
55 55
       manHourData: [
56 56
       ],
57 57
       manHourNum: 1,
58
+      leftName:deleteCacheAndChangeUrl("left",false,true),
59
+      rightName:deleteCacheAndChangeUrl("right",false,true),
58 60
     };
59 61
     this.timer = null //定时器,用于检测同步状态
60 62
   }
@@ -88,7 +90,6 @@ class Home extends Component {
88 90
     this.fontMsgChange();
89 91
     this.getUrl2()
90 92
     this.getUrl3();
91
-    this.getUrl();
92 93
     setTimeout(() => {
93 94
       this.videoStart();
94 95
     }, 200)
@@ -188,6 +189,7 @@ class Home extends Component {
188 189
   }
189 190
   async getUrl2() {
190 191
     await numberService().then(({ data = [], resultCode }) => {
192
+      this.getUrl();
191 193
       if (+resultCode === 0) {
192 194
         let tailiTotal = 0, totalValue = 0, productInventory = 0, yearDecline = 0, yearSend = 0, annualPlan = 0, implementationOfThePlan = 0;
193 195
         data.map((x, i) => {
@@ -264,7 +266,7 @@ class Home extends Component {
264 266
   render() {
265 267
     const stores = this.store.state;
266 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 270
     return (
269 271
       <div className={[styles.tlk_box + ' home_box ']}>
270 272
         {/* 水印 */}
@@ -272,14 +274,14 @@ class Home extends Component {
272 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 278
           <img src={require("@assets/imgs/iconJpg/rightJ.png").default} alt="" className={"rightJ_png"} onClick={() => {
277 279
             deleteCacheAndChangeUrl("right", (url) => {
278 280
               this.props.history.replace(url);
279 281
             })
280 282
           }} />
281 283
         </Tooltip>
282
-        <Tooltip placement="bottom">
284
+        <Tooltip placement="bottom" title={leftName}>
283 285
           <img src={require("@assets/imgs/iconJpg/rightJL.png").default} alt="" className={"rightJ_png rightJ_png_L"} onClick={() => {
284 286
             deleteCacheAndChangeUrl("left", (url) => {
285 287
               this.props.history.replace(url);
@@ -480,7 +482,7 @@ class Home extends Component {
480 482
                   </div>
481 483
                   <div className="topMsg_box">
482 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 486
                     <p className="topMsg_number_p" style={{ marginBottom: '0.05rem' }}>plan execution rate</p>
485 487
                     <span className="topMsg_number" class="shu1">{getThousandNum(implementationOfThePlan, true)}</span>
486 488
                     <span className="topMsg_number_2">%</span>

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

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm 
3 3
  * @Date: 2023-10-25 10:32:44 
4 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 8
  * @Author: dayan_hjm 
@@ -53,6 +53,9 @@ class Home extends Component {
53 53
       manHourData: [
54 54
       ],
55 55
       manHourNum: 1,
56
+      leftName:deleteCacheAndChangeUrl("left",false,true),
57
+      rightName:deleteCacheAndChangeUrl("right",false,true),
58
+
56 59
     };
57 60
     this.timer = null //定时器,用于检测同步状态
58 61
   }
@@ -252,7 +255,7 @@ class Home extends Component {
252 255
   render() {
253 256
     const stores = this.store.state;
254 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 259
     return (
257 260
       <div className={"home_box"}>
258 261
         {/* 水印 */}
@@ -260,14 +263,14 @@ class Home extends Component {
260 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 267
           <img src={require("@assets/imgs/iconJpg/rightJ.png").default} alt="" className={"rightJ_png"} onClick={() => {
265 268
             deleteCacheAndChangeUrl("right", (url) => {
266 269
               this.props.history.replace(url);
267 270
             })
268 271
           }} />
269 272
         </Tooltip>
270
-        <Tooltip placement="bottom">
273
+        <Tooltip placement="bottom" title={leftName}>
271 274
           <img src={require("@assets/imgs/iconJpg/rightJL.png").default} alt="" className={"rightJ_png rightJ_png_L"} onClick={() => {
272 275
             deleteCacheAndChangeUrl("left", (url) => {
273 276
               this.props.history.replace(url);

+ 46 - 25
src/utils/util.js

@@ -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