Browse Source

用户行为记录

zhengjinyi 2 years ago
parent
commit
557b61a72f

+ 2 - 2
.env.development

@@ -4,8 +4,8 @@ ENV = 'development'
 # base api
 # VUE_APP_BASE_API = 'http://192.168.2.67:18015'
 # VUE_APP_BASE_API = 'http://localhost:18015'
-# VUE_APP_BASE_API = 'http://192.168.2.102:18015'
-VUE_APP_BASE_API = 'https://mapi-b.caimei365.com'
+VUE_APP_BASE_API = 'http://192.168.2.102:18015'
+# VUE_APP_BASE_API = 'https://mapi-b.caimei365.com'
 # 图片上传,索引更新等
 VUE_APP_CORE_API = 'https://core-b.caimei365.com'
 

+ 72 - 0
src/api/user/supplier/supplier.js

@@ -0,0 +1,72 @@
+import request from '@/utils/request'
+
+export function fetchShopRelevanceList(params) {
+  return request({
+    url: '/user/shopLabel/shopRelevanceList',
+    method: 'get',
+    params
+  })
+}
+export function fetchShopLabelShopList(params) {
+  return request({
+    url: '/user/shopLabel/shopList',
+    method: 'get',
+    params
+  })
+}
+export function importShopRelevance(params) {
+  return request({
+    url: '/user/shopLabel/insertShopRelevance',
+    method: 'get',
+    params
+  })
+}
+export function fetchDelShopById(params) {
+  return request({
+    url: '/user/shopLabel/delShopById',
+    method: 'get',
+    params
+  })
+}
+export function fetchShopLabelList(params) {
+  return request({
+    url: '/user/shopLabel/shopLabelList',
+    method: 'get',
+    params
+  })
+}
+export function fetchLabelList(params) {
+  return request({
+    url: '/user/shopLabel/labelList',
+    method: 'get',
+    params
+  })
+}
+export function relevanceInsertLabel(params) {
+  return request({
+    url: '/user/shopLabel/insertLabel',
+    method: 'get',
+    params
+  })
+}
+export function delShopLabelList(params) {
+  return request({
+    url: '/user/shopLabel/delShopLabelList',
+    method: 'get',
+    params
+  })
+}
+export function addInsertSearch(params) {
+  return request({
+    url: '/user/shopLabel/insertSearch',
+    method: 'get',
+    params
+  })
+}
+export function searchBehaviorList(params) {
+  return request({
+    url: '/user/behavior/searchList',
+    method: 'get',
+    params
+  })
+}

+ 6 - 5
src/router/modules/keywordLibrary.js

@@ -53,19 +53,20 @@ const keywordLibraryRouter = {
       redirect: '/library/supplierTag/list',
       alwaysShow: true,
       component: () => import('@/views/index'),
-      meta: { title: '供应商关联标签', useDefault: true },
+      meta: { title: '供应商关联标签' },
       children: [
         {
-          path: 'supplierList',
+          path: 'list',
           name: 'SupplierList',
           component: () => import('@/views/library/supplierTag/supplier-list'),
           meta: { title: '供应商列表' }
         },
         {
-          path: 'list',
-          name: 'SupplierTagList',
+          path: 'tagList',
+          hidden: true,
           component: () => import('@/views/library/supplierTag/list'),
-          meta: { title: '标签列表' }
+          name: 'SupplierTagList',
+          meta: { title: '标签列表', noCache: true, activeMenu: '/library/supplierTag/' }
         }
       ]
     }

+ 1 - 1
src/router/modules/user.js

@@ -44,7 +44,7 @@ const userRouter = {
           path: 'detail',
           hidden: true,
           component: () => import('@/views/user/record/detail-list.vue'),
-          name: 'SysUserEdit',
+          name: 'RecordDtails',
           meta: { title: '查看详情', noCache: true, activeMenu: '/user/record/' }
         }
       ]

+ 63 - 212
src/views/library/supplierTag/list.vue

@@ -14,7 +14,7 @@
       </div>
       <div class="filter-control">
         <el-button type="primary" @click="getList">查询</el-button>
-        <el-button v-permission="'tag:list:add'" type="primary" @click="selectionTagDialog = true">选择标签</el-button>
+        <el-button v-permission="'tag:list:add'" type="primary" @click="handleSelectionTagDialog">选择标签</el-button>
         <el-button v-permission="'tag:list:del'" type="danger" :disabled="disabled" @click="handleDeleteTag">
           删除
         </el-button>
@@ -41,7 +41,7 @@
       </el-table-column>
       <el-table-column label="添加时间" align="center" width="200">
         <template slot-scope="{ row }">
-          <span v-if="row.searchTime">{{ row.searchTime | parseTime }}</span>
+          <span v-if="row.pickTime">{{ row.pickTime | parseTime }}</span>
           <span v-else>-</span>
         </template>
       </el-table-column>
@@ -57,7 +57,7 @@
       :total="total"
       :page.sync="listQuery.pageNum"
       :limit.sync="listQuery.pageSize"
-      @pagination="fetchKeywordList"
+      @pagination="fetchShopLabelList"
     />
 
     <!-- 选择标签 -->
@@ -72,19 +72,19 @@
         <div class="filter-control">
           <span>标签:</span>
           <el-input
-            v-model="listQuery.keyword"
+            v-model="labelQuery.keyword"
             placeholder="标签"
             clearable
-            @keyup.enter.native="getList"
-            @clear="getList"
+            @keyup.enter.native="fetchLabelList"
+            @clear="fetchLabelList"
           />
         </div>
         <div class="filter-control">
-          <el-button type="primary" @click="getList">查询</el-button>
+          <el-button type="primary" @click="fetchLabelList">查询</el-button>
           <el-button type="primary" @click="handleAddTag">新增标签</el-button>
         </div>
       </div>
