代码调整

This commit is contained in:
joylink_cuiweidong 2022-12-05 16:50:07 +08:00
parent a19c95516d
commit 39b4b0b49a
4 changed files with 169 additions and 70 deletions

View File

@ -19,7 +19,7 @@ export default {
formModel: {
code: '',
type: '',
projectCode: ''
project: ''
},
LessonList: [],
UserList: [],
@ -35,7 +35,7 @@ export default {
items: [
{ 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: 'projectCode', label:'所属项目', type: 'select', required: true, options:ConstConfig.ConstSelect.projectList }
{prop: 'project', label:'所属项目', type: 'select', required: true, options:ConstConfig.ConstSelect.projectList }
]
};
return form;
@ -48,7 +48,7 @@ export default {
type: [
{ required: true, message: this.$t('rules.selectDeviceType'), trigger: 'change' }
],
projectCode: [
project: [
{ required: true, message: '请选择所属项目', trigger: 'change' }
]
};
@ -70,7 +70,7 @@ export default {
const params = {
code: this.formModel.code,
type: this.formModel.type,
projectCode: this.formModel.projectCode
project: this.formModel.project
};
deviceIsExist(params.code).then(response => {
if (!response.data) {
@ -92,7 +92,7 @@ export default {
this.formModel = {
code: '',
type: '',
projectCode: ''
project: ''
};
this.$refs.dataform.resetForm();
this.dialogVisible = false;

View File

@ -161,9 +161,9 @@
<el-select v-model="formIscs.stationCode" placeholder="请选择" size="small" clearable>
<el-option
v-for="item in stationList"
:key="item.value"
:key="item.code"
:label="item.name"
:value="item.value"
:value="item.code"
/>
</el-select>
</el-form-item>
@ -277,6 +277,12 @@ export default {
rulesIscs: {
deviceCode: [
{ 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'}],

View File

@ -43,6 +43,39 @@
<!--</el-form-item>-->
<!--</el-form>-->
<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">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
@ -52,7 +85,11 @@
<script>
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 {
name: 'EditConfigGateway',
@ -60,13 +97,19 @@ export default {
return {
dialogVisible: false,
inline: true,
formModel: {},
formLeft: {},
formRight: {},
leftRules: {},
rightRules: {},
setDeviceConfigFunction: null,
// formModel: {},
// formLeft: {},
// formRight: {},
// leftRules: {},
// rightRules: {},
// setDeviceConfigFunction: null,
clientList: ConstConfig.ConstSelect.clientList,
data: {},
formPis:{
mapId: '',
roleCode:'',
client:''
},
titleMap: {
SWITCH: '道岔',
PSD:'屏蔽门',
@ -82,12 +125,21 @@ export default {
},
mapId: '',
mapList: [],
stationCode: '',
stationList: [],
standList: [],
standCode: '',
psdList: [],
jsonConfig: ''
roleList:[],
// stationCode: '',
// stationList: [],
// standList: [],
// standCode: '',
// psdList: [],
jsonConfig: '',
rulesLw: {
roleCode: [
{ required: true, message: '请选择关联角色', trigger: 'change'}
],
client: [
{ required: true, message: '请选择关联客户端', trigger: 'change'}
]
}
};
},
computed: {
@ -107,36 +159,49 @@ export default {
this.jsonConfig = '{}';
getDeviceDetail(row.id).then(resp => {
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);
}
}).catch((e)=> {
this.$message.error('获取项目设备详情失败!');
});
if (row.type === 'PSL' || row.type === 'PSC') {
getAllMapOnline().then(resp => {
if (resp.data && resp.data.length) {
this.mapList = resp.data;
this.mapId = this.mapList[0].id;
this.mapIdChange(this.mapList[0].id);
}
}).catch(() => {
this.$message.error('获取地图列表失败');
});
}
// if (row.type === 'PSL' || row.type === 'PSC') {
// getAllMapOnline().then(resp => {
// if (resp.data && resp.data.length) {
// this.mapList = resp.data;
// this.mapId = this.mapList[0].id;
// this.mapIdChange(this.mapList[0].id);
// }
// }).catch(() => {
// this.$message.error('');
// });
// }
},
doShow(row) {
this.initData(row);
// this.initForm(row);
this.dialogVisible = true;
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() {
const self = this;
let flag = true;
if (this.$refs.form) {
this.$refs.form.validate((valid) => {
if (this.$refs.formPis) {
this.$refs.formPis.validate((valid) => {
flag = valid;
this.jsonConfig = Object.assign(this.jsonConfig, this.formPis);
});
}
// const form = JSON.parse(this.jsonConfig);
@ -161,54 +226,82 @@ export default {
// }
},
handleClose() {
this.formModel = {};
// this.formModel = {};
this.data = {};
this.mapList = [];
this.stationList = [];
this.standList = [];
this.psdList = [];
// this.stationList = [];
// this.standList = [];
// this.psdList = [];
this.mapId = '';
this.stationCode = '';
this.standCode = '';
// this.stationCode = '';
// this.standCode = '';
this.dialogVisible = false;
this.$refs.form && this.$refs.form.resetFields();
},
mapIdChange(mapId) {
this.stationList = [];
if (mapId) {
getStationListNeedAttendant(mapId).then(resp => {
if (resp.data && resp.data.length) {
this.stationList = resp.data;
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];
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(() => {
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.$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>

View File

@ -29,7 +29,7 @@ export default {
EditConfigIbp
},
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 {
examResultList: [],
url: '',