|
|
@ -12,7 +12,7 @@ |
|
|
|
<el-col :span="24"> |
|
|
|
<el-button size="small" |
|
|
|
type="primary" |
|
|
|
@click="handleSearchFrom">查询</el-button> |
|
|
|
@click="handleSearchFrom('search')">查询</el-button> |
|
|
|
<el-button style="margin-left: 10px" |
|
|
|
size="small" |
|
|
|
plain |
|
|
@ -442,7 +442,8 @@ |
|
|
|
formCode: 'resident_base_info', |
|
|
|
pageNo: currentPage, |
|
|
|
pageSize: pageSize, |
|
|
|
conditions: conditions, |
|
|
|
// conditions: conditions, |
|
|
|
...this.searchForm |
|
|
|
}" |
|
|
|
@close="handleDiyClose"></diy-info> |
|
|
|
</el-dialog> |
|
|
@ -596,6 +597,8 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
queryConditions: [], |
|
|
|
|
|
|
|
searchForm:{} |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
@ -643,7 +646,7 @@ export default { |
|
|
|
categoryKey: "resi_info", |
|
|
|
}, |
|
|
|
}); |
|
|
|
this.getQueryConditions(); |
|
|
|
// this.getQueryConditions(); |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
@ -683,82 +686,34 @@ export default { |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
|
handleSearchFrom () { |
|
|
|
let obj = this.$refs.myResiSearch.form; |
|
|
|
let categoryArr = this.$refs.myResiSearch.form.categoryKey; |
|
|
|
let agencyId = this.$refs.myResiSearch.form.agencyId; |
|
|
|
if ( |
|
|
|
typeof obj.categoryKey == "object" && |
|
|
|
obj.categoryKey.length != 0 |
|
|
|
) { |
|
|
|
obj.categoryKey = obj.categoryKey.join(","); |
|
|
|
handleSearchFrom (type) { |
|
|
|
// 使用解构赋值获取需要的属性 |
|
|
|
const { categoryKey, agencyId, level } = this.$refs.myResiSearch.form; |
|
|
|
// 深复制对象 |
|
|
|
let _obj = JSON.parse(JSON.stringify(this.$refs.myResiSearch.form)); |
|
|
|
|
|
|
|
// 处理 categoryKey |
|
|
|
if (Array.isArray(categoryKey) && categoryKey.length) { |
|
|
|
_obj.categoryKey = categoryKey.join(","); |
|
|
|
} else { |
|
|
|
obj.categoryKey = ""; |
|
|
|
_obj.categoryKey = ""; |
|
|
|
} |
|
|
|
if (typeof obj.agencyId == "object" && obj.agencyId.length != 0) { |
|
|
|
// obj.agencyId = obj.agencyId.join(","); |
|
|
|
obj.agencyId = obj.agencyId[obj.agencyId.length - 1] |
|
|
|
|
|
|
|
// 处理 agencyId |
|
|
|
if (Array.isArray(agencyId) && agencyId.length) { |
|
|
|
_obj.agencyId = agencyId[agencyId.length - 1]; |
|
|
|
} else { |
|
|
|
obj.agencyId = ""; |
|
|
|
_obj.agencyId = ""; |
|
|
|
} |
|
|
|
obj.level = this.$refs.myResiSearch.level ? this.$refs.myResiSearch.level : '' |
|
|
|
this.currentPage = 1; |
|
|
|
this.getTableData(obj); |
|
|
|
|
|
|
|
let conditions = this.queryConditions |
|
|
|
.filter((item) => obj[item.humpName]) |
|
|
|
.map((item) => { |
|
|
|
let queryType = "equal"; |
|
|
|
const { humpName } = item; |
|
|
|
if ( |
|
|
|
humpName == "name" || |
|
|
|
humpName == "mobile" || |
|
|
|
humpName == "idNum" |
|
|
|
) { |
|
|
|
queryType = "like"; |
|
|
|
} |
|
|
|
return { |
|
|
|
...item, |
|
|
|
queryType, |
|
|
|
columnValue: [obj[item.humpName]], |
|
|
|
}; |
|
|
|
}); |
|
|
|
if (obj.birthdayStart || obj.birthdayEnd) { |
|
|
|
conditions.push({ |
|
|
|
queryType: "daterange", |
|
|
|
columnValue: [ |
|
|
|
obj.birthdayStart || "", |
|
|
|
obj.birthdayEnd || "", |
|
|
|
], |
|
|
|
columnName: "BIRTHDAY", |
|
|
|
label: "出生日期", |
|
|
|
tableName: "resident_base_info", |
|
|
|
}); |
|
|
|
} |
|
|
|
if (obj.ageStart || obj.ageEnd) { |
|
|
|
let ageStart = obj.ageStart || 0; |
|
|
|
let ageEnd = obj.ageEnd || 200; |
|
|
|
let currentYear = new Date().getFullYear(); |
|
|
|
let dateStart = dateFormat( |
|
|
|
new Date(new Date().setFullYear(currentYear - ageStart)), |
|
|
|
"yyyy-MM-dd" |
|
|
|
); |
|
|
|
let dateEnd = dateFormat( |
|
|
|
new Date(new Date().setFullYear(currentYear - ageEnd)), |
|
|
|
"yyyy-MM-dd" |
|
|
|
); |
|
|
|
conditions.push({ |
|
|
|
queryType: "daterange", |
|
|
|
columnValue: [dateEnd, dateStart], |
|
|
|
columnName: "BIRTHDAY", |
|
|
|
label: "出生日期", |
|
|
|
tableName: "resident_base_info", |
|
|
|
}); |
|
|
|
_obj.level = level || ''; // 使用逻辑或操作符简化代码 |
|
|
|
if(type){ |
|
|
|
this.currentPage = 1 |
|
|
|
} |
|
|
|
this.conditions = conditions; |
|
|
|
console.log(obj, this.conditions); |
|
|
|
|
|
|
|
this.$refs.myResiSearch.form.categoryKey = categoryArr; |
|
|
|
this.getTableData(_obj); |
|
|
|
this.searchForm = _obj; |
|
|
|
// 还原form的值 |
|
|
|
this.$refs.myResiSearch.form.categoryKey = categoryKey; |
|
|
|
this.$refs.myResiSearch.form.agencyId = agencyId; |
|
|
|
}, |
|
|
|
// 是否可以选中 |
|
|
@ -809,6 +764,7 @@ export default { |
|
|
|
}, |
|
|
|
async diyExport () { |
|
|
|
await this.getExportList(); |
|
|
|
console.log(this.$refs['']); |
|
|
|
}, |
|
|
|
computedWidth (label, type) { |
|
|
|
let wd = ""; |
|
|
@ -908,8 +864,8 @@ export default { |
|
|
|
resetSearchForm () { |
|
|
|
for (const n in this.$refs.myResiSearch.form) { |
|
|
|
this.$refs.myResiSearch.form[n] = ""; |
|
|
|
|
|
|
|
} |
|
|
|
this.currentPage = 1 |
|
|
|
this.$refs.myResiSearch.level = '' |
|
|
|
this.getTableData(); |
|
|
|
}, |
|
|
@ -1447,6 +1403,7 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
async getTableData (obj) { |
|
|
|
console.log(this.currentPage); |
|
|
|
let params = { |
|
|
|
pageNo: this.currentPage, |
|
|
|
pageSize: this.pageSize, |
|
|
|