<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='traffic-item'&gt;
          &lt;img src='../../assets/images/icon5.png' alt='' /&gt;
          &lt;div class='traffic-num'&gt;
            &lt;div class='BwFont blue' style='font-size: 35px'&gt;643&lt;/div&gt;
            &lt;div style='color: #81a5ad; margin-top: 10px; '&gt;
              剩余车位
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class='traffic-item'&gt;
          &lt;img src='../../assets/images/icon6.png' alt='' /&gt;
          &lt;div class='traffic-num'&gt;
            &lt;div class='BwFont blue' style='font-size: 35px'&gt;356&lt;/div&gt;
            &lt;div style='color: #81a5ad; margin-top: 10px; '&gt;
              在停社会车辆
            &lt;/div&gt;
          &lt;/div&gt;

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

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

      &lt;div class='reservation' style='padding-bottom: 0;'&gt;
        &lt;div class='reservationItem'&gt;
          &lt;div&gt;总预约数&lt;/div&gt;
          &lt;div class='BwFont blue' style='font-size: 35px;margin-top: 8px;'&gt;456&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class='reservationImg'&gt;
          &lt;div style='padding-top: 30px;'&gt;
            &lt;svg-icon icon-class='icon-car' style='font-size: 30px;'&gt;&lt;/svg-icon&gt;
          &lt;/div&gt;
          &lt;div&gt;预约车位&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class='reservationItem'&gt;
          &lt;div&gt;VIP预约&lt;/div&gt;
          &lt;div class='BwFont blue' style='font-size: 35px;margin-top: 8px;'&gt;256&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class='item'&gt;
    &lt;div class='item-title'&gt;通行记录&lt;/div&gt;
    &lt;div class='town-info'&gt;
      &lt;div class='search-box' &gt;
        &lt;el-input placeholder='请输入查询信息' prefix-icon='el-icon-search' v-model='input' @input='filterItems'&gt;
        &lt;/el-input&gt;
      &lt;/div&gt;
      &lt;div class='vehicle'&gt;
        &lt;div class='vehicleItem' :class='vehicleIndex == 1 ? 'active' : ''' @click='vehicleIndex = 1'&gt;人员通行&lt;/div&gt;
        &lt;div class='vehicleItem' :class='vehicleIndex == 2 ? 'active' : ''' @click='vehicleIndex = 2'&gt;车辆通行&lt;/div&gt;
      &lt;/div&gt;
      &lt;div v-if='vehicleIndex == 1'&gt;
        &lt;div class='table-box mt-15' &gt;
          &lt;el-table
              height='350'
              :data='userList'
              style='width: 100%' &gt;
            &lt;el-table-column type='expand'&gt;
              &lt;template slot-scope='{ row }'&gt;
                &lt;div id='panelDetail'&gt;
                  &lt;img :src='row.img' style='width: 100px; height: 100px'&gt;
                  &lt;div class='panelInformation'&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='编号'
                prop='Id' width='80px'&gt;
            &lt;/el-table-column&gt;
            &lt;el-table-column
                label='姓名'
                prop='Name' width='80px'&gt;
            &lt;/el-table-column&gt;
            &lt;el-table-column
                label='时间'
                prop='recordTime'&gt;
            &lt;/el-table-column&gt;
          &lt;/el-table&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div v-if='vehicleIndex == 2'&gt;
        &lt;div class='list-title'&gt;
          &lt;el-row&gt;
            &lt;el-col :span='8'&gt;车牌号&lt;/el-col&gt;
            &lt;el-col :span='4'&gt;类型&lt;/el-col&gt;
            &lt;el-col :span='6'&gt;进入时间&lt;/el-col&gt;
            &lt;el-col :span='6'&gt;停车时长&lt;/el-col&gt;
          &lt;/el-row&gt;
        &lt;/div&gt;
        &lt;div class='user-list' style='height: 240px;'&gt;
          &lt;div class='user-list-item'  v-for='(item, index) in carList'
               :key='index' &gt;
            &lt;el-row&gt;
              &lt;el-col :span='8'&gt;{{ item.number }}&lt;/el-col&gt;
              &lt;el-col :span='4'&gt;
                &lt;span v-if='item.type==1'&gt;进场&lt;/span&gt;
                &lt;span v-if='item.type==0' style='color: #00aeff;'&gt;出场&lt;/span&gt;
              &lt;/el-col&gt;
              &lt;el-col :span='6'&gt;{{ item.date }}&lt;/el-col&gt;
              &lt;el-col :span='6'&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>
通行记录模糊查询实现方法 - 详细步骤与代码示例

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

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