From 36c96b755fde8a7cfee6b605ccaff09ca0731b85 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期四, 21 十二月 2023 09:07:13 +0800
Subject: [PATCH] Mr.Shi

---
 admin/src/views/business/carEvent.vue    |  123 +++++++++----
 admin/src/views/business/device.vue      |   46 +++-
 admin/src/api/business/visitEvent.js     |    8 
 admin/src/views/business/retention.vue   |   61 ++++--
 admin/src/api/business/device.js         |    5 
 admin/src/utils/util.js                  |   23 ++
 admin/src/views/business/visitEvent.vue  |  117 ++++++++----
 admin/src/views/business/deviceEvent.vue |  115 +++++++++---
 8 files changed, 354 insertions(+), 144 deletions(-)

diff --git a/admin/src/api/business/device.js b/admin/src/api/business/device.js
index 4f85769..221ac0f 100644
--- a/admin/src/api/business/device.js
+++ b/admin/src/api/business/device.js
@@ -7,6 +7,11 @@
   })
 }
 
+// 鍚屾
+export function syncDevices (data) {
+  return request.post('/business/erpsync/syncDevices', data)
+}
+
 // 淇敼
 export function updateById (data) {
   return request.post('/business/device/updateById', data)
diff --git a/admin/src/api/business/visitEvent.js b/admin/src/api/business/visitEvent.js
index 2d5ab68..05d7a8c 100644
--- a/admin/src/api/business/visitEvent.js
+++ b/admin/src/api/business/visitEvent.js
@@ -6,3 +6,11 @@
     trim: true
   })
 }
+
+// 瀵煎嚭Excel
+export function exportExcel (data) {
+  return request.post('/business/visitEvent/exportExcel', data, {
+    trim: true,
+    download: true
+  })
+}
diff --git a/admin/src/utils/util.js b/admin/src/utils/util.js
index bc975bc..48cf55e 100644
--- a/admin/src/utils/util.js
+++ b/admin/src/utils/util.js
@@ -18,3 +18,26 @@
   }
   return data
 }
+
+export function timeForMat (count) {
+  // 鎷兼帴鏃堕棿
+  const time1 = new Date()
+  const time2 = new Date()
+  if (count === 1) {
+    time1.setTime(time1.getTime() - (24 * 60 * 60 * 1000))
+  } else {
+    time1.setTime(time1.getTime())
+  }
+
+  const Y1 = time1.getFullYear()
+  const M1 = ((time1.getMonth() + 1) > 9 ? (time1.getMonth() + 1) : '0' + (time1.getMonth() + 1))
+  const D1 = (time1.getDate() > 9 ? time1.getDate() : '0' + time1.getDate())
+  const timer1 = Y1 + '-' + M1 + '-' + D1 + ' ' + '23:59:59' // 褰撳墠鏃堕棿
+
+  time2.setTime(time2.getTime() - (24 * 60 * 60 * 1000 * count))
+  const Y2 = time2.getFullYear()
+  const M2 = ((time2.getMonth() + 1) > 9 ? (time2.getMonth() + 1) : '0' + (time2.getMonth() + 1))
+  const D2 = (time2.getDate() > 9 ? time2.getDate() : '0' + time2.getDate())
+  const timer2 = Y2 + '-' + M2 + '-' + D2 + ' ' + '00:00:00' // 涔嬪墠鐨�7澶╂垨鑰�30澶�
+  return [timer2, timer1]
+}
diff --git a/admin/src/views/business/carEvent.vue b/admin/src/views/business/carEvent.vue
index 5644f65..aba7510 100644
--- a/admin/src/views/business/carEvent.vue
+++ b/admin/src/views/business/carEvent.vue
@@ -1,49 +1,47 @@
 <template>
-    <TableLayout :permissions="['business:category:query']">
+    <TableLayout :permissions="['business:carevent:query']">
         <!-- 鎼滅储琛ㄥ崟 -->
         <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
             <el-form-item label="杞︾墝鍙�" prop="plateNos">
                 <el-input v-model="searchForm.plateNos" placeholder="璇疯緭鍏ヨ溅鐗屽彿" @keypress.enter.native="search"></el-input>
             </el-form-item>
-            <el-form-item label="濮撳悕/鎵嬫満鍙�" prop="plateNos">
-                <el-input v-model="searchForm.plateNos" placeholder="璇疯緭鍏ュ鍚�/鎵嬫満鍙�" @keypress.enter.native="search"></el-input>
+            <el-form-item label="濮撳悕/鎵嬫満鍙�" prop="keyWords">
+                <el-input v-model="searchForm.keyWords" placeholder="璇疯緭鍏ュ鍚�/鎵嬫満鍙�" @keypress.enter.native="search"></el-input>
             </el-form-item>
-            <el-form-item label="鍏徃/閮ㄩ棬鍚嶇О" prop="plateNos">
-                <el-input v-model="searchForm.plateNos" placeholder="璇疯緭鍏ュ叕鍙�/閮ㄩ棬鍚嶇О" @keypress.enter.native="search"></el-input>
+            <el-form-item label="鍏徃/閮ㄩ棬鍚嶇О" prop="companyName">
+                <el-input v-model="searchForm.companyName" placeholder="璇疯緭鍏ュ叕鍙�/閮ㄩ棬鍚嶇О" @keypress.enter.native="search"></el-input>
             </el-form-item>
