# Conflicts:
#	src/views/designPlatform/mapPreview.vue
This commit is contained in:
joylink_cuiweidong 2019-10-28 19:14:49 +08:00
commit b9111b8219
21 changed files with 220 additions and 145 deletions

View File

@ -26,9 +26,9 @@ export function getScriptById(id) {
}); });
} }
/** 通过ID查询未发布剧本的详细信息 */ /** 通过ID查询未发布剧本的详细信息 */
export function getDraftScriptById(id) { export function getDraftScriptByGroup(group) {
return request({ return request({
url: `/api/script/draft/${id}/detail`, url: `/api/simulation/${group}/script/loadedScript`,
method: 'get' method: 'get'
}); });
} }

View File

@ -425,3 +425,12 @@ export function handlerIbpEvent(group, data) {
data: data data: data
}); });
} }
/** 预览脚本仿真*/
export function scriptDraftRecordNotify(scriptId) {
return request({
url: `/api/simulation/scriptDraft/${scriptId}`,
method: 'get'
});
}

View File

@ -205,5 +205,6 @@ export default {
publishTheCourseHint: 'This operation will publish the course. Are you sure?', publishTheCourseHint: 'This operation will publish the course. Are you sure?',
rejectedCourseReleaseApplicationSuccessful: 'Rejected course release application successful!', rejectedCourseReleaseApplicationSuccessful: 'Rejected course release application successful!',
rejectedCourseReleaseApplicationFailed: 'Rejected course release application failed!', rejectedCourseReleaseApplicationFailed: 'Rejected course release application failed!',
duplicatePlanFailedTips: 'The interval needs to be more than 30 seconds or the times is more than 1' duplicatePlanFailedTips: 'The interval needs to be more than 30 seconds or the times is more than 1',
createSwitchPortion: 'The relevant turnout is not formed'
}; };

View File

@ -205,5 +205,6 @@ export default {
publishTheCourseHint: '此操作将发布课程,是否确定?', publishTheCourseHint: '此操作将发布课程,是否确定?',
rejectedCourseReleaseApplicationSuccessful: '驳回课程发布申请成功!', rejectedCourseReleaseApplicationSuccessful: '驳回课程发布申请成功!',
rejectedCourseReleaseApplicationFailed: '驳回课程发布申请失败!', rejectedCourseReleaseApplicationFailed: '驳回课程发布申请失败!',
duplicatePlanFailedTips: '间隔时间需要大于30秒或次数大于1' duplicatePlanFailedTips: '间隔时间需要大于30秒或次数大于1',
createSwitchPortion: '相关道岔未生成'
}; };

View File

