<template>
  <div class="path-card right-path pointerBlock">
    <div class="content">
      <div class="item ">
        <div class="town-info pt-15">
          <div class="chart border-line" style="height: 140px; padding-bottom: 10px">
            <chart4 :value1="0.26" :value2="0.45" :title="['车辆进场', '车辆出场']" :refresh="['9:00已刷新', '9:00已刷新']"></chart4>
          </div>
          <div class="traffic border-line">
            <div class="traffic-item">
              <img src="../../assets/images/icon4.png" alt="" />
              <div class="traffic-num">
                <div class="BwFont blue" style="font-size: 35px">208</div>
                <div style="color: #81a5ad; margin-top: 10px; ">
                  停车场总车位
                </div>
              </div>
<pre><code>        &lt;/div&gt;
        &lt;div class=&quot;traffic-item&quot;&gt;
          &lt;img src=&quot;../../assets/images/icon5.png&quot; alt=&quot;&quot; /&gt;
          &lt;div class=&quot;traffic-num&quot;&gt;
            &lt;div class=&quot;BwFont blue&quot; style=&quot;font-size: 35px&quot;&gt;643&lt;/div&gt;
            &lt;div style=&quot;color: #81a5ad; margin-top: 10px; &quot;&gt;
              剩余车位
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;traffic-item&quot;&gt;
          &lt;img src=&quot;../../assets/images/icon6.png&quot; alt=&quot;&quot; /&gt;
          &lt;div class=&quot;traffic-num&quot;&gt;
            &lt;div class=&quot;BwFont blue&quot; style=&quot;font-size: 35px&quot;&gt;356&lt;/div&gt;
            &lt;div style=&quot;color: #81a5ad; margin-top: 10px; &quot;&gt;
              在停社会车辆
            &lt;/div&gt;
          &lt;/div&gt;

        &lt;/div&gt;
        &lt;div class=&quot;traffic-item&quot;&gt;
          &lt;img src=&quot;../../assets/images/icon7.png&quot; alt=&quot;&quot; /&gt;
          &lt;div class=&quot;traffic-num&quot;&gt;
            &lt;div class=&quot;BwFont blue&quot; style=&quot;font-size: 35px&quot;&gt;203&lt;/div&gt;
            &lt;div style=&quot;color: #81a5ad; margin-top: 10px; &quot;&gt;
              在停院职工车辆
            &lt;/div&gt;
          &lt;/div&gt;

        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class=&quot;reservation&quot; style=&quot;padding-bottom: 0;&quot;&gt;
        &lt;div class=&quot;reservationItem&quot;&gt;
          &lt;div&gt;总预约数&lt;/div&gt;
          &lt;div class=&quot;BwFont blue&quot; style=&quot;font-size: 35px;margin-top: 8px;&quot;&gt;456&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;reservationImg&quot;&gt;
          &lt;div style=&quot;padding-top: 30px;&quot;&gt;
            &lt;svg-icon icon-class=&quot;icon-car&quot; style=&quot;font-size: 30px;&quot;&gt;&lt;/svg-icon&gt;
          &lt;/div&gt;
          &lt;div&gt;预约车位&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;reservationItem&quot;&gt;
          &lt;div&gt;VIP预约&lt;/div&gt;
          &lt;div class=&quot;BwFont blue&quot; style=&quot;font-size: 35px;margin-top: 8px;&quot;&gt;256&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;item&quot;&gt;
    &lt;div class=&quot;item-title&quot;&gt;通行记录&lt;/div&gt;
    &lt;div class=&quot;town-info&quot;&gt;
      &lt;div class=&quot;search-box&quot; &gt;
        &lt;el-input placeholder=&quot;请输入查询信息&quot; prefix-icon=&quot;el-icon-search&quot; v-model=&quot;input&quot; @input=&quot;filterItems&quot;&gt;
        &lt;/el-input&gt;
      &lt;/div&gt;
      &lt;div class=&quot;vehicle&quot;&gt;
        &lt;div class=&quot;vehicleItem&quot; :class=&quot;vehicleIndex == 1 ? 'active' : ''&quot; @click=&quot;vehicleIndex = 1&quot;&gt;人员通行&lt;/div&gt;
        &lt;div class=&quot;vehicleItem&quot; :class=&quot;vehicleIndex == 2 ? 'active' : ''&quot; @click=&quot;vehicleIndex = 2&quot;&gt;车辆通行&lt;/div&gt;
      &lt;/div&gt;
      &lt;div v-if=&quot;vehicleIndex == 1&quot;&gt;
        &lt;div class=&quot;table-box mt-15&quot; &gt;
          &lt;el-table
              height=&quot;350&quot;
              :data=&quot;userList&quot;
              style=&quot;width: 100%&quot; &gt;
            &lt;el-table-column type=&quot;expand&quot;&gt;
              &lt;template slot-scope=&quot;{ row }&quot;&gt;
                &lt;div id=&quot;panelDetail&quot;&gt;
                  &lt;img :src=&quot;row.img&quot; style=&quot;width: 100px; height: 100px&quot;&gt;
                  &lt;div class=&quot;panelInformation&quot;&gt;
                    &lt;p&gt;姓名:&lt;span&gt;{{ row.Name}}&lt;/span&gt;
                    &lt;/p&gt;
                    &lt;p&gt;部门:&lt;span&gt;{{ row.GroupName }}&lt;/span&gt;&lt;/p&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/template&gt;
            &lt;/el-table-column&gt;
            &lt;el-table-column
                label=&quot;编号&quot;
                prop=&quot;Id&quot; width=&quot;80px&quot;&gt;
            &lt;/el-table-column&gt;
            &lt;el-table-column
                label=&quot;姓名&quot;
                prop=&quot;Name&quot; width=&quot;80px&quot;&gt;
            &lt;/el-table-column&gt;
            &lt;el-table-column
                label=&quot;时间&quot;
                prop=&quot;recordTime&quot;&gt;
            &lt;/el-table-column&gt;
          &lt;/el-table&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div v-if=&quot;vehicleIndex == 2&quot;&gt;
        &lt;div class=&quot;list-title&quot;&gt;
          &lt;el-row&gt;
            &lt;el-col :span=&quot;8&quot;&gt;车牌号&lt;/el-col&gt;
            &lt;el-col :span=&quot;4&quot;&gt;类型&lt;/el-col&gt;
            &lt;el-col :span=&quot;6&quot;&gt;进入时间&lt;/el-col&gt;
            &lt;el-col :span=&quot;6&quot;&gt;停车时长&lt;/el-col&gt;
          &lt;/el-row&gt;
        &lt;/div&gt;
        &lt;div class=&quot;user-list&quot; style=&quot;height: 240px;&quot;&gt;
          &lt;div class=&quot;user-list-item&quot;  v-for=&quot;(item, index) in carList&quot;
               :key=&quot;index&quot; &gt;
            &lt;el-row&gt;
              &lt;el-col :span=&quot;8&quot;&gt;{{ item.number }}&lt;/el-col&gt;
              &lt;el-col :span=&quot;4&quot;&gt;
                &lt;span v-if=&quot;item.type==1&quot;&gt;进场&lt;/span&gt;
                &lt;span v-if=&quot;item.type==0&quot; style=&quot;color: #00aeff;&quot;&gt;出场&lt;/span&gt;
              &lt;/el-col&gt;
              &lt;el-col :span=&quot;6&quot;&gt;{{ item.date }}&lt;/el-col&gt;
              &lt;el-col :span=&quot;6&quot;&gt;
                &lt;span&gt;{{ item.time }}&lt;/span&gt;
              &lt;/el-col&gt;
            &lt;/el-row&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code></pre>
  </div>
