代码调整

This commit is contained in:
dong 2022-11-01 14:02:40 +08:00
parent 88aec8f6dd
commit 002a2fddd2
8 changed files with 101 additions and 69 deletions

View File

@ -25,3 +25,11 @@ export function getPermissonInDistribute(subjectId) {
method: 'get' method: 'get'
}); });
} }
/** 查看当前mapId 下用户的所有权限及功能*/
export function getMapIdPermisson(mapId) {
return request({
url: `/api/v2/permission/subject/permission/${mapId}`,
method: 'get'
});
}

View File

@ -257,6 +257,19 @@ export default {
{ label: 'SF', value: 'SF' }, { label: 'SF', value: 'SF' },
{ label: 'SD', value: 'SD' } { label: 'SD', value: 'SD' }
], ],
permissionTypeList: [ // 权限类型
{label: '项目', value: 0},
{label: '线路', value: 1},
{label: '线路功能', value: 2}
],
EffectiveTypeList: [ // 有效类型
{ value: '1', label: '有效'},
{ value: '2', label: '无效'}
],
subTypeList: [ // 主体类型
{ value: 'user', label: '个人'},
{ value: 'org', label: '组织'}
],
trainingType: [ trainingType: [
// 实训类型 // 实训类型
{ enlabel: 'single operation', label: '单操', value: 'SINGLE' }, { enlabel: 'single operation', label: '单操', value: 'SINGLE' },
@ -294,7 +307,7 @@ export default {
{ label: '自动闭塞', value: 'StationDirectionAuto' }, { label: '自动闭塞', value: 'StationDirectionAuto' },
{ label: '半自动闭塞', value: 'StationDirectionSemi' } { label: '半自动闭塞', value: 'StationDirectionSemi' }
], ],
paperStateArr: ['正在编辑', '封存', '已使用'], //试卷定义状态 paperStateArr: ['正在编辑', '封存', '已使用'], // 试卷定义状态
paperStateQueryArr: ['所有', '正在编辑', '可生成试卷', '封存', '已被使用'], //试卷定义查询状态 paperStateQueryArr: ['所有', '正在编辑', '可生成试卷', '封存', '已被使用'] // 试卷定义查询状态
} }
}; };

View File

