commit:左树右表页面支持

This commit is contained in:
Jerry
2020-10-10 23:40:46 +08:00
parent 42eb7503d7
commit 3020abc9e5
5 changed files with 284 additions and 334 deletions

View File

@@ -1,29 +1,28 @@
<template>
<div style="position: relative;">
<el-container style="position: relative;">
<el-aside width="300px">
<el-card class="base-card" shadow="never" :body-style="{ padding: '0px' }">
<div slot="header" class="base-card-header">
<span>所属校区</span>
</div>
<el-scrollbar :style="{height: (getMainContextHeight - 94) + 'px'}" class="custom-scroll">
<el-tree ref="schoolId" :props="{label: 'name'}"
:data="formStudent.schoolId.impl.dropdownList"
node-key="id" @node-click="onSchoolIdValueChange"
:highlight-current="true" :default-expand-all="true" />
</el-scrollbar>
</el-card>
</el-aside>
<el-main style="padding-left: 15px;">
<el-scrollbar :style="{height: (getMainContextHeight - 42) + 'px'}" class="custom-scroll">
<el-form label-width="100px" size="mini" label-position="right" @submit.native.prevent>
<filter-box :item-width="350">
<el-form-item label="所属省份">
<el-select class="filter-item" v-model="formStudent.formFilter.provinceId" :clearable="true" filterable
placeholder="所属省份" :loading="formStudent.provinceId.impl.loading"
@visible-change="formStudent.provinceId.impl.onVisibleChange"
@change="onProvinceIdValueChange">
<el-option v-for="item in formStudent.provinceId.impl.dropdownList" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
<el-form-item label="所属城市">
<el-select class="filter-item" v-model="formStudent.formFilter.cityId" :clearable="true" filterable
placeholder="所属城市" :loading="formStudent.cityId.impl.loading"
@visible-change="formStudent.cityId.impl.onVisibleChange"
@change="onCityIdValueChange">
<el-option v-for="item in formStudent.cityId.impl.dropdownList" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
<el-form-item label="所属校区">
<el-select class="filter-item" v-model="formStudent.formFilter.schoolId" :clearable="true" filterable
placeholder="所属校区" :loading="formStudent.schoolId.impl.loading"
@visible-change="formStudent.schoolId.impl.onVisibleChange"
@change="onSchoolIdValueChange">
<el-option v-for="item in formStudent.schoolId.impl.dropdownList" :key="item.id" :value="item.id" :label="item.name" />
<el-form-item label="所属年级">
<el-select class="filter-item" v-model="formStudent.formFilter.gradeId" :clearable="true" filterable
placeholder="所属年级" :loading="formStudent.gradeId.impl.loading"
@visible-change="formStudent.gradeId.impl.onVisibleChange"
@change="onGradeIdValueChange">
<el-option v-for="item in formStudent.gradeId.impl.dropdownList" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
<el-form-item label="注册日期">
@@ -89,10 +88,13 @@
</el-row>
</el-col>
</el-row>
</div>
</el-scrollbar>
</el-main>
</el-container>
</template>
<script>
import { mapGetters } from 'vuex';
/* eslint-disable-next-line */
import rules from '@/utils/validate.js';
/* eslint-disable-next-line */
@@ -113,27 +115,22 @@ export default {
return {
formStudent: {
formFilter: {
provinceId: undefined,
cityId: undefined,
schoolId: undefined,
gradeId: undefined,
registerDate: [],
searchString: undefined
},
formFilterCopy: {
provinceId: undefined,
cityId: undefined,
schoolId: undefined,
gradeId: undefined,
registerDate: [],
searchString: undefined
},
provinceId: {
impl: new DropdownWidget(this.loadProvinceIdDropdownList)
},
cityId: {
impl: new DropdownWidget(this.loadCityIdDropdownList)
},
schoolId: {
impl: new DropdownWidget(this.loadSchoolIdDropdownList)
impl: new DropdownWidget(this.loadSchoolIdDropdownList, true, 'id', 'parentId')
},
gradeId: {
impl: new DropdownWidget(this.loadGradeIdDropdownList)
},
Student: {
impl: new TableWidget(this.loadStudentData, this.loadStudentVerify, true, 'registerTime', 1)
@@ -151,8 +148,7 @@ export default {
params = {
...params,
studentFilter: {
provinceId: this.formStudent.formFilterCopy.provinceId,
cityId: this.formStudent.formFilterCopy.cityId,
gradeId: this.formStudent.formFilterCopy.gradeId,
schoolId: this.formStudent.formFilterCopy.schoolId,
registerTimeStart: Array.isArray(this.formStudent.formFilterCopy.registerDate) ? this.formStudent.formFilterCopy.registerDate[0] : undefined,
registerTimeEnd: Array.isArray(this.formStudent.formFilterCopy.registerDate) ? this.formStudent.formFilterCopy.registerDate[1] : undefined,
@@ -174,76 +170,18 @@ export default {
* 学生数据数据获取检测函数返回true正常获取数据返回false停止获取数据
*/
loadStudentVerify () {
this.formStudent.formFilterCopy.provinceId = this.formStudent.formFilter.provinceId;
this.formStudent.formFilterCopy.cityId = this.formStudent.formFilter.cityId;
this.formStudent.formFilterCopy.gradeId = this.formStudent.formFilter.gradeId;
this.formStudent.formFilterCopy.schoolId = this.formStudent.formFilter.schoolId;
this.formStudent.formFilterCopy.registerDate = this.formStudent.formFilter.registerDate;
this.formStudent.formFilterCopy.searchString = this.formStudent.formFilter.searchString;
return true;
},
/**
* 所属省份下拉数据获取函数
*/
loadProvinceIdDropdownList () {
return new Promise((resolve, reject) => {
let params = {};
DictionaryController.dictAreaCodeByParentId(this, params).then(res => {
resolve(res.getList());
}).catch(e => {
reject(e);
});
});
},
/**
* 所属省份选中值改变
*/
onProvinceIdValueChange (value) {
// 清除被过滤组件选中值并且将被过滤组件的状态设置为dirty
this.formStudent.formFilter.cityId = undefined;
this.formStudent.cityId.impl.dirty = true;
this.onCityIdValueChange(this.formStudent.formFilter.cityId);
// 清除被过滤组件选中值并且将被过滤组件的状态设置为dirty
this.formStudent.formFilter.schoolId = undefined;
this.formStudent.schoolId.impl.dirty = true;
this.onSchoolIdValueChange(this.formStudent.formFilter.schoolId);
},
/**
* 所属城市下拉数据获取函数
*/
loadCityIdDropdownList () {
return new Promise((resolve, reject) => {
let params = {
parentId: this.formStudent.formFilter.provinceId
};
if (params.parentId == null || params.parentId === '') {
resolve([]);
return;
}
DictionaryController.dictAreaCodeByParentId(this, params).then(res => {
resolve(res.getList());
}).catch(e => {
reject(e);
});
});
},
/**
* 所属城市选中值改变
*/
onCityIdValueChange (value) {
// 清除被过滤组件选中值并且将被过滤组件的状态设置为dirty
this.formStudent.formFilter.schoolId = undefined;
this.formStudent.schoolId.impl.dirty = true;
this.onSchoolIdValueChange(this.formStudent.formFilter.schoolId);
},
/**
* 所属校区下拉数据获取函数
*/
loadSchoolIdDropdownList () {
return new Promise((resolve, reject) => {
let params = {
provinceId: this.formStudent.formFilter.provinceId,
cityId: this.formStudent.formFilter.cityId
};
let params = {};
DictionaryController.dictSchoolInfo(this, params).then(res => {
resolve(res.getList());
}).catch(e => {
@@ -255,6 +193,33 @@ export default {
* 所属校区选中值改变
*/
onSchoolIdValueChange (value) {
if (value.id !== this.formStudent.formFilter.schoolId) {
this.formStudent.formFilter.schoolId = value.id;
} else {
this.formStudent.formFilter.schoolId = undefined;
this.$nextTick(() => {
this.$refs.schoolId.setCurrentKey(null);
});
}
this.refreshFormStudent(true);
},
/**
* 所属年级下拉数据获取函数
*/
loadGradeIdDropdownList () {
return new Promise((resolve, reject) => {
let params = {};
DictionaryController.dictGrade(this, params).then(res => {
resolve(res.getList());
}).catch(e => {
reject(e);
});
});
},
/**
* 所属年级选中值改变
*/
onGradeIdValueChange (value) {
},
/**
* 更新学生管理
@@ -267,6 +232,7 @@ export default {
}
if (!this.formStudent.isInit) {
// 初始化下拉数据
this.formStudent.schoolId.impl.onVisibleChange(true);
}
this.formStudent.isInit = true;
},
@@ -320,8 +286,17 @@ export default {
this.refreshFormStudent();
}
},
computed: {
...mapGetters(['getMainContextHeight'])
},
created () {
this.formInit();
}
}
</script>
<style scoped>
>>> .el-tree-node__content {
height: 35px;
}
</style>

View File

@@ -10,7 +10,7 @@
icon="el-icon-circle-plus-outline" @click="onCreatePermModuleClick()" />
</div>
</div>
<el-scrollbar :style="{height: (getClientHeight - 184) + 'px'}" class="custom-scroll">
<el-scrollbar :style="{height: (getMainContextHeight - 94) + 'px'}" class="custom-scroll">
<el-tree ref="moduleTree" :data="getModuleTreeData" :props="{label: 'moduleName'}"
node-key="moduleId" @node-click="onModuleNodeClick" :default-expanded-keys="formPerm.expandedModule"
:highlight-current="true" @node-expand="onModuleNodeExpand" @node-collapse="onModuleNodeCollapse">
@@ -49,7 +49,7 @@
<el-row>
<el-col :span="24">
<el-table :data="formPerm.SysPerm.impl.dataList" size="mini" @sort-change="formPerm.SysPerm.impl.onSortChange"
header-cell-class-name="table-header-gray" :height="(getClientHeight - 222) + 'px'">
header-cell-class-name="table-header-gray" :height="(getMainContextHeight - 132) + 'px'">
<el-table-column label="序号" header-align="center" align="center" type="index" width="50px" :index="formPerm.SysPerm.impl.getTableIndex" />
<el-table-column label="权限名称" prop="permName" width="150px">
</el-table-column>
@@ -344,7 +344,7 @@ export default {
}];
return tempList.concat(this.formPerm.permModuleId.impl.dropdownList);
},
...mapGetters(['getClientHeight'])
...mapGetters(['getMainContextHeight'])
},
created () {
this.formInit();

View File

@@ -5,11 +5,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<title><EFBFBD>ȵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></title>
</head>
<body class="demo-project">
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
<strong>We're sorry but <EFBFBD>ȵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->

View File

@@ -1,29 +1,28 @@
<template>
<div style="position: relative;">
<el-container style="position: relative;">
<el-aside width="300px">
<el-card class="base-card" shadow="never" :body-style="{ padding: '0px' }">
<div slot="header" class="base-card-header">
<span>所属校区</span>
</div>
<el-scrollbar :style="{height: (getMainContextHeight - 94) + 'px'}" class="custom-scroll">
<el-tree ref="schoolId" :props="{label: 'name'}"
:data="formStudent.schoolId.impl.dropdownList"
node-key="id" @node-click="onSchoolIdValueChange"
:highlight-current="true" :default-expand-all="true" />
</el-scrollbar>
</el-card>
</el-aside>
<el-main style="padding-left: 15px;">
<el-scrollbar :style="{height: (getMainContextHeight - 42) + 'px'}" class="custom-scroll">
<el-form label-width="100px" size="mini" label-position="right" @submit.native.prevent>
<filter-box :item-width="350">
<el-form-item label="所在省份">
<el-select class="filter-item" v-model="formStudent.formFilter.provinceId" :clearable="true" filterable
placeholder="所在省份" :loading="formStudent.provinceId.impl.loading"
@visible-change="formStudent.provinceId.impl.onVisibleChange"
@change="onProvinceIdValueChange">
<el-option v-for="item in formStudent.provinceId.impl.dropdownList" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
<el-form-item label="所在城市">
<el-select class="filter-item" v-model="formStudent.formFilter.cityId" :clearable="true" filterable
placeholder="所在城市" :loading="formStudent.cityId.impl.loading"
@visible-change="formStudent.cityId.impl.onVisibleChange"
@change="onCityIdValueChange">
<el-option v-for="item in formStudent.cityId.impl.dropdownList" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
<el-form-item label="所属校区">
<el-select class="filter-item" v-model="formStudent.formFilter.schoolId" :clearable="true" filterable
placeholder="所属校区" :loading="formStudent.schoolId.impl.loading"
@visible-change="formStudent.schoolId.impl.onVisibleChange"
@change="onSchoolIdValueChange">
<el-option v-for="item in formStudent.schoolId.impl.dropdownList" :key="item.id" :value="item.id" :label="item.name" />
<el-form-item label="所属年级">
<el-select class="filter-item" v-model="formStudent.formFilter.gradeId" :clearable="true" filterable
placeholder="所属年级" :loading="formStudent.gradeId.impl.loading"
@visible-change="formStudent.gradeId.impl.onVisibleChange"
@change="onGradeIdValueChange">
<el-option v-for="item in formStudent.gradeId.impl.dropdownList" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
<el-form-item label="注册日期">
@@ -89,10 +88,13 @@
</el-row>
</el-col>
</el-row>
</div>
</el-scrollbar>
</el-main>
</el-container>
</template>
<script>
import { mapGetters } from 'vuex';
/* eslint-disable-next-line */
import rules from '@/utils/validate.js';
/* eslint-disable-next-line */
@@ -113,27 +115,22 @@ export default {
return {
formStudent: {
formFilter: {
provinceId: undefined,
cityId: undefined,
schoolId: undefined,
gradeId: undefined,
registerDate: [],
searchString: undefined
},
formFilterCopy: {
provinceId: undefined,
cityId: undefined,
schoolId: undefined,
gradeId: undefined,
registerDate: [],
searchString: undefined
},
provinceId: {
impl: new DropdownWidget(this.loadProvinceIdDropdownList)
},
cityId: {
impl: new DropdownWidget(this.loadCityIdDropdownList)
},
schoolId: {
impl: new DropdownWidget(this.loadSchoolIdDropdownList)
impl: new DropdownWidget(this.loadSchoolIdDropdownList, true, 'id', 'parentId')
},
gradeId: {
impl: new DropdownWidget(this.loadGradeIdDropdownList)
},
Student: {
impl: new TableWidget(this.loadStudentData, this.loadStudentVerify, true, 'registerTime', 1)
@@ -151,8 +148,7 @@ export default {
params = {
...params,
studentFilter: {
provinceId: this.formStudent.formFilterCopy.provinceId,
cityId: this.formStudent.formFilterCopy.cityId,
gradeId: this.formStudent.formFilterCopy.gradeId,
schoolId: this.formStudent.formFilterCopy.schoolId,
registerTimeStart: Array.isArray(this.formStudent.formFilterCopy.registerDate) ? this.formStudent.formFilterCopy.registerDate[0] : undefined,
registerTimeEnd: Array.isArray(this.formStudent.formFilterCopy.registerDate) ? this.formStudent.formFilterCopy.registerDate[1] : undefined,
@@ -174,76 +170,18 @@ export default {
* 学生数据数据获取检测函数返回true正常获取数据返回false停止获取数据
*/
loadStudentVerify () {
this.formStudent.formFilterCopy.provinceId = this.formStudent.formFilter.provinceId;
this.formStudent.formFilterCopy.cityId = this.formStudent.formFilter.cityId;
this.formStudent.formFilterCopy.gradeId = this.formStudent.formFilter.gradeId;
this.formStudent.formFilterCopy.schoolId = this.formStudent.formFilter.schoolId;
this.formStudent.formFilterCopy.registerDate = this.formStudent.formFilter.registerDate;
this.formStudent.formFilterCopy.searchString = this.formStudent.formFilter.searchString;
return true;
},
/**
* 所在省份下拉数据获取函数
*/
loadProvinceIdDropdownList () {
return new Promise((resolve, reject) => {
let params = {};
DictionaryController.dictAreaCodeByParentId(this, params).then(res => {
resolve(res.getList());
}).catch(e => {
reject(e);
});
});
},
/**
* 所在省份选中值改变
*/
onProvinceIdValueChange (value) {
// 清除被过滤组件选中值并且将被过滤组件的状态设置为dirty
this.formStudent.formFilter.cityId = undefined;
this.formStudent.cityId.impl.dirty = true;
this.onCityIdValueChange(this.formStudent.formFilter.cityId);
// 清除被过滤组件选中值并且将被过滤组件的状态设置为dirty
this.formStudent.formFilter.schoolId = undefined;
this.formStudent.schoolId.impl.dirty = true;
this.onSchoolIdValueChange(this.formStudent.formFilter.schoolId);
},
/**
* 所在城市下拉数据获取函数
*/
loadCityIdDropdownList () {
return new Promise((resolve, reject) => {
let params = {
parentId: this.formStudent.formFilter.provinceId
};
if (params.parentId == null || params.parentId === '') {
resolve([]);
return;
}
DictionaryController.dictAreaCodeByParentId(this, params).then(res => {
resolve(res.getList());
}).catch(e => {
reject(e);
});
});
},
/**
* 所在城市选中值改变
*/
onCityIdValueChange (value) {
// 清除被过滤组件选中值并且将被过滤组件的状态设置为dirty
this.formStudent.formFilter.schoolId = undefined;
this.formStudent.schoolId.impl.dirty = true;
this.onSchoolIdValueChange(this.formStudent.formFilter.schoolId);
},
/**
* 所属校区下拉数据获取函数
*/
loadSchoolIdDropdownList () {
return new Promise((resolve, reject) => {
let params = {
provinceId: this.formStudent.formFilter.provinceId,
cityId: this.formStudent.formFilter.cityId
};
let params = {};
DictionaryController.dictSchoolInfo(this, params).then(res => {
resolve(res.getList());
}).catch(e => {
@@ -255,6 +193,33 @@ export default {
* 所属校区选中值改变
*/
onSchoolIdValueChange (value) {
if (value.id !== this.formStudent.formFilter.schoolId) {
this.formStudent.formFilter.schoolId = value.id;
} else {
this.formStudent.formFilter.schoolId = undefined;
this.$nextTick(() => {
this.$refs.schoolId.setCurrentKey(null);
});
}
this.refreshFormStudent(true);
},
/**
* 所属年级下拉数据获取函数
*/
loadGradeIdDropdownList () {
return new Promise((resolve, reject) => {
let params = {};
DictionaryController.dictGrade(this, params).then(res => {
resolve(res.getList());
}).catch(e => {
reject(e);
});
});
},
/**
* 所属年级选中值改变
*/
onGradeIdValueChange (value) {
},
/**
* 更新学生管理
@@ -267,6 +232,7 @@ export default {
}
if (!this.formStudent.isInit) {
// 初始化下拉数据
this.formStudent.schoolId.impl.onVisibleChange(true);
}
this.formStudent.isInit = true;
},
@@ -320,8 +286,17 @@ export default {
this.refreshFormStudent();
}
},
computed: {
...mapGetters(['getMainContextHeight'])
},
created () {
this.formInit();
}
}
</script>
<style scoped>
>>> .el-tree-node__content {
height: 35px;
}
</style>

View File

@@ -10,7 +10,7 @@
icon="el-icon-circle-plus-outline" @click="onCreatePermModuleClick()" />
</div>
</div>
<el-scrollbar :style="{height: (getClientHeight - 184) + 'px'}" class="custom-scroll">
<el-scrollbar :style="{height: (getMainContextHeight - 94) + 'px'}" class="custom-scroll">
<el-tree ref="moduleTree" :data="getModuleTreeData" :props="{label: 'moduleName'}"
node-key="moduleId" @node-click="onModuleNodeClick" :default-expanded-keys="formPerm.expandedModule"
:highlight-current="true" @node-expand="onModuleNodeExpand" @node-collapse="onModuleNodeCollapse">
@@ -49,7 +49,7 @@
<el-row>
<el-col :span="24">
<el-table :data="formPerm.SysPerm.impl.dataList" size="mini" @sort-change="formPerm.SysPerm.impl.onSortChange"
header-cell-class-name="table-header-gray" :height="(getClientHeight - 222) + 'px'">
header-cell-class-name="table-header-gray" :height="(getMainContextHeight - 132) + 'px'">
<el-table-column label="序号" header-align="center" align="center" type="index" width="50px" :index="formPerm.SysPerm.impl.getTableIndex" />
<el-table-column label="权限名称" prop="permName" width="150px">
</el-table-column>
@@ -344,7 +344,7 @@ export default {
}];
return tempList.concat(this.formPerm.permModuleId.impl.dropdownList);
},
...mapGetters(['getClientHeight'])
...mapGetters(['getMainContextHeight'])
},
created () {
this.formInit();