lyy 1 год назад
Родитель
Сommit
b1f238315b
1 измененных файлов с 195 добавлено и 36 удалено
  1. 195 36
      src/views/carplanman/index.vue

+ 195 - 36
src/views/carplanman/index.vue

@@ -5,7 +5,7 @@
 import { ref,onMounted,reactive } from 'vue'
 import { Search,Download,Tools,Plus,Check,Close } from "@element-plus/icons-vue";
 let searchkey=ref('')
-let isauto=ref('')
+let isauto=ref(false)
 let viewType=ref(1)
 import { apisystemdzbcSitelist,apisystemdzbcPathlist,apisystemdzbcCarlist,apisystemdzbcPathSchedulinglist,apisystemdzbcPathSchedulingexport,apisystemdzbcPathSchedulingDel,apisystemdzbcPathSchedulingAdd,apisystemdzbcPathSchedulingUpdate } from '../../request/api.js'
 import type { ComponentSize, FormInstance, FormRules } from 'element-plus'
@@ -128,7 +128,7 @@ const addItem=data=>{
     for(let key in initData){
       ruleForm[key]=initData[key]
     }
-    console.log(data)
+    ruleForm.isauto=isauto.value?'1':'0'
     ruleForm.mdate=data.mdate+' 00:00:00'
     logtitle.value='新增定制班车-路线排班'
   }
@@ -163,8 +163,14 @@ const searchClick=()=>{
   getTableData()
 
 }
