Browse Source

居民信息分页问题

feature
mk 2 years ago
parent
commit
8b740834e8
  1. 119
      src/views/modules/base/resi.vue

119
src/views/modules/base/resi.vue

@ -12,7 +12,7 @@
<el-col :span="24"> <el-col :span="24">
<el-button size="small" <el-button size="small"
type="primary" type="primary"
@click="handleSearchFrom">查询</el-button> @click="handleSearchFrom('search')">查询</el-button>
<el-button style="margin-left: 10px" <el-button style="margin-left: 10px"
size="small" size="small"
plain plain
@ -442,7 +442,8 @@
formCode: 'resident_base_info', formCode: 'resident_base_info',
pageNo: currentPage, pageNo: currentPage,
pageSize: pageSize, pageSize: pageSize,
conditions: conditions, // conditions: conditions,
...this.searchForm
}" }"
@close="handleDiyClose"></diy-info> @close="handleDiyClose"></diy-info>
</el-dialog> </el-dialog>
@ -596,6 +597,8 @@ export default {
}, },
queryConditions: [], queryConditions: [],
searchForm:{}
}; };
}, },
@ -643,7 +646,7 @@ export default {
categoryKey: "resi_info", categoryKey: "resi_info",
}, },
}); });
this.getQueryConditions(); // this.getQueryConditions();
}, },
methods: { methods: {
@ -683,83 +686,35 @@ export default {
}, },
}); });
}, },
handleSearchFrom () { handleSearchFrom (type) {
let obj = this.$refs.myResiSearch.form; // 使
let categoryArr = this.$refs.myResiSearch.form.categoryKey; const { categoryKey, agencyId, level } = this.$refs.myResiSearch.form;
let agencyId = this.$refs.myResiSearch.form.agencyId; //
if ( let _obj = JSON.parse(JSON.stringify(this.$refs.myResiSearch.form));
typeof obj.categoryKey == "object" &&
obj.categoryKey.length != 0 // categoryKey
) { if (Array.isArray(categoryKey) && categoryKey.length) {
obj.categoryKey = obj.categoryKey.join(","); _obj.categoryKey = categoryKey.join(",");
} else { } else {
obj.categoryKey = ""; _obj.categoryKey = "";
} }
if (typeof obj.agencyId == "object" && obj.agencyId.length != 0) {
// obj.agencyId = obj.agencyId.join(","); // agencyId
obj.agencyId = obj.agencyId[obj.agencyId.length - 1] if (Array.isArray(agencyId) && agencyId.length) {
} else { _obj.agencyId = agencyId[agencyId.length - 1];
obj.agencyId = ""; } else {
} _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",
});
}
this.conditions = conditions;
console.log(obj, this.conditions);
this.$refs.myResiSearch.form.categoryKey = categoryArr; _obj.level = level || ''; // 使
this.$refs.myResiSearch.form.agencyId = agencyId; if(type){
this.currentPage = 1
}
this.getTableData(_obj);
this.searchForm = _obj;
// form
this.$refs.myResiSearch.form.categoryKey = categoryKey;
this.$refs.myResiSearch.form.agencyId = agencyId;
}, },
// //
checkSelectable (row, index) { checkSelectable (row, index) {
@ -809,6 +764,7 @@ export default {
}, },
async diyExport () { async diyExport () {
await this.getExportList(); await this.getExportList();
console.log(this.$refs['']);
}, },
computedWidth (label, type) { computedWidth (label, type) {
let wd = ""; let wd = "";
@ -908,8 +864,8 @@ export default {
resetSearchForm () { resetSearchForm () {
for (const n in this.$refs.myResiSearch.form) { for (const n in this.$refs.myResiSearch.form) {
this.$refs.myResiSearch.form[n] = ""; this.$refs.myResiSearch.form[n] = "";
} }
this.currentPage = 1
this.$refs.myResiSearch.level = '' this.$refs.myResiSearch.level = ''
this.getTableData(); this.getTableData();
}, },
@ -1447,12 +1403,13 @@ export default {
}, },
async getTableData (obj) { async getTableData (obj) {
console.log(this.currentPage);
let params = { let params = {
pageNo: this.currentPage, pageNo: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
...obj, ...obj,
}; };
this.tableLoading = true; this.tableLoading = true;
const { data } = await this.$http.post( const { data } = await this.$http.post(
"/actual/base/residentBaseInfo/page", "/actual/base/residentBaseInfo/page",

Loading…
Cancel
Save