浏览代码

看板-增加cookie ,样式调整

xiaost 2 年之前
父节点
当前提交
33643ecf7e

+ 15 - 0
package-lock.json

@@ -12,8 +12,10 @@
         "@types/echarts": "^4.4.3",
         "axios": "^1.3.5",
         "core-js": "^3.6.4",
+        "crypto-js": "^4.2.0",
         "echarts": "^4.6.0",
         "element-ui": "^2.15.9",
+        "js-cookie": "^3.0.5",
         "less": "^4.1.3",
         "less-loader": "^6.0.0",
         "vue": "^2.6.11",
@@ -5506,6 +5508,11 @@
         "node": "*"
       }
     },
+    "node_modules/crypto-js": {
+      "version": "4.2.0",
+      "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
+      "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
+    },
     "node_modules/css-color-names": {
       "version": "0.0.4",
       "resolved": "https://registry.npmmirror.com/css-color-names/-/css-color-names-0.0.4.tgz",
@@ -9740,6 +9747,14 @@
       "dev": true,
       "license": "MIT"
     },
+    "node_modules/js-cookie": {
+      "version": "3.0.5",
+      "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz",
+      "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==",
+      "engines": {
+        "node": ">=14"
+      }
+    },
     "node_modules/js-message": {
       "version": "1.0.7",
       "resolved": "https://registry.npmmirror.com/js-message/-/js-message-1.0.7.tgz",

+ 2 - 0
package.json

@@ -12,8 +12,10 @@
     "@types/echarts": "^4.4.3",
     "axios": "^1.3.5",
     "core-js": "^3.6.4",
+    "crypto-js": "^4.2.0",
     "echarts": "^4.6.0",
     "element-ui": "^2.15.9",
+    "js-cookie": "^3.0.5",
     "less": "^4.1.3",
     "less-loader": "^6.0.0",
     "vue": "^2.6.11",

+ 8 - 6
src/components/smtechart/bottom/bottom1Chart/chart.vue

@@ -199,8 +199,8 @@
                             position: 'bottom',
                             axisLine: true,
                             axisLabel: {
-                                color: 'rgba(255,255,255,.8)',
-                                fontSize: 12
+                                //color: 'rgba(255,255,255,.8)',
+                                fontSize: 15
                             },
                             data: newData.weekCategory
                         },
