This commit is contained in:
sunzhenyu 2020-07-31 15:58:38 +08:00
commit 764a6139ea
5 changed files with 80 additions and 101 deletions

View File

@ -152,10 +152,9 @@
>
<el-option
v-for="option in item.options"
:key="option.value"
:label="option.label"
:value="option.value"
:disabled="option.disabled"
:key="option[item.optionValue|| 'value']"
:label="option[item.optionLabel || 'label']"
:value="option[item.optionValue || 'value']"
/>
</el-select>
</template>
@ -171,9 +170,9 @@
>
<el-option
v-for="option in item.options"
:key="option.value"
:label="option.label"
:value="option.value"
:key="option[item.optionValue|| 'value']"
:label="option[item.optionLabel || 'label']"
:value="option[item.optionValue || 'value']"
:disabled="option.disabled"
/>
</el-select>
@ -187,9 +186,9 @@
>
<el-option
v-for="option in item.options"
:key="option.value"
:label="option.label"
:value="option.value"
:key="option[item.optionValue|| 'value']"
:label="option[item.optionLabel || 'label']"
:value="option[item.optionValue || 'value']"
:disabled="option.disabled"
/>
</el-select>
@ -204,9 +203,9 @@
>
<el-option
v-for="option in item.options"
:key="option.value"
:label="option.label"
:value="option.value"
:key="option[item.optionValue|| 'value']"
:label="option[item.optionLabel || 'label']"
:value="option[item.optionValue || 'value']"
:disabled="option.disabled"
/>
</el-select>
@ -217,12 +216,13 @@
filterable
:placeholder="item.placeholder"
:disabled="item.disabled"
@change="((val)=>{deviceChange(val, item)})"
>
<el-option
v-for="option in item.options"
:key="option.value"
:label="option.label"
:value="option.value"
:key="option[item.optionValue|| 'value']"
:label="option[item.optionLabel || 'label']"
:value="option[item.optionValue || 'value']"
:disabled="option.disabled"
/>
</el-select>
@ -386,6 +386,11 @@ export default {
},
clearValidate() {
this.$refs.form.clearValidate();
},
deviceChange(data, item) {
if (item.deviceChange) {
item.deviceChange(data);
}
}
}
};

View File

