地图分组管理

This commit is contained in:
fan 2021-04-12 18:09:49 +08:00
parent 904d84e8ab
commit 8d5de4cc1a
6 changed files with 303 additions and 2 deletions

33
src/api/mapGroup.js Normal file
View File

@ -0,0 +1,33 @@
import request from '@/utils/request';
/** 创建分组 */
export function createMapGroup(data) {
return request({
url: `/api/mapGroup`,
method: 'post',
data
});
}
/** 修改分组 */
export function updateMapGroup(data) {
return request({
url: `/api/mapGroup/${data.groupId}`,
method: 'put',
data
});
}
/** 删除分组 */
export function deleteMapGroup(groupId) {
return request({
url: `/api/mapGroup/${groupId}`,
method: 'delete'
});
}
/** 分页查询地图分组 */
export function queryMapGroupPaging(params) {
return request({
url: `/api/mapGroup/page`,
method: 'get',
params
});
}

View File

@ -90,5 +90,6 @@ export default {
boardManage: 'Message Board Manage',
publishIBPManage:'publish IBP Manage',
publishISCSManage:'publish ISCS Manage',
voiceTraining: 'Voice Training'
voiceTraining: 'Voice Training',
mapGroup: 'Map Group'
};

View File

@ -95,5 +95,6 @@ export default {
boardManage: '留言板管理',
publishIBPManage:'发布IBP盘管理',
publishISCSManage:'发布ISCS管理',
voiceTraining: '语音训练'
voiceTraining: '语音训练',
mapGroup: '地图分组'
};

View File

@ -162,6 +162,7 @@ const InfoLessonDetail = () => import('@/views/organization/lessonManage/lessonD
const RunPlanViewWindow = () => import('@/views/newMap/displayNew/demon/runPlanViewWindow');
const SecondaryHome = () => import('@/views/trainingPlatform/secondaryHome');
const Demo = () => import('@/views/demo');
const MapGroup = () => import('@/views/publish/mapGroup/index');
const DemoTraining = () => import('@/views/newMap/displayNew/demoTraining');
const OrgDetail = () => import('@/views/system/companyManage/orgDetail');
const VoiceTraining = () => import('@/views/system/voiceTraining/index');
@ -853,6 +854,13 @@ export const asyncRouter = [
meta: {
i18n: 'router.publishISCSManage'
}
},
{
path: 'mapGroup',
component: MapGroup,
meta: {
i18n: 'router.mapGroup'
}
}
]
},

View File

@ -0,0 +1,112 @@
<template>
<div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { createMapGroup, updateMapGroup } from '@/api/mapGroup';
export default {
name: 'Edit',
props: {
mapList: {
type: Array,
default: () => {
return [];
}
}
},
data() {
return {
dialogVisible:false,
isEdit: false,
typeList: [{ label: '数据', value: 'DATA' }, { label: '运行线', value: 'RUNPLAN' }],
formModel: {
id: '',
name: '',
type: '',
mapIds: []
}
};
},
computed: {
title() {
return this.isEdit ? '修改分组' : '创建分组';
},
form() {
const form = {
labelWidth: '150px',
items: [
{ prop: 'name', label: '分组名称', type: 'text', required: true},
{ prop: 'type', label: '分组类型', type: 'select', required: true, options:this.typeList },
{ prop: 'mapIds', label: '归属地图', type: 'select', multiple: true, options: this.mapList, optionLabel: 'name', optionValue: 'id' }
]
};
return form;
},
rules() {
const crules = {
name:[
{ required: true, message: '请输入分组名称', trigger: 'blur', max:100 }
],
type:[
{ required: true, message: '请选择分组类型', trigger: 'change' }
],
mapIds:[
{ required: true, message: '请选择归属地图', trigger: 'change' }
]
};
return crules;
}
},
methods: {
doShow(row) {
this.dialogVisible = true;
if (row) {
this.isEdit = true;
this.formModel.id = row.id;
this.formModel.name = row.name;
this.formModel.type = row.type;
this.formModel.mapIds = [...row.mapIds];
} else {
this.isEdit = false;
this.$nextTick(() => {
this.$refs.dataform.resetForm();
});
}
},
doCreate() {
const _that = this;
this.$refs.dataform.validateForm(() => {
if (_that.isEdit) {
updateMapGroup(_that.formModel).then(resp => {
_that.$message.success('修改成功!');
}).catch(error => {
_that.$message.error('修改失败:' + error.message);
});
} else {
createMapGroup(_that.formModel).then(resp => {
_that.$message.success('创建成功!');
}).catch(error => {
_that.$message.error('创建失败:' + error.message);
});
}
});
},
doClose() {
this.dialogVisible = false;
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,146 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-group ref="editGroup" :map-list="mapList" @refresh="refresh" />
</div>
</template>
<script>
import { getPublishMapListOnline } from '@/api/jmap/map';
import { queryMapGroupPaging, deleteMapGroup } from '@/api/mapGroup';
import EditGroup from './editGroup';
export default {
name: 'Index',
components:{
EditGroup
},
data() {
return {
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
name: {
type: 'text',
label: '分组名称'
},
type: {
type: 'select',
label: '分组类型',
config: {
data: [
{label: '数据', value: 'DATA'},
{label: '运行图', value: 'RUNPLAN'}
]
}
}
}
},
queryList: {
query: queryMapGroupPaging,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '分组名称',
prop: 'name'
},
{
title: '分组类型',
prop: 'type',
type: 'tag',
columnValue: (row) => {
if (row.type === 'DATA') {
return '数据';
} else if (row.type === 'RUNPLAN') {
return '运行线';
} else {
return '';
}
},
tagType: (row) => { return 'success'; }
},
{
title: '归属地图',
prop: 'mapIds',
type: 'tagMore',
columnValue: (row) => { return this.$convertField(row.mapIds, this.$ConstSelect.roleList, ['value', 'label'], true); },
tagType: (row) => { return 'success'; }
},
// {
// title: '',
// prop: 'createTime'
// },
{
type: 'button',
title: this.$t('global.operate'),
width: '300',
buttons: [
{
name: '编辑',
handleClick: this.handleCopy
},
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: this.$t('global.add'), handler: this.handleAdd }
]
}
};
},
mounted() {
this.loadInitData();
},
methods: {
loadInitData() {
getPublishMapListOnline().then(resp => {
this.mapList = resp.data;
}).catch(e => {
console.error(e);
this.$message.error('获取地图数据列表失败!');
});
},
refresh() {
this.$refs.queryListPage.refresh(true);
},
handleAdd() {
this.$refs.editGroup.doShow();
},
handleEdit(index, row) {
this.$refs.editGroup.doShow(row);
},
handleDelete(index, row) {
const _that = this;
this.$confirm('是否确认删除分组《' + row.name + '》 ' + ' ', this.$t('tip.hint'), {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteMapGroup(row.id).then(response => {
_that.refresh();
_that.$message.success(this.$t('map.successfullyDelete'));
}).catch(error => {
_that.$message.error(this.$t('map.failDelete') + error.message);
});
}).catch(() => {});
}
}
};
</script>
<style scoped>
</style>