@@ -229,8 +229,8 @@
                                 }
                             },
                             axisLabel: {
-                                color: 'rgba(255,255,255,.8)',
-                                fontSize: 12
+                                //color: 'rgba(255,255,255,.8)',
+                                fontSize: 15
                             }
                         },
                         series: [
@@ -327,7 +327,7 @@
                                 lineStyle: {
                                     normal: {
                                         color: this.colorList.linearBtoG,
-                                        width: 3
+                                        width: 4
                                     }
                                 },
                                 areaStyle: {
@@ -338,7 +338,8 @@
                                 data: newData.weekLineData,
                                 label: {
                                     show: true,
-                                    position: 'top'
+                                    position: 'top',
+                                    fontSize:14,
                                 },
                                 lineSmooth: true,
                                 markLine: {
@@ -356,6 +357,7 @@
                                         }
                                     },
                                     lineStyle: {
+                                        fontSize: 16,
                                         normal: {
                                             color: 'rgba(248,211,81,.7)'
                                         }

+ 50 - 15
src/components/smtechart/up/up1Chart/chart.vue

@@ -24,7 +24,13 @@ export default {
             type: 'shadow'
           }
         },
-        legend: {},
+        legend: {
+          textStyle: {
+            fontSize: 18
+          },
+          itemWidth: 29,
+          itemHeight: 19
+        },
         grid: {
           left: '3%',
           right: '4%',
@@ -34,13 +40,19 @@ export default {
         xAxis: [
           {
             type: 'category',
-            data:[]
-            //data: ['插件-01', '插件-02', '插件-03', '插件-04', '插件-05', '插件-06', '插件-07'],
+            data:[],
+            axisLabel: {
+              fontSize: 16,
+              fontWeight: "bold"
+            }
           }
         ],
         yAxis: [
           {
             type: 'value',
+            axisLabel: {
+              fontSize: 16
+            }
           },
           {
             type: 'value',
@@ -48,8 +60,12 @@ export default {
             min: 0,
             max: 100,
             interval: 20,
+            nameTextStyle: {
+              fontSize: 20
+            },
             axisLabel: {
-              formatter: '{value}%'
+              formatter: '{value}%',
+              fontSize: 16
             }
           }
 
@@ -58,41 +74,54 @@ export default {
           {
             name: '投入',
             type: 'bar',
-            barWidth: 20,
+            barWidth: 25,
             emphasis: {
               focus: 'series'
             },
-            data:[]
-            //data: [320, 332, 301, 334, 390, 330, 320]
+            data:[],
+            label: {
+              show: true,
+              position: 'top',
+              fontSize:14,
+              fontWeight: "bold"
+            },
           },
           {
             name: '产出',
             type: 'bar',
-            barWidth: 20,
+            barWidth: 25,
             stack: 'Ad',
             emphasis: {
               focus: 'series'
             },
-            data:[]
-            //data: [220, 232, 221, 234, 290, 230, 220]
+            data:[],
+            label: {
+              show: true,
+              position: 'top',
+              fontSize:14,
+              fontWeight: "bold"
+            },
           },
           {
             name: '不良',
             type: 'bar',
             stack: 'Ad',
-            barWidth: 10,
+            barWidth: 25,
             data:[],
-            //data: [12, 22, 32, 12, 32, 12, 32],
             emphasis: {
               focus: 'series'
-            }
+            },
+            label: {
+              show: false,
+              position: 'top',
+              fontSize:14,
+            },
           },
           {
             name: '良率%',
             type: 'line',
             data:[],
             yAxisIndex: 1,
-            //data: [92, 92,92, 72, 82, 62, 62],
             tooltip: {
               valueFormatter: function (value) {
                 return value + '%';
@@ -110,7 +139,13 @@ export default {
             },
             emphasis: {
               focus: 'series'
-            }
+            },
+            label: {
+              show: true,
+              position: 'top',
+              fontSize:14,
+              fontWeight: "bold"
+            },
           }
         ]
       },

+ 1 - 1
src/components/smtechart/up/up2Chart/chart.vue

@@ -3,7 +3,7 @@
     <Echart
       :options="options"
       id="up2Chart"
-      height="210px"
+      height="160px"
       width="280px"
     ></Echart>
   </div>

+ 2 - 0
src/main.js

@@ -18,12 +18,14 @@ import 'vue-awesome/icons/align-left.js';
 import echarts from 'echarts'
 import ElementUI from 'element-ui';
 
+import Cookies from 'js-cookie'
 
 //5.x 引用方式为按需引用
 //希望使用5.x版本的话,需要在package.json中更新版本号,并切换引用方式
 //import * as echarts from 'echarts'
 Vue.prototype.$echarts = echarts
 Vue.config.productionTip = false;
+Vue.prototype.$cookie = Cookies;
 
 // 全局注册
 Vue.component('icon', Icon);

+ 3 - 0
src/views/assembly/index.vue

@@ -173,6 +173,9 @@ export default {
     },
     handleBlur (val){
       sessionStorage.setItem('li_code',val);
+      this.$cookie.set("AS_LI_CODE", val, {
+        expires: 30,
+      });
       location.reload();
     },
   }

+ 95 - 7
src/views/login.vue

@@ -39,6 +39,8 @@
 </template>
 
 <script>
+    import CryptoJS from "crypto-js";
+
     export default {
         name: "Login",
         data(){
@@ -48,7 +50,7 @@
                     sob:"",
                     username:"",
                     password:"",
-                    workshop:""
+                    workshop:"SMT"
                 },
                 checked: true,
                 rules:{
@@ -67,9 +69,16 @@
             }
         },
         mounted() {
+            //默认数据
+            this.getCookies();
+            //监听enter键
+            this.$refs.loginForm.$el.addEventListener('keydown',this.handleEnter);
             //获取账套信息
             this.getMasters();
         },
+        beforeDestroy(){
+            this.$refs.loginForm.$el.removeEventListener('keydown',this.handleEnter);
+        },
         methods:{
             //获取账套
             getMasters(){
@@ -99,23 +108,54 @@
                                     wccode:this.loginForm.workshop
                                 }}).then(
                             (result)=>{
-                                console.info(result.data);
                                 var res = result.data;
                                 if(res.success || "检测到您已登录本系统,请不要重复登录、打开空白页!" == res.reason) {
                                     //登录成功返回session
                                     sessionStorage.setItem('x-access-token', res.token);
                                     sessionStorage.setItem('user',res);
-                                    if(res.linedata) {
-                                        sessionStorage.setItem('li_code',res.linedata[0].LI_CODE);
-                                    }else{
-                                        sessionStorage.setItem('li_code','');
-                                    }
                                     this.$store.commit('setUser',res);
+                                    this.setCookieData();
                                     if(this.loginForm.workshop =='SMT'){
+                                        if(res.linedata) {
+                                            if(this.$cookie.get("SMT_LI_CODE") && res.linedata.some(item => item.LI_CODE === this.$cookie.get("SMT_LI_CODE")) ){
+                                                sessionStorage.setItem('li_code', this.$cookie.get("SMT_LI_CODE"));
+                                            }else {
+                                                sessionStorage.setItem('li_code', res.linedata[0].LI_CODE);
+                                                this.$cookie.set("SMT_LI_CODE", res.linedata[0].LI_CODE, {
+                                                    expires: 30,
+                                                });
+                                            }
+                                        }else{
+                                            sessionStorage.setItem('li_code','');
+                                        }
                                         this.$router.push({path: this.redirect || '/smt'});
                                     }else if(this.loginForm.workshop =='包装'){
+                                        if(res.linedata) {
+                                            if(this.$cookie.get("PC_LI_CODE") && res.linedata.some(item => item.LI_CODE === this.$cookie.get("PC_LI_CODE")) ){
+                                                sessionStorage.setItem('li_code', this.$cookie.get("PC_LI_CODE"));
+                                            }else {
+                                                sessionStorage.setItem('li_code', res.linedata[0].LI_CODE);
+                                                this.$cookie.set("PC_LI_CODE", res.linedata[0].LI_CODE, {
+                                                    expires: 30,
+                                                });
+                                            }
+                                        }else{
+                                            sessionStorage.setItem('li_code','');
+                                        }
                                         this.$router.push({path: this.redirect || '/package'});
                                     }else if(this.loginForm.workshop =='组装'){
+                                        if(res.linedata) {
+                                            if(this.$cookie.get("AS_LI_CODE") && res.linedata.some(item => item.LI_CODE === this.$cookie.get("AS_LI_CODE")) ){
+                                                sessionStorage.setItem('li_code', this.$cookie.get("AS_LI_CODE"));
+                                            }else {
+                                                sessionStorage.setItem('li_code', res.linedata[0].LI_CODE);
+                                                this.$cookie.set("AS_LI_CODE", res.linedata[0].LI_CODE, {
+                                                    expires: 30,
+                                                });
+                                            }
+                                        }else{
+                                            sessionStorage.setItem('li_code','');
+                                        }
                                         this.$router.push({path: this.redirect || '/assembly'});
                                     }
                                 }else{
@@ -137,6 +177,54 @@
                 });
 
 
+            },
+            handleEnter(event){
+                if(event.key === 'Enter'){
+                    //处理回车键按下时间
+                    this.submitLogin();
+                }
+            },
+            setCookieData(){
+                if (this.checked) {
+                    this.$cookie.set(
+                        "password",
+                        CryptoJS.AES.encrypt(this.loginForm.password, "123456"),
+                        {
+                            expires: 30
+                        }
+                    );
+                } else {
+                    this.$cookie.remove("password");
+                }
+                this.$cookie.set("username", this.loginForm.username, {
+                    expires: 30,
+                });
+                this.$cookie.set("sob", this.loginForm.sob, {
+                    expires: 30,
+                });
+                this.$cookie.set("workshop", this.loginForm.workshop, {
+                    expires: 30,
+                });
+                this.$cookie.set("checked", this.checked, {
+                    expires: 30,
+                });
+            },
+            getCookies(){
+                this.loginForm.username = this.$cookie.get("username");
+                if (this.$cookie.get("password")) {
+                    this.loginForm.password = CryptoJS.AES.decrypt(
+                        this.$cookie.get("password"),
+                        "123456"
+                    ).toString(CryptoJS.enc.Utf8);
+                }
+                if(this.$cookie.get("workshop")) {
+                    this.loginForm.workshop = this.$cookie.get("workshop");
+                }
+                if(this.$cookie.get("checked")) {
+                    if(this.$cookie.get("checked") == 'false') {
+                        this.checked = false;
+                    }
+                }
             }
         },
     };

+ 3 - 0
src/views/package/index.vue

@@ -173,6 +173,9 @@ export default {
     },
     handleBlur (val){
       sessionStorage.setItem('li_code',val);
+      this.$cookie.set("PC_LI_CODE", val, {
+        expires: 30,
+      });
       location.reload();
     },
     goSMT(){

+ 3 - 0
src/views/smt/index.vue

@@ -175,6 +175,9 @@ export default {
     },
     handleBlur (val){
       sessionStorage.setItem('li_code',val);
+      this.$cookie.set("SMT_LI_CODE", val, {
+        expires: 30,
+      });
       location.reload();
     }
   }

+ 15 - 13
src/views/smt/up2.vue

@@ -16,17 +16,17 @@
                   :key="item.title"
           >
             <p class="ml-3 colorBlue fw-b fs-xl">{{ item.title }}</p>
-            <div>
-              <dv-digital-flop
+            <div class="dv-dig-flop ml-1 mt-2 pl-3"> {{ item.number }}
+             <!-- <dv-digital-flop
                       class="dv-dig-flop ml-1 mt-2 pl-3"
                       :config="item.number"
-              />
+              />-->
             </div>
           </div>
         </div>
         <div class="down">
           <span class="fs-xl text mx-2">功能测试岗位良率分析</span>