@ -62,7 +62,7 @@ export function parser(data, skinCode, showConfig) {
zrUtil.each(data.sectionList || [], elem => {
if (elem.type == '02' || elem.type == '03') {
mapDevice[elem.code].parentName = mapDevice[elem.parentCode] ? mapDevice[elem.parentCode].name : '';
} else if (elem.type == '01' && (elem.standTrack || elem.reentryTrack)) {
} else if (elem.type == '01' && (elem.standTrack || elem.reentryTrack) && elem.belongStation) {
mapDevice[elem.belongStation].sectionCode = elem.code;
}
}, this);

View File

@ -421,8 +421,8 @@ export default {
case 'AUDIENCE':
this.$store.dispatch('training/setPrdType', '');
this.$store.dispatch('training/setRoles', 'AUDIENCE');
this.jl3dmaintainershow = false;
this.drivingShow = false;
// this.jl3dmaintainershow = false;
// this.drivingShow = false;
this.hideIbp();
break;
case 'DRIVER':

View File

@ -1,73 +1,6 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<el-form ref="form" :model="formData" label-width="100px" :rules="rules">
<el-form-item v-show="data.type === 'PLC_GATEWAY'" label-width="150px" label="读取开始位地址:" prop="addr">
<el-input-number v-model="formData.addr" :controls="false" :min="0" :max="20000" />
</el-form-item>
<el-form-item v-show="data.type==='PLC_GATEWAY'" label-width="150px" label="数量" prop="quantity">
<el-input-number v-model="formData.quantity" :controls="false" :min="0" :max="20000" />
</el-form-item>
<el-form-item v-show="data.type !== 'PLC_GATEWAY'" label="教员机:" prop="deviceCode">
<el-select v-model="formData.deviceCode" placeholder="请选择" size="small">
<el-option
v-for="item in deviceList"
:key="item.code"
:label="item.code"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item v-show="data.type === 'LSW'" label="屏目配置:" prop="quadrant" size="small">
<el-select v-model="formData.quadrant" placeholder="请选择" size="small">
<el-option
v-for="item in screenList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item v-show="data.type === 'VR_PSD'" label="关联地图:" prop="mapId">
<el-select v-model="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 v-show="data.type === 'VR_PSD'" label="关联车站:" prop="stationCode">
<el-select v-model="stationCode" placeholder="请选择" size="small" @change="stationCodeChange">
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item v-show="data.type === 'VR_PSD'" label="关联站台:" prop="standCode">
<el-select v-model="standCode" placeholder="请选择" size="small" @change="standCodeChange">
<el-option
v-for="item in standList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item v-show="data.type === 'VR_PSD'" label="关联屏蔽门:" prop="psdCode">
<el-select v-model="formData.psdCode" placeholder="请选择" size="small">
<el-option
v-for="item in psdList"
:key="item.code"
:label="item.code"
:value="item.code"
/>
</el-select>
</el-form-item>
</el-form>
<data-form ref="dataForm" :form="formItem" :form-model="formData" :rules="rules" />
<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>
@ -100,7 +33,10 @@ export default {
quantity: '',
quadrant: '',
deviceCode: '',
psdCode: ''
psdCode: '',
mapId: '',
stationCode: '',
standCode: ''
},
rules: {
addr: [
@ -119,18 +55,54 @@ export default {
{ required: true, message: '请选择关联屏蔽门', trigger: 'change'}
]
},
mapId: '',
mapList: [],
stationCode: '',
stationList: [],
standList: [],
standCode: '',
psdList: []
};
},
computed: {
title() {
return '编辑设备配置';
},
formItem() {
let form = {labelWidth: '150px', item: []};
if (this.data.type === 'PLC_GATEWAY') {
form = {
labelWidth: '150px',
items: [
{ prop:'addr', label: '读取开始位地址:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, noControls: true},
{ prop: 'quantity', label: '位数量:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0, noControls: true }
]
};
} else if (this.data.type === 'VR_PSD') {
form = {
labelWidth: '150px',
items: [
{ prop: 'deviceCode', label: '教研机:', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code' },
{ prop: 'mapId', label: '关联地图:', type: 'select', options: this.mapList, optionLabel: 'name', optionValue: 'id', deviceChange: this.mapIdChange},
{ prop: 'stationCode', label: '关联车站:', type: 'select', options: this.stationList, optionLabel: 'name', optionValue: 'code', deviceChange: this.stationCodeChange},
{ prop: 'standCode', label: '关联站台:', type: 'select', options: this.standList, optionLabel: 'name', optionValue: 'code', deviceChange: this.standCodeChange},
{ prop: 'psdCode', label: '关联屏蔽门:', type: 'select', options: this.psdList, optionLabel: 'name', optionValue: 'code' }
]
};
} else if (this.data.type === 'LSW') {
form = {
labelWidth: '150px',
items: [
{ prop: 'deviceCode', label: '教研机:', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code' },
{ prop: 'quadrant', label: '屏幕配置:', type: 'select', options: this.screenList, optionLabel: 'label', optionValue: 'value'}
]
};
} else if (this.data.type === 'CCTV') {
form = {
labelWidth: '150px',
items: [
{ prop: 'deviceCode', label: '教研机:', type: 'select', options: this.deviceList, optionLabel: 'code', optionValue: 'code' }
]
};
}
return form;
}
},
methods: {
@ -159,7 +131,7 @@ export default {
getAllMapOnline().then(resp => {
if (resp.data && resp.data.length) {
this.mapList = resp.data;
this.mapId = this.mapList[0].id;
this.formData.mapId = this.mapList[0].id;
this.mapIdChange(this.mapList[0].id);
}
}).catch(() => {
@ -182,7 +154,7 @@ export default {
stationCodeChange(stationCode) {
this.standList = [];
if (stationCode) {
getStandListByStationCode(this.mapId, stationCode).then(resp => {
getStandListByStationCode(this.formData.mapId, stationCode).then(resp => {
if (resp.data && resp.data.length) {
this.standList = resp.data;
}
@ -194,7 +166,7 @@ export default {
standCodeChange(standCode) {
this.psdList = [];
if (standCode) {
getPsdListByStandCode(this.mapId, standCode).then(resp => {
getPsdListByStandCode(this.formData.mapId, standCode).then(resp => {
if (resp.data && resp.data.length) {
this.psdList = resp.data;
}
@ -206,7 +178,7 @@ export default {
doSave() {
const self = this;
if (this.data.type == 'LSW') {
this.$refs.form.validate(() => {
this.$refs.dataForm.validateForm(() => {
const param = {
deviceCode: this.formData.deviceCode,
quadrant: this.formData.quadrant
@ -220,7 +192,7 @@ export default {
});
});
} else if (this.data.type == 'CCTV') {
this.$refs.form.validate(() => {
this.$refs.dataForm.validateForm(() => {
const param = {
deviceCode: this.formData.deviceCode
};
@ -233,7 +205,7 @@ export default {
});
});
} else if (this.data.type == 'VR_PSD') {
this.$refs.form.validate(() => {
this.$refs.dataForm.validateForm(() => {
const param = {
deviceCode: this.formData.deviceCode,
psdCode: this.formData.psdCode
@ -247,7 +219,7 @@ export default {
});
});
} else if (this.data.type == 'PLC_GATEWAY') {
this.$refs.form.validate(() => {
this.$refs.dataForm.validateForm(() => {
const param = {
addr: this.formData.addr,
quantity: this.formData.quantity
@ -273,7 +245,7 @@ export default {
this.stationCode = '';
this.standCode = '';
this.deviceList = [];
this.$refs.form.resetFields();
this.$refs.dataForm.resetForm();
}
}
};

View File

@ -182,8 +182,10 @@ export default {
this.$nextTick(() => {
const checkId = localStore.get('trainingPlatformCheckId' + filterSelect + this.userId + this.project) || null;
this.$refs.tree && this.$refs.tree.setCurrentKey(checkId);
checkId && this.findTree(this.treeList, checkId);
!checkId && this.treeList && this.treeList.length && this.clickEvent(this.treeList[0], {data: this.treeList[0]});
if (!this.$route.path.includes('result')) {
checkId && this.findTree(this.treeList, checkId);
!checkId && this.treeList && this.treeList.length && this.clickEvent(this.treeList[0], {data: this.treeList[0]});
}
this.loading = false;
});
} catch (error) {