-            <el-form-item label="浜哄憳绫诲瀷" prop="plateNos">
-                <el-select v-model="searchForm.plateNos" placeholder="璇烽�夋嫨">
-                    <el-option
-                        v-for="item in options"
-                        :key="item.value"
-                        :label="item.label"
-                        :value="item.value">
-                    </el-option>
+            <el-form-item label="浜哄憳绫诲瀷" prop="memberType">
+                <el-select v-model="searchForm.memberType" placeholder="璇烽�夋嫨">
+                    <el-option label="鍔冲姟璁垮" value="0"></el-option>
+                    <el-option label="鏅�氳瀹�" value="1"></el-option>
+                    <el-option label="鍐呴儴浜哄憳" value="2"></el-option>
                 </el-select>
             </el-form-item>
             <el-form-item label="浜嬩欢绫诲瀷" prop="eventType">
                 <el-select v-model="searchForm.eventType" placeholder="璇烽�夋嫨">
-                    <el-option
-                        v-for="item in options"
-                        :key="item.value"
-                        :label="item.label"
-                        :value="item.value">
-                    </el-option>
+                    <el-option label="鍏ュ満鍘嬬嚎浜嬩欢" value="771760130"></el-option>
+                    <el-option label="鍏ュ満鏀捐浜嬩欢" value="771760131"></el-option>
+                    <el-option label="鍑哄満鍘嬬嚎浜嬩欢" value="771760133"></el-option>
+                    <el-option label="鍑哄満鏀捐浜嬩欢" value="771760134"></el-option>
                 </el-select>
             </el-form-item>
             <el-form-item label="璧峰鏃堕棿" prop="eventType">
                 <el-date-picker
-                    v-model="searchForm.eventType"
-                    type="daterange"
+                    @change="seleTime"
+                    v-model="time"
+                    type="datetimerange"
+                    format="yyyy-MM-dd HH:mm:ss"
+                    value-format="yyyy-MM-dd HH:mm:ss"
                     range-separator="鑷�"
                     start-placeholder="寮�濮嬫棩鏈�"
                     end-placeholder="缁撴潫鏃ユ湡">
                 </el-date-picker>
             </el-form-item>
-            <el-radio-group v-model="searchForm.eventType" size="small">
-                <el-radio-button label="褰撳ぉ"></el-radio-button>
-                <el-radio-button label="杩�7澶�"></el-radio-button>
-                <el-radio-button label="杩�30澶�"></el-radio-button>
+            <el-radio-group v-model="searchForm.radio" size="small" @input="changeRadio">
+                <el-radio-button label="0">褰撳ぉ</el-radio-button>
+                <el-radio-button label="1">杩�7澶�</el-radio-button>
+                <el-radio-button label="2">杩�30澶�</el-radio-button>
             </el-radio-group>
             <section>
                 <el-button type="primary" @click="search">鎼滅储</el-button>
@@ -52,8 +50,8 @@
         </el-form>
         <!-- 琛ㄦ牸鍜屽垎椤� -->
         <template v-slot:table-wrap>
-            <ul class="toolbar" v-permissions="['business:member:create', 'business:member:delete']">
-                <li><el-button type="primary" v-permissions="['business:member:create']">瀵煎嚭</el-button></li>
+            <ul class="toolbar" v-permissions="['business:carevent:exportExcel']">
+                <li><el-button type="primary" v-permissions="['business:carevent:exportExcel']">瀵煎嚭</el-button></li>
             </ul>
             <el-table
                 v-loading="isWorking.search"
@@ -61,20 +59,34 @@
                 stripe
             >
                 <el-table-column prop="plateNos" label="杞︾墝鍙�" min-width="100px"></el-table-column>
-                <el-table-column prop="plateNos" label="褰掑睘鐢ㄦ埛绫诲瀷" min-width="100px"></el-table-column>
-                <el-table-column prop="plateNos" label="濮撳悕" min-width="100px"></el-table-column>
-                <el-table-column prop="plateNos" label="鎵嬫満鍙�" min-width="100px"></el-table-column>
-                <el-table-column prop="plateNos" label="鍏徃/閮ㄩ棬" min-width="100px"></el-table-column>
+                <el-table-column label="褰掑睘鐢ㄦ埛绫诲瀷" min-width="100px">
+                    <template slot-scope="{row}">
+                        <span v-if="row.personType === '0'">鍔冲姟璁垮</span>
+                        <span v-if="row.personType === '1'">鏅�氳瀹�</span>
+                        <span v-if="row.personType === '2'">鍐呴儴浜哄憳</span>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="personName" label="濮撳悕" min-width="100px"></el-table-column>
+                <el-table-column prop="personPhone" label="鎵嬫満鍙�" min-width="100px"></el-table-column>
+                <el-table-column prop="personCompanyName" label="鍏徃/閮ㄩ棬" min-width="100px"></el-table-column>
                 <el-table-column prop="parkName" label="鍋滆溅搴撳悕绉�" min-width="100px"></el-table-column>
                 <el-table-column prop="gateName" label="鍑哄叆鍙e悕绉�" min-width="100px"></el-table-column>
-                <el-table-column prop="eventType" label="浜嬩欢绫诲瀷" min-width="100px"></el-table-column>
-                <el-table-column prop="inoutType" label="鍑哄叆绫诲瀷" min-width="100px">
+                <el-table-column prop="eventTypeName" label="浜嬩欢绫诲瀷" min-width="100px"></el-table-column>
+                <el-table-column label="鍑哄叆绫诲瀷" min-width="100px">
                     <template slot-scope="{row}">
                         <span v-if="row.inoutType === 0">杩涘満</span>
                         <span v-if="row.inoutType === 1">鍑哄満</span>
                     </template>
                 </el-table-column>
-                <el-table-column prop="vehiclePicUrl" label="鎶撴媿鍥剧墖" min-width="100px"></el-table-column>
+                <el-table-column label="鎶撴媿鍥剧墖" min-width="100px">
+                    <template slot-scope="{row}">
+                        <el-image
+                            style="width: 80px; height: 80px"
+                            :src="row.vehiclePicUrl"
+                            :preview-src-list="[row.vehiclePicUrl]">
+                        </el-image>
+                    </template>
+                </el-table-column>
                 <el-table-column prop="happenTime" label="浜嬩欢鏃堕棿" min-width="100px"></el-table-column>
             </el-table>
             <pagination
@@ -91,6 +103,7 @@
 import BaseTable from '@/components/base/BaseTable'
 import TableLayout from '@/layouts/TableLayout'
 import Pagination from '@/components/common/Pagination'
+import { timeForMat } from '@/utils/util'
 export default {
   name: 'CarEvent',
   extends: BaseTable,
@@ -100,9 +113,15 @@
       // 鎼滅储
       searchForm: {
         eventType: '',
-        plateNos: ''
+        keyWords: '',
+        plateNos: '',
+        memberType: '',
+        companyName: '',
+        startTime: '',
+        endTime: '',
+        radio: null
       },
-      options: []
+      time: []
     }
   },
   created () {
@@ -113,6 +132,38 @@
       'field.main': 'id'
     })
     this.search()
+  },
+  methods: {
+    reset () {
+      this.$refs.searchForm.resetFields()
+      this.searchForm.startTime = ''
+      this.searchForm.endTime = ''
+      this.time = []
+      this.searchForm.radio = null
+      this.search()
+    },
+    changeRadio (e) {
+      if (e === '0') {
+        this.searchForm.startTime = timeForMat(1)[0]
+        this.searchForm.endTime = timeForMat(1)[1]
+        this.time = timeForMat(1)
+      } else if (e === '1') {
+        this.searchForm.startTime = timeForMat(7)[0]
+        this.searchForm.endTime = timeForMat(7)[1]
+        this.time = timeForMat(7)
+      } else if (e === '2') {
+        this.searchForm.startTime = timeForMat(30)[0]
+        this.searchForm.endTime = timeForMat(30)[1]
+        this.time = timeForMat(30)
+      }
+      this.search()
+    },
+    seleTime (e) {
+      this.searchForm.startTime = e[0]
+      this.searchForm.endTime = e[1]
+      this.searchForm.radio = null
+      this.search()
+    }
   }
 }
 </script>
diff --git a/admin/src/views/business/device.vue b/admin/src/views/business/device.vue
index d93229a..dc6a3de 100644
--- a/admin/src/views/business/device.vue
+++ b/admin/src/views/business/device.vue
@@ -1,18 +1,15 @@
 <template>
-    <TableLayout :permissions="['business:company:query']">
+    <TableLayout :permissions="['business:device:query']">
         <!-- 鎼滅储琛ㄥ崟 -->
         <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
-            <el-form-item label="闂ㄧ鍚嶇О" prop="title">
-                <el-input v-model="searchForm.title" placeholder="璇疯緭鍏ラ棬绂佸悕绉�" @keypress.enter.native="search"></el-input>
+            <el-form-item label="闂ㄧ鍚嶇О" prop="name">
+                <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ラ棬绂佸悕绉�" @keypress.enter.native="search"></el-input>
             </el-form-item>
             <el-form-item label="闂ㄧ绛夌骇" prop="level">
                 <el-select v-model="searchForm.level" placeholder="璇烽�夋嫨闂ㄧ绛夌骇" @keypress.enter.native="search">
-                    <el-option
-                        v-for="item in options"
-                        :key="item.value"
-                        :label="item.label"
-                        :value="item.value">
-                    </el-option>
+                    <el-option label="涓�绾ч棬绂�" value="1"></el-option>
+                    <el-option label="浜岀骇闂ㄧ" value="2"></el-option>
+                    <el-option label="涓夌骇闂ㄧ" value="3"></el-option>
                 </el-select>
             </el-form-item>
             <section>
@@ -23,7 +20,7 @@
         <!-- 琛ㄦ牸鍜屽垎椤� -->
         <template v-slot:table-wrap>
             <ul class="toolbar">
-                <li><el-button type="primary">鍚屾</el-button></li>
+                <li><el-button type="primary" @click="synchronousData">鍚屾</el-button></li>
             </ul>
             <el-table
                 v-loading="isWorking.search"
@@ -32,16 +29,16 @@
             >
                 <el-table-column prop="manufature" label="鍘傚晢" min-width="100px"></el-table-column>
                 <el-table-column prop="no" label="璁惧缂栧彿" min-width="100px"></el-table-column>
-                <el-table-column prop="title" label="闂ㄧ鍚嶇О" min-width="100px"></el-table-column>
+                <el-table-column prop="name" label="闂ㄧ鍚嶇О" min-width="100px"></el-table-column>
                 <el-table-column prop="level" label="闂ㄧ绛夌骇" min-width="100px"></el-table-column>
-                <el-table-column prop="status" label="璁惧鐘舵�� 0绂佺敤 1鍚敤" min-width="100px">
+                <el-table-column prop="status" label="璁惧鐘舵��" min-width="100px">
                     <template slot-scope="{row}">
                         <span v-if="row.status === 0">绂佺敤</span>
                         <span v-if="row.status === 1">鍚敤</span>
                     </template>
                 </el-table-column>
                 <el-table-column
-                    v-if="containPermissions(['business:company:update'])"
+                    v-if="containPermissions(['business:device:update'])"
                     label="鎿嶄綔"
                     min-width="120"
                     fixed="right"
@@ -68,6 +65,7 @@
 import TableLayout from '@/layouts/TableLayout'
 import Pagination from '@/components/common/Pagination'
 import OperaDeviceWindow from '@/components/business/OperaDeviceWindow'
+import { syncDevices } from '@/api/business/device'
 export default {
   name: 'Device',
   extends: BaseTable,
@@ -76,7 +74,7 @@
     return {
       // 鎼滅储
       searchForm: {
-        title: '',
+        name: '',
         level: ''
       },
       options: []
@@ -90,6 +88,26 @@
       'field.main': 'id'
     })
     this.search()
+  },
+  methods: {
+    synchronousData () {
+      this.$confirm('纭鍚屾鍚�?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        syncDevices({})
+          .then(res => {
+            this.$message({
+              type: 'success',
+              message: '鍚屾鎴愬姛'
+            })
+            this.search()
+          })
+      }).catch(() => {
+
+      })
+    }
   }
 }
 </script>
diff --git a/admin/src/views/business/deviceEvent.vue b/admin/src/views/business/deviceEvent.vue
index c5be976..f055fb4 100644
--- a/admin/src/views/business/deviceEvent.vue
+++ b/admin/src/views/business/deviceEvent.vue
@@ -1,53 +1,53 @@
 <template>
-    <TableLayout :permissions="['business:member:query']">
+    <TableLayout :permissions="['business:deviceevent:query']">
         <!-- 鎼滅储琛ㄥ崟 -->
         <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
-            <el-form-item label="濮撳悕/鎵嬫満鍙�" prop="eventType">
-                <el-input v-model="searchForm.eventType" placeholder="璇疯緭鍏ュ鍚�/鎵嬫満鍙�" @keypress.enter.native="search"></el-input>
+            <el-form-item label="濮撳悕/鎵嬫満鍙�" prop="keyWords">
+                <el-input v-model="searchForm.keyWords" placeholder="璇疯緭鍏ュ鍚�/鎵嬫満鍙�" @keypress.enter.native="search"></el-input>
             </el-form-item>
-            <el-form-item label="鍏徃/缁勭粐鍚嶇О" prop="eventType">
-                <el-input v-model="searchForm.eventType" placeholder="璇疯緭鍏ュ叕鍙�/缁勭粐鍚嶇О" @keypress.enter.native="search"></el-input>
+            <el-form-item label="鍏徃/缁勭粐鍚嶇О" prop="personCompanyName">
+                <el-input v-model="searchForm.personCompanyName" placeholder="璇疯緭鍏ュ叕鍙�/缁勭粐鍚嶇О" @keypress.enter.native="search"></el-input>
             </el-form-item>
-            <el-form-item label="浜哄憳绫诲瀷" prop="userType">
-                <el-select v-model="searchForm.userType" placeholder="璇烽�夋嫨">
-                    <el-option label="鏈煡" value="0"></el-option>
-                    <el-option label="鏅��" value="1"></el-option>
-                    <el-option label="鏉ュ" value="2"></el-option>
-                    <el-option label="榛戝悕鍗�" value="3"></el-option>
-                    <el-option label="绠$悊鍛�" value="4"></el-option>
+            <el-form-item label="浜哄憳绫诲瀷" prop="personType">
+                <el-select v-model="searchForm.personType" placeholder="璇烽�夋嫨">
+                    <el-option label="鍔冲姟璁垮" value="0"></el-option>
+                    <el-option label="鏅�氳瀹�" value="1"></el-option>
+                    <el-option label="鍐呴儴浜哄憳" value="2"></el-option>
                 </el-select>
             </el-form-item>
             <el-form-item label="浜嬩欢绫诲瀷" prop="eventType">
                 <el-select v-model="searchForm.eventType" placeholder="璇烽�夋嫨">
-                    <el-option label="鏈煡" value="0"></el-option>
-                    <el-option label="鏅��" value="1"></el-option>
-                    <el-option label="鏉ュ" value="2"></el-option>
-                    <el-option label="榛戝悕鍗�" value="3"></el-option>
-                    <el-option label="绠$悊鍛�" value="4"></el-option>
+                    <el-option label="浜鸿劯璁よ瘉澶辫触" value="197163"></el-option>
+                    <el-option label="浜鸿劯璁よ瘉閫氳繃" value="196893"></el-option>
                 </el-select>
             </el-form-item>
             <el-form-item label="璧峰鏃堕棿" prop="eventType">
                 <el-date-picker
