优化学科过滤功能

This commit is contained in:
YuNan 2025-02-23 12:26:50 +08:00
parent c46475239e
commit 4f6ca271c0
3 changed files with 102 additions and 14 deletions

View File

@ -5,7 +5,7 @@
<el-input v-model="dataForm.userName" placeholder="姓名" clearable></el-input> <el-input v-model="dataForm.userName" placeholder="姓名" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <el-button @click="getData()">查询</el-button>
<!-- <el-button v-if="isAuth('stu:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>--> <!-- <el-button v-if="isAuth('stu:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>-->
<el-button v-if="isAuth('teach:user:delete')" type="danger" @click="deleteHandle()" <el-button v-if="isAuth('teach:user:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除 :disabled="dataListSelections.length <= 0">批量删除
@ -17,7 +17,7 @@
</el-form> </el-form>
<el-table @sort-change="sortChange" :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" <el-table @sort-change="sortChange" @filter-change="filterChange" :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
style="width: 100%;"> style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"> <el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column> </el-table-column>
@ -120,6 +120,7 @@ export default {
dataListSelections: [], dataListSelections: [],
addOrUpdateVisible: false, addOrUpdateVisible: false,
groupIdes: [], groupIdes: [],
majorIds: 0,
json_fields: { json_fields: {
"序号": "index", "序号": "index",
"姓名": "userName", "姓名": "userName",
@ -198,6 +199,19 @@ export default {
} }
}, },
filterChange(value) {
const majorFilter = value.majorId || []
const majorIds = majorFilter.join(',')
this.majorIds = majorIds
console.log("11111",this.majorIds)
//
this.pageIndex = 1
//
this.myPageSize = [5, 10, 20, 50, 100, 500]
this.getDataList('', '', this.majorIds)
},
// Excel // Excel
async getExportExcel(){ async getExportExcel(){
let excelData=[] let excelData=[]
@ -235,10 +249,18 @@ export default {
// return "" // return ""
// } // }
}, },
async getData(){
if(this.majorIds === 0){
console.log(this.majorIds);
this.getDataList()
return;
}
this.getDataList('','',this.majorIds)
},
// //
getDataList(prop='', sort='', arr='') { async getDataList(prop='', sort='', arr='') {
this.dataListLoading = true this.dataListLoading = true
this.$http({ await this.$http({
url: this.$http.adornUrl('/teach/list'), url: this.$http.adornUrl('/teach/list'),
method: 'get', method: 'get',
params: this.$http.adornParams({ params: this.$http.adornParams({
@ -258,18 +280,29 @@ export default {
this.totalCount = 0 this.totalCount = 0
} }
this.dataListLoading = false this.dataListLoading = false
this.queryCount(0)
}) })
}, },
// //
sizeChangeHandle(val) { sizeChangeHandle(val) {
this.pageSize = val this.pageSize = val
this.pageIndex = 1 this.pageIndex = 1
if(this.majorIds === 0){
console.log(this.majorId);
this.getDataList() this.getDataList()
return;
}
this.getDataList('','',this.majorIds)
}, },
// //
currentChangeHandle(val) { currentChangeHandle(val) {
this.pageIndex = val this.pageIndex = val
if(this.majorIds === 0){
console.log(this.majorIds);
this.getDataList() this.getDataList()
return;
}
this.getDataList('','',this.majorIds)
}, },
// //
selectionChangeHandle(val) { selectionChangeHandle(val) {

View File

@ -5,7 +5,7 @@
<el-input v-model="dataForm.userName" placeholder="姓名" clearable></el-input> <el-input v-model="dataForm.userName" placeholder="姓名" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <el-button @click="getData()">查询</el-button>
<!-- <el-button v-if="isAuth('stu:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>--> <!-- <el-button v-if="isAuth('stu:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>-->
<el-button v-if="isAuth('stu:user:delete')" type="danger" @click="deleteHandle()" <el-button v-if="isAuth('stu:user:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除 :disabled="dataListSelections.length <= 0">批量删除
@ -15,7 +15,7 @@
<el-button type='primary'>导出</el-button> <el-button type='primary'>导出</el-button>
</download-excel> </download-excel>
</el-form> </el-form>
<el-table @sort-change="sortChange" :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" <el-table @sort-change="sortChange" @filter-change="filterChange" :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
style="width: 100%;"> style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"> <el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column> </el-table-column>
@ -119,6 +119,7 @@ export default {
dataListSelections: [], dataListSelections: [],
addOrUpdateVisible: false, addOrUpdateVisible: false,
groupIdes: [], groupIdes: [],
majorIds: 0,
json_fields: { json_fields: {
"序号":"index", "序号":"index",
"姓名": "userName", "姓名": "userName",
@ -190,6 +191,19 @@ export default {
} }
}, },
filterChange(value) {
const majorFilter = value.majorId || []
const majorIds = majorFilter.join(',')
this.majorIds = majorIds
console.log("11111",this.majorIds)
//
this.pageIndex = 1
//
this.myPageSize = [5, 10, 20, 50, 100, 500]
this.getDataList('', '', this.majorIds)
},
// Excel // Excel
async getExportExcel(){ async getExportExcel(){
let excelData=[] let excelData=[]
@ -224,6 +238,14 @@ export default {
// return "" // return ""
// } // }
}, },
async getData(){
if(this.majorIds === 0){
console.log(this.majorIds);
this.getDataList()
return;
}
this.getDataList('','',this.majorIds)
},
// //
getDataList(prop='', sort='', arr='') { getDataList(prop='', sort='', arr='') {
this.dataListLoading = true this.dataListLoading = true
@ -247,18 +269,29 @@ export default {
this.totalCount = 0 this.totalCount = 0
} }
this.dataListLoading = false this.dataListLoading = false
this.queryCount(0)
}) })
}, },
// //
sizeChangeHandle(val) { sizeChangeHandle(val) {
this.pageSize = val this.pageSize = val
this.pageIndex = 1 this.pageIndex = 1
if(this.majorIds === 0){
console.log(this.majorId);
this.getDataList() this.getDataList()
return;
}
this.getDataList('','',this.majorIds)
}, },
// //
currentChangeHandle(val) { currentChangeHandle(val) {
this.pageIndex = val this.pageIndex = val
if(this.majorIds === 0){
console.log(this.majorId);
this.getDataList() this.getDataList()
return;
}
this.getDataList('','',this.majorIds)
}, },
// //
selectionChangeHandle(val) { selectionChangeHandle(val) {

View File

@ -5,7 +5,7 @@
<el-input v-model="dataForm.userName" placeholder="姓名" clearable></el-input> <el-input v-model="dataForm.userName" placeholder="姓名" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <el-button @click="getData()">查询</el-button>
<el-button v-if="isAuth('stu:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button v-if="isAuth('stu:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('wai:user:delete')" type="danger" @click="deleteHandle()" <el-button v-if="isAuth('wai:user:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除 :disabled="dataListSelections.length <= 0">批量删除
@ -232,6 +232,7 @@ export default {
dataListSelections: [], dataListSelections: [],
addOrUpdateVisible: false, addOrUpdateVisible: false,
groupIdes: [], groupIdes: [],
majorIds: 0,
json_fields: { json_fields: {
"序号": "index", "序号": "index",
"姓名": "userName", "姓名": "userName",
@ -336,6 +337,8 @@ export default {
filterChange(value) { filterChange(value) {
const majorFilter = value.majorId || [] const majorFilter = value.majorId || []
const majorIds = majorFilter.join(',') const majorIds = majorFilter.join(',')
this.majorIds = majorIds
//console.log(this.majorIds)
// //
this.pageIndex = 1 this.pageIndex = 1
@ -507,6 +510,14 @@ export default {
// return "" // return ""
// } // }
}, },
async getData(){
if(this.majorIds === 0){
console.log(this.majorIds);
this.getDataList()
return;
}
this.getDataList('','',this.majorIds)
},
// //
async getDataList(prop = '', sort = '', arr = '') { async getDataList(prop = '', sort = '', arr = '') {
this.dataListLoading = true this.dataListLoading = true
@ -537,12 +548,23 @@ export default {
sizeChangeHandle(val) { sizeChangeHandle(val) {
this.pageSize = val this.pageSize = val
this.pageIndex = 1 // this.pageIndex = 1 //
if(this.majorIds === 0){
console.log(this.majorIds);
this.getDataList() this.getDataList()
return;
}
this.getDataList('','',this.majorIds)
}, },
// //
currentChangeHandle(val) { currentChangeHandle(val) {
this.pageIndex = val this.pageIndex = val
console.log("1111",val)
if(this.majorIds === 0){
console.log(this.majorIds);
this.getDataList() this.getDataList()
return;
}
this.getDataList('','',this.majorIds)
}, },
// //
selectionChangeHandle(val) { selectionChangeHandle(val) {