This commit is contained in:
sunzhenyu 2020-09-18 09:26:50 +08:00
commit af322ec7aa
14 changed files with 681 additions and 136 deletions

View File

@ -621,9 +621,9 @@ export function getPlcGateway(group) {
// }); // });
// } // }
export function handlerIbpEvent(group, button) { export function handlerIbpEvent(group, button, stationCode) {
return request({ return request({
url: `/simulation/${group}/ibp/${button}`, url: `/simulation/${group}/ibp/${button}?stationCode=${stationCode}`,
method: 'put' method: 'put'
}); });
} }

View File

@ -308,4 +308,10 @@ deviceRender[deviceType.FuzhouDoor] = {
zlevel: 1, zlevel: 1,
z: 4 z: 4
}; };
// 福州通讯图符
deviceRender[deviceType.CommunicationButcher] = {
_type: deviceType.CommunicationButcher,
zlevel: 1,
z: 4
};
export default deviceRender; export default deviceRender;

View File

@ -47,7 +47,8 @@ const deviceType = {
Draught: 'Draught', Draught: 'Draught',
IscsImage: 'IscsImage', IscsImage: 'IscsImage',
OrdinaryDoor: 'OrdinaryDoor', OrdinaryDoor: 'OrdinaryDoor',
FuzhouDoor: 'FuzhouDoor' FuzhouDoor: 'FuzhouDoor',
CommunicationButcher: 'CommunicationButcher'
}; };
export default deviceType; export default deviceType;

View File

@ -0,0 +1,218 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import Line from 'zrender/src/graphic/shape/Line';
export default class CommunicationButcher extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this._type = device.model._type;
this._code = device.model.code;
this.create();
this.setState(this.model);
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
this.add(this.grouper);
this.rect1 = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: 0,
y: 0,
width: this.model.width,
height: this.model.width * 5 / 12
},
style: {
fill: '#0F0',
stroke: '#000',
lineWidth: 2
}
});
this.rect2 = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: this.model.width / 30,
y: this.model.width * 5 / 12,
width: this.model.width - this.model.width / 15,
height: this.model.width / 30
},
style: {
fill: '#000'
}
});
this.rect3 = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: this.model.width / 4 * 3,
y: this.model.width / 8,
width: this.model.width / 7,
height: this.model.width / 12
},
style: {
fill: 'rgba(0,0,0,0)',
lineWidth: 1,
stroke: '#000'
}
});
this.line1 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: 0,
x2: this.model.width * 7 / 24,
y2: this.model.width * 5 / 12
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line2 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 12,
y1: 0,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 12
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line3 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 5 / 84,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 84
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line4 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 5 / 42,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 42
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line5 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 5 / 28,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 28
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line6 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 5 / 21,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 21
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line7 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 25 / 84,
x2: this.model.width * 7 / 12,
y2: this.model.width * 25 / 84
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line8 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 7 / 24,
y1: this.model.width * 5 / 14,
x2: this.model.width * 7 / 12,
y2: this.model.width * 5 / 14
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.line9 = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: this.model.width * 3 / 4,
y1: this.model.width / 6,
x2: this.model.width * 25 / 28,
y2: this.model.width / 6
},
style: {
stroke: '#000',
lineWidth: 1
}
});
this.grouper.add(this.rect1);
this.grouper.add(this.rect2);
this.grouper.add(this.rect3);
this.grouper.add(this.line1);
this.grouper.add(this.line2);
this.grouper.add(this.line3);
this.grouper.add(this.line4);
this.grouper.add(this.line5);
this.grouper.add(this.line6);
this.grouper.add(this.line7);
this.grouper.add(this.line8);
this.grouper.add(this.line9);
this.add(this.grouper);
}
setState(model) {
if (model.state === 'normal') {
this.rect1.setStyle({fill: '#0F0'});
} else if (model.state === 'fault') {
this.rect1.setStyle({fill: '#F00'});
} else if (model.state === 'unknow') {
this.rect1.setStyle({fill: '#00F'});
}
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -48,6 +48,7 @@ import Draught from './bas/draught';
import IscsImage from './iscsImage'; import IscsImage from './iscsImage';
import OrdinaryDoor from './ordinaryDoor'; import OrdinaryDoor from './ordinaryDoor';
import FuzhouDoor from './fuzhouDoor'; import FuzhouDoor from './fuzhouDoor';
import CommunicationButcher from './communicationButcher';
const iscsShape = {}; const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton; iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -100,6 +101,7 @@ iscsShape[deviceType.Draught] = Draught;
iscsShape[deviceType.IscsImage] = IscsImage; iscsShape[deviceType.IscsImage] = IscsImage;
iscsShape[deviceType.OrdinaryDoor] = OrdinaryDoor; iscsShape[deviceType.OrdinaryDoor] = OrdinaryDoor;
iscsShape[deviceType.FuzhouDoor] = FuzhouDoor; iscsShape[deviceType.FuzhouDoor] = FuzhouDoor;
iscsShape[deviceType.CommunicationButcher] = CommunicationButcher;
function shapefactory(device, iscs) { function shapefactory(device, iscs) {
const type = device.model._type; const type = device.model._type;

View File

@ -18,7 +18,6 @@ export default class fuzhouDoor extends Group {
id: this.model.code, id: this.model.code,
position: [this.model.point.x, this.model.point.y] position: [this.model.point.x, this.model.point.y]
}); });
this.add(this.grouper);
this.door = new Rect({ this.door = new Rect({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
@ -29,7 +28,9 @@ export default class fuzhouDoor extends Group {
height: this.model.width * 25 / 16 height: this.model.width * 25 / 16
}, },
style: { style: {
fill: '#33CC00'// D3D0C9 fill: '#33CC00',
stroke: '#000',
lineWidth: 2
} }
}); });
this.doorWindow = new Rect({ this.doorWindow = new Rect({
@ -49,10 +50,10 @@ export default class fuzhouDoor extends Group {
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
x: this.model.width * 13 / 17, x: this.model.width * 12 / 17,
y: this.model.width * 21 / 17, y: this.model.width * 20 / 17,
width: this.model.width / 17, width: this.model.width / 9,
height: this.model.width / 17 height: this.model.width / 9
}, },
style: { style: {
fill: '#000' fill: '#000'
@ -64,7 +65,7 @@ export default class fuzhouDoor extends Group {
shape: { shape: {
points:[ points:[
[0, 0], [0, 0],
[this.model.width * 3 / 4, this.model.width * 5 / 16], [this.model.width * 3 / 4, this.model.width * 7 / 24],
[this.model.width * 3 / 4, this.model.width * 7 / 4], [this.model.width * 3 / 4, this.model.width * 7 / 4],
[0, this.model.width * 25 / 16] [0, this.model.width * 25 / 16]
] ]
@ -80,10 +81,10 @@ export default class fuzhouDoor extends Group {
z: this.z + 2, z: this.z + 2,
shape: { shape: {
points: [ points: [
[this.model.width / 6, this.model.width / 4], [this.model.width / 8, this.model.width / 4],
[this.model.width * 2 / 3, this.model.width * 5 / 12], [this.model.width * 5 / 8, this.model.width * 5 / 12],
[this.model.width / 6, this.model.width * 7 / 12], [this.model.width * 5 / 8, this.model.width * 3 / 4],
[this.model.width * 2 / 3, this.model.width * 2 / 3] [this.model.width / 8, this.model.width * 7 / 12]
] ]
}, },
style: { style: {
@ -95,10 +96,10 @@ export default class fuzhouDoor extends Group {
z: this.z + 2, z: this.z + 2,
shape: { shape: {
points: [ points: [
[this.model.width * 11 / 24, this.model.width * 55 / 48], [this.model.width * 5 / 12, this.model.width * 55 / 48],
[this.model.width / 3, this.model.width * 29 / 24], [this.model.width * 14 / 24, this.model.width * 29 / 24],
[this.model.width * 11 / 24, this.model.width * 5 / 4], [this.model.width * 14 / 24, this.model.width * 21 / 16],
[this.model.width / 3, this.model.width * 21 / 16] [this.model.width * 5 / 12, this.model.width * 5 / 4]
] ]
}, },
style: { style: {
@ -120,12 +121,12 @@ export default class fuzhouDoor extends Group {
} }
setState(model) { setState(model) {
if (model.doorOpen) { if (model.doorOpen) {
this.door.setStyle({fill: 'D3D0C9'}); this.door.setStyle({fill: '#D3D0C9'});
this.polygon1.show(); this.polygon1.show();
this.polygon2.show(); this.polygon2.show();
this.polygon3.show(); this.polygon3.show();
} else { } else {
this.door.setStyle({fill: 'D3D0C9'}); this.door.setStyle({fill: '#0F0'});
this.doorWindow.show(); this.doorWindow.show();
this.doorknob.show(); this.doorknob.show();
} }

View File

@ -190,6 +190,9 @@ export function parser(data) {
zrUtil.each(data.fuzhoudoorList || [], elem => { zrUtil.each(data.fuzhoudoorList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.FuzhouDoor, elem); iscsDevice[elem.code] = deviceFactory(deviceType.FuzhouDoor, elem);
}); });
zrUtil.each(data.communicationButcherList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.CommunicationButcher, elem);
});
} }
return iscsDevice; return iscsDevice;

View File

@ -191,7 +191,7 @@ export default {
onMouseDown(em) { onMouseDown(em) {
if (em.deviceModel.mean) { if (em.deviceModel.mean) {
if (IbpOperation[em.deviceModel.mean]) { if (IbpOperation[em.deviceModel.mean]) {
handlerIbpEvent(this.$route.query.group, IbpOperation[em.deviceModel.mean].event); handlerIbpEvent(this.$route.query.group, IbpOperation[em.deviceModel.mean].event, this.stationCode);
} }
} }
}, },

View File

@ -454,47 +454,47 @@ export default {
}, },
{ {
name: '自动售检票/门禁', name: '自动售检票/门禁',
mode: '', mode: 'fafc',
id: '', id: 'fafc',
type: '', type: 'totalSystem',
children: [ children: [
{ {
name: '自动售检票系统', name: '自动售检票系统',
mode: '', mode: 'autoTicket',
id: '', id: 'autoTicket',
type: '' type: 'interface'
}, },
{ {
name: '门禁系统', name: '门禁系统',
mode: '', mode: 'entranceGuard',
id: '', id: 'entranceGuard',
type: '' type: 'interface'
} }
] ]
}, },
{ {
name: '火灾报警系统', name: '火灾报警系统',
mode: '', mode: 'ffas',
id: '', id: 'ffas',
type: '', type: 'totalSystem',
children: [ children: [
{ {
name: '火灾报警系统-FAS联动', name: '火灾报警系统-FAS联动',
mode: '', mode: 'linkage',
id: '', id: 'linkage',
type: '' type: 'interface'
}, },
{ {
name: '火灾报警系统-站厅层', name: '火灾报警系统-站厅层',
mode: '', mode: 'stationHall',
id: '', id: 'stationHall',
type: '' type: 'interface'
}, },
{ {
name: '火灾报警系统-站台层', name: '火灾报警系统-站台层',
mode: '', mode: 'platform',
id: '', id: 'platform',
type: '' type: 'interface'
}, },
{ {
name: '火灾报警系统-区间', name: '火灾报警系统-区间',

View File

@ -58,6 +58,22 @@
@deleteDataModel="deleteDataModel" @deleteDataModel="deleteDataModel"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="门禁" name="fuzhouDoor">
<fuzhou-door
ref="fuzhouDoor"
style="width: 100%;height: 100%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="通讯图符" name="communicationButcher">
<communication-butcher
ref="communication"
style="width: 100%;height: 100%;"
@createDataModel="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-card> </el-card>
</div> </div>
@ -71,6 +87,8 @@ import IscsLine from '../iscsCommonElem/line';
import IscsText from '../iscsCommonElem/text'; import IscsText from '../iscsCommonElem/text';
import IscsRect from '../iscsCommonElem/rect'; import IscsRect from '../iscsCommonElem/rect';
import OrdinaryDoor from '../iscsCommonElem/ordinaryDoor'; import OrdinaryDoor from '../iscsCommonElem/ordinaryDoor';
import FuzhouDoor from '../iscsCommonElem/fuzhouDoor';
import CommunicationButcher from '../iscsCommonElem/communicationButcher';
export default { export default {
name: 'IscsAcsOperate', name: 'IscsAcsOperate',
@ -80,7 +98,9 @@ export default {
IscsLine, IscsLine,
IscsText, IscsText,
IscsRect, IscsRect,
OrdinaryDoor OrdinaryDoor,
FuzhouDoor,
CommunicationButcher
}, },
mixins: [ mixins: [
], ],

View File

@ -0,0 +1,110 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="80px" style="width: 100%;padding: 10px 50px;">
<el-form-item label="门宽:" prop="height">
<el-input-number v-model="form.width" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="X轴坐标:">
<el-input-number v-model="form.x" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="Y轴坐标:">
<el-input-number v-model="form.y" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">删除</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {getUID} from '@/iscs/utils/Uid';
import { mapGetters } from 'vuex';
export default {
name: 'CommunicationButcher',
data() {
return {
form:{
code: '',
width: 50,
x: 10,
y: 10
},
rules: {},
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'CommunicationButcher' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.x = model.point.x;
this.form.y = model.point.y;
this.form.width = model.width;
}
}
},
mounted() {},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const model = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.isUpdate ? this.form.code : getUID('CommunicationButcher', this.iscs.communicationButcherList),
_type: 'CommunicationButcher',
width: this.form.width
};
this.$emit('createDataModel', model);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const model = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.form.code,
_type: 'CommunicationButcher',
width: this.form.width
};
this.$emit('deleteDataModel', model);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
width: 50,
x: 10,
y: 10
};
}
}
};
</script>
<style scoped>
</style>

View File

@ -23,12 +23,12 @@
import {getUID} from '@/iscs/utils/Uid'; import {getUID} from '@/iscs/utils/Uid';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
name: 'OrdinaryDoor', name: 'FuzhouDoor',
data() { data() {
return { return {
form:{ form:{
code: '', code: '',
width: 1, width: 20,
x: 10, x: 10,
y: 10 y: 10
}, },
@ -46,16 +46,14 @@ export default {
watch:{ watch:{
'$store.state.iscs.rightClickCount': function (val) { '$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData']; const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'OrdinaryDoor' ) { if (model._type === 'FuzhouDoor' ) {
this.buttonText = '修改'; this.buttonText = '修改';
this.showDeleteButton = true; this.showDeleteButton = true;
this.isUpdate = true; this.isUpdate = true;
this.form.code = model.code; this.form.code = model.code;
this.form.x = model.point.x; this.form.x = model.point.x;
this.form.y = model.point.y; this.form.y = model.point.y;
this.form.r = model.r; this.form.width = model.width;
this.form.doorType = model.doorType;
this.form.rotationAngle = model.rotationAngle;
} }
} }
}, },
@ -69,11 +67,9 @@ export default {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
}, },
code: this.isUpdate ? this.form.code : getUID('OrdinaryDoor', this.iscs.ordinaryDoorList), code: this.isUpdate ? this.form.code : getUID('FuzhouDoor', this.iscs.fuzhouDoorList),
_type: 'OrdinaryDoor', _type: 'FuzhouDoor',
rotationAngle: this.form.rotationAngle, width: this.form.width
r: this.form.r,
doorType: this.form.doorType
}; };
this.$emit('createDataModel', model); this.$emit('createDataModel', model);
this.initPage(); this.initPage();
@ -83,18 +79,16 @@ export default {
}); });
}, },
deleteDevice() { deleteDevice() {
const lineModel = { const model = {
point: { point: {
x: this.form.x, x: this.form.x,
y: this.form.y y: this.form.y
}, },
code: this.form.code, code: this.form.code,
_type: 'OrdinaryDoor', _type: 'FuzhouDoor',
rotationAngle: this.form.rotationAngle, width: this.form.width
r: this.form.r,
doorType: this.form.doorType
}; };
this.$emit('deleteDataModel', lineModel); this.$emit('deleteDataModel', model);
}, },
initPage() { initPage() {
this.isUpdate = false; this.isUpdate = false;
@ -102,9 +96,7 @@ export default {
this.showDeleteButton = false; this.showDeleteButton = false;
this.form = { this.form = {
code: '', code: '',
doorType: '1', width: 20,
r: 1,
rotationAngle: 0,
x: 10, x: 10,
y: 10 y: 10
}; };

View File

@ -0,0 +1,116 @@
<template>
<div class="question">
<div class="ql-editor" v-html="appendIndex($escapeHTML(`${option.topic}`), $vnode.key, option)" />
<template v-if="checkType(option, 'judge')">
<el-radio-group v-model="answer" disabled :class="{'select-box': option.rightAnswer != option.answer}" @change="onChnage">
<el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: inline">
<span>{{ el.content }}</span>
</el-radio>
</el-radio-group>
</template>
<template v-else-if="checkType(option, 'select')">
<el-radio-group v-model="answer" disabled :class="{'select-box': option.rightAnswer != option.answer}" @change="onChnage">
<el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: block">
<span>{{ $asc2chart(i+65) }}. </span>
<div class="ql-editor" style="display: inline; padding: 0" v-html="$escapeHTML(el.content)" />
</el-radio>
</el-radio-group>
</template>
</div>
</template>
<script>
export default {
props: {
value: {
type: String,
default: ''
},
option: {
type: Object,
required: true
}
},
data() {
return {
answer: 0
};
},
watch: {
value(val) {
this.changeValue();
}
},
mounted() {
this.changeValue();
},
methods: {
changeValue() {
this.answer = parseInt(this.value);
},
checkType(option, type) {
return option.type == type;
},
appendIndex(str, index, option) {
let result = '';
const i = option.optionList.findIndex(ele => ele.correct);
if (option.type === 'select') {
if (option.answer == option.optionList[i].id) {
result = `<span style="color: green;margin-left: 10px;">(正确 得分: ${option.score})</span>`;
} else {
result = `<span style="color: red;margin-left: 10px;">(错误 正确答案: ${this.$asc2chart(i + 65)})</span>`;
}
} else if (option.type === 'judge') {
if (option.answer == option.optionList[i].id) {
result = `<span style="color: green;margin-left: 10px;">(正确 得分: ${option.score})</span>`;
} else {
result = `<span style="color: red;margin-left: 10px;">(错误 正确答案: ${option.optionList[i].content})</span>`;
}
}
this.$set(option, 'rightAnswer', option.optionList[i].id);
//
return `${index + 1}. ${str} ${result}`;
},
onChnage(e) {
const answer = `${e}`;
this.$emit('input', answer);
this.$emit('save', {userExamQuestionId: this.option.id, answer: answer});
}
}
};
</script>
<style lang="scss" scoped>
.rich-text {
padding: 0;
display: inline;
}
.question {
/deep/ {
.ql-editor {
line-height: 26px;
padding: 0;
}
.el-radio {
color: #000;
}
.el-radio__label {
font-size: 16px;
line-height: 26px;
}
.el-radio-group .is-disabled .el-radio__label{
color: #333;
}
.select-box.el-radio-group .is-checked.is-disabled .el-radio__label{
color: red;
}
}
}
</style>

View File

@ -1,109 +1,185 @@
<template> <template>
<el-dialog :visible.sync="dialogVisible" fullscreen> <el-dialog :visible.sync="dialogVisible" fullscreen>
<div class="joylink-card paper"> <el-container class="quiz">
<div class="card-title"> <el-container class="quiz__container">
<span style="font-weight:bold ">{{ $t('exam.examResultsDetails') }}</span> <el-header class="quiz__container-header layer-center">
</div> <div class="titles">考试结果</div>
<div class="context"> </el-header>
<el-table :data="operateScoreData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary> <el-main class="quiz__container-main layer-center">
<el-table-column prop="questionTopic" label="题目" /> <div v-for="(el,i) in sortedList" :id="'anchor__lst-'+i" :key="i" class="section">
<el-table-column prop="remarks" label="描述" /> <template v-if="el.children.length">
<el-table-column prop="totalScore" width="100" label="分值" /> <div class="caption">{{ index2UnicodeList[i] }}{{ el.title }}</div>
<el-table-column prop="score" width="100" label="得分" /> <question v-for="(item,j) in el.children" :id="'anchor__lst-'+item.type+'-'+item.index" :key="j" v-model="item.answer" class="context" :option="item" />
</el-table> </template>
</div> </div>
<div class="draf_box"> <div style="padding-left: 20px;margin-top: 20px;">
<el-button type="primary " @click="restart">重新测试</el-button> <span>考试总分: </span>
<el-button type="primary" @click="close">关闭</el-button> <span style="font-size: 20px">{{ totalScore }}</span>
</div> </div>
</div> </el-main>
<el-footer class="quiz__container-footer layer-center" @click="returnTop">
<el-button-group class="buttons">
<el-button type="primary" @click="restart">重新测验</el-button>
<el-button type="primary" @click="close">返回</el-button>
</el-button-group>
</el-footer>
</el-container>
</el-container>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import Question from './requestQuestion';
export default { export default {
name: 'ExamResult', name: 'ExamResult',
components: {
Question
},
props: { props: {
}, },
data() { data() {
return { return {
resultModel: { index: 0,
trainingName: '', height: 0,
score: 0 loading: false,
formModel: {
description: '',
duration: 10,
name: '',
status: '',
totalScore: 0,
passScore: 10
}, },
tableData: [], totalScore: 0,
operateScoreData: [], examQuestions: [],
dialogVisible: false dialogVisible: false
}; };
}, },
computed: { computed: {
height() { examId() {
return this.$store.state.app.height - 50; return this.$route.params.examId;
},
userExamId() {
return this.$route.params.userExamId;
},
question() {
return this.examQuestions[this.index] || {};
},
index2UnicodeList() {
return ['一', '二', '三', '四'];
},
sortedList() {
return [
{
title: '判断题',
children: this.examQuestions.filter(el => { return el.type === 'judge'; })
},
{
title: '选择题',
children: this.examQuestions.filter(el => { return el.type === 'select'; })
}
];
} }
}, },
created() { created() {
}, },
methods: { methods: {
doShow(result) { doShow(result) {
this.examQuestions = [];
this.dialogVisible = true; this.dialogVisible = true;
this.operateScoreData = result; if (result.length) {
}, result.forEach((item, i) => {
getSummaries(param) { // this.examQuestions.push({...item.question, ...{answer: String(item.answerOptionId), score: item.score, index: i}});
const { columns, data } = param; });
const sums = []; this.totalScore = result.reduce((pre, ver) => pre + ver.score, 0);
columns.forEach((column, index) => { }
if (index === 0) {
sums[index] = this.$t('exam.totalScore');
return;
}
if (column.property === 'score' || column.property === 'totalScore') {
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += this.$t('exam.points');
} else {
sums[index] = '';
}
}
});
return sums;
}, },
restart() { restart() {
this.$emit('restart'); this.$emit('restart');
}, },
close() { close() {
this.dialogVisible = false; this.dialogVisible = false;
},
returnTop() {
document.querySelector('.el-header').scrollIntoView(true);
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.paper { .layer-center {
height: 100%; width: 900px;
overflow: hidden; height: 100%;
.card-title{ margin: auto;
height: 47px; background: #fff;
line-height: 47px; padding-top: 0;
border-bottom: 1px solid #e6e6e6; }
text-align: center;
}
.context { .quiz {
padding: 30px 60px; background: #eee;
height: calc(100% - 107px); height: 100%;
overflow: auto;
}
}
.draf_box{ &::-webkit-scrollbar {
padding: 10px 0; display:none
text-align: center; }
}
&__card {
height: 100%;
.dir-item {
padding-left: 25px;
}
.dir-caption {
padding-left: 10px;
line-height: 26px;
background: #f1f1f1;
}
}
&__container {
height: 100%;
&-header {
height: auto !important;
.titles {
font-size: 24px;
line-height: 60px;
font-weight: bold;
text-align: center;
margin: 0 auto;
}
.notes {
color:#606266;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0 20px;
}
}
&-main {
.section {
padding: 5px 20px;
.caption {
line-height: 26px;
}
.context {
}
}
}
&-footer {
text-align: right;
position: sticky;
bottom: 0px;
padding: 40px ;
.buttons {
position: relative;
bottom: 20px;
}
}
}
}
</style> </style>