@ -14,7 +14,6 @@ export default {
}, },
data() { data() {
return { return {
PermissionTypeList: [],
mapList: [], mapList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
@ -81,14 +80,6 @@ export default {
}, },
methods: { methods: {
loadInitData() { loadInitData() {
// this.$Dictionary.permissionType().then(list => {
// list.forEach(elem => {
// this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name });
// });
// this.$convertList(list, this.PermissionTypeList, elem => {
// return true;
// });
// });
// //
this.mapList = []; this.mapList = [];
getPublishMapListOnline().then(res => { getPublishMapListOnline().then(res => {

View File

@ -67,10 +67,6 @@ export default {
required:true, required:true,
type:Array type:Array
}, },
permissionTypeList: {
required:true,
type:Array
},
mapList: { mapList: {
required:true, required:true,
type:Array type:Array
@ -128,6 +124,9 @@ export default {
return this.abilityList.filter(item => { return this.abilityList.filter(item => {
return item.mapName == this.mapName; return item.mapName == this.mapName;
}); });
},
permissionTypeList() {
return this.$ConstSelect.permissionTypeList;
} }
}, },
methods: { methods: {

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<create ref="create" :ability-list="abilityList" :permission-type-list="permissionTypeList" :map-list="mapList" :project-list="projectList" @refresh="reloadTable" /> <create ref="create" :ability-list="abilityList" :map-list="mapList" :project-list="projectList" @refresh="reloadTable" />
</div> </div>
</template> </template>
@ -35,11 +35,6 @@ export default {
}, },
data() { data() {
return { return {
permissionTypeList: [
{label: '项目', value: 0},
{label: '线路', value: 1},
{label: '线路功能', value: 2}
],
mapList: [], mapList: [],
abilityList: [], abilityList: [],
pagerConfig: { pagerConfig: {
@ -103,7 +98,7 @@ export default {
title: this.$t('orderAuthor.permissionType'), title: this.$t('orderAuthor.permissionType'),
prop: 'permissionType', prop: 'permissionType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$convertField(row.permissionType, this.permissionTypeList, ['value', 'label']); }, columnValue: (row) => { return this.$ConstSelect.translate(row.permissionType, 'permissionTypeList'); },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{ {
@ -183,7 +178,7 @@ export default {
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.queryForm.queryObject.permissionType.config.data = this.permissionTypeList; this.queryForm.queryObject.permissionType.config.data = this.$ConstSelect.permissionTypeList;
this.queryForm.queryObject.projectCode.config.data = ProjectList; this.queryForm.queryObject.projectCode.config.data = ProjectList;
// //
queryMapListByUser().then(res => { queryMapListByUser().then(res => {

View File

@ -21,7 +21,7 @@
</template> </template>
<script> <script>
import { listUserPermision } from '@/api/management/author'; import { getMapIdPermisson } from '@/api/userRulesManage';
import { queryMapFunctionList } from '@/api/trainingPlatform'; import { queryMapFunctionList } from '@/api/trainingPlatform';
import { superAdmin, admin } from '@/router/index'; import { superAdmin, admin } from '@/router/index';
import selectRole from './selectRole/list'; import selectRole from './selectRole/list';
@ -48,13 +48,14 @@ export default {
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
show: false,
labelWidth: '140px', labelWidth: '140px',
reset: true, reset: true,
leftSpan: 18, leftSpan: 18,
queryObject: { queryObject: {
'canDistribute': { 'subjectType': {
type: 'select', type: 'select',
label: this.$t('permission.permissionUseType'), label: '主体类型',
config: { config: {
data: [] data: []
} }
@ -65,22 +66,43 @@ export default {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
paginationHiden: true,
columns: [ columns: [
{ {
title: this.$t('permission.permissionName'), title: this.$t('permission.permissionName'),
width: '210',
prop: 'permissionName' prop: 'permissionName'
}, },
{ {
title: this.$t('permission.permissionUseType'), title: '权限类型',
prop: 'canDistribute', prop: 'permissionType',
width: '80',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => { return this.$ConstSelect.translate(row.permissionType, 'permissionTypeList'); },
const type = LangStorage.getLang() == 'en' ? 'PermissionUseListEn' : 'PermissionUseList'; tagType: (row) => { return ''; }
return this.$ConstSelect.translate(row.canDistribute, type);
}, },
{
title: '主体类型',
prop: 'subjectType',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.subjectType, 'subTypeList'); },
tagType: (row) => { return ''; }
},
{
title: '功能',
prop: 'systemAbilityList',
type: 'tagMore',
columnValue: (row) => { return this.getAbilityList(row.systemAbilityList); },
tagType: (row) => { return ''; }
},
{
title: this.$t('permission.isForever'),
width: '80',
prop: 'forever',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.forever, 'Whether'); },
tagType: (row) => { tagType: (row) => {
switch (row.canDistribute) { switch (row.forever) {
case true: return 'success'; case true: return 'success';
case false: return 'danger'; case false: return 'danger';
} }
@ -88,28 +110,42 @@ export default {
}, },
{ {
title: this.$t('permission.permissionTotal'), title: this.$t('permission.permissionTotal'),
width: '80',
prop: 'amount' prop: 'amount'
}, },
{ {
title: this.$t('permission.permissionRemains'), title: this.$t('permission.permissionRemains'),
width: '80',
prop: 'remains' prop: 'remains'
}, },
{ {
title: this.$t('permission.startTime'), title:this.$t('global.startTime'),
prop: 'startTime', prop: 'startTime',
type: 'formatter', width: '160'
formatter: this.formatterDate
}, },
{ {
title: this.$t('permission.endTime'), title: this.$t('permission.endTime'),
prop: 'endTime', prop: 'endTime',
type: 'formatter', width: '160'
formatter: this.formatterDate },
{
title: this.$t('permission.permissionStatus'),
prop: 'status',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'EffectiveTypeList'); },
tagType: (row) => {
switch (row.status) {
case '1': return 'success';
default: return 'danger';
}
}
}, },
{ {
title: this.$t('permission.belonger'), title: this.$t('permission.belonger'),
prop: 'ownerName', prop: 'named',
width: '80',
isShow: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0 || this.$store.state.user.roles.indexOf(admin) > 0; } isShow: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0 || this.$store.state.user.roles.indexOf(admin) > 0; }
}, },
{ {
@ -145,6 +181,13 @@ export default {
this.initMapSystem(); this.initMapSystem();
}, },
methods: { methods: {
getAbilityList(list) {
const arr = [];
list && list.forEach(item => {
arr.push(item.abilityName);
});
return arr;
},
handleRoleVest(index, row) { handleRoleVest(index, row) {
this.$refs.selectRole.doShow(row.id); this.$refs.selectRole.doShow(row.id);
}, },
@ -157,16 +200,16 @@ export default {
}); });
}, },
loadInitData() { loadInitData() {
this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList; this.queryForm.queryObject.subjectType.config.data = this.$ConstSelect.subTypeList;
}, },
formatterDate(row, porpInfo) { formatterDate(row, porpInfo) {
return row[porpInfo.property] ? row[porpInfo.property] : this.$t('global.perpetual'); return row[porpInfo.property] ? row[porpInfo.property] : this.$t('global.perpetual');
}, },
queryFunction(params) { queryFunction(params) {
if (this.$route.params.mapId) { // if (this.$route.params.mapId) {
params.mapId = this.$route.params.mapId; // params.mapId = this.$route.params.mapId;
} // }
return listUserPermision(params); return getMapIdPermisson(this.$route.params.mapId);
}, },
reloadTable() { reloadTable() {
if (this.queryList && this.queryList.reload) { if (this.queryList && this.queryList.reload) {

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<PermissionList ref="list" :effective-type-list="EffectiveTypeList" :sub-type-list="subTypeList" /> <PermissionList ref="list" />
</div> </div>
</template> </template>
@ -16,16 +16,7 @@ export default {
}, },
data() { data() {
return { return {
PermissionTypeList: [],
belongForm: {}, belongForm: {},
EffectiveTypeList: [
{ value: '1', label: '有效'},
{ value: '2', label: '无效'}
],
subTypeList: [
{ value: 'user', label: '个人'},
{ value: 'org', label: '组织'}
],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
@ -78,7 +69,7 @@ export default {
prop: 'subjectType', prop: 'subjectType',
width: '80', width: '80',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$convertField(row.subjectType, this.subTypeList, ['value', 'label']); }, columnValue: (row) => { return this.$ConstSelect.translate(row.subjectType, 'subTypeList'); },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{ {
@ -127,7 +118,7 @@ export default {
prop: 'status', prop: 'status',
width: '80', width: '80',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); }, columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'EffectiveTypeList'); },
tagType: (row) => { tagType: (row) => {
switch (row.status) { switch (row.status) {
case '1': return 'success'; case '1': return 'success';
@ -172,10 +163,10 @@ export default {
return arr; return arr;
}, },
loadInitData() { loadInitData() {
this.EffectiveTypeList.forEach(elem => { this.$ConstSelect.EffectiveTypeList.forEach(elem => {
this.queryForm.queryObject.status.config.data.push(elem); this.queryForm.queryObject.status.config.data.push(elem);
}); });
this.subTypeList.forEach(elem => { this.$ConstSelect.subTypeList.forEach(elem => {
this.queryForm.queryObject.subType.config.data.push(elem); this.queryForm.queryObject.subType.config.data.push(elem);
}); });
}, },

View File

@ -17,14 +17,6 @@ export default {
components: { components: {
}, },
props: { props: {
effectiveTypeList: {
required: true,
type: Array
},
subTypeList:{
required:true,
type:Array
}
}, },
data() { data() {
return { return {
@ -64,7 +56,7 @@ export default {
prop: 'subjectType', prop: 'subjectType',
width: '80', width: '80',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$convertField(row.subjectType, this.subTypeList, ['value', 'label']); }, columnValue: (row) => { return this.$ConstSelect.translate(row.subjectType, 'subTypeList'); },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{ {
@ -113,7 +105,7 @@ export default {
prop: 'status', prop: 'status',
width: '80', width: '80',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); }, columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'EffectiveTypeList'); },
tagType: (row) => { tagType: (row) => {
switch (row.status) { switch (row.status) {
case '1': return 'success'; case '1': return 'success';