行调大赛理论考试&福州Iscs
This commit is contained in:
parent
28e9bf2dae
commit
f7e350ca95
@ -308,4 +308,10 @@ deviceRender[deviceType.FuzhouDoor] = {
|
||||
zlevel: 1,
|
||||
z: 4
|
||||
};
|
||||
// 福州通讯图符
|
||||
deviceRender[deviceType.CommunicationButcher] = {
|
||||
_type: deviceType.CommunicationButcher,
|
||||
zlevel: 1,
|
||||
z: 4
|
||||
};
|
||||
export default deviceRender;
|
||||
|
@ -47,7 +47,8 @@ const deviceType = {
|
||||
Draught: 'Draught',
|
||||
IscsImage: 'IscsImage',
|
||||
OrdinaryDoor: 'OrdinaryDoor',
|
||||
FuzhouDoor: 'FuzhouDoor'
|
||||
FuzhouDoor: 'FuzhouDoor',
|
||||
CommunicationButcher: 'CommunicationButcher'
|
||||
};
|
||||
|
||||
export default deviceType;
|
||||
|
@ -131,6 +131,7 @@ class Iscs {
|
||||
updateIscsData(store.state.iscs, elem);
|
||||
const oDevice = this.iscsDevice[code] || deviceFactory(type, elem);
|
||||
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, elem));
|
||||
console.log(nDevice, '****', this.iscsDevice[code]);
|
||||
delete this.iscsDevice[code];
|
||||
this.$painter.delete(oDevice);
|
||||
if (!elem._dispose) {
|
||||
|
216
src/iscs/shape/communicationButcher.js
Normal file
216
src/iscs/shape/communicationButcher.js
Normal file
@ -0,0 +1,216 @@
|
||||
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
|
||||
}
|
||||
});
|
||||
// x: this.model.width / 4 * 3,
|
||||
// y: this.model.width / 8,
|
||||
// width: this.model.width / 7,
|
||||
// height: this.model.width / 12
|
||||
this.line9 = new Line({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z + 1,
|
||||
shape: {
|
||||
x1: this.model.width * 3 / 4,
|
||||
y1: this.model.width * 10 / 48
|
||||
}
|
||||
});
|
||||
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.add(this.grouper);
|
||||
console.log(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;
|
||||
}
|
||||
}
|
@ -48,6 +48,7 @@ import Draught from './bas/draught';
|
||||
import IscsImage from './iscsImage';
|
||||
import OrdinaryDoor from './ordinaryDoor';
|
||||
import FuzhouDoor from './fuzhouDoor';
|
||||
import CommunicationButcher from './communicationButcher';
|
||||
|
||||
const iscsShape = {};
|
||||
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
|
||||
@ -100,6 +101,7 @@ iscsShape[deviceType.Draught] = Draught;
|
||||
iscsShape[deviceType.IscsImage] = IscsImage;
|
||||
iscsShape[deviceType.OrdinaryDoor] = OrdinaryDoor;
|
||||
iscsShape[deviceType.FuzhouDoor] = FuzhouDoor;
|
||||
iscsShape[deviceType.CommunicationButcher] = CommunicationButcher;
|
||||
|
||||
function shapefactory(device, iscs) {
|
||||
const type = device.model._type;
|
||||
|
@ -18,7 +18,6 @@ export default class fuzhouDoor extends Group {
|
||||
id: this.model.code,
|
||||
position: [this.model.point.x, this.model.point.y]
|
||||
});
|
||||
this.add(this.grouper);
|
||||
this.door = new Rect({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
@ -29,7 +28,9 @@ export default class fuzhouDoor extends Group {
|
||||
height: this.model.width * 25 / 16
|
||||
},
|
||||
style: {
|
||||
fill: '#33CC00'// D3D0C9
|
||||
fill: '#33CC00',
|
||||
stroke: '#000',
|
||||
lineWidth: 2
|
||||
}
|
||||
});
|
||||
this.doorWindow = new Rect({
|
||||
@ -49,10 +50,10 @@ export default class fuzhouDoor extends Group {
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
shape: {
|
||||
x: this.model.width * 13 / 17,
|
||||
y: this.model.width * 21 / 17,
|
||||
width: this.model.width / 17,
|
||||
height: this.model.width / 17
|
||||
x: this.model.width * 12 / 17,
|
||||
y: this.model.width * 20 / 17,
|
||||
width: this.model.width / 9,
|
||||
height: this.model.width / 9
|
||||
},
|
||||
style: {
|
||||
fill: '#000'
|
||||
@ -64,7 +65,7 @@ export default class fuzhouDoor extends Group {
|
||||
shape: {
|
||||
points:[
|
||||
[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],
|
||||
[0, this.model.width * 25 / 16]
|
||||
]
|
||||
@ -80,10 +81,10 @@ export default class fuzhouDoor extends Group {
|
||||
z: this.z + 2,
|
||||
shape: {
|
||||
points: [
|
||||
[this.model.width / 6, this.model.width / 4],
|
||||
[this.model.width * 2 / 3, this.model.width * 5 / 12],
|
||||
[this.model.width / 6, this.model.width * 7 / 12],
|
||||
[this.model.width * 2 / 3, this.model.width * 2 / 3]
|
||||
[this.model.width / 8, this.model.width / 4],
|
||||
[this.model.width * 5 / 8, this.model.width * 5 / 12],
|
||||
[this.model.width * 5 / 8, this.model.width * 3 / 4],
|
||||
[this.model.width / 8, this.model.width * 7 / 12]
|
||||
]
|
||||
},
|
||||
style: {
|
||||
@ -95,10 +96,10 @@ export default class fuzhouDoor extends Group {
|
||||
z: this.z + 2,
|
||||
shape: {
|
||||
points: [
|
||||
[this.model.width * 11 / 24, this.model.width * 55 / 48],
|
||||
[this.model.width / 3, this.model.width * 29 / 24],
|
||||
[this.model.width * 11 / 24, this.model.width * 5 / 4],
|
||||
[this.model.width / 3, this.model.width * 21 / 16]
|
||||
[this.model.width * 5 / 12, this.model.width * 55 / 48],
|
||||
[this.model.width * 14 / 24, this.model.width * 29 / 24],
|
||||
[this.model.width * 14 / 24, this.model.width * 21 / 16],
|
||||
[this.model.width * 5 / 12, this.model.width * 5 / 4]
|
||||
]
|
||||
},
|
||||
style: {
|
||||
@ -120,12 +121,12 @@ export default class fuzhouDoor extends Group {
|
||||
}
|
||||
setState(model) {
|
||||
if (model.doorOpen) {
|
||||
this.door.setStyle({fill: 'D3D0C9'});
|
||||
this.door.setStyle({fill: '#D3D0C9'});
|
||||
this.polygon1.show();
|
||||
this.polygon2.show();
|
||||
this.polygon3.show();
|
||||
} else {
|
||||
this.door.setStyle({fill: 'D3D0C9'});
|
||||
this.door.setStyle({fill: '#0F0'});
|
||||
this.doorWindow.show();
|
||||
this.doorknob.show();
|
||||
}
|
||||
|
@ -190,6 +190,9 @@ export function parser(data) {
|
||||
zrUtil.each(data.fuzhoudoorList || [], elem => {
|
||||
iscsDevice[elem.code] = deviceFactory(deviceType.FuzhouDoor, elem);
|
||||
});
|
||||
zrUtil.each(data.communicationButcherList || [], elem => {
|
||||
iscsDevice[elem.code] = deviceFactory(deviceType.CommunicationButcher, elem);
|
||||
});
|
||||
}
|
||||
|
||||
return iscsDevice;
|
||||
|
@ -58,6 +58,22 @@
|
||||
@deleteDataModel="deleteDataModel"
|
||||
/>
|
||||
</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-card>
|
||||
</div>
|
||||
@ -71,6 +87,8 @@ import IscsLine from '../iscsCommonElem/line';
|
||||
import IscsText from '../iscsCommonElem/text';
|
||||
import IscsRect from '../iscsCommonElem/rect';
|
||||
import OrdinaryDoor from '../iscsCommonElem/ordinaryDoor';
|
||||
import FuzhouDoor from '../iscsCommonElem/fuzhouDoor';
|
||||
import CommunicationButcher from '../iscsCommonElem/communicationButcher';
|
||||
|
||||
export default {
|
||||
name: 'IscsAcsOperate',
|
||||
@ -80,7 +98,9 @@ export default {
|
||||
IscsLine,
|
||||
IscsText,
|
||||
IscsRect,
|
||||
OrdinaryDoor
|
||||
OrdinaryDoor,
|
||||
FuzhouDoor,
|
||||
CommunicationButcher
|
||||
},
|
||||
mixins: [
|
||||
],
|
||||
|
110
src/views/iscs/iscsDraw/iscsCommonElem/communicationButcher.vue
Normal file
110
src/views/iscs/iscsDraw/iscsCommonElem/communicationButcher.vue
Normal 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: 20,
|
||||
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: 20,
|
||||
x: 10,
|
||||
y: 10
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -23,12 +23,12 @@
|
||||
import {getUID} from '@/iscs/utils/Uid';
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
name: 'OrdinaryDoor',
|
||||
name: 'FuzhouDoor',
|
||||
data() {
|
||||
return {
|
||||
form:{
|
||||
code: '',
|
||||
width: 1,
|
||||
width: 20,
|
||||
x: 10,
|
||||
y: 10
|
||||
},
|
||||
@ -46,16 +46,14 @@ export default {
|
||||
watch:{
|
||||
'$store.state.iscs.rightClickCount': function (val) {
|
||||
const model = this.$store.getters['iscs/updateDeviceData'];
|
||||
if (model._type === 'OrdinaryDoor' ) {
|
||||
if (model._type === 'FuzhouDoor' ) {
|
||||
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.r = model.r;
|
||||
this.form.doorType = model.doorType;
|
||||
this.form.rotationAngle = model.rotationAngle;
|
||||
this.form.width = model.width;
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -69,11 +67,9 @@ export default {
|
||||
x: this.form.x,
|
||||
y: this.form.y
|
||||
},
|
||||
code: this.isUpdate ? this.form.code : getUID('OrdinaryDoor', this.iscs.ordinaryDoorList),
|
||||
_type: 'OrdinaryDoor',
|
||||
rotationAngle: this.form.rotationAngle,
|
||||
r: this.form.r,
|
||||
doorType: this.form.doorType
|
||||
code: this.isUpdate ? this.form.code : getUID('FuzhouDoor', this.iscs.fuzhouDoorList),
|
||||
_type: 'FuzhouDoor',
|
||||
width: this.form.width
|
||||
};
|
||||
this.$emit('createDataModel', model);
|
||||
this.initPage();
|
||||
@ -83,18 +79,16 @@ export default {
|
||||
});
|
||||
},
|
||||
deleteDevice() {
|
||||
const lineModel = {
|
||||
const model = {
|
||||
point: {
|
||||
x: this.form.x,
|
||||
y: this.form.y
|
||||
},
|
||||
code: this.form.code,
|
||||
_type: 'OrdinaryDoor',
|
||||
rotationAngle: this.form.rotationAngle,
|
||||
r: this.form.r,
|
||||
doorType: this.form.doorType
|
||||
_type: 'FuzhouDoor',
|
||||
width: this.form.width
|
||||
};
|
||||
this.$emit('deleteDataModel', lineModel);
|
||||
this.$emit('deleteDataModel', model);
|
||||
},
|
||||
initPage() {
|
||||
this.isUpdate = false;
|
||||
@ -102,9 +96,7 @@ export default {
|
||||
this.showDeleteButton = false;
|
||||
this.form = {
|
||||
code: '',
|
||||
doorType: '1',
|
||||
r: 1,
|
||||
rotationAngle: 0,
|
||||
width: 20,
|
||||
x: 10,
|
||||
y: 10
|
||||
};
|
||||
|
116
src/views/newMap/displayNew/dispatherContest/requestQuestion.vue
Normal file
116
src/views/newMap/displayNew/dispatherContest/requestQuestion.vue
Normal 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>
|
@ -1,82 +1,100 @@
|
||||
<template>
|
||||
<el-dialog :visible.sync="dialogVisible" fullscreen>
|
||||
<div class="joylink-card paper">
|
||||
<div class="card-title">
|
||||
<span style="font-weight:bold ">{{ $t('exam.examResultsDetails') }}</span>
|
||||
</div>
|
||||
<div class="context">
|
||||
<el-table :data="operateScoreData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary>
|
||||
<el-table-column prop="questionTopic" label="题目" />
|
||||
<el-table-column prop="remarks" label="描述" />
|
||||
<el-table-column prop="totalScore" width="100" label="分值" />
|
||||
<el-table-column prop="score" width="100" label="得分" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="draf_box">
|
||||
<el-button type="primary " @click="restart">重新测试</el-button>
|
||||
<el-button type="primary" @click="close">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-container class="quiz">
|
||||
<el-container class="quiz__container">
|
||||
<el-header class="quiz__container-header layer-center">
|
||||
<div class="titles">考试结果</div>
|
||||
</el-header>
|
||||
<el-main class="quiz__container-main layer-center">
|
||||
<div v-for="(el,i) in sortedList" :id="'anchor__lst-'+i" :key="i" class="section">
|
||||
<template v-if="el.children.length">
|
||||
<div class="caption">{{ index2UnicodeList[i] }}、{{ el.title }}</div>
|
||||
<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" />
|
||||
</template>
|
||||
</div>
|
||||
<div style="padding-left: 20px;margin-top: 20px;">
|
||||
<span>考试总分: </span>
|
||||
<span style="font-size: 20px">{{ totalScore }}分</span>
|
||||
</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>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import Question from './requestQuestion';
|
||||
export default {
|
||||
name: 'ExamResult',
|
||||
components: {
|
||||
Question
|
||||
},
|
||||
props: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
resultModel: {
|
||||
trainingName: '',
|
||||
score: 0
|
||||
index: 0,
|
||||
height: 0,
|
||||
loading: false,
|
||||
formModel: {
|
||||
description: '',
|
||||
duration: 10,
|
||||
name: '',
|
||||
status: '',
|
||||
totalScore: 0,
|
||||
passScore: 10
|
||||
},
|
||||
tableData: [],
|
||||
operateScoreData: [],
|
||||
totalScore: 0,
|
||||
examQuestions: [],
|
||||
dialogVisible: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height - 50;
|
||||
examId() {
|
||||
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() {
|
||||
},
|
||||
methods: {
|
||||
doShow(result) {
|
||||
this.examQuestions = [];
|
||||
this.dialogVisible = true;
|
||||
this.operateScoreData = result;
|
||||
},
|
||||
getSummaries(param) { // 计算总分
|
||||
const { columns, data } = param;
|
||||
const sums = [];
|
||||
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;
|
||||
if (result.length) {
|
||||
result.forEach((item, i) => {
|
||||
this.examQuestions.push({...item.question, ...{answer: String(item.answerOptionId), score: item.score, index: i}});
|
||||
});
|
||||
this.totalScore = result.reduce((pre, ver) => pre + ver.score, 0);
|
||||
}
|
||||
},
|
||||
restart() {
|
||||
this.$emit('restart');
|
||||
this.$emit('restart');
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false;
|
||||
@ -85,25 +103,80 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.paper {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
.card-title{
|
||||
height: 47px;
|
||||
line-height: 47px;
|
||||
border-bottom: 1px solid #e6e6e6;
|
||||
text-align: center;
|
||||
}
|
||||
.layer-center {
|
||||
width: 900px;
|
||||
height: 100%;
|
||||
margin: auto;
|
||||
background: #fff;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.context {
|
||||
padding: 30px 60px;
|
||||
height: calc(100% - 107px);
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
.quiz {
|
||||
background: #eee;
|
||||
height: 100%;
|
||||
|
||||
.draf_box{
|
||||
padding: 10px 0;
|
||||
text-align: center;
|
||||
}
|
||||
&::-webkit-scrollbar {
|
||||
display:none
|
||||
}
|
||||
|
||||
&__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>
|
||||
|
Loading…
Reference in New Issue
Block a user