|
|
@@ -25,23 +25,32 @@ Component({
|
|
|
type: Array,
|
|
|
default: [],
|
|
|
},
|
|
|
+ // 查询条件
|
|
|
+ searchForm:{
|
|
|
+ type:Object,
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* 组件的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
+ $t: app.globalData.lang,
|
|
|
+ // 下拉
|
|
|
dropDownFlag: false,
|
|
|
+ // 筛选
|
|
|
+ pickFlag: false,
|
|
|
// 筛选中的日期组件显示标识
|
|
|
dropDateFlag: false,
|
|
|
dropType: null,
|
|
|
dropCode: null,
|
|
|
index: null,
|
|
|
searchType: null,
|
|
|
+ // 记录是哪个组件点击出现的日期
|
|
|
+ dropDateCode: null,
|
|
|
// 下拉多选数据源
|
|
|
pullMSelectMenuList: [],
|
|
|
// 下拉多选外数据源
|
|
|
- pullOtherMenuList: [],
|
|
|
- searchForm: {}
|
|
|
+ pullOtherMenuList: []
|
|
|
},
|
|
|
lifetimes: {
|
|
|
attached: function () {
|
|
|
@@ -86,7 +95,7 @@ Component({
|
|
|
// 筛选
|
|
|
else if (item.searchType === Constants.searchType.pick) {
|
|
|
this.setData({
|
|
|
- dropDownFlag: true,
|
|
|
+ pickFlag: true,
|
|
|
index: index,
|
|
|
dropCode: item.dropType ? item.dropType : item.code,
|
|
|
searchType: item.searchType
|
|
|
@@ -96,6 +105,7 @@ Component({
|
|
|
this.setData({
|
|
|
index: index,
|
|
|
dropDownFlag: false,
|
|
|
+ pickFlag: false,
|
|
|
dropCode: null,
|
|
|
dropType: null
|
|
|
})
|
|
|
@@ -114,7 +124,7 @@ Component({
|
|
|
searchForm[code + 'End'] = data[1]
|
|
|
let menuList = this.data.menuList
|
|
|
let dateDefault = e.detail.dateDefault
|
|
|
- if(this.data.index){
|
|
|
+ if (this.data.index) {
|
|
|
if (menuList.length > this.data.index) {
|
|
|
menuList[this.data.index].defaultValue = dateDefault.value
|
|
|
menuList[this.data.index].title = dateDefault.text
|
|
|
@@ -124,6 +134,8 @@ Component({
|
|
|
searchForm: searchForm,
|
|
|
menuList: menuList
|
|
|
})
|
|
|
+ console.log('fff',this.data.searchForm);
|
|
|
+ this.triggerEvent('search', { searchForm: this.data.searchForm ,trigger:true});
|
|
|
this.selectComponent('#' + e.detail.code).toggle(false);
|
|
|
},
|
|
|
/**
|
|
|
@@ -144,6 +156,7 @@ Component({
|
|
|
dropDownFlag: false
|
|
|
})
|
|
|
console.log('e', this.data.searchForm, e);
|
|
|
+ this.triggerEvent('search', { searchForm: this.data.searchForm });
|
|
|
this.selectComponent('#' + this.data.dropCode).toggle(false);
|
|
|
},
|
|
|
/**
|
|
|
@@ -153,7 +166,7 @@ Component({
|
|
|
*/
|
|
|
mutiCloseAll(e) {
|
|
|
this.setData({
|
|
|
- dropDownFlag: false
|
|
|
+ pickFlag: false
|
|
|
})
|
|
|
this.selectComponent('#' + this.data.dropCode).toggle(false);
|
|
|
},
|
|
|
@@ -196,7 +209,8 @@ Component({
|
|
|
*/
|
|
|
onClickDate(e) {
|
|
|
this.setData({
|
|
|
- dropDateFlag: true
|
|
|
+ dropDateFlag: true,
|
|
|
+ dropDateCode: e.currentTarget.dataset.key
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
@@ -205,7 +219,14 @@ Component({
|
|
|
* @date : 2024/1/29 08:59
|
|
|
*/
|
|
|
pickDateCommit(e) {
|
|
|
- console.log('ee2', e);
|
|
|
+ let searchForm = this.data.searchForm
|
|
|
+ let date = e.detail.date[0] + '~' + e.detail.date[1]
|
|
|
+ searchForm[this.data.dropDateCode] = date
|
|
|
+ searchForm[this.data.dropDateCode + 'Start'] = e.detail.date[0];
|
|
|
+ searchForm[this.data.dropDateCode + 'End'] = e.detail.date[1];
|
|
|
+ this.setData({
|
|
|
+ searchForm: searchForm,
|
|
|
+ })
|
|
|
},
|
|
|
/**
|
|
|
* @desc : 筛选重置事件
|
|
|
@@ -229,14 +250,32 @@ Component({
|
|
|
pullOtherMenuList.forEach(it => {
|
|
|
if (searchForm[it.code]) {
|
|
|
// 删除searchForm中的属性
|
|
|
- delete searchForm[it.code ];
|
|
|
+ delete searchForm[it.code];
|
|
|
+ }
|
|
|
+ // 如果有日期删除日期
|
|
|
+ if (it.dataType == Constants.dataType.date) {
|
|
|
+ delete searchForm[it.code + "Start"];
|
|
|
+ delete searchForm[it.code + "End"];
|
|
|
}
|
|
|
})
|
|
|
console.log('tf', searchForm);
|
|
|
this.setData({
|
|
|
- searchForm: searchForm
|
|
|
+ searchForm: searchForm,
|
|
|
+ dropDateCode: null
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ /**
|
|
|
+ * @desc : 获取语言的方法
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2024/1/19
|
|
|
+ */
|
|
|
+ $t(name) {
|
|
|
+ if (this.data.$t[name]) {
|
|
|
+ return this.data.$t[name];
|
|
|
+ } else {
|
|
|
+ return name;
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
})
|