-                    v-model="searchForm.eventType"
-                    type="daterange"
+                    @change="seleTime"
+                    v-model="time"
+                    type="datetimerange"
+                    format="yyyy-MM-dd HH:mm:ss"
+                    value-format="yyyy-MM-dd HH:mm:ss"
                     range-separator="鑷�"
                     start-placeholder="寮�濮嬫棩鏈�"
                     end-placeholder="缁撴潫鏃ユ湡">
                 </el-date-picker>
             </el-form-item>
-            <el-radio-group v-model="searchForm.eventType" size="small">
-                <el-radio-button label="褰撳ぉ"></el-radio-button>
-                <el-radio-button label="杩�7澶�"></el-radio-button>
-                <el-radio-button label="杩�30澶�"></el-radio-button>
+            <el-radio-group v-model="searchForm.radio" size="small" @input="changeRadio">
+                <el-radio-button label="0">褰撳ぉ</el-radio-button>
+                <el-radio-button label="1">杩�7澶�</el-radio-button>
+                <el-radio-button label="2">杩�30澶�</el-radio-button>
             </el-radio-group>
             <section>
                 <el-button type="primary" @click="search">鎼滅储</el-button>
-                <el-button type="primary" :loading="isWorking.export" v-permissions="['business:member:exportExcel']" @click="exportExcel">瀵煎嚭</el-button>
                 <el-button @click="reset">閲嶇疆</el-button>
             </section>
         </el-form>
         <!-- 琛ㄦ牸鍜屽垎椤� -->
         <template v-slot:table-wrap>
+            <ul class="toolbar" v-permissions="['business:deviceevent:exportExcel']">
+                <li><el-button type="primary" :loading="isWorking.export" v-permissions="['business:deviceevent:exportExcel']" @click="exportExcel">瀵煎嚭</el-button></li>
+            </ul>
             <el-table
                 v-loading="isWorking.search"
                 :data="tableData.list"
@@ -63,12 +63,26 @@
                 <el-table-column prop="name" label="濮撳悕" min-width="100px"></el-table-column>
                 <el-table-column prop="phone" label="鎵嬫満鍙�" min-width="100px"></el-table-column>
                 <el-table-column prop="idcard" label="韬唤璇佸彿鐮�" min-width="100px"></el-table-column>
-                <el-table-column prop="company" label="鍏徃/缁勭粐" min-width="100px"></el-table-column>
-                <el-table-column prop="srcName" label="闂ㄧ鍚嶇О" min-width="100px"></el-table-column>
+                <el-table-column prop="personCompanyName" label="鍏徃/缁勭粐" min-width="100px"></el-table-column>
+                <el-table-column prop="devName" label="闂ㄧ鍚嶇О" min-width="100px"></el-table-column>
                 <el-table-column prop="srcName" label="闂ㄧ鐐�" min-width="100px"></el-table-column>
-                <el-table-column prop="eventType" label="浜嬩欢绫诲瀷" min-width="100px"></el-table-column>
-                <el-table-column prop="eventType" label="鍑哄叆绫诲瀷" min-width="100px"></el-table-column>
-                <el-table-column prop="extEventPictureURL" label="鎶撴媿鐓х墖" min-width="100px"></el-table-column>
+                <el-table-column prop="eventTypeName" label="浜嬩欢绫诲瀷" min-width="100px"></el-table-column>
+                <el-table-column label="鍑哄叆绫诲瀷" min-width="100px">
+                    <template slot-scope="{row}">
+                        <span v-if="row.extEventInOut === 1">杩�</span>
+                        <span v-if="row.extEventInOut === 0">鍑�</span>
+                        <span v-if="row.extEventInOut === -1">鏈煡</span>
+                    </template>
+                </el-table-column>
+                <el-table-column label="鎶撴媿鐓х墖" min-width="100px">
+                    <template slot-scope="{row}">
+                        <el-image
+                            style="width: 80px; height: 80px"
+                            :src="row.extEventPictureURL"
+                            :preview-src-list="[row.extEventPictureURL]">
+                        </el-image>
+                    </template>
+                </el-table-column>
                 <el-table-column prop="happenTime" label="浜嬩欢鏃堕棿" min-width="100px"></el-table-column>
             </el-table>
             <pagination
@@ -85,6 +99,7 @@
 import BaseTable from '@/components/base/BaseTable'
 import TableLayout from '@/layouts/TableLayout'
 import Pagination from '@/components/common/Pagination'
+import { timeForMat } from '@/utils/util'
 export default {
   name: 'DeviceEvent',
   extends: BaseTable,
@@ -93,9 +108,15 @@
     return {
       // 鎼滅储
       searchForm: {
+        keyWords: '',
+        personCompanyName: '',
+        personType: '',
         eventType: '',
-        userType: ''
-      }
+        startTime: '',
+        endTime: '',
+        radio: null
+      },
+      time: []
     }
   },
   created () {
@@ -106,6 +127,38 @@
       'field.main': 'id'
     })
     this.search()
+  },
+  methods: {
+    changeRadio (e) {
+      if (e === '0') {
+        this.searchForm.startTime = timeForMat(1)[0]
+        this.searchForm.endTime = timeForMat(1)[1]
+        this.time = timeForMat(1)
+      } else if (e === '1') {
+        this.searchForm.startTime = timeForMat(7)[0]
+        this.searchForm.endTime = timeForMat(7)[1]
+        this.time = timeForMat(7)
+      } else if (e === '2') {
+        this.searchForm.startTime = timeForMat(30)[0]
+        this.searchForm.endTime = timeForMat(30)[1]
+        this.time = timeForMat(30)
+      }
+      this.search()
+    },
+    seleTime (e) {
+      this.searchForm.startTime = e[0]
+      this.searchForm.endTime = e[1]
+      this.searchForm.radio = null
+      this.search()
+    },
+    reset () {
+      this.$refs.searchForm.resetFields()
+      this.searchForm.startTime = ''
+      this.searchForm.endTime = ''
+      this.time = []
+      this.searchForm.radio = null
+      this.search()
+    }
   }
 }
 </script>
diff --git a/admin/src/views/business/retention.vue b/admin/src/views/business/retention.vue
index 3609c9b..297ea95 100644
--- a/admin/src/views/business/retention.vue
+++ b/admin/src/views/business/retention.vue
@@ -1,15 +1,12 @@
 <template>
-    <TableLayout :permissions="['business:member:query']">
+    <TableLayout :permissions="['business:retention:query']">
         <!-- 鎼滅储琛ㄥ崟 -->
         <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
-            <el-form-item label="濮撳悕" prop="name">
-                <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ュ鍚�" @keypress.enter.native="search"></el-input>
+            <el-form-item label="濮撳悕/鎵嬫満鍙�" prop="keyWords">
+                <el-input v-model="searchForm.keyWords" placeholder="璇疯緭鍏ュ鍚�/鎵嬫満鍙�" @keypress.enter.native="search"></el-input>
             </el-form-item>
-            <el-form-item label="鎵嬫満鍙�" prop="phone">
-                <el-input v-model="searchForm.phone" placeholder="璇疯緭鍏ユ墜鏈哄彿" @keypress.enter.native="search"></el-input>
-            </el-form-item>
-            <el-form-item label="鍏徃/閮ㄩ棬鍚嶇О" prop="companyId">
-                <el-input v-model="searchForm.companyId" placeholder="璇疯緭鍏ュ叕鍙�/閮ㄩ棬鍚嶇О" @keypress.enter.native="search"></el-input>
+            <el-form-item label="鍏徃/閮ㄩ棬鍚嶇О" prop="companyName">
+                <el-input v-model="searchForm.companyName" placeholder="璇疯緭鍏ュ叕鍙�/閮ㄩ棬鍚嶇О" @keypress.enter.native="search"></el-input>
             </el-form-item>
             <el-form-item label="浜哄憳绫诲瀷" prop="type">
                 <el-select v-model="searchForm.type" placeholder="璇烽�夋嫨">
@@ -18,10 +15,13 @@
                     <el-option label="鍐呴儴鍛樺伐" value="2"></el-option>
                 </el-select>
             </el-form-item>
-            <el-form-item label="璧峰鏃堕棿" prop="companyId">
+            <el-form-item label="璧峰鏃堕棿" prop="startTime">
                 <el-date-picker
-                    v-model="searchForm.companyId"
-                    type="daterange"
+                    @change="seleTime"
+                    v-model="time"
+                    type="datetimerange"
+                    format="yyyy-MM-dd HH:mm:ss"
+                    value-format="yyyy-MM-dd HH:mm:ss"
                     range-separator="鑷�"
                     start-placeholder="寮�濮嬫棩鏈�"
                     end-placeholder="缁撴潫鏃ユ湡">
@@ -34,8 +34,8 @@
         </el-form>
         <!-- 琛ㄦ牸鍜屽垎椤� -->
         <template v-slot:table-wrap>
-            <ul class="toolbar" v-permissions="['business:member:create', 'business:member:delete']">
-                <li><el-button type="primary" :loading="isWorking.export" v-permissions="['business:member:exportExcel']" @click="exportExcel">瀵煎嚭</el-button></li>
+            <ul class="toolbar" v-permissions="['business:retention:exportExcel']">
+                <li><el-button type="primary" :loading="isWorking.export" v-permissions="['business:retention:exportExcel']" @click="exportExcel">瀵煎嚭</el-button></li>
             </ul>
             <el-table
                 v-loading="isWorking.search"
@@ -44,7 +44,7 @@
                 @selection-change="handleSelectionChange"
             >
                 <el-table-column type="selection" width="55"></el-table-column>
-                <el-table-column prop="companyId" label="鍏徃/缁勭粐" min-width="100px"></el-table-column>
+                <el-table-column prop="companyName" label="鍏徃/缁勭粐" min-width="100px"></el-table-column>
                 <el-table-column prop="type" label="浜哄憳绫诲瀷" min-width="100px">
                     <template slot-scope="{row}">
                         <span v-if="row.type === 0">鍔冲姟璁垮</span>
@@ -54,10 +54,14 @@
                 </el-table-column>
                 <el-table-column prop="name" label="濮撳悕" min-width="100px"></el-table-column>
                 <el-table-column prop="phone" label="鎵嬫満鍙�" min-width="100px"></el-table-column>