</template>
<script>
import chart4 from "./chart/chart4";
import {getDoorPassLogs} from "@/api/EcardApi";

export default {
  name: "teaching-path",
  components: {
    chart4
  },
  data() {
    return {
      input: '',
      vehicleIndex: '1',
      userList:[ ],
      carList:[ 
        {number:"皖AC540Q",type:'1',date:'05/11-11:28',time:'1小时5分'},
        {number:"皖AC540Q",type:'1',date:'05/11-11:28',time:'1小时5分'},
        {number:"皖AC540Q",type:'1',date:'05/11-11:28',time:'1小时5分'},
        {number:"皖AC540Q",type:'0',date:'05/11-11:28',time:'1小时5分'},
        {number:"皖AC540Q",type:'1',date:'05/11-11:28',time:'1小时5分'},
        {number:"皖AC540Q",type:'1',date:'05/11-11:28',time:'1小时5分'},
        {number:"皖AC540Q",type:'0',date:'05/11-11:28',time:'1小时5分'},
        {number:"皖AC540Q",type:'1',date:'05/11-11:28',time:'1小时5分'},
        {number:"皖AC540Q",type:'1',date:'05/11-11:28',time:'1小时5分'},
      ],
      img: ""
    };
  },
  mounted() {
    // 监听 leftToRightValue 事件,并获取传递的值
    this.$bus.$on('leftToRightValue', (value) => {
      console.log('接受传递过来的值',value);
      this.getPassLogs(value);
    });
    this.userList=this.filterItems();
    console.log('得到结果--> ',this.filterItems());
  },
  methods: {
    //模糊搜索
    filterItems() {
      console.log('查询内容-->',this.input);
      if (this.input === '') {
        return this.userList; // 如果搜索值为空,则返回全部项
      } else {
        return this.userList.filter(item => {
          return item.Name.toLowerCase().includes(this.input.toLowerCase());
        });
      }
    },

    getPassLogs(name){
      name = "1#MJ1F23";
      const nameParts = name.split("#");
      const part1 = nameParts[0];
      const part2 = nameParts[1];
      getDoorPassLogs(part1,part2).then(res=>{
        console.log('门禁通行记录--->',res);
        this.userList = res.data;
        //this.img = 'http://192.168.50.2:18000'+res.data[0].PhotoPath.split(':')[1];
        console.log('split------>',res.data[0].PhotoPath.split(':')[1])
        //console.log('img--------->',this.img)
      })
    },
    getImg(item){
      let PhotoPath = item.PhotoPath;
      let img = 'http://192.168.50.2:18000'+PhotoPath.split(':')[1];
      //this.img=img;
      //console.log('img--------->',this.img)
    },
    //
    timeChange(dateString ){
// 创建一个新的Date对象
      var date = new Date(dateString);

// 使用日期方法获取年、月、日、小时、分钟和秒
      var year = date.getFullYear();
      var month = ("0" + (date.getMonth() + 1)).slice(-2); // 月份从0开始,需要加1并补零
      var day = ("0" + date.getDate()).slice(-2); // 补零
      var hours = ("0" + date.getHours()).slice(-2); // 补零
      var minutes = ("0" + date.getMinutes()).slice(-2); // 补零
      var seconds = ("0" + date.getSeconds()).slice(-2); // 补零

// 格式化日期
      var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
      return formattedDate;
    }
  },
};
</script>
<style scoped lang="less">
@import "@/style/style-my";
</style>
<p>内容:通行记录模糊查询的实现步骤如下:</p>
<ol>
<li>在data中添加一个input属性,用于存储用户输入的查询信息。</li>
<li>在el-input组件中添加v-model绑定input属性,实现输入框与数据的双向绑定。</li>
<li>在el-input组件的@input事件中调用filterItems方法,实现模糊查询功能。</li>
<li>在filterItems方法中判断输入值是否为空,如果为空,则返回全部项;如果不为空,则使用filter方法过滤出符合条件的项,并返回结果。</li>
<li>在页面加载完成后,通过mounted钩子函数调用filterItems方法,将查询结果赋值给userList数组,实现页面的初始化显示。</li>
<li>在el-table组件中使用:data绑定userList数组,实现数据的动态展示。</li>
<li>在el-input组件中添加prefix-icon属性,设置查询图标。</li>
<li>在el-table组件的el-table-column中,使用prop属性绑定对应的数据字段。</li>
<li>根据需要,可以在filterItems方法中添加更多的筛选条件,例如根据时间范围进行查询等。</li>
</ol>
<p>以上是实现通行记录模糊查询的基本步骤,根据具体需求可以进行适当调整和扩展。</p>
通行记录模糊查询 - 快速查找人员和车辆通行信息

原文地址: https://www.cveoy.top/t/topic/pkb0 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录