From c3ac41833efc9e7597c1eaa8a5c03c38e302dbe5 Mon Sep 17 00:00:00 2001
From: x_ying <2438792676@qq.com>
Date: Thu, 7 Jul 2022 09:27:42 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=AE=A1=E7=90=86=20?=
=?UTF-8?q?=E6=A0=87=E7=AD=BE=E4=BD=BF=E7=94=A8=E8=AE=B0=E5=BD=95=20?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../storeManage/tagManage/tagLog/index.vue | 58 +++++++++++--------
1 file changed, 34 insertions(+), 24 deletions(-)
diff --git a/src/views/storeManage/tagManage/tagLog/index.vue b/src/views/storeManage/tagManage/tagLog/index.vue
index 8a94d9d..0916d50 100644
--- a/src/views/storeManage/tagManage/tagLog/index.vue
+++ b/src/views/storeManage/tagManage/tagLog/index.vue
@@ -3,9 +3,9 @@
-
+
-
+
- 搜索
+ 搜索
@@ -57,7 +57,7 @@ import CRUD, { presenter } from '@crud/crud'
// import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import { initTagLogList } from '@/api/storeManage/tagManage/bindTagList'
-let data = null // 接口数据
+
export default {
name: 'TagLog',
components: { crudOperation, pagination },
@@ -88,13 +88,13 @@ export default {
operType: '0',
operTypeOptions: [
{ value: '0', label: '全部' },
- { value: '1', label: '解绑' },
- { value: '2', label: '绑定' }
+ { value: '1', label: '绑定' },
+ { value: '2', label: '解绑' }
],
searchVal: 'tid',
searchOptions: [
{ value: 'tid', label: 'TID' },
- { value: 'tagName', label: '标签名称' }
+ { value: 'title', label: '标签名称' }
],
keyWord: '',
params: {
@@ -111,11 +111,23 @@ export default {
},
methods: {
getData() {
- initTagLogList(this.params).then(res => {
+ initTagLogList(this.getQueryParams()).then(res => {
// 处理表格数据
- data = res
- console.log(data, 'data')
- this.tableRender(res.content)
+ // console.log(res, 'res')
+ let table = res.content
+ // console.log(this.keyWord, 'keyWord')
+ // console.log(this.searchVal)
+ if (!this.keyWord.length) {
+ this.tableRender(table)
+ } else {
+ if (this.searchVal === 'title') {
+ table = table.filter(item => item.title.includes(this.keyWord))
+ this.tableRender(table)
+ } else if (this.searchVal === 'tid') {
+ table = table.filter(item => item.tid.includes(this.keyWord))
+ this.tableRender(table)
+ }
+ }
})
},
// 处理表格数据
@@ -136,26 +148,24 @@ export default {
return item
})
console.log(this.tableData, '表格渲染')
+ } else {
+ this.tableData = []
}
},
- // 获取搜索词
+ // 获取参数
getQueryParams() {
- const queryParams = {
- bindingType: this.bindingType,
- operType: this.operType
+ const queryParams = {}
+ // queryParams.searchVal = this.keyWord.length === 0 ? '' : this.searchVal
+ queryParams.bindingType = parseInt(this.bindingType) === 0 ? '' : this.bindingType
+ queryParams.operType = parseInt(this.operType) === 0 ? '' : this.operType
+ if (this.keyWord.length === 0) {
+ queryParams.title = ''
+ queryParams.tid = ''
}
- queryParams.searchVal = this.keyWord.length === 0 ? undefined : this.searchVal
- console.log(queryParams)
+ return queryParams
},
clickRowHandler(row) {
this.$refs.table.toggleRowSelection(row)
- },
- // 搜索
- searchTableData() {
- // console.log(this.bindingType, this.operType, this.searchVal)
- // const table = data.content
- // console.log(table)
- this.getQueryParams()
}
}
}