-                <el-table-column prop="idcardNo" label="韬唤璇佸彿" min-width="100px"></el-table-column>
-                <el-table-column prop="eventDate" label="杩涘満闂ㄧ" min-width="100px"></el-table-column>
+                <el-table-column prop="idcardNo" label="韬唤璇佸彿" min-width="130px"></el-table-column>
+                <el-table-column prop="deviceName" label="杩涘満闂ㄧ" min-width="100px"></el-table-column>
                 <el-table-column prop="eventDate" label="杩涘満鏃堕棿" min-width="100px"></el-table-column>
-                <el-table-column prop="faceImg" label="杩涘満鎶撴媿鐓х墖" min-width="100px"></el-table-column>
+                <el-table-column label="杩涘満鎶撴媿鐓х墖" min-width="100px">
+                    <template slot-scope="{row}">
+                        <el-image style="width: 80px; height: 80px;" :src="row.faceImg"></el-image>
+                    </template>
+                </el-table-column>
             </el-table>
             <pagination
                 @size-change="handleSizeChange"
@@ -81,11 +85,13 @@
     return {
       // 鎼滅储
       searchForm: {
-        companyId: '',
+        companyName: '',
         type: '',
-        name: '',
-        phone: ''
-      }
+        keyWords: '',
+        startTime: '',
+        endTime: ''
+      },
+      time: []
     }
   },
   created () {
@@ -96,6 +102,19 @@
       'field.main': 'id'
     })
     this.search()
+  },
+  methods: {
+    reset () {
+      this.$refs.searchForm.resetFields()
+      this.searchForm.startTime = ''
+      this.searchForm.endTime = ''
+      this.time = []
+      this.search()
+    },
+    seleTime (e) {
+      this.searchForm.startTime = e[0]
+      this.searchForm.endTime = e[1]
+    }
   }
 }
 </script>
diff --git a/admin/src/views/business/visitEvent.vue b/admin/src/views/business/visitEvent.vue
index b26d310..5cf8c69 100644
--- a/admin/src/views/business/visitEvent.vue
+++ b/admin/src/views/business/visitEvent.vue
@@ -1,52 +1,38 @@
 <template>
-    <TableLayout :permissions="['business:member:query']">
+    <TableLayout :permissions="['business:visitevent:query']">
         <!-- 鎼滅储琛ㄥ崟 -->
         <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
-            <el-form-item label="濮撳悕" prop="personName">
-                <el-input v-model="searchForm.personName" placeholder="璇疯緭鍏ュ鍚�" @keypress.enter.native="search"></el-input>
-            </el-form-item>
-            <el-form-item label="鎵嬫満鍙风爜" prop="endTime">
-                <el-input v-model="searchForm.endTime" placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" @keypress.enter.native="search"></el-input>
+            <el-form-item label="濮撳悕/鎵嬫満鍙�" prop="keyWords">
+                <el-input v-model="searchForm.keyWords" placeholder="璇疯緭鍏ュ鍚�/鎵嬫満鍙�" @keypress.enter.native="search"></el-input>
             </el-form-item>
             <el-form-item label="杞︾墝鍙�" prop="carNo">
                 <el-input v-model="searchForm.carNo" placeholder="璇疯緭鍏ヨ溅鐗屽彿" @keypress.enter.native="search"></el-input>
             </el-form-item>
-            <el-form-item label="鍏徃鍚嶇О" prop="endTime">
-                <el-input v-model="searchForm.endTime" placeholder="璇疯緭鍏ュ叕鍙稿悕绉�" @keypress.enter.native="search"></el-input>
+            <el-form-item label="鍏徃鍚嶇О" prop="companyName">
+                <el-input v-model="searchForm.companyName" placeholder="璇疯緭鍏ュ叕鍙稿悕绉�" @keypress.enter.native="search"></el-input>
             </el-form-item>
-            <el-form-item label="璁惧绫诲瀷" prop="carNo">
-                <el-select v-model="searchForm.carNo" placeholder="璇烽�夋嫨">
-                    <el-option
-                        v-for="item in options"
-                        :key="item.value"
-                        :label="item.label"
-                        :value="item.value">
-                    </el-option>
-                </el-select>
-            </el-form-item>
-            <el-form-item label="鍑哄叆绫诲瀷" prop="carNo">
-                <el-select v-model="searchForm.carNo" placeholder="璇烽�夋嫨">
-                    <el-option
-                        v-for="item in options"
-                        :key="item.value"
-                        :label="item.label"
-                        :value="item.value">
-                    </el-option>
+            <el-form-item label="浜嬩欢绫诲瀷" prop="eventType">
+                <el-select v-model="searchForm.eventType" placeholder="璇烽�夋嫨">
+                    <el-option label="璁垮鐧昏" value="1392513025"></el-option>
+                    <el-option label="璁垮绛剧" value="1392513026"></el-option>
                 </el-select>
             </el-form-item>
             <el-form-item label="璧峰鏃堕棿" prop="carNo">
                 <el-date-picker
-                    v-model="searchForm.carNo"
-                    type="daterange"
+                    @change="seleTime"
+                    v-model="time"
+                    type="datetimerange"
+                    format="yyyy-MM-dd HH:mm:ss"
+                    value-format="yyyy-MM-dd HH:mm:ss"
                     range-separator="鑷�"
                     start-placeholder="寮�濮嬫棩鏈�"
                     end-placeholder="缁撴潫鏃ユ湡">
                 </el-date-picker>
             </el-form-item>
