2019-09-25 14:52:21 +08:00
|
|
|
<template>
|
2019-10-28 17:51:59 +08:00
|
|
|
<div v-loading="loading" class="joylink-card map-list-main">
|
|
|
|
<div class="clearfix">
|
|
|
|
<span>{{ $t('map.publishedMapList') }}</span>
|
|
|
|
</div>
|
2019-11-07 18:46:17 +08:00
|
|
|
<div class="text_item">
|
2020-01-14 16:19:36 +08:00
|
|
|
<filter-city v-if="project==='design'" ref="filerCity" filter-empty :query-function="queryFunction" :local-param-name="localParamName" @filterSelectChange="refresh" />
|
|
|
|
<el-input v-if="project==='design'" v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
|
2019-11-07 18:46:17 +08:00
|
|
|
<div class="tree_mian_box">
|
2019-10-28 17:51:59 +08:00
|
|
|
<el-tree ref="tree" class="tree_box" :data="treeList" node-key="id" :props="defaultProps" highlight-current :span="22" :filter-node-method="filterNode" @node-click="clickEvent">
|
2019-10-28 11:07:33 +08:00
|
|
|
<span slot-scope="{ node:tnode, data }">
|
|
|
|
<span class="el-icon-tickets" :style="{color: data.valid ? 'green':''}" />
|
|
|
|
<span> {{ tnode.label }}</span>
|
2019-10-18 17:15:04 +08:00
|
|
|
</span>
|
|
|
|
</el-tree>
|
2019-10-28 17:51:59 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-10-18 17:15:04 +08:00
|
|
|
</div>
|
2019-09-25 14:52:21 +08:00
|
|
|
</template>
|
|
|
|
<script>
|
2019-10-29 14:14:14 +08:00
|
|
|
import { listPublishMap, getMapListByProjectCode } from '@/api/jmap/map';
|
2019-10-18 17:15:04 +08:00
|
|
|
import { UrlConfig } from '@/router/index';
|
2019-10-24 18:11:58 +08:00
|
|
|
import { superAdmin, admin } from '@/router';
|
2019-10-18 17:15:04 +08:00
|
|
|
import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth';
|
|
|
|
import FilterCity from '@/views/components/filterCity';
|
|
|
|
import localStore from 'storejs';
|
2019-10-29 14:14:14 +08:00
|
|
|
import { ProjectCode } from '@/scripts/ConstDic';
|
2019-09-25 14:52:21 +08:00
|
|
|
|
2019-10-18 17:15:04 +08:00
|
|
|
export default {
|
2019-10-29 14:41:47 +08:00
|
|
|
name: 'PublicMapList',
|
|
|
|
components: {
|
|
|
|
FilterCity
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
width: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
loading: true,
|
|
|
|
defaultShowKeys: [],
|
|
|
|
queryFunction: listPublishMap,
|
|
|
|
filterText: '',
|
|
|
|
treeData: [],
|
|
|
|
treeList: [],
|
|
|
|
selected: {},
|
|
|
|
defaultProps: {
|
|
|
|
children: 'children',
|
|
|
|
label: 'name'
|
|
|
|
},
|
|
|
|
node: {
|
|
|
|
},
|
|
|
|
localParamName: 'publish_cityCode'
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
project() {
|
|
|
|
return getSessionStorage('project');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
filterText(val) {
|
|
|
|
this.treeList = this.treeData.filter((res) => {
|
|
|
|
return res.name.includes(val);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeDestroy () {
|
|
|
|
removeSessionStorage('demonList');
|
|
|
|
},
|
|
|
|
mounted() {
|
2019-12-30 18:06:40 +08:00
|
|
|
if (this.project === 'designxty' || this.project === 'designgzb') {
|
2019-10-29 14:41:47 +08:00
|
|
|
this.refresh();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
filterNode(value, data) {
|
|
|
|
if (!value) return true;
|
|
|
|
return data.name.indexOf(value) !== -1;
|
|
|
|
},
|
|
|
|
showContextMenu(e, obj, node, vueElem) {
|
|
|
|
if (obj) {
|
|
|
|
this.node = node;
|
|
|
|
this.selected = obj;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
clickEvent(obj, data, ele) {
|
|
|
|
switch (obj.type) {
|
|
|
|
case 'scriptDesign': {
|
|
|
|
setSessionStorage('designType', 'scriptDesign');
|
2019-11-12 13:39:52 +08:00
|
|
|
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}?lineCode=${obj.lineCode}` });
|
2019-10-29 14:41:47 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'lessonDesign': {
|
|
|
|
setSessionStorage('designType', 'lessonDesign');
|
2019-10-31 13:56:42 +08:00
|
|
|
this.$router.push({ path: `${UrlConfig.design.lessonHome}/${obj.mapId}`, query: {cityCode: obj.cityCode} });
|
2019-10-29 14:41:47 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'runPlanDesign': {
|
|
|
|
setSessionStorage('designType', 'runPlanDesign');
|
2019-11-08 14:35:58 +08:00
|
|
|
this.$router.push({ path: `${UrlConfig.design.runPlan}/${obj.mapId}?lineCode=${obj.lineCode}` });
|
2019-10-29 14:41:47 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'map': {
|
|
|
|
setSessionStorage('demonList', obj.id);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'mapPreview': {
|
2019-12-23 10:36:32 +08:00
|
|
|
if (obj.drawWay) {
|
|
|
|
this.$router.push({ path: `${UrlConfig.design.mapPreviewNew}/${obj.mapId}` });
|
|
|
|
} else {
|
|
|
|
this.$router.push({ path: `${UrlConfig.design.mapPreview}/${obj.mapId}` });
|
|
|
|
}
|
2019-10-29 14:41:47 +08:00
|
|
|
break;
|
|
|
|
}
|
2020-03-13 18:19:04 +08:00
|
|
|
case 'ibpDesign': {
|
|
|
|
setSessionStorage('designType', 'ibpDesign');
|
|
|
|
this.$router.push({ path: `${UrlConfig.design.ibpHome}/${obj.mapId}`, query: {cityCode: obj.cityCode} });
|
|
|
|
break;
|
|
|
|
}
|
2019-10-29 14:41:47 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
async refresh(filterSelect) {
|
|
|
|
this.loading = true;
|
|
|
|
this.treeData = this.treeList = [];
|
2019-11-14 17:03:44 +08:00
|
|
|
const that = this;
|
2019-10-29 14:41:47 +08:00
|
|
|
try {
|
|
|
|
let res = '';
|
2019-12-30 18:06:40 +08:00
|
|
|
if (this.project === 'designxty' || this.project === 'designgzb') {
|
2019-10-29 14:41:47 +08:00
|
|
|
res = await getMapListByProjectCode(ProjectCode[this.project]);
|
|
|
|
} else {
|
|
|
|
res = await listPublishMap({cityCode: filterSelect});
|
|
|
|
}
|
|
|
|
res.data && res.data.forEach(elem=>{
|
|
|
|
elem.children = [
|
|
|
|
{
|
|
|
|
id: '1',
|
|
|
|
name: this.$t('designPlatform.mapPreview'),
|
|
|
|
type: 'mapPreview',
|
|
|
|
mapId: elem.id,
|
2019-12-23 10:36:32 +08:00
|
|
|
cityCode: elem.cityCode,
|
|
|
|
drawWay: elem.drawWay
|
2019-10-29 14:41:47 +08:00
|
|
|
}
|
|
|
|
];
|
2019-11-06 10:42:53 +08:00
|
|
|
this.isAdministrator() ? elem.children.push({id: '2', name: this.$t('designPlatform.lessonDesign'), type: 'lessonDesign', mapId: elem.id, cityCode: elem.cityCode}) : '';
|
2019-10-29 14:41:47 +08:00
|
|
|
elem.children.push(
|
|
|
|
{
|
|
|
|
id: '3',
|
|
|
|
name: this.$t('designPlatform.scriptDesign'),
|
|
|
|
type: 'scriptDesign',
|
|
|
|
mapId: elem.id,
|
2019-11-12 13:39:52 +08:00
|
|
|
cityCode: elem.cityCode,
|
|
|
|
lineCode: elem.lineCode
|
2019-10-29 14:41:47 +08:00
|
|
|
// code:elem.children.find(n => { return n.name.includes("行调")})
|
|
|
|
});
|
|
|
|
elem.children.push(
|
|
|
|
{
|
|
|
|
id: '4',
|
|
|
|
name: this.$t('designPlatform.runPlanDesign'),
|
|
|
|
type: 'runPlanDesign',
|
|
|
|
mapId: elem.id,
|
2020-03-13 18:19:04 +08:00
|
|
|
lineCode: elem.lineCode,
|
|
|
|
cityCode: elem.cityCode
|
|
|
|
}
|
|
|
|
);
|
|
|
|
elem.children.push(
|
|
|
|
{
|
|
|
|
id: '5',
|
|
|
|
name: 'IBP盘设计',
|
|
|
|
type: 'ibpDesign',
|
|
|
|
mapId: elem.id,
|
2019-11-08 14:35:58 +08:00
|
|
|
lineCode: elem.lineCode,
|
2019-10-29 14:41:47 +08:00
|
|
|
cityCode: elem.cityCode
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
this.treeData = res.data;
|
|
|
|
this.treeList = this.filterText
|
|
|
|
? res.data.filter(elem => { return elem.name.includes(this.filterText); })
|
|
|
|
: res.data;
|
|
|
|
this.$nextTick(() => {
|
|
|
|
const mapId = getSessionStorage('demonList') || null;
|
|
|
|
this.$refs.tree.setCurrentKey(mapId);
|
|
|
|
this.loading = false;
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
this.loading = false;
|
2019-11-14 17:03:44 +08:00
|
|
|
this.$messageBox(that.$t('error.refreshFailed'));
|
2019-10-29 14:41:47 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
resize() {
|
|
|
|
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
|
|
|
|
const width = this.$store.state.app.width - 521 - this.widthLeft;
|
|
|
|
const height = this.$store.state.app.height - 90;
|
|
|
|
this.$store.dispatch('config/resize', { width: width, height: height });
|
|
|
|
},
|
|
|
|
isAdministrator() {
|
|
|
|
return this.$store.state.user.roles.includes(superAdmin) || this.$store.state.user.roles.includes(admin);
|
|
|
|
}
|
|
|
|
}
|
2019-10-18 17:15:04 +08:00
|
|
|
};
|
2019-09-25 14:52:21 +08:00
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
.back-home {
|
|
|
|
float: right;
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: #3ea726;
|
|
|
|
}
|
|
|
|
}
|
2019-11-07 18:46:17 +08:00
|
|
|
.text_item{
|
|
|
|
height: calc(100% - 47px);
|
|
|
|
.tree_mian_box{
|
|
|
|
height: calc(100% - 76px);
|
|
|
|
}
|
|
|
|
}
|
2019-09-26 15:51:22 +08:00
|
|
|
|
2019-09-29 14:21:06 +08:00
|
|
|
.map-list-main{
|
|
|
|
text-align:left;
|
2019-10-28 17:51:59 +08:00
|
|
|
height: 100%;
|
2019-09-26 15:51:22 +08:00
|
|
|
}
|
2019-10-28 17:51:59 +08:00
|
|
|
.clearfix{
|
|
|
|
padding: 0 20px;
|
|
|
|
border-bottom: 1px solid #EBEEF5;
|
|
|
|
box-sizing: border-box;
|
|
|
|
height: 47px;
|
|
|
|
line-height: 47px;
|
|
|
|
}
|
|
|
|
.tree_box{
|
|
|
|
height: 100%;
|
|
|
|
}
|
2019-09-25 14:52:21 +08:00
|
|
|
</style>
|
|
|
|
<style>
|
|
|
|
.el-tree {
|
|
|
|
overflow-x: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-tree-node.is-current>.el-tree-node__content {
|
|
|
|
background-color: #e4e3e3 !important;
|
|
|
|
}
|
|
|
|
</style>
|