-          <div class="pad-15">
+          <div class="pad-5">
             <Up2Chart />
           </div>
         </div>
@@ -69,7 +69,7 @@
                             if(element.name =='工单达成率'){
                               titleitems.push({
                                 title: element.name,
-                                number: {
+                                number: element.value+'%' /*{
                                   number: [element.value],
                                   textAlign: 'left',
                                   toFixed: 2,
@@ -77,19 +77,19 @@
                                   style: {
                                     fontSize: 26
                                   }
-                                }
+                                }*/
                               });
                             }else {
                               titleitems.push({
                                 title: element.name,
-                                number: {
+                                number:element.value/*{
                                   number: [element.value],
                                   textAlign: 'left',
                                   content: '{nt}',
                                   style: {
                                     fontSize: 26
                                   }
-                                }
+                                }*/
                               });
                             }
                           }
@@ -135,7 +135,7 @@
         display: flex;
         flex-wrap: wrap;
         //justify-content: space-around;
-        height: 140px;
+        height: 200px;
         margin-bottom: 7px;
         .item {
           border-radius: 6px;
@@ -144,15 +144,17 @@
           width: 50%;
           height: 60px;
           .dv-dig-flop {
-            width: 100px;
+            width: 100%;
             height: 30px;
+            font-size: 20px;
+            color: #3de7c9;
           }
         }
       }
       .down{
-        padding: 20px 0px 0px 0px;
-        .pad-15{
-          padding: 15px 0px 0px 0px;
+        padding: 15px 0px 0px 0px;
+        .pad-5{
+          padding: 5px 0px 0px 0px;
         }
       }
 

+ 10 - 0
yarn.lock

@@ -3059,6 +3059,11 @@ crypto-browserify@^3.11.0:
     randombytes "^2.0.0"
     randomfill "^1.0.3"
 
+crypto-js@^4.2.0:
+  version "4.2.0"
+  resolved "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz"
+  integrity sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==
+
 css-color-names@^0.0.4, css-color-names@0.0.4:
   version "0.0.4"
   resolved "https://registry.npmmirror.com/css-color-names/-/css-color-names-0.0.4.tgz"
@@ -5413,6 +5418,11 @@ javascript-stringify@^2.0.1:
   resolved "https://registry.npmmirror.com/javascript-stringify/-/javascript-stringify-2.1.0.tgz"
   integrity sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==
 
+js-cookie@^3.0.5:
+  version "3.0.5"
+  resolved "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz"
+  integrity sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==
+
 js-message@1.0.7:
   version "1.0.7"
   resolved "https://registry.npmmirror.com/js-message/-/js-message-1.0.7.tgz"