desc: 增加屏蔽门list
This commit is contained in:
parent
6ab6f83ae8
commit
f3798aa2c9
@ -1,13 +1,56 @@
|
||||
<template>
|
||||
<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>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import { getUID } from '@/jmap/utils/Uid';
|
||||
|
||||
export default {
|
||||
name: 'ParkOperate',
|
||||
name: 'SafetyDoorOperate',
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {
|
||||
mapInfo: {
|
||||
@ -25,10 +68,87 @@ export default {
|
||||
},
|
||||
data() {
|
||||
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: {
|
||||
|
||||
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>
|
||||
|
@ -3,8 +3,8 @@
|
||||
<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-form ref="ruleForm" :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 safetyDoorList"
|
||||
@ -14,7 +14,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="名字" prop="name">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="editModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属站台" prop="stationStandCode">
|
||||
@ -110,7 +110,7 @@ export default {
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
this.$refs.form.resetFields();
|
||||
this.$refs.ruleForm && this.$refs.ruleForm.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'PSD'.toUpperCase()) { // ESP
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
}
|
||||
@ -144,6 +144,7 @@ export default {
|
||||
this.display = false;
|
||||
this.$message('创建完成');
|
||||
this.$store.dispatch('map/updateMapStandData', {models: arr, type: 'safetyDoorList'});
|
||||
this.deviceSelect();
|
||||
} else {
|
||||
this.$message('暂无车站');
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ export default {
|
||||
formModel: {
|
||||
id: '',
|
||||
simulationRole: '',
|
||||
controlMode: '',
|
||||
controlMode: [],
|
||||
lineCode: '',
|
||||
operateObject: '',
|
||||
operate: '',
|
||||
@ -87,7 +87,7 @@ export default {
|
||||
items: [
|
||||
{ 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: '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: 'operate', label: this.$t('system.instructionType'), type: 'select', options: this.operateList }
|
||||
]
|
||||
|
@ -56,13 +56,6 @@ export default {
|
||||
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: 'simulationRole',
|
||||
@ -70,6 +63,13 @@ export default {
|
||||
columnValue: (row) => { return this.$convertField(row.simulationRole, this.$ConstSelect.simulationRole, ['value', 'label']); },
|
||||
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'), // 操作对象
|
||||
prop: 'operateObject',
|
||||
@ -149,7 +149,7 @@ export default {
|
||||
return getCommandList(params);
|
||||
},
|
||||
convertField(fieldValue, operateObject, converFormat) {
|
||||
if (Commands) {
|
||||
if (Commands && Commands[operateObject]) {
|
||||
const enumList = Object.values(Commands[operateObject]);
|
||||
if (enumList && converFormat && converFormat.length >= 2) {
|
||||
const value = converFormat[0];
|
||||
|
Loading…
Reference in New Issue
Block a user