@ -40,6 +40,7 @@ class Jlmap {
initMapInstance(opts) { initMapInstance(opts) {
const width = opts.dom.clientWidth; const width = opts.dom.clientWidth;
const height = opts.dom.clientHeight; const height = opts.dom.clientHeight;
this.zoomOnMouseWheel = opts.options.zoomOnMouseWheel;
this.$zr = zrender.init(opts.dom, deepAssign({ renderer, devicePixelRatio, width, height }, opts.config)); this.$zr = zrender.init(opts.dom, deepAssign({ renderer, devicePixelRatio, width, height }, opts.config));
@ -125,6 +126,7 @@ class Jlmap {
if (this.$options.disabled == true) { if (this.$options.disabled == true) {
this.$mouseController.disable(); this.$mouseController.disable();
} else { } else {
opts['zoomOnMouseWheel'] = this.zoomOnMouseWheel;
this.$mouseController.enable(opts); this.$mouseController.enable(opts);
} }

View File

@ -1,17 +0,0 @@
<template>
<section class="app-main">
<el-scrollbar wrap-class="scrollbar-wrapper">
<transition name="fade" mode="out-in">
<router-view />
</transition>
</el-scrollbar>
</section>
</template>
<script>
export default {
name: 'AppMain',
computed: {
}
};
</script>

View File

@ -1,3 +1,3 @@
export { default as Navbar } from './Navbar'; export { default as Navbar } from './Navbar';
export { default as Sidebar } from './Sidebar'; export { default as Sidebar } from './Sidebar';
export { default as AppMain } from './AppMain'; // export { default as AppMain } from './AppMain';

View File

@ -119,7 +119,7 @@
<script> <script>
import md5 from 'js-md5'; import md5 from 'js-md5';
import { getInfo } from '@/api/login'; import { getInfo } from '@/api/login';
import { getDesignToken } from '@/utils/auth'; // import { getDesignToken, getToken } from '@/utils/auth'; //
import { getUserinfoName, getUserinfoNickname, getUserinfoMobile, getUserinfoMobileCode, getUserinfoEmailCode, getUserinfoEmail, getUserinfoPassword } from '@/api/management/user'; import { getUserinfoName, getUserinfoNickname, getUserinfoMobile, getUserinfoMobileCode, getUserinfoEmailCode, getUserinfoEmail, getUserinfoPassword } from '@/api/management/user';
import { setInterval, clearInterval } from 'timers'; import { setInterval, clearInterval } from 'timers';
@ -187,7 +187,8 @@ export default {
}, },
doShow() { doShow() {
this.visible = true; this.visible = true;
getInfo(getDesignToken()).then(response => { const token = getToken() || getDesignToken();
getInfo(token).then(response => {
const user = response.data; const user = response.data;
this.userInfo = { this.userInfo = {
name: user.name, name: user.name,

View File

@ -2,13 +2,12 @@
<div class="app-wrapper" :class="classObj"> <div class="app-wrapper" :class="classObj">
<div class="main-container"> <div class="main-container">
<navbar /> <navbar />
<!-- <app-main :style="{width: width+'px', height: height+'px'}" /> -->
<section class="app-main" :style="{height: height+'px'}"> <section class="app-main" :style="{height: height+'px'}">
<el-scrollbar wrap-class="scrollbar-wrapper app_scrollbar_box"> <!-- <el-scrollbar wrap-class="scrollbar-wrapper app_scrollbar_box"> -->
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<router-view /> <router-view />
</transition> </transition>
</el-scrollbar> <!-- </el-scrollbar> -->
</section> </section>
<el-footer style="height:30px;text-align:right;line-height: 30px;"> <el-footer style="height:30px;text-align:right;line-height: 30px;">
<span style="font-size:14px;">Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号</span> <span style="font-size:14px;">Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号</span>
@ -24,7 +23,6 @@ export default {
name: 'Layout', name: 'Layout',
components: { components: {
Navbar Navbar
// AppMain
}, },
data() { data() {
return { return {
@ -77,6 +75,10 @@ export default {
overflow: hidden; overflow: hidden;
} }
.app-main{
overflow-y: auto;
}
.drawer-bg { .drawer-bg {
background: #000; background: #000;
opacity: 0.3; opacity: 0.3;
@ -94,4 +96,49 @@ export default {
height: 100%; height: 100%;
} }
} }
// card
.joylink-card{
border: 1px solid #EBEEF5;
background-color: #FFF;
color: #303133;
transition: .3s;
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
}
// safariqq360
//
::-webkit-scrollbar {
width: 6px;
height: 110px;
background-color: #FFFFFF;
}
/*定义滚动条轨道 内阴影+圆角*/
::-webkit-scrollbar-track {
// box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #FFFFFF;;
}
/*定义滑块 内阴影+圆角*/
::-webkit-scrollbar-thumb {
border-radius: 10px;
// box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #eaeaea;
}
/*滑块效果*/
::-webkit-scrollbar-thumb:hover {
border-radius: 5px;
// box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
background: rgba(0,0,0,0.4);
}
/*IE滚动条颜色*/
html {
scrollbar-face-color:#bfbfbf;/*滚动条颜色*/
scrollbar-highlight-color:#000;
scrollbar-3dlight-color:#000;
scrollbar-darkshadow-color:#000;
scrollbar-Shadow-color:#adadad;/*滑块边色*/
scrollbar-arrow-color:rgba(0,0,0,0.4);/*箭头颜色*/
scrollbar-track-color:#eeeeee;/*背景颜色*/
}
</style> </style>

View File

@ -3,8 +3,8 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰 // BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
} else { } else {

View File

@ -1,17 +1,20 @@
<template> <template>
<div> <div v-loading="loading" class="joylink-card map-list-main">
<el-card v-loading="loading" class="map-list-main" :header="$t('map.publishedMapList')"> <div class="clearfix">
<span>{{ $t('map.publishedMapList') }}</span>
</div>
<div class="text_item" style="height: calc(100% - 47px);">
<filter-city ref="filerCity" filter-empty :query-function="queryFunction" :local-param-name="localParamName" @filterSelectChange="refresh" /> <filter-city ref="filerCity" filter-empty :query-function="queryFunction" :local-param-name="localParamName" @filterSelectChange="refresh" />
<el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable /> <el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-125) +'px' }"> <div style="height: calc(100% - 76px);">
<el-tree ref="tree" :data="treeList" node-key="id" :props="defaultProps" highlight-current :span="22" :filter-node-method="filterNode" @node-click="clickEvent"> <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">
<span slot-scope="{ node:tnode, data }"> <span slot-scope="{ node:tnode, data }">
<span class="el-icon-tickets" :style="{color: data.valid ? 'green':''}" /> <span class="el-icon-tickets" :style="{color: data.valid ? 'green':''}" />
<span>&nbsp;{{ tnode.label }}</span> <span>&nbsp;{{ tnode.label }}</span>
</span> </span>
</el-tree> </el-tree>
</el-scrollbar> </div>
</el-card> </div>
</div> </div>
</template> </template>
<script> <script>
@ -57,11 +60,6 @@ export default {
cityCode: '' cityCode: ''
}; };
}, },
computed: {
height() {
return this.$store.state.app.height - 93;
}
},
watch: { watch: {
filterText(val) { filterText(val) {
this.treeList = this.treeData.filter((res) => { this.treeList = this.treeData.filter((res) => {
@ -174,8 +172,28 @@ export default {
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.map-list-main{ .back-home {
text-align:left; float: right;
cursor: pointer;
&:hover {
color: #3ea726;
}
}
.map-list-main{
text-align:left;
height: 100%;
}
.clearfix{
padding: 0 20px;
border-bottom: 1px solid #EBEEF5;
box-sizing: border-box;
height: 47px;
line-height: 47px;
}
.tree_box{
height: 100%;
} }
</style> </style>
<style> <style>

View File

@ -1,14 +1,12 @@
<template> <template>
<div class="app-wrapper"> <div class="app-wrapper">
<el-scrollbar wrap-class="scrollbar-wrapper"> <div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}">
<div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}"> <demon-list ref="demonList" :width="widthLeft" />
<demon-list ref="demonList" :width="widthLeft" /> </div>
</div> <drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" /> <transition>
<transition> <router-view :product-list="productList" :width-left="widthLeft" />
<router-view :product-list="productList" :width-left="widthLeft" /> </transition>
</transition>
</el-scrollbar>
</div> </div>
</template> </template>
@ -99,8 +97,6 @@ export default {
} }
.examList { .examList {
// position: fixed;
// top: 61px;
float: left; float: left;
height: 100%; height: 100%;
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="map-view"> <div class="map-view">
<jlmap-visual ref="jlmapVisual" @onSelect="clickEvent" @onMenu="onContextmenu" /> <jlmap-visual ref="jlmapVisual" />
</div> </div>
</template> </template>
<script> <script>

View File

@ -1,39 +1,25 @@
<template> <template>
<el-card v-loading="loading" class="map-list-main" :header="$t('map.myMapList')"> <div v-loading="loading" class="joylink-card map-list-main">
<el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable /> <div class="clearfix">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height-185) +'px' }"> <span>{{ $t('map.myMapList') }}</span>
<el-tree </div>
ref="tree" <div class="text_item" style="height: calc(100% - 47px);">
:data="treeList" <el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
node-key="id" <div style="height: calc(100% - 89px); overflow-y: auto;">
:props="defaultProps" <el-tree ref="tree" :data="treeList" node-key="id" :props="defaultProps" highlight-current :span="22" :filter-node-method="filterNode" @node-click="clickEvent" @node-contextmenu="showContextMenu">
highlight-current <span slot-scope="{ node:tnode, data }">
:span="22" <span class="el-icon-tickets" :style="{color: data.valid ? 'green':''}" />
:filter-node-method="filterNode" <span>&nbsp;{{ tnode.label }}</span>
@node-click="clickEvent" </span>
@node-contextmenu="showContextMenu" </el-tree>
> </div>
<span slot-scope="{ node:tnode, data }"> <div class="buttonList">
<span <el-button size="small" type="primary" class="eachButton uploadDemo ">
class="el-icon-tickets" <input ref="files" type="file" class="file_box" accept=".json, application/json" @change="importf">
:style="{color: data.valid ? 'green':''}" {{ $t('map.importMap') }}
/> </el-button>
<span>&nbsp;{{ tnode.label }}</span> <el-button size="small" type="primary" class="eachButton" @click="createMap">{{ $t('map.newConstruction') }}</el-button>
</span> </div>
</el-tree>
</el-scrollbar>
<div class="buttonList">
<el-button size="small" type="primary" class="eachButton uploadDemo ">
<input
ref="files"
type="file"
class="file_box"
accept=".json, application/json"
@change="importf"
>
{{ $t('map.importMap') }}
</el-button>
<el-button size="small" type="primary" class="eachButton" @click="createMap">{{ $t('map.newConstruction') }}</el-button>
</div> </div>
<map-operate-menu <map-operate-menu
ref="menu" ref="menu"
@ -43,7 +29,7 @@
@refresh="loadInitData" @refresh="loadInitData"
@jlmap3d="jlmap3d" @jlmap3d="jlmap3d"
/> />
</el-card> </div>
</template> </template>
<script> <script>
import { DeviceMenu } from '@/scripts/ConstDic'; import { DeviceMenu } from '@/scripts/ConstDic';
@ -59,10 +45,6 @@ export default {
MapOperateMenu MapOperateMenu
}, },
props: { props: {
height: {
type: Number,
required: true
},
width: { width: {
type: Number, type: Number,
required: true required: true
@ -223,6 +205,16 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.clearfix{
padding: 0 20px;
border-bottom: 1px solid #EBEEF5;
box-sizing: border-box;
height: 47px;
line-height: 47px;
}
.tree_box{
height: 100%;
}
.buttonList{ .buttonList{
padding: 8px 0px 8px 0px; padding: 8px 0px 8px 0px;
border-top: 1px #ccc solid; border-top: 1px #ccc solid;
@ -249,5 +241,6 @@ export default {
} }
.map-list-main{ .map-list-main{
text-align:left; text-align:left;
height: 100%;
} }
</style> </style>

View File

@ -1,20 +1,13 @@
<template> <template>
<div class="app-wrapper"> <div class="app-wrapper" style="height: 100%;">
<map-create ref="mapCreate" :skin-code="skinCode" @refresh="refresh1" @editmap="handleNodeClick" /> <map-create ref="mapCreate" :skin-code="skinCode" @refresh="refresh1" @editmap="handleNodeClick" />
<!-- <el-scrollbar wrap-class="scrollbar-wrapper"> --> <div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}">
<div> <demon-list ref="demonList" :width="widthLeft" @createMap="createMap" />
<div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}">
<demon-list ref="demonList" :height="height" :width="widthLeft" @createMap="createMap" />
</div>
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
<transition>
<!-- position:'relative', -->
<!-- :style="{left:widthLeft+'px', width: (width - widthLeft)+'px'}" -->
<router-view :product-list="productList" />
</transition>
</div> </div>
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
<!-- </el-scrollbar> --> <transition>
<router-view :product-list="productList" />
</transition>
</div> </div>
</template> </template>
@ -47,9 +40,6 @@ export default {
...mapGetters([ ...mapGetters([
'lessonbar' 'lessonbar'
]), ]),
height() {
return this.$store.state.app.height - 50;
},
width() { width() {
return this.$store.state.app.width; return this.$store.state.app.width;
} }
@ -140,8 +130,6 @@ export default {
} }
.examList { .examList {
// position: fixed;
// top: 61px;
float: left; float: left;
height: 100%; height: 100%;
} }

View File

@ -131,6 +131,12 @@ export default {
document.getElementById(this.canvasId).oncontextmenu = function (e) { document.getElementById(this.canvasId).oncontextmenu = function (e) {
return false; return false;
}; };
//
const path = window.location.href;
let flag = false;
if (path.includes('design/userlist/map/draw')) {
flag = true;
}
Vue.prototype.$jlmap = new Jlmap({ Vue.prototype.$jlmap = new Jlmap({
dom: document.getElementById(this.canvasId), dom: document.getElementById(this.canvasId),
@ -142,7 +148,8 @@ export default {
options: { options: {
scaleRate: 1, scaleRate: 1,
offsetX: 0, offsetX: 0,
offsetY: 0 offsetY: 0,
zoomOnMouseWheel: flag
}, },
methods: { methods: {
dataLoaded: this.handleDataLoaded, dataLoaded: this.handleDataLoaded,

View File

@ -104,6 +104,7 @@
<div class="point-section"> <div class="point-section">
<template v-for="(point, index) in formModel[item.prop]"> <template v-for="(point, index) in formModel[item.prop]">
<div :key="index" style="overflow: hidden;"> <div :key="index" style="overflow: hidden;">
<span style="display: table; margin-right: 3px; font-size: 14px; float: left; line-height: 28px;">{{ index == 0 ? '(起点)' : index == formModel[item.prop].length - 1 ? '(终点)' : `(中点${index})` }}</span>
<el-form-item <el-form-item
label="" label=""
:prop="'points[' + index + '].x'" :prop="'points[' + index + '].x'"
@ -120,7 +121,7 @@
label="" label=""
:prop="'points[' + index + '].y'" :prop="'points[' + index + '].y'"
style="display: table; float: left; margin-right: 5px;" style="display: table; float: left; margin-right: 5px;"
label-width="10px" label-width="4px"
> >
<el-input-number v-model="point.y" :disabled="item.pointDisabled" /> <el-input-number v-model="point.y" :disabled="item.pointDisabled" />
</el-form-item> </el-form-item>
@ -136,6 +137,7 @@
:disabled="index == 0 || index == formModel[item.prop].length - 1" :disabled="index == 0 || index == formModel[item.prop].length - 1"
circle circle
class="point-button" class="point-button"
style="margin-left: 4px;"
@click="item.delPoint(index)" @click="item.delPoint(index)"
/> />
</div> </div>

View File

@ -107,6 +107,7 @@
<div class="point-section" :style="{ width: `calc(100% - 10px - ${item.width})` }"> <div class="point-section" :style="{ width: `calc(100% - 10px - ${item.width})` }">
<template v-for="(point, index) in formModel[item.prop]"> <template v-for="(point, index) in formModel[item.prop]">
<div :key="index" style="overflow: hidden;"> <div :key="index" style="overflow: hidden;">
<span style="display: table; margin-right: 3px; font-size: 14px; float: left; line-height: 28px;" :style="{'margin-right': index == 0 || index == formModel[item.prop].length - 1 ? '9px' : '5px'}">{{ index == 0 ? '起 点' : index == formModel[item.prop].length - 1 ? '终 点' : `中点${index}` }}</span>
<el-form-item <el-form-item
label="" label=""
:prop="'points[' + index + '].x'" :prop="'points[' + index + '].x'"
@ -123,7 +124,7 @@
label="" label=""
:prop="'points[' + index + '].y'" :prop="'points[' + index + '].y'"
style="display: table; float: left; margin-right: 5px;" style="display: table; float: left; margin-right: 5px;"
label-width="10px" label-width="4px"
> >
<el-input-number v-model="point.y" :disabled="item.pointDisabled" /> <el-input-number v-model="point.y" :disabled="item.pointDisabled" />
</el-form-item> </el-form-item>
@ -139,6 +140,7 @@
:disabled="index == 0 || index == formModel[item.prop].length - 1" :disabled="index == 0 || index == formModel[item.prop].length - 1"
circle circle
class="point-button" class="point-button"
style="margin-left: 4px;"
@click="item.delPoint(index)" @click="item.delPoint(index)"
/> />
</div> </div>

View File

@ -161,7 +161,7 @@ export default {
{ prop: 'code', label: this.$t('map.lineCoding'), type: 'select', optionLabel: 'code', optionValue: 'code', options: this.lineList, change: true, deviceChange: this.deviceChange }, { prop: 'code', label: this.$t('map.lineCoding'), type: 'select', optionLabel: 'code', optionValue: 'code', options: this.lineList, change: true, deviceChange: this.deviceChange },
{ prop: 'type', label: this.$t('map.lineType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.LineTypeList }, { prop: 'type', label: this.$t('map.lineType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.LineTypeList },
{ prop: 'width', label: this.$t('map.lineWidth'), type: 'number', min: 1, placeholder: 'px' }, { prop: 'width', label: this.$t('map.lineWidth'), type: 'number', min: 1, placeholder: 'px' },
{ prop: 'points', label: this.$t('map.segmentCoordinates'), type: 'points', width: '120px', isHidden: !this.isPointsShow, addPoint: this.addPoint, delPoint: this.delPoint } { prop: 'points', label: this.$t('map.segmentCoordinates'), type: 'points', width: '100px', isHidden: !this.isPointsShow, addPoint: this.addPoint, delPoint: this.delPoint }
] ]
}, },
map: { map: {

View File

@ -130,7 +130,7 @@
<el-tab-pane class="view-control" label="批量删除" name="five" :style="{ height: cardHeight + 30 +'px' }"> <el-tab-pane class="view-control" label="批量删除" name="five" :style="{ height: cardHeight + 30 +'px' }">
<div class="link_box_select"> <div class="link_box_select">
<span style="margin-right: 12px;">选择link:</span> <span style="margin-right: 12px;">选择link:</span>
<el-select v-model="linkCode" filterable size="mini"> <el-select v-model="linkCode" filterable multiple size="mini">
<el-option <el-option
v-for="item in linkList" v-for="item in linkList"
:key="item.code" :key="item.code"
@ -225,6 +225,7 @@ export default {
}, },
linkCode: '', linkCode: '',
tableData: [], tableData: [],
oldPoint: [], //
addModel: { addModel: {
code: '', code: '',
splitNumber: 2, splitNumber: 2,
@ -343,7 +344,7 @@ export default {
{ prop: 'segmentationPosition.y', firstLevel: 'segmentationPosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true } { prop: 'segmentationPosition.y', firstLevel: 'segmentationPosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
] }, ] },
{ prop: 'isCurve', label: this.$t('map.isCurve'), type: 'checkbox', isHidden: !this.isSectionType }, { prop: 'isCurve', label: this.$t('map.isCurve'), type: 'checkbox', isHidden: !this.isSectionType },
{ prop: 'points', label: this.$t('map.segmentCoordinates'), type: 'points', width: '140px', isHidden: !this.isPointsShow, pointDisabled: this.pointDisabledName, addPoint: this.addPoint, delPoint: this.delPoint } { prop: 'points', label: this.$t('map.segmentCoordinates'), type: 'points', width: '100px', isHidden: !this.isPointsShow, pointDisabled: this.pointDisabledName, addPoint: this.addPoint, delPoint: this.delPoint }
] ]
}, },
map: { map: {
@ -565,6 +566,7 @@ export default {
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0]; this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0];
this.editModel.isSegmentation = selected.isSegmentation || false; this.editModel.isSegmentation = selected.isSegmentation || false;
this.editModel.points = JSON.parse(JSON.stringify(selected.points)); this.editModel.points = JSON.parse(JSON.stringify(selected.points));
this.oldPoint = JSON.parse(JSON.stringify(selected.points));
this.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz); this.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz);
this.addModel.splitOffset = this.addModel.splitOffsetMax / 2; this.addModel.splitOffset = this.addModel.splitOffsetMax / 2;
@ -836,7 +838,6 @@ export default {
} }
} }
}); });
console.log(models, remove);
const _that = this; const _that = this;
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), { this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), {
@ -865,7 +866,7 @@ export default {
this.$refs['dataform'].validate((valid) => { this.$refs['dataform'].validate((valid) => {
if (valid) { if (valid) {
const edits = []; const edits = [];
const model = Object.assign({_type: 'Section'}, this.editModel); const model = Object.assign({_type: 'Section'}, this.editModel); // model
model.leftStopPointOffset = Number(model.leftStopPointOffset); model.leftStopPointOffset = Number(model.leftStopPointOffset);
model.rightStopPointOffset = Number(model.rightStopPointOffset); model.rightStopPointOffset = Number(model.rightStopPointOffset);
this.sectionList.forEach(section => { this.sectionList.forEach(section => {
@ -874,10 +875,24 @@ export default {
section.trainPosType = model.trainPosType; section.trainPosType = model.trainPosType;
edits.push(section); edits.push(section);
} }
if (section.linkCode == model.linkCode && model.code != section.code) {
// debugger;
const lastIndex = this.oldPoint.length - 1;
if (this.oldPoint[0].x == section.points[section.points.length -1].x && this.oldPoint[0].y == section.points[section.points.length -1].y) {
section.points[section.points.length -1].x = model.points[0].x;
section.points[section.points.length -1].y = model.points[0].y;
}
if (this.oldPoint[lastIndex].x == section.points[0].x && this.oldPoint[lastIndex].y == section.points[0].y) {
section.points[0].x = model.points[model.points.length -1].x;
section.points[0].y = model.points[model.points.length -1].y;
}
edits.push(section);
}
}); });
edits.push(model); edits.push(model);
this.fieldS = ''; this.fieldS = '';
this.$emit('addOrUpdateMapModel', edits); this.$emit('addOrUpdateMapModel', edits);
this.oldPoint = JSON.parse(JSON.stringify(model.points));
} }
}); });
}, },
@ -1101,17 +1116,19 @@ export default {
delRelevanceSection() { delRelevanceSection() {
const selected = []; const selected = [];
const switchList = []; const switchList = [];
this.sectionList.forEach(section => { this.linkCode.forEach(linkCode => {
if (section.linkCode == this.linkCode) { this.sectionList.forEach(section => {
const selectedSection = this.$store.getters['map/getDeviceByCode'](section.code); if (section.linkCode == linkCode) {
selected.push(selectedSection); const selectedSection = this.$store.getters['map/getDeviceByCode'](section.code);
this.switchList.forEach(switchEle => { selected.push(selectedSection);
if (section.relSwitchCode == switchEle.code) { this.switchList.forEach(switchEle => {
const selectedSwitch = this.$store.getters['map/getDeviceByCode'](switchEle.code); if (section.relSwitchCode == switchEle.code) {
switchList.push(selectedSwitch); const selectedSwitch = this.$store.getters['map/getDeviceByCode'](switchEle.code);
} switchList.push(selectedSwitch);
}); }
} });
}
});
}); });
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), { this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
@ -1123,6 +1140,7 @@ export default {
}); });
await this.$emit('delMapModel', selected); await this.$emit('delMapModel', selected);
this.deviceSelect(); this.deviceSelect();
this.linkCode = '';
}).catch(() => { }).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete')); this.$message.info(this.$t('tip.cancelledDelete'));
}); });

View File

@ -171,15 +171,15 @@ export default {
create() { // create() { //
this.questionList = []; // this.questionList = []; //
const models = []; const models = [];
// const remove = [];
const linkObj = {}; const linkObj = {};
this.linkList.forEach(link => { this.linkList.forEach(link => {
if (link && link.leftFdCode && link.leftSdCode) { // link if (link && link.leftFdCode && link.leftSdCode) { // link
linkObj[`${link.code}`] = { name: '', num: 0 }; linkObj[`${link.code}`] = { name: '', num: 0 };
} else if (link && link.rightFdCode && link.rightSdCode) { // link } else if (link && link.rightFdCode && link.rightSdCode) { // link
linkObj[`${link.code}`] = { name: '', num: 0 }; linkObj[`${link.code}`] = { name: '', num: 0 };
} else if (link && link.leftFdCode && !link.leftSdCode && link.rightFdCode && !link.rightSdCode) { // linklink
linkObj[`${link.code}`] = { name: '', num: 0 };
} }
}); });
this.sectionList.forEach(section => { this.sectionList.forEach(section => {
for (const link in linkObj) { for (const link in linkObj) {
@ -227,7 +227,7 @@ export default {
} }
}; };
const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode); const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
!swch && models.push(model); !swch && models.push(model); //
} }
} }
} }
@ -273,6 +273,16 @@ export default {
} }
} }
}); });
const createArr = [];
models.forEach((item) => {
const sectionA = this.$store.getters['map/getDeviceByCode'](item.sectionACode);
const sectionB = this.$store.getters['map/getDeviceByCode'](item.sectionBCode);
const sectionC = this.$store.getters['map/getDeviceByCode'](item.sectionCCode);
if (linkObj[sectionA.linkCode].num != 1 && linkObj[sectionB.linkCode].num != 1 && linkObj[sectionC.linkCode].num != 1 ) {
createArr.push(item);
}
});
// console.log(models, createArr, 'list');
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), { this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'), confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
@ -280,14 +290,11 @@ export default {
}).then(() => { }).then(() => {
for (const link in linkObj) { for (const link in linkObj) {
if (linkObj[link].num == 1) { if (linkObj[link].num == 1) {
this.questionList.push(`${this.$t('map.section')}${linkObj[link].name}${this.$t('tip.linkNoneSplit')}`); this.questionList.push(`${this.$t('map.section')}${linkObj[link].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
} }
} }
if (!this.questionList.length) { // list this.$emit('addOrUpdateMapModel', createArr);
// this.$emit('delMapModel', remove); this.createSwitchSection(createArr);
this.$emit('addOrUpdateMapModel', models);
this.createSwitchSection(models);
}
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',