-      <el-table ref="table" v-loading="isLoading" :data="supplierList" height="400px" border @selection-change="handleSelectionTagChange">
+      <el-table ref="table" v-loading="isLoading" :data="labelList" height="340px" border @selection-change="handleSelectionTagChange">
         <el-table-column type="selection" width="55" />
         <el-table-column prop="keyword" label="标签" align="center" />
         <el-table-column prop="frequency" label="搜索次数" width="120" align="center" sortable />
@@ -96,14 +96,14 @@
         </el-table-column>
         <el-table-column label="添加时间" align="center" width="200">
           <template slot-scope="{ row }">
-            <span v-if="row.searchTime">{{ row.searchTime | parseTime }}</span>
+            <span v-if="row.addTime">{{ row.addTime | parseTime }}</span>
             <span v-else>-</span>
           </template>
         </el-table-column>
       </el-table>
       <div slot="footer">
         <el-button @click="selectionTagDialog = false">取 消</el-button>
-        <el-button type="primary" @click="handleSelectionTagConfirm">确 定</el-button>
+        <el-button type="primary" :disabled="labelDisabled" @click="handleSelectionTagConfirm">确 定</el-button>
       </div>
     </el-dialog>
 
@@ -129,82 +129,29 @@
 </template>
 
 <script>
