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', entryTurnout: 'Entry turnout',
accessGate: 'Access gate', accessGate: 'Access gate',
selectPhysicalSection: 'Please select the incoming physical sectio', 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: '进路道岔数据', entryTurnout: '进路道岔数据',
accessGate: '进路屏蔽门数据', accessGate: '进路屏蔽门数据',
selectPhysicalSection: '请选择进路物理区段数据', selectPhysicalSection: '请选择进路物理区段数据',
actualLength: '实际长度' actualLength: '实际长度',
verifyMapName: '地图名称重复,您确认发布此地图将会覆盖公共地图?'
}; };

View File

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

View File

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

View File

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

View File

@ -14,119 +14,116 @@
</template> </template>
<script> <script>
import { requestAnimationFrame, cancelRequestAnimFrame } from '@/utils/animation'; // import { requestAnimationFrame, cancelRequestAnimFrame } from '@/utils/animation';
export default { export default {
name: 'ProgressBar', name: 'ProgressBar',
props: { props: {
type: { type: {
type: String, type: String,
default() { default() {
return 'line'; return 'line';
} }
}, },
showText: { showText: {
type: Boolean, type: Boolean,
default() { default() {
return true; return true;
} }
}, },
textInside: { textInside: {
type: Boolean, type: Boolean,
default() { default() {
return false; return false;
} }
}, },
strokeWidth: { strokeWidth: {
type: Number, type: Number,
default() { default() {
return 5; return 5;
} }
}, },
background: { background: {
type: String, type: String,
default() { default() {
return 'rgba(0, 0, 0, 0.8)'; return 'rgba(0, 0, 0, 0.8)';
} }
} }
}, },
data() { data() {
return { return {
color: '#8e71c7', color: '#8e71c7',
status: null, status: null,
show: true, show: false,
percentage: 0, percentage: 0,
fps: 30, fps: 30,
then: null then: null,
}; timer: null
}, };
mounted() { },
this.percentage = this.randomNum(); mounted() {
}, this.percentage = this.randomNum();
methods: { this.start();
randomNum() { },
return Math.ceil(Math.random() * 5) + 50; methods: {
}, randomNum() {
run() { return Math.ceil(Math.random() * 5) + 20;
const now = +Date.now(); },
const delta = now - this.then || +Date.now(); run() {
const interval = 1000 / this.fps; this.timer = setInterval(() => {
this.percentage = this.percentage + 3;
if (delta > interval) { //
this.then = now - (delta % interval); if (this.percentage >= 95) {
if (this.percentage < 90) { this.percentage = 95;
this.percentage = this.percentage + 5; //
} else { clearInterval(this.timer);
cancelRequestAnimFrame(this.run); return;
} }
} }, 50);
},
requestAnimationFrame(this.run); start() {
}, if (!this.show) {
start() { this.status = null;
if (!this.show) { this.percentage = this.randomNum();
this.status = null; this.show = true;
this.percentage = this.randomNum(); this.run();
this.show = true; }
this.run(); },
} end(isSuccess) {
}, this.timer && clearInterval(this.timer);
end(isSuccess) { if (this.show) {
cancelRequestAnimFrame(this.run); if (isSuccess) {
if (this.show) { this.success();
if (isSuccess) { } else {
this.success(); this.failed();
} else { }
this.failed(); }
} },
} progressAt(num) {
}, if (num > 0 && num < 100 && num > this.percentage) {
progressAt(num) { this.percentage = num;
if (num > 0 && num < 100 && num > this.percentage) { }
this.percentage = num; },
} success() {
}, this.status = 'success';
success() { this.percentage = 100;
this.status = 'success'; setTimeout(() => {
this.percentage = 100; this.show = false;
setTimeout(() => { }, 1000 / this.fps);
this.show = false; },
}, 1000 / this.fps); failed() {
}, this.status = 'exception';
failed() { setTimeout(() => {
this.status = 'exception'; this.show = false;
setTimeout(() => { }, 1000 / this.fps);
this.show = false; }
}, 1000 / this.fps); }
}
}
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
.progressShade { .progressShade {
display: inline;
z-index: 9998; z-index: 9998;
position: absolute; position: absolute;
top: 0px; top: 0px;
@ -137,7 +134,6 @@ export default {
.progressBar { .progressBar {
z-index: 9999; z-index: 9999;
display: inline;
position: absolute; position: absolute;
top: 40%; top: 40%;
width: 50%; width: 50%;

View File

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

View File

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

View File

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

View File

@ -75,6 +75,21 @@ export default {
publish() { publish() {
this.loading = true; this.loading = true;
delete this.editModel.children; 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 => { publishMap(this.editModel).then(response => {
this.loading = false; this.loading = false;
if (response.data && response.data.length) { if (response.data && response.data.length) {
@ -97,7 +112,7 @@ export default {
}); });
const dataList = this.formatJson(filterVal, arr); const dataList = this.formatJson(filterVal, arr);
import('@/utils/Export2Excel').then(excel => { import('@/utils/Export2Excel').then(excel => {
excel.export_json_to_excel([this.$t('map.datQuestion')], dataList, this.$t('map.dataList')); excel.export_json_to_excel([this.$t('map.datQuestion')], dataList, this.$t('map.dataList'));
}); });
}, },
formatJson(filterVal, jsonData) { formatJson(filterVal, jsonData) {

View File

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

View File

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

View File

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

View File

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

View File

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