Commit defe2582 authored by knight's avatar knight

需求96 客户列表,查询清空创建时间

parent 7c70bab5
......@@ -892,6 +892,8 @@ export default {
customerServiceConfirmedTime: [],
firstDealTime: [],
createTime: [],
autoClearedCreateTime: false,
clearedCreateNum: 0,
customerSelect: [],
recommended: [],
getNodeLists: [],
......@@ -1006,6 +1008,19 @@ export default {
}
},
watch: {
queryParams: {
handler() {
this.clearedCreateNum++ // 记录用户改动搜索框次数
console.log('clearedCreateNum:' + this.clearedCreateNum)
// 当页面尚未自动清空过创建时间,并且创建时间不为空时
// 页面加载完成后,这里的值是5,如果查询条件功能做了修改也可能要改动
if (this.clearedCreateNum == 5 && this.createTime && this.createTime.length > 0) {
this.createTime = [] // 清空创建时间条件数据
this.autoClearedCreateTime = true // 记录已经清空过
}
},
deep: true, // 深度监听
},
showSearch() {
this.$nextTick(() => {
this.getHeight()
......@@ -1195,10 +1210,28 @@ export default {
//this.$refs.push({path:'/customer-contacts/select',query:{pageNo:1,pageSize:10,searchKey:row.defaultContactPhone}})
})
},
hasNonEmptyQueryCondition() {
// 用于判断搜索字段内容是否做了修改
return Object.keys(this.queryParams).some(key => {
// 如果不需要判断某个字段,可在此处进行排除
if(key === 'pageNo') return false;
if(key === 'pageSize') return false;
if(key === 'searchKey') return false;
const value = this.queryParams[key]
if (typeof value === 'string') {
return value.trim() !== ''
} else if (Array.isArray(value)) {
return value.length > 0
} else if (typeof value === 'object' && value !== null) {
return Object.keys(value).length > 0
}
return value !== null && value !== undefined
})
},
/** 查询列表 */
getList() {
this.loading = true
// 处理查询参数}
// 处理查询参数
let params = { ...this.queryParams, ...this.combinedQueryParams }
// 执行查询
......@@ -1291,6 +1324,15 @@ export default {
},
/** 搜索按钮操作 */
handleQuery() {
// 第一次通过查询选择框触发会清空创建时间
if (
!this.autoClearedCreateTime &&
this.hasNonEmptyQueryCondition() &&
(this.createTime && this.createTime.length > 0)
) {
this.createTime = [] // 自动清空创建时间数据
this.autoClearedCreateTime = true // 记录已经清空过
}
this.queryParams.pageNo = 1
this.getList()
},
......@@ -1392,7 +1434,7 @@ export default {
})
},
setData(response) {
console.log(response, "response")
// console.log(response, "response")
this.list = response.data.list
this.total = response.data.total
this.loading = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment