浏览代码

bug修改

twt 2 年之前
父节点
当前提交
30efcf684a
共有 7 个文件被更改,包括 414 次插入18 次删除
  1. 13 0
      package-lock.json
  2. 2 1
      package.json
  3. 二进制
      src/assets/noImg.png
  4. 5 0
      src/main.js
  5. 370 12
      src/page/index.vue
  6. 13 0
      src/utils/index.js
  7. 11 5
      src/utils/request.js

+ 13 - 0
package-lock.json

@@ -25,6 +25,11 @@
         "source-map": "^0.6.1"
       }
     },
+    "@vue/devtools-api": {
+      "version": "6.4.4",
+      "resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.4.4.tgz",
+      "integrity": "sha512-Ku31WzpOV/8cruFaXaEZKF81WkNnvCSlBY4eOGtz5WMSdJvX1v1WWlSMGZeqUwPtQ27ZZz7B62erEMq8JDjcXw=="
+    },
     "accepts": {
       "version": "1.3.8",
       "resolved": "https://registry.npmmirror.com/accepts/-/accepts-1.3.8.tgz",
@@ -11171,6 +11176,14 @@
       "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
       "dev": true
     },
+    "vuex": {
+      "version": "4.1.0",
+      "resolved": "https://registry.npmmirror.com/vuex/-/vuex-4.1.0.tgz",
+      "integrity": "sha512-hmV6UerDrPcgbSy9ORAtNXDr9M4wlNP4pEFKye4ujJF8oqgFFuxDCdOLS3eNoRTtq5O3hoBDh9Doj1bQMYHRbQ==",
+      "requires": {
+        "@vue/devtools-api": "^6.0.0-beta.11"
+      }
+    },
     "watchpack": {
       "version": "1.7.5",
       "resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-1.7.5.tgz",

+ 2 - 1
package.json

@@ -13,7 +13,8 @@
     "axios": "^1.1.2",
     "element-ui": "^2.15.10",
     "vue": "^2.5.2",
-    "vue-router": "^3.0.1"
+    "vue-router": "^3.0.1",
+    "vuex": "^4.1.0"
   },
   "devDependencies": {
     "autoprefixer": "^7.1.2",

二进制
src/assets/noImg.png


+ 5 - 0
src/main.js

@@ -7,6 +7,11 @@ import App from './App'
 Vue.use(ElementUI);
 import router from './router'
 
+
+import { getHashQuery } from './utils'
+console.log(encodeURIComponent(getHashQuery('url')))
+console.log(encodeURIComponent('http://api.dms.66km.com.cn'))
+
 Vue.config.productionTip = false
 console.log(process.env.VUE_APP_BASE_URL);
 /* eslint-disable no-new */

+ 370 - 12
src/page/index.vue

@@ -14,9 +14,10 @@
        </div>
      </div>
      <div class="toConfigure">
-       车辆配置:<span class="span1">{{carConfigName}}</span>  > 车型: <span class="span1">{{brand_name}}</span>
-        总组:<span class="span1">{{zzName}}</span>
-       <span>>子组:<span class="span1">--</span></span>
+       <span v-if="carConfigName">  车辆配置:<span class="span1">{{carConfigName}}> </span></span>
+       车型: <span class="span1">{{brand_name?brand_name:'--'}}</span>
+       <span> {{navfName}}:<span class="span1">{{zzName}}></span></span>
+       <span v-if="navchildrenNameTitle">{{navchildrenNameTitle}}:<span class="span1">{{navchildrenName?navchildrenName:'--'}}</span></span>
      </div>
      <div class="main">
        <!-- 总组-->
@@ -25,8 +26,46 @@
            <div class="sx"></div>
            <div class="leftTitle">总组</div>
          </div>
-         <div class="mainLeftLine"  :class="{mainLeftLineActive:zzIndex==index}"
-          v-for="(item,index) in zlist" @click="zzClick(index,item)">{{item.caption}}</div>
+         <div class="mainLeftLineBox">
+           <div class="mainLeftLine"  :class="{mainLeftLineActive:zzIndex==index}"
+            v-for="(item,index) in zlist" @click="zzClick(index,item)" >{{item.caption}}</div>
+         </div>
+
+       </div>
+       <!-- 子组循环-->
+      <!-- <div class="mainLeft" v-if="childrenCk1">
+         <div class="mainLeftTop">
+           <div class="sx"></div>
+           <div class="leftTitle">子组</div>
+         </div>
+         <div class="mainLeftLineBox">
+           <div class="mainLeftLine"  :class="{mainLeftLineActive:zzIndex==index}"
+            v-for="(item,index) in zhizhulist1" @click="zzClick(index,item)" v-html="item.caption">{{item.caption}}</div>
+         </div>
+
+       </div> -->
+       <!-- 约束子组循环-->
+       <div class="mainLeft m1" v-if="restrainShow1">
+         <div class="mainLeftTop">
+           <div class="sx"></div>
+           <div class="leftTitle">{{zkName1}}</div>
+         </div>
+         <div class="mainLeftLineBox">
+           <div class="mainLeftLine"  :class="{mainLeftLineActive:ckIndex1==index}"
+            v-for="(item,index) in restrainList1" @click="restrainClick1(index,item)" v-html="item.caption">{{item.caption}}</div>
+         </div>
+
+       </div>
+       <div class="mainLeft m2" v-if="restrainShow2">
+         <div class="mainLeftTop">
+           <div class="sx"></div>
+           <div class="leftTitle">{{zkName2}}</div>
+         </div>
+         <div class="mainLeftLineBox">
+           <div class="mainLeftLine"  :class="{mainLeftLineActive:ckIndex2==index}"
+            v-for="(item,index) in restrainList2" @click="restrainClick2(index,item)" v-html="item.caption">{{item.caption}}</div>
+         </div>
+
        </div>
        <!-- 车辆配置-->
        <div class="mainLeft" v-if="carConfig">
@@ -37,12 +76,12 @@
          <div class="mainLeftLine" v-for="(item,index) in restrains" @click="carConfigClick(index,item)"
          :class="{mainLeftLineActive:carConfigIndex==index}">{{item.combine_cp}}</div>
        </div>
-       <div class="mainRight1" v-if="groupShow">
+       <div class="mainRight1" v-if="lastShow">
          <div class="mainRightTop">
            <div class="sx2"></div>
            <div class="mainRightTopTitle">子组</div>
            <div class="childrensearchBox">
-             <input type="text" class="childrensearchInput" placeholder="搜索子组">
+             <input type="text" v-model="childrenss" class="childrensearchInput" placeholder="搜索子组"  @keyup.enter="childrenkeyupOne">
              <img src="../assets/icon_search@2x.png" alt="" class="childrensearchImg">
            </div>
          </div>
@@ -63,7 +102,53 @@
          </div>
 
        </div>
+       <div class="mainRight2" v-if="restrainShow3">
+         <div class="mainRightTop">
+           <div class="sx2"></div>
+           <div class="mainRightTopTitle">子组</div>
+           <div class="childrensearchBox">
+             <input type="text" v-model="childrenss" class="childrensearchInput" placeholder="搜索子组"  @keyup.enter="childrenkeyup">
+             <img src="../assets/icon_search@2x.png" alt="" class="childrensearchImg">
+           </div>
+         </div>
+         <div class="mainRightCont">
+           <div class="mainRightLine2" v-for="(item,index) in restrainList3" @click="childrenClick(item)">
+             <div class="mainRightLineImgBox">
+               <img class="mainRightLineImg" :src="item.image_url.replace(/90/g, '320')" alt="">
+             </div>
+             <div class="mainRightLineMsBox">
+               <div class="mainRightLineName" >{{item.caption}}</div>
+               <div class="mainRightLineZm">组名:{{item.group_no}}</div>
+               <div class="mainRightLineRemarks">备注:{{item.remark}}</div>
+             </div>
+           </div>
+         </div>
 
+       </div>
+       <div class="mainRight3" v-if="restrainShow4">
+         <div class="mainRightTop">
+           <div class="sx2"></div>
+           <div class="mainRightTopTitle">子组</div>
+           <div class="childrensearchBox">
+             <input type="text" v-model="childrenss" class="childrensearchInput" placeholder="搜索子组"  @keyup.enter="childrenkeyup">
+             <img src="../assets/icon_search@2x.png" alt="" class="childrensearchImg">
+           </div>
+         </div>
+         <div class="mainRightCont">
+           <div class="mainRightLine3" v-for="(item,index) in restrainList3" @click="childrenClick(item)">
+             <div class="mainRightLineImgBox">
+               <img class="mainRightLineImg" v-if="item.image_url"  :src="item.image_url.split('').reverse().join('').replace(/09/g, '023').split('').reverse().join('')" alt="">
+                <img src="../assets/noImg.png" alt="" v-else class="mainRightLineNOImg">
+             </div>
+             <div class="mainRightLineMsBox">
+               <div class="mainRightLineName">{{item.caption}}</div>
+               <div class="mainRightLineZm">组名:{{item.group_no}}</div>
+               <div class="mainRightLineRemarks">备注:{{item.remark}}</div>
+             </div>
+           </div>
+         </div>
+
+       </div>
    <!-- 子组件详情-->
       <div class="childrenMain" v-if="childrenShow">
          <div class="childrenMainLeft" ref="childrenMainLeft">
@@ -125,8 +210,10 @@ export default {
        carConfig:false,   //车辆配置的显示
        carConfigIndex:-1,
        childrenShow:false,
+       childrenShow2:false,
+       childrenCk1:false,
        children:'',
-       vin:'LVHFC1663G6003140',
+       vin:'',
        restrains:'',
        brand_name:'',
        access_time:'',
@@ -141,6 +228,27 @@ export default {
        rows:'',
        zzTime:'',
        childrenHeight:'',
+       zhizhulist1:'',
+       restrainList1:'',
+       restrainList2:'',
+       restrainList3:'',
+       zkName1:'',
+       zkName2:'',
+       zkName3:'',
+       restrainShow1:false,
+       restrainShow2:false,
+       restrainShow3:false,
+       restrainShow4:false,
+       lastShow:false,
+       ckIndex1:-1,
+       ckIndex2:-1,
+       ckTimeOne:'',
+       restrainTime:'',
+       childrenss:'',
+       oldList:'',
+       navchildrenName:'',
+       navfName:'',
+       navchildrenNameTitle:''
     }
   },
   methods:{
@@ -152,7 +260,20 @@ export default {
       this.getcarVinGroupPc()
     },
     keyup(){
-     // console.log(this.vin);LVHFC1663G6003140
+     // console.log(this.vin);LVHFC1663G6003140  奔驰WDDFH3DB0AJ541602 奥迪WUAANB426BN001711  子组LGWEF4A50GF211798
+       this.restrainShow1=false
+       this.restrainShow2=false
+       this.restrainShow3=false
+       this.childrenCk1=false;
+       this.childrenShow=false;
+       this.childrenShow2=false;
+       this.restrainShow4=false;
+       this.lastShow=false;
+       this.navchildrenName=''
+       this.navchildrenNameTitle=''
+       this.zkName1=''
+       this.navfName='';
+       this.zzName=''
       fetchGet('/advancedEpc/getVinGroupPc', {
         vin:this.vin
        }).then(res => {
@@ -165,6 +286,18 @@ export default {
                 this.groupShow=false;
                 this.carConfig=true;
                 this.childrenShow=false;
+              }else{
+                this.zzTime=res.data.result.access_time;
+                this.zlist=res.data.result.list;
+                this.zzName=this.zlist[0].caption;
+                this.param=this.zlist[0].param;
+                this.token=this.zlist[0].token;
+                this.navfName=res.data.result.caption;
+                this.groupShow=true;
+                this.carConfig=false;
+                this.childrenShow=false;
+                this.carConfigName=''
+                this.getSubgroupPc()
               }
          }else{
            this.$message({
@@ -198,11 +331,13 @@ export default {
                  this.childrenShow=false;
                }else{
                  this.zlist=res.data.result.list;
+                 this.navfName=res.data.result.caption
                  this.groupShow=true;
                  this.carConfig=false;
                  this.zzName=this.zlist[0].caption;
                  this.param=this.zlist[0].param;
                  this.token=this.zlist[0].token;
+                  this.navchildrenName=this.zlist[0].caption
                  this.getSubgroupPc()
                }
          }else{
@@ -218,6 +353,14 @@ export default {
        })
     },
     zzClick(index,item){
+      this.ckIndex1=-1;
+      this.ckIndex1=-2;
+      this.restrainShow2=false
+      this.restrainShow3=false
+      this.childrenShow=false;
+      this.childrenShow2=false;
+       this.restrainShow4=false;
+      this.LGWEF4A50GF211798=false;
       this.zzIndex=index;
       this.param=item.param;
       this.token=item.token;
@@ -233,8 +376,141 @@ export default {
        }).then(res => {
          console.log(res.data.number);
          if(res.data.number==200||res.data.number==5212){
-             this.childrenList=res.data.result.list;
              this.access_time=res.data.result.access_time;
+             this.ckTimeOne=res.data.result.access_time;
+             if(res.data.result.level_identify=='group_restrain'||res.data.result.level_identify=='subgroup'){  //约束
+               console.log("约束1")
+               this.restrainShow1=true;
+               this.restrainList1=res.data.result.list;
+               this.zkName1=res.data.result.caption;
+               this.navchildrenNameTitle=res.data.result.caption
+               //console.log(this.zkName1)
+             }else{
+                this.lastShow=true;
+                this.zkName1=res.data.result.caption;
+                 this.navchildrenNameTitle=res.data.result.caption
+                this.childrenList=res.data.result.list;
+                this.oldList= this.childrenList
+             }
+
+
+         }else{
+           this.$message({
+                  message: res.data.message,
+                  type: 'warning'
+            });
+         }
+         }).catch(err => {
+
+
+         })
+    },
+    restrainClick1(index,item){  //约束第一轮点击
+      this.param=item.param;
+      this.token=item.token;
+      this.ckIndex1=index;
+       this.navchildrenName=item.caption
+      if(item.next_restrain==1){
+        this.getYsone()
+      }else{
+        this.getyijiDline()
+      }
+
+    },
+    restrainClick2(index,item){//约束第二轮点击
+      this.param=item.param;
+      this.token=item.token;
+      this.ckIndex2=index;
+      if(item.next_restrain==1){
+        this.getYsDlist()
+      }else{
+        this.getPartsPc();
+        this.groupShow=false;
+        this.carConfig=false;
+        this.restrainShow3=false;
+        this.restrainShow2=false;
+        this.restrainShow1=false;
+        this.childrenShow=true;
+         setTimeout(() => {
+          this.childrenHeight = this.$refs.childrenMainLeft.offsetHeight // 高
+         // console.log(this.childrenHeight)
+         }, 500)
+      }
+    },
+    getYsone(){
+      fetchGet('/advancedEpc/getSubgroupPc', {
+        vin:this.vin,
+        access_time:this.access_time,
+        param:this.param,
+        token:this.token
+       }).then(res => {
+         console.log(res.data.number);
+         if(res.data.number==200||res.data.number==5212){
+             this.access_time=res.data.result.access_time;
+             this.restrainTime=res.data.result.access_time;
+             if(res.data.result.level_identify=='group_restrain'||res.data.result.level_identify=='subgroup'){  //约束
+               console.log("约束2")
+               this.restrainShow2=true;
+               this.restrainList2=res.data.result.list;
+               this.zkName2=res.data.result.caption;
+               //console.log(this.zkName1)
+             }
+
+         }else{
+           this.$message({
+                  message: res.data.message,
+                  type: 'warning'
+            });
+         }
+         }).catch(err => {
+
+
+         })
+    },
+    getyijiDline(){
+      fetchGet('/advancedEpc/getSubgroupPc', {
+        vin:this.vin,
+        access_time:this.ckTimeOne,
+        param:this.param,
+        token:this.token
+       }).then(res => {
+         console.log(res.data.number);
+         if(res.data.number==200||res.data.number==5212){
+               this.access_time=res.data.result.access_time;
+               console.log("约束3")
+               this.restrainShow4=true;
+               this.restrainList3=res.data.result.list;
+               this.oldList=this.restrainList3
+
+
+         }else{
+           this.$message({
+                  message: res.data.message,
+                  type: 'warning'
+            });
+         }
+         }).catch(err => {
+
+
+         })
+    },
+    getYsDlist(){
+      fetchGet('/advancedEpc/getSubgroupPc', {
+        vin:this.vin,
+        access_time:this.restrainTime,
+        param:this.param,
+        token:this.token
+       }).then(res => {
+         console.log(res.data.number);
+         if(res.data.number==200||res.data.number==5212){
+               this.access_time=res.data.result.access_time;
+               console.log("约束3")
+               this.restrainShow3=true;
+               this.restrainList3=res.data.result.list;
+               this.zkName3=res.data.result.caption;
+               //console.log(this.zkName1)
+               this.oldList=this.restrainList3
+
          }else{
            this.$message({
                   message: res.data.message,
@@ -249,10 +525,16 @@ export default {
     childrenClick(item){
       this.param=item.param;
       this.token=item.token;
+
       this.getPartsPc();
       this.groupShow=false;
       this.carConfig=false;
+      this.restrainShow3=false;
+      this.restrainShow2=false;
+      this.restrainShow1=false;
       this.childrenShow=true;
+       this.restrainShow4=false;
+      this.lastShow=false;
        setTimeout(() => {
         this.childrenHeight = this.$refs.childrenMainLeft.offsetHeight // 高度
 
@@ -285,7 +567,42 @@ export default {
 
 
          })
-    }
+    },
+    childrenkeyup(){
+       console.log("子组件搜索")
+       console.log(this.childrenss)
+       this.restrainList3=this.oldList;
+       if(this.childrenss==''){
+         this.restrainList3=this.oldList;
+        // this.childrenList=this.oldList;
+       }else{
+           console.log(this.query(this.restrainList3,this.childrenss,'caption'))
+           this.restrainList3=this.query(this.restrainList3,this.childrenss,'caption')
+       }
+
+    },
+    childrenkeyupOne(){
+      this.childrenList=this.oldList;
+      if(this.childrenss==''){
+
+       this.childrenList=this.oldList;
+      }else{
+
+          this.childrenList=this.query(this.childrenList,this.childrenss,'caption')
+
+      }
+    },
+    query(list, keyWord, attribute = 'caption') {
+      const reg = new RegExp(keyWord) // 创建正则表达式
+      const arr = []
+      for (let i = 0; i < list.length; i++) {
+        if (reg.test(list[i][attribute])) {
+          arr.push(list[i])
+        }
+      }
+      return arr
+
+    },
 }
 
 
@@ -385,6 +702,10 @@ export default {
    border-radius: 4px;
    border: 1px solid #EEEEEE;
  }
+ .mainLeftLineBox{
+   max-height: calc(100vh - 250px );
+   overflow: auto;
+ }
  .mainLeftTop{
    display: flex;
    border-bottom: 1px solid #EEEEEE;
@@ -413,7 +734,7 @@ export default {
    border-radius: 4px;
    border: 1px solid #EEEEEE;
    margin-left: 20px;
-   overflow-y: scroll;
+   overflow: auto;
 
  }
  .mainRightTop{
@@ -439,6 +760,7 @@ export default {
    background: #FFFFFF;
    border-radius: 4px;
    border: 1px solid #EEEEEE;
+   outline: none;
  }
  .mainRightTopTitle{
    line-height: 34px;font-weight: 500;font-size: 14px;
@@ -467,8 +789,40 @@ color: #333333;padding-left: 10px;padding-right: 20px;
    border-radius: 4px;
    border: 1px solid #EEEEEE;
    margin: 1vw;
+   cursor: pointer;
+ }
+ .mainRight2 .mainRightLine2{
+  width: 200px;
+  border-radius: 4px;
+  border: 1px solid #EEEEEE;
+  margin: 1vw;
   cursor: pointer;
  }
+ .mainRight2{
+   height: calc(100vh - 200px );
+   width: calc(100% - 900px );
+   border-radius: 4px;
+   border: 1px solid #EEEEEE;
+   margin-left: 20px;
+   overflow: auto;
+
+ }
+ .mainRight3 .mainRightLine3{
+  width: 200px;
+  border-radius: 4px;
+  border: 1px solid #EEEEEE;
+  margin: 1vw;
+  cursor: pointer;
+ }
+ .mainRight3{
+   height: calc(100vh - 200px );
+   width: calc(100% - 600px );
+   border-radius: 4px;
+   border: 1px solid #EEEEEE;
+   margin-left: 20px;
+   overflow: auto;
+
+ }
  .mainRightLineImgBox {
    /*图片容器宽高各220px,容器水平居中,图片水平垂直居中*/
    width: 100%;
@@ -549,4 +903,8 @@ color: #333333;padding-left: 10px;padding-right: 20px;
 /deep/ .el-table .has-gutter th.el-table__cell{
      background-color: #F7F9F8;
  }
+ .mainRightLineNOImg{
+   width: 100%;
+   height: 100%;
+ }
 </style>

+ 13 - 0
src/utils/index.js

@@ -152,3 +152,16 @@ export const deepObjectMerge = function(FirstOBJ, SecondOBJ) {
   }
   return FirstOBJ
 }
+
+export function getHashQuery (query) {
+  if (location.hash.indexOf(query) > -1) {
+    let cur = location.hash.slice(location.hash.indexOf(query) + query.length + 1, location.hash.length)
+    if (cur.indexOf('&') > -1) {
+      return cur.slice(0, cur.indexOf('&'))
+    } else {
+      return cur
+    }
+  } else {
+    return false
+  }
+}

+ 11 - 5
src/utils/request.js

@@ -1,21 +1,27 @@
 import axios from 'axios'
 //import store from '@/store'
-
+import { getHashQuery } from './index.js'
 //"build": "node build/build.js"
 axios.defaults.timeout = 8640000000 // 响应时间
 axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
 //axios.defaults.headers.post['Content-Type'] = 'application/json'
-
+console.log(getHashQuery('url'))
+var url='http://'+getHashQuery('url')+'/'
 //axios.defaults.baseURL = process.env.VUE_APP_BASE_API // 配置接口地址
 axios.defaults.baseURL = 'http://api.dms.66km.com.cn/' // 配置接口地址
+//axios.defaults.baseURL = url // 配置接口地址
 // POST传参序列化(添加请求拦截器)
+var epcToken=getHashQuery('token');
+var uid=getHashQuery('uid');
 axios.interceptors.request.use((conf) => {
  // console.log(conf)
   // 在发送请求之前做某件事
 
-  // if (store.getters.token) {
-  //   conf.headers['token'] = getToken()
-  // }
+    if (epcToken) {
+       conf.headers['epcToken'] = epcToken
+       conf.headers['uid'] = uid
+    }
+
   return conf
 }, (error) => {
   Message.error(error)