Browse Source

修改首页判断条件

caojunjie 3 years ago
parent
commit
c7b6b3ae74

+ 44 - 12
src/views/wel/home/landTransportation/components/quick-launch.vue

@@ -7,27 +7,27 @@
         </span>
       </div>
       <div class="content">
-        <div class="content-icon" @click="inPage('wt')">
+        <div v-if="entrust" class="content-icon" @click="inPage('wt')">
           <i class="tradingIcon icon-purchase" style="color:#75CD28"></i>
           <span>委托</span>
         </div>
-        <div class="content-icon" @click="inPage('dd')">
+        <div v-if="dispatch" class="content-icon" @click="inPage('dd')">
           <i class="tradingIcon icon-receipt" style="color:#409EFF"></i>
           <span>调度</span>
         </div>
-        <div class="content-icon" @click="inPage('pc')">
+        <div v-if="sendACar" class="content-icon" @click="inPage('pc')">
           <i class="tradingIcon icon-ship" style="color:#921939"></i>
           <span>派车</span>
         </div>
-        <div class="content-icon" @click="inPage('gz')">
+        <div v-if="track" class="content-icon" @click="inPage('gz')">
           <i class="tradingIcon icon-ship" style="color:#7db4ff"></i>
           <span>跟踪</span>
         </div>
-        <div class="content-icon" @click="inPage('lytz')">
+        <div v-if="sBook" class="content-icon" @click="inPage('lytz')">
           <i class="tradingIcon icon-sales" style="color:#143056"></i>
           <span>台账</span>
         </div>
-        <div class="content-icon" @click="inPage('dqtx')">
+        <div v-if="reminder" class="content-icon" @click="inPage('dqtx')">
           <div style="width: 36px;height: 36px;background-color: #3a8ee6;border-radius: 5px;line-height: 36px;text-align: center;padding-top: 4px">
             <i class="el-icon-bell" style="color:#fff;font-size: 28px;"></i>
           </div>
@@ -91,21 +91,53 @@ export default {
       },
       entrust:false,
       dispatch:false,
+      sBook:false,
+      reminder:false,
+      sendACar:false,
+      track:false,
     };
   },
   props: {
     sysType: Number
   },
   mounted() {
-    if (this.roleName.indexOf('总经理') !== -1 || this.roleName.indexOf('部门经理') !== -1 || this.roleName.indexOf('业务员') !== -1){
-      // 委托、台账
+    if (this.roleName.indexOf('平台') !== -1){
+      if (this.roleName.indexOf('总经理') !== -1 || this.roleName.indexOf('部门经理') !== -1 || this.roleName.indexOf('业务员') !== -1){
+        // 委托、台账
+        this.entrust = true //委托
+        this.sBook = true //台账
+      }
+      if (this.roleName.indexOf('总调度') !== -1 || this.roleName.indexOf('分管调度') !== -1){
+        // 调度、台账、到期提醒
+        this.dispatch = true //调度
+        this.sBook = true //台账
+        this.reminder = true //到期提醒
+      }
+      if (this.roleName.indexOf('admin') !== -1){
+        this.entrust = true
+        this.dispatch = true
+        this.sBook = true
+        this.reminder = true
+        this.sendACar = true
+        this.track = true
+      }
+    }
+    if (this.roleName.indexOf('客户') !== -1){
       this.entrust = true
+      this.dispatch = false
+      this.sBook = false
+      this.reminder = false
+      this.sendACar = false
+      this.track = false
     }
-    if (this.roleName.indexOf('总调度') !== -1 || this.roleName.indexOf('分管调度') !== -1){
-      // 调度、台账、到期提醒
-      this.dispatch = true
+    if (this.roleName.indexOf('车队') !== -1){
+      this.entrust = false
+      this.dispatch = false
+      this.sBook = false
+      this.reminder = false
+      this.sendACar = true
+      this.track = false
     }
-    if (this.roleName.indexOf('车队') !== -1){}
   },
   methods: {
     inPage(type) {

+ 5 - 3
src/views/wel/home/landTransportation/landTransportation.vue

@@ -2,8 +2,8 @@
   <div class="container">
     <quick-launch class="item1" :sysType="sysType" />
 <!--    <audit-data class="item2" :sysType="sysType"/>-->
-    <sales-reached @handleMousedown="handleMousedown" class="item2" :sysType="sysType"/>
-    <sales-trend ref="trend" class="item3" :sysType="sysType"/>
+    <sales-reached v-if="!(this.roleName.indexOf('车队') !== -1)" @handleMousedown="handleMousedown" class="item2" :sysType="sysType"/>
+    <sales-trend v-if="!(this.roleName.indexOf('车队') !== -1)" ref="trend" class="item3" :sysType="sysType"/>
   </div>
 </template>
 
@@ -18,7 +18,9 @@ import payToday from "./components/pay-today";
 export default {
   name: "wel",
   data() {
-    return {};
+    return {
+      roleName: localStorage.getItem("roleName").split(','),
+    };
   },
   props:{
     sysType:Number