-            <el-radio-group v-model="searchForm.eventType" size="small">
-                <el-radio-button label="褰撳ぉ"></el-radio-button>
-                <el-radio-button label="杩�7澶�"></el-radio-button>
-                <el-radio-button label="杩�30澶�"></el-radio-button>
+            <el-radio-group v-model="searchForm.radio" size="small" @input="changeRadio">
+                <el-radio-button label="0">褰撳ぉ</el-radio-button>
+                <el-radio-button label="1">杩�7澶�</el-radio-button>
+                <el-radio-button label="2">杩�30澶�</el-radio-button>
             </el-radio-group>
             <section>
                 <el-button type="primary" @click="search">鎼滅储</el-button>
@@ -55,22 +41,31 @@
         </el-form>
         <!-- 琛ㄦ牸鍜屽垎椤� -->
         <template v-slot:table-wrap>
+            <ul class="toolbar" v-permissions="['business:visitevent:exportExcel']">
+                <li><el-button type="primary" :loading="isWorking.export" v-permissions="['business:visitevent:exportExcel']" @click="exportExcel">瀵煎嚭</el-button></li>
+            </ul>
             <el-table
                 v-loading="isWorking.search"
                 :data="tableData.list"
                 stripe
             >
                 <el-table-column prop="personName" label="濮撳悕" min-width="100px"></el-table-column>
-                <el-table-column prop="endTime" label="鎵嬫満鍙风爜" min-width="100px"></el-table-column>
+                <el-table-column prop="personPhone" label="鎵嬫満鍙风爜" min-width="100px"></el-table-column>
                 <el-table-column prop="idNo" label="韬唤璇佸彿鐮�" min-width="100px"></el-table-column>
-                <el-table-column prop="idNo" label="鍏徃" min-width="100px"></el-table-column>
+                <el-table-column prop="personCompanyName" label="鍏徃" min-width="100px"></el-table-column>
                 <el-table-column prop="carNo" label="杞︾墝鍙�" min-width="100px"></el-table-column>
-                <el-table-column prop="carNo" label="璁惧绫诲瀷" min-width="100px"></el-table-column>
-                <el-table-column prop="carNo" label="璁惧鍚嶇О" min-width="100px"></el-table-column>
-                <el-table-column prop="carNo" label="鍑哄叆绫诲瀷" min-width="100px"></el-table-column>
-                <el-table-column prop="captureUrl" label="鎶撴媿鍥緐ri" min-width="100px"></el-table-column>
-                <el-table-column prop="happenTime" label="鎶撴媿鐓х墖" min-width="100px"></el-table-column>
-                <el-table-column prop="captureUrl" label="浜嬩欢鏃堕棿" min-width="100px"></el-table-column>
+                <el-table-column prop="beVisitedPersonName" label="琚浜�" min-width="100px"></el-table-column>
+                <el-table-column prop="eventTypeName" label="浜嬩欢绫诲瀷" min-width="100px"></el-table-column>
+                <el-table-column label="鎶撴媿鍥緐ri" min-width="100px">
+                    <template slot-scope="{row}">
+                        <el-image
+                            style="width: 80px; height: 80px"
+                            :src="row.captureUrl"
+                            :preview-src-list="[row.captureUrl]">
+                        </el-image>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="happenTime" label="浜嬩欢鏃堕棿" min-width="100px"></el-table-column>
             </el-table>
             <pagination
                 @size-change="handleSizeChange"
@@ -86,6 +81,7 @@
 import BaseTable from '@/components/base/BaseTable'
 import TableLayout from '@/layouts/TableLayout'
 import Pagination from '@/components/common/Pagination'
+import { timeForMat } from '@/utils/util'
 export default {
   name: 'VisitEvent',
   extends: BaseTable,
@@ -95,10 +91,15 @@
       // 鎼滅储
       searchForm: {
         personName: '',
+        carNo: '',
+        keyWords: '',
+        startTime: '',
         endTime: '',
-        carNo: ''
+        eventType: '',
+        companyName: '',
+        radio: null
       },
-      options: []
+      time: []
     }
   },
   created () {
@@ -109,6 +110,38 @@
       'field.main': 'id'
     })
     this.search()
+  },
+  methods: {
+    seleTime (e) {
+      this.searchForm.startTime = e[0]
+      this.searchForm.endTime = e[1]
+      this.searchForm.radio = null
+      this.search()
+    },
+    changeRadio (e) {
+      if (e === '0') {
+        this.searchForm.startTime = timeForMat(1)[0]
+        this.searchForm.endTime = timeForMat(1)[1]
+        this.time = timeForMat(1)
+      } else if (e === '1') {
+        this.searchForm.startTime = timeForMat(7)[0]
+        this.searchForm.endTime = timeForMat(7)[1]
+        this.time = timeForMat(7)
+      } else if (e === '2') {
+        this.searchForm.startTime = timeForMat(30)[0]
+        this.searchForm.endTime = timeForMat(30)[1]
+        this.time = timeForMat(30)
+      }
+      this.search()
+    },
+    reset () {
+      this.$refs.searchForm.resetFields()
+      this.searchForm.startTime = ''
+      this.searchForm.endTime = ''
+      this.time = []
+      this.searchForm.radio = null
+      this.search()
+    }
   }
 }
 </script>

--
Gitblit v1.9.3