desc: 增加屏蔽门list

This commit is contained in:
zyy 2019-11-19 17:48:32 +08:00
parent 6ab6f83ae8
commit f3798aa2c9
4 changed files with 138 additions and 17 deletions

View File

@ -1,13 +1,56 @@
<template> <template>
<div style="height: 100%;"> <div style="height: 100%;">
22222 <div style="height: calc(100% - 46px);">
<template v-if="!display">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="form" :model="editModel" label-width="120px" size="mini">
<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"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="editModel.name" />
</el-form-item>
<el-form-item label="所属站台" prop="stationStandCode">
<el-select v-model="editModel.stationStandCode" disabled>
<el-option
v-for="item in stationStandList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
</el-form>
</el-scrollbar>
</template>
<template v-if="display">
<div style="text-align: center;padding-top: 20px;">暂无数据</div>
</template>
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="create">批量创建</el-button>
<el-button type="danger" size="small" @click="editObject">修改</el-button>
</el-button-group>
</div>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import { deepAssign } from '@/utils/index';
import { getUID } from '@/jmap/utils/Uid';
export default { export default {
name: 'ParkOperate', name: 'SafetyDoorOperate',
components: { components: {
}, },
props: { props: {
mapInfo: { mapInfo: {
@ -25,10 +68,87 @@ export default {
}, },
data() { data() {
return { return {
display: true,
editModel: {
code: '',
name: '',
stationCode: '',
stationStandCode: ''
}
}; };
}, },
computed: {
...mapGetters('map', [
'map',
'parkStandList',
'stationStandList'
])
},
watch: {
'$store.state.map.map': function(val) {
if (val) {
this.init();
}
}
},
mounted () {
this.init();
},
methods: { methods: {
init() {
this.display = true;
const mapObject = this.map;
if (mapObject) {
if (mapObject.parkStandList && mapObject.parkStandList.length) {
this.display = false;
} else {
mapObject.parkStandList = [];
}
}
},
deviceChange(code) {
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
deviceSelect(selected) {
this.$refs.form && this.$refs.form.resetFields();
if (selected && selected._type.toUpperCase() === 'ESP'.toUpperCase()) {
this.editModel = deepAssign(this.editModel, selected);
}
},
editObject() {
console.log(this.editModel, 111);
},
hasPSD(data) {
let falg = false;
this.map.parkStandList.forEach(item => {
if (item.stationStandCode == data.code) {
falg = true;
}
});
return falg;
},
create() {
const arr = [];
this.map.stationStandList.forEach(item => {
if (item.visible && item.hasDoor && !this.hasPSD(item)) {
arr.push({
_type: 'ESP',
code: getUID('ESP'),
name: getUID('ESP'),
stationCode: item.stationCode,
stationStandCode: item.code
});
}
});
if (arr.length) {
this.display = false;
this.$message('创建完成');
this.$store.dispatch('map/updateMapStandData', {models: arr, type: 'parkStandList'});
this.deviceSelect();
} else {
this.$message('暂无车站');
}
}
} }
}; };
</script> </script>

View File

@ -3,8 +3,8 @@
<div style="height: calc(100% - 46px);"> <div style="height: calc(100% - 46px);">
<template v-if="!display"> <template v-if="!display">
<el-scrollbar wrap-class="scrollbar-wrapper"> <el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="form" :model="editModel" label-width="120px" size="mini"> <el-form ref="ruleForm" :model="editModel" label-width="120px" size="mini">
<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 safetyDoorList"
@ -14,7 +14,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="名" prop="name"> <el-form-item label="名" prop="name">
<el-input v-model="editModel.name" /> <el-input v-model="editModel.name" />
</el-form-item> </el-form-item>
<el-form-item label="所属站台" prop="stationStandCode"> <el-form-item label="所属站台" prop="stationStandCode">
@ -110,7 +110,7 @@ export default {
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code)); this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
}, },
deviceSelect(selected) { deviceSelect(selected) {
this.$refs.form.resetFields(); this.$refs.ruleForm && this.$refs.ruleForm.resetFields();
if (selected && selected._type.toUpperCase() === 'PSD'.toUpperCase()) { // ESP if (selected && selected._type.toUpperCase() === 'PSD'.toUpperCase()) { // ESP
this.editModel = deepAssign(this.editModel, selected); this.editModel = deepAssign(this.editModel, selected);
} }
@ -144,6 +144,7 @@ export default {
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: 'safetyDoorList'});
this.deviceSelect();
} else { } else {
this.$message('暂无车站'); this.$message('暂无车站');
} }

View File

@ -71,7 +71,7 @@ export default {
formModel: { formModel: {
id: '', id: '',
simulationRole: '', simulationRole: '',
controlMode: '', controlMode: [],
lineCode: '', lineCode: '',
operateObject: '', operateObject: '',
operate: '', operate: '',
@ -87,7 +87,7 @@ export default {
items: [ items: [
{ prop: 'lineCode', label: this.$t('system.lineCode'), type: 'select', options: this.taskStatusList }, { prop: 'lineCode', label: this.$t('system.lineCode'), type: 'select', options: this.taskStatusList },
{ prop: 'simulationRole', label: this.$t('system.simulationRole'), type: 'select', options: this.$ConstSelect.simulationRole }, { 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: 'controlMode', label: this.$t('system.controlMode'), type: 'select', options: this.$ConstSelect.controlMode, multiple: true },
{ prop: 'operateObject', label: this.$t('system.deviceType'), type: 'select', options: this.$ConstSelect.deviceTypeList, change: true, onChange: this.deviceChange }, { prop: 'operateObject', label: this.$t('system.deviceType'), type: 'select', options: this.$ConstSelect.deviceTypeList, change: true, onChange: this.deviceChange },
{ prop: 'operate', label: this.$t('system.instructionType'), type: 'select', options: this.operateList } { prop: 'operate', label: this.$t('system.instructionType'), type: 'select', options: this.operateList }
] ]

View File

@ -56,13 +56,6 @@ export default {
columnValue: (row) => { return this.$convertField(row.lineCode, this.taskStatusList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.lineCode, this.taskStatusList, ['code', 'name']); },
tagType: (row) => { return 'success'; } 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'), // 仿 title: this.$t('system.simulationRole'), // 仿
prop: 'simulationRole', prop: 'simulationRole',
@ -70,6 +63,13 @@ export default {
columnValue: (row) => { return this.$convertField(row.simulationRole, this.$ConstSelect.simulationRole, ['value', 'label']); }, columnValue: (row) => { return this.$convertField(row.simulationRole, this.$ConstSelect.simulationRole, ['value', 'label']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{
title: this.$t('system.controlMode'), //
prop: 'controlMode',
type: 'tagMore',
columnValue: (row) => { return this.$convertField(row.controlMode, this.$ConstSelect.controlMode, ['value', 'label'], true); },
tagType: (row) => { return 'success'; }
},
{ {
title: this.$t('system.deviceType'), // title: this.$t('system.deviceType'), //
prop: 'operateObject', prop: 'operateObject',
@ -149,7 +149,7 @@ export default {
return getCommandList(params); return getCommandList(params);
}, },
convertField(fieldValue, operateObject, converFormat) { convertField(fieldValue, operateObject, converFormat) {
if (Commands) { if (Commands && Commands[operateObject]) {
const enumList = Object.values(Commands[operateObject]); const enumList = Object.values(Commands[operateObject]);
if (enumList && converFormat && converFormat.length >= 2) { if (enumList && converFormat && converFormat.length >= 2) {
const value = converFormat[0]; const value = converFormat[0];