设备管理配置调整
This commit is contained in:
parent
710dd576d4
commit
8e7b653bd3
@ -43,29 +43,6 @@
|
||||
<!--</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="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>
|
||||
@ -77,9 +54,8 @@
|
||||
import { setDeviceConfig, getDeviceDetail } from '@/api/project';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
// getAllMapOnline, getStationListNeedAttendant, getPsdListByStandCode, getStandListByStationCode
|
||||
import {querySimulationMemberByMapId, querySimulationStationsByMapId } from '@/api/jmap/map';
|
||||
import { getBackProjectConfigByCode } from '@/api/projectConfig';
|
||||
import { getMapFunctioById } from '@/api/trainingPlatform';
|
||||
// import {querySimulationMemberByMapId, querySimulationStationsByMapId } from '@/api/jmap/map';
|
||||
// import { getMapFunctioById } from '@/api/trainingPlatform';
|
||||
|
||||
export default {
|
||||
name: 'EditConfigGateway',
|
||||
@ -95,10 +71,6 @@ export default {
|
||||
// setDeviceConfigFunction: null,
|
||||
clientList: ConstConfig.ConstSelect.clientList,
|
||||
data: {},
|
||||
formPis:{
|
||||
roleCode:'',
|
||||
client:''
|
||||
},
|
||||
titleMap: {
|
||||
SWITCH: '道岔',
|
||||
PSD:'屏蔽门',
|
||||
@ -119,15 +91,7 @@ export default {
|
||||
// standList: [],
|
||||
// standCode: '',
|
||||
// psdList: [],
|
||||
jsonConfig: '',
|
||||
rulesPis: {
|
||||
roleCode: [
|
||||
{ required: true, message: '请选择关联角色', trigger: 'change'}
|
||||
],
|
||||
client: [
|
||||
{ required: true, message: '请选择关联客户端', trigger: 'change'}
|
||||
]
|
||||
}
|
||||
jsonConfig: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -146,30 +110,12 @@ export default {
|
||||
initData(row) {
|
||||
this.jsonConfig = '{}';
|
||||
getDeviceDetail(row.id).then(resp => {
|
||||
this.formPis = {roleCode:'', client:''};
|
||||
if (resp.data.config) {
|
||||
// this.formModel = JSON.parse(resp.data.config);
|
||||
const config = JSON.parse(resp.data.config);
|
||||
const jsonConfig = Object.assign({}, config);
|
||||
delete jsonConfig.roleCode;
|
||||
delete jsonConfig.client;
|
||||
this.jsonConfig = JSON.stringify(jsonConfig, null, 4);
|
||||
if (['PIS_STAND', 'PIS_TRAIN'].includes(row.type)) {
|
||||
getBackProjectConfigByCode(row.project).then(res=>{
|
||||
const data = res.data;
|
||||
this.dialogVisible = true;
|
||||
this.roleList = [];
|
||||
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('请先配置项目信息');
|
||||
}
|
||||
});
|
||||
}
|
||||
this.jsonConfig = JSON.stringify(JSON.parse(resp.data.config), null, 4);
|
||||
}
|
||||
}).catch((e)=> {
|
||||
console.error(e, '======');
|
||||
this.$message.error('获取项目设备详情失败!');
|
||||
});
|
||||
// if (row.type === 'PSL' || row.type === 'PSC') {
|
||||
@ -193,13 +139,7 @@ export default {
|
||||
},
|
||||
doSave() {
|
||||
const self = this;
|
||||
let flag = true;
|
||||
if (this.$refs.formPis) {
|
||||
this.$refs.formPis.validate((valid) => {
|
||||
flag = valid;
|
||||
this.jsonConfig = JSON.stringify(Object.assign(JSON.parse(this.jsonConfig), this.formPis));
|
||||
});
|
||||
}
|
||||
const flag = true;
|
||||
// const form = JSON.parse(this.jsonConfig);
|
||||
// if (this.data.type === 'PSC' || this.data.type === 'PSL') {
|
||||
// form.psdCode = this.formModel.psdCode;
|
||||
@ -234,44 +174,44 @@ export default {
|
||||
this.dialogVisible = false;
|
||||
this.$refs.form && this.$refs.form.resetFields();
|
||||
},
|
||||
mapIdChange(mapId, functionId) {
|
||||
if (mapId) {
|
||||
querySimulationStationsByMapId(mapId).then(resp => {
|
||||
if (resp.data && resp.data.length) {
|
||||
this.stationList = resp.data;
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error('获取车站列表失败');
|
||||
});
|
||||
querySimulationMemberByMapId(mapId).then(resp => {
|
||||
if (resp.data) {
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}).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('获取车站列表失败');
|
||||
// });
|
||||
// }
|
||||
},
|
||||
// mapIdChange(mapId, functionId) {
|
||||
// if (mapId) {
|
||||
// querySimulationStationsByMapId(mapId).then(resp => {
|
||||
// if (resp.data && resp.data.length) {
|
||||
// this.stationList = resp.data;
|
||||
// }
|
||||
// }).catch(() => {
|
||||
// this.$message.error('获取车站列表失败');
|
||||
// });
|
||||
// querySimulationMemberByMapId(mapId).then(resp => {
|
||||
// if (resp.data) {
|
||||
// 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;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }).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) {
|
||||
|
Loading…
Reference in New Issue
Block a user