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 <el-option
v-for="option in item.options" v-for="option in item.options"
:key="option.value" :key="option[item.optionValue|| 'value']"
:label="option.label" :label="option[item.optionLabel || 'label']"
:value="option.value" :value="option[item.optionValue || 'value']"
:disabled="option.disabled"
/> />
</el-select> </el-select>
</template> </template>
@ -171,9 +170,9 @@
> >
<el-option <el-option
v-for="option in item.options" v-for="option in item.options"
:key="option.value" :key="option[item.optionValue|| 'value']"
:label="option.label" :label="option[item.optionLabel || 'label']"
:value="option.value" :value="option[item.optionValue || 'value']"
:disabled="option.disabled" :disabled="option.disabled"
/> />
</el-select> </el-select>
@ -187,9 +186,9 @@
> >
<el-option <el-option
v-for="option in item.options" v-for="option in item.options"
:key="option.value" :key="option[item.optionValue|| 'value']"
:label="option.label" :label="option[item.optionLabel || 'label']"
:value="option.value" :value="option[item.optionValue || 'value']"
:disabled="option.disabled" :disabled="option.disabled"
/> />
</el-select> </el-select>
@ -204,9 +203,9 @@
> >
<el-option <el-option
v-for="option in item.options" v-for="option in item.options"
:key="option.value" :key="option[item.optionValue|| 'value']"
:label="option.label" :label="option[item.optionLabel || 'label']"
:value="option.value" :value="option[item.optionValue || 'value']"
:disabled="option.disabled" :disabled="option.disabled"
/> />
</el-select> </el-select>
@ -217,12 +216,13 @@
filterable filterable
:placeholder="item.placeholder" :placeholder="item.placeholder"
:disabled="item.disabled" :disabled="item.disabled"
@change="((val)=>{deviceChange(val, item)})"
> >
<el-option <el-option
v-for="option in item.options" v-for="option in item.options"
:key="option.value" :key="option[item.optionValue|| 'value']"
:label="option.label" :label="option[item.optionLabel || 'label']"
:value="option.value" :value="option[item.optionValue || 'value']"
:disabled="option.disabled" :disabled="option.disabled"
/> />
</el-select> </el-select>
@ -386,6 +386,11 @@ export default {
}, },
clearValidate() { clearValidate() {
this.$refs.form.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 => { zrUtil.each(data.sectionList || [], elem => {
if (elem.type == '02' || elem.type == '03') { if (elem.type == '02' || elem.type == '03') {
mapDevice[elem.code].parentName = mapDevice[elem.parentCode] ? mapDevice[elem.parentCode].name : ''; 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; mapDevice[elem.belongStation].sectionCode = elem.code;
} }
}, this); }, this);

View File

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

View File

@ -1,73 +1,6 @@
<template> <template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false"> <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"> <data-form ref="dataForm" :form="formItem" :form-model="formData" :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>
<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>
@ -100,7 +33,10 @@ export default {
quantity: '', quantity: '',
quadrant: '', quadrant: '',
deviceCode: '', deviceCode: '',
psdCode: '' psdCode: '',
mapId: '',
stationCode: '',
standCode: ''
}, },
rules: { rules: {
addr: [ addr: [
@ -119,18 +55,54 @@ export default {
{ required: true, message: '请选择关联屏蔽门', trigger: 'change'} { required: true, message: '请选择关联屏蔽门', trigger: 'change'}
] ]
}, },
mapId: '',
mapList: [], mapList: [],
stationCode: '',
stationList: [], stationList: [],
standList: [], standList: [],
standCode: '',
psdList: [] psdList: []
}; };
}, },
computed: { computed: {
title() { title() {
return '编辑设备配置'; 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: { methods: {
@ -159,7 +131,7 @@ export default {
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.formData.mapId = this.mapList[0].id;
this.mapIdChange(this.mapList[0].id); this.mapIdChange(this.mapList[0].id);
} }
}).catch(() => { }).catch(() => {
@ -182,7 +154,7 @@ export default {
stationCodeChange(stationCode) { stationCodeChange(stationCode) {
this.standList = []; this.standList = [];
if (stationCode) { if (stationCode) {
getStandListByStationCode(this.mapId, stationCode).then(resp => { getStandListByStationCode(this.formData.mapId, stationCode).then(resp => {
if (resp.data && resp.data.length) { if (resp.data && resp.data.length) {
this.standList = resp.data; this.standList = resp.data;
} }
@ -194,7 +166,7 @@ export default {
standCodeChange(standCode) { standCodeChange(standCode) {
this.psdList = []; this.psdList = [];
if (standCode) { if (standCode) {
getPsdListByStandCode(this.mapId, standCode).then(resp => { getPsdListByStandCode(this.formData.mapId, standCode).then(resp => {
if (resp.data && resp.data.length) { if (resp.data && resp.data.length) {
this.psdList = resp.data; this.psdList = resp.data;
} }
@ -206,7 +178,7 @@ export default {
doSave() { doSave() {
const self = this; const self = this;
if (this.data.type == 'LSW') { if (this.data.type == 'LSW') {
this.$refs.form.validate(() => { this.$refs.dataForm.validateForm(() => {
const param = { const param = {
deviceCode: this.formData.deviceCode, deviceCode: this.formData.deviceCode,
quadrant: this.formData.quadrant quadrant: this.formData.quadrant
@ -220,7 +192,7 @@ export default {
}); });
}); });
} else if (this.data.type == 'CCTV') { } else if (this.data.type == 'CCTV') {
this.$refs.form.validate(() => { this.$refs.dataForm.validateForm(() => {
const param = { const param = {
deviceCode: this.formData.deviceCode deviceCode: this.formData.deviceCode
}; };
@ -233,7 +205,7 @@ export default {
}); });
}); });
} else if (this.data.type == 'VR_PSD') { } else if (this.data.type == 'VR_PSD') {
this.$refs.form.validate(() => { this.$refs.dataForm.validateForm(() => {
const param = { const param = {
deviceCode: this.formData.deviceCode, deviceCode: this.formData.deviceCode,
psdCode: this.formData.psdCode psdCode: this.formData.psdCode
@ -247,7 +219,7 @@ export default {
}); });
}); });
} else if (this.data.type == 'PLC_GATEWAY') { } else if (this.data.type == 'PLC_GATEWAY') {
this.$refs.form.validate(() => { this.$refs.dataForm.validateForm(() => {
const param = { const param = {
addr: this.formData.addr, addr: this.formData.addr,
quantity: this.formData.quantity quantity: this.formData.quantity
@ -273,7 +245,7 @@ export default {
this.stationCode = ''; this.stationCode = '';
this.standCode = ''; this.standCode = '';
this.deviceList = []; this.deviceList = [];
this.$refs.form.resetFields(); this.$refs.dataForm.resetForm();
} }
} }
}; };

View File

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