desc: 修改代码

This commit is contained in:
zyy 2019-11-18 14:29:43 +08:00
parent 9a82914c11
commit 8d05730dc4
19 changed files with 493 additions and 219 deletions

View File

@ -25,6 +25,7 @@
"qrcode.vue": "^1.6.2",
"script-loader": "^0.7.2",
"sessionstorage": "^0.1.0",
"sockjs-client": "^1.4.0",
"stompjs": "^2.3.3",
"storejs": "^1.0.25",
"three": "^0.107.0",

View File

@ -20,6 +20,7 @@
<script src="https://cdn.bootcss.com/element-ui/2.7.2/index.js"></script>
<script src="https://cdn.bootcss.com/element-ui/2.7.2/locale/en.min.js"></script>
<script src="https://cdn.bootcss.com/element-ui/2.7.2/locale/zh-CN.min.js"></script>
<!-- <script src="https://cdn.bootcss.com/sockjs-client/1.4.0/sockjs.min.js"></script> -->
</head>
<body>
<noscript>

View File

@ -71,10 +71,36 @@ export function getCommandList(parmas) {
});
}
// 根据线路code分页查询指令
// 删除指令对象
export function delCommand(id) {
return request({
url: `/api/cmd/${id}`,
method: 'delete'
});
}
// 创建指令
export function createCommand(data) {
return request({
url: `/api/cmd`,
method: 'post',
data: data
});
}
// 修改指令
export function editCommand(data) {
return request({
url: `/api/cmd`,
method: 'put',
data: data
});
}
// 获取指令详情
export function getCommandDetail(id) {
return request({
url: `/api/cmd/${id}`,
method: 'get'
});
}

View File

