Sfoglia il codice sorgente

用户行为记录

zhengjinyi 2 anni fa
parent
commit
5049c9397f

+ 4 - 2
src/utils/index.js

@@ -245,7 +245,8 @@ export function getTime(type) {
 export function debounce(func, wait, immediate) {
   let timeout, args, context, timestamp, result
 
-  const later = function() {
+  // eslint-disable-next-line space-before-function-paren
+  const later = function () {
     // 据上一次触发时间间隔
     const last = +new Date() - timestamp
 
@@ -262,7 +263,8 @@ export function debounce(func, wait, immediate) {
     }
   }
 
-  return function(...args) {
+  // eslint-disable-next-line space-before-function-paren
+  return function (...args) {
     context = this
     timestamp = +new Date()
     const callNow = immediate && !timeout

+ 3 - 1
src/views/library/supplierTag/list.vue

@@ -117,7 +117,7 @@
     >
       <el-form ref="tagForm" :model="tagForm" :rules="tagFormRules">
         <el-form-item label="标签名:" prop="keyword">
-          <el-input v-model="tagForm.keyword" />
+          <el-input v-model="tagForm.keyword" maxlength="20" />
         </el-form-item>
       </el-form>
       <div slot="footer">
@@ -148,6 +148,7 @@ export default {
       addTagDialog: false,
       selectionTagDialog: false,
       labelQuery: {
+        shopId: '', // 供应商Id
         keyword: '', // 标签名
         pageNum: 1, // 页码
         pageSize: 100// 页面数据数
@@ -181,6 +182,7 @@ export default {
   },
   created() {
     this.relevanceId = this.$route.query.relevanceId
+    this.labelQuery.shopId = this.$route.query.shopId
     this.listQuery = { ...this.listQuery, ...this.$route.query }
     console.log('listQuery', this.listQuery)
     this.getList()

+ 23 - 5
src/views/library/supplierTag/supplier-list.vue

@@ -52,7 +52,7 @@
       <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>
+          <el-button type="primary" size="mini" @click="handleTagsList(row)">标签列表</el-button>
           <el-button v-permission="'tag:list:del'" type="danger" size="mini" @click="handleDeleteSupper(row)">删除</el-button>
         </template>
       </el-table-column>
@@ -110,6 +110,15 @@
           </template>
         </el-table-column>
       </el-table>
+      <!-- 页码 -->
+      <pagination
+        :total="shopListTotal"
+        :page-sizes="[100, 200]"
+        :page-size="100"
+        :page.sync="shopListQuery.pageNum"
+        :limit.sync="shopListQuery.pageSize"
+        @pagination="fetchShopLabelShopList"
+      />
       <div slot="footer">
         <el-button @click="addSupplierDialog = false">取 消</el-button>
         <el-button type="primary" :disabled="disabled" @click="handleAddTagConfirm(supplierRadio)">确 定</el-button>
@@ -136,13 +145,15 @@ export default {
       },
       list: [],
       total: 0,
+      shopListTotal: 0,
       shopListQuery: {
         pageNum: 1, // 页码
         pageSize: 200, // 页面数据数
         shopId: '', // 供应商ID
         name: ''// 供应商公司名称
       },
-      supplierRadio: null
+      supplierRadio: null,
+      isAddSupplier: false
     }
   },
   computed: {
@@ -186,9 +197,11 @@ export default {
     },
     // 获取所有供应商列表
     async fetchShopLabelShopList() {
+      this.supplierList = []
       try {
         const res = await fetchShopLabelShopList(this.shopListQuery)
         this.supplierList = res.data.results
+        this.shopListTotal = res.data.totalRecord
       } catch (error) {
         console.log(error)
       }
@@ -196,7 +209,9 @@ export default {
     // 确定选择供应商
     async handleAddTagConfirm(shopId) {
       try {
+        if (this.isAddSupplier) { return }
         this.addSupplierDialog = false
+        this.isAddSupplier = true
         await importShopRelevance({ shopId: shopId })
         this.$message.success({
           message: '添加供应商成功',
@@ -204,12 +219,15 @@ export default {
           center: true,
           duration: 2000,
           onClose: () => {
+            this.isAddSupplier = false
             this.shopListQuery.name = ''
             this.shopListQuery.shopId = ''
+            this.supplierRadio = null
             this.getList()
           }
         })
       } catch (error) {
+        this.isAddSupplier = false
         console.log(error)
       }
     },
@@ -236,9 +254,9 @@ export default {
         console.log(error)
       }
     },
-    // 查看详情
-    handleTagsList(id) {
-      this.$router.push({ path: '/library/supplierTag/tagList', query: { relevanceId: id }})
+    // 标签列表
+    handleTagsList(row) {
+      this.$router.push({ path: '/library/supplierTag/tagList', query: { shopId: row.shopId, relevanceId: row.id }})
     }
   }
 }

+ 13 - 2
src/views/user/record/detail-list.vue

@@ -4,7 +4,12 @@
     <div class="filter-container">
       <!-- 关键词列表 -->
       <el-table v-loading="isLoading" :data="list" border>
-        <el-table-column prop="pagePath" label="页面路径" align="center" width="300" />
+        <el-table-column prop="pagePath" label="页面路径" align="center" width="300">
+          <template slot-scope="{ row }">
+            <a v-if="row.accessClient === '0'" style="color:#2fa4e7;" target="_blank" :href="row.pagePath"> {{ row.pagePath }}</a>
+            <span v-else> {{ row.pagePath }} </span>
+          </template>
+        </el-table-column>
         <el-table-column prop="accessSource" label="访问来源" align="center" width="100">
           <template slot-scope="{ row }">
             {{ row.accessSource | accessSourceFilters }}
@@ -46,13 +51,19 @@
             {{ row.productName ? row.productName : '---' }}
           </template>
         </el-table-column>
-        <el-table-column prop="relevanceShop" label="关联供应商" align="center" />
+        <el-table-column label="关联供应商" align="center">
+          <template slot-scope="{ row }">
+            {{ row.relevanceShop ? row.relevanceShop : '---' }}
+          </template>
+        </el-table-column>
         <el-table-column prop="accessTime" label="访问时间" align="center" />
         <el-table-column prop="accessDuration" label="访问时长" align="center" />
       </el-table>
       <!-- 页码 -->
       <pagination
         :total="total"
+        :page-sizes="[100, 200]"
+        :page-size="100"
         :page.sync="listQuery.pageNum"
         :limit.sync="listQuery.pageSize"
         @pagination="fetchBehaviorList"

+ 6 - 4
src/views/user/record/list.vue

@@ -151,7 +151,7 @@
             {{ row.spName ? row.spName : '---' }}
           </template>
         </el-table-column>
-        <el-table-column prop="relevanceShop" label="关联供应商" align="center">
+        <el-table-column prop="relevanceShop" label="关联供应商" align="center" width="250">
           <template slot-scope="{ row }">
             {{ row.relevanceShop ? row.relevanceShop : '---' }}
           </template>
@@ -184,6 +184,8 @@
       <!-- 页码 -->
       <pagination
         :total="total"
+        :page-sizes="[100, 200]"
+        :page-size="100"
         :page.sync="listQuery.pageNum"
         :limit.sync="listQuery.pageSize"
         @pagination="fetchRecordList"
@@ -194,7 +196,7 @@
 
 <script>
 import { downloadWithUrl } from '@/utils'
-import { fetchRecordList, importExportToday } from '@/api/user/record/record'
+import { fetchRecordList } from '@/api/user/record/record'
 import { fetchShopRelevanceList, searchBehaviorList } from '@/api/user/supplier/supplier'
 import { export_json_to_excel } from '@/vendor/Export2Excel'
 
@@ -388,8 +390,8 @@ export default {
     async handleExport() {
       if (this.tabsCurrent === 0) {
         // 导出今日数据
-        const res = await importExportToday(this.listQuery)
-        downloadWithUrl(res.data, '用户行为记录')
+        const url = process.env.VUE_APP_BASE_API + '/user/behavior/exportToday'
+        downloadWithUrl(url, '用户行为记录')
       } else {
         // 导出以往当前数据
         try {