-import { parseTime } from '@/utils'
-import { addKeyword, deleteKeyword, fetchKeywordList, importKeywordXlsx } from '@/api/library/keyword'
-import { export_json_to_excel } from '@/vendor/Export2Excel'
+import { fetchShopLabelList, fetchLabelList, relevanceInsertLabel, delShopLabelList, addInsertSearch } from '@/api/user/supplier/supplier'
 export default {
   data() {
-    const pickerOptions = {
-      shortcuts: [
-        {
-          text: '近1年',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 365)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '近半年',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 183)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '近1月',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '近1周',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '昨天',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24)
-            picker.$emit('pick', [start, end])
-          }
-        }
-      ]
-    }
     return {
       isLoading: true,
-      pickerOptions,
-      time: '',
+      relevanceId: null,
       listQuery: {
+        relevanceId: '',
         keyword: '',
-        beginTime: '',
-        endTime: '',
-        labelStatus: 1,
-        searchTimeCode: '',
-        fromSearch: '',
         pageNum: 1,
         pageSize: 10
       },
       list: [],
       total: 0,
       currentList: [],
-      currentTabsList: [],
       searchDialog: false,
-      visibleKeyword: '',
       addTagDialog: false,
       selectionTagDialog: false,
+      labelQuery: {
+        keyword: '', // 标签名
+        pageNum: 1, // 页码
+        pageSize: 100// 页面数据数
+      },
       tagForm: {
         keyword: ''
       },
@@ -220,53 +167,36 @@ export default {
       importFormRules: {
         fileUrl: [{ required: true, message: '文件不能为空', trigger: ['change'] }]
       },
-      supplierList: [
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' },
-        { frequency: '45454', keyword: '综合供应商公司似手打发送到', searchTime: '2022-09-16 10:37:12', parseTime: '2022-09-16 10:37:12' }
-      ]
+      labelList: [],
+      labelCurrentList: []
     }
   },
   computed: {
     disabled() {
       return this.currentList.length === 0
+    },
+    labelDisabled() {
+      return this.labelCurrentList.length === 0
     }
   },
   created() {
+    this.relevanceId = this.$route.query.relevanceId
+    this.listQuery = { ...this.listQuery, ...this.$route.query }
+    console.log('listQuery', this.listQuery)
     this.getList()
   },
   methods: {
     // 获取关键词列表
     getList() {
       this.listQuery.pageNum = 1
-      if (this.time && this.time.length > 0) {
-        this.listQuery.beginTime = this.time[0]
-        this.listQuery.endTime = this.time[1]
-      } else {
-        this.listQuery.beginTime = ''
-        this.listQuery.endTime = ''
-      }
-      this.fetchKeywordList()
+      this.fetchShopLabelList()
     },
 
-    // 获取关键词列表
-    async fetchKeywordList() {
+    // 获取供应商标签列表
+    async fetchShopLabelList() {
       try {
         this.isLoading = true
-        const res = await fetchKeywordList(this.listQuery)
+        const res = await fetchShopLabelList(this.listQuery)
         this.list = res.data.results
         this.total = res.data.totalRecord
         this.isLoading = false
@@ -275,9 +205,24 @@ export default {
       }
     },
 
+    // 显示选择标签列表
+    handleSelectionTagDialog() {
+      this.selectionTagDialog = true
+      this.fetchLabelList()
+    },
+
+    // 获取标签列表
+    async fetchLabelList() {
+      try {
+        const res = await fetchLabelList(this.labelQuery)
+        this.labelList = res.data.results
+      } catch (error) {
+        console.log(error)
+      }
+    },
     // 选中标签项
     handleSelectionTagChange(current) {
-      this.currentTabsList = current
+      this.labelCurrentList = current
     },
 
     // 选中列表项
@@ -285,33 +230,32 @@ export default {
       this.currentList = current
     },
 
-    // 去搜索
-    handleSearch(keyword) {
-      this.visibleKeyword = keyword
-      this.searchDialog = true
-    },
     // 添加标签
     handleAddTag() {
       this.selectionTagDialog = false
       this.addTagDialog = true
     },
+
     // 添加标签取消
     closeAddTagDialog() {
       this.$refs.tagForm.resetFields()
       this.addTagDialog = false
     },
 
-    // 添加标签确定
-    async handleAddTagConfirm() {
+    // 选择标签确定
+    async handleSelectionTagConfirm() {
+      const ids = this.labelCurrentList.map((item) => item.id).join(',')
       try {
-        await this.$refs.tagForm.validate()
-        this.addTagSubmit()
+        await relevanceInsertLabel({ relevanceId: this.relevanceId, keywordIds: ids })
+        this.$message.success('添加成功')
+        this.selectionTagDialog = false
+        this.getList()
       } catch (error) {
         console.log(error)
       }
     },
-    // 选择标签确定
-    async handleSelectionTagConfirm() {
+    // 添加标签确定
+    async handleAddTagConfirm() {
       try {
         await this.$refs.tagForm.validate()
         this.addTagSubmit()
@@ -322,19 +266,19 @@ export default {
     // 提交添加标签信息
     async addTagSubmit() {
       try {
-        await addKeyword(this.tagForm)
+        await addInsertSearch(this.tagForm)
         this.$message.success('添加标签成功')
-        this.getList()
+        this.closeAddTagDialog()
+        this.handleSelectionTagDialog()
       } catch (error) {
         console.log(error)
       }
-      this.closeAddTagDialog()
     },
 
     // 删除标签
     async handleDeleteTag(row) {
       try {
-        await this.$confirm('确定删除选标签?', {
+        await this.$confirm('确定删除选中的标签?', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
@@ -345,110 +289,17 @@ export default {
       }
     },
 
-    // 提交删除标签操作
+    // 提交删除关联标签操作
     async deleteTagSubmit(row) {
       const keywords = row instanceof Event ? this.currentList : [].concat(row)
       const ids = keywords.map((item) => item.id).join(',')
       try {
-        await deleteKeyword({ id: ids })
-        this.$message.success('已忽略所选关键词')
+        await delShopLabelList({ labelIds: ids })
+        this.$message.success('操作成功')
         this.getList()
       } catch (error) {
         console.log(error)
       }
-    },
-
-    // 导入关键词
-    async handleImport() {},
-
-    // 导入关键词取消
-    closeImportDialog() {
-      this.$refs.importForm.resetFields()
-      this.importDialog = false
-    },
-
-    // 导入关键词确定
-    async handleImportConfirm() {
-      console.log(1)
-      try {
-        await this.$refs.importForm.validate()
-        this.importSumbit()
-      } catch (error) {
-        console.log(error)
-      }
-    },
-
-    async importSumbit() {
-      const file = this.fileList.length > 0 && this.fileList[0]
-      if (!file) return
-      try {
-        const formData = new FormData()
-        this.fileList = []
-        this.importDialog = false
-        formData.append('keywordFile', file.raw)
-        await importKeywordXlsx(formData)
-        this.$message.success('导入标签成功')
-        this.getList()
-      } catch (error) {
-        console.log(error)
-      }
-    },
-
-    // 导出
-    async handleExport() {
-      try {
-        await this.$confirm('确定将所选标签导出为xlsx?', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        })
-        // 导出数据格式化
-        const filterVal = ['index', 'keyword', 'frequency', 'fromSearch', 'searchTime', 'addTime']
-        const data = this.formatJson(filterVal, this.currentList.slice(0))
-        export_json_to_excel({
-          header: ['序号', '标签', '搜索次数', '来源', '最近搜索时间', '添加时间'],
-          data,
-          filename: '标签列表'
-        })
-      } catch (error) {
-        this.$message.info('已取消导出操作')
-      }
-    },
-
-    formatJson(filterVal, jsonData) {
-      return jsonData.map((v, index) =>
-        filterVal.map((key) => {
-          if (['searchTime', 'addTime'].includes(key)) {
-            return parseTime(v[key])
-          }
-          if (key === 'index') return index + 1
-          if (key === 'fromSearch') {
-            const t = ['单个添加', '系统推荐', '导入']
-            return t[v[key] - 1]
-          }
-          return v[key]
-        })
-      )
-    },
-
-    // 文件上传成功
-    handleUploadSuccess(response, file, fileList) {
-      this.importForm.fileUrl = response.url
-      this.fileList = fileList
-    },
-
-    // 上传文件删除
-    handleUploadRemove(file, fileList) {
-      this.fileList = fileList
-    },
-
-    handleUploadChange(file, fileList) {
-      this.fileList = fileList
-      this.importForm.fileUrl = file.name
-    },
-
-    indexMethod(index) {
-      return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
     }
   }
 }

+ 86 - 191
src/views/library/supplierTag/supplier-list.vue

@@ -5,7 +5,7 @@
       <div class="filter-control">
         <span>供应商名称:</span>
         <el-input
-          v-model="listQuery.keyword"
+          v-model="listQuery.shopName"
           placeholder="供应商名称"
           clearable
           @keyup.enter.native="getList"
@@ -15,7 +15,7 @@
       <div class="filter-control">
         <span>手机号:</span>
         <el-input
-          v-model="listQuery.keyword"
+          v-model="listQuery.contractMobile"
           placeholder="手机号"
           clearable
           style="width:160px;"
@@ -26,7 +26,7 @@
       <div class="filter-control">
         <span>联系人:</span>
         <el-input
-          v-model="listQuery.keyword"
+          v-model="listQuery.linkMan"
           placeholder="联系人"
           clearable
           style="width:160px;"
@@ -36,16 +36,20 @@
       </div>
       <div class="filter-control">
         <el-button type="primary" @click="getList">查询</el-button>
-        <el-button v-permission="'tag:list:add'" type="primary" @click="addSupplierDialog = true">添加供应商</el-button>
+        <el-button v-permission="'tag:list:add'" type="primary" @click="handleAddSupplier">添加供应商</el-button>
       </div>
     </div>
     <!-- 关键词列表 -->
     <el-table v-loading="isLoading" :data="list" border>
-      <el-table-column label="序号" :index="indexMethod" type="index" sortable="custom" align="center" width="100" />
-      <el-table-column prop="供应商名称" label="供应商名称" align="center" width="300" />
-      <el-table-column label="联系人" :index="indexMethod" type="index" sortable="custom" align="center" width="300" />
-      <el-table-column label="手机号" :index="indexMethod" type="index" sortable="custom" align="center" width="300" />
-      <el-table-column label="添加时间" :index="indexMethod" type="index" sortable="custom" align="center" width="300" />
+      <el-table-column label="序号" type="index" align="center" width="100" />
+      <el-table-column prop="shopName" label="供应商名称" align="center" width="300" />
+      <el-table-column prop="linkMan" label="联系人" align="center" width="300" />
+      <el-table-column prop="contractMobile" label="手机号" align="center" width="300">
+        <template slot-scope="{ row }">
+          {{ row.contractMobile ? row.contractMobile : '---' }}
+        </template>
+      </el-table-column>
+      <el-table-column prop="addTime" label="添加时间" align="center" width="300" />
       <el-table-column label="操作" align="center">
         <template slot-scope="{ row }">
           <el-button type="primary" size="mini" @click="handleTagsList(row.id)">标签列表</el-button>
@@ -59,7 +63,7 @@
       :total="total"
       :page.sync="listQuery.pageNum"
       :limit.sync="listQuery.pageSize"
-      @pagination="fetchKeywordList"
+      @pagination="fetchShopRelevanceList"
     />
     <!-- 添加供应商 -->
     <el-dialog
@@ -73,185 +77,101 @@
         <div class="filter-control">
           <span>供应商ID:</span>
           <el-input
-            v-model="listQuery.keyword"
+            v-model="shopListQuery.shopId"
             placeholder="供应商ID"
             clearable
-            @keyup.enter.native="getList"
-            @clear="getList"
+            @keyup.enter.native="fetchShopLabelShopList"
+            @clear="fetchShopLabelShopList"
           />
         </div>
         <div class="filter-control">
           <span>供应商名称:</span>
           <el-input
-            v-model="listQuery.keyword"
+            v-model="shopListQuery.name"
             placeholder="供应商名称"
             clearable
             style="width:160px;"
-            @keyup.enter.native="getList"
-            @clear="getList"
+            @keyup.enter.native="fetchShopLabelShopList"
+            @clear="fetchShopLabelShopList"
           />
         </div>
         <div class="filter-control">
-          <el-button type="primary" @click="getList">查询</el-button>
+          <el-button type="primary" @click="fetchShopLabelShopList">查询</el-button>
         </div>
       </div>
-      <el-table ref="table" v-loading="isLoading" :data="supplierList" height="400px" border @select="handleSelect">
+      <el-table ref="table" v-loading="isLoading" :data="supplierList" height="350px" border @select="handleSelect">
         <el-table-column type="selection" width="55" />
-        <el-table-column label="供应商ID" prop="id" align="center" width="100" />
+        <el-table-column label="供应商ID" prop="shopId" align="center" width="100" />
         <el-table-column label="供应商名称" prop="name" align="center" />
-        <el-table-column label="联系人" prop="user" align="center" />
-        <el-table-column label="手机号" prop="phone" align="center" />
+        <el-table-column label="联系人" prop="linkMan" align="center" />
+        <el-table-column label="手机号" prop="contractMobile" align="center">
+          <template slot-scope="{ row }">
+            {{ row.contractMobile ? row.contractMobile : '---' }}
+          </template>
+        </el-table-column>
       </el-table>
       <div slot="footer">
         <el-button @click="addSupplierDialog = false">取 消</el-button>
-        <el-button type="primary" @click="handleAddTagConfirm">确 定</el-button>
+        <el-button type="primary" :disabled="disabled" @click="handleAddTagConfirm(supplierRadio)">确 定</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import { parseTime } from '@/utils'
-import { fetchKeywordList, joinKeywordLibrary } from '@/api/library/keyword'
-import { export_json_to_excel } from '@/vendor/Export2Excel'
+import { fetchShopRelevanceList, fetchShopLabelShopList, importShopRelevance, fetchDelShopById } from '@/api/user/supplier/supplier'
 
 export default {
   data() {
-    const pickerOptions = {
-      shortcuts: [
-        {
-          text: '近1年',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 365)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '近半年',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 183)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '近1月',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '近1周',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '昨天',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24)
-            picker.$emit('pick', [start, end])
-          }
-        }
-      ]
-    }
     return {
-      activeName: 'first',
       isLoading: true,
       addSupplierDialog: false,
-      pickerOptions,
-      time: '',
-      supplierList: [
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' },
-        { id: '45454', name: '综合供应商公司似手打发送到', user: '黄志国', phone: '13855555555' }
-      ],
+      supplierList: [],
       listQuery: {
-        keyword: '',
-        beginTime: '',
-        endTime: '',
-        labelStatus: '',
-        searchTimeCode: '',
-        fromSearch: '',
-        tags: '',
+        shopName: '',
+        linkMan: '',
+        contractMobile: '',
         pageNum: 1,
         pageSize: 100
       },
       list: [],
       total: 0,
-      currentList: [],
-      searchDialog: false,
-      visibleKeyword: '',
-      tagsOptions: [
-        { value: '黄金糕', label: '黄金糕' },
-        { value: '双皮奶', label: '双皮奶' },
-        { value: '蚵仔煎', label: '蚵仔煎' },
-        { value: '龙须面', label: '龙须面' },
-        { value: '北京烤鸭', label: '北京烤鸭' },
-        { value: '双黄蛋', label: '双黄蛋' }
-      ],
-      tagsList: [],
+      shopListQuery: {
+        pageNum: 1, // 页码
+        pageSize: 200, // 页面数据数
+        shopId: '', // 供应商ID
+        name: ''// 供应商公司名称
+      },
       supplierRadio: null
     }
   },
   computed: {
-
+    disabled() {
+      return this.supplierRadio === null
+    }
   },
   created() {
     this.getList()
   },
   methods: {
-    // 确定选择供应商
-    handleAddTagConfirm() {
-
-    },
     // 选择供应商
     handleSelect(selection, row) {
       this.$refs.table.clearSelection()
       this.$refs.table.toggleRowSelection(row)
-      this.supplierRadio = row
+      this.supplierRadio = row.shopId
       console.log('supplierRadio', this.supplierRadio)
     },
     // 获取关键词列表
     getList() {
       this.listQuery.pageNum = 1
-      if (this.time && this.time.length > 0) {
-        this.listQuery.beginTime = this.time[0]
-        this.listQuery.endTime = this.time[1]
-      } else {
-        this.listQuery.beginTime = ''
-        this.listQuery.endTime = ''
-      }
-      this.fetchKeywordList()
+      this.fetchShopRelevanceList()
     },
 
-    // 获取关键词列表
-    async fetchKeywordList() {
+    // 获取供应商列表
+    async fetchShopRelevanceList() {
       try {
         this.isLoading = true
-        const res = await fetchKeywordList(this.listQuery)
+        const res = await fetchShopRelevanceList(this.listQuery)
         this.list = res.data.results
         this.total = res.data.totalRecord
         this.isLoading = false
@@ -259,21 +179,41 @@ export default {
         console.log(error)
       }
     },
-
-    // 添加到标签库
-    async handleAddLibrary(row) {
+    // 显示选择供应商弹窗 查询列表
+    handleAddSupplier() {
+      this.addSupplierDialog = true
+      this.fetchShopLabelShopList()
+    },
+    // 获取所有供应商列表
+    async fetchShopLabelShopList() {
       try {
-        await this.$confirm('确定将所选标签加入到标签库?', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
+        const res = await fetchShopLabelShopList(this.shopListQuery)
+        this.supplierList = res.data.results
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 确定选择供应商
+    async handleAddTagConfirm(shopId) {
+      try {
+        this.addSupplierDialog = false
+        await importShopRelevance({ shopId: shopId })
+        this.$message.success({
+          message: '添加供应商成功',
+          type: 'success',
+          center: true,
+          duration: 2000,
+          onClose: () => {
+            this.shopListQuery.name = ''
+            this.shopListQuery.shopId = ''
+            this.getList()
+          }
         })
-        this.addLibrarySubmit(row)
       } catch (error) {
-        this.$message.info('已取消操作')
+        console.log(error)
       }
     },
-    // 删除标签
+    // 删除供应商
     async handleDeleteSupper(row) {
       try {
         await this.$confirm('确定删除吗?该供应商关联的标签也将一并删除。', {
@@ -281,69 +221,24 @@ export default {
           cancelButtonText: '取消',
           type: 'warning'
         })
-        this.deleteTagSubmit(row)
+        this.deleteShowSubmit(row)
       } catch (error) {
         this.$message.info('已取消删除操作')
       }
     },
-    // 添加到标签库提交
-    async addLibrarySubmit(row) {
-      const keywords = row instanceof Event ? this.currentList : [].concat(row)
-      const ids = keywords.map((item) => item.id).join(',')
+    // 删除
+    async deleteShowSubmit(row) {
       try {
-        await joinKeywordLibrary({ id: ids })
-        this.$message.success('添加关键词库成功')
-        keywords.forEach((item) => {
-          item.labelStatus = 1
-        })
+        await fetchDelShopById({ relevanceId: row.id })
+        this.$message.success('操作成功')
+        this.getList()
       } catch (error) {
         console.log(error)
       }
     },
     // 查看详情
     handleTagsList(id) {
-      this.$router.push({ path: '/library/supplierTag/list', query: { id: id }})
-    },
-
-    // 导出
-    async handleExport() {
-      try {
-        await this.$confirm('确定将所选标签导出为xlsx?', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        })
-        // 导出数据格式化
-        const filterVal = ['index', 'keyword', 'frequency', 'searchTime', 'labelStatus']
-        const data = this.formatJson(filterVal, this.currentList.slice(0))
-        export_json_to_excel({
-          header: ['序号', '标签', '搜索次数', '最近搜索时间', '标签库状态'],
-          data,
-          filename: '关键词列表'
-        })
-      } catch (error) {
-        this.$message.info('已取消导出操作')
-      }
-    },
-
-    formatJson(filterVal, jsonData) {
-      return jsonData.map((v, index) =>
-        filterVal.map((key) => {
-          if (['searchTime'].includes(key)) {
-            return parseTime(v[key])
-          }
-          if (key === 'index') return index + 1
-          if (key === 'labelStatus') {
-            const t = ['未添加', '已添加', '导入']
-            return t[v[key]]
-          }
-          return v[key]
-        })
-      )
-    },
-
-    indexMethod(index) {
-      return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
+      this.$router.push({ path: '/library/supplierTag/tagList', query: { relevanceId: id }})
     }
   }
 }

+ 66 - 193
src/views/user/record/detail-list.vue

@@ -4,249 +4,122 @@
     <div class="filter-container">
       <!-- 关键词列表 -->
       <el-table v-loading="isLoading" :data="list" border>
-        <el-table-column label="页面路径" :index="indexMethod" type="index" sortable="custom" align="center" width="300" />
-        <el-table-column label="访问来源" :index="indexMethod" type="index" sortable="custom" align="center" width="120" />
-        <el-table-column label="页面类型" :index="indexMethod" type="index" sortable="custom" align="center" width="100" />
-        <el-table-column label="公司类型" :index="indexMethod" type="index" sortable="custom" align="center" width="100" />
-        <el-table-column label="关联供应商" :index="indexMethod" type="index" sortable="custom" align="center" width="100" />
-        <el-table-column label="页面标签" :index="indexMethod" type="index" sortable="custom" align="center" width="150" />
-        <el-table-column label="商品图片" :index="indexMethod" type="index" sortable="custom" align="center" width="100">
-          <template>
+        <el-table-column prop="pagePath" label="页面路径" align="center" width="300" />
+        <el-table-column prop="accessSource" label="访问来源" align="center" width="100">
+          <template slot-scope="{ row }">
+            {{ row.accessSource | accessSourceFilters }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="pageTypes" label="页面类型" align="center">
+          <template slot-scope="{ row }">
+            {{ row.pageTypes ? row.pageTypes : '---' }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="pageLabel" label="页面标签" align="center">
+          <template slot-scope="{ row }">
+            {{ row.pageLabel ? row.pageLabel : '---' }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="pagePath" label="商品图片" align="center" width="100">
+          <template v-if="row.productId" slot-scope="{ row }">
             <el-popover
               placement="top-start"
               title=""
               width="180"
               trigger="hover"
             >
-              <img src="https://img1.baidu.com/it/u=2427424503,947601508&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500" alt="" style="width:150px;height:150px;">
-              <img slot="reference" src="https://img1.baidu.com/it/u=2427424503,947601508&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500" alt="" style="width:30px;height:30px;">
+              <img :src="row.productImage" alt="" style="width:150px;height:150px;">
+              <img slot="reference" :src="row.productImage" alt="" style="width:30px;height:30px;">
             </el-popover>
           </template>
+          <template v-else>
+            <span>---</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="商品ID" align="center" width="100">
+          <template slot-scope="{ row }">
+            {{ row.productId ? row.productId : '---' }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="productName" label="商品名称" align="center">
+          <template slot-scope="{ row }">
+            {{ row.productName ? row.productName : '---' }}
+          </template>
         </el-table-column>
-        <el-table-column label="商品ID" :index="indexMethod" type="index" sortable="custom" align="center" width="100" />
-        <el-table-column label="商品名称" :index="indexMethod" type="index" sortable="custom" align="center" width="300" />
-        <el-table-column label="访问时间" :index="indexMethod" type="index" sortable="custom" align="center" width="200" />
-        <el-table-column label="访问时长" :index="indexMethod" type="index" sortable="custom" align="center" />
+        <el-table-column prop="pageTypes" label="关联供应商" align="center" width="150" />
+        <el-table-column prop="accessTime" label="访问时间" align="center" width="180" />
+        <el-table-column prop="accessDuration" label="访问时长" align="center" width="100" />
       </el-table>
       <!-- 页码 -->
       <pagination
         :total="total"
         :page.sync="listQuery.pageNum"
         :limit.sync="listQuery.pageSize"
-        @pagination="fetchKeywordList"
+        @pagination="fetchBehaviorList"
       />
     </div>
-  </div></template>
+  </div>
+</template>
 
 <script>
-import { parseTime } from '@/utils'
-import { fetchKeywordList, joinKeywordLibrary } from '@/api/library/keyword'
-import { export_json_to_excel } from '@/vendor/Export2Excel'
+import { fetchBehaviorList } from '@/api/user/record/record'
 
 export default {
-  data() {
-    const pickerOptions = {
-      shortcuts: [
-        {
-          text: '近1年',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 365)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '近半年',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 183)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '近1月',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '近1周',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '昨天',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24)
-            picker.$emit('pick', [start, end])
-          }
-        }
-      ]
+  filters: {
+    accessSourceFilters(value) {
+      // 公司类型
+      const map = {
+        '0': '直接访问',
+        '1': '百度搜索',
+        '2': '360搜索',
+        '3': '谷歌搜索',
+        '4': '神马搜索',
+        '5': '头条搜索',
+        '6': '搜狗搜索',
+        '7': '直接访问'
+      }
+      return map[value]
     }
+  },
+  data() {
     return {
-      activeName: 'first',
       isLoading: true,
-      pickerOptions,
-      time: '',
       listQuery: {
-        keyword: '',
-        beginTime: '',
-        endTime: '',
-        labelStatus: '',
-        searchTimeCode: '',
-        fromSearch: '',
-        tags: '',
+        ip: '',
+        accessDate: '',
+        userId: 0,
         pageNum: 1,
         pageSize: 100
       },
       list: [],
-      total: 0,
-      currentList: [],
-      searchDialog: false,
-      visibleKeyword: '',
-      tagsOptions: [
-        { value: '黄金糕', label: '黄金糕' },
-        { value: '双皮奶', label: '双皮奶' },
-        { value: '蚵仔煎', label: '蚵仔煎' },
-        { value: '龙须面', label: '龙须面' },
-        { value: '北京烤鸭', label: '北京烤鸭' },
-        { value: '双黄蛋', label: '双黄蛋' }
-      ],
-      tagsList: [],
-      tabsCurrent: 0
+      total: 0
     }
   },
   computed: {
 
   },
   created() {
+    this.listQuery = { ...this.listQuery, ...this.$route.query }
+    console.log('listQuery', this.listQuery)
     this.getList()
   },
   methods: {
-    // tab切换
-    handleClick(tab, event) {
-      if (tab.name === 'first') {
-        console.log('data', '今日数据')
-        this.tabsCurrent = 0
-      } else if (tab.name === 'second') {
-        console.log('data', '以往数据')
-        this.tabsCurrent = 1
-      }
-    },
-    handleTagsOptions(arr) {
-      this.listQuery.tags = arr.join(',')
-      this.getList()
-      console.log('tags', this.listQuery.tags)
-    },
-    // 获取关键词列表
+    // 获取详情列表
     getList() {
       this.listQuery.pageNum = 1
-      if (this.time && this.time.length > 0) {
-        this.listQuery.beginTime = this.time[0]
-        this.listQuery.endTime = this.time[1]
-      } else {
-        this.listQuery.beginTime = ''
-        this.listQuery.endTime = ''
-      }
-      this.fetchKeywordList()
+      this.fetchBehaviorList()
     },
-
     // 获取关键词列表
-    async fetchKeywordList() {
+    async fetchBehaviorList() {
       try {
         this.isLoading = true
-        const res = await fetchKeywordList(this.listQuery)
+        const res = await fetchBehaviorList(this.listQuery)
         this.list = res.data.results
         this.total = res.data.totalRecord
         this.isLoading = false
       } catch (error) {
         console.log(error)
       }
-    },
-
-    // 添加到标签库
-    async handleAddLibrary(row) {
-      try {
-        await this.$confirm('确定将所选标签加入到标签库?', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        })
-        this.addLibrarySubmit(row)
-      } catch (error) {
-        this.$message.info('已取消操作')
-      }
-    },
-
-    // 添加到标签库提交
-    async addLibrarySubmit(row) {
-      const keywords = row instanceof Event ? this.currentList : [].concat(row)
-      const ids = keywords.map((item) => item.id).join(',')
-      try {
-        await joinKeywordLibrary({ id: ids })
-        this.$message.success('添加关键词库成功')
-        keywords.forEach((item) => {
-          item.labelStatus = 1
-        })
-      } catch (error) {
-        console.log(error)
-      }
-    },
-    // 查看详情
-    handleRecordDetail(id) {
-      this.$router.push({ path: '/user/record/detail', query: { id: id }})
-    },
-
-    // 导出
-    async handleExport() {
-      try {
-        await this.$confirm('确定将所选标签导出为xlsx?', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        })
-        // 导出数据格式化
-        const filterVal = ['index', 'keyword', 'frequency', 'searchTime', 'labelStatus']
-        const data = this.formatJson(filterVal, this.currentList.slice(0))
-        export_json_to_excel({
-          header: ['序号', '标签', '搜索次数', '最近搜索时间', '标签库状态'],
-          data,
-          filename: '关键词列表'
-        })
-      } catch (error) {
-        this.$message.info('已取消导出操作')
-      }
-    },
-
-    formatJson(filterVal, jsonData) {
-      return jsonData.map((v, index) =>
-        filterVal.map((key) => {
-          if (['searchTime'].includes(key)) {
-            return parseTime(v[key])
-          }
-          if (key === 'index') return index + 1
-          if (key === 'labelStatus') {
-            const t = ['未添加', '已添加', '导入']
-            return t[v[key]]
-          }
-          return v[key]
-        })
-      )
-    },
-
-    indexMethod(index) {
-      return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
     }
   }
 }

+ 115 - 42
src/views/user/record/list.vue

@@ -62,25 +62,28 @@
           <span>公司类型:</span>
           <el-select v-model="listQuery.companyType" style="width:120px;" clearable @change="getList">
             <el-option :value="0" label="请选择" />
-            <el-option :value="1" label="机构" />
-            <el-option :value="2" label="供应商" />
-            <el-option :value="3" label="游客" />
+            <el-option :value="1" label="游客" />
+            <el-option :value="2" label="机构" />
+            <el-option :value="3" label="供应商" />
           </el-select>
         </div>
         <div class="filter-control">
           <span>访问客户端:</span>
           <el-select v-model="listQuery.accessClient" style="width:120px;" clearable @change="getList">
-            <el-option :value="0" label="请选择" />
-            <el-option :value="1" label="网站" />
-            <el-option :value="2" label="小程序" />
+            <el-option value="" label="请选择" />
+            <el-option :value="0" label="网站" />
+            <el-option :value="1" label="小程序" />
           </el-select>
         </div>
         <div class="filter-control">
           <span>关联供应商:</span>
           <el-select v-model="listQuery.accessClient" clearable @change="getList">
-            <el-option :value="0" label="请选择" />
-            <el-option :value="1" label="网站" />
-            <el-option :value="2" label="小程序" />
+            <el-option
+              v-for="item in supplierList"
+              :key="item.shopId"
+              :label="item.shopName"
+              :value="item.shopId"
+            />
           </el-select>
         </div>
         <div class="filter-control">
@@ -88,8 +91,8 @@
           <el-select v-model="tagsList" multiple filterable placeholder="请选择" @change="handleTagsOptions">
             <el-option
               v-for="item in tagsOptions"
-              :key="item.value"
-              :label="item.label"
+              :key="item.id"
+              :label="item.value"
               :value="item.value"
             />
           </el-select>
@@ -116,21 +119,49 @@
       </div>
       <!-- 关键词列表 -->
       <el-table v-loading="isLoading" :data="list" border>
-        <el-table-column label="IP" :index="indexMethod" type="index" sortable="custom" align="center" />
-        <el-table-column label="地区" :index="indexMethod" type="index" sortable="custom" align="center" width="200" />
-        <el-table-column label="访问客户端" :index="indexMethod" type="index" sortable="custom" align="center" width="100" />
-        <el-table-column label="公司类型" :index="indexMethod" type="index" sortable="custom" align="center" width="100" />
-        <el-table-column prop="公司名称" label="公司名称" align="center" />
-        <el-table-column label="联系人" :index="indexMethod" type="index" sortable="custom" align="center" width="100" />
-        <el-table-column label="手机号" :index="indexMethod" type="index" sortable="custom" align="center" width="100" />
-        <el-table-column label="所属协销" :index="indexMethod" type="index" sortable="custom" align="center" width="100" />
-        <el-table-column label="访问页面数量" :index="indexMethod" type="index" sortable="custom" align="center" width="80" />
-        <el-table-column label="总时长" :index="indexMethod" type="index" sortable="custom" align="center" />
-        <el-table-column label="访问日期" :index="indexMethod" type="index" sortable="custom" align="center" />
-        <el-table-column label="最后访问时间" :index="indexMethod" type="index" sortable="custom" align="center" />
+        <el-table-column prop="ip" label="IP" align="center" />
+        <el-table-column prop="region" label="地区" align="center" width="160" />
+        <el-table-column prop="accessClient" label="访问客户端" align="center" width="80">
+          <template slot-scope="{ row }">
+            {{ row.accessClient | accessClientFilters }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="companyType" label="公司类型" align="center" width="80">
+          <template slot-scope="{ row }">
+            {{ row.companyType | companyTypeFilters }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="corporateName" label="公司名称" align="center">
+          <template slot-scope="{ row }">
+            {{ row.corporateName ? row.corporateName : '---' }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="contacts" label="联系人" align="center">
+          <template slot-scope="{ row }">
+            {{ row.contacts ? row.contacts : '---' }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="phoneNumber" label="手机号" align="center">
+          <template slot-scope="{ row }">
+            {{ row.phoneNumber ? row.phoneNumber : '---' }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="spName" label="所属协销" align="center" width="100">
+          <template slot-scope="{ row }">
+            {{ row.spName ? row.spName : '---' }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="numbers" label="访问页面数量" align="center" width="50">
+          <template slot-scope="{ row }">
+            {{ row.numbers ? row.numbers : '0' }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="accessDuration" label="总时长" align="center" />
+        <el-table-column prop="accessDate" label="访问日期" align="center" />
+        <el-table-column prop="lastAccessTime" label="最后访问时间" align="center" />
         <el-table-column label="操作" align="center" width="120">
           <template slot-scope="{ row }">
-            <el-button type="primary" size="mini" @click="handleRecordDetail(row.id)">查看详情</el-button>
+            <el-button type="primary" size="mini" @click="handleRecordDetail(row)">查看详情</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -149,9 +180,29 @@
 <script>
 import { parseTime } from '@/utils'
 import { fetchRecordList } from '@/api/user/record/record'
+import { fetchShopRelevanceList, searchBehaviorList } from '@/api/user/supplier/supplier'
 import { export_json_to_excel } from '@/vendor/Export2Excel'
 
 export default {
+  filters: {
+    companyTypeFilters(value) {
+      // 公司类型
+      const map = {
+        '1': '游客',
+        '2': '机构',
+        '3': '供应商'
+      }
+      return map[value]
+    },
+    accessClientFilters(value) {
+      // 访问客户端
+      const map = {
+        '0': '网站',
+        '1': '小程序'
+      }
+      return map[value]
+    }
+  },
   data() {
     const pickerOptions = {
       shortcuts: [
@@ -221,19 +272,18 @@ export default {
         pageNum: 1,
         pageSize: 100
       },
+      shopListQuery: {
+        shopName: '',
+        linkMan: '',
+        contractMobile: '',
+        pageNum: 1,
+        pageSize: 100
+      },
       list: [],
       total: 0,
       currentList: [],
-      searchDialog: false,
-      visibleKeyword: '',
-      tagsOptions: [
-        { value: '黄金糕', label: '黄金糕' },
-        { value: '双皮奶', label: '双皮奶' },
-        { value: '蚵仔煎', label: '蚵仔煎' },
-        { value: '龙须面', label: '龙须面' },
-        { value: '北京烤鸭', label: '北京烤鸭' },
-        { value: '双黄蛋', label: '双黄蛋' }
-      ],
+      supplierList: [], // 关联供应商列表
+      tagsOptions: [],
       tagsList: [],
       tabsCurrent: 0
     }
@@ -250,9 +300,13 @@ export default {
       if (tab.name === 'first') {
         console.log('data', '今日数据')
         this.tabsCurrent = this.listQuery.todayType = 0
+        this.listQuery.startTime = ''
+        this.listQuery.endTime = ''
+        this.getList()
       } else if (tab.name === 'second') {
         console.log('data', '以往数据')
         this.tabsCurrent = this.listQuery.todayType = 1
+        this.getList()
       }
     },
     handleTagsOptions(arr) {
@@ -260,7 +314,7 @@ export default {
       this.getList()
       console.log('tags', this.listQuery.tags)
     },
-    // 获取关键词列表
+    // 获取行为记录列表
     getList() {
       this.listQuery.pageNum = 1
       if (this.time && this.time.length > 0) {
@@ -271,6 +325,8 @@ export default {
         this.listQuery.endTime = ''
       }
       this.fetchRecordList()
+      this.fetchShopRelevanceList()
+      this.searchBehaviorList()
     },
 
     // 获取关键词列表
@@ -285,15 +341,36 @@ export default {
         console.log(error)
       }
     },
+
+    // 获取关联供应商列表选项
+    async fetchShopRelevanceList() {
+      try {
+        const res = await fetchShopRelevanceList(this.shopListQuery)
+        this.supplierList = res.data.results
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    // 获取标签库列表选项
+    async searchBehaviorList() {
+      try {
+        const res = await searchBehaviorList()
+        this.tagsOptions = res.data
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
     // 查看详情
-    handleRecordDetail(id) {
-      this.$router.push({ path: '/user/record/detail', query: { id: id }})
+    handleRecordDetail(row) {
+      this.$router.push({ path: '/user/record/detail', query: { ip: row.ip, accessDate: row.accessDate, userId: row.userId }})
     },
 
     // 导出
     async handleExport() {
       try {
-        await this.$confirm('确定将所选标签导出为xlsx?', {
+        await this.$confirm('确定将用户行为记录导出为xlsx?', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
@@ -325,10 +402,6 @@ export default {
           return v[key]
         })
       )
-    },
-
-    indexMethod(index) {
-      return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
     }
   }
 }