@ -10,7 +10,7 @@ export default {
normalCreate: 'The normal to create',
saveMapAs: 'Save the map as',
create: 'establish',
dataVerification: 'data verification',
dataVerification: 'verify',
edit3d: '3D editor',
logicalView: 'logical view',
physicalView: 'Physical view',
@ -21,7 +21,7 @@ export default {
deny: 'no',
drawMap: 'draw',
advanced: 'advanced',
viewLayer: 'The view layer',
viewLayer: 'display',
layerDisplay: 'The layer display',
viewShows: 'View shows',
contentShows: 'content show',
@ -87,7 +87,7 @@ export default {
text: 'text',
button: 'button',
mapName: 'Name of the map:',
mapName: 'Name:',
skinName: 'Skin style:',
selectCity: 'city:',
offsetXColon: 'X Offset:',
@ -126,7 +126,7 @@ export default {
abnormalOperation: 'abnormal operation',
datQuestion: 'Data in question',
dataList: 'Data list',
saveFailed: 'Save failed',
saveFailed: 'Save',
mapEditor: 'map editor',
mapPublished: 'Map published as',
@ -211,18 +211,18 @@ export default {
hypomere: 'Bottom section',
returnByGraph: 'Return by graph',
linkType: 'The Link type',
linkCode: 'The Link code:',
linkName: 'The Link name:',
linkType: 'Link type',
linkCode: 'Link code:',
linkName: 'Link name:',
linkDisplayLength: 'Link display length:',
linkActualLength: 'Actual Link length:',
linkColor: 'The Link colors:',
linkColor: 'color:',
linkLeftFdCode: 'Left forward Link:',
linkLeftSdCode: 'Left lateral Link:',
linkRightFdCode: 'Right forward Link:',
linkRightSdCode: 'Right lateral Link:',
linkLp: 'Link Start point coordinates:',
linkRp: 'Link End point coordinates:',
linkLp: 'Start point coordinates:',
linkRp: 'End point coordinates:',
linePoint: 'point:',
@ -237,9 +237,9 @@ export default {
aux: 'The first',
sectionLine: 'Section of the line',
sectionPolyline: 'Section polyline',
switchSection: 'The switch section',
switchSection: 'turnout section',
trainDirection: 'Direction of train:',
deleteSwitchSection: 'One key to delete the switch section',
deleteSwitchSection: 'One key to delete turnout section',
createSwitchSection: 'One key creates the turnout section',
sectionLogicalNumber: 'Number of logical extents',
sectionLsectioncode: 'Left section name:',
@ -249,8 +249,8 @@ export default {
sectionType: 'Section type:',
sectionNameColon: 'The name of the section:',
sectionNameOffset: 'Extentname offset:',
leftKilometerMark: 'Left kilometer mark (meter):',
rightKilometerMark: 'Right kilometer mark (meter):',
leftKilometerMark: 'Left kilometer mark:',
rightKilometerMark: 'Right kilometer mark:',
sectionColon: 'interval:',
displayExtentName: 'Whether to display the extent name:',
displayAxleCounter: 'Whether to display axis gauge:',
@ -406,13 +406,13 @@ export default {
stationstandHeight: 'highly h:',
switchCode: 'Switch coding:',
switchName: 'The name of the switch:',
switchNameC: 'The name of the switch',
switchShowName: 'Whether the switch name is displayed:',
switchName: 'name of turnout:',
switchNameC: 'name of turnout',
switchShowName: 'Whether turnout name is displayed:',
switchPositionX: 'Switch name x offset:',
switchPositionY: 'Switch name y offset:',
switchPosition: 'Switch name offset:',
turnTime: 'The switch changes time:',
turnTime: 'turnout changes time:',
timeoutShow: 'Whether to display switch countdown time:',
sectionACode: 'Associated with A Section Code:',
sectionBCode: 'Associated with B Section Code:',
@ -546,5 +546,9 @@ export default {
horizontal: 'Horizontal',
vertical: 'Vertical',
piece: 'piece',
setStationCode: 'Batch set up centralized station'
setStationCode: 'Batch set up centralized station',
physicalSection: 'Incoming physical section',
entryTurnout: 'Entry turnout',
accessGate: 'Access gate',
selectPhysicalSection: 'Please select the incoming physical sectio'
};

View File

@ -61,5 +61,6 @@ export default {
instructionType: 'type of instruction',
paramDetail: 'Check Parameters',
createDirective: '新增指令',
editDirective: '修改指令'
editDirective: '修改指令',
parameterName: '参数名称'
};

View File

@ -232,8 +232,8 @@ export default {
sectionType: '区段类型:',
sectionNameColon: '区段名称:',
sectionNameOffset: '区段名称偏移量:',
leftKilometerMark: '左侧公里标(米):',
rightKilometerMark: '右侧公里标(米):',
leftKilometerMark: '左侧公里标:',
rightKilometerMark: '右侧公里标:',
sectionColon: '区间:',
displayExtentName: '是否显示区段名称:',
displayAxleCounter: '是否显示计轴:',
@ -541,6 +541,10 @@ export default {
horizontal: '水平',
vertical: '垂直',
piece: 'piece',
setStationCode: '批量设置集中站'
setStationCode: '批量设置集中站',
physicalSection: '进路物理区段数据',
entryTurnout: '进路道岔数据',
accessGate: '进路屏蔽门数据',
selectPhysicalSection: '请选择进路物理区段数据'
};

View File

@ -61,5 +61,6 @@ export default {
instructionType: '指令类型',
paramDetail: '查看参数',
createDirective: '新增指令',
editDirective: '修改指令'
editDirective: '修改指令',
parameterName: '参数名称'
};

View File

@ -32,6 +32,7 @@ const SystemGenerate = () => import('@/views/system/systemGenerate/index');
const IbpDraw = () => import('@/views/system/ibpDraw/index');
const News = () => import('@/views/system/news/index');
const CommandDictionary = () => import('@/views/system/commandDictionary/index');
const CommandDictionaryDetail = () => import('@/views/system/commandDictionary/edit');
const Mapedit = () => import('@/views/mapdraft/index');
@ -820,6 +821,11 @@ export const asyncRouter = [
meta: {
i18n: 'router.commandDictionary'
}
},
{
path: 'commands/Detail',
hidden: true,
component: CommandDictionaryDetail
}
]
},

View File

@ -117,6 +117,16 @@ export default {
],
customeredProductType: [
{ enlabel: 'Plan Draw', label: '运行图编制', value: 'Plan'}
],
controlMode: [
{ label: '中控', value: '01' },
{ label: '站控', value: '02' }
],
simulationRole: [
{ label: '行调操作', value: '01' },
{ label: '现地操作', value: '02' }
]
}
};

View File

@ -3,11 +3,11 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// 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.6: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 {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -3,9 +3,11 @@ import { checkLoginLine } from '@/api/login';
import { getBaseUrl } from '@/utils/baseUrl';
import { MessageBox } from 'element-ui';
import store from '../store';
import SockJS from 'sockjs-client';
import Stomp from 'stompjs';
var SockJS = require('sockjs-client');
var Stomp = require('stompjs');
// var SockJS = require('sockjs-client');
// var Stomp = require('stompjs');
const isDev = process.env.NODE_ENV === 'development';
const websocketUrl = `${getBaseUrl()}/joylink-websocket?token=`;

View File

@ -13,7 +13,7 @@
<el-button type="text" class="mapEdit_box" @click="showMap">{{ $t('map.viewLayer') }}</el-button>
</div>
<el-tabs v-model="enabledTab" type="card" class="map_card" @tab-click="changePane">
<el-tab-pane label="进路" class="tab_pane_box" name="route">
<el-tab-pane :label="$t('map.routeID')" class="tab_pane_box" name="route">
<route-operate
ref="routeOperate"
:map-info="mapInfo"
@ -21,7 +21,7 @@
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane label="路径单元" class="tab_pane_box" name="path">
<el-tab-pane :label="$t('map.pathUnit')" class="tab_pane_box" name="path">
<path-operate
ref="pathOperate"
:map-info="mapInfo"
@ -29,7 +29,7 @@
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane label="交路" class="tab_pane_box" name="routing">
<el-tab-pane :label="$t('map.routing')" class="tab_pane_box" name="routing">
<routing-operate
ref="routingOperate"
:map-info="mapInfo"
@ -37,7 +37,7 @@
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane label="自动信号" class="tab_pane_box" name="automatic">
<el-tab-pane :label="$t('map.automaticSignal')" class="tab_pane_box" name="automatic">
<automatic-operate
ref="automaticOperate"
:map-info="mapInfo"
@ -45,7 +45,7 @@
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane label="联动道岔" class="tab_pane_box" name="swtich">
<el-tab-pane :label="$t('map.setSwitch')" class="tab_pane_box" name="swtich">
<switch-operate
ref="SwitchOperate"
:map-info="mapInfo"

View File

@ -117,8 +117,8 @@
@click="hover('routeTriggerSectionList')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="进路物理区段数据:" prop="routeSectionList">
<el-select v-model="addModel.routeSectionList" multiple :filterable="true" placeholder="请选择">
<el-form-item :label="$t('map.physicalSection') +':'" prop="routeSectionList">
<el-select v-model="addModel.routeSectionList" multiple :filterable="true">
<el-option
v-for="item in sectionList"
:key="item.code"
@ -129,10 +129,10 @@
<el-button
:type=" field === 'routeSectionList' ? 'danger' : 'primary'"
@click="hover('routeSectionList')"
>激活</el-button>
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="进路道岔数据:" prop="routeSwitchList">
<el-select v-model="routeCode" clearable :filterable="true" placeholder="请选择道岔数据">
<el-form-item :label="$t('map.entryTurnout')+':'" prop="routeSwitchList">
<el-select v-model="routeCode" clearable :filterable="true">
<el-option
v-for="item in switchList"
:key="item.code"
@ -143,12 +143,12 @@
<el-button
:type=" field === 'routeSwitchList' ? 'danger' : 'primary'"
@click="hover('routeSwitchList')"
>激活</el-button>
>{{ $t('map.activate') }}</el-button>
<el-button
type="primary"
@click="pushSwitch(addModel.routeSwitchList, { switchCode: routeCode, switchLocateType: routeType, switchType: overlapType == '01' ? '定位' : '反位' } )"
>添加</el-button>
<el-select v-model="routeType" :filterable="true" placeholder="请选择道岔类型">
>{{ $t('map.add') }}</el-button>
<el-select v-model="routeType" :filterable="true">
<el-option
v-for="item in SwitchLocateTypeList"
:key="item.code"
@ -157,7 +157,7 @@
/>
</el-select>
<el-table :data="addModel.routeSwitchList" border style="width: 97%">
<el-table-column prop="switchCode" label="道岔">
<el-table-column prop="switchCode" :label="$t('map.switch')">
<template slot-scope="scope">
<span>{{ swictchName(scope.row.switchCode) }}</span>
</template>
@ -176,8 +176,8 @@
</el-table-column>
</el-table>
</el-form-item>
<el-form-item label="进路屏蔽门数据:" prop="routeStandList">
<el-select v-model="addModel.routeStandList" multiple :filterable="true" placeholder="请选择">
<el-form-item :label="$t('map.accessGate') + ':'" prop="routeStandList">
<el-select v-model="addModel.routeStandList" multiple :filterable="true">
<el-option
v-for="item in stationStandList"
:key="item.code"
@ -188,7 +188,7 @@
<el-button
:type=" field === 'routeStandList' ? 'danger' : 'primary'"
@click="hover('routeStandList')"
>激活</el-button>
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.routeFlankProtectionList')" prop="routeFlankProtectionList">
<el-select v-model="flankCode" clearable :filterable="true" :placeholder="$t('map.pleaseSelect')">
@ -223,7 +223,7 @@
</template>
</el-table-column>
<el-table-column prop="switchType" :label="$t('map.switchType')" />
<el-table-column fixed="right" label="操作" width="50">
<el-table-column fixed="right" :label="$t('map.operation')" width="50">
<template slot-scope="scope">
<el-button
type="text"
@ -311,7 +311,6 @@
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { createRouteRoute, updateRouteRoute } from '@/api/jmap/mapdraft';
// import { ViewMode } from '@/scripts/ConstDic';
export default {
name: 'RouteOperation',
@ -436,7 +435,7 @@ export default {
{ required: true, message: this.$t('rules.autoAccessType'), trigger: 'change' }
],
routeSectionList: [
{ required: true, message: '请选择进路物理区段数据', trigger: 'change' }
{ required: true, message: this.$t('map.selectPhysicalSection'), trigger: 'change' }
]
};
return baseRules;
@ -540,7 +539,7 @@ export default {
if (valid) {
this.loading = true;
updateRouteRoute(this.buildModel()).then(response => {
this.$message.success('更新成功');
this.$message.success(this.$t('map.updateSuccessfully'));
this.loading = false;
this.clear();
}).catch(() => {

View File

@ -396,13 +396,13 @@ export default {
name: this.$t('map.mapData'),
item: [
{ prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: this.isStationCodeDisabled, options: this.stationList },
{ prop: 'offsetLeft', label: this.$t('map.sectionOffsetLeft'), type: 'number', min: 0, placeholder: '米', isHidden: !this.isSectionType },
{ prop: 'offsetRight', label: this.$t('map.sectionOffsetRight'), type: 'number', min: 0, placeholder: '米', isHidden: !this.isSectionType },
{ prop: 'offsetLeft', label: this.$t('map.sectionOffsetLeft'), type: 'number', min: 0, placeholder: this.$t('map.meter'), isHidden: !this.isSectionType },
{ prop: 'offsetRight', label: this.$t('map.sectionOffsetRight'), type: 'number', min: 0, placeholder: this.$t('map.meter'), isHidden: !this.isSectionType },
{ prop: 'leftStopPointOffset', label: this.$t('map.leftStopPointOffset'), type: 'number', min: 0, isHidden: !this.isStopPointOffset },
{ prop: 'rightStopPointOffset', label: this.$t('map.rightStopPointOffset'), type: 'number', min: 0, isHidden: !this.isStopPointOffset },
{ prop: 'region', label: this.$t('map.sectionColon'), type: 'select', optionLabel: 'label', optionValue: 'value', options: this.regionList, isHidden: !this.sectionColonShow },
{ prop: 'kmRangeLeft', label: this.$t('map.leftKilometerMark'), type: 'number', min: 0 },
{ prop: 'kmRangeRight', label: this.$t('map.rightKilometerMark'), type: 'number', min: 0 },
{ prop: 'kmRangeLeft', label: this.$t('map.leftKilometerMark'), type: 'number', min: 0, placeholder: this.$t('map.meter') },
{ prop: 'kmRangeRight', label: this.$t('map.rightKilometerMark'), type: 'number', min: 0, placeholder: this.$t('map.meter') },
{ prop: 'trainPosType', label: this.$t('map.trainDirection'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.TrainPositionTypeList, isHidden: !this.isSectionType }
]
}

View File

@ -1,46 +1,79 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<div class="dictionary_box">
<div class="joylink-card">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<div style="overflow: hidden;">
<div class="param-title">指令参数:</div>
<el-table :data="formModel.paramList" border class="param-table">
<el-table-column prop="name" label="参数名" />
<el-table-column :label="this.$t('global.operate')" width="180">
<template slot-scope="scope">
<el-button type="text" size="small" @click="editParam(scope.$index, scope.row)">修改</el-button>
<el-button type="text" size="small" @click="delParam(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="button-box">
<el-button type="primary" size="small" round @click="addParam">添加</el-button>
</div>
</div>
</div>
<div class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
<el-button @click="back">返回</el-button>
</div>
<command-edit ref="create" type="ADD" @addData="addData" />
<command-edit ref="edit" type="EDIT" @editData="editData" />
</div>
</template>
<script>
import { create, getData, update } from '@/api/management/dictionary';
import { createCommand, editCommand, getCommandDetail } from '@/api/management/dictionary';
import CommandEdit from './editParam';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'DictionaryEdit',
components: {
CommandEdit
},
props: {
type: {
type: String,
required: true
}
},
data() {
return {
dialogVisible: false,
taskStatusList: [],
deviceTypeList: [
{ label: '区段', value: 'section' },
{ label: '道岔', value: 'switch' },
{ label: '信号机', value: 'signal' },
{ label: '站台', value: 'station' },
{ label: '控制模式', value: 'stationConter' },
{ label: '临时全线限速', value: 'limitConter' }
],
type: 'add',
editIndex: 0,
formModel: {
code: '',
name: '',
status: '1',
remarks: ''
id: '',
simulationRole: '',
controlMode: '',
lineCode: '',
operateObject: '',
operate: '',
paramList: []
}
};
},
computed: {
form() {
const isAdd = this.type === 'ADD';
const form = {
labelWidth: '120px',
items: [
{ prop: 'controlMode', label: this.$t('system.controlMode'), type: 'text', required: true, disabled: !isAdd },
{ prop: 'deviceType', label: this.$t('system.deviceType'), type: 'select', required: true, options: this.$ConstSelect.Status },
{ prop: 'lineCode', label: this.$t('system.lineCode'), type: 'select', required: true, options: this.$ConstSelect.Status },
{ prop: 'role', label: this.$t('system.simulationRole'), type: 'select', required: true, options: this.$ConstSelect.Status },
{ prop: 'type', label: this.$t('system.instructionType'), type: 'select', required: true, options: this.$ConstSelect.Status }
{ prop: 'simulationRole', label: this.$t('system.simulationRole'), type: 'select', options: this.$ConstSelect.simulationRole },
{ prop: 'controlMode', label: this.$t('system.controlMode'), type: 'select', options: this.$ConstSelect.controlMode },
{ prop: 'lineCode', label: this.$t('system.lineCode'), type: 'select', options: this.taskStatusList },
{ prop: 'operateObject', label: this.$t('system.deviceType'), type: 'select', options: this.deviceTypeList, change: true, onChange: this.deviceChange },
{ prop: 'operate', label: this.$t('system.instructionType'), type: 'text' }
]
};
return form;
@ -50,82 +83,137 @@ export default {
controlMode: [
{ required: true, message: this.$t('rules.pleaseSelectStatus'), trigger: 'change' }
],
deviceType: [
operateObject: [
{ required: true, message: this.$t('rules.pleaseSelectStatus'), trigger: 'change' }
],
lineCode: [
{ required: true, message: this.$t('rules.pleaseSelectStatus'), trigger: 'change' }
],
role: [
simulationRole: [
{ required: true, message: this.$t('rules.pleaseSelectStatus'), trigger: 'change' }
],
type: [
operate: [
{ required: true, message: this.$t('rules.pleaseSelectStatus'), trigger: 'change' }
]
};
}
},
title() {
if (this.type === 'ADD') {
return this.$t('system.createDirective');
} else {
return this.$t('system.editDirective');
}
}
mounted () {
this.loadInitData();
this.init();
},
methods: {
show(id) {
this.dialogVisible = true;
if (id) {
getData(id).then(response => {
this.formModel = response.data;
this.$refs.dataform.resetForm();
async loadInitData() {
try {
this.taskStatusList = [];
const list = await getLineCodeList();
list.data.forEach(elem => {
elem.value = elem.code;
elem.label = elem.name;
});
this.taskStatusList = list.data;
} catch (error) {
console.log(error);
}
},
init() {
this.type = this.$route.query.type;
if (this.$route.query.id) {
getCommandDetail(this.$route.query.id).then(res => {
this.formModel = res.data;
});
}
},
deviceChange(code) {
console.log(code);
},
doSave() {
const self = this;
this.$refs.dataform.validateForm(() => {
if (self.type === 'ADD') {
self.create();
if (this.type == 'add') {
this.create();
} else {
self.update();
this.update();
}
});
},
create() {
const self = this;
create(this.formModel).then(response => {
self.$message.success(this.$t('system.createSuccess'));
self.handleClose();
self.$emit('reloadTable');
createCommand(this.formModel).then(response => {
this.$message.success(this.$t('system.createSuccess'));
this.handleBack();
}).catch(error => {
self.$message.error(`${this.$t('error.createDictionaryFailed')}:${error.message}`);
console.log(error);
this.$message.error('创建指令失败');
});
},
update() {
const self = this;
update(this.formModel).then(response => {
self.$message.success(this.$t('system.updateSuccess'));
self.handleClose();
self.$emit('reloadTable');
editCommand(this.formModel).then(response => {
this.$message.success(this.$t('system.updateSuccess'));
this.handleBack();
}).catch(error => {
self.$message.error(`${this.$t('error.updateDictionaryFailed')}:${error.message}`);
console.log(error);
this.$message.error('更新指令失败');
});
},
handleClose(done) {
this.formModel = {
code: '',
name: '',
status: '1',
remarks: ''
};
this.$refs.dataform.resetForm();
if (done) {
done();
} else {
this.dialogVisible = false;
}
handleBack() {
this.$router.push({ path: `/system/commands`, query: { } });
},
back() {
this.$router.go(-1);
},
editData(data) {
this.formModel.paramList.splice(this.editIndex, 1, data);
},
addData(data) {
this.formModel.paramList.push(data);
},
addParam() {
this.$refs.create.doShow();
},
editParam(index, row) {
this.$refs.edit.doShow(row);
this.editIndex = index;
},
delParam(index) {
this.formModel.paramList.splice(index, 1);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.dictionary_box{
margin: 40px auto 20px;
width: 800px;
.joylink-card{
padding: 24px;
.param-title{
width: 120px;
text-align: right;
float: left;
font-size: 14px;
color: #606266;
line-height: 40px;
padding: 0 12px 0 0;
box-sizing: border-box;
font-weight: 700;
}
.param-table{
width: calc(100% - 190px);
min-height: 200px;
float: left;
}
.button-box{
float: left;
margin-left: 10px;
}
}
.dialog-footer{
margin: 20px auto;
display: flex;
justify-content: center;
}
}
</style>

View File

@ -0,0 +1,108 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="400px" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: 'DictionaryEdit',
props: {
type: {
type: String,
required: true
}
},
data() {
return {
dialogVisible: false,
formModel: {
id: '',
name: ''
// pattern: '',
// val: ''
}
};
},
computed: {
form() {
const form = {
labelWidth: '100px',
items: [
{ prop: 'name', label: '参数名', type: 'text' }
// { prop: 'pattern', label: '', type: 'text' },
// { prop: 'val', label: '', type: 'text' }
]
};
return form;
},
rules() {
return {
// pattern: [
// { required: true, message: '', trigger: 'blur' }
// ],
name: [
{ required: true, message: '请输入内容', trigger: 'blur' }
]
// val: [
// { required: true, message: '', trigger: 'blur' }
// ]
};
},
title() {
if (this.type === 'ADD') {
return this.$t('system.createDirectory');
} else {
return this.$t('system.editDictionary');
}
}
},
methods: {
doShow(data) {
this.dialogVisible = true;
if (data) {
this.formModel = {
name: data.name,
pattern: data.pattern,
val: data.val
};
}
},
doSave() {
const self = this;
this.$refs.dataform.validateForm(() => {
if (self.type === 'ADD') {
self.create();
} else {
self.update();
}
});
},
getData() {
return {
id: this.formModel.id,
name: this.formModel.name
// pattern: this.formModel.pattern,
// val: this.formModel.val
};
},
create() {
this.$emit('addData', this.getData());
this.handleClose();
},
update() {
this.$emit('editData', this.getData());
this.handleClose();
},
handleClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false;
}
}
};
</script>

View File

@ -1,24 +1,28 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<dictionary-edit ref="create" type="ADD" @reloadTable="reloadTable" />
<dictionary-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
</div>
</template>
<script>
import { getCommandList, delCommand } from '@/api/management/dictionary';
import { listPublishMap } from '@/api/jmap/map';
import DictionaryEdit from './edit';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'CommandDictionary',
components: {
DictionaryEdit
},
data() {
return {
taskStatusList: [],
deviceTypeList: [
{ label: '区段', value: 'section' },
{ label: '道岔', value: 'switch' },
{ label: '信号机', value: 'signal' },
{ label: '站台', value: 'station' },
{ label: '控制模式', value: 'stationConter' },
{ label: '临时全线限速', value: 'limitConter' }
],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -34,7 +38,7 @@ export default {
data: []
}
},
deviceType: {
operateObject: {
type: 'select',
label: this.$t('system.deviceType'),
config: {
@ -48,38 +52,50 @@ export default {
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('system.controlMode'), //
prop: 'controlMode'
},
{
title: this.$t('system.deviceType'), //
prop: 'deviceType'
},
{
title: this.$t('system.lineCode'), // 线
prop: 'lineCode',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.lineCode, this.taskStatusList, ['lineCode', 'name']); },
columnValue: (row) => { return this.$convertField(row.lineCode, this.taskStatusList, ['code', 'name']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.controlMode'), //
prop: 'controlMode',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.controlMode, this.$ConstSelect.controlMode, ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.simulationRole'), // 仿
prop: 'role'
prop: 'simulationRole',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.simulationRole, this.$ConstSelect.simulationRole, ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.deviceType'), //
prop: 'operateObject',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.operateObject, this.deviceTypeList, ['value', 'label']); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.instructionType'), //
prop: 'type'
prop: 'operate'
},
{
title: this.$t('system.parameterName'), //
prop: 'paramList',
type: 'tagMore',
columnValue: (row) => { return this.replace(row.paramList); },
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: this.$t('system.paramDetail'),
handleClick: this.handleDetail
},
{
name: this.$t('global.edit'),
handleClick: this.handleEdit
@ -109,10 +125,13 @@ export default {
try {
this.taskStatusList = [];
this.mapList = [];
const list = await listPublishMap();
const list = await getLineCodeList();
this.taskStatusList = list.data;
list.data.forEach(elem => {
this.queryForm.queryObject.lineCode.config.data.push({ value: elem.lineCode, label: elem.name });
this.queryForm.queryObject.lineCode.config.data.push({ value: elem.code, label: elem.name });
});
this.deviceTypeList.forEach(elem => {
this.queryForm.queryObject.operateObject.config.data.push(elem);
});
} catch (error) {
console.log(error);
@ -126,19 +145,23 @@ export default {
return getCommandList(params);
},
handleDetail(index, row) {
console.log(index, row);
replace(fieldValue) {
const arr = [];
if (fieldValue && fieldValue.length) {
fieldValue.forEach((v, j) => {
if (v.name) {
arr.push(v.name);
}
});
}
return arr;
},
handleEdit(index, row) {
console.log(index, row);
// this.$refs.edit.show(row.id);
this.$router.push({ path: `/system/commands/Detail`, query: { type: 'edit', id: row.id } });
},
handleAdd() {
this.$refs.create.show();
this.$router.push({ path: `/system/commands/Detail`, query: { type: 'add' } });
},
handleDelete(index, row) {
this.$confirm(this.$t('system.wellDelType'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
@ -154,7 +177,6 @@ export default {
});
});
},
reloadTable() {
this.queryList.reload();
}

View File

@ -83,6 +83,7 @@ module.exports = {
'nprogress': 'NProgress',
'echarts': 'echarts',
'element-ui': 'ELEMENT'
// 'sockjs': 'sockjs'
};
},