desc: 调整代码书写逻辑

This commit is contained in:
zyy 2019-11-20 16:31:41 +08:00
parent 1719292036
commit fa3d0cb099
15 changed files with 176 additions and 157 deletions

View File

@ -551,5 +551,6 @@ export default {
entryTurnout: 'Entry turnout',
accessGate: 'Access gate',
selectPhysicalSection: 'Please select the incoming physical sectio',
actualLength: 'physical length'
actualLength: 'physical length',
verifyMapName: 'Map name repeated, you confirm that publishing this map will overwrite the public map?'
};

View File

@ -546,6 +546,7 @@ export default {
entryTurnout: '进路道岔数据',
accessGate: '进路屏蔽门数据',
selectPhysicalSection: '请选择进路物理区段数据',
actualLength: '实际长度'
actualLength: '实际长度',
verifyMapName: '地图名称重复,您确认发布此地图将会覆盖公共地图?'
};

View File

@ -421,6 +421,7 @@ export default {
.content{
width: calc(100% - 80px);
float: left;
margin: 0;
.el-icon-edit{
cursor: pointer;
}

View File

@ -318,8 +318,11 @@ const map = {
map: (state) => {
return state.map;
},
safetyDoorList: (state) => {
return state.map.safetyDoorList || [];
psdList: (state) => {
return state.map.psdList;
},
espList: (state) => {
return state.map.espList;
},
lineCode: (state) => {
if (state.map && state.map.skinVO) {

View File

@ -6,7 +6,7 @@ export function getBaseUrl() {
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5: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'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -14,7 +14,7 @@
</template>
<script>
import { requestAnimationFrame, cancelRequestAnimFrame } from '@/utils/animation';
// import { requestAnimationFrame, cancelRequestAnimFrame } from '@/utils/animation';
export default {
name: 'ProgressBar',
@ -54,34 +54,32 @@ export default {
return {
color: '#8e71c7',
status: null,
show: true,
show: false,
percentage: 0,
fps: 30,
then: null
then: null,
timer: null
};
},
mounted() {
this.percentage = this.randomNum();
this.start();
},
methods: {
randomNum() {
return Math.ceil(Math.random() * 5) + 50;
return Math.ceil(Math.random() * 5) + 20;
},
run() {
const now = +Date.now();
const delta = now - this.then || +Date.now();
const interval = 1000 / this.fps;
if (delta > interval) {
this.then = now - (delta % interval);
if (this.percentage < 90) {
this.percentage = this.percentage + 5;
} else {
cancelRequestAnimFrame(this.run);
this.timer = setInterval(() => {
this.percentage = this.percentage + 3;
//
if (this.percentage >= 95) {
this.percentage = 95;
//
clearInterval(this.timer);
return;
}
}
requestAnimationFrame(this.run);
}, 50);
},
start() {
if (!this.show) {
@ -92,7 +90,7 @@ export default {
}
},
end(isSuccess) {
cancelRequestAnimFrame(this.run);
this.timer && clearInterval(this.timer);
if (this.show) {
if (isSuccess) {
this.success();
@ -126,7 +124,6 @@ export default {
@import "src/styles/mixin.scss";
.progressShade {
display: inline;
z-index: 9998;
position: absolute;
top: 0px;
@ -137,7 +134,6 @@ export default {
.progressBar {
z-index: 9999;
display: inline;
position: absolute;
top: 40%;
width: 50%;

View File

@ -125,7 +125,6 @@ export default {
res = await listPublishMap({cityCode: filterSelect});
}
res.data && res.data.forEach(elem=>{
// elem.children.find(n => { return n.name.includes("")})
elem.children = [
{
id: '1',

View File

@ -59,7 +59,7 @@ export default {
await this.initLoadData();
},
methods: {
async initLoadData() {
async initLoadData() { //
if (parseInt(this.mapId)) {
await this.loadMapDataById(this.mapId);
} else {

View File

@ -162,7 +162,6 @@ export default {
});
});
}).catch(() => { });
},
getMapOrigin() {
const dataZoom = this.$store.state.map.dataZoom;

View File

@ -75,6 +75,21 @@ export default {
publish() {
this.loading = true;
delete this.editModel.children;
this.verifyMapName();
},
async verifyMapName() { //
this.publishMap();
},
confirmPublish() {
this.$confirm(this.$t('map.verifyMapName'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
this.publishMap();
}).catch(() => { this.loading = false; });
},
publishMap() {
publishMap(this.editModel).then(response => {
this.loading = false;
if (response.data && response.data.length) {

View File

@ -7,7 +7,7 @@
<el-form-item label="code" prop="code">
<el-select v-model="editModel.code" clearable :filterable="true" @change="deviceChange">
<el-option
v-for="item in parkStandList"
v-for="item in espList"
:key="item.code"
:label="item.name"
:value="item.code"
@ -80,7 +80,7 @@ export default {
computed: {
...mapGetters('map', [
'map',
'parkStandList',
'espList',
'stationStandList'
])
},
@ -99,10 +99,10 @@ export default {
this.display = true;
const mapObject = this.map;
if (mapObject) {
if (mapObject.parkStandList && mapObject.parkStandList.length) {
if (mapObject.espList && mapObject.espList.length) {
this.display = false;
} else {
mapObject.parkStandList = [];
mapObject.espList = [];
}
}
},
@ -120,7 +120,7 @@ export default {
},
hasPSD(data) {
let falg = false;
this.map.parkStandList.forEach(item => {
this.map.espList.forEach(item => {
if (item.stationStandCode == data.code) {
falg = true;
}
@ -143,7 +143,7 @@ export default {
if (arr.length) {
this.display = false;
this.$message('创建完成');
this.$store.dispatch('map/updateMapStandData', {models: arr, type: 'parkStandList'});
this.$store.dispatch('map/updateMapStandData', {models: arr, type: 'espList'});
this.deviceSelect();
} else {
this.$message('暂无车站');

View File

@ -54,14 +54,14 @@
/>
</el-tab-pane>
<el-tab-pane label="站台屏蔽门" class="tab_pane_box" name="safetyDoor">
<safety-door-operate
<psd-operate
ref="routeOperate"
:map-info="mapInfo"
:selected="selected"
/>
</el-tab-pane>
<el-tab-pane label="站台紧急停车按钮" class="tab_pane_box" name="park">
<park-operate
<esp-operate
ref="routeOperate"
:map-info="mapInfo"
:selected="selected"
@ -79,8 +79,8 @@ import RoutingOperate from './routingoperate/index';
import AutomaticOperate from './automaticoperate/index';
import SwitchOperate from './switchoperate/index';
import PathOperate from './pathoperate/index';
import safetyDoorOperate from './safetyDoorOperate/index';
import parkOperate from './parkOperate/index';
import PsdOperate from './psdOperate/index';
import EspOperate from './espOperate/index';
export default {
name: 'DataRelation',
@ -90,8 +90,8 @@ export default {
AutomaticOperate,
SwitchOperate,
PathOperate,
safetyDoorOperate,
parkOperate
PsdOperate,
EspOperate
},
props: {
selected: {

View File

@ -7,7 +7,7 @@
<el-form-item label="code" prop="code">
<el-select v-model="editModel.code" clearable :filterable="true" @change="deviceChange">
<el-option
v-for="item in safetyDoorList"
v-for="item in psdList"
:key="item.code"
:label="item.name"
:value="item.code"
@ -80,7 +80,7 @@ export default {
computed: {
...mapGetters('map', [
'map',
'safetyDoorList',
'psdList',
'stationStandList'
])
},
@ -99,10 +99,10 @@ export default {
this.display = true;
const mapObject = this.map;
if (mapObject) {
if (mapObject.safetyDoorList && mapObject.safetyDoorList.length) {
if (mapObject.psdList && mapObject.psdList.length) {
this.display = false;
} else {
mapObject.safetyDoorList = [];
mapObject.psdList = [];
}
}
},
@ -120,7 +120,7 @@ export default {
},
hasPSD(data) {
let falg = false;
this.map.safetyDoorList.forEach(item => {
this.map.psdList.forEach(item => {
if (item.stationStandCode == data.code) {
falg = true;
}
@ -143,7 +143,7 @@ export default {
if (arr.length) {
this.display = false;
this.$message('创建完成');
this.$store.dispatch('map/updateMapStandData', {models: arr, type: 'safetyDoorList'});
this.$store.dispatch('map/updateMapStandData', {models: arr, type: 'psdList'});
this.deviceSelect();
} else {
this.$message('暂无车站');

View File

@ -159,35 +159,35 @@ export default {
}
},
handleSelectControlPage (model) {
if (this.$refs && this.$refs.mapOperate) {
if (this.$refs.mapOperate) {
this.$refs.mapOperate.handleSelectControlPage(model);
this.$store.dispatch('menuOperation/setMapDrawSelectCount');
}
},
handleSelectView(handle) {
if (this.$refs && this.$refs.jlmapVisual) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLayerVisible(handle);
}
},
handleSelectLogicalView(handle) {
if (this.$refs && this.$refs.jlmapVisual) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLevelVisible(handle);
}
},
handleSelectPhysicalView(handle) {
if (this.$refs && this.$refs.jlmapVisual) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLevelVisible(handle);
}
},
handleSelectHybridView(handle) {
if (this.$refs && this.$refs.jlmapVisual) {
if (this.$refs.jlmapVisual) {
this.$refs.jlmapVisual.setLevelVisible(handle);
}
},
clickEvent(em) {
var device = this.getDeviceByEm(em);
this.onSelect(device);
if (this.$refs.dataRelation) {
if (this.$refs.dataRelation && this.viewDraft != 'draft') {
this.$refs.dataRelation.setSelected(device);
}
},
@ -213,24 +213,27 @@ export default {
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
}
},
saveMapEvent() {
if (this.$refs.jlmapVisual) {
const map = this.$store.state.map.map;
if (map && parseInt(this.$route.params.mapId)) {
for (const i in map.sectionList) {
if (map.sectionList[i].points.length > 0) {
for (let index = 0; index < map.sectionList[i].points.length; index++) {
if (String(map.sectionList[i].points[index].x) == 'undefined' || String(map.sectionList[i].points[index].y) == 'undefined') {
this.$messageBox(this.$t('tip.sectionPointsDeficiency'));
return;
verifySectionPoint(map) { //
let flag = true;
map.sectionList.forEach(elem => {
if (elem.points.length > 0) {
for (let index = 0; index < elem.points.length; index++) {
if (String(elem.points[index].x) == 'undefined' || String(elem.points[index].y) == 'undefined') {
this.$message(`${elem.name}${this.$t('tip.sectionPointsDeficiency')}`);
flag = false;
}
}
} else {
this.$messageBox(this.$t('tip.sectionPointsDeficiency'));
return;
this.$message(this.$t('tip.sectionPointsDeficiency'));
flag = false;
}
}
});
return flag;
},
saveMapEvent() { //
const map = this.$store.state.map.map;
if (this.$refs.jlmapVisual && map && parseInt(this.$route.params.mapId)) {
if (this.verifySectionPoint(map)) {
this.mapSaveing = true;
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
saveMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(response => {
@ -317,7 +320,7 @@ export default {
createMap() {
this.$refs.mapCreate.show();
},
importf() {
importf() { // jsons
const loading = this.$loading({
lock: true,
text: '正在导入中...',

View File

@ -33,6 +33,7 @@ export default {
labelWidth: '100px',
items: [
{ prop: 'name', label: '参数名', type: 'text' }
// { prop: 'name', label: '', type: 'select', options: this.taskStatusList }
]
};
return form;
@ -40,7 +41,7 @@ export default {
rules() {
return {
name: [
{ required: true, message: '请输入内容', trigger: 'blur' }
{ required: true, message: '请选择', trigger: 'change' }
]
};
},