代码调整

This commit is contained in:
joylink_cuiweidong 2022-12-06 15:05:53 +08:00
parent e727a1c338
commit 6d7ef0d42b
2 changed files with 39 additions and 116 deletions

View File

@ -21,16 +21,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="关联地图:" prop="mapId">
<el-select v-model="formIbp.mapId" placeholder="请选择" size="small" @change="mapIdChange">
<el-option
v-for="item in mapList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="关联角色:" prop="roleCode">
<el-select v-model="formIbp.roleCode" placeholder="请选择" size="small">
<el-option
@ -53,16 +43,6 @@
</el-form-item>
</el-form>
<el-form v-show="['IM','CW','DRIVE','DEPOT'].includes(data.type)" ref="formIm" :model="formIm" label-width="100px" :rules="rulesIm">
<el-form-item label="关联地图:" prop="mapId">
<el-select v-model="formIm.mapId" placeholder="请选择" size="small" filter @change="mapIdChange">
<el-option
v-for="item in mapList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="关联角色:" prop="roleCode">
<el-select v-model="formIm.roleCode" placeholder="请选择" size="small">
<el-option
@ -85,16 +65,6 @@
</el-form-item>
</el-form>
<el-form v-show="data.type === 'LW'" ref="formLw" :model="formLw" label-width="100px" :rules="rulesLw">
<el-form-item label="关联地图:" prop="mapId">
<el-select v-model="formLw.mapId" placeholder="请选择" size="small" @change="mapIdChange">
<el-option
v-for="item in mapList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="关联车站:" prop="stationCode">
<el-select v-model="formLw.stationCode" placeholder="请选择" size="small">
<el-option
@ -147,16 +117,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="关联地图:" prop="mapId">
<el-select v-model="formIscs.mapId" placeholder="请选择" size="small" @change="mapIdChange">
<el-option
v-for="item in mapList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="车站" prop="stationCode">
<el-select v-model="formIscs.stationCode" placeholder="请选择" size="small" clearable>
<el-option
@ -197,7 +157,7 @@
<script>
import { getDeviceDetail, getDevicesByType, setDeviceConfig } from '@/api/project';
import { getAllMapOnline, getPublishMapListOnline, querySimulationMemberByMapId, querySimulationStationsByMapId } from '@/api/jmap/map';
import { getAllMapOnline, querySimulationMemberByMapId, querySimulationStationsByMapId } from '@/api/jmap/map';
import { getBackProjectConfigByCode } from '@/api/projectConfig';
import { getMapFunctioById } from '@/api/trainingPlatform';
import ConstConfig from '@/scripts/ConstConfig';
@ -211,19 +171,16 @@ export default {
roleList:[],
lwList: [],
formIm:{
mapId:'',
roleCode:'',
client:''
},
formIbp: {
part: '',
deviceCode: '',
mapId: '',
roleCode:'',
client:''
},
formLw: {
mapId: '',
stationCode: '',
roleCode:'',
client:''
@ -231,7 +188,6 @@ export default {
formIscs: {
deviceCode: '',
picture: '',
mapId: '',
stationCode: '',
roleCode:'',
client:''
@ -316,7 +272,7 @@ export default {
},
doShow(row) {
this.initData(row);
this.dialogVisible = true;
this.data = row;
this.mapList = [];
this.stationList = [];
@ -337,17 +293,14 @@ export default {
this.$message.error('获取设备列表失败!');
});
}
getPublishMapListOnline().then(res => {
if (res.data && res.data.length) {
this.mapList = res.data;
// this.formLw.mapId = this.mapList[0].id;
// this.mapIdChange(this.mapList[0].id);
if (this.formIm.mapId) { this.mapIdChange(this.formIm.mapId); }
if (this.formLw.mapId) { this.mapIdChange(this.formLw.mapId); }
if (this.formIbp.mapId) { this.mapIdChange(this.formLw.mapId); }
getBackProjectConfigByCode(row.project).then(res=>{
const data = res.data;
this.dialogVisible = true;
if (data.functionId) {
if (data.mapId) { this.mapIdChange(data.mapId, data.functionId); }
} else {
this.$message.error('请先配置项目信息');
}
}).catch(() => {
this.$message.error('获取地图列表失败!');
});
},
doSave() {
@ -425,7 +378,7 @@ export default {
this.$refs.formLw.resetFields();
this.$refs.formIscs.resetFields();
},
mapIdChange(mapId) {
mapIdChange(mapId, functionId) {
if (mapId) {
// const stationResp = await querySimulationStationsByMapId(this.$route.query.mapId);
querySimulationStationsByMapId(mapId).then(resp => {
@ -437,10 +390,6 @@ export default {
});
querySimulationMemberByMapId(mapId).then(resp => {
if (resp.data) {
getBackProjectConfigByCode(this.data.project).then(res=>{
if (res.data) {
const functionId = res.data.functionId;
if (functionId) {
getMapFunctioById(functionId).then(response=>{
if (resp.data) {
const roleList = resp.data[response.data.simType];
@ -452,11 +401,6 @@ export default {
this.roleList = covertRoleList;
}
});
} else {
this.$message.error('请先配置项目信息');
}
}
});
}
}).catch(() => {
this.$message.error('获取角色列表失败');

View File

@ -45,16 +45,6 @@
<el-input v-model="jsonConfig" autosize type="textarea" />
<el-form v-show="['PIS_STAND','PIS_TRAIN'].includes(data.type)" ref="formPis" :model="formPis" label-width="100px" :rules="rulesPis" style="margin-top:10px">
<!-- -->
<el-form-item label="关联地图:" prop="mapId">
<el-select v-model="formPis.mapId" placeholder="请选择" size="small" @change="mapIdChange">
<el-option
v-for="item in mapList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="关联角色:" prop="roleCode">
<el-select v-model="formPis.roleCode" placeholder="请选择" size="small">
<el-option
@ -87,7 +77,7 @@
import { setDeviceConfig, getDeviceDetail } from '@/api/project';
import ConstConfig from '@/scripts/ConstConfig';
// getAllMapOnline, getStationListNeedAttendant, getPsdListByStandCode, getStandListByStationCode
import {getPublishMapListOnline, querySimulationMemberByMapId, querySimulationStationsByMapId } from '@/api/jmap/map';
import {querySimulationMemberByMapId, querySimulationStationsByMapId } from '@/api/jmap/map';
import { getBackProjectConfigByCode } from '@/api/projectConfig';
import { getMapFunctioById } from '@/api/trainingPlatform';
@ -106,7 +96,6 @@ export default {
clientList: ConstConfig.ConstSelect.clientList,
data: {},
formPis:{
mapId: '',
roleCode:'',
client:''
},
@ -123,7 +112,6 @@ export default {
PIS_TRAIN: '列车PIS',
UDP_LOW:'UDP下位机'
},
mapId: '',
mapList: [],
roleList:[],
// stationCode: '',
@ -162,20 +150,20 @@ export default {
// this.formModel = JSON.parse(resp.data.config);
const config = JSON.parse(resp.data.config);
const jsonConfig = Object.assign({}, config);
delete jsonConfig.mapId;
delete jsonConfig.roleCode;
delete jsonConfig.client;
this.jsonConfig = JSON.stringify(jsonConfig, null, 4);
if (['PIS_STAND', 'PIS_TRAIN'].includes(row.type)) {
getPublishMapListOnline().then(res => {
if (res.data && res.data.length) {
this.mapList = res.data;
if (config.mapId) { this.mapIdChange(config.mapId); this.formPis.mapId = config.mapId; }
getBackProjectConfigByCode(row.project).then(res=>{
const data = res.data;
this.dialogVisible = true;
if (config.roleCode) { this.formPis.roleCode = config.roleCode; }
if (config.client) { this.formPis.client = config.client; }
if (data.functionId) {
if (data.mapId) { this.mapIdChange(data.mapId, data.functionId); }
} else {
this.$message.error('请先配置项目信息');
}
}).catch(() => {
this.$message.error('获取地图列表失败!');
});
}
}
@ -244,7 +232,7 @@ export default {
this.dialogVisible = false;
this.$refs.form && this.$refs.form.resetFields();
},
mapIdChange(mapId) {
mapIdChange(mapId, functionId) {
if (mapId) {
querySimulationStationsByMapId(mapId).then(resp => {
if (resp.data && resp.data.length) {
@ -255,10 +243,6 @@ export default {
});
querySimulationMemberByMapId(mapId).then(resp => {
if (resp.data) {
getBackProjectConfigByCode(this.data.project).then(res=>{
if (res.data) {
const functionId = res.data.functionId;
if (functionId) {
getMapFunctioById(functionId).then(response=>{
if (resp.data) {
const roleList = resp.data[response.data.simType];
@ -270,11 +254,6 @@ export default {
this.roleList = covertRoleList;
}
});
} else {
this.$message.error('请先配置项目信息');
}
}
});
}
}).catch(() => {
this.$message.error('获取角色列表失败');