Commit 00ff56e6 by 李伟康

Merge branch 'feature/586/lwk' into 'SAAS+V5.8.6'

style: 调整src/views/serviceCentre/examinationManagement/下的代码格式与组件规范

See merge request !986
2 parents 227f7276 25111e9a
Pipeline #257 for 00ff56e6 failed in 0 seconds
<template>
<div class="left-container">
<div class="data-view">
<div v-for="item in submitArr" :key="item.name" class="item">
<div class="name">{{ item.name }}</div>
<div class="value">{{ item.value(dataView) }}</div>
<div v-for="item in submitArr"
:key="item.name"
class="item">
<div class="name">
{{ item.name }}
</div>
<div class="value">
{{ item.value(dataView) }}
</div>
</div>
</div>
<div class="examination-result">
<div class="title">考试结果等级分布</div>
<echart-bar
class="echart"
:xData="xData"
:yData="yData"
id="resultRef"
></echart-bar>
<div class="title">
考试结果等级分布
</div>
<EchartBar id="resultRef"
class="echart"
:x-data="xData"
:y-data="yData">
</EchartBar>
<div class="hint">
<div
v-for="(item, index) in queryData.examLevelDTOS"
class="item"
:key="index"
>
<div v-for="(item, index) in queryData.examLevelDTOS"
:key="index"
class="item">
<span>{{ item.levelName }}:</span>
<span>{{ item.minScore + "-" + item.maxScore }}</span>
<span>{{ `${item.minScore}-${item.maxScore}` }}</span>
</div>
</div>
</div>
</div>
</template>
<script>
import echartBar from "./echartBar.vue"
import echartBar from "./echartBar.vue";
export default {
components: { echartBar },
props: {
dataView: {
type: Object,
default: () => {}
},
queryData: {
type: Object,
default: () => {}
}
},
watch: {
dataView: {
handler(newValue, oldValue) {
this.initEchartData(newValue)
},
deep: true,
immediate: true
}
},
components: { EchartBar: echartBar },
props: {
dataView: {
type: Object,
default: () => {},
},
queryData: {
type: Object,
default: () => {},
},
},
data() {
return {
submitArr: [
{
name: "已提交人数",
value: (obj) => {
console.log(obj)
return obj.submitted || obj.submitted === 0 ? obj.submitted : "-"
}
},
{
name: "已提交人均得分",
value: (obj) => {
return obj.avg || obj.avg === 0 ? obj.avg : "-"
}
}
],
xData: [],
yData: []
}
},
methods: {
initEchartData(data) {
console.log(data)
let xData = []
data.scoreDistributions.forEach((item) => {
xData.push(item.levelName)
})
this.xData = xData
this.yData = data.scoreDistributions
}
}
}
data() {
return {
submitArr: [
{
name: "已提交人数",
value: (obj) => {
console.log(obj);
return obj.submitted || obj.submitted === 0 ? obj.submitted : "-";
},
},
{
name: "已提交人均得分",
value: (obj) => {
return obj.avg || obj.avg === 0 ? obj.avg : "-";
},
},
],
xData: [],
yData: [],
};
},
watch: {
dataView: {
handler(newValue, oldValue) {
this.initEchartData(newValue);
},
deep: true,
immediate: true,
},
},
methods: {
initEchartData(data) {
console.log(data);
let xData = [];
data.scoreDistributions.forEach((item) => {
xData.push(item.levelName);
});
this.xData = xData;
this.yData = data.scoreDistributions;
},
},
};
</script>
<style lang="scss" scoped>
.left-container {
min-width: 800px;
.data-view {
display: flex;
align-items: center;
.item {
flex: 1;
height: 100px;
border-radius: 4px;
background: #f8faff;
margin-right: 16px;
padding: 16px 20px;
box-sizing: border-box;
margin-bottom: 16px;
.name {
color: #333333;
font-size: 14px;
font-weight: 400;
margin-bottom: 8px;
}
.value {
color: #1d1d1d;
font-size: 32px;
font-weight: 500;
}
}
}
.examination-result {
position: relative;
.title {
color: #333333;
font-size: 14px;
font-weight: 400;
}
.hint {
display: flex;
flex-direction: column;
align-items: flex-start;
position: absolute;
top: 52px;
right: 45px;
.item {
display: flex;
align-items: center;
color: #000000a6;
font-size: 11px;
font-weight: 400;
margin-bottom: 7px;
}
}
}
// min-width: 800px;
.data-view {
display: flex;
align-items: center;
.item {
flex: 1;
height: 100px;
border-radius: 4px;
background: #f8faff;
margin-right: 16px;
padding: 16px 20px;
box-sizing: border-box;
margin-bottom: 16px;
.name {
color: #333333;
font-size: 14px;
font-weight: 400;
margin-bottom: 8px;
}
.value {
color: #1d1d1d;
font-size: 32px;
font-weight: 500;
}
}
}
.examination-result {
position: relative;
.title {
color: #333333;
font-size: 14px;
font-weight: 400;
}
.hint {
display: flex;
flex-direction: column;
align-items: flex-start;
position: absolute;
top: 52px;
right: 45px;
.item {
display: flex;
align-items: center;
color: #000000a6;
font-size: 11px;
font-weight: 400;
margin-bottom: 7px;
}
}
}
}
</style>
......@@ -2,107 +2,112 @@
<template>
<div class="dataView">
<d2-container>
<div class="title">数据概览</div>
<div class="title">
数据概览
</div>
<div class="content">
<div class="left">
<left-data-view
:dataView="dataViewObj"
:queryData="queryData"
></left-data-view>
<LeftDataView :data-view="dataViewObj"
:query-data="queryData">
</LeftDataView>
</div>
<div class="right">
<right-data-view :dataView="dataViewObj"></right-data-view>
<RightDataView :data-view="dataViewObj"></RightDataView>
</div>
</div>
<div class="database">
<dataTable :dataView="dataViewObj" :queryData="queryData"> </dataTable>
<DataTable :data-view="dataViewObj" :query-data="queryData">
</DataTable>
</div>
</d2-container>
</div>
</template>
<script>
import leftDataView from "./components/leftView.vue"
import rightDataView from "./components/rightView.vue"
import dataTable from "./components/dataTable.vue"
import { getLevelExamOverView } from "@api/serviceCentre"
import { getLevelExamOverView } from "@api/serviceCentre";
import dataTable from "./components/dataTable.vue";
import leftDataView from "./components/leftView.vue";
import rightDataView from "./components/rightView.vue";
export default {
name: "dataView",
components: {
leftDataView,
rightDataView,
dataTable
},
data() {
return {
dataViewObj: {
submitted: 0,
avg: 0,
topPersons: [],
scoreDistributions: []
}
}
},
props: {
queryData: {
type: Object,
default: () => {}
}
},
watch: {
queryData: {
handler(val) {
setTimeout(() => {
this.getLevelExamOverViewData()
}, 0)
},
deep: true,
immediate: true
}
},
mounted() {
this.getLevelExamOverViewData()
},
methods: {
async getLevelExamOverViewData() {
try {
let params = {
id: this.queryData.id
}
let result = await getLevelExamOverView(params)
console.log(result)
this.dataViewObj = result
} catch (err) {
this.$message.error(err?.message || "获取失败")
}
}
}
}
name: "dataView",
components: {
LeftDataView: leftDataView,
RightDataView: rightDataView,
DataTable: dataTable,
},
props: {
queryData: {
type: Object,
default: () => {},
},
},
data() {
return {
dataViewObj: {
submitted: 0,
avg: 0,
topPersons: [],
scoreDistributions: [],
},
};
},
watch: {
queryData: {
handler(val) {
setTimeout(() => {
this.getLevelExamOverViewData();
}, 0);
},
deep: true,
immediate: true,
},
},
mounted() {
this.getLevelExamOverViewData();
},
methods: {
async getLevelExamOverViewData() {
try {
let params = {
id: this.queryData.id,
};
let result = await getLevelExamOverView(params);
console.log(result);
this.dataViewObj = result;
} catch (err) {
this.$message.error(err?.message || "获取失败");
}
},
},
};
</script>
<style lang="scss" scoped>
.dataView {
padding: 0 20px;
.title {
height: 50px;
border-bottom: 1px solid #e5e5e5;
background: #ffffff;
color: #333333;
font-size: 16px;
font-weight: 500;
padding: 13px 0 13px 20px;
box-sizing: border-box;
}
.content {
background: #ffffff;
padding: 16px 20px;
display: flex;
.left {
width: calc(100% - 376px);
}
}
.database {
background: #ffffff;
}
padding: 0 20px;
.title {
height: 50px;
border-bottom: 1px solid #e5e5e5;
background: #ffffff;
color: #333333;
font-size: 16px;
font-weight: 500;
padding: 13px 0 13px 20px;
box-sizing: border-box;
}
.content {
background: #ffffff;
padding: 16px 20px;
display: flex;
width: 100%;
box-sizing: border-box;
.left {
width: calc(100% - 376px);
}
}
.database {
background: #ffffff;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!