添加调度台code

This commit is contained in:
dong 2022-09-30 17:26:53 +08:00
parent ace0f3d0ae
commit f9fe3ab615
4 changed files with 183 additions and 49 deletions

View File

@ -23,3 +23,11 @@ export function deleteDisStation(mapId, code) {
method: 'delete'
});
}
// 获取调度台逻辑数据
export function getDisStationList(mapId, data) {
return request({
url: `/api/draftMap/${mapId}/disStation/page`,
method: 'post',
data
});
}

View File

@ -0,0 +1,146 @@
<template>
<el-dialog v-dialogDrag :title="$t('map.routePreview')" :visible.sync="show" width="60%" :before-do-close="doClose" append-to-body>
<div>
<QueryListPage
ref="queryListPage"
style="margin-top: 10px;"
:pager-config="pagerConfig"
:query-form="queryForm"
:query-list="queryList"
/>
</div>
</el-dialog>
</template>
<script>
import { getDisStationList, deleteDisStation } from '@/api/disStation.js';
import { mapGetters } from 'vuex';
export default {
name:'BigRouteDetail',
props: {
mapInfo: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
show:false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
show:false
},
queryList: {
query: this.queryFunction,
height:'500px',
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '调度台名称',
width: 150,
prop: 'name'
},
{
title: 'code',
width: 150,
prop: 'code'
},
{
title: '下辖车站',
prop: 'stationList',
type: 'tag',
columnValue: (row) => { return this.getNameList(row.stationList); },
tagType: (row) => { return ''; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '200',
buttons: [
{
name: '删除',
handleClick: this.deleteRoute,
type: 'danger'
},
{
name: '编辑',
handleClick: this.editRouteFn,
type: 'primary'
}
]
}
]
}
};
},
computed: {
...mapGetters('map', [
'stationList'
])
},
mounted() {
},
methods:{
doShow() {
this.show = true;
this.reloadData();
},
doClose() {
this.show = false;
},
reloadData() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
queryFunction(params) {
if (this.mapInfo && this.mapInfo.id) {
return getDisStationList(this.mapInfo.id, params);
}
},
getNameList(codeList) {
const nameList = [];
codeList && codeList.forEach(item => {
nameList.push(this.formatName(item));
});
return nameList;
},
formatName(code) {
let name = '';
const device = this.$store.getters['map/getDeviceByCode'](code);
if (device) {
name = device.name || device.code;
}
return name;
},
editRouteFn(index, row) {
this.$emit('setEditDate', JSON.parse(JSON.stringify(row)));
this.doClose();
},
deleteRoute(index, row) {
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
deleteDisStation(this.mapInfo.id, row.code).then(res => {
this.$message.success('删除成功!');
this.reloadData();
this.$emit('refresh');
}).catch(err => {
console.log('删除失败!', err);
this.$message.error('删除失败!');
});
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
});
}
}
};
</script>

View File

@ -4,18 +4,20 @@
ref="routeEdit"
:selected="selected"
:map-info="mapInfo"
:route-data="routeData"
@setCenter="setCenter"
/>
<DisStationDetail ref="routeDetail" :map-info="mapInfo" @refresh="refresh" @setEditDate="setEditDate" />
</div>
</template>
<script>
import DisStationDraft from './route';
import DisStationDetail from './detail';
export default {
name: 'DisStationOperate',
components: {
DisStationDraft
DisStationDraft,
DisStationDetail
},
props: {
mapInfo: {
@ -33,21 +35,14 @@ export default {
},
data() {
return {
enabledTab: 'Route',
routeData: null,
routeList:[]
};
},
created() {
// filterRouteList() {
// return this.routeList.filter(route=>{ return !route.multiRoute; });
// } 'routeList',
},
created() {},
methods: {
setEditRouteDate(data) {
this.routeData = data;
setEditDate(data) {
this.$nextTick(() => {
this.$refs.routeEdit.setEditData();
this.$refs.routeEdit.initPage(data);
});
},
clickEvent(e, model) {
@ -67,12 +62,6 @@ export default {
});
}
},
routeSelected: function (data) {
this.routeData = data;
if (this.$refs && this.$refs.routeEdit) {
this.$refs.routeEdit.isModify = data.id;
}
},
previewRouteEvent: function () {
if (this.$refs && this.$refs.routeDetail) {
this.$refs.routeDetail.doShow();
@ -83,7 +72,7 @@ export default {
},
createRouteEvent: function () {
if (this.$refs && this.$refs.routeEdit) {
this.$refs.routeEdit.clear();
this.$refs.routeEdit.initPage();
}
},
setSelected(selected) {

View File

@ -2,7 +2,7 @@
<div class="BigRouteInfo">
<el-form ref="form" :model="editModel" :rules="rules" label-width="140px" size="mini" class="bigDefinition">
<el-form-item label="编号:">
<el-select v-model="editModel.code" clearable filterable :placeholder="$t('map.pleaseSelect')" @change="deviceChange">
<el-select v-model="editModel.code" disabled :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in disStationList"
:key="item.code"
@ -27,9 +27,8 @@
</el-form>
<div class="button_box">
<el-button-group class="button-group">
<el-button :disabled="!!editModel.code" type="success" size="small" @click="create">{{ $t('map.create') }}</el-button>
<el-button :disabled="!editModel.code" type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
<el-button :disabled="!editModel.code" type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
<el-button v-if="editModel.code" type="primary" size="small" @click="edit">更新</el-button>
<el-button v-else type="success" size="small" @click="create">保存</el-button>
</el-button-group>
</div>
@ -39,7 +38,7 @@
import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid';
import { deepAssign } from '@/utils/index';
import { createDisStation, updateDisStation, deleteDisStation } from '@/api/disStation.js';
import { createDisStation, updateDisStation } from '@/api/disStation.js';
export default {
name:'DisStationDraft',
@ -49,6 +48,12 @@ export default {
default() {
return null;
}
},
mapInfo: {
type: Object,
default() {
return null;
}
}
},
data() {
@ -83,17 +88,19 @@ export default {
return rules;
}
},
mounted() {},
mounted() {
this.initPage();
},
methods: {
deviceChange(code) {
let obj = {};
const findObj = this.disStationList.find(item => {
return item.code == code;
});
if (findObj) {
obj = deepAssign({}, findObj);
initPage(row) {
if (this.mapInfo) {
if (row) {
this.editModel = Object.assign({}, row);
} else {
this.$refs.form && this.$refs.form.resetFields();
this.editModel.code = '';
}
}
this.editModel = deepAssign(this.editModel, obj);
},
edit() {
this.$refs.form.validate((valid) => {
@ -109,22 +116,6 @@ export default {
}
});
},
deleteObj() {
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
deleteDisStation(this.mapId, this.editModel.code).then(res => {
this.$refs.form && this.$refs.form.resetFields();
}).catch(err => {
console.log('删除失败!', err);
this.$message.error('删除失败!');
});
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
});
},
create() {
this.$refs.form.validate((valid) => {
if (valid) {