|
@@ -24,7 +24,7 @@
|
|
<!-- 权限设置 -->
|
|
<!-- 权限设置 -->
|
|
<scrollCard contentHeight="calc(100vh - 15.5rem)" :colSpan="19">
|
|
<scrollCard contentHeight="calc(100vh - 15.5rem)" :colSpan="19">
|
|
<template #cardHeader>
|
|
<template #cardHeader>
|
|
- <div style="display:flex;justify-content: space-between;">
|
|
|
|
|
|
+ <div style="display: flex; justify-content: space-between">
|
|
<span>角色列表</span>
|
|
<span>角色列表</span>
|
|
<dg-button type="primary" :icon="'保存' | optIcon" @click="handleSave()">保存</dg-button>
|
|
<dg-button type="primary" :icon="'保存' | optIcon" @click="handleSave()">保存</dg-button>
|
|
</div>
|
|
</div>
|
|
@@ -32,27 +32,22 @@
|
|
|
|
|
|
<!-- 角色搜索栏 -->
|
|
<!-- 角色搜索栏 -->
|
|
<search-bar :conditionForm="roleConditionForm" @submitSearch="receiveRoleSearch"></search-bar>
|
|
<search-bar :conditionForm="roleConditionForm" @submitSearch="receiveRoleSearch"></search-bar>
|
|
- <!-- 角色操作栏 -->
|
|
|
|
- <!-- <operate-bar :pageOptList="pageOptList" @submitPageOpt="handleSave()"></operate-bar> -->
|
|
|
|
|
|
|
|
<!-- 角色列表 -->
|
|
<!-- 角色列表 -->
|
|
- <dg-table
|
|
|
|
|
|
+ <new-table
|
|
ref="table"
|
|
ref="table"
|
|
:condition="condition"
|
|
:condition="condition"
|
|
- :url="tableUrl"
|
|
|
|
- :span-method="objectSpanMethod"
|
|
|
|
- border
|
|
|
|
- style="width: 100%"
|
|
|
|
|
|
+ :tableUrl="tableUrl"
|
|
|
|
+ rowSpanKey="appId"
|
|
row-key="roleId"
|
|
row-key="roleId"
|
|
- overflow="tooltip"
|
|
|
|
- lazyLoad
|
|
|
|
@selection-change="handleSelectChange"
|
|
@selection-change="handleSelectChange"
|
|
- :before-quest="handleBeforeQuest"
|
|
|
|
|
|
+ :defaultSelectRows="checkRoleList"
|
|
|
|
+ lazyLoad
|
|
>
|
|
>
|
|
<dg-table-column prop="appName" label="应用系统名称" min-width="120" align="center"> </dg-table-column>
|
|
<dg-table-column prop="appName" label="应用系统名称" min-width="120" align="center"> </dg-table-column>
|
|
<dg-table-column type="selection" reserve-selection width="50" align="center"></dg-table-column>
|
|
<dg-table-column type="selection" reserve-selection width="50" align="center"></dg-table-column>
|
|
<dg-table-column prop="roleName" label="角色名称" align="center"> </dg-table-column>
|
|
<dg-table-column prop="roleName" label="角色名称" align="center"> </dg-table-column>
|
|
- </dg-table>
|
|
|
|
|
|
+ </new-table>
|
|
</scrollCard>
|
|
</scrollCard>
|
|
</dg-row>
|
|
</dg-row>
|
|
</div>
|
|
</div>
|
|
@@ -62,7 +57,7 @@
|
|
import orgTree from '@/components/tree';
|
|
import orgTree from '@/components/tree';
|
|
import scrollCard from '@/components/scroll-card';
|
|
import scrollCard from '@/components/scroll-card';
|
|
import searchBar from '@/components/search-bar';
|
|
import searchBar from '@/components/search-bar';
|
|
-
|
|
|
|
|
|
+import newTable from '@/components/new-table';
|
|
import * as roleAuthApi from '@/api/role-auth-info';
|
|
import * as roleAuthApi from '@/api/role-auth-info';
|
|
import * as Api from '@/api/org-role-manage';
|
|
import * as Api from '@/api/org-role-manage';
|
|
export default {
|
|
export default {
|
|
@@ -70,6 +65,7 @@ export default {
|
|
orgTree,
|
|
orgTree,
|
|
scrollCard,
|
|
scrollCard,
|
|
searchBar,
|
|
searchBar,
|
|
|
|
+ newTable
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -96,10 +92,6 @@ export default {
|
|
}
|
|
}
|
|
],
|
|
],
|
|
condition: {
|
|
condition: {
|
|
- orgId: {
|
|
|
|
- value: '',
|
|
|
|
- op: '='
|
|
|
|
- },
|
|
|
|
appId: {
|
|
appId: {
|
|
value: '',
|
|
value: '',
|
|
op: '='
|
|
op: '='
|
|
@@ -109,6 +101,7 @@ export default {
|
|
op: 'like'
|
|
op: 'like'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ orgId: "",
|
|
tableUrl: Api.tableUrl,
|
|
tableUrl: Api.tableUrl,
|
|
pageOptList: ['保存'],
|
|
pageOptList: ['保存'],
|
|
checkRoleList: [],
|
|
checkRoleList: [],
|
|
@@ -123,81 +116,24 @@ export default {
|
|
* @param {*} node
|
|
* @param {*} node
|
|
*/
|
|
*/
|
|
async handleGetNode(node) {
|
|
async handleGetNode(node) {
|
|
- this.condition.orgId.value = node.id;
|
|
|
|
|
|
+ this.orgId = node.id;
|
|
this.refreshTable();
|
|
this.refreshTable();
|
|
},
|
|
},
|
|
async refreshTable() {
|
|
async refreshTable() {
|
|
- this.$refs.table.clearAll();
|
|
|
|
- await this.getRoleChecked(this.condition.orgId.value);
|
|
|
|
|
|
+ this.$refs.table.handleClearSelection();
|
|
|
|
+ await this.getRoleChecked(this.orgId);
|
|
this.selectRoleList = [];
|
|
this.selectRoleList = [];
|
|
- this.$refs.table.searchForm();
|
|
|
|
|
|
+ this.$refs.table.handleSearch();
|
|
},
|
|
},
|
|
receiveRoleSearch(condition) {
|
|
receiveRoleSearch(condition) {
|
|
this.condition = { ...this.condition, ...condition };
|
|
this.condition = { ...this.condition, ...condition };
|
|
this.refreshTable();
|
|
this.refreshTable();
|
|
},
|
|
},
|
|
- objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
|
- if (columnIndex === 0) {
|
|
|
|
- return {
|
|
|
|
- rowspan: row.rowspan,
|
|
|
|
- colspan: 1
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+
|
|
handleSelectChange(selection) {
|
|
handleSelectChange(selection) {
|
|
this.selectRoleList = this.$lodash.cloneDeep(selection);
|
|
this.selectRoleList = this.$lodash.cloneDeep(selection);
|
|
},
|
|
},
|
|
- // 角色列表数据渲染前整合数据
|
|
|
|
- handleBeforeQuest(res) {
|
|
|
|
- const { content, totalElements } = res.data;
|
|
|
|
- this.currentPageContent = content;
|
|
|
|
- if (this.checkRoleList.length > 0) {
|
|
|
|
- let rowKeys = [];
|
|
|
|
- for (let j = 0; j < content.length; j++) {
|
|
|
|
- const cItem = content[j];
|
|
|
|
- const index = this.checkRoleList.findIndex((item) => item == cItem.roleId);
|
|
|
|
- if (index > -1) {
|
|
|
|
- rowKeys.push(this.checkRoleList[index]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.$refs.table.setCheck(rowKeys);
|
|
|
|
- }, 500);
|
|
|
|
- }
|
|
|
|
- this.roleTotal = totalElements;
|
|
|
|
|
|
|
|
- const result = {
|
|
|
|
- data: {
|
|
|
|
- content: this.setRowSpans(content),
|
|
|
|
- totalElements
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- return result;
|
|
|
|
- },
|
|
|
|
- setRowSpans(tableData) {
|
|
|
|
- // 先给所有的数据都加一个v.rowspan = 1
|
|
|
|
- tableData.forEach((v) => {
|
|
|
|
- v.rowspan = 1;
|
|
|
|
- });
|
|
|
|
- // 双层循环
|
|
|
|
- for (let i = 0; i < tableData.length; i++) {
|
|
|
|
- // 内层循环,上面已经给所有的行都加了v.rowspan = 1
|
|
|
|
- // 这里进行判断
|
|
|
|
- // 如果当前行的id和下一行的id相等
|
|
|
|
- // 就把当前v.rowspan + 1
|
|
|
|
- // 下一行的v.rowspan - 1
|
|
|
|
- for (let j = i + 1; j < tableData.length; j++) {
|
|
|
|
- //此处可根据相同字段进行合并,此处是根据的id
|
|
|
|
- if (tableData[i].appId === tableData[j].appId) {
|
|
|
|
- tableData[i].rowspan++;
|
|
|
|
- tableData[j].rowspan--;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 这里跳过已经重复的数据
|
|
|
|
- i = i + tableData[i].rowspan - 1;
|
|
|
|
- }
|
|
|
|
- return tableData;
|
|
|
|
- },
|
|
|
|
handleSave() {
|
|
handleSave() {
|
|
if (this.roleTotal == 0) {
|
|
if (this.roleTotal == 0) {
|
|
this.$message.warning('没有可保存的数据!');
|
|
this.$message.warning('没有可保存的数据!');
|
|
@@ -213,7 +149,7 @@ export default {
|
|
.map((item) => item.roleId);
|
|
.map((item) => item.roleId);
|
|
|
|
|
|
const saveParams = {
|
|
const saveParams = {
|
|
- orgId: this.condition.orgId.value,
|
|
|
|
|
|
+ orgId: this.orgId,
|
|
addRoleIds,
|
|
addRoleIds,
|
|
delRoleIds
|
|
delRoleIds
|
|
};
|
|
};
|