提交 ed9820d2 authored 作者: Yroc's avatar Yroc

后端优化

上级 7421b204
<!-- -->
<script>
/**
* @Author: AnthonyD
* @Date: 2023-03-28 10:34:24
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-15 18:02:16
*/
</script><!-- -->
<template>
<div class="chart_container" :id="chart_id"></div>
</template>
<script>
export default {
props: ['chart_data', 'chart_id'],
data() {
return {
};
return {};
},
components: {},
computed: {},
created() {
},
created() {},
mounted() {
this.initChart();
// console.log('@@@@@@@@@@@');
// console.log(this.chart_data);
},
methods: {
initChart() {
let colors = ['#bcdfdc', '#47afa0', '#cd9f50'];
let series = this.changData(this.chart_data);
let legend_data = this.chart_data.labers.map(item => {
return item.key
})
// console.log(series);
let legend_data = this.chart_data.labers.map((item) => {
return item.key;
});
let _that = this;
let dom = document.getElementById(`${this.chart_id}`);
let myChart = this.$echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false
useDirtyRect: false,
});
let labers = this.chart_data.labers.map((item) => {
return item.label;
});
let option;
option = {
color: ['#cd9f50', '#47afa0', '#bcdfdc'],
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
type: 'shadow',
},
},
legend: {
// data: ['Forest', 'Steppe', 'Desert', 'Wetland']
// data: legend_data,
formatter: (name) => {
let objs = this.chart_data.labers.filter(itme => {
/* formatter: (name) => {
let objs = this.chart_data.labers.filter((itme) => {
return itme.key == name;
})
return objs[0].label
}
});
return objs[0].label;
}, */
data: labers,
},
toolbox: {
show: false,
......@@ -62,64 +73,30 @@ export default {
dataView: { show: true, readOnly: false },
magicType: { show: true, type: ['line', 'bar', 'stack'] },
restore: { show: true },
saveAsImage: { show: true }
}
saveAsImage: { show: true },
},
},
xAxis: [
{
type: 'category',
axisTick: { show: false },
// data: ['2012', '2013', '2014', '2015', '2016']
data: this.chart_data.keys
}
data: this.chart_data.keys,
interval: 0,
axisLabel: {
show: true,
rotate: -90,
},
},
],
yAxis: [
{
type: 'value'
}
type: 'value',
},
],
// series: [
// {
// name: 'Forest',
// type: 'bar',
// barGap: 0,
// // label: labelOption,
// emphasis: {
// focus: 'series'
// },
// data: [320, 332, 301, 334, 390]
// },
// {
// name: 'Steppe',
// type: 'bar',
// // label: labelOption,
// emphasis: {
// focus: 'series'
// },
// data: [220, 182, 191, 234, 290]
// },
// {
// name: 'Desert',
// type: 'bar',
// // label: labelOption,
// emphasis: {
// focus: 'series'
// },
// data: [150, 232, 201, 154, 190]
// },
// {
// name: 'Wetland',
// type: 'bar',
// // label: labelOption,
// emphasis: {
// focus: 'series'
// },
// data: [98, 77, 101, 99, 40]
// }
// ]
series: series
};
series: series,
};
if (option && typeof option === 'object') {
myChart.setOption(option);
......@@ -132,24 +109,26 @@ export default {
let list = [];
data.labers.forEach((item, index) => {
let obj = {
name: item.key,
itemStyle: {
normal: { label: { show: true, position: 'top' } },
},
name: item.label,
type: 'bar',
barGap: 0,
emphasis: {
focus: 'series'
focus: 'series',
},
data: []
}
data.keys.forEach(element => {
data: [],
};
data.keys.forEach((element) => {
obj.data.push(data.raw_data[element][item.key]);
});
list.push(obj)
list.push(obj);
});
return list
return list;
},
}
}
},
};
</script>
<style scoped>
.chart_container {
......
......@@ -9,38 +9,132 @@
<div class="container_box">
<table class="table_box">
<tr>
<th v-for="(e, i) in labers" :key="i">{{ e.label }}</th>
<th v-for="(e, i) in labers" :key="i" style="padding: 15px 10px">
{{ e.label
}}<i
class="el-icon-caret-bottom"
:style="
'color: ' +
(e.key == sort_field && sort_type == 'desc' ? '#038d6e' : '')
"
@click="sort(e.key, 'desc')"
></i
><i
class="el-icon-caret-top"
:style="
'color: ' +
(e.key == sort_field && sort_type == 'asc' ? '#038d6e' : '')
"
@click="sort(e.key, 'asc')"
></i>
</th>
</tr>
<tr v-for="(item, index) in table_data" :key="index">
<td v-for="(e, i) in labers" :key="i">
<div v-if="typeof item[e.key] === 'object'">
<el-popover placement="top-start" width="200" trigger="hover">
<!-- <el-popover placement="top-start" width="200" trigger="hover">
<div>
<el-form label-width="80px">
<!-- <el-form-item label="正确数据: ">
<span v-for="(o, b) in item[e.key].exactness.value">{{ o
}},</span>
</el-form-item> -->
<el-form-item label="错误数据: ">
<span v-for="(o, b) in item[e.key].wrong.value">{{ o }},</span>
<span v-for="(o, b) in item[e.key].wrong.value" :key="b"
>{{ o }},</span
>
</el-form-item>
</el-form>
</div>
<el-button slot="reference" type="text" size="mini">{{ item[e.key].accuracy.value }}</el-button>
</el-popover>
<el-button slot="reference" type="text" size="mini">{{
item[e.key].accuracy.value
}}</el-button>
</el-popover> -->
<span slot="reference" type="text" size="mini">
{{ item[e.key] }}
</span>
</div>
<el-popover
v-else-if="e.key === 'stability'"
placement="top-start"
width="100%"
trigger="hover"
>
<div
v-if="
Object.prototype.toString.call(item.conclusion_data) ===
'[object Array]'
"
>
学员答案:{{ item.conclusion_data.join(',') }}
</div>
<div v-else>
<el-table
:data="table_data[index].conclusion_table"
height="250"
border
style="width: 100%"
>
<el-table-column
prop="student_id"
sortable
label="学员信息"
width="180"
>
<template slot-scope="scope">
{{ scope.row.name }}({{ scope.row.student_id }})
</template>
</el-table-column>
<el-table-column
prop="conclusion"
sortable
label="稳定性"
width="180"
>
</el-table-column>
<el-table-column
label="学员答案"
sortable
prop="conclusion_data"
width="180"
>
<template slot-scope="scope">
{{ scope.row.conclusion_data.join(',') }}
</template>
</el-table-column>
</el-table>
</div>
<span slot="reference">{{ item[e.key] }}</span>
</el-popover>
<div v-else>{{ item[e.key] }}</div>
</td>
</tr>
</table>
<!-- <el-table :data="table_data" border style="width: 100%">
<el-table-column
v-for="(item, index) in labers"
:key="index"
:label="item.label"
:width="item.width"
>
<template slot="header">
<div>{{ item.label }}</div>
</template>
<template slot-scope="scope">
<div>{{ scope.row[item.key] }}</div>
</template>
</el-table-column>
</el-table> -->
</div>
</template>
<script>
export default {
props: ['table_data', 'labers'],
props: ['table_data', 'labers', 'is_pover'],
data() {
return {
sort_field: null,
sort_type: null,
};
},
......@@ -48,25 +142,66 @@ export default {
computed: {},
created() {
// console.log(this.table_data);
// console.log(this.labers);
},
mounted() { },
mounted() {},
methods: {
test(item) {
console.log('判断对象');
console.log(item);
console.log(typeof item == 'object');
sort(col, type = 'desc') {
this.sort_field = col;
this.sort_type = type;
if (type == 'asc') {
this.table_data.sort((a, b) => {
let a_n =
parseFloat(a[col]) != a[col] ? a[col].split('~')[0] : a[col];
let b_n =
parseFloat(b[col]) != b[col] ? b[col].split('~')[0] : b[col];
if (parseFloat(a_n) == a_n && parseFloat(b_n) == b_n) {
return a_n - b_n;
} else if (a_n < b_n) {
return -1;
} else if (a_n > b_n) {
return 1;
} else {
return 0;
}
}); //升序
} else {
this.table_data.sort((a, b) => {
let a_n =
parseFloat(a[col]) != a[col] ? a[col].split('~')[0] : a[col];
let b_n =
parseFloat(b[col]) != b[col] ? b[col].split('~')[0] : b[col];
if (parseFloat(a_n) == a_n && parseFloat(b_n) == b_n) {
return b_n - a_n;
} else if (b_n < a_n) {
return -1;
} else if (b_n > a_n) {
return 1;
} else {
return 0;
}
}); //降序
}
},
}
}
},
};
</script>
<style lang="scss" scoped>
.container_box {
width: 100%;
height: 100%;
position: relative;
}
.el-icon-caret-bottom {
position: absolute;
top: 20px;
}
.el-icon-caret-top {
position: absolute;
top: 13px;
}
.table_box {
......@@ -74,8 +209,8 @@ export default {
// min-height: 100%;
text-align: center;
font-size: 14px;
border-top: 1px solid #E4E7ED;
border-left: 1px solid #E4E7ED;
border-top: 1px solid #e4e7ed;
border-left: 1px solid #e4e7ed;
border-collapse: collapse;
th,
......@@ -83,8 +218,8 @@ export default {
margin: 0;
padding: 0;
font-size: 14px;
border-bottom: 1px solid #E4E7ED;
border-right: 1px solid #E4E7ED;
border-bottom: 1px solid #e4e7ed;
border-right: 1px solid #e4e7ed;
}
th {
......
<!--
* @Author: czj
* @Date: 2023-03-21 10:14:46
* @Description:
* @FilePath: \AdministrationHome\src\components\AnalyseModule\components\table.vue
-->
<!-- -->
<template>
<div class="container_box">
<div>
<el-select
v-model="select_value"
style="width: 100%"
@change="selectChange"
>
<el-option v-for="(e, i) in select_list" :label="e" :value="e" :key="i">
</el-option>
</el-select>
</div>
<table class="table_box">
<tr>
<!-- #038d6e -->
<th v-for="(e, i) in labers" :key="i" style="padding: 15px 10px">
{{ e.label
}}<span
><i
class="el-icon-caret-bottom"
:style="
'color: ' +
(e.key == sort_field && sort_type == 'desc' ? '#038d6e' : '')
"
@click="sort(e.key, 'desc')"
></i
><i
class="el-icon-caret-top"
:style="
'color: ' +
(e.key == sort_field && sort_type == 'asc' ? '#038d6e' : '')
"
@click="sort(e.key, 'asc')"
></i
></span>
</th>
</tr>
<tr v-for="(item, index) in table_list" :key="index">
<td v-for="(e, i) in labers" :key="i">
<div>{{ item[e.key] }}</div>
</td>
</tr>
</table>
</div>
</template>
<script>
export default {
props: ['table_data', 'labers'],
data() {
return {
sort_field: null,
sort_type: null,
table_list: null,
select_list: [],
select_value: '',
};
},
components: {},
computed: {},
created() {
// console.log('是否加载');
// console.log(this.table_data);
// console.log(this.labers);
this.select_value = this.table_data.select_value;
this.select_list = [...this.table_data.topic];
this.table_list = this.table_data.list[this.table_data.topic[0]];
},
mounted() {},
methods: {
sort(col, type = 'desc') {
this.sort_field = col;
this.sort_type = type;
if (type == 'asc') {
this.table_list.sort((a, b) => {
let a_n =
parseFloat(a[col]) != a[col] ? a[col].split('~')[0] : a[col];
let b_n =
parseFloat(b[col]) != b[col] ? b[col].split('~')[0] : b[col];
if (parseFloat(a_n) == a_n && parseFloat(b_n) == b_n) {
return a_n - b_n;
} else if (a_n < b_n) {
return -1;
} else if (a_n > b_n) {
return 1;
} else {
return 0;
}
}); //升序
} else {
this.table_list.sort((a, b) => {
let a_n =
parseFloat(a[col]) != a[col] ? a[col].split('~')[0] : a[col];
let b_n =
parseFloat(b[col]) != b[col] ? b[col].split('~')[0] : b[col];
if (parseFloat(a_n) == a_n && parseFloat(b_n) == b_n) {
return b_n - a_n;
} else if (b_n < a_n) {
return -1;
} else if (b_n > a_n) {
return 1;
} else {
return 0;
}
}); //降序
}
},
//选择监听
selectChange(val) {
console.log('val');
console.log(val);
this.table_list = [...this.table_data.list[val]];
},
},
};
</script>
<style lang="scss" scoped>
.container_box {
width: 100%;
height: 100%;
position: relative;
}
.el-icon-caret-bottom {
position: absolute;
top: 56px;
}
.el-icon-caret-top {
position: absolute;
top: 49px;
}
.table_box {
width: 100%;
// min-height: 100%;
text-align: center;
font-size: 14px;
border-top: 1px solid #e4e7ed;
border-left: 1px solid #e4e7ed;
border-collapse: collapse;
th,
td {
margin: 0;
padding: 0;
font-size: 14px;
border-bottom: 1px solid #e4e7ed;
border-right: 1px solid #e4e7ed;
}
th {
padding: 15px 0;
color: #909399;
}
td {
padding: 5px 0;
color: #303133;
}
}
</style>
......@@ -7,6 +7,9 @@
<!-- -->
<template>
<div class="container_box">
<!-- <el-select v-model="">
<el-option></el-option>
</el-select> -->
<table class="table_box">
<!-- <tr>
<th v-for="(e, i) in labers" :key="i">{{ e.label }}</th>
......@@ -22,32 +25,38 @@
<script>
export default {
props: ['table_data',],
props: ['table_data'],
data() {
return {
sel: '',
};
},
components: {},
computed: {},
created() {
created() {},
mounted() {
// console.log(this.table_data);
},
mounted() { },
methods: {
//保留两位,四舍五入
keepTwoDecimal(num) {
var result = parseFloat(num);
if (isNaN(result)) {
return false;
if (num.includes(',')) {
return num;
} else {
result = Math.round(num * 100) / 100;
return result;
var result = parseFloat(num);
if (isNaN(result)) {
return false;
} else {
result = Math.round(num * 100) / 100;
return result;
}
}
}
}
}
},
},
};
</script>
<style lang="scss" scoped>
.container_box {
......@@ -60,8 +69,8 @@ export default {
min-height: 100%;
text-align: center;
font-size: 14px;
border-top: 1px solid #E4E7ED;
border-left: 1px solid #E4E7ED;
border-top: 1px solid #e4e7ed;
border-left: 1px solid #e4e7ed;
border-collapse: collapse;
th,
......@@ -69,8 +78,8 @@ export default {
margin: 0;
padding: 0;
font-size: 14px;
border-bottom: 1px solid #E4E7ED;
border-right: 1px solid #E4E7ED;
border-bottom: 1px solid #e4e7ed;
border-right: 1px solid #e4e7ed;
}
th {
......
......@@ -9,31 +9,75 @@
<div class="container_box">
<table class="table_box">
<tr>
<th v-for="(e, i) in labers" :key="i">{{ e.label }}</th>
<th v-for="(e, i) in labers" :key="i" style="padding: 15px 10px">
{{ e.label
}}<span
><i
class="el-icon-caret-bottom"
:style="
'color: ' +
(e.key == sort_field && sort_type == 'desc' ? '#038d6e' : '')
"
@click="sort(e.key, 'desc')"
></i
><i
class="el-icon-caret-top"
:style="
'color: ' +
(e.key == sort_field && sort_type == 'asc' ? '#038d6e' : '')
"
@click="sort(e.key, 'asc')"
></i
></span>
</th>
</tr>
<tr v-for="(item, index) in table_data" :key="index">
<td v-for="(e, i) in labers" :key="i">
<div v-if="e.key == 'distribute'">
<div v-if="item['distribute'].length > 3">
<el-popover placement="right" title="标题" width="200" trigger="click">
<div
v-if="
typeof item['distribute'] == 'object' &&
item['distribute'].length > 3
"
>
<el-popover
placement="right"
title="标题"
width="200"
trigger="click"
>
<div v-for="(h, key, j) in item['distribute']" :key="j">
{{ key }}({{ item['distribute'][key] }}题)
</div>
<el-button slot="reference" type="text" size="mini">...</el-button>
<el-button slot="reference" type="text" size="mini"
>...</el-button
>
</el-popover>
</div>
<div v-else>
<div v-else-if="typeof item['distribute'] == 'object'">
<div v-for="(h, key, j) in item['distribute']" :key="j">
{{ key }}({{ item['distribute'][key] }}题),
{{ key }}({{ item['distribute'][key] }}题)
</div>
</div>
<div v-else>
<div>
{{ item['distribute'] }}
</div>
</div>
</div>
<div v-else-if="Array.isArray(item[e.key])">
<el-popover placement="right" width="200" trigger="click" v-if="item[e.key].length > 0">
<el-popover
placement="right"
width="200"
trigger="click"
v-if="item[e.key].length > 0"
>
<div v-for="(h, j) in item[e.key]" :key="j">
{{ h }}
</div>
<el-button slot="reference" type="text" size="mini">...</el-button>
<el-button slot="reference" type="text" size="mini"
>...</el-button
>
</el-popover>
</div>
<div v-else>{{ item[e.key] }}</div>
......@@ -48,23 +92,72 @@ export default {
props: ['table_data', 'labers'],
data() {
return {
sort_field: null,
sort_type: null,
};
},
components: {},
computed: {},
created() {},
mounted() {},
mounted() { },
methods: {}
}
methods: {
sort(col, type = 'desc') {
this.sort_field = col;
this.sort_type = type;
if (type == 'asc') {
this.table_data.sort((a, b) => {
let a_n =
parseFloat(a[col]) != a[col] ? a[col].split('~')[0] : a[col];
let b_n =
parseFloat(b[col]) != b[col] ? b[col].split('~')[0] : b[col];
if (parseFloat(a_n) == a_n && parseFloat(b_n) == b_n) {
return a_n - b_n;
} else if (a_n < b_n) {
return -1;
} else if (a_n > b_n) {
return 1;
} else {
return 0;
}
}); //升序
} else {
this.table_data.sort((a, b) => {
let a_n =
parseFloat(a[col]) != a[col] ? a[col].split('~')[0] : a[col];
let b_n =
parseFloat(b[col]) != b[col] ? b[col].split('~')[0] : b[col];
if (parseFloat(a_n) == a_n && parseFloat(b_n) == b_n) {
return b_n - a_n;
} else if (b_n < a_n) {
return -1;
} else if (b_n > a_n) {
return 1;
} else {
return 0;
}
}); //降序
}
},
},
};
</script>
<style lang="scss" scoped>
.container_box {
width: 100%;
height: 100%;
position: relative;
}
.el-icon-caret-bottom {
position: absolute;
top: 20px;
}
.el-icon-caret-top {
position: absolute;
top: 13px;
}
.table_box {
......@@ -72,8 +165,8 @@ export default {
// min-height: 100%;
text-align: center;
font-size: 14px;
border-top: 1px solid #E4E7ED;
border-left: 1px solid #E4E7ED;
border-top: 1px solid #e4e7ed;
border-left: 1px solid #e4e7ed;
border-collapse: collapse;
th,
......@@ -81,8 +174,8 @@ export default {
margin: 0;
padding: 0;
font-size: 14px;
border-bottom: 1px solid #E4E7ED;
border-right: 1px solid #E4E7ED;
border-bottom: 1px solid #e4e7ed;
border-right: 1px solid #e4e7ed;
}
th {
......
......@@ -16,33 +16,64 @@
<div class="header_box">
<el-row>
<el-col :span="12">
<div class="title_box" :title="original_data.title"> {{ original_data.title }}</div>
<div class="title_box" :title="original_data.title">
{{ original_data.title }}
</div>
</el-col>
<el-col :span="12" style="text-align: right;">
<el-checkbox v-if="original_data.is_show" v-model="original_data.is_show.value" @change="changeSelect">{{
original_data.is_show.value ? '显示' : '隐藏'
}}</el-checkbox>
<el-col :span="12" style="text-align: right">
<el-checkbox
v-if="original_data.is_show"
v-model="original_data.is_show.value"
@change="changeSelect"
>{{ original_data.is_show.value ? '显示' : '隐藏' }}</el-checkbox
>
</el-col>
</el-row>
</div>
<div class="content_container" v-if="original_data.type == 'table'">
<Table :table_data="original_data.list" :labers="original_data.labers"></Table>
<Table
v-if="original_data"
:table_data="original_data.list"
:labers="original_data.labers"
></Table>
</div>
<div class="content_container" v-if="original_data.type == 'select_table'">
<SelectTabe
v-if="original_data"
:table_data="original_data"
:labers="original_data.labers"
>
</SelectTabe>
</div>
<div class="content_container" v-if="false">
<line-chart :chart_data="original_data.data" :chart_id="original_data.chart_id"></line-chart>
<line-chart
:chart_data="original_data.data"
:chart_id="original_data.chart_id"
></line-chart>
</div>
<div class="content_container" v-if="original_data.type == 'bar'">
<bar-chart
:chart_data="{ raw_data: original_data.raw_data, keys: original_data.keys, labers: original_data.labers }"
:chart_id="original_data.chart_id"></bar-chart>
:chart_data="{
raw_data: original_data.raw_data,
keys: original_data.keys,
labers: original_data.labers,
}"
:chart_id="original_data.chart_id"
></bar-chart>
</div>
<div class="content_container" v-if="original_data.type == 'simple_table'">
<simple-table :table_data="original_data"></simple-table>
</div>
<!-- 眼光稳定性 -->
<div class="content_container" v-if="original_data.type == 'eye_stability_table'">
<eye-stability-table :table_data="original_data.list" :labers="original_data.labers"></eye-stability-table>
<div
class="content_container"
v-if="original_data.type == 'eye_stability_table'"
>
<eye-stability-table
:table_data="original_data.list"
:labers="original_data.labers"
></eye-stability-table>
</div>
</div>
</template>
......@@ -53,31 +84,38 @@ import LineChart from './components/LineChart.vue';
import BarChart from './components/BarChart.vue';
import SimpleTable from './components/SimpleTable.vue';
import EyeStabilityTable from './components/EyeStabilityTable.vue';
import SelectTabe from './components/SelectTabe.vue';
export default {
props: ['module_data'],
data() {
return {
original_data: {},
original_data: null,
};
},
components: { Table, LineChart, BarChart, SimpleTable, EyeStabilityTable },
components: {
Table,
LineChart,
BarChart,
SimpleTable,
EyeStabilityTable,
SelectTabe,
},
computed: {},
created() {
this.original_data = { ...this.module_data };
console.log(this.original_data);
},
mounted() {
},
mounted() {},
methods: {
//选择框监听
changeSelect() {
this.$emit('changeSelect', this.original_data.is_show);
},
}
}
},
};
</script>
<style lang="scss" scoped>
.analyse_container {
......
......@@ -10,16 +10,33 @@
<el-row>
<el-col :span="12">
<div>
<el-button type="text" icon="el-icon-arrow-left" size="mini" class="back_btn" @click="back">返回</el-button>
<el-button
type="text"
icon="el-icon-arrow-left"
size="mini"
class="back_btn"
@click="back"
>返回</el-button
>
<h2 class="title_box">
<div v-if="Array.isArray(info_data.title)">
<span>{{ info_data.title[0] }}</span>
<el-popover placement="bottom" title="多个标题" width="200" trigger="hover">
<!-- <span>{{ info_data.title[0] }}</span> -->
<el-popover placement="bottom" width="480" trigger="hover">
<div>
<el-tag type="info" v-for="(item, index) in info_data.title" :key="index"
style="margin-bottom: 10px;">{{ item }}</el-tag>
<el-tag
type="info"
v-for="(item, index) in info_data.title"
:key="index"
style="margin-bottom: 10px"
>{{ item }}</el-tag
>
</div>
<el-button slot="reference" type="text">...</el-button>
<el-button
style="color: #000; font-size: 20px"
slot="reference"
type="text"
>{{ info_data.title[0] }}</el-button
>
</el-popover>
</div>
<div v-else>
......@@ -28,15 +45,18 @@
</h2>
</div>
</el-col>
<el-col :span="12" style="text-align: right;">
<el-button type="primary" v-for="(item, index) in info_data.right_buttons" :key="index" :icon="item.icon"
@click="btnClick(item.event)">
<el-col :span="12" style="text-align: right">
<el-button
type="primary"
v-for="(item, index) in info_data.right_buttons"
:key="index"
:icon="item.icon"
@click="btnClick(item.event)"
>
{{ item.text }}
</el-button>
</el-col>
</el-row>
</div>
</template>
......@@ -56,10 +76,10 @@ export default {
computed: {},
created() {
this.info_data = { ...this.examination_questions };
console.log('头部接受到的数据');
console.log(this.examination_questions);
// console.log('头部接受到的数据');
// console.log(this.examination_questions);
},
mounted() { },
mounted() {},
methods: {
back() {
......@@ -67,24 +87,23 @@ export default {
},
seconds_to_minutes(str) {
if (str) {
return secondsToMinutes(str)
return secondsToMinutes(str);
} else {
return '暂无'
return '暂无';
}
},
btnClick(val) {
this.$emit('btnClick', val);
},
}
}
},
};
</script>
<style lang="scss" scoped>
.back_btn {
/* font-size: 16px; */
color: #303133;
border-right: 1px solid #DCDFE6;
border-right: 1px solid #dcdfe6;
padding: 3px 10px 3px 0;
border-radius: none;
}
......
<!--
* @Author: czj
* @Date: 2023-03-03 10:41:57
* @Description:
* @FilePath: \AdministrationHome\src\components\TableHead\index.vue
-->
<!-- -->
<template>
<div>
<el-row :gutter="20">
<el-col :span="9">
<div v-if="head_data.is_search_show">
<span>搜索:</span>
<el-input
placeholder="输入名称"
class="search_box"
v-model="search_val"
:placeholder="
!head_data.search_placeholder
? '搜索'
: head_data.search_placeholder
"
@change="searchChange"
></el-input>
<el-button type="warning" size="small" @click="search"
>搜索</el-button
>
<el-button size="small" @click="resetting">重置</el-button>
</div>
<div v-else style="opacity: 0; pointer-events: none">暂无</div>
</el-col>
<el-col :span="13" style="text-align: right; padding-right: 0">
<span
v-for="(item, index) in head_data.right_buttons"
:key="index"
style="margin: 0 8px"
>
<el-button
v-if="upload_btns.indexOf(item.event) == -1"
type="primary"
:icon="item.icon"
@click="btnClick(item.event)"
>{{ item.text }}</el-button
>
<el-upload
v-else
id="upload_moudel"
class="avatar-uploader"
action="#"
:show-file-list="false"
accept=""
:http-request="sliderRequest"
>
<el-button
type="primary"
:icon="item.icon"
@click="uploadCode(item.event)"
>{{ item.text }}</el-button
>
</el-upload>
</span>
</el-col>
<el-col :span="2"
><span v-if="head_data.ensembel_btn"
><el-badge :value="head_data.number_value">
<el-popover
placement="bottom"
width="400"
style="overflow-y: hidden"
trigger="hover"
v-model="visible"
>
<el-table
:data="head_data.select_data"
height="600"
style="width: 100%"
>
<el-table-column prop="id" label="编号"> </el-table-column>
<el-table-column prop="title" label="考试标题" width="180">
</el-table-column>
<el-table-column prop="address" label="操作">
<template slot-scope="scope">
<el-button
type="danger"
icon="el-icon-delete"
@click="deleteSelectData(scope)"
circle
></el-button>
</template>
</el-table-column>
</el-table>
<el-button
style="float: right; margin-top: 10px"
@click="
btnClick(head_data.ensembel_btn.event), (visible = !visible)
"
type="primary"
>{{ head_data.ensembel_btn.text }}</el-button
>
<el-button
slot="reference"
:icon="head_data.ensembel_btn.icon"
type="primary"
>{{ head_data.ensembel_btn.text }}</el-button
>
</el-popover>
</el-badge></span
></el-col
>
</el-row>
</div>
</template>
<script>
export default {
props: ['head_data'],
data() {
return {
search_val: '',
select_ids: [],
upload_btns: [
'upload',
'examination_questions_upload',
'batch_reservation',
],
btn_code: '',
visible: false,
};
},
components: {},
watch: {
head_data: {
handler(newValue, oldVlue) {
this.head_data = newValue;
},
deep: true,
},
},
computed: {},
mounted() {
// console.log(this.head_data);
},
methods: {
search() {
this.$emit('search', this.search_val);
},
searchChange() {
this.$emit('change', this.search_val);
},
resetting() {
this.search_val = null;
this.$emit('resetting', null);
},
addEvent() {
this.$emit('add');
},
//右侧按钮事件
btnClick(val) {
this.$emit('btnClick', val);
},
uploadCode(val) {
this.btn_code = val;
},
// 上传代理
sliderRequest(upload) {
let uploads = { ...upload };
uploads['btn_code'] = this.btn_code;
this.$emit('upload', uploads);
},
//删除购物车内容
deleteSelectData(scope) {
this.$emit('deleteSelectData', scope.$index, scope.row.id);
// this.head_data.select_data.splice(scope.$index, 1);
},
},
};
</script>
<style scoped>
.search_box {
width: 200px;
margin-right: 15px;
}
.avatar-uploader {
display: inline-block;
}
</style>
......@@ -11,25 +11,67 @@
<el-col :span="9">
<div v-if="head_data.is_search_show">
<span>搜索:</span>
<el-input placeholder="输入名称" class="search_box" v-model="search_val"
:placeholder="!head_data.search_placeholder ? '搜索' : head_data.search_placeholder"
@change="searchChange"></el-input>
<el-button type="warning" size="small" @click="search">搜索</el-button>
<el-input
placeholder="输入名称"
class="search_box"
v-model="search_val"
:placeholder="
!head_data.search_placeholder
? '搜索'
: head_data.search_placeholder
"
@change="searchChange"
></el-input>
<el-button type="warning" size="small" @click="search"
>搜索</el-button
>
<el-button size="small" @click="resetting">重置</el-button>
</div>
<div v-else style="opacity: 0;pointer-events: none;">暂无</div>
<div v-else style="opacity: 0; pointer-events: none">暂无</div>
</el-col>
<el-col :span="15" style="text-align: right;">
<span v-for="(item, index) in head_data.right_buttons" :key="index" style="margin: 0 8px;">
<el-button v-if="upload_btns.indexOf(item.event) == -1" type="primary" :icon="item.icon"
@click="btnClick(item.event)">{{
item.text }}</el-button>
<el-upload v-else id="upload_moudel" class="avatar-uploader" action="#" :show-file-list="false" accept=""
:http-request="sliderRequest">
<el-button type="primary" :icon="item.icon" @click="uploadCode(item.event)">{{ item.text }}</el-button>
<el-col :span="15" style="text-align: right; padding-right: 0">
<span
v-for="(item, index) in head_data.right_buttons"
:key="index"
style="margin: 0 8px"
>
<el-button
v-if="upload_btns.indexOf(item.event) == -1"
type="primary"
:icon="item.icon"
@click="btnClick(item.event)"
>{{ item.text }}</el-button
>
<el-upload
v-else
id="upload_moudel"
class="avatar-uploader"
action="#"
:show-file-list="false"
accept=""
:http-request="sliderRequest"
>
<el-button
type="primary"
:icon="item.icon"
@click="uploadCode(item.event)"
>{{ item.text }}</el-button
>
</el-upload>
</span>
</el-col>
<!-- <el-col :span="2"
><span v-if="head_data.ensembel_btn"
><el-badge :value="head_data.number_value">
<el-button
:icon="head_data.ensembel_btn.icon"
@click="btnClick(head_data.ensembel_btn.event)"
type="primary"
>{{ head_data.ensembel_btn.text }}</el-button
>
</el-badge></span
></el-col
> -->
</el-row>
</div>
</template>
......@@ -40,16 +82,29 @@ export default {
data() {
return {
search_val: '',
upload_btns: ['upload', 'examination_questions_upload', 'batch_reservation'],
upload_btns: [
'upload',
'examination_questions_upload',
'batch_reservation',
],
btn_code: '',
};
},
components: {},
watch: {
head_data: {
handler(newValue, oldVlue) {
this.head_data = newValue;
},
deep: true,
},
},
computed: {},
mounted() { },
mounted() {
console.log(this.head_data);
},
methods: {
search() {
......@@ -59,7 +114,7 @@ export default {
this.$emit('change', this.search_val);
},
resetting() {
this.search_val = null
this.search_val = null;
this.$emit('resetting', null);
},
addEvent() {
......@@ -75,13 +130,12 @@ export default {
},
// 上传代理
sliderRequest(upload) {
let uploads = { ...upload }
uploads['btn_code'] = this.btn_code
this.$emit('upload', uploads)
let uploads = { ...upload };
uploads['btn_code'] = this.btn_code;
this.$emit('upload', uploads);
},
}
}
},
};
</script>
<style scoped>
.search_box {
......
/**
* @Author: AnthonyD
* @Date: 2023-03-23 15:22:21
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-30 15:05:46
*/
import Cookies from 'js-cookie'
const TokenKey = 'Admin-Token'
const TokenKey = 'Admin-Token_min'
export function getToken() {
return Cookies.get(TokenKey)
......
......@@ -55,10 +55,24 @@ export function secondsToMinutes(s) {
//两个数,求百分比
export function toPercent(num, total) {
return (Math.round(num / total * 10000) / 100.00 + "%");// 小数点后两位百分比
}
if (num == 0) {
return '0%'
} else {
return (Math.round(num / total * 10000) / 100.00 + "%");// 小数点后两位百分比
}
}
//取至小数点后两位,四舍五入
export function keepTwoDecimal(num) {
var result = parseFloat(num);
if (isNaN(result)) {
return false;
} else {
result = Math.round(num * 100) / 100;
return result;
}
}
......
......@@ -8,30 +8,57 @@
<template>
<div class="module_container">
<el-card class="module_container_left">
<el-tree :data="left_terr_data" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode"
ref="tree" :default-expand-all="false" @node-click="handleNodeClick" />
<el-tree
:data="left_terr_data"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
:default-expand-all="false"
@node-click="handleNodeClick"
/>
</el-card>
<div class="right_container">
<div class="card_container">
<el-card class="box-card">
<table-head :head_data="head_data" @search="searchEvent" @change="searchChange" @resetting="resetting"
@btnClick="btnClick"></table-head>
<table-head
:head_data="head_data"
@search="searchEvent"
@change="searchChange"
@resetting="resetting"
@btnClick="btnClick"
></table-head>
<div class="table_container">
<el-table v-loading="is_loading" :data="tableData" style="width: 100%;margin-bottom: 20px;" height="600">
<el-table
v-loading="is_loading"
:data="tableData"
style="width: 100%; margin-bottom: 20px"
height="600"
>
<el-table-column prop="id" label="编号" width="80">
</el-table-column>
<el-table-column prop="name" label="烟草产地">
<template slot-scope="scope">
<div v-for="(item, index) in scope.row.tobacco_breed_place" :key="index">{{ item.area }}.
{{ item.place_of_production }};
<div
v-for="(item, index) in scope.row.tobacco_breed_place"
:key="index"
>
{{ item.area }}. {{ item.place_of_production }};
</div>
</template>
</el-table-column>
<el-table-column prop="name" label="品种名称" width="150">
</el-table-column>
<el-table-column prop="appearance_characteristics" label="外观特征" width="120">
<el-table-column
prop="appearance_characteristics"
label="外观特征"
width="120"
>
<template slot-scope="scope">
<div v-for="(e, key, i) in scope.row.appearance_characteristics" :key="i">
<div
v-for="(e, key, i) in scope.row.appearance_characteristics"
:key="i"
>
<span>{{ key }}</span>
<span>{{ scope.row.appearance_characteristics[key] }}</span>
</div>
......@@ -41,39 +68,69 @@
<template slot-scope="scope">
<el-popover placement="right" trigger="click">
<div class="amplify_img_box">
<img :src="IP + scope.row.image" alt="">
<img :src="IP + scope.row.image" alt="" />
</div>
<img class="small_picture" slot="reference" :src="IP + scope.row.image" alt="">
<img
class="small_picture"
slot="reference"
:src="IP + scope.row.image"
alt=""
/>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注">
</el-table-column>
<el-table-column prop="remark" label="备注"> </el-table-column>
<el-table-column prop="created_at" label="创建时间">
</el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button size="mini" type="text" style="color: #000;"
@click="updataTobaccoInfo(scope.row)">编辑</el-button>
<el-button size="mini" type="text" style="color: #F56C6C;"
@click="deleteTobacco(scope.row)">删除</el-button>
<el-button
size="mini"
type="text"
style="color: #000"
@click="updataTobaccoInfo(scope.row)"
>编辑</el-button
>
<el-button
size="mini"
type="text"
style="color: #f56c6c"
@click="deleteTobacco(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div style="text-align: right;">
<el-pagination @current-change="handleCurrentChange" :current-page.sync="request_params.page"
:page-size="request_params.limit" layout="total, prev, pager, next" :total="request_params.total">
<div style="text-align: right">
<el-pagination
@current-change="handleCurrentChange"
:current-page.sync="request_params.page"
:page-size="request_params.limit"
layout="total, prev, pager, next"
:total="request_params.total"
>
</el-pagination>
</div>
</el-card>
</div>
</div>
<el-dialog :title="is_updata_type == 'add' ? '新增品种信息' : '修改品种信息'" :visible.sync="is_dialogVisible" width="60%"
top="50px" :before-close="handleClose">
<Dialog :left_terr_data="left_terr_data" :ProvinceData="ProvinceData" :tobacco_infos="tobacco_info"
@handleClose="handleClose" @submitData="submitData" :key="new Date().getTime()"></Dialog>
<el-dialog
:title="is_updata_type == 'add' ? '新增品种信息' : '修改品种信息'"
:visible.sync="is_dialogVisible"
width="60%"
top="50px"
:before-close="handleClose"
>
<Dialog
:left_terr_data="left_terr_data"
:ProvinceData="ProvinceData"
:tobacco_infos="tobacco_info"
@handleClose="handleClose"
@submitData="submitData"
:key="new Date().getTime()"
></Dialog>
</el-dialog>
</div>
</template>
......@@ -81,7 +138,16 @@
<script>
import TableHead from '@/components/TableHead/index';
import Dialog from './components/dialog.vue';
import { get_province_list, get_tobacco_province, get_tobacco_all_info, add_tobacco_breed, delete_tobacco_breed, updata_tobacco_breed, get_tobacco_detail, get_tobacco_breed_list } from '@/api/student';
import {
get_province_list,
get_tobacco_province,
get_tobacco_all_info,
add_tobacco_breed,
delete_tobacco_breed,
updata_tobacco_breed,
get_tobacco_detail,
get_tobacco_breed_list,
} from '@/api/student';
const standard_template = {
name: '',
tobacco_breed_place: [
......@@ -91,15 +157,13 @@ const standard_template = {
},
],
appearance_characteristics: {
"颜色": "绿色",
"大小": "50CM"
颜色: '绿色',
大小: '50CM',
},
appearance_characteristics_vals: [
{ label: "颜色", value: '绿色' },
],
image: "",
remark: ""
}
appearance_characteristics_vals: [{ label: '颜色', value: '绿色' }],
image: '',
remark: '',
};
export default {
data() {
return {
......@@ -114,7 +178,7 @@ export default {
text: '新增',
icon: 'el-icon-document-add',
event: 'add',
}
},
],
},
//初始化请求参数
......@@ -134,8 +198,8 @@ export default {
left_terr_data: [],
//树字段对应
defaultProps: {
children: "children",
label: "name"
children: 'children',
label: 'name',
},
//烟草信息
tobacco_info: {},
......@@ -153,7 +217,7 @@ export default {
computed: {},
mounted() {
this.init()
this.init();
},
methods: {
......@@ -196,7 +260,7 @@ export default {
let params = this.$handleParams(val);
console.log(params);
if (this.is_updata_type == 'add') {
add_tobacco_breed(params).then(res => {
add_tobacco_breed(params).then((res) => {
console.log('新增回调');
console.log(res);
if (res.code == 200) {
......@@ -205,10 +269,10 @@ export default {
// this.getTobaccoAllInfo();
this.getTobaccoBreedList();
}
})
});
} else {
let id = val.id;
updata_tobacco_breed(id, params).then(res => {
updata_tobacco_breed(id, params).then((res) => {
console.log('修改回调');
console.log(res);
if (res.code == 200) {
......@@ -217,41 +281,41 @@ export default {
// this.getTobaccoAllInfo();
this.getTobaccoBreedList();
}
})
});
}
},
//获取烟草区域信息
getTobaccoProvince() {
get_tobacco_province().then(res => {
get_tobacco_province().then((res) => {
console.log('烟草区域信息');
console.log(res);
this.left_terr_data = res || [];
for (let i in this.left_terr_data) {
this.selectProvince(this.left_terr_data[i].name)
this.selectProvince(this.left_terr_data[i].name);
}
})
});
},
//获取烟草列表
getTobaccoBreedList() {
this.is_loading = true;
let params = this.$removeProperty(this.request_params);
get_tobacco_breed_list(params).then(res => {
get_tobacco_breed_list(params).then((res) => {
this.tableData = res.data || [];
this.request_params.total = res.total;
this.is_loading = false;
})
});
},
//获取烟草全部信息
getTobaccoAllInfo() {
this.is_loading = true;
get_tobacco_all_info().then(res => {
get_tobacco_all_info().then((res) => {
console.log('全部烟草信息');
console.log(res);
this.tableData = res || [];
this.is_loading = false;
})
});
},
//获取获取省市区信息
selectProvince(val, index) {
......@@ -262,14 +326,14 @@ export default {
if (list[i].children.length == 0) {
delete list[i].children;
} else {
removeNodeInTree(list[i].children)
removeNodeInTree(list[i].children);
}
}
return list
}
get_province_list({ area: val }).then(res => {
return list;
};
get_province_list({ area: val }).then((res) => {
this.ProvinceData[val] = removeNodeInTree(res);
})
});
},
// 左侧树节点单击事件
handleNodeClick(data) {
......@@ -299,23 +363,27 @@ export default {
let id = items.id;
this.tobacco_info.id = items.id;
this.tobacco_info.name = items.name;
this.tobacco_info.appearance_characteristics = items.appearance_characteristics;
this.tobacco_info.appearance_characteristics =
items.appearance_characteristics;
this.tobacco_info.appearance_characteristics_vals = [];
for (const key in items.appearance_characteristics) {
this.tobacco_info.appearance_characteristics_vals.push({
label: key,
value: items.appearance_characteristics[key]
value: items.appearance_characteristics[key],
});
}
this.tobacco_info['remark'] = items.remark;
this.tobacco_info['image'] = items.image;
this.tobacco_info.tobacco_breed_place = [];
get_tobacco_detail(id).then(res => {
get_tobacco_detail(id).then((res) => {
res.tobacco_breed_place.forEach((element, index) => {
this.tobacco_info.tobacco_breed_place.push({ area: element.area, province_id: element.province_id })
this.tobacco_info.tobacco_breed_place.push({
area: element.area,
province_id: element.province_id,
});
});
this.is_dialogVisible = true;
})
});
},
//删除烟草信息
deleteTobacco(item) {
......@@ -323,20 +391,22 @@ export default {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delete_tobacco_breed(id).then(res => {
if (res.code == 200) {
this.$message.success(res.message);
this.init();
}
type: 'warning',
})
.then(() => {
delete_tobacco_breed(id).then((res) => {
if (res.code == 200) {
this.$message.success(res.message);
this.init();
}
});
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除',
});
});
});
},
//分页
......@@ -344,10 +414,8 @@ export default {
this.request_params.page = val;
this.getTobaccoBreedList();
},
},
}
};
</script>
<style lang="scss" scoped>
.small_picture {
......
......@@ -12,44 +12,84 @@
<Header v-if="!is_loading" :examination_questions="head_data"></Header>
</el-card>
<el-card class="box-card">
<div>
<div class="module_header">得分情况</div>
<div>
<el-row class="row_container">
<el-col :span="8" v-if="review_conditions && review_conditions.is_ScoreScore" class="unit_container">
<el-col
:span="8"
v-if="review_conditions && review_conditions.is_ScoreScore"
class="unit_container"
>
<div class="centenr_container">
<AnalyseModule :module_data="result_section" v-if="result_section">
<AnalyseModule
:module_data="result_section"
v-if="result_section"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="8" v-if="review_conditions && review_conditions.is_AreaScore" class="unit_container">
<el-col
:span="8"
v-if="review_conditions && review_conditions.is_AreaScore"
class="unit_container"
>
<div class="centenr_container">
<AnalyseModule :module_data="area_score" v-if="area_score">
</AnalyseModule>
</div>
</el-col>
<el-col :span="8" v-if="review_conditions && review_conditions.is_ProvinceScore" class="unit_container">
<el-col
:span="8"
v-if="review_conditions && review_conditions.is_ProvinceScore"
class="unit_container"
>
<div class="centenr_container">
<AnalyseModule :module_data="province_score" v-if="province_score">
<AnalyseModule
:module_data="province_score"
v-if="province_score"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="8" v-if="review_conditions && review_conditions.is_breedScore" class="unit_container">
<el-col
:span="8"
v-if="review_conditions && review_conditions.is_breedScore"
class="unit_container"
>
<div class="centenr_container">
<AnalyseModule :module_data="breed_score" v-if="breed_score">
</AnalyseModule>
</div>
</el-col>
<el-col :span="8" v-if="review_conditions && review_conditions.is_getHighesLowesttScore"
class="unit_container">
<el-col
:span="8"
v-if="
review_conditions &&
review_conditions.is_getHighesLowesttScore
"
class="unit_container"
>
<div class="centenr_container">
<AnalyseModule :module_data="get_highes_lowestt_score_data" v-if="get_highes_lowestt_score_data">
<AnalyseModule
:module_data="get_highes_lowestt_score_data"
v-if="get_highes_lowestt_score_data"
>
</AnalyseModule>
</div>
</el-col>
<!-- 学员得分 -->
<el-col :span="8">
<div class="centenr_container">
<AnalyseModule
:module_data="transcript_data"
v-if="transcript_data"
>
</AnalyseModule>
</div>
</el-col>
</el-row>
</div>
</div>
......@@ -60,67 +100,113 @@
<el-row class="row_container">
<el-col :span="12">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_question_data" v-if="wrong_question_data"></AnalyseModule>
<AnalyseModule
:module_data="wrong_question_data"
v-if="wrong_question_data"
></AnalyseModule>
</div>
</el-col>
<el-col :span="12">
<div class="centenr_container">
<AnalyseModule :module_data="exactness_question_data" v-if="exactness_question_data"></AnalyseModule>
<AnalyseModule
:module_data="exactness_question_data"
v-if="exactness_question_data"
></AnalyseModule>
</div>
</el-col>
</el-row>
</div>
</div>
<div>
<div class="module_header">错误方向分析</div>
<div>
<el-row class="row_container">
<el-col :span="12" v-if="review_conditions && review_conditions.is_WrongPosition" class="unit_container">
<el-col
:span="12"
v-if="review_conditions && review_conditions.is_WrongPosition"
class="unit_container"
style="margin-top: 15px"
>
<div class="centenr_container">
<AnalyseModule :module_data="wrong_position_data" v-if="wrong_position_data"></AnalyseModule>
<AnalyseModule
:module_data="wrong_position_data"
v-if="wrong_position_data"
></AnalyseModule>
</div>
</el-col>
<el-col :span="12" v-if="review_conditions && review_conditions.is_ErrorLevel" class="unit_container">
<el-col
:span="12"
v-if="review_conditions && review_conditions.is_ErrorLevel"
class="unit_container"
>
<div class="centenr_container">
<AnalyseModule :module_data="error_level_data" v-if="error_level_data">
<AnalyseModule
:module_data="error_level_data"
v-if="error_level_data"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="12" v-if="review_conditions && review_conditions.is_WrongColor" class="unit_container">
<el-col
:span="12"
v-if="review_conditions && review_conditions.is_WrongColor"
class="unit_container"
>
<div class="centenr_container">
<AnalyseModule :module_data="wrong_color_data" v-if="wrong_color_data">
<AnalyseModule
:module_data="wrong_color_data"
v-if="wrong_color_data"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="12" v-if="review_conditions && review_conditions.is_WrongGroup" class="unit_container">
<el-col
:span="12"
v-if="review_conditions && review_conditions.is_WrongGroup"
class="unit_container"
>
<div class="centenr_container">
<AnalyseModule :module_data="wrongG_group_data" v-if="wrongG_group_data">
<AnalyseModule
:module_data="wrongG_group_data"
v-if="wrongG_group_data"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="12" v-if="review_conditions && review_conditions.is_getHighesLowesttScore"
class="unit_container">
<el-col
:span="12"
v-if="
review_conditions &&
review_conditions.is_getHighesLowesttScore
"
class="unit_container"
>
<div class="centenr_container">
<AnalyseModule :module_data="eye_stability_data" v-if="eye_stability_data">
<AnalyseModule
:module_data="eye_stability_data"
v-if="eye_stability_data"
>
</AnalyseModule>
</div>
</el-col>
</el-row>
</div>
</div>
<div>
<div class="module_header">老师点评</div>
<div style="padding: 0 10px;box-sizing: border-box;">
<el-input v-model="found_remark" type="textarea" :rows="6" placeholder="暂无内容" disabled>
<div style="padding: 0 10px; box-sizing: border-box">
<el-input
v-model="found_remark"
type="textarea"
:rows="6"
placeholder="暂无内容"
disabled
>
</el-input>
</div>
</div>
</el-card>
</div>
</div>
</template>
......@@ -179,7 +265,8 @@ export default {
wrong_color_data: null,
//错误组别
wrongG_group_data: null,
//学员得分情况
transcript_data: null,
//老师点评
found_remark: null,
};
......@@ -199,33 +286,59 @@ export default {
//获取批阅试题列表-详情
getReadOverDetail() {
this.is_loading = true;
get_read_over_detail(this.examination_questions_id).then(res => {
get_read_over_detail(this.examination_questions_id).then((res) => {
console.log('获取试题详情');
console.log(res);
this.found_remark = res.found_remark || '';
this.head_data.title = res.review_content.title_list;//标题
this.head_data.title = res.review_content.title_list; //标题
this.is_loading = false;
this.review_conditions = res.review_conditions;//审阅条件
this.review_conditions = res.review_conditions; //审阅条件
if (res.review_content) {
this.result_section = this.changeScore(res.review_content.ScoreScore);//成绩分段
this.area_score = this.changeAreaScore(res.review_content.AreaScore);//南北方得分
this.province_score = this.changeProvinceScore(res.review_content.ProvinceScore);//省区得分
this.breed_score = this.changeBreedScore(res.review_content.breedScore);//品种得分
this.result_section = this.changeScore(res.review_content.ScoreScore); //成绩分段
this.area_score = this.changeAreaScore(res.review_content.AreaScore); //南北方得分
this.province_score = this.changeProvinceScore(
res.review_content.ProvinceScore
); //省区得分
this.breed_score = this.changeBreedScore(
res.review_content.breedScore
); //品种得分
//最高分、最低分、平均分,中位数、众数、离散(变异系数)
this.get_highes_lowestt_score_data = this.getHighesLowesttScore(res.review_content.getHighesLowesttScore);
this.eye_stability_data = this.changeEyeStability(res.review_content.EyeStability);
this.get_highes_lowestt_score_data = this.getHighesLowesttScore(
res.review_content.getHighesLowesttScore
);
this.eye_stability_data = this.changeEyeStability(
res.review_content.EyeStability
);
//学员得分
this.transcript_data = this.changeTranscript(
res.review_content.Transcript
);
//对错题分析
if (res.review_content.top_data) this.wrong_question_data = this.changeWrong(res.review_content.top_data.datadesc);//错题分析
if (res.review_content.top_data) this.exactness_question_data = this.changeRight(res.review_content.top_data.dataasc);//对题分析
this.wrong_position_data = this.changeWrongPosition(res.review_content.WrongPosition);//错误部位
this.error_level_data = this.changeErrorLevel(res.review_content.ErrorLevel);//错误等级
this.wrong_color_data = this.changeWrongColor(res.review_content.WrongColor);//错误颜色
this.wrongG_group_data = this.changeWrongGroup(res.review_content.WrongGroup);//错误组别
if (res.review_content.top_data)
this.wrong_question_data = this.changeWrong(
res.review_content.top_data.datadesc
); //错题分析
if (res.review_content.top_data)
this.exactness_question_data = this.changeRight(
res.review_content.top_data.dataasc
); //对题分析
this.wrong_position_data = this.changeWrongPosition(
res.review_content.WrongPosition
); //错误部位
this.error_level_data = this.changeErrorLevel(
res.review_content.ErrorLevel
); //错误等级
this.wrong_color_data = this.changeWrongColor(
res.review_content.WrongColor
); //错误颜色
this.wrongG_group_data = this.changeWrongGroup(
res.review_content.WrongGroup
); //错误组别
console.log('处理好的数据');
console.log(this.wrong_position_data);
}
})
});
},
//计算百分比
toPercent,
......@@ -242,18 +355,18 @@ export default {
let labers = [
{ label: '分类', key: 'classify' },
{ label: '分数段', key: 'score' },
{ label: '人数', key: 'people' },
{ label: '人次', key: 'people' },
{ label: '占比', key: 'proportion' },
];
keys.forEach(element => {
keys.forEach((element) => {
let scores = element.split('~');
data.push(datas[element]);
let obj = {
classify: element,
score: scores[0],
people: datas[element],
proportion: this.toPercent(datas[element], num)
}
proportion: this.toPercent(datas[element], num),
};
list.push(obj);
});
return {
......@@ -264,7 +377,6 @@ export default {
labers,
list,
data,
};
},
//南方烟北方烟得分情况
......@@ -272,19 +384,18 @@ export default {
if (!datas) return false;
let keys = Object.keys(datas);
let labers = [
{ label: '分数', key: 'ScoreScore' },
{ label: '总分', key: 'assemble' },
{ label: '人数', key: 'student_num' },
{ label: '总题数', key: 'assemble' },
{ label: '正确人次', key: 'success_man_time' },
{ label: '错误人次', key: 'error_man_time' },
];
return {
type: "bar",
type: 'bar',
chart_id: 'bar_chart',
color: '#E6A23C',
title: '南方北方烟得分情况',
labers,
keys,
raw_data: datas,
};
},
//省区得分数据处理
......@@ -292,19 +403,18 @@ export default {
if (!datas) return false;
let keys = Object.keys(datas);
let labers = [
{ label: '分数', key: 'ScoreScore' },
{ label: '总分', key: 'assemble' },
{ label: '人数', key: 'student_num' },
{ label: '总题数', key: 'assemble' },
{ label: '正确人次', key: 'success_man_time' },
{ label: '错误人次', key: 'error_man_time' },
];
return {
type: "bar",
type: 'bar',
chart_id: 'province_bar_chart',
color: '#505F79',
title: '省级产区得分情况',
labers,
keys,
raw_data: datas,
};
},
//品种得分情况
......@@ -312,19 +422,18 @@ export default {
if (!datas) return false;
let keys = Object.keys(datas);
let labers = [
{ label: '分数', key: 'ScoreScore' },
{ label: '总分', key: 'assemble' },
{ label: '人数', key: 'student_num' },
{ label: '总题数', key: 'assemble' },
{ label: '正确人次', key: 'success_man_time' },
{ label: '错误人次', key: 'error_man_time' },
];
return {
type: "bar",
type: 'bar',
chart_id: 'breed_bar_chart',
color: '#39c183f0',
title: '品种得分情况',
labers,
keys,
raw_data: datas,
};
},
//最高分、最低分、平均分,中位数、众数、离散(变异系数)
......@@ -346,10 +455,30 @@ export default {
title: '最高分、最低分、平均分,中位数、众数、离散(变异系数)',
labers,
data: datas,
};
},
//学员得分情况
changeTranscript(datas) {
if (!datas) return false;
let labers = [
{ label: '姓名', key: 'name' },
{ label: '分数', key: 'score' },
];
let select_list = Object.keys(datas);
return {
type: 'select_table',
chart_id: 'transcript_bar_chart',
color: '#99A9BF',
title: '学员得分情况',
}
labers,
topic: select_list,
select_value: select_list[0],
// data: datas,
list: datas,
};
},
//眼光稳定性
changeEyeStability(datas) {
if (!datas) return false;
......@@ -357,23 +486,32 @@ export default {
let labers = [
{ label: '题目', key: 'title' },
{ label: '答案', key: 'answer' },
{ label: '稳定性', key: 'stability' }
{ label: '稳定性', key: 'stability' },
];
//处理稳定性数据
const changeStability = (items) => {
let all_num = items.exactness.length + items.wrong.length;
let Accuracy = toPercent(items.exactness.length, all_num);//准确率
return {
accuracy: { label: '正确率', value: Accuracy },
// exactness: { label: '正确数据', value: items.exactness },
wrong: { label: '错误数据', value: items.wrong },
}
};
// //处理稳定性数据
// const changeStability = (items) => {
// let all_num = items.exactness.length + items.wrong.length;
// let Accuracy = toPercent(items.exactness.length, all_num); //准确率
// return {
// accuracy: { label: '正确率', value: Accuracy },
// // exactness: { label: '正确数据', value: items.exactness },
// wrong: { label: '错误数据', value: items.wrong },
// };
// };
// datas.data.forEach((element, index) => {
// list.push({
// title: datas.title[index],
// answer: element.answer,
// stability: changeStability(element),
// });
// });
datas.data.forEach((element, index) => {
list.push({
title: datas.title[index],
answer: element.answer,
stability: changeStability(element)
area: element.area,
stability: element.conclusion,
conclusion_table: element.conclusion_table,
});
});
return {
......@@ -402,7 +540,7 @@ export default {
title: element.title,
result: element.result,
errorRate: `${element.errorRate}%`,
distribute: element.distribute
distribute: element.distribute,
});
});
return {
......@@ -412,7 +550,6 @@ export default {
title: '易错题分析',
labers,
list,
};
},
//易对题分析
......@@ -439,7 +576,7 @@ export default {
color: '#529B2E',
title: '易对题分析',
labers,
list
list,
};
},
//错误部位
......@@ -461,7 +598,7 @@ export default {
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
// distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute)
distribute: countOccurrences(datas[element].distribute),
});
});
return {
......@@ -471,7 +608,6 @@ export default {
title: '错误部位',
labers,
list,
};
},
//错误等级
......@@ -503,7 +639,6 @@ export default {
title: '错误等级',
labers,
list,
};
},
//错误颜色
......@@ -535,7 +670,6 @@ export default {
title: '错误颜色',
labers,
list,
};
},
//错误组别
......@@ -566,12 +700,10 @@ export default {
title: '错误组别',
labers,
list,
};
},
}
}
},
};
</script>
<style lang="scss" scoped>
.box-card {
......
......@@ -9,7 +9,11 @@
<div class="module_container">
<div class="card_container">
<el-card class="box-card">
<Header v-if="!is_loading" :examination_questions="head_data" @btnClick="btnClick"></Header>
<Header
v-if="!is_loading"
:examination_questions="head_data"
@btnClick="btnClick"
></Header>
</el-card>
<el-card class="box-card">
<div>
......@@ -18,19 +22,31 @@
<el-row class="row_container">
<el-col :span="8">
<div class="centenr_container">
<AnalyseModule :module_data="result_section" v-if="result_section" @changeSelect="changeSelects">
<AnalyseModule
:module_data="result_section"
v-if="result_section"
@changeSelect="changeSelects"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="8">
<div class="centenr_container">
<AnalyseModule :module_data="area_score" v-if="area_score" @changeSelect="changeSelects">
<AnalyseModule
:module_data="area_score"
v-if="area_score"
@changeSelect="changeSelects"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="8">
<div class="centenr_container">
<AnalyseModule :module_data="province_score" v-if="province_score" @changeSelect="changeSelects">
<AnalyseModule
:module_data="province_score"
v-if="province_score"
@changeSelect="changeSelects"
>
</AnalyseModule>
</div>
</el-col>
......@@ -38,14 +54,33 @@
<el-row class="row_container">
<el-col :span="8">
<div class="centenr_container">
<AnalyseModule :module_data="breed_score" v-if="breed_score" @changeSelect="changeSelects">
<AnalyseModule
:module_data="breed_score"
v-if="breed_score"
@changeSelect="changeSelects"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="8">
<div class="centenr_container">
<AnalyseModule :module_data="get_highes_lowestt_score_data" v-if="get_highes_lowestt_score_data"
@changeSelect="changeSelects">
<AnalyseModule
:module_data="get_highes_lowestt_score_data"
v-if="get_highes_lowestt_score_data"
@changeSelect="changeSelects"
>
</AnalyseModule>
</div>
</el-col>
<!-- 学员得分 -->
<el-col :span="8">
<div class="centenr_container">
<AnalyseModule
:module_data="transcript_data"
v-if="transcript_data"
@changeSelect="changeSelects"
>
</AnalyseModule>
</div>
</el-col>
......@@ -56,11 +91,9 @@
<div class="module_header">
<el-row>
<el-col :span="12">
<div>
易错、对等级分析
</div>
<div>易错、对等级分析</div>
</el-col>
<el-col :span="12" style="text-align: right;">
<el-col :span="12" style="text-align: right">
<el-checkbox v-model="request_params.is_top_data">{{
request_params.is_top_data ? '显示' : '隐藏'
}}</el-checkbox>
......@@ -71,22 +104,46 @@
<el-row class="row_container">
<el-col :span="12">
<div class="top_input_box" @keyup.enter="enterSearch">
<el-input class="input_box" v-model="request_params.top.error_top"></el-input>
<el-input class="input_box" v-model="request_params.top.error_region_max"></el-input>
<el-input class="input_box" v-model="request_params.top.error_region_min"></el-input>
<el-input
class="input_box"
v-model="request_params.top.error_top"
></el-input>
<el-input
class="input_box"
v-model="request_params.top.error_region_max"
></el-input>
<el-input
class="input_box"
v-model="request_params.top.error_region_min"
></el-input>
</div>
<div class="centenr_container">
<AnalyseModule :module_data="wrong_question_data" v-if="wrong_question_data"></AnalyseModule>
<AnalyseModule
:module_data="wrong_question_data"
v-if="wrong_question_data"
></AnalyseModule>
</div>
</el-col>
<el-col :span="12">
<div class="top_input_box" @keyup.enter="enterSearch">
<el-input class="input_box" v-model="request_params.top.success_top"></el-input>
<el-input class="input_box" v-model="request_params.top.success_region_max"></el-input>
<el-input class="input_box" v-model="request_params.top.success_region_min"></el-input>
<el-input
class="input_box"
v-model="request_params.top.success_top"
></el-input>
<el-input
class="input_box"
v-model="request_params.top.success_region_max"
></el-input>
<el-input
class="input_box"
v-model="request_params.top.success_region_min"
></el-input>
</div>
<div class="centenr_container">
<AnalyseModule :module_data="exactness_question_data" v-if="exactness_question_data"></AnalyseModule>
<AnalyseModule
:module_data="exactness_question_data"
v-if="exactness_question_data"
></AnalyseModule>
</div>
</el-col>
</el-row>
......@@ -96,33 +153,56 @@
<div class="module_header">错误方向分析</div>
<div>
<el-row class="row_container">
<el-col :span="12" class="unit_container">
<el-col
:span="12"
class="unit_container"
style="margin-top: 15px"
>
<div class="centenr_container">
<AnalyseModule :module_data="wrong_position_data" v-if="wrong_position_data"
@changeSelect="changeSelects"></AnalyseModule>
<AnalyseModule
:module_data="wrong_position_data"
v-if="wrong_position_data"
@changeSelect="changeSelects"
></AnalyseModule>
</div>
</el-col>
<el-col :span="12" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="error_level_data" v-if="error_level_data" @changeSelect="changeSelects">
<AnalyseModule
:module_data="error_level_data"
v-if="error_level_data"
@changeSelect="changeSelects"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="12" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_color_data" v-if="wrong_color_data" @changeSelect="changeSelects">
<AnalyseModule
:module_data="wrong_color_data"
v-if="wrong_color_data"
@changeSelect="changeSelects"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="12" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="wrongG_group_data" v-if="wrongG_group_data" @changeSelect="changeSelects">
<AnalyseModule
:module_data="wrongG_group_data"
v-if="wrongG_group_data"
@changeSelect="changeSelects"
>
</AnalyseModule>
</div>
</el-col>
<el-col :span="12" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="eye_stability_data" v-if="eye_stability_data">
<AnalyseModule
:module_data="eye_stability_data"
v-if="eye_stability_data"
@changeSelect="changeSelects"
>
</AnalyseModule>
</div>
</el-col>
......@@ -131,15 +211,18 @@
</div>
<div>
<div class="module_header">老师点评</div>
<div style="padding: 0 10px;box-sizing: border-box;">
<el-input type="textarea" :rows="6" placeholder="请输入内容" v-model="request_params.found_remark">
<div style="padding: 0 10px; box-sizing: border-box">
<el-input
type="textarea"
:rows="6"
placeholder="请输入内容"
v-model="request_params.found_remark"
>
</el-input>
</div>
</div>
</el-card>
</div>
</div>
</template>
......@@ -147,11 +230,9 @@
import Header from '@/components/ExaminationHeader/succinct.vue';
import AnalyseModule from '@/components/AnalyseModule/index.vue';
import { get_test_results_count, save_read_over_data } from '@/api/student';
import { toPercent, countOccurrences } from '@/utils/tool';
import { toPercent, countOccurrences, keepTwoDecimal } from '@/utils/tool';
import { Level } from 'chalk';
const standard_template = {
}
const standard_template = {};
export default {
data() {
return {
......@@ -171,9 +252,10 @@ export default {
text: '保存',
icon: 'el-icon-plus',
event: 'save',
}
},
],
},
//初始化请求参数
request_params: {
is_StudentStatistics: true,
......@@ -188,13 +270,9 @@ export default {
is_WrongColor: true,
is_WrongGroup: true,
is_EyeStability: true,
is_Transcript: true,
id: [14, 16],
ScoreScore: [
"100",
"80",
"70",
"60"
],
ScoreScore: ['100', '80', '70', '60'],
is_top: true,
top: {
error_top: 10,
......@@ -202,9 +280,9 @@ export default {
error_region_min: 0,
success_top: 10,
success_region_max: 100,
success_region_min: 10
success_region_min: 10,
},
found_remark: ''
found_remark: '',
},
is_loading: false,
......@@ -238,6 +316,8 @@ export default {
wrong_color_data: null,
//错误组别
wrongG_group_data: null,
//学员得分情况
transcript_data: null,
};
},
......@@ -247,10 +327,10 @@ export default {
created() {
let ids = localStorage.getItem('examination_questions_ids');
console.log(ids);
this.request_params.id = ids.split(",");
this.request_params.id = ids.split(',');
},
mounted() {
this.init()
this.init();
},
destroyed() {
// localStorage.removeItem("examination_questions_ids");
......@@ -264,43 +344,60 @@ export default {
console.log(val);
//saveExaminationQuestions
if (val == 'save') this.saveExaminationQuestions();
},
getListData() {
let keys = ['result_section', 'area_score', 'province_score', 'breed_score', 'get_highes_lowestt_score_data', 'wrong_question_data', 'exactness_question_data', 'wrong_position_data', 'error_level_data', 'wrong_color_data', 'wrongG_group_data'];
keys.forEach(element => {
let keys = [
'result_section',
'area_score',
'province_score',
'breed_score',
'get_highes_lowestt_score_data',
'wrong_question_data',
'exactness_question_data',
'wrong_position_data',
'error_level_data',
'wrong_color_data',
'wrongG_group_data',
'transcript_data',
];
keys.forEach((element) => {
this[element] = null;
});
this.is_loading = true;
get_test_results_count(this.request_params).then(res => {
get_test_results_count(this.request_params).then((res) => {
console.log('统计数据');
console.log(res);
this.is_loading = false;
this.head_data.title = res.title_list;//标题
this.result_section = this.changeScore(res.ScoreScore);//成绩分段
this.area_score = this.changeAreaScore(res.AreaScore);//南北方得分
this.province_score = this.changeProvinceScore(res.ProvinceScore);//省区得分
this.breed_score = this.changeBreedScore(res.breedScore);//品种得分
this.head_data.title = res.title_list; //标题
this.result_section = this.changeScore(res.ScoreScore); //成绩分段
this.area_score = this.changeAreaScore(res.AreaScore); //南北方得分
this.province_score = this.changeProvinceScore(res.ProvinceScore); //省区得分
this.breed_score = this.changeBreedScore(res.breedScore); //品种得分
this.transcript_data = this.changeTranscript(res.Transcript); //学员得分
//最高分、最低分、平均分,中位数、众数、离散(变异系数)
this.get_highes_lowestt_score_data = this.getHighesLowesttScore(res.getHighesLowesttScore);
this.get_highes_lowestt_score_data = this.getHighesLowesttScore(
res.getHighesLowesttScore
);
// console.log('高低中位');
// console.log(res.getHighesLowesttScore);
//眼光稳定性
this.eye_stability_data = this.changeEyeStability(res.EyeStability);
//对错题分析
if (res.top_data) this.wrong_question_data = this.changeWrong(res.top_data.datadesc);//错题分析
if (res.top_data) this.exactness_question_data = this.changeRight(res.top_data.dataasc);//对题分析
this.wrong_position_data = this.changeWrongPosition(res.WrongPosition);//错误部位
this.error_level_data = this.changeErrorLevel(res.ErrorLevel);//错误等级
this.wrong_color_data = this.changeWrongColor(res.WrongColor);//错误颜色
this.wrongG_group_data = this.changeWrongGroup(res.WrongGroup);//错误组别
})
if (res.top_data)
this.wrong_question_data = this.changeWrong(res.top_data.datadesc); //错题分析
if (res.top_data)
this.exactness_question_data = this.changeRight(res.top_data.dataasc); //对题分析
this.wrong_position_data = this.changeWrongPosition(res.WrongPosition); //错误部位
this.error_level_data = this.changeErrorLevel(res.ErrorLevel); //错误等级
this.wrong_color_data = this.changeWrongColor(res.WrongColor); //错误颜色
this.wrongG_group_data = this.changeWrongGroup(res.WrongGroup); //错误组别
});
},
//百分比
toPercent,
//处理分段值
changeScore(datas) {
if (!datas) return false;
......@@ -314,18 +411,19 @@ export default {
let labers = [
{ label: '分类', key: 'classify' },
{ label: '分数段', key: 'score' },
{ label: '人数', key: 'people' },
{ label: '人次', key: 'people' },
{ label: '占比', key: 'proportion' },
];
keys.forEach(element => {
keys.forEach((element) => {
let scores = element.split('~');
data.push(datas[element]);
let obj = {
classify: element,
score: scores[0],
people: datas[element],
proportion: this.toPercent(datas[element], num)
}
proportion: this.toPercent(datas[element], num),
sort_color: '#038d6e',
};
list.push(obj);
});
return {
......@@ -338,8 +436,8 @@ export default {
data,
is_show: {
key: 'is_ScoreScore',
value: this.request_params.is_ScoreScore
}
value: this.request_params.is_ScoreScore,
},
};
},
//南方烟北方烟得分情况
......@@ -347,12 +445,12 @@ export default {
if (!datas) return false;
let keys = Object.keys(datas);
let labers = [
{ label: '分数', key: 'ScoreScore' },
{ label: '总分', key: 'assemble' },
{ label: '人数', key: 'student_num' },
{ label: '总题数', key: 'assemble' },
{ label: '正确人次', key: 'success_man_time' },
{ label: '错误人次', key: 'error_man_time' },
];
return {
type: "bar",
type: 'bar',
chart_id: 'bar_chart',
color: '#E6A23C',
title: '南方北方烟得分情况',
......@@ -361,8 +459,8 @@ export default {
raw_data: datas,
is_show: {
key: 'is_AreaScore',
value: this.request_params.is_AreaScore
}
value: this.request_params.is_AreaScore,
},
// keys: ['南方', '北方', '西部'],
// raw_data: {
// '南方': {
......@@ -388,12 +486,12 @@ export default {
if (!datas) return false;
let keys = Object.keys(datas);
let labers = [
{ label: '分数', key: 'ScoreScore' },
{ label: '总分', key: 'assemble' },
{ label: '人数', key: 'student_num' },
{ label: '总题数', key: 'assemble' },
{ label: '正确人次', key: 'success_man_time' },
{ label: '错误人次', key: 'error_man_time' },
];
return {
type: "bar",
type: 'bar',
chart_id: 'province_bar_chart',
color: '#505F79',
title: '省级产区得分情况',
......@@ -402,8 +500,8 @@ export default {
raw_data: datas,
is_show: {
key: 'is_ProvinceScore',
value: this.request_params.is_ProvinceScore
}
value: this.request_params.is_ProvinceScore,
},
};
},
//品种得分情况
......@@ -411,26 +509,53 @@ export default {
if (!datas) return false;
let keys = Object.keys(datas);
let labers = [
{ label: '分数', key: 'ScoreScore' },
{ label: '总分', key: 'assemble' },
{ label: '人数', key: 'student_num' },
{ label: '总题数', key: 'assemble' },
{ label: '正确人次', key: 'success_man_time' },
{ label: '错误人次', key: 'error_man_time' },
];
return {
type: "bar",
type: 'bar',
chart_id: 'breed_bar_chart',
color: '#39c183f0',
title: '品种得分情况',
labers,
keys,
raw_data: datas,
is_show: {
key: 'is_breedScore',
value: this.request_params.is_breedScore
}
value: this.request_params.is_breedScore,
},
};
},
//学员得分情况
changeTranscript(datas) {
if (!datas) return false;
let labers = [
{ label: '姓名', key: 'name' },
{ label: '分数', key: 'score' },
];
let select_list = Object.keys(datas);
return {
type: 'select_table',
chart_id: 'transcript_bar_chart',
color: '#99A9BF',
title: '学员得分情况',
labers,
topic: select_list,
select_value: select_list[0],
// data: datas,
list: datas,
is_show: {
key: 'is_Transcript',
value: this.request_params.is_Transcript,
},
};
},
//最高分、最低分、平均分,中位数、众数、离散(变异系数)
getHighesLowesttScore(datas) {
// console.log(datas);
if (!datas) return false;
let labers = [
{ label: '最高成绩', key: 'max' },
......@@ -450,48 +575,42 @@ export default {
data: datas,
is_show: {
key: 'is_getHighesLowesttScore',
value: this.request_params.is_getHighesLowesttScore
}
}
value: this.request_params.is_getHighesLowesttScore,
},
};
},
//眼光稳定性
changeEyeStability(datas) {
// console.log(datas);
if (!datas) return false;
let list = [];
let labers = [
{ label: '题目', key: 'title' },
{ label: '题目', key: 'title', width: '300' },
{ label: '区域', key: 'area' },
{ label: '答案', key: 'answer' },
{ label: '稳定性', key: 'stability' }
{ label: '稳定性', key: 'stability' },
];
//处理稳定性数据
const changeStability = (items) => {
let all_num = items.exactness.length + items.wrong.length;
let Accuracy = toPercent(items.exactness.length, all_num);//准确率
return {
accuracy: { label: '正确率', value: Accuracy },
// exactness: { label: '正确数据', value: items.exactness },
wrong: { label: '错误数据', value: items.wrong },
}
};
datas.data.forEach((element, index) => {
list.push({
title: datas.title[index],
answer: element.answer,
stability: changeStability(element)
area: element.area,
stability: element.conclusion,
conclusion_table: element.conclusion_table,
});
});
return {
type: 'eye_stability_table',
chart_id: 'wrong_group',
color: '#529B2E',
color: '#E6A23C',
title: '眼光稳定性',
labers,
list,
is_show: {
key: 'is_EyeStability',
value: this.request_params.is_EyeStability
}
value: this.request_params.is_EyeStability,
},
};
},
//易错/易对 等级分析
......@@ -503,15 +622,18 @@ export default {
{ label: '题目', key: 'title' },
{ label: '结果', key: 'result' },
{ label: '错误率', key: 'errorRate' },
{ label: '比率', key: 'ratio' },
{ label: '错误结果', key: 'distribute' },
];
// ratio: `${keepTwoDecimal(element.total - wrong_num / element.total)}`,
datas.forEach((element, index) => {
list.push({
index: index + 1,
title: element.title,
result: element.result,
errorRate: `${element.errorRate}%`,
distribute: element.distribute
errorRate: `${keepTwoDecimal(element.errorRate)}%`,
ratio: `${element.wrong_num + '/' + element.total}`,
distribute: element.distribute,
});
});
return {
......@@ -523,12 +645,13 @@ export default {
list,
// is_show: {
// key: 'is_top_data',
// value: this.request_params.is_top_data
// }
// value: this.request_params.is_top_data,
// },
};
},
//易对题分析
changeRight(datas) {
// console.log(datas);
if (!datas) return false;
let list = [];
let labers = [
......@@ -536,13 +659,15 @@ export default {
{ label: '题目', key: 'title' },
{ label: '结果', key: 'result' },
{ label: '正确率', key: 'errorRate' },
{ label: '比率', key: 'ratio' },
];
datas.forEach((element, index) => {
list.push({
index: index + 1,
title: element.title,
result: element.result,
errorRate: `${100 - element.errorRate}%`,
ratio: `${element.total - element.wrong_num + '/' + element.total}`,
errorRate: `${keepTwoDecimal(100 - element.errorRate)}%`,
});
});
return {
......@@ -551,7 +676,7 @@ export default {
color: '#529B2E',
title: '易对题分析',
labers,
list
list,
};
},
//错误部位
......@@ -560,7 +685,7 @@ export default {
let keys = Object.keys(datas);
let list = [];
let labers = [
{ label: '部位', key: 'position' },
{ label: '题目', key: 'position' },
{ label: '正确答案', key: 'answer' },
{ label: '错题数量', key: 'wrong_num' },
{ label: '错误答案内容', key: 'distribute' },
......@@ -582,8 +707,8 @@ export default {
list,
is_show: {
key: 'is_WrongPosition',
value: this.request_params.is_WrongPosition
}
value: this.request_params.is_WrongPosition,
},
};
},
//错误等级
......@@ -592,7 +717,7 @@ export default {
let keys = Object.keys(datas);
let list = [];
let labers = [
{ label: '等级', key: 'level' },
{ label: '题目', key: 'level' },
{ label: '正确答案', key: 'answer' },
{ label: '错题数量', key: 'wrong_num' },
{ label: '错误答案内容', key: 'distribute' },
......@@ -614,8 +739,8 @@ export default {
list,
is_show: {
key: 'is_ErrorLevel',
value: this.request_params.is_ErrorLevel
}
value: this.request_params.is_ErrorLevel,
},
};
},
//错误颜色
......@@ -624,7 +749,7 @@ export default {
let keys = Object.keys(datas);
let list = [];
let labers = [
{ label: '颜色', key: 'color' },
{ label: '题目', key: 'color' },
{ label: '正确答案', key: 'answer' },
{ label: '错题数量', key: 'wrong_num' },
{ label: '错误答案内容', key: 'distribute' },
......@@ -646,8 +771,8 @@ export default {
list,
is_show: {
key: 'is_WrongColor',
value: this.request_params.is_WrongColor
}
value: this.request_params.is_WrongColor,
},
};
},
//错误组别
......@@ -656,7 +781,7 @@ export default {
let keys = Object.keys(datas);
let list = [];
let labers = [
{ label: '组别', key: 'group' },
{ label: '题目', key: 'group' },
{ label: '正确答案', key: 'answer' },
{ label: '错题数量', key: 'wrong_num' },
{ label: '错误答案内容', key: 'distribute' },
......@@ -678,12 +803,11 @@ export default {
list,
is_show: {
key: 'is_WrongGroup',
value: this.request_params.is_WrongGroup
}
value: this.request_params.is_WrongGroup,
},
};
},
//过滤
enterSearch(event) {
console.log('触发回车');
......@@ -694,13 +818,13 @@ export default {
//保存
saveExaminationQuestions() {
let params = this.$removeProperty(this.request_params);
save_read_over_data(params).then(res => {
save_read_over_data(params).then((res) => {
console.log('保存回调');
console.log(res);
if (res.code == 200) {
this.$message.success(res.message);
}
})
});
},
//是否显示模块
......@@ -708,8 +832,7 @@ export default {
this.request_params[val.key] = val.value;
},
},
}
};
</script>
<style lang="scss" scoped>
.centenr_container {
......
<script>
/**
* @Author: AnthonyD
* @Date: 2023-03-28 10:34:24
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-11 19:40:37
*/
</script>
<template>
<div class="module_container">
<div class="card_container">
<el-card class="box-card" style="margin-bottom: 10px;">
<examination-header :examination_questions="student_brief_introduction"
:key="new Date().getTime()"></examination-header>
<el-card class="box-card" style="margin-bottom: 10px">
<examination-header
:examination_questions="student_brief_introduction"
:key="new Date().getTime()"
></examination-header>
</el-card>
<el-card class="box-card">
<table-head :head_data="head_data" @search="searchEvent" @resetting="resetting" @btnClick="btnClick"
@upload="uploadTestQuestions"></table-head>
<!-- <div>
<table-head
:head_data="head_data"
@search="searchEvent"
@resetting="resetting"
@btnClick="btnClick"
@upload="uploadTestQuestions"
></table-head>
<!-- <div>
<el-button v-for="(item, index) in head_data.right_buttons" :key="index" type="primary" :icon="item.icon"
@click="resetting(item.event)">
{{ item.text }}
</el-button>
</div> -->
<div class="table_container">
<el-table v-loading="is_loading" :data="table_list" style="width: 100%;margin-bottom: 20px;" height="500">
<el-table
v-loading="is_loading"
:data="table_list"
style="width: 100%; margin-bottom: 20px"
height="500"
>
<el-table-column prop="id" label="编号" width="50">
<template slot-scope="scope">
{{ scope.$index + 1 }}
......@@ -28,28 +47,54 @@
</el-table-column>
<el-table-column prop="place_of_production" label="生产地点">
<template slot-scope="scope">
<div>{{ scope.row.area }}.{{ scope.row.place_of_production }}</div>
<div>
{{ scope.row.area }}.{{ scope.row.place_of_production }}
</div>
</template>
</el-table-column>
<el-table-column prop="path" label="烟叶实物">
<template slot-scope="scope">
<el-popover placement="right" trigger="click">
<div class="amplify_img_box">
<img :src="IP + scope.row.image + '?key=' + new Date().getTime()" alt="">
<img
:src="
IP + scope.row.image + '?key=' + new Date().getTime()
"
alt=""
/>
</div>
<img class="small_picture" slot="reference" :src="IP + scope.row.image + '?key=' + new Date().getTime()"
alt="">
<img
class="small_picture"
slot="reference"
:src="IP + scope.row.image + '?key=' + new Date().getTime()"
alt=""
/>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="quote" label="是否引用" align="center">
<template slot-scope="scope">
{{ scope.row.examination_question_detail_id ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column prop="created_at" label="创建时间">
</el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button size="mini" type="text" style="color: #000;"
@click="updateInformation(scope.$index, scope.row)">编辑</el-button>
<el-button size="mini" type="text" style="color: #F56C6C;"
@click="deleteInformation(scope.row)">删除</el-button>
<el-button
size="mini"
type="text"
style="color: #000"
@click="updateInformation(scope.$index, scope.row)"
>编辑</el-button
>
<el-button
size="mini"
type="text"
style="color: #f56c6c"
@click="deleteInformation(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
......@@ -57,14 +102,26 @@
</el-card>
</div>
<el-dialog :title="is_updata_type == 'add' ? '新增' : '修改'" :visible.sync="is_dialogVisible" width="60%"
:before-close="handleClose">
<el-dialog
:title="is_updata_type == 'add' ? '新增' : '修改'"
:visible.sync="is_dialogVisible"
width="60%"
:before-close="handleClose"
>
<div>
<table-moudel v-if="is_dialogVisible && province_data != {}" ref="detail_info" :table_data="detailed_information"
:position_datas="position_data" :province_datas="province_data" :tobacco_all_lists="tobacco_all_lists"
:tobacco_grades_all_lists="tobacco_grades_all_lists" :is_updata_type="is_updata_type"
:examination_questions_all_lists="examination_questions_all_list" :key="new Date().getTime()"></table-moudel>
<div v-else style="text-align: center;">
<table-moudel
v-if="is_dialogVisible && province_data != {}"
ref="detail_info"
:table_data="detailed_information"
:position_datas="position_data"
:province_datas="province_data"
:tobacco_all_lists="tobacco_all_lists"
:tobacco_grades_all_lists="tobacco_grades_all_lists"
:is_updata_type="is_updata_type"
:examination_questions_all_lists="examination_questions_all_list"
:key="new Date().getTime()"
></table-moudel>
<div v-else style="text-align: center">
<p><i class="el-icon-loading"></i></p>
<p>加载中...,请关闭弹框重新打开</p>
</div>
......@@ -74,12 +131,24 @@
<el-button type="primary" @click="submitData">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="图片批量上传" :visible.sync="is_picture_upload" width="60%" :before-close="handleClosePicture">
<el-dialog
title="图片批量上传"
:visible.sync="is_picture_upload"
width="60%"
:before-close="handleClosePicture"
>
<div class="upload_picture_container">
<el-upload action="#" multiple accept="image/png,image/jpeg,image/jpg" :auto-upload="false"
:on-change="seletePicture">
<el-upload
action="#"
multiple
accept="image/png,image/jpeg,image/jpg"
:auto-upload="false"
:on-change="seletePicture"
>
<el-button size="small" type="primary">点击选择</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
<div slot="tip" class="el-upload__tip">
只能上传jpg/png文件,且不超过500kb
</div>
</el-upload>
</div>
<span slot="footer" class="dialog-footer">
......@@ -94,29 +163,43 @@
import ExaminationHeader from '@/components/ExaminationHeader/index';
import TableHead from '@/components/TableHead/index';
import TableMoudel from '../components/TableMoudel.vue';
import { get_examination_questions_detail, get_province_list, get_tobacco_all_info, upload_examination_question_image, get_tobacco_grades_all, add_examination_question_detail, delete_examination_question_detail, updata_examination_question_detail, examination_question_detail_upload, get_tobacco_province, batch_upload_of_pictures, get_image_path, get_examination_questions_all } from '@/api/student';
import {
get_examination_questions_detail,
get_province_list,
get_tobacco_all_info,
upload_examination_question_image,
get_tobacco_grades_all,
add_examination_question_detail,
delete_examination_question_detail,
updata_examination_question_detail,
examination_question_detail_upload,
get_tobacco_province,
batch_upload_of_pictures,
get_image_path,
get_examination_questions_all,
create_answer_card,
} from '@/api/student';
import { exportText } from '@/utils/tool';
const standard_template = {
area: "南方",
area: '南方',
fraction: 1,
province_id: "70000",
breed_name: "中烟100",
grades_code: "C2F",
explain_in_detail: "",
image: "",
province_id: '70000',
breed_name: '中烟100',
grades_code: 'C2F',
explain_in_detail: '',
image: '',
examination_questions_id: null,
examination_question_detail_id: null,//关联试题id
}
examination_question_detail_id: null, //关联试题id
};
export default {
data() {
return {
IP: process.env.VUE_APP_BASE_API,
examination_questions_id: null,//试题id
examination_questions_id: null, //试题id
//头部按钮
head_data: {
is_search_show: false,
search_placeholder: "学员姓名/手机号",
search_placeholder: '学员姓名/手机号',
right_buttons: [
{
text: '模板下载',
......@@ -128,6 +211,11 @@ export default {
icon: 'el-icon-upload2',
event: 'examination_questions_upload',
},
{
text: '试题下载',
icon: 'el-icon-download',
event: 'examination_download',
},
{
text: '图片批量上传',
icon: 'el-icon-upload2',
......@@ -137,7 +225,7 @@ export default {
text: '新增',
icon: 'el-icon-document-add',
event: 'add',
}
},
],
},
//初始化请求参数
......@@ -148,6 +236,7 @@ export default {
total: null,
},
is_loading: false,
is_upload_loading: false,
tableData: [],
is_dialogVisible: false,
is_picture_upload: false,
......@@ -184,7 +273,7 @@ export default {
this.examination_questions_id = this.$route.query.id;
},
mounted() {
this.init()
this.init();
},
methods: {
......@@ -193,7 +282,6 @@ export default {
return `${this.IP}/api/examination_question_detail/uploadimage/${this.examination_questions_id}`;
},
searchEvent(val) {
console.log('搜索');
console.log(val);
......@@ -213,6 +301,7 @@ export default {
if (val == 'template_download') this.templateDownload();
/* pictureBatchUpload */
if (val == 'batch_upload') this.pictureBatchUpload();
if (val == 'examination_download') this.createAnswerCard();
},
init() {
......@@ -229,7 +318,7 @@ export default {
this.is_dialogVisible = false;
},
handleClosePicture() {
this.is_picture_upload = false
this.is_picture_upload = false;
},
//提交
submitData() {
......@@ -237,7 +326,7 @@ export default {
data['examination_questions_id'] = this.examination_questions_id;
let params = this.$handleParams(data);
if (this.is_updata_type == 'add') {
add_examination_question_detail(params).then(res => {
add_examination_question_detail(params).then((res) => {
console.log('新增试题详情');
console.log(res);
if (res.code == 200) {
......@@ -245,10 +334,10 @@ export default {
this.is_dialogVisible = false;
this.getExaminationQuestionsDetail();
}
})
});
} else {
let id = this.detailed_information.id;
updata_examination_question_detail(id, params).then(res => {
updata_examination_question_detail(id, params).then((res) => {
console.log('修改试题详情');
console.log(res);
if (res.code == 200) {
......@@ -256,26 +345,32 @@ export default {
this.is_dialogVisible = false;
this.getExaminationQuestionsDetail();
}
})
});
}
},
//获取全套试题
getExaminationQuestionsAll() {
this.examination_questions_all_list = [];
get_examination_questions_all().then(res => {
get_examination_questions_all().then((res) => {
// console.log('获取全套试题');
// console.log(res);
if (res.length) {
res.forEach(element => {
this.examination_questions_all_list.push({ value: element.id, label: element.title, children: [], })
res.forEach((element) => {
this.examination_questions_all_list.push({
value: element.id,
label: element.title,
children: [],
});
});
}
})
});
},
//获取详情
getExaminationQuestionsDetail() {
this.is_loading = true;
get_examination_questions_detail(this.examination_questions_id, { val: this.request_params.val }).then(res => {
get_examination_questions_detail(this.examination_questions_id, {
val: this.request_params.val,
}).then((res) => {
console.log('详情');
console.log(res);
this.table_list = [...res.examination_question_detail];
......@@ -284,18 +379,19 @@ export default {
this.student_brief_introduction.creat_user_name = res.user.name;
this.student_brief_introduction.duration = res.duration;
this.student_brief_introduction.begin_date = res.begin_date;
this.student_brief_introduction.test_number = res.examination_question_detail.length;
this.student_brief_introduction.test_number =
res.examination_question_detail.length;
this.is_loading = false;
})
});
},
//获取方位
getTobaccoProvince() {
get_tobacco_province().then(res => {
get_tobacco_province().then((res) => {
this.position_data = res || [];
for (let i in res) {
this.getProvinceList(res[i].name)
this.getProvinceList(res[i].name);
}
})
});
},
//获取省市区列表
getProvinceList(val) {
......@@ -306,13 +402,13 @@ export default {
if (list[i].children.length == 0) {
delete list[i].children;
} else {
removeNodeInTree(list[i].children)
removeNodeInTree(list[i].children);
}
}
return list
}
return list;
};
/* { name_is_value: true } 获取汉字值的列表 */
get_province_list({ area: val }).then(res => {
get_province_list({ area: val }).then((res) => {
this.province_data[val] = removeNodeInTree(res);
// if (res.length) {
// // this.province_list = removeNodeInTree(res);
......@@ -321,20 +417,19 @@ export default {
// // this.province_list = [];
// this.province_data[val] = [];
// }
})
});
},
//获取全部烟草等级
getTobaccoAll() {
get_tobacco_all_info().then(res => {
get_tobacco_all_info().then((res) => {
this.tobacco_all_lists = res || [];
})
});
},
//获取全部烟草等级
getTobaccoGradesAll() {
get_tobacco_grades_all().then(res => {
get_tobacco_grades_all().then((res) => {
this.tobacco_grades_all_lists = res || [];
})
});
},
//新增信息
......@@ -346,12 +441,12 @@ export default {
this.detailed_information = { ...standard_template };
this.detailed_information['question_no'] = this.table_list.length + 1;
//获取当前试题配置图片
get_image_path(this.examination_questions_id).then(res => {
get_image_path(this.examination_questions_id).then((res) => {
if (res.code == 200) {
this.detailed_information['image'] = res.message || '/';
this.is_dialogVisible = true;
}
})
});
} else {
const h = this.$createElement;
this.$notify({
......@@ -361,7 +456,6 @@ export default {
duration: 1000,
});
}
},
//修改信息
updateInformation(index, item) {
......@@ -371,11 +465,33 @@ export default {
console.log(item);
//获取详情
if (Object.keys(this.province_data).length == 3) {
let { id, area, fraction, province_id, breed_name, grades_code, explain_in_detail, image, examination_questions_id, examination_question_detail_id } = { ...item };
this.detailed_information = { id, area, fraction, province_id, breed_name, grades_code, explain_in_detail, image };
let {
id,
area,
fraction,
province_id,
breed_name,
grades_code,
explain_in_detail,
image,
examination_questions_id,
examination_question_detail_id,
} = { ...item };
this.detailed_information = {
id,
area,
fraction,
province_id,
breed_name,
grades_code,
explain_in_detail,
image,
};
if (item.quote) {
this.detailed_information['examination_questions_id'] = item.quote.examination_questions_id;
this.detailed_information['examination_question_detail_id'] = item.quote.id;
this.detailed_information['examination_questions_id'] =
item.quote.examination_questions_id;
this.detailed_information['examination_question_detail_id'] =
item.quote.id;
} else {
this.detailed_information['examination_questions_id'] = null;
this.detailed_information['examination_question_detail_id'] = null;
......@@ -398,42 +514,64 @@ export default {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delete_examination_question_detail(id).then(res => {
if (res.code == 200) {
this.$message.success(res.message);
this.init();
}
type: 'warning',
})
.then(() => {
delete_examination_question_detail(id).then((res) => {
if (res.code == 200) {
this.$message.success(res.message);
this.init();
}
});
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除',
});
});
});
},
//试题模版下载
templateDownload() {
let url = `${this.IP}/php_sours/tmpDoc/setThemeCard.docx`;
exportText(url, '模板.docx');
},
//试题下载
createAnswerCard() {
let id = this.examination_questions_id;
create_answer_card(id).then((res) => {
console.log('下载答题卡回调');
console.log(res);
if (res.code == 200) {
let s = res.message.split('=');
let name = s[s.length - 1];
let url = `${this.IP}${res.message}`;
exportText(url, name);
}
});
},
//试题上传
uploadTestQuestions(val) {
this.is_loading = true;
console.log('试题上传');
console.log(val);
const formData = new FormData();
formData.append('file', val.file)
formData.append('file', val.file);
let id = this.examination_questions_id;
examination_question_detail_upload(id, formData).then(res => {
console.log('试题上传');
console.log(res);
if (res.code == 200) {
this.$message.success(res.message);
this.getExaminationQuestionsDetail();
}
})
examination_question_detail_upload(id, formData)
.then((res) => {
console.log('试题上传');
console.log(res);
if (res.code == 200) {
this.is_loading = false;
this.$message.success(res.message);
this.getExaminationQuestionsDetail();
}
})
.catch((err) => {
this.is_loading = false;
});
},
//图片批量上传
......@@ -442,29 +580,32 @@ export default {
},
//选择文件监听
seletePicture(file, fileList) {
this.picture_file_list = fileList
this.picture_file_list = fileList;
},
//图片提交
subMitPictureList() {
console.log('当前文件列表');
console.log(this.picture_file_list);
let formData = new FormData();
this.picture_file_list.forEach(element => {
this.picture_file_list.forEach((element) => {
formData.append('image[]', element.raw);
});
setTimeout(() => {
batch_upload_of_pictures(this.examination_questions_id, '', formData).then(res => {
batch_upload_of_pictures(
this.examination_questions_id,
'',
formData
).then((res) => {
if (res.code == 200) {
this.$message.success(res.message);
this.is_picture_upload = false;
this.getExaminationQuestionsDetail();
}
})
});
}, 300);
},
},
}
};
</script>
<style lang="scss" scoped>
.small_picture {
......
<script>
/**
* @Author: AnthonyD
* @Date: 2023-04-10 18:06:52
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-15 15:59:31
*/
</script>
<template>
<div class="module_container">
<div class="card_container">
<el-card class="box-card">
<table-head :head_data="head_data" @search="searchEvent" @resetting="resetting" @btnClick="btnClick"></table-head>
<add-features
:head_data="head_data"
@search="searchEvent"
@resetting="resetting"
@btnClick="btnClick"
@deleteSelectData="deleteSelectData"
></add-features>
<div class="table_container">
<el-table v-loading="is_loading" :data="tableData" style="width: 100%;margin-bottom: 20px;" height="650"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table
ref="multipleTable"
v-loading="is_loading"
:data="tableData"
style="width: 100%; margin-bottom: 20px"
height="650"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="50"></el-table-column>
<!-- <el-table-column prop="id" label="编号" width="50">
<template slot="header">
<el-checkbox
:indeterminate="isIndeterminate"
v-model="is_select_all"
@change="select_all_fun" ></el-checkbox>
</template>
<template slot-scope="scope">
<el-checkbox
v-model="scope.row.is_select"
@change="handleSelectionChange"
></el-checkbox>
</template>
</el-table-column> -->
<el-table-column prop="id" label="编号" width="50">
</el-table-column>
<el-table-column prop="title" label="考试标题">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-document" style="color: #005FC2;"
@click="commentJump(scope.row)">{{ scope.row.title
}}</el-button>
<el-popover trigger="hover" placement="top">
<p>{{ scope.row.title }}</p>
<div slot="reference" class="title_wrapper">
<el-button
size="mini"
type="text"
icon="el-icon-document"
style="color: #005fc2"
@click="commentJump(scope.row)"
>{{ scope.row.title }}</el-button
>
</div>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="remarks" label="考试提示">
<template slot-scope="scope">
<div class="remark_box" :title="scope.row.opening_tip">{{ scope.row.opening_tip }}</div>
<div class="remark_box" :title="scope.row.opening_tip">
{{ scope.row.opening_tip }}
</div>
</template>
</el-table-column>
<el-table-column prop="type" label="类型">
<template slot-scope="scope">
<div>{{ scope.row.type }}</div>
</template>
</el-table-column>
<el-table-column
prop="begin_date"
label="开始时间~结束时间"
width="150"
>
<template slot-scope="scope">
<div>{{ scope.row.begin_date }}{{ scope.row.end_date }}</div>
</template>
</el-table-column>
<el-table-column v-if="false" prop="end_date" label="结束时间">
<template slot-scope="scope">
<div>{{ scope.row.end_date }}</div>
</template>
</el-table-column>
<el-table-column prop="begin_date" label="考试时间">
<el-table-column prop="place" label="区域">
<template slot-scope="scope">
<div>{{ scope.row.begin_date }}</div>
<div>{{ scope.row.place }}</div>
</template>
</el-table-column>
<el-table-column prop="duration" label="考试时长" width="100">
......@@ -37,67 +102,144 @@
<el-table-column prop="status" label="状态" width="100">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status == 1" type="info">未发布</el-tag>
<el-tag v-if="scope.row.status == 2" type="success">已发布</el-tag>
<el-tag v-if="scope.row.status == 3" type="success">开始考试</el-tag>
<el-tag v-if="scope.row.status == 4" type="success">考试完成</el-tag>
<el-tag v-if="scope.row.status == 5" type="success">已点评</el-tag>
<el-tag v-if="scope.row.status == 6" type="danger">停止使用</el-tag>
<el-tag v-if="scope.row.status == 1" type="info"
>未发布</el-tag
>
<el-tag v-if="scope.row.status == 2" type="success"
>已发布</el-tag
>
<el-tag v-if="scope.row.status == 3" type="success"
>开始考试</el-tag
>
<el-tag v-if="scope.row.status == 4" type="success"
>考试完成</el-tag
>
<el-tag v-if="scope.row.status == 5" type="success"
>已点评</el-tag
>
<el-tag v-if="scope.row.status == 6" type="danger"
>停止使用</el-tag
>
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="260">
<template slot-scope="scope">
<el-button size="mini" type="text" style="color: #000;" v-if="scope.row.status != '6'"
@click="updateInformation(scope.row)">修改</el-button>
<el-button size="mini" type="text" style="color: #000;" title="试题复制"
@click="examinationQuestionsCopy(scope.row)">复制</el-button>
<el-button v-if="scope.row.status != '6'" size="mini" type="text" style="color: #000;margin-right: 15px;"
@click="createAnswerCard(scope.row)" title="生成答题卡">下载</el-button>
<el-button
size="mini"
type="text"
style="color: #000"
v-if="scope.row.status != '6'"
@click="updateInformation(scope.row)"
>修改</el-button
>
<el-button
size="mini"
type="text"
style="color: #000"
title="试题复制"
@click="examinationQuestionsCopy(scope.row)"
>复制</el-button
>
<div v-if="false">
<el-button
v-if="scope.row.status != '6'"
size="mini"
type="text"
style="color: #000; margin-right: 15px"
@click="createAnswerCard(scope.row)"
title="生成答题卡"
>下载</el-button
>
</div>
<el-popover placement="right" width="160">
<div>
<el-radio-group v-model="status_params.status">
<el-radio label="1" style="margin: 5px 0;">试题配置中</el-radio>
<el-radio label="2" style="margin: 5px 0;">试题配置完成</el-radio>
<el-radio label="3" style="margin: 5px 0;">开始考试</el-radio>
<el-radio label="4" style="margin: 5px 0;">考试完成</el-radio>
<el-radio label="5" style="margin: 5px 0;">已点评</el-radio>
<el-radio label="6" style="margin: 5px 0;">停止使用</el-radio>
<el-radio label="1" style="margin: 5px 0"
>试题配置中</el-radio
>
<el-radio label="2" style="margin: 5px 0"
>试题配置完成</el-radio
>
<el-radio label="3" style="margin: 5px 0"
>开始考试</el-radio
>
<el-radio label="4" style="margin: 5px 0"
>考试完成</el-radio
>
<el-radio label="5" style="margin: 5px 0"
>已点评</el-radio
>
<el-radio label="6" style="margin: 5px 0"
>停止使用</el-radio
>
</el-radio-group>
</div>
<div style="text-align: right; margin: 0">
<el-button type="primary" size="mini" @click="updataExaminationQuestionsStatus">确定</el-button>
<el-button
type="primary"
size="mini"
@click="updataExaminationQuestionsStatus"
>确定</el-button
>
</div>
<el-button slot="reference" type="text" size="mini" @click="setStatusParams(scope.row)">设置状态</el-button>
<el-button
slot="reference"
type="text"
size="mini"
style="margin-left: 15px"
@click="setStatusParams(scope.row)"
>设置状态</el-button
>
</el-popover>
<el-button type="text" size="mini" style="color: #000;margin-left: 15px;"
@click="comment(scope.row)">批阅</el-button>
<el-button
type="text"
size="mini"
style="color: #000; margin-left: 15px"
@click="comment(scope.row)"
>批阅</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<div style="text-align: right;">
<el-pagination @current-change="handleCurrentChange" :current-page.sync="request_params.page"
:page-size="request_params.limit" layout="total, prev, pager, next" :total="request_params.total">
<div style="text-align: right">
<el-pagination
@current-change="handleCurrentChange"
:current-page.sync="request_params.page"
:page-size="request_params.limit"
layout="total, prev, pager, next"
:total="request_params.total"
>
</el-pagination>
</div>
</el-card>
</div>
<el-dialog :title="is_updata_type == 'add' ? '新增考试' : '修改考试'" :visible.sync="is_dialogVisible" width="900px"
:before-close="handleClose">
<el-dialog
:title="is_updata_type == 'add' ? '新增考试' : '修改考试'"
:visible.sync="is_dialogVisible"
width="900px"
:before-close="handleClose"
>
<div>
<el-form label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="考试标题">
<el-input v-model="detailed_information.title" placeholder="考试标题"></el-input>
<el-input
v-model="detailed_information.title"
placeholder="考试标题"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="烟叶类型">
<el-select v-model="detailed_information.type" placeholder="请选择">
<el-select
v-model="detailed_information.type"
placeholder="请选择"
>
<el-option :label="'把烟'" :value="'把烟'"></el-option>
<el-option :label="'片烟'" :value="'片烟'"></el-option>
<el-option :label="'甩把'" :value="'甩把'"></el-option>
......@@ -108,46 +250,79 @@
<el-row>
<el-col :span="12">
<el-form-item label="开始时间">
<el-date-picker v-model="detailed_information.begin_date" type="datetime" placeholder="选择日期时间">
<el-date-picker
v-model="detailed_information.begin_date"
type="datetime"
placeholder="选择日期时间"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="结束时间">
<el-date-picker v-model="detailed_information.end_date" type="datetime" placeholder="选择日期时间">
<el-date-picker
v-model="detailed_information.end_date"
type="datetime"
placeholder="选择日期时间"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="区域信息">
<el-input
v-model="detailed_information.place"
placeholder="区域信息"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="考试时长">
<el-input v-model="detailed_information.duration" placeholder="考试时长" type="number" :min="30">
<el-input
v-model="detailed_information.duration"
placeholder="考试时长"
type="number"
:min="30"
>
<template slot="append">分钟</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="考试人数上限">
<el-input v-model="detailed_information.examiners_max" placeholder="考试人数上限" type="number"
:min="1"></el-input>
<el-input
v-model="detailed_information.examiners_max"
placeholder="考试人数上限"
type="number"
:min="1"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="考试提示">
<el-input v-model="detailed_information.opening_tip" placeholder="考试提示" type="textarea"
:rows="2"></el-input>
<el-input
v-model="detailed_information.opening_tip"
placeholder="考试提示"
type="textarea"
:rows="2"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="试题备注">
<el-input v-model="detailed_information.remarks" placeholder="试题备注" type="textarea" :rows="2"></el-input>
<el-input
v-model="detailed_information.remarks"
placeholder="试题备注"
type="textarea"
:rows="2"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
......@@ -156,28 +331,56 @@
</span>
</el-dialog>
<el-dialog title="预约" :visible.sync="is_reservation" width="60%" :before-close="reservationClose">
<el-dialog
title="预约"
:visible.sync="is_reservation"
width="60%"
:before-close="reservationClose"
>
<div>
<el-form label-width="100px" v-if="is_reservation">
<el-form-item label="选择试题">
<el-select v-model="reservation_info.examination_questions_id" placeholder="请选择" style="width: 300px;">
<el-option v-for="item in examination_questions_all_list" :key="item.id" :label="item.title"
:value="item.id" :disabled="item.status != '2'">
<el-select
v-model="reservation_info.examination_questions_id"
placeholder="请选择"
style="width: 300px"
>
<el-option
v-for="item in examination_questions_all_list"
:key="item.id"
:label="item.title"
:value="item.id"
:disabled="item.status != '2'"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
<el-tabs v-model="activeName" v-if="reservation_info.examination_questions_id">
<el-tabs
v-model="activeName"
v-if="reservation_info.examination_questions_id"
>
<el-tab-pane label="单独预约" name="single">
<el-select v-model="reservation_info.student_id" placeholder="请选择" style="width: 300px;">
<el-option v-for="item in student_all_list" :key="item.value" :label="item.name + '(' + item.idcard + ')'"
:value="item.student_id">
<el-select
v-model="reservation_info.student_id"
placeholder="请选择"
style="width: 300px"
>
<el-option
v-for="item in student_all_list"
:key="item.value"
:label="item.name + '(' + item.idcard + ')'"
:value="item.student_id"
>
</el-option>
</el-select>
</el-tab-pane>
<el-tab-pane label="批量预约" name="batch">
<el-upload action="#" :auto-upload="false" :on-change="seletePicture">
<el-upload
action="#"
:auto-upload="false"
:on-change="seletePicture"
>
<el-button size="small" type="primary">点击选择</el-button>
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
</el-upload>
......@@ -193,27 +396,46 @@
</template>
<script>
import TableHead from '@/components/TableHead/index';
import { get_examination_questions_list, add_examination_questions, updata_examination_questions, create_answer_card, examination_questions_copy, examination_questions_publish, delete_examination_questions, get_examination_questions_all, get_student_all, examination_reservation, examination_batch_reservation, updata_examination_questions_status } from '@/api/student';
import AddFeatures from '@/components/TableHead/AddFeatures.vue';
import {
get_examination_questions_list,
add_examination_questions,
updata_examination_questions,
create_answer_card,
examination_questions_copy,
examination_questions_publish,
delete_examination_questions,
get_examination_questions_all,
get_student_all,
examination_reservation,
examination_batch_reservation,
updata_examination_questions_status,
} from '@/api/student';
import { exportText } from '@/utils/tool';
const standard_template = {
title: "",
type: "把烟",
opening_tip: " ",
begin_date: "",
end_date: "",
duration: "60",
title: '',
type: '把烟',
opening_tip: ' ',
begin_date: '',
end_date: '',
duration: '60',
examiners_max: 100,
remarks: ""
}
remarks: '',
place: null,
};
export default {
data() {
return {
activeName: "single",
is_change: true,
is_select_all: false,
isIndeterminate: false,
activeName: 'single',
IP: process.env.VUE_APP_BASE_API,
//头部按钮
head_data: {
is_search_show: true,
number_value: 0,
select_data: [],
// search_placeholder: "学员姓名/手机号",
right_buttons: [
{
......@@ -221,17 +443,17 @@ export default {
icon: 'el-icon-document-add',
event: 'add',
},
{
text: '批阅',
icon: 'el-icon-data-analysis',
event: 'analysis',
},
{
text: '预约',
event: 'reservation',
},
],
ensembel_btn: {
text: '批阅',
icon: 'el-icon-data-analysis',
event: 'analysis',
},
},
//初始化请求参数
request_params: {
......@@ -272,14 +494,14 @@ export default {
};
},
components: { TableHead },
components: { AddFeatures },
computed: {},
created() {
localStorage.removeItem("examination_questions_ids");
localStorage.removeItem('examination_questions_ids');
},
mounted() {
this.init()
this.init();
},
methods: {
......@@ -315,7 +537,7 @@ export default {
submitData() {
let params = this.$handleParams(this.detailed_information);
if (this.is_updata_type == 'add') {
add_examination_questions(params).then(res => {
add_examination_questions(params).then((res) => {
console.log('新增回调');
console.log(res);
if (res.code == 200) {
......@@ -323,11 +545,11 @@ export default {
this.is_dialogVisible = false;
this.getListData();
}
})
});
} else {
let id = this.detailed_information.id;
console.log(id);
updata_examination_questions(id, params).then(res => {
updata_examination_questions(id, params).then((res) => {
console.log('修改回调');
console.log(res);
if (res.code == 200) {
......@@ -335,20 +557,25 @@ export default {
this.is_dialogVisible = false;
this.getListData();
}
})
});
}
},
//获取列表数据
getListData() {
this.is_loading = true;
let params = this.$removeProperty(this.request_params);
get_examination_questions_list(params).then(res => {
console.log('列表数据');
console.log(res);
get_examination_questions_list(params).then((res) => {
// console.log('列表数据');
// console.log(res);
// for (let i in res.data) {
// res.data[i].is_select =
// this.select_ids.indexOf(res.data[i].id) > -1 ? true : false;
// }
// this.update_data_select();
this.tableData = res.data || [];
this.request_params.total = res.total;
this.is_loading = false;
})
});
},
//分页
handleCurrentChange(val) {
......@@ -375,67 +602,69 @@ export default {
this.$confirm('此试题将停止使用, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delete_examination_questions(id).then(res => {
if (res.code == 200) {
this.$message.success(res.message);
this.init();
}
type: 'warning',
})
.then(() => {
delete_examination_questions(id).then((res) => {
if (res.code == 200) {
this.$message.success(res.message);
this.init();
}
});
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除',
});
});
});
},
//跳转点评详情
commentJump(item) {
let id = item.id;
this.$router.push({
path: "/student/examination_questions_detail",
path: '/student/examination_questions_detail',
query: { id: id },
});
},
//生成答题卡
createAnswerCard(item) {
let id = item.id;
create_answer_card(id).then(res => {
create_answer_card(id).then((res) => {
console.log('下载答题卡回调');
console.log(res);
if (res.code == 200) {
let s = res.message.split('=');
let name = s[s.length - 1];
let url = `${this.IP}${res.message}`;
exportText(url, name)
exportText(url, name);
}
})
});
},
//发布
examinationQuestionsPublish(item) {
let id = item.id;
examination_questions_publish(id).then(res => {
examination_questions_publish(id).then((res) => {
console.log('试题发布回调');
console.log(res);
if (res.code == 200) {
this.$message.success(res.message);
this.getListData();
}
})
});
},
//试题复制
examinationQuestionsCopy(item) {
console.log('点击触发');
let id = item.id;
examination_questions_copy(id).then(res => {
examination_questions_copy(id).then((res) => {
console.log('试题复制回调');
console.log(res);
if (res.code == 200) {
this.$message.success(res.message);
this.getListData();
}
})
});
},
//点击修改状态
setStatusParams(item) {
......@@ -449,31 +678,31 @@ export default {
updataExaminationQuestionsStatus() {
let id = this.status_params.id;
let params = {
status: this.status_params.status
}
updata_examination_questions_status(id, params).then(res => {
status: this.status_params.status,
};
updata_examination_questions_status(id, params).then((res) => {
console.log('修改状态');
if (res.code == 200) {
this.$message.success(res.message);
document.body.click();
this.getListData();
}
})
});
},
//预约点击
reservationFun() {
//获取全部试题
get_examination_questions_all().then(res => {
get_examination_questions_all().then((res) => {
console.log('全部试题');
console.log(res);
if (res.length) this.examination_questions_all_list = res || [];
get_student_all().then(result => {
get_student_all().then((result) => {
console.log('全部学生列表');
console.log(result);
if (result.length) this.student_all_list = result || [];
this.is_reservation = true;
})
})
});
});
},
//取消预约
reservationClose() {
......@@ -486,23 +715,27 @@ export default {
//预约提交
reservationSubMit() {
if (this.reservation_info.examination_questions_id) {
if (this.activeName == 'single') {//单个
if (this.activeName == 'single') {
//单个
let params = this.$handleParams(this.reservation_info);
examination_reservation(params).then(res => {
examination_reservation(params).then((res) => {
if (res.code == 200) {
this.$message.success(res.message);
this.is_reservation = false;
}
})
});
} else {
let formData = new FormData();
formData.append('file', this.batch_reservation_file.raw);
examination_batch_reservation(this.reservation_info.examination_questions_id, formData).then(res => {
examination_batch_reservation(
this.reservation_info.examination_questions_id,
formData
).then((res) => {
if (res.code == 200) {
this.$message.success(res.message);
this.is_reservation = false;
}
})
});
}
} else {
this.$message.warning('请选择试题!');
......@@ -510,32 +743,88 @@ export default {
},
//表格多选监听
handleSelectionChange(val) {
console.log('val');
console.log(val);
this.select_ids = val.map(e => {
if (!this.is_change) return;
console.log('ssss');
this.select_ids = this.head_data.select_data.map((e) => {
return e.id;
})
});
let val_ids = val.map((e) => {
return e.id;
});
for (let i of val) {
if (this.select_ids.indexOf(i.id) < 0) {
this.head_data.select_data.push(i);
this.select_ids.push(i.id);
}
}
for (let i of this.tableData) {
if (val_ids.indexOf(i.id) < 0 && this.select_ids.indexOf(i.id) > -1) {
this.head_data.select_data.splice(this.select_ids.indexOf(i.id), 1);
this.select_ids = this.head_data.select_data.map((e) => {
return e.id;
});
}
}
// this.select_ids = this.head_data.select_data.map((e) => {
// return e.id;
// });
// for (let i of this.tableData) {
// if (i.is_select && this.select_ids.indexOf(i.id) < 0) {
// this.head_data.select_data.push(i);
// this.select_ids.push(i.id);
// } else if (!i.is_select && this.select_ids.indexOf(i.id) > -1) {
// this.head_data.select_data.splice(this.select_ids.indexOf(i.id), 1);
// this.select_ids = this.head_data.select_data.map((e) => {
// return e.id;
// });
// }
// }
this.head_data.number_value = this.head_data.select_data.length;
},
deleteSelectData(index, id) {
this.head_data.select_data.splice(index, 1);
for (let i of this.tableData) {
if (i.id == id) {
i.is_select = false;
}
}
// this.update_data_select();
this.head_data.number_value = this.head_data.select_data.length;
},
// select_all_fun(val) {
// let is_select = false;
// if (val) {
// is_select = true;
// }
// this.isIndeterminate = false;
// for (let i of this.tableData) {
// i.is_select = is_select;
// }
// },
// update_data_select() {
// this.is_change = false;
// for (let i of this.head_data.select_data) {
// this.$refs.multipleTable.toggleRowSelection(i);
// }
// this.is_change = true;
// },
//行 点评 点击
comment(item) {
if (item) {
let ids = [item.id];
localStorage.setItem('examination_questions_ids', ids);
this.$router.push({ path: '/student/examination_questions_comment', })
this.$router.push({ path: '/student/examination_questions_comment' });
} else {
if (this.select_ids.length > 0) {
localStorage.setItem('examination_questions_ids', this.select_ids);
this.$router.push({ path: '/student/examination_questions_comment', })
this.$router.push({ path: '/student/examination_questions_comment' });
} else {
this.$message.warning('请选择数据!');
}
}
},
},
}
};
</script>
<style lang="scss" scoped>
.remark_box {
......
<script>
/**
* @Author: AnthonyD
* @Date: 2023-03-29 17:06:03
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-17 10:39:36
*/
</script>
<template>
<div class="module_container">
<div class="card_container">
<el-card class="box-card">
<examination-header v-if="student_brief_introduction" :examination_questions="student_brief_introduction"
:key="new Date().getTime()"></examination-header>
<examination-header
v-if="student_brief_introduction"
:examination_questions="student_brief_introduction"
:key="new Date().getTime()"
></examination-header>
</el-card>
<el-card class="box-card" v-if="questions_list.length > 0">
<answer-card :questions_lists="questions_list" :test_results_lists="test_results_list"></answer-card>
<answer-card
:questions_lists="questions_list"
:test_results_lists="test_results_list"
></answer-card>
</el-card>
<el-card class="box-card">
<el-row>
<!-- 错误方位/区域 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="area_score_list">
<el-col :span="8" style="margin-bottom: 15px" v-if="area_score_list">
<div class="centenr_container">
<AnalyseModule :module_data="area_score_list">
</AnalyseModule>
<AnalyseModule :module_data="area_score_list"> </AnalyseModule>
</div>
</el-col>
<!-- 错误部位 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="wrong_position_list">
<!-- 错误上下一级 -->
<el-col :span="8" style="margin-bottom: 15px" v-if="error_level_list">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_position_list"></AnalyseModule>
<AnalyseModule :module_data="error_level_list"> </AnalyseModule>
</div>
</el-col>
<!-- 错误颜色 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="wrong_color_list">
<!-- 错误组别 -->
<el-col :span="8" style="margin-bottom: 15px" v-if="wrong_group_list">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_color_list">
</AnalyseModule>
<AnalyseModule :module_data="wrong_group_list"> </AnalyseModule>
</div>
</el-col>
<!-- 错误等级 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="error_level_list">
<!-- 错误等组 -->
<el-col
:span="8"
style="margin-bottom: 15px"
v-if="wrong_iso_groups_list"
>
<div class="centenr_container">
<AnalyseModule :module_data="error_level_list">
<AnalyseModule :module_data="wrong_iso_groups_list">
</AnalyseModule>
</div>
</el-col>
<!-- 错误组别 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="wrong_group_list">
<!-- 错误颜色 -->
<el-col :span="8" style="margin-bottom: 15px" v-if="wrong_color_list">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_group_list">
</AnalyseModule>
<AnalyseModule :module_data="wrong_color_list"> </AnalyseModule>
</div>
</el-col>
<!-- 错误部位 -->
<el-col
:span="8"
style="margin-bottom: 15px"
v-if="wrong_position_list"
>
<div class="centenr_container">
<AnalyseModule :module_data="wrong_position_list"></AnalyseModule>
</div>
</el-col>
<!-- 眼观稳定性 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="eye_stability_list">
<el-col
:span="8"
style="margin-bottom: 15px"
v-if="eye_stability_list"
>
<div class="centenr_container">
<AnalyseModule :module_data="eye_stability_list">
<AnalyseModule :module_data="eye_stability_list" :is_pover="true">
</AnalyseModule>
</div>
</el-col>
......@@ -59,7 +88,6 @@
<el-dialog title="提示" :visible.sync="is_dialogVisible" width="60%">
<div class="table_box">
<!-- -->
</div>
<span slot="footer" class="dialog-footer">
<el-button>取 消</el-button>
......@@ -75,20 +103,20 @@ import AnswerCard from '../components/AnswerCard.vue';
import AnalyseModule from '@/components/AnalyseModule/index.vue';
import { get_test_results_detail } from '@/api/student';
import { array_conversion } from '@/utils/tool';
import { toPercent,countOccurrences } from '@/utils/tool';
import { toPercent, countOccurrences } from '@/utils/tool';
const standard_template = {
id: null,
father_id: -1,//父级id
is_show: false,//是否展示为菜单
name: null,//英文名称
name_zh: null,//中文名称
path: null,//路由路径
sort: null,//排序
status: 1,//状态
type: 1,//类型:菜单/按钮
view_path: null,//视图路径
icon: null,//图标
}
father_id: -1, //父级id
is_show: false, //是否展示为菜单
name: null, //英文名称
name_zh: null, //中文名称
path: null, //路由路径
sort: null, //排序
status: 1, //状态
type: 1, //类型:菜单/按钮
view_path: null, //视图路径
icon: null, //图标
};
export default {
data() {
return {
......@@ -112,13 +140,12 @@ export default {
//考试结果id
test_results_id: null,
//试题结果
questions_list: [],//试题列表
test_results_list: [],//答题列表
test_text: '针对你在本次烟草知识考试中的表现,我认为你已经做得非常出色。你的答案准确地回答了考试中的问题,而且展现出了对烟草知识的全面了解。',
questions_list: [], //试题列表
test_results_list: [], //答题列表
test_text:
'针对你在本次烟草知识考试中的表现,我认为你已经做得非常出色。你的答案准确地回答了考试中的问题,而且展现出了对烟草知识的全面了解。',
//区域区域数据
area_score_list: null,
......@@ -130,9 +157,10 @@ export default {
error_level_list: null,
//错误组别
wrong_group_list: null,
//错误等组
wrong_iso_groups_list: null,
///眼光稳定性
eye_stability_list: null,
};
},
......@@ -144,7 +172,7 @@ export default {
if (id) this.test_results_id = id;
},
mounted() {
this.init()
this.init();
},
methods: {
......@@ -153,7 +181,7 @@ export default {
},
//考试结果详情
getTestResultsDetail() {
get_test_results_detail(this.test_results_id).then(res => {
get_test_results_detail(this.test_results_id).then((res) => {
console.log('考试结果详情');
console.log(res);
//头部组件
......@@ -172,32 +200,52 @@ export default {
],
};
this.questions_list = [];
res.examination_questions.examination_question_detail.forEach((element, index) => {
let obj = JSON.parse(JSON.stringify(element))
element['index_number'] = index;//用来记录在原始数据中的索引
});
let new_arr = array_conversion(res.examination_questions.examination_question_detail, 5);
res.examination_questions.examination_question_detail.forEach(
(element, index) => {
let obj = JSON.parse(JSON.stringify(element));
element['index_number'] = index; //用来记录在原始数据中的索引
}
);
let new_arr = array_conversion(
res.examination_questions.examination_question_detail,
5
);
this.test_results_list = res.test_results;
//表格列表
this.questions_list = new_arr;
//烟草区域
this.area_score_list = this.changeAreaScore(res.statistical_results.AreaScore);
this.area_score_list = this.changeAreaScore(
res.statistical_results.AreaScore
);
//错误部位
this.wrong_position_list = this.changeWrongPosition(res.statistical_results.WrongPosition);
this.wrong_position_list = this.changeWrongPosition(
res.statistical_results.WrongPosition
);
//错误颜色
this.wrong_color_list = this.changeWrongColor(res.statistical_results.WrongColor);
this.wrong_color_list = this.changeWrongColor(
res.statistical_results.WrongColor
);
//错误等级
this.error_level_list = this.changeErrorLevel(res.statistical_results.ErrorLevel);
this.error_level_list = this.changeWrongLevel(
res.statistical_results.WrongLevel
);
//错误组别
this.wrong_group_list = this.changeWrongGroup(res.statistical_results.WrongGroup);
this.wrong_group_list = this.changeWrongGroup(
res.statistical_results.WrongGroup
);
//错误等组
this.wrong_iso_groups_list = this.changeWrongIsoGroup(
res.statistical_results.WrongIsogroup
);
//眼光稳定性
this.eye_stability_list = this.changeEyeStability(res.statistical_results.EyeStability)
this.eye_stability_list = this.changeEyeStability(
res.statistical_results.EyeStability
);
console.log('处理好的数据');
console.log(this.area_score_list);
})
console.log(this.eye_stability_list);
});
},
//区域得分
changeAreaScore(datas) {
......@@ -209,7 +257,7 @@ export default {
{ label: '错误题目数量', key: 'subject_num_error' },
];
return {
type: "bar",
type: 'bar',
chart_id: 'bar_chart1',
color: '#E6A23C',
title: '突出区域的烟草识别',
......@@ -218,23 +266,24 @@ export default {
raw_data: datas,
};
},
//错误部位
changeWrongPosition(datas) {
if (!datas) return false;
let keys = Object.keys(datas);
let list = [];
let labers = [
{ label: '部位', key: 'position' },
{ label: '题号', key: 'position' },
{ label: '区域', key: 'area' },
{ label: '正确答案', key: 'answer' },
{ label: '错题数量', key: 'wrong_num' },
{ label: '错误答案内容', key: 'distribute' },
{ label: '错误答案', key: 'distribute' },
];
keys.forEach((element, index) => {
list.push({
position: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: countOccurrences(datas[element].distribute),
area: datas[element].area,
distribute: datas[element].distribute,
});
});
return {
......@@ -244,26 +293,26 @@ export default {
title: '错误部位',
labers,
list,
};
},
//错误颜色
changeWrongColor(datas) {
console.log(datas);
if (!datas) return false;
let keys = Object.keys(datas);
let list = [];
let labers = [
{ label: '颜色', key: 'color' },
{ label: '题号', key: 'color' },
{ label: '区域', key: 'area' },
{ label: '正确答案', key: 'answer' },
{ label: '错题数量', key: 'wrong_num' },
{ label: '错误答案内容', key: 'distribute' },
{ label: '错误答案', key: 'distribute' },
];
keys.forEach((element, index) => {
list.push({
color: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: countOccurrences(datas[element].distribute),
area: datas[element].area,
distribute: datas[element].distribute,
});
});
return {
......@@ -276,32 +325,31 @@ export default {
};
},
//错误等级
changeErrorLevel(datas) {
changeWrongLevel(datas) {
if (!datas) return false;
let keys = Object.keys(datas);
let list = [];
let labers = [
{ label: '等级', key: 'level' },
{ label: '题号', key: 'level' },
{ label: '区域', key: 'area' },
{ label: '正确答案', key: 'answer' },
{ label: '错题数量', key: 'wrong_num' },
{ label: '错误答案内容', key: 'distribute' },
{ label: '错误答案', key: 'distribute' },
];
keys.forEach((element, index) => {
list.push({
level: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: countOccurrences(datas[element].distribute),
area: datas[element].area,
distribute: datas[element].distribute,
});
});
return {
type: 'table',
chart_id: 'wrong_position',
color: '#505F79',
title: '错误等级',
title: '错误上下一级',
labers,
list,
};
},
//错误组别
......@@ -310,17 +358,17 @@ export default {
let keys = Object.keys(datas);
let list = [];
let labers = [
{ label: '组别', key: 'group' },
{ label: '题号', key: 'group' },
{ label: '区域', key: 'area' },
{ label: '正确答案', key: 'answer' },
{ label: '错题数量', key: 'wrong_num' },
{ label: '错误答案内容', key: 'distribute' },
{ label: '错误答案', key: 'distribute' },
];
keys.forEach((element, index) => {
list.push({
group: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: countOccurrences(datas[element].distribute),
area: datas[element].area,
distribute: datas[element].distribute,
});
});
return {
......@@ -332,44 +380,95 @@ export default {
list,
};
},
//错误等组
changeWrongIsoGroup(datas) {
if (!datas) return false;
let keys = Object.keys(datas);
let list = [];
let labers = [
{ label: '题号', key: 'iso_group' },
{ label: '区域', key: 'area' },
{ label: '正确答案', key: 'answer' },
{ label: '错误答案', key: 'distribute' },
];
keys.forEach((element, index) => {
list.push({
iso_group: element,
answer: datas[element].answer,
area: datas[element].area,
distribute: datas[element].distribute,
});
});
return {
type: 'table',
chart_id: 'wrong_group',
color: '#529B2E',
title: '错误等组',
labers,
list,
};
},
//眼光稳定性
changeEyeStability(datas) {
console.log(datas);
if (!datas) return false;
let list = [];
let labers = [
{ label: '题目', key: 'title' },
{ label: '题号', key: 'title' },
{ label: '区域', key: 'area' },
{ label: '答案', key: 'answer' },
{ label: '稳定性', key: 'stability' }
{ label: '稳定性', key: 'stability' },
];
//处理稳定性数据
const changeStability = (items) => {
let all_num = items.exactness.length + items.wrong.length;
let Accuracy = toPercent(items.exactness.length, all_num);//准确率
return {
accuracy: { label: '正确率', value: Accuracy },
// exactness: { label: '正确数据', value: items.exactness },
wrong: { label: '错误数据', value: items.wrong },
}
};
// const changeStability = (items) => {
// let all_num = items.exactness.length + items.wrong.length;
// let Accuracy = toPercent(items.exactness.length, all_num); //准确率
// return {
// accuracy: { label: '正确率', value: Accuracy },
// // exactness: { label: '正确数据', value: items.exactness },
// wrong: { label: '错误数据', value: items.wrong },
// };
// };
// datas.data.forEach((element, index) => {
// list.push({
// title: datas.title[index],
// answer: element.answer,
// stability: changeStability(element),
// });
// });
//处理稳定性数据
datas.data.forEach((element, index) => {
// console.log(element);
let answer_data = element.conclusion_data;
let is_t = '';
let res = answer_data.length < 2 ? '' : '稳定';
for (let i = 0; i < answer_data.length; i++) {
if (is_t == '') {
is_t = answer_data[i];
} else if (is_t != answer_data[i]) {
res = '不稳定';
}
}
// console.log(datas.data);
list.push({
title: datas.title[index],
answer: element.answer,
stability: changeStability(element)
stability: res,
area: element.area,
conclusion_data: answer_data,
});
});
return {
type: 'eye_stability_table',
chart_id: 'wrong_group',
color: '#529B2E',
color: '#E6A23C',
title: '眼光稳定性',
labers,
list,
};
},
},
}
};
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
......
......@@ -11,58 +11,115 @@
<el-card class="box-card">
<!-- <table-head :add_text="'管理员'" :add_icon="'el-icon-s-custom'" @search="searchEvent" @resetting="resetting"
@add="infoUpdata(null)"></table-head> -->
<table-head :head_data="head_data" @search="searchEvent" @resetting="resetting" @btnClick="btnClick"></table-head>
<table-head
:head_data="head_data"
@search="searchEvent"
@resetting="resetting"
@btnClick="btnClick"
></table-head>
<div class="table_container">
<el-table v-loading="is_loading" :data="administrators_list" style="width: 100%" height="650">
<el-table
v-loading="is_loading"
:data="administrators_list"
style="width: 100%"
height="650"
>
<el-table-column prop="id" label="编号"></el-table-column>
<el-table-column prop="name" label="名称"></el-table-column>
<el-table-column prop="email" label="邮箱"></el-table-column>
<el-table-column prop="phone" label="手机号"></el-table-column>
<el-table-column prop="created_at" label="创建时间"></el-table-column>
<el-table-column
prop="created_at"
label="创建时间"
></el-table-column>
<el-table-column prop="status" label="状态">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status == 1" type="success">正常</el-tag>
<el-tag v-if="scope.row.status == 2" type="danger">禁止</el-tag>
<el-tag v-if="scope.row.status == 3" type="info" color="#f4f4f5">失效</el-tag>
<el-tag v-if="scope.row.status == 1" type="success"
>正常</el-tag
>
<el-tag v-if="scope.row.status == 2" type="danger"
>禁止</el-tag
>
<el-tag
v-if="scope.row.status == 3"
type="info"
color="#f4f4f5"
>失效</el-tag
>
</div>
</template>
</el-table-column>
<el-table-column prop="address" label="操作">
<template slot-scope="scope">
<div>
<el-button size="mini" type="text" style="color: #000;" @click="infoUpdata(scope.row)">编辑</el-button>
<el-button size="mini" type="text" style="color: #F56C6C;"
@click="deleteAdmin(scope.row)">删除</el-button>
<el-button
size="mini"
type="text"
style="color: #000"
@click="infoUpdata(scope.row)"
>编辑</el-button
>
<el-button
size="mini"
type="text"
style="color: #f56c6c"
@click="deleteAdmin(scope.row)"
>删除</el-button
>
</div>
</template>
</el-table-column>
</el-table>
<div style="text-align: right;">
<el-pagination @current-change="handleCurrentChange" :current-page.sync="params.page"
:page-size="params.limit" layout="total, prev, pager, next" :total="params.total">
<div style="text-align: right">
<el-pagination
@current-change="handleCurrentChange"
:current-page.sync="params.page"
:page-size="params.limit"
layout="total, prev, pager, next"
:total="params.total"
>
</el-pagination>
</div>
</div>
</el-card>
</div>
<el-dialog :title="is_type == 'add' ? '新增管理员' : '编辑管理员'" :visible.sync="is_dialogVisible" width="1024px"
:before-close="handleClose" :class="is_type == 'add' ? 'add_dialog' : 'edit_dialog'">
<el-dialog
:title="is_type == 'add' ? '新增管理员' : '编辑管理员'"
:visible.sync="is_dialogVisible"
width="1024px"
:before-close="handleClose"
:class="is_type == 'add' ? 'add_dialog' : 'edit_dialog'"
>
<div>
<el-row>
<el-col :span="10" v-if="user_type == 1">
<div class="head_container">
<el-upload class="avatar-uploader" :action="upload_action" :show-file-list="false"
accept="image/png,image/jpeg,image/jpg" :http-request="sliderRequest">
<img v-if="administrators_info.image" :src="upload_action + administrators_info.image" class="avatar">
<el-upload
class="avatar-uploader"
:action="upload_action"
:show-file-list="false"
accept="image/png,image/jpeg,image/jpg"
:http-request="sliderRequest"
>
<img
v-if="administrators_info.image"
:src="upload_action + administrators_info.image"
class="avatar"
/>
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
<div class="prompt_text">只能上传jpg/png文件,且不超过500kb</div>
</div>
</el-col>
<el-col :span="14">
<el-form :model="administrators_info" :rules="info_rules" ref="ruleForm" label-width="100px"
class="demo-ruleForm">
<el-form
:model="administrators_info"
:rules="info_rules"
ref="ruleForm"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item label="用户类型" v-if="is_type == 'add'">
<el-radio-group v-model="user_type">
<el-radio :label="1">普通用户</el-radio>
......@@ -70,18 +127,44 @@
</el-radio-group>
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="administrators_info.name" placeholder="请输入名称"
:disabled="is_type == 'add' ? false : true"></el-input>
<el-input
v-model="administrators_info.name"
placeholder="请输入名称"
:disabled="is_type == 'add' ? false : true"
></el-input>
</el-form-item>
<el-form-item label="手机号" prop="phone" v-if="user_type == 1">
<el-input v-model="administrators_info.phone" placeholder="请输入手机号"></el-input>
<el-input
v-model="administrators_info.phone"
placeholder="请输入手机号"
></el-input>
</el-form-item>
<el-form-item label="区域信息">
<treeselect
v-model="administrators_info.department_id"
:options="tree_select_list"
:normalizer="normalizer"
:show-count="true"
placeholder="选择上级菜单"
/>
</el-form-item>
<el-form-item label="邮箱" prop="email" v-if="user_type == 1">
<el-input v-model="administrators_info.email" placeholder="请输入邮箱"></el-input>
<el-input
v-model="administrators_info.email"
placeholder="请输入邮箱"
></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="administrators_info.password" placeholder="请输入密码" :type="passwordType">
<i slot="suffix" class="el-input__icon el-icon-view" @click="showPwd"></i>
<el-input
v-model="administrators_info.password"
placeholder="请输入密码"
:type="passwordType"
>
<i
slot="suffix"
class="el-input__icon el-icon-view"
@click="showPwd"
></i>
</el-input>
</el-form-item>
<el-form-item label="状态" prop="password" v-if="user_type == 1">
......@@ -92,8 +175,16 @@
</el-radio-group>
</el-form-item>
<el-form-item label="角色" prop="password">
<el-select v-model="administrators_info.role_id" placeholder="请选择">
<el-option v-for="item in roles_list" :key="item.id" :label="item.name" :value="item.id">
<el-select
v-model="administrators_info.role_id"
placeholder="请选择"
>
<el-option
v-for="item in roles_list"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
......@@ -110,9 +201,21 @@
</template>
<script>
import { get_administrators_list, add_administrators, delete_administrators, edit_administrators, get_administrators_detail, upload_head, create_temporary } from '@/api/system.js';
import {
get_administrators_list,
add_administrators,
delete_administrators,
edit_administrators,
get_administrators_detail,
upload_head,
create_temporary,
} from '@/api/system.js';
import { get_roles_all } from '@/api/role';
import TableHead from '@/components/TableHead/index';
import { get_department_list } from '@/api/system';
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
const admin_info = {
id: null,
name: null,
......@@ -122,7 +225,8 @@ const admin_info = {
role_id: 1,
image: '/php_sours/userimg/2023_03_02/16777479118474.jpg',
status: 1,
}
department_id: null,
};
export default {
data() {
return {
......@@ -135,7 +239,7 @@ export default {
text: '新增',
icon: 'el-icon-s-custom',
event: 'add',
}
},
],
},
is_loading: false,
......@@ -150,68 +254,65 @@ export default {
is_type: 'add',
administrators_info: {},
info_rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' },
],
phone: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
],
email: [
{ required: true, message: '请输入邮箱', trigger: 'blur' },
],
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
// phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
// email: [{ required: true, message: '请输入邮箱', trigger: 'blur' }],
// password: [
// { required: true, message: '请输入密码', trigger: 'blur' },
// ],
},
upload_action: `${process.env.VUE_APP_BASE_API}`,
passwordType: 'password',//输入框的类型,密码框
user_type: 1,//创建用户类型 老师,普通用户
passwordType: 'password', //输入框的类型,密码框
user_type: 1, //创建用户类型 老师,普通用户
roles_list: [],
//树菜单选择
tree_select_list: [],
};
},
components: { TableHead },
components: { TableHead, Treeselect },
computed: {},
mounted() {
this.getAdministratorsList();
this.getRolesAll();
this.getProvinceList();
},
methods: {
//获取全部角色
getRolesAll() {
get_roles_all().then(res => {
get_roles_all().then((res) => {
console.log('获取全部角色');
console.log(res);
this.roles_list = res || [];
})
});
},
//获取管理员列表
getAdministratorsList() {
let params = {
val: this.params.val,
page: this.params.page,
limit: this.params.limit
}
limit: this.params.limit,
};
this.is_loading = true;
get_administrators_list(params).then(res => {
get_administrators_list(params).then((res) => {
console.log('获取管理员列表');
console.log(res);
if (res.data.length > 0) {
res.data.forEach(element => {
res.data.forEach((element) => {
if (element.role.length > 0) {
element['role_id'] = element.role[0].id
element['role_id'] = element.role[0].id;
} else {
element['role_id'] = null
element['role_id'] = null;
}
});
}
this.administrators_list = res.data;
this.params.total = res.total;
this.is_loading = false;
})
});
},
//分页
handleCurrentChange(val) {
......@@ -237,11 +338,13 @@ export default {
//新增修改
infoUpdata(item) {
console.log(item);
if (item) {//修改
if (item) {
//修改
this.is_type = 'edit';
this.user_type = 1;//控制用户类型
this.user_type = 1; //控制用户类型
this.administrators_info = { ...item };
} else {//新增
} else {
//新增
this.is_type = 'add';
this.administrators_info = { ...admin_info };
}
......@@ -257,30 +360,31 @@ export default {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delete_administrators(id).then(res => {
console.log('删除回调');
console.log(res);
if (res.code == 200) {
this.$message.success('删除成功!');
this.getAdministratorsList();
}
type: 'warning',
})
.then(() => {
delete_administrators(id).then((res) => {
console.log('删除回调');
console.log(res);
if (res.code == 200) {
this.$message.success('删除成功!');
this.getAdministratorsList();
}
});
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除',
});
});
});
},
//密码框和输入框切换
showPwd() {
if (this.passwordType === 'password') {
this.passwordType = ''
this.passwordType = '';
} else {
this.passwordType = 'password'
this.passwordType = 'password';
}
},
//上传
......@@ -288,19 +392,21 @@ export default {
console.log('上传');
console.log(upload);
const formData = new FormData();
formData.append('image', upload.file)
upload_head(formData).then(res => {
formData.append('image', upload.file);
upload_head(formData).then((res) => {
console.log('上传回调');
console.log(res);
if (res.err_code == 200) {
this.administrators_info.image = res.message;
this.$message.success('上传成功');
}
})
});
},
//提交
submitInfo() {
console.log('提交的数据');
console.log(this.administrators_info);
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
let data = {
......@@ -312,12 +418,14 @@ export default {
roles: this.administrators_info.role_id,
image: this.administrators_info.image,
status: this.administrators_info.status,
}
department_id: this.administrators_info.department_id,
};
let params = this.$handleParams(data);
if (this.is_type == 'add') {
console.log(params);
if (this.user_type == 1) {//创建普通用户
add_administrators(params).then(res => {
if (this.user_type == 1) {
//创建普通用户
add_administrators(params).then((res) => {
console.log('新增用户回调');
console.log(res);
if (res.code == 200) {
......@@ -325,25 +433,27 @@ export default {
this.is_dialogVisible = false;
this.getAdministratorsList();
}
})
} else {//创建老师用户
});
} else {
//创建老师用户
let temporary = {
name: this.administrators_info.name,
password: this.administrators_info.password,
roles: this.administrators_info.role_id,
}
department_id: this.administrators_info.department_id,
};
let temporary_data = this.$handleParams(temporary);
create_temporary(temporary_data).then(res => {
create_temporary(temporary_data).then((res) => {
if (res.code == 200) {
this.$message.success(res.message);
this.is_dialogVisible = false;
this.getAdministratorsList();
}
})
});
}
} else {
let id = this.administrators_info.id;
edit_administrators(id, params).then(res => {
edit_administrators(id, params).then((res) => {
console.log('修改');
console.log(res);
if (res.code == 200) {
......@@ -351,18 +461,35 @@ export default {
this.is_dialogVisible = false;
this.getAdministratorsList();
}
})
});
}
} else {
console.log('error submit!!');
return false;
}
});
},
}
}
//获取区域信息
getProvinceList() {
get_department_list().then((res) => {
console.log('@@@@');
console.log(res);
const menu = { id: -1, department_name: '', children: [] };
menu.children = res;
this.tree_select_list.push(menu);
});
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) delete node.children;
return {
id: node.id,
label: node.department_name,
children: node.children,
};
},
},
};
</script>
<style lang="scss" scoped>
.search_box {
......@@ -383,7 +510,7 @@ export default {
}
.el-upload:hover {
border-color: #409EFF;
border-color: #409eff;
}
.avatar-uploader-icon {
......@@ -410,6 +537,7 @@ export default {
font-size: 12px;
color: #606266;
margin-top: 15px;
text-align: center;
}
}
</style>
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论