ibp盘计轴复位

This commit is contained in:
fan 2021-02-23 13:04:29 +08:00
parent a432cfc632
commit 069c1b7203
5 changed files with 60 additions and 13 deletions

View File

@ -264,3 +264,10 @@ export function getSectionListByStationCode(id, stationCode) {
method: 'get' method: 'get'
}); });
} }
/** 查询地图下所有的区段 */
export function getSectionListByMapId(id) {
return request({
url: `/api/map/${id}/sections`,
method: 'get'
});
}

View File

@ -221,9 +221,9 @@ export function executeScriptNew(group) {
} }
/** 处理ibp盘事件 */ /** 处理ibp盘事件 */
export function handlerIbpEvent(group, button, stationCode) { export function handlerIbpEvent(group, button, stationCode, buttonCode) {
return request({ return request({
url: `/simulation/${group}/ibp/${button}?stationCode=${stationCode}`, url: `/simulation/${group}/ibp/${button}?stationCode=${stationCode}&buttonCode=${buttonCode}`,
method: 'put' method: 'put'
}); });
} }

View File

@ -119,7 +119,8 @@ export const IbpOperation = {
XXKM: {operate: '08', event: 'XXKM', name: '下行屏蔽门开门'}, XXKM: {operate: '08', event: 'XXKM', name: '下行屏蔽门开门'},
SXKM: {operate: '10', event: 'SXKM', name: '上行屏蔽门开门'}, SXKM: {operate: '10', event: 'SXKM', name: '上行屏蔽门开门'},
XXYS: {operate: '09', event: 'XXYS', name: '下行钥匙'}, XXYS: {operate: '09', event: 'XXYS', name: '下行钥匙'},
SXYS: {operate: '11', event: 'SXYS', name: '上行钥匙'} SXYS: {operate: '11', event: 'SXYS', name: '上行钥匙'},
PRERESET: {operate: '12', event: 'PRERESET', name: '计轴复位'}
}; };
/** /**

View File

@ -34,6 +34,16 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="form.mean === 'PRERESET'" label="关联区段">
<el-select v-model="form.sectionCode" placeholder="请选择">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + '(' + item.code +')'"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button> <el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" type="danger" @click="deleteDevice">{{ $t('global.delete') }}</el-button> <el-button v-show="showDeleteButton" type="danger" @click="deleteDevice">{{ $t('global.delete') }}</el-button>
@ -44,6 +54,7 @@
</template> </template>
<script> <script>
import {getSectionListByStationCode, getSectionListByMapId } from '@/api/jmap/map';
export default { export default {
name: 'ButtonDraft', name: 'ButtonDraft',
components: { components: {
@ -62,14 +73,17 @@ export default {
{ label: '取消紧急停车', value: 'QXJJTC' }, { label: '取消紧急停车', value: 'QXJJTC' },
{ label: '报警切除', value: 'BJQC' }, { label: '报警切除', value: 'BJQC' },
{ label: '下行屏蔽门开门', value: 'XXKM' }, { label: '下行屏蔽门开门', value: 'XXKM' },
{ label: '上行屏蔽门开门', value: 'SXKM' } { label: '上行屏蔽门开门', value: 'SXKM' },
{ label: '计轴复位', value: 'PRERESET' }
], ],
form: { form: {
code: '', code: '',
buttonColor: 'red', buttonColor: 'red',
buttonWidth: 25, buttonWidth: 25,
x: 10, x: 10,
y: 10 y: 10,
sectionCode: '',
mean: ''
}, },
rules: { rules: {
code: [ code: [
@ -81,7 +95,8 @@ export default {
buttonWidth: [ buttonWidth: [
{ required: true, message: this.$t('ibp.enterTheButtonWidth'), trigger: 'blur' } { required: true, message: this.$t('ibp.enterTheButtonWidth'), trigger: 'blur' }
] ]
} },
sectionList: []
}; };
}, },
computed: { computed: {
@ -100,12 +115,31 @@ export default {
this.form.x = model.point.x; this.form.x = model.point.x;
this.form.y = model.point.y; this.form.y = model.point.y;
this.form.mean = model.mean; this.form.mean = model.mean;
this.form.sectionCode = model.sectionCode;
} }
} }
}, },
mounted() { mounted() {
if (this.$route.query.stationCode) {
getSectionListByStationCode(this.$route.query.mapId, this.$route.query.stationCode).then(resp => {
this.sectionList = resp.data;
console.log(resp.data);
}).catch(() => {
this.$message.error('获取区段列表失败!');
});
} else {
getSectionListByMapId(this.$route.query.mapId).then(resp => {
this.sectionList = resp.data;
console.log(resp.data);
}).catch(() => {
this.$message.error('获取区段列表失败!');
});
}
}, },
methods: { methods: {
// consoleChange() {
// console.log(this.form.mean === 'PRERESET', this.form.mean );
// },
onSubmit(form) { onSubmit(form) {
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid) { if (valid) {
@ -119,7 +153,8 @@ export default {
color: this.form.buttonColor, color: this.form.buttonColor,
status: 'off', status: 'off',
width: this.form.buttonWidth, width: this.form.buttonWidth,
mean: this.form.mean mean: this.form.mean,
sectionCode: this.form.sectionCode
}; };
this.$emit('createData', buttonModel); this.$emit('createData', buttonModel);
this.initPage(); this.initPage();
@ -139,7 +174,8 @@ export default {
color: this.form.buttonColor, color: this.form.buttonColor,
status: 'off', status: 'off',
width: this.form.buttonWidth, width: this.form.buttonWidth,
mean: this.form.mean mean: this.form.mean,
sectionCode: this.form.sectionCode
}; };
this.$emit('deleteDataModel', buttonModel ); this.$emit('deleteDataModel', buttonModel );
this.initPage(); this.initPage();
@ -154,7 +190,8 @@ export default {
buttonWidth: 25, buttonWidth: 25,
x: 10, x: 10,
y: 10, y: 10,
mean: '' mean: '',
sectionCode: ''
}; };
}, },
generateCode() { generateCode() {

View File

@ -229,10 +229,12 @@ export default {
}, },
onMouseDown(em) { onMouseDown(em) {
if (em.deviceModel.mean) { if (em.deviceModel.mean && IbpOperation[em.deviceModel.mean] && em.deviceModel.mean === IbpOperation.PRERESET.event) {
if (IbpOperation[em.deviceModel.mean]) { handlerIbpEvent(this.$route.query.group, IbpOperation[em.deviceModel.mean].event, this.stationCode, em.deviceModel.sectionCode).then(() => {
handlerIbpEvent(this.$route.query.group, IbpOperation[em.deviceModel.mean].event, this.stationCode); }).catch(error => { this.$message.error(error.message); });
} } else if ( em.deviceModel.mean && IbpOperation[em.deviceModel.mean]) {
handlerIbpEvent(this.$route.query.group, IbpOperation[em.deviceModel.mean].event, this.stationCode).then(() => {
}).catch(error => { this.$message.error(error.message); });
} }
}, },
// //