+const isautoChange=()=>{
+  localStorage.setItem('isauto',isauto.value)
+}
+let carId=ref('')
 const getTableData=()=>{
   apisystemdzbcPathSchedulinglist({
+    carId:carId.value,
+    pathId:pathId.value,
     pageSize:10,
     pageNum:pageNum.value
   }).then(res=>{
@@ -174,6 +180,50 @@ const getTableData=()=>{
         item.mdate=item.mdate?item.mdate:''
         return item
       })
+
+      for(let i=0;i<tableData.value.length;i++){
+        let car=carList.value.filter(car=>{
+          return car.id===tableData.value[i].carId
+        })[0]
+        if(car){
+          tableData.value[i].carName=car.carNum
+        }
+
+        let route=routeList.value.filter(route=>{
+          return route.id===tableData.value[i].pathId
+        })[0]
+       
+        if(route){
+          tableData.value[i].pathName=route.name
+        }
+        /////////////////////////////////////////////////////
+        let startSites=stationList.value.filter(station=>{
+          
+          return station.id===tableData.value[i].startSites
+        })[0]
+
+       
+       
+        if(startSites){
+          tableData.value[i].startSitesName=startSites.name
+        }
+       
+
+
+        let endSites=stationList.value.filter(station=>{
+          
+          return station.id===tableData.value[i].endSites
+        })[0]
+
+       
+       
+        if(endSites){
+          tableData.value[i].endSitesName=endSites.name
+        }
+        
+      }
+
+
     }
     loading.value=false
     
@@ -206,47 +256,57 @@ const deleteItem=(id)=>{
 let carList=ref([])
 let routeList=ref([])
 let stationList=ref([])
+let pathId=ref('')
+const clickRoute=item=>{
+  console.log(item)
+  pathId.value=item.id
+  searchClick()
+}
 onMounted(()=>{
-  getTableData()
+  isauto.value=localStorage.getItem('isauto')=='true'?true:false
+  
   apisystemdzbcCarlist({
     
   }).then(res=>{
     if(res.code==200){
       
       carList.value=res.rows
-    }
-    
+      apisystemdzbcPathlist({
     
-  }).catch(err=>{
-    console.log(err)
-  })
-
-  apisystemdzbcPathlist({
+      }).then(res=>{
+        if(res.code==200){
+        
+          routeList.value=res.rows
+          apisystemdzbcSitelist({
     
-  }).then(res=>{
-    if(res.code==200){
-     
-      routeList.value=res.rows
+          }).then(res=>{
+            if(res.code==200){
+            
+              stationList.value=res.rows
+              getTableData()
+            }
+          
+            
+          }).catch(err=>{
+            console.log(err)
+          })
+        }
+      
+        
+      }).catch(err=>{
+        console.log(err)
+      })
     }
-   
+    
     
   }).catch(err=>{
     console.log(err)
   })
 
+  
 
-  apisystemdzbcSitelist({
-    
-  }).then(res=>{
-    if(res.code==200){
-     
-      stationList.value=res.rows
-    }
-   
-    
-  }).catch(err=>{
-    console.log(err)
-  })
+
+ 
 })
 
 
@@ -272,7 +332,7 @@ onMounted(()=>{
                     </template>
                     </el-input>
                     <div class="common-chart-wrap" id="order-wrap">
-                        <div class="lefttop-card-wrap" v-for="item in routeList" :key="item.id">
+                        <div class="lefttop-card-wrap" v-for="item in routeList" :key="item.id" @click="clickRoute(item)">
                             <div class="left-part">
                                 <div class="title">{{item.name}}</div>
                                 <div class="time">发车时间: {{item.mtime}}</div>
@@ -294,7 +354,7 @@ onMounted(()=>{
                     <div class="common-title">
                         <div class="title-left">
                             <div>深圳湾线 - 排班表</div>
-                            <el-switch style="margin:0 6px" v-model="isauto" />
+                            <el-switch style="margin:0 6px" @change="isautoChange" v-model="isauto" />
                             <div style="color: #4B5563;font-size:14px;font-weight: 400;">自动续排</div>
                             <el-button size="mini" v-if="viewType==2" style="margin-left:6px;padding:0 2px;" type="primary"  @click="addItem({})">添加排班 </el-button>
                         </div>
@@ -332,6 +392,55 @@ onMounted(()=>{
                             </div>
                           </template>
                         </el-calendar>
+
+                        <div class="common-search-box" v-if="viewType==2">
+                      <div class="left-part" style="display:flex;">
+                        <el-input
+                          v-model="name"
+                         
+                          placeholder="搜索区域名称..."
+                          style="width:260px"
+                        >
+                        
+                         
+                        </el-input>
+                        <el-select
+                        style="margin-left:10px"
+                        v-model="carId"
+                        placeholder="车辆"
+                        
+                        
+                      >
+                        <el-option
+                          v-for="item in carList"
+                          :key="item.value"
+                          :label="item.carNum"
+                          :value="item.id"
+                        />
+                      </el-select>
+
+                      <el-select
+                      style="margin-left:10px"
+                  v-model="pathId"
+                  placeholder="路线"
+                  
+                  
+                >
+                  <el-option
+                    v-for="item in routeList"
+                    :key="item.value"
+                    :label="item.name"
+                    :value="item.id"
+                  />
+                </el-select>
+                        <el-button @click="searchClick" style="margin-left:10px">筛选</el-button>
+                      </div>
+                      <div class="right-part">
+                      
+                        <el-button :loading="excellloading" @click="downExcell" :icon="Download">{{ excellloading?'正在导出':'导出' }}</el-button>
+                        <!-- <el-button :icon="Tools">设置</el-button> -->
+                      </div>
+                    </div>
                         <el-table v-if="viewType==2" element-loading-text='加载中' header-row-class-name="reset-gray-head" :data="tableData"  style="width: 100%" v-loading="loading">
                         <el-table-column prop="pathName" label="路线">
                           
@@ -343,10 +452,10 @@ onMounted(()=>{
                         <el-table-column prop="mtime" label="开始时间">
                         
                     </el-table-column>
-                    <el-table-column prop="startSites" label="开始站点">
+                    <el-table-column prop="startSitesName" label="开始站点">
                         
                     </el-table-column>
-                    <el-table-column prop="endSites" label="结束站点">
+                    <el-table-column prop="endSitesName" label="结束站点">
                         
                     </el-table-column>
                     <el-table-column prop="isauto" label="自动排班">
@@ -370,7 +479,19 @@ onMounted(()=>{
                         </el-table-column>
                     </el-table>
 
-                        
+                    <div class="common-page-wrap">
+                      <div class="left-part">
+                        <span>显示第 </span>
+                        <span>{{pageNum}}</span>
+                        <span>至 </span>
+                        <span>10 </span>
+                        <span>条, </span>
+                        <span>共{{total}}条记录 </span>
+                      </div>
+                      <div class="right-part">
+                        <el-pagination v-model:current-page="pageNum" @current-change="getTableData" background layout="prev, pager, next" :total="total" />
+                      </div>
+                    </div>
                     </div>
 
                 </el-card>
@@ -501,7 +622,7 @@ onMounted(()=>{
                 style="width:100%"
                   v-model="ruleForm.mdate"
                   type="datetime"
-                  value-format="yyyy-MM-DD HH:mm:ss"
+                  value-format="YYYY-MM-DD HH:mm:ss"
                   placeholder="排班日期"
                 />
               </el-form-item>
@@ -516,13 +637,39 @@ onMounted(()=>{
             <el-col :span="12">
               <el-form-item label="开始站点">
                 
-                <el-input placeholder="开始站点" v-model="ruleForm.startSites" />
+              
+                <el-select
+                  v-model="ruleForm.startSites"
+                  placeholder="开始站点"
+                  
+                  style="width: 100%"
+                >
+                  <el-option
+                    v-for="item in stationList"
+                    :key="item.value"
+                    :label="item.name"
+                    :value="item.id"
+                  />
+                </el-select>
               </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-form-item label="结束站点">
                 
-                <el-input placeholder="结束站点" v-model="ruleForm.endSites" />
+               
+                <el-select
+                  v-model="ruleForm.endSites"
+                  placeholder="结束站点"
+                  
+                  style="width: 100%"
+                >
+                  <el-option
+                    v-for="item in stationList"
+                    :key="item.value"
+                    :label="item.name"
+                    :value="item.id"
+                  />
+                </el-select>
               </el-form-item>
             </el-col>
             <el-col :span="12">
@@ -580,6 +727,12 @@ onMounted(()=>{
 </template>
 
 <style lang="scss" scoped>
+ .common-search-box{
+          padding:10px 10px 10px 10px;
+          display:flex;
+          justify-content: space-between;
+          align-items: center;
+        }
     #caruse-wrap{
         height:434px;
     }
@@ -599,6 +752,7 @@ onMounted(()=>{
         
         overflow: auto;
         .lefttop-card-wrap{
+            cursor:pointer;
             border: 1px solid #E5E7EB;
             margin-bottom:8px;
             padding:8px 6px 8px 8px;
@@ -659,7 +813,12 @@ onMounted(()=>{
                 padding:5px 0 16px 0px;
             }
             .common-chart-wrap{
-                height:300px;
+              .common-page-wrap{
+                padding:10px 10px 10px 10px;
+                display: flex;
+                justify-content: space-between;
+              }
+                          height:300px;
             }
         }
     }