代码调整

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'
});
}
/** 查看当前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: '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: [
// 实训类型
{ enlabel: 'single operation', label: '单操', value: 'SINGLE' },
@ -294,7 +307,7 @@ export default {
{ label: '自动闭塞', value: 'StationDirectionAuto' },
{ label: '半自动闭塞', value: 'StationDirectionSemi' }
],
paperStateArr: ['正在编辑', '封存', '已使用'], //试卷定义状态
paperStateQueryArr: ['所有', '正在编辑', '可生成试卷', '封存', '已被使用'], //试卷定义查询状态
paperStateArr: ['正在编辑', '封存', '已使用'], // 试卷定义状态
paperStateQueryArr: ['所有', '正在编辑', '可生成试卷', '封存', '已被使用'] // 试卷定义查询状态
}
};

View File

@ -14,7 +14,6 @@ export default {
},
data() {
return {
PermissionTypeList: [],
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
@ -81,14 +80,6 @@ export default {
},
methods: {
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 = [];
getPublishMapListOnline().then(res => {

View File

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

View File

@ -1,7 +1,7 @@
<template>
<div>
<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>
</template>
@ -35,11 +35,6 @@ export default {
},
data() {
return {
permissionTypeList: [
{label: '项目', value: 0},
{label: '线路', value: 1},
{label: '线路功能', value: 2}
],
mapList: [],
abilityList: [],
pagerConfig: {
@ -103,7 +98,7 @@ export default {
title: this.$t('orderAuthor.permissionType'),
prop: 'permissionType',
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 ''; }
},
{
@ -183,7 +178,7 @@ export default {
},
methods: {
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;
//
queryMapListByUser().then(res => {

View File

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

View File

@ -1,7 +1,7 @@
<template>
<div>
<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>
</template>
@ -16,16 +16,7 @@ export default {
},
data() {
return {
PermissionTypeList: [],
belongForm: {},
EffectiveTypeList: [
{ value: '1', label: '有效'},
{ value: '2', label: '无效'}
],
subTypeList: [
{ value: 'user', label: '个人'},
{ value: 'org', label: '组织'}
],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -78,7 +69,7 @@ export default {
prop: 'subjectType',
width: '80',
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 ''; }
},
{
@ -127,7 +118,7 @@ export default {
prop: 'status',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'EffectiveTypeList'); },
tagType: (row) => {
switch (row.status) {
case '1': return 'success';
@ -172,10 +163,10 @@ export default {
return arr;
},
loadInitData() {
this.EffectiveTypeList.forEach(elem => {
this.$ConstSelect.EffectiveTypeList.forEach(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);
});
},

View File

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