desc: 修改权限编辑
This commit is contained in:
parent
8d06b98ba1
commit
7fbadc2bd3
@ -61,6 +61,14 @@ export function setLessonPermisson(data) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 设置权限失效或有效*/
|
||||
export function getPermissionList(id) {
|
||||
return request({
|
||||
url: `/api/permission/${id}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询仿真权限列表
|
||||
*/
|
||||
|
@ -93,44 +93,11 @@ export default {
|
||||
activeName: 'first',
|
||||
SignalLeftOrRightList: [],
|
||||
SignalPotLampTypeList: [],
|
||||
/*
|
||||
{ code: '01', name: '物理点灯' },
|
||||
{ code: '02', name: '逻辑电灯' }
|
||||
*/
|
||||
SignalLampPostTypeList: [],
|
||||
/*
|
||||
{ code: '01', name: '矮柱' },
|
||||
{ code: '02', name: '高柱' }
|
||||
*/
|
||||
SignalLampPositionTypeList: [],
|
||||
/*
|
||||
{ code: '01', name: '单灯' },
|
||||
{ code: '02', name: '双灯' },
|
||||
{ code: '03', name: '三灯' },
|
||||
{ code: '04', name: '四灯' },
|
||||
{ code: '05', name: '五灯' }
|
||||
*/
|
||||
SignalDirectionTypeList: [],
|
||||
/*
|
||||
{ code: '01', name: '向左行使' },
|
||||
{ code: '02', name: '向右行驶' }
|
||||
*/
|
||||
SignalPositionTypeList: [],
|
||||
/*
|
||||
{ code: '01', name: '区段上边' },
|
||||
{ code: '02', name: '区段下边' }
|
||||
*/
|
||||
SignalUseTypeList: [],
|
||||
/*
|
||||
{ code: '01', name: '进站信号机' },
|
||||
{ code: '02', name: '出站信号机' },
|
||||
{ code: '03', name: '通过信号机' },
|
||||
{ code: '04', name: '防护信号机' },
|
||||
{ code: '05', name: '调车信号机' },
|
||||
{ code: '06', name: '阻挡信号机' },
|
||||
{ code: '07', name: '预告信号机' },
|
||||
{ code: '08', name: '复位信号机' }
|
||||
*/
|
||||
failTypes: [
|
||||
{ code: '00', name: this.$t('map.normal') },
|
||||
{ code: '01', name: this.$t('map.signalFilamentAlarm') }
|
||||
@ -145,10 +112,7 @@ export default {
|
||||
potLampType: '01',
|
||||
directionType: '',
|
||||
positionType: '',
|
||||
namePosition: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
namePosition: { x: 0, y: 0 },
|
||||
useType: '',
|
||||
stationCode: '',
|
||||
linkCode: '',
|
||||
@ -156,18 +120,9 @@ export default {
|
||||
rotate: 0,
|
||||
guideShow: false,
|
||||
buttonShow: false,
|
||||
position: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
buttonPosition: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
guidePosition: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
position: { x: 0, y: 0 },
|
||||
buttonPosition: { x: 0, y: 0 },
|
||||
guidePosition: { x: 0, y: 0 }
|
||||
},
|
||||
addModel: {
|
||||
sectionCode: '',
|
||||
@ -207,7 +162,7 @@ export default {
|
||||
return list;
|
||||
},
|
||||
form() {
|
||||
const form = {
|
||||
return {
|
||||
labelWidth: '150px',
|
||||
items: {
|
||||
code: {
|
||||
@ -258,10 +213,9 @@ export default {
|
||||
}
|
||||
}
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const rules = {
|
||||
return {
|
||||
code: [
|
||||
{ required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' }
|
||||
],
|
||||
@ -293,7 +247,6 @@ export default {
|
||||
{ required: true, message: this.$t('rules.signalGuidePositionY'), trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
return rules;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -6,6 +6,7 @@
|
||||
width="90%"
|
||||
:before-close="doClose"
|
||||
:close-on-click-modal="false"
|
||||
:z-index="3000"
|
||||
>
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
</el-dialog>
|
||||
|
@ -1,53 +1,103 @@
|
||||
<template>
|
||||
<el-dialog title="修改权限内容" :visible.sync="dialogShow" width="30%" :before-close="handleClose">
|
||||
<div>
|
||||
<el-form
|
||||
ref="form"
|
||||
label-position="right"
|
||||
:model="editModel"
|
||||
label-width="100px"
|
||||
:rules="editRules"
|
||||
size="mini"
|
||||
@submit.native.prevent
|
||||
>
|
||||
<el-form-item :label="$t('map.mapName')" prop="name">
|
||||
<el-input v-model="editModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="remarks">
|
||||
<el-input
|
||||
v-model="editModel.remarks"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
placeholder="请输入内容"
|
||||
maxlength="60"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="saveAs">{{ $t('map.confirm') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<div>
|
||||
<el-dialog title="修改权限内容" :visible.sync="dialogShow" width="30%" :before-close="handleClose" :z-index="2000">
|
||||
<div>
|
||||
<el-form
|
||||
ref="form"
|
||||
label-position="right"
|
||||
:model="editModel"
|
||||
label-width="100px"
|
||||
:rules="editRules"
|
||||
size="mini"
|
||||
@submit.native.prevent
|
||||
>
|
||||
<el-form-item :label="$t('map.mapName')" prop="name">
|
||||
<el-input v-model="editModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="remarks">
|
||||
<el-input
|
||||
v-model="editModel.remarks"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
placeholder="请输入内容"
|
||||
maxlength="60"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div v-show="isPackage">
|
||||
<div class="form_title">地图名称:</div>
|
||||
<el-select v-model="editModel.mapId" size="mini" :disabled="ruleList.length ? true : false">
|
||||
<el-option
|
||||
v-for="item in mapList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button class="addList" size="small" @click="dialogSelect">添加权限</el-button>
|
||||
<el-table
|
||||
:data="ruleList"
|
||||
border
|
||||
style="width: 100%"
|
||||
:height="200"
|
||||
>
|
||||
<el-table-column prop="name" label="权限名称" />
|
||||
<el-table-column prop="type" :label="this.$t('orderAuthor.permissionType')">
|
||||
<template slot-scope="scope">
|
||||
{{ computedName(PermissionTypeList, scope.row.type) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="this.$t('global.operate')" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="saveAs">{{ $t('map.confirm') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<choose-permission
|
||||
ref="choosePermission"
|
||||
:rule-list="ruleList"
|
||||
:effective-type-list="EffectiveTypeList"
|
||||
:permission-type-list="PermissionTypeList"
|
||||
@addRuleForm="addRuleForm"
|
||||
@deleteForm="deleteForm"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { putPermissonDetail } from '@/api/management/author';
|
||||
import { putPermissonDetail, getPermissionList } from '@/api/management/author';
|
||||
import { listPublishMap } from '@/api/jmap/map';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import ChoosePermission from './choosePermission';
|
||||
|
||||
export default {
|
||||
name: 'MapSaveAs',
|
||||
props: {
|
||||
|
||||
components: {
|
||||
ChoosePermission
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
isPackage: false,
|
||||
mapList: [],
|
||||
ruleList: [],
|
||||
PermissionTypeList: [],
|
||||
EffectiveTypeList: [],
|
||||
editModel: {
|
||||
id: '',
|
||||
name: '',
|
||||
remarks: ''
|
||||
remarks: '',
|
||||
mapId: ''
|
||||
},
|
||||
editRules: {
|
||||
name: [
|
||||
@ -56,23 +106,75 @@ export default {
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
||||
computed: {
|
||||
// height() {
|
||||
// return this.$store.state.app.height - 65;
|
||||
// }
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
doShow(data) {
|
||||
async loadInitData() {
|
||||
this.EffectiveTypeList = [];
|
||||
this.$Dictionary.effectiveType().then(list => {
|
||||
this.EffectiveTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
|
||||
});
|
||||
|
||||
this.PermissionTypeList = [];
|
||||
this.$Dictionary.permissionType().then(list => {
|
||||
this.PermissionTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
|
||||
});
|
||||
|
||||
this.mapList = [];
|
||||
const res = await listPublishMap();
|
||||
if (res.code == 200 && res.data.length) {
|
||||
res.data.forEach(elem => {
|
||||
this.mapList.push({ value: elem.id, label: elem.name });
|
||||
});
|
||||
} else {
|
||||
console.error(res);
|
||||
}
|
||||
},
|
||||
computedName(list, code) {
|
||||
let name = '';
|
||||
list.forEach(elem => {
|
||||
if (elem.value == code) {
|
||||
name = elem.label;
|
||||
}
|
||||
});
|
||||
return name;
|
||||
},
|
||||
dialogSelect(row) {
|
||||
if (this.editModel.mapId) {
|
||||
this.$refs.choosePermission.doShow(this.editModel.mapId);
|
||||
} else {
|
||||
this.$messageBox('请选择地图');
|
||||
}
|
||||
},
|
||||
async doShow(data) {
|
||||
this.dialogShow = true;
|
||||
this.editModel = {
|
||||
id: data.id,
|
||||
name: data.name,
|
||||
remarks: data.remarks
|
||||
remarks: data.remarks,
|
||||
mapId: ''
|
||||
};
|
||||
this.isPackage = data.isPackage;
|
||||
if (this.isPackage) {
|
||||
const res = await getPermissionList(data.id);
|
||||
if (res.code == 200) {
|
||||
this.ruleList = res.data.relPermissions;
|
||||
this.editModel.mapId = res.data.relPermissions[0].mapId;
|
||||
}
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.editModel = {
|
||||
id: '',
|
||||
name: '',
|
||||
remarks: ''
|
||||
remarks: '',
|
||||
mapId: ''
|
||||
};
|
||||
this.dialogShow = false;
|
||||
},
|
||||
@ -81,18 +183,50 @@ export default {
|
||||
},
|
||||
saveAs() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
this.loading = true;
|
||||
putPermissonDetail(this.editModel).then(response => {
|
||||
this.loading = false;
|
||||
this.$message.success('修改成功!');
|
||||
this.$emit('refresh');
|
||||
this.close();
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$messageBox(this.$t('map.saveFailed'));
|
||||
});
|
||||
if (this.ruleList.length) {
|
||||
const arr = this.ruleList.map(nor => {
|
||||
return nor.id;
|
||||
});
|
||||
this.editModel['relPermissions'] = arr;
|
||||
this.loading = true;
|
||||
putPermissonDetail(this.editModel).then(response => {
|
||||
this.loading = false;
|
||||
this.$message.success('修改成功!');
|
||||
this.$emit('refresh');
|
||||
this.close();
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$messageBox(this.$t('map.saveFailed'));
|
||||
});
|
||||
} else {
|
||||
this.$messageBox('请选择多个权限');
|
||||
}
|
||||
});
|
||||
},
|
||||
deleteForm(index, row) {
|
||||
const idx = this.ruleList.findIndex(elem => { return elem.id == row.id; });
|
||||
if (idx >= 0) {
|
||||
row['isPut'] = false;
|
||||
this.ruleList.splice(idx, 1);
|
||||
}
|
||||
EventBus.$emit('reloadTable', { index: index, list: row });
|
||||
},
|
||||
addRuleForm(index, row) {
|
||||
row['isPut'] = true;
|
||||
this.ruleList.push(row);
|
||||
EventBus.$emit('reloadTable', { index: index, list: row });
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.form_title{
|
||||
float: left;
|
||||
width: 90px;
|
||||
margin-right: 10px;
|
||||
line-height: 31px;
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
</style>
|
||||
|
@ -29,8 +29,6 @@
|
||||
style="width: 100%"
|
||||
:height="height-450"
|
||||
>
|
||||
<!-- <el-table-column prop="createTime" label="创建时间" />
|
||||
<el-table-column prop="creatorUserName" label="创建者" /> -->
|
||||
<el-table-column prop="name" label="权限名称" />
|
||||
<el-table-column prop="type" :label="this.$t('orderAuthor.permissionType')">
|
||||
<template slot-scope="scope">
|
||||
|
Loading…
Reference in New Issue
Block a user