代码调整
This commit is contained in:
parent
a19c95516d
commit
39b4b0b49a
@ -19,7 +19,7 @@ export default {
|
|||||||
formModel: {
|
formModel: {
|
||||||
code: '',
|
code: '',
|
||||||
type: '',
|
type: '',
|
||||||
projectCode: ''
|
project: ''
|
||||||
},
|
},
|
||||||
LessonList: [],
|
LessonList: [],
|
||||||
UserList: [],
|
UserList: [],
|
||||||
@ -35,7 +35,7 @@ export default {
|
|||||||
items: [
|
items: [
|
||||||
{ prop: 'code', label: this.$t('system.deviceCode'), type: 'text', required: true, placeholder: this.$t('rules.enterDeviceCode') },
|
{ prop: 'code', label: this.$t('system.deviceCode'), type: 'text', required: true, placeholder: this.$t('rules.enterDeviceCode') },
|
||||||
{ prop: 'type', label: this.$t('system.deviceType1'), type: 'select', required: true, options: this.deviceTypeList, placeholder: this.$t('rules.selectDeviceType') },
|
{ prop: 'type', label: this.$t('system.deviceType1'), type: 'select', required: true, options: this.deviceTypeList, placeholder: this.$t('rules.selectDeviceType') },
|
||||||
{prop: 'projectCode', label:'所属项目', type: 'select', required: true, options:ConstConfig.ConstSelect.projectList }
|
{prop: 'project', label:'所属项目', type: 'select', required: true, options:ConstConfig.ConstSelect.projectList }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
return form;
|
return form;
|
||||||
@ -48,7 +48,7 @@ export default {
|
|||||||
type: [
|
type: [
|
||||||
{ required: true, message: this.$t('rules.selectDeviceType'), trigger: 'change' }
|
{ required: true, message: this.$t('rules.selectDeviceType'), trigger: 'change' }
|
||||||
],
|
],
|
||||||
projectCode: [
|
project: [
|
||||||
{ required: true, message: '请选择所属项目', trigger: 'change' }
|
{ required: true, message: '请选择所属项目', trigger: 'change' }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@ -70,7 +70,7 @@ export default {
|
|||||||
const params = {
|
const params = {
|
||||||
code: this.formModel.code,
|
code: this.formModel.code,
|
||||||
type: this.formModel.type,
|
type: this.formModel.type,
|
||||||
projectCode: this.formModel.projectCode
|
project: this.formModel.project
|
||||||
};
|
};
|
||||||
deviceIsExist(params.code).then(response => {
|
deviceIsExist(params.code).then(response => {
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
@ -92,7 +92,7 @@ export default {
|
|||||||
this.formModel = {
|
this.formModel = {
|
||||||
code: '',
|
code: '',
|
||||||
type: '',
|
type: '',
|
||||||
projectCode: ''
|
project: ''
|
||||||
};
|
};
|
||||||
this.$refs.dataform.resetForm();
|
this.$refs.dataform.resetForm();
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
|
@ -161,9 +161,9 @@
|
|||||||
<el-select v-model="formIscs.stationCode" placeholder="请选择" size="small" clearable>
|
<el-select v-model="formIscs.stationCode" placeholder="请选择" size="small" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in stationList"
|
v-for="item in stationList"
|
||||||
:key="item.value"
|
:key="item.code"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.value"
|
:value="item.code"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -277,6 +277,12 @@ export default {
|
|||||||
rulesIscs: {
|
rulesIscs: {
|
||||||
deviceCode: [
|
deviceCode: [
|
||||||
{ required: true, message: '请选择关联设备', trigger: 'change'}
|
{ required: true, message: '请选择关联设备', trigger: 'change'}
|
||||||
|
],
|
||||||
|
roleCode: [
|
||||||
|
{ required: true, message: '请选择关联角色', trigger: 'change'}
|
||||||
|
],
|
||||||
|
client: [
|
||||||
|
{ required: true, message: '请选择关联客户端', trigger: 'change'}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
partList: [{label: '左', value: 'LEFT'}, {label: '右', value: 'RIGHT'}, {label: '全部', value: 'WHOLE'}],
|
partList: [{label: '左', value: 'LEFT'}, {label: '右', value: 'RIGHT'}, {label: '全部', value: 'WHOLE'}],
|
||||||
|
@ -43,6 +43,39 @@
|
|||||||
<!--</el-form-item>-->
|
<!--</el-form-item>-->
|
||||||
<!--</el-form>-->
|
<!--</el-form>-->
|
||||||
<el-input v-model="jsonConfig" autosize type="textarea" />
|
<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
|
||||||
|
v-for="item in roleList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="关联客户端:" prop="client">
|
||||||
|
<el-select v-model="formPis.client" placeholder="请选择" size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="item in clientList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||||
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
|
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
|
||||||
@ -52,7 +85,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { setDeviceConfig, getDeviceDetail } from '@/api/project';
|
import { setDeviceConfig, getDeviceDetail } from '@/api/project';
|
||||||
import { getAllMapOnline, getStationListNeedAttendant, getPsdListByStandCode, getStandListByStationCode } from '@/api/jmap/map';
|
import ConstConfig from '@/scripts/ConstConfig';
|
||||||
|
// getAllMapOnline, getStationListNeedAttendant, getPsdListByStandCode, getStandListByStationCode
|
||||||
|
import {getPublishMapListOnline, querySimulationMemberByMapId } from '@/api/jmap/map';
|
||||||
|
import { getBackProjectConfigByCode } from '@/api/projectConfig';
|
||||||
|
import { getMapFunctioById } from '@/api/trainingPlatform';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'EditConfigGateway',
|
name: 'EditConfigGateway',
|
||||||
@ -60,13 +97,19 @@ export default {
|
|||||||
return {
|
return {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
inline: true,
|
inline: true,
|
||||||
formModel: {},
|
// formModel: {},
|
||||||
formLeft: {},
|
// formLeft: {},
|
||||||
formRight: {},
|
// formRight: {},
|
||||||
leftRules: {},
|
// leftRules: {},
|
||||||
rightRules: {},
|
// rightRules: {},
|
||||||
setDeviceConfigFunction: null,
|
// setDeviceConfigFunction: null,
|
||||||
|
clientList: ConstConfig.ConstSelect.clientList,
|
||||||
data: {},
|
data: {},
|
||||||
|
formPis:{
|
||||||
|
mapId: '',
|
||||||
|
roleCode:'',
|
||||||
|
client:''
|
||||||
|
},
|
||||||
titleMap: {
|
titleMap: {
|
||||||
SWITCH: '道岔',
|
SWITCH: '道岔',
|
||||||
PSD:'屏蔽门',
|
PSD:'屏蔽门',
|
||||||
@ -82,12 +125,21 @@ export default {
|
|||||||
},
|
},
|
||||||
mapId: '',
|
mapId: '',
|
||||||
mapList: [],
|
mapList: [],
|
||||||
stationCode: '',
|
roleList:[],
|
||||||
stationList: [],
|
// stationCode: '',
|
||||||
standList: [],
|
// stationList: [],
|
||||||
standCode: '',
|
// standList: [],
|
||||||
psdList: [],
|
// standCode: '',
|
||||||
jsonConfig: ''
|
// psdList: [],
|
||||||
|
jsonConfig: '',
|
||||||
|
rulesLw: {
|
||||||
|
roleCode: [
|
||||||
|
{ required: true, message: '请选择关联角色', trigger: 'change'}
|
||||||
|
],
|
||||||
|
client: [
|
||||||
|
{ required: true, message: '请选择关联客户端', trigger: 'change'}
|
||||||
|
]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -107,36 +159,49 @@ export default {
|
|||||||
this.jsonConfig = '{}';
|
this.jsonConfig = '{}';
|
||||||
getDeviceDetail(row.id).then(resp => {
|
getDeviceDetail(row.id).then(resp => {
|
||||||
if (resp.data.config) {
|
if (resp.data.config) {
|
||||||
this.formModel = JSON.parse(resp.data.config);
|
// this.formModel = JSON.parse(resp.data.config);
|
||||||
this.jsonConfig = JSON.stringify(JSON.parse(resp.data.config), null, 4);
|
this.jsonConfig = JSON.stringify(JSON.parse(resp.data.config), null, 4);
|
||||||
}
|
}
|
||||||
}).catch((e)=> {
|
}).catch((e)=> {
|
||||||
this.$message.error('获取项目设备详情失败!');
|
this.$message.error('获取项目设备详情失败!');
|
||||||
});
|
});
|
||||||
if (row.type === 'PSL' || row.type === 'PSC') {
|
// if (row.type === 'PSL' || row.type === 'PSC') {
|
||||||
getAllMapOnline().then(resp => {
|
// getAllMapOnline().then(resp => {
|
||||||
if (resp.data && resp.data.length) {
|
// if (resp.data && resp.data.length) {
|
||||||
this.mapList = resp.data;
|
// this.mapList = resp.data;
|
||||||
this.mapId = this.mapList[0].id;
|
// this.mapId = this.mapList[0].id;
|
||||||
this.mapIdChange(this.mapList[0].id);
|
// this.mapIdChange(this.mapList[0].id);
|
||||||
}
|
// }
|
||||||
}).catch(() => {
|
// }).catch(() => {
|
||||||
this.$message.error('获取地图列表失败');
|
// this.$message.error('获取地图列表失败');
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
doShow(row) {
|
doShow(row) {
|
||||||
this.initData(row);
|
this.initData(row);
|
||||||
// this.initForm(row);
|
// this.initForm(row);
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
this.data = row;
|
this.data = row;
|
||||||
|
if (['PIS_STAND', 'PIS_TRAIN'].includes(row.type)) {
|
||||||
|
getPublishMapListOnline().then(res => {
|
||||||
|
if (res.data && res.data.length) {
|
||||||
|
this.mapList = res.data;
|
||||||
|
if (this.data.mapId) { this.mapIdChange(this.data.mapId); this.formPis.mapId = this.data.mapId; }
|
||||||
|
if (this.data.roleCode) { this.formPis.roleCode = this.data.roleCode; }
|
||||||
|
if (this.data.client) { this.formPis.client = this.data.client; }
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message.error('获取地图列表失败!');
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
doSave() {
|
doSave() {
|
||||||
const self = this;
|
const self = this;
|
||||||
let flag = true;
|
let flag = true;
|
||||||
if (this.$refs.form) {
|
if (this.$refs.formPis) {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.formPis.validate((valid) => {
|
||||||
flag = valid;
|
flag = valid;
|
||||||
|
this.jsonConfig = Object.assign(this.jsonConfig, this.formPis);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// const form = JSON.parse(this.jsonConfig);
|
// const form = JSON.parse(this.jsonConfig);
|
||||||
@ -161,54 +226,82 @@ export default {
|
|||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.formModel = {};
|
// this.formModel = {};
|
||||||
this.data = {};
|
this.data = {};
|
||||||
this.mapList = [];
|
this.mapList = [];
|
||||||
this.stationList = [];
|
// this.stationList = [];
|
||||||
this.standList = [];
|
// this.standList = [];
|
||||||
this.psdList = [];
|
// this.psdList = [];
|
||||||
this.mapId = '';
|
this.mapId = '';
|
||||||
this.stationCode = '';
|
// this.stationCode = '';
|
||||||
this.standCode = '';
|
// this.standCode = '';
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
this.$refs.form && this.$refs.form.resetFields();
|
this.$refs.form && this.$refs.form.resetFields();
|
||||||
},
|
},
|
||||||
mapIdChange(mapId) {
|
mapIdChange(mapId) {
|
||||||
this.stationList = [];
|
|
||||||
if (mapId) {
|
if (mapId) {
|
||||||
getStationListNeedAttendant(mapId).then(resp => {
|
querySimulationMemberByMapId(mapId).then(resp => {
|
||||||
if (resp.data && resp.data.length) {
|
if (resp.data) {
|
||||||
this.stationList = 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];
|
||||||
|
const covertRoleList = [];
|
||||||
|
roleList.forEach(member => {
|
||||||
|
const data = this.handleMember(member, this.stationList);
|
||||||
|
covertRoleList.push(data);
|
||||||
|
});
|
||||||
|
this.roleList = covertRoleList;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message.error('请先配置项目信息');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
|
||||||
this.$message.error('获取车站列表失败');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
|
||||||
stationCodeChange(stationCode) {
|
|
||||||
this.standList = [];
|
|
||||||
if (stationCode) {
|
|
||||||
getStandListByStationCode(this.mapId, stationCode).then(resp => {
|
|
||||||
if (resp.data && resp.data.length) {
|
|
||||||
this.standList = resp.data;
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$message.error('获取站台列表失败');
|
this.$message.error('获取角色列表失败');
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
standCodeChange(standCode) {
|
|
||||||
this.psdList = [];
|
|
||||||
if (standCode) {
|
|
||||||
getPsdListByStandCode(this.mapId, standCode).then(resp => {
|
|
||||||
if (resp.data && resp.data.length) {
|
|
||||||
this.psdList = resp.data;
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
this.$message.error('获取屏蔽门列表失败');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// this.stationList = [];
|
||||||
|
// if (mapId) {
|
||||||
|
// getStationListNeedAttendant(mapId).then(resp => {
|
||||||
|
// if (resp.data && resp.data.length) {
|
||||||
|
// this.stationList = resp.data;
|
||||||
|
// }
|
||||||
|
// }).catch(() => {
|
||||||
|
// this.$message.error('获取车站列表失败');
|
||||||
|
// });
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
// stationCodeChange(stationCode) {
|
||||||
|
// this.standList = [];
|
||||||
|
// if (stationCode) {
|
||||||
|
// getStandListByStationCode(this.mapId, stationCode).then(resp => {
|
||||||
|
// if (resp.data && resp.data.length) {
|
||||||
|
// this.standList = resp.data;
|
||||||
|
// }
|
||||||
|
// }).catch(() => {
|
||||||
|
// this.$message.error('获取站台列表失败');
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// standCodeChange(standCode) {
|
||||||
|
// this.psdList = [];
|
||||||
|
// if (standCode) {
|
||||||
|
// getPsdListByStandCode(this.mapId, standCode).then(resp => {
|
||||||
|
// if (resp.data && resp.data.length) {
|
||||||
|
// this.psdList = resp.data;
|
||||||
|
// }
|
||||||
|
// }).catch(() => {
|
||||||
|
// this.$message.error('获取屏蔽门列表失败');
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -29,7 +29,7 @@ export default {
|
|||||||
EditConfigIbp
|
EditConfigIbp
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const noShowPathType = ['SWITCH', 'SIGNAL', 'PSD', 'PSL', 'IBP', 'SECTION', 'TRAIN', 'UDP_CLIENT'];
|
const noShowPathType = ['SWITCH', 'SIGNAL', 'PSD', 'PSL', 'IBP', 'SECTION', 'TRAIN', 'UDP_CLIENT', 'PLC_GATEWAY', 'UDP_LOW', 'PSC'];
|
||||||
return {
|
return {
|
||||||
examResultList: [],
|
examResultList: [],
|
||||||
url: '',
|
url: '',
|
||||||
|
Loading…
Reference in New Issue
Block a user