提交 7d6f07d9 authored 作者: Yroc's avatar Yroc

后台功能添加

上级 e2247469
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
<table class="table_box"> <table class="table_box" :id="chart_id">
<tr> <tr>
<!-- #038d6e --> <!-- #038d6e -->
<th v-for="(e, i) in labers" :key="i" style="padding: 15px 10px"> <th v-for="(e, i) in labers" :key="i" style="padding: 15px 10px">
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<script> <script>
export default { export default {
props: ['table_data', 'labers'], props: ['table_data', 'labers', 'chart_id'],
data() { data() {
return { return {
sort_field: null, sort_field: null,
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<!-- <el-select v-model=""> <!-- <el-select v-model="">
<el-option></el-option> <el-option></el-option>
</el-select> --> </el-select> -->
<table class="table_box"> <table class="table_box" :id="chart_id">
<!-- <tr> <!-- <tr>
<th v-for="(e, i) in labers" :key="i">{{ e.label }}</th> <th v-for="(e, i) in labers" :key="i">{{ e.label }}</th>
</tr> --> </tr> -->
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<script> <script>
export default { export default {
props: ['table_data'], props: ['table_data', 'chart_id'],
data() { data() {
return { return {
sel: '', sel: '',
...@@ -43,6 +43,7 @@ export default { ...@@ -43,6 +43,7 @@ export default {
methods: { methods: {
//保留两位,四舍五入 //保留两位,四舍五入
keepTwoDecimal(num) { keepTwoDecimal(num) {
if (num == 0 || !num) return num;
if (num.includes(',')) { if (num.includes(',')) {
return num; return num;
} else { } else {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<!-- --> <!-- -->
<template> <template>
<div class="container_box"> <div class="container_box">
<table class="table_box"> <table class="table_box" :id="chart_id">
<tr> <tr>
<th v-for="(e, i) in labers" :key="i" style="padding: 15px 10px"> <th v-for="(e, i) in labers" :key="i" style="padding: 15px 10px">
{{ e.label {{ e.label
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<script> <script>
export default { export default {
props: ['table_data', 'labers'], props: ['table_data', 'labers', 'chart_id'],
data() { data() {
return { return {
sort_field: null, sort_field: null,
...@@ -149,15 +149,15 @@ export default { ...@@ -149,15 +149,15 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative; position: relative;
}
.el-icon-caret-bottom { .el-icon-caret-bottom {
position: absolute; position: absolute;
top: 20px; top: 20px;
} }
.el-icon-caret-top { .el-icon-caret-top {
position: absolute; position: absolute;
top: 13px; top: 13px;
}
} }
.table_box { .table_box {
......
/**
* @Author: AnthonyD
* @Date: 2023-04-21 15:02:15
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-21 19:06:40
*/
const style_text = '<style>table {\
border-collapse: collapse;\
}.table_box{width:80%;margin:auto;text-align: center;border: 1px solid #000; }\
th,td{ border-bottom: 1px solid #000; border-right: 1px solid #000;}</style>'
export default style_text;
...@@ -21,6 +21,17 @@ ...@@ -21,6 +21,17 @@
</div> </div>
</el-col> </el-col>
<el-col :span="12" style="text-align: right"> <el-col :span="12" style="text-align: right">
<el-button
v-if="original_data.print_id"
style="backgrount-color: #000; margin-right: 10px"
icon="el-icon-printer"
size="mini"
circle
class="print_box"
@click="print_()"
>
</el-button>
<el-checkbox <el-checkbox
v-if="original_data.is_show" v-if="original_data.is_show"
v-model="original_data.is_show.value" v-model="original_data.is_show.value"
...@@ -34,6 +45,7 @@ ...@@ -34,6 +45,7 @@
<Table <Table
v-if="original_data" v-if="original_data"
:table_data="original_data.list" :table_data="original_data.list"
:chart_id="original_data.chart_id"
:labers="original_data.labers" :labers="original_data.labers"
></Table> ></Table>
</div> </div>
...@@ -42,6 +54,7 @@ ...@@ -42,6 +54,7 @@
v-if="original_data" v-if="original_data"
:table_data="original_data" :table_data="original_data"
:labers="original_data.labers" :labers="original_data.labers"
:chart_id="original_data.chart_id"
> >
</SelectTabe> </SelectTabe>
</div> </div>
...@@ -63,7 +76,10 @@ ...@@ -63,7 +76,10 @@
></bar-chart> ></bar-chart>
</div> </div>
<div class="content_container" v-if="original_data.type == 'simple_table'"> <div class="content_container" v-if="original_data.type == 'simple_table'">
<simple-table :table_data="original_data"></simple-table> <simple-table
:table_data="original_data"
:chart_id="original_data.chart_id"
></simple-table>
</div> </div>
<!-- 眼光稳定性 --> <!-- 眼光稳定性 -->
<div <div
...@@ -85,6 +101,7 @@ import BarChart from './components/BarChart.vue'; ...@@ -85,6 +101,7 @@ import BarChart from './components/BarChart.vue';
import SimpleTable from './components/SimpleTable.vue'; import SimpleTable from './components/SimpleTable.vue';
import EyeStabilityTable from './components/EyeStabilityTable.vue'; import EyeStabilityTable from './components/EyeStabilityTable.vue';
import SelectTabe from './components/SelectTabe.vue'; import SelectTabe from './components/SelectTabe.vue';
import style_text from './components/table_style';
export default { export default {
props: ['module_data'], props: ['module_data'],
data() { data() {
...@@ -105,7 +122,7 @@ export default { ...@@ -105,7 +122,7 @@ export default {
computed: {}, computed: {},
created() { created() {
this.original_data = { ...this.module_data }; this.original_data = { ...this.module_data };
// console.log(this.original_data); console.log(this.original_data);
}, },
mounted() {}, mounted() {},
...@@ -114,6 +131,32 @@ export default { ...@@ -114,6 +131,32 @@ export default {
changeSelect() { changeSelect() {
this.$emit('changeSelect', this.original_data.is_show); this.$emit('changeSelect', this.original_data.is_show);
}, },
print_() {
let domObj = document.getElementById(this.original_data.chart_id);
var newWin = window.open(''); //新打开一个空窗口
let title = this.original_data.topic
? `<div> <h4>${this.original_data.topic}</h4></div>`
: '';
let body = `<div style="text-align: center">
<h2>${this.original_data.title}</h2>
${title}
${domObj.outerHTML}
</div>`;
if (domObj) {
newWin.document.write(body);
// newWin.document.write(outerHTML);
// console.log(domObj.outerHTML);
newWin.document.head.innerHTML = style_text; //给打印的内容加上样式
newWin.document.close(); //在IE浏览器中使用必须添加这一句
newWin.focus(); //在IE浏览器中使用必须添加这一句
setTimeout(() => {
newWin.print(); //打印
newWin.close(); //关闭窗口
}, 500);
}
},
}, },
}; };
</script> </script>
......
...@@ -191,7 +191,7 @@ export default { ...@@ -191,7 +191,7 @@ export default {
// console.log(val); // console.log(val);
// console.log(data); // console.log(data);
this.examination_questions_select_data = ''; this.examination_questions_select_data = '';
this.$emit('btnClick', { val, data }); this.$emit('btnClick', val, data);
}, },
uploadCode(val) { uploadCode(val) {
this.btn_code = val; this.btn_code = val;
......
...@@ -241,7 +241,7 @@ export default { ...@@ -241,7 +241,7 @@ export default {
btnClick(val) { btnClick(val) {
console.log('右侧按钮'); console.log('右侧按钮');
console.log(val); console.log(val);
if (val.val == 'add') this.addTobaccoInfo(); if (val == 'add') this.addTobaccoInfo();
}, },
init() { init() {
......
...@@ -371,6 +371,8 @@ export default { ...@@ -371,6 +371,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'result_section', chart_id: 'result_section',
print_id: 'result_section',
color: '#39c183f0', color: '#39c183f0',
title: '成绩分段值', title: '成绩分段值',
labers, labers,
...@@ -392,6 +394,7 @@ export default { ...@@ -392,6 +394,7 @@ export default {
chart_id: 'bar_chart', chart_id: 'bar_chart',
color: '#E6A23C', color: '#E6A23C',
title: '南方北方烟得分情况', title: '南方北方烟得分情况',
labers, labers,
keys, keys,
raw_data: datas, raw_data: datas,
...@@ -450,6 +453,8 @@ export default { ...@@ -450,6 +453,8 @@ export default {
return { return {
type: 'simple_table', type: 'simple_table',
chart_id: 'HighesLowesttScore_table', chart_id: 'HighesLowesttScore_table',
print_id: 'HighesLowesttScore_table',
color: '#99A9BF', color: '#99A9BF',
title: '最高分、最低分、平均分,中位数、众数、离散(变异系数)', title: '最高分、最低分、平均分,中位数、众数、离散(变异系数)',
labers, labers,
...@@ -467,6 +472,8 @@ export default { ...@@ -467,6 +472,8 @@ export default {
return { return {
type: 'select_table', type: 'select_table',
chart_id: 'transcript_bar_chart', chart_id: 'transcript_bar_chart',
print_id: 'transcript_bar_chart',
color: '#99A9BF', color: '#99A9BF',
title: '学员得分情况', title: '学员得分情况',
...@@ -516,7 +523,8 @@ export default { ...@@ -516,7 +523,8 @@ export default {
}); });
return { return {
type: 'eye_stability_table', type: 'eye_stability_table',
chart_id: 'wrong_group', chart_id: 'eye_stability',
print_id: 'eye_stability',
color: '#529B2E', color: '#529B2E',
title: '眼光稳定性', title: '眼光稳定性',
labers, labers,
...@@ -546,6 +554,8 @@ export default { ...@@ -546,6 +554,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_table', chart_id: 'wrong_table',
print_id: 'wrong_table',
color: '#F56C6C', color: '#F56C6C',
title: '易错题分析', title: '易错题分析',
labers, labers,
...@@ -573,6 +583,8 @@ export default { ...@@ -573,6 +583,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_table', chart_id: 'wrong_table',
print_id: 'wrong_table',
color: '#529B2E', color: '#529B2E',
title: '易对题分析', title: '易对题分析',
labers, labers,
...@@ -604,6 +616,8 @@ export default { ...@@ -604,6 +616,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_position', chart_id: 'wrong_position',
print_id: 'wrong_position',
color: '#E6A23C', color: '#E6A23C',
title: '错误部位', title: '错误部位',
labers, labers,
...@@ -632,6 +646,8 @@ export default { ...@@ -632,6 +646,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_level', chart_id: 'wrong_level',
print_id: 'wrong_level',
color: '#505F79', color: '#505F79',
title: '错误上下一级', title: '错误上下一级',
labers, labers,
...@@ -663,6 +679,8 @@ export default { ...@@ -663,6 +679,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_color', chart_id: 'wrong_color',
print_id: 'wrong_color',
color: '#99A9BF', color: '#99A9BF',
title: '错误颜色', title: '错误颜色',
labers, labers,
...@@ -693,6 +711,8 @@ export default { ...@@ -693,6 +711,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_group', chart_id: 'wrong_group',
print_id: 'wrong_group',
color: '#529B2E', color: '#529B2E',
title: '错误组别', title: '错误组别',
labers, labers,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-03-28 10:34:24 * @Date: 2023-03-28 10:34:24
* @Last Modified by: AnthonyD * @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-21 13:59:01 * @Last Modified time: 2023-04-21 14:57:51
*/ */
</script> </script>
<template> <template>
...@@ -244,7 +244,7 @@ export default { ...@@ -244,7 +244,7 @@ export default {
this.getListData(); this.getListData();
}, },
btnClick(val) { btnClick(val) {
if (val.val == 'add') this.addInformation(); if (val == 'add') this.addInformation();
}, },
init() { init() {
......
...@@ -366,8 +366,12 @@ export default { ...@@ -366,8 +366,12 @@ export default {
console.log(res); console.log(res);
this.is_loading = false; this.is_loading = false;
this.head_data.title = res.title_list; //标题 this.head_data.title = res.title_list; //标题
this.result_section = this.changeScore(res.ScoreScore); //成绩分段
this.area_score = this.changeAreaScore(res.AreaScore); //南北方得分 this.area_score = this.changeAreaScore(res.AreaScore); //南北方得分
this.result_section = this.changeScore(res.ScoreScore); //成绩分段
this.province_score = this.changeProvinceScore(res.ProvinceScore); //省区得分
this.province_score = this.changeProvinceScore(res.ProvinceScore); //省区得分 this.province_score = this.changeProvinceScore(res.ProvinceScore); //省区得分
this.breed_score = this.changeBreedScore(res.breedScore); //品种得分 this.breed_score = this.changeBreedScore(res.breedScore); //品种得分
this.transcript_data = this.changeTranscript(res.Transcript); //学员得分 this.transcript_data = this.changeTranscript(res.Transcript); //学员得分
...@@ -427,6 +431,7 @@ export default { ...@@ -427,6 +431,7 @@ export default {
chart_id: 'result_section', chart_id: 'result_section',
color: '#39c183f0', color: '#39c183f0',
title: '成绩分段值', title: '成绩分段值',
print_id: 'result_section',
labers, labers,
list, list,
data, data,
...@@ -491,6 +496,7 @@ export default { ...@@ -491,6 +496,7 @@ export default {
chart_id: 'province_bar_chart', chart_id: 'province_bar_chart',
color: '#505F79', color: '#505F79',
title: '省级产区得分情况', title: '省级产区得分情况',
labers, labers,
keys, keys,
raw_data: datas, raw_data: datas,
...@@ -512,6 +518,7 @@ export default { ...@@ -512,6 +518,7 @@ export default {
return { return {
type: 'bar', type: 'bar',
chart_id: 'breed_bar_chart', chart_id: 'breed_bar_chart',
color: '#39c183f0', color: '#39c183f0',
title: '品种得分情况', title: '品种得分情况',
...@@ -535,9 +542,10 @@ export default { ...@@ -535,9 +542,10 @@ export default {
return { return {
type: 'select_table', type: 'select_table',
chart_id: 'transcript_bar_chart', chart_id: 'transcript_bar_chart',
print_id: 'transcript_bar_chart',
color: '#99A9BF', color: '#99A9BF',
title: '学员得分情况', title: '学员得分情况',
labers, labers,
topic: select_list, topic: select_list,
select_value: select_list[0], select_value: select_list[0],
...@@ -565,6 +573,7 @@ export default { ...@@ -565,6 +573,7 @@ export default {
return { return {
type: 'simple_table', type: 'simple_table',
chart_id: 'HighesLowesttScore_table', chart_id: 'HighesLowesttScore_table',
print_id: 'HighesLowesttScore_table',
color: '#99A9BF', color: '#99A9BF',
title: '最高分、最低分、平均分,中位数、众数、离散(变异系数)', title: '最高分、最低分、平均分,中位数、众数、离散(变异系数)',
labers, labers,
...@@ -598,7 +607,8 @@ export default { ...@@ -598,7 +607,8 @@ export default {
}); });
return { return {
type: 'eye_stability_table', type: 'eye_stability_table',
chart_id: 'wrong_group', print_id: 'eye_stability',
chart_id: 'eye_stability',
color: '#E6A23C', color: '#E6A23C',
title: '眼光稳定性', title: '眼光稳定性',
labers, labers,
...@@ -635,6 +645,8 @@ export default { ...@@ -635,6 +645,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_table', chart_id: 'wrong_table',
print_id: 'wrong_table',
color: '#F56C6C', color: '#F56C6C',
title: '易错题分析', title: '易错题分析',
labers, labers,
...@@ -669,6 +681,8 @@ export default { ...@@ -669,6 +681,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_table', chart_id: 'wrong_table',
print_id: 'wrong_table',
color: '#529B2E', color: '#529B2E',
title: '易对题分析', title: '易对题分析',
labers, labers,
...@@ -697,6 +711,8 @@ export default { ...@@ -697,6 +711,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_position', chart_id: 'wrong_position',
print_id: 'wrong_position',
color: '#E6A23C', color: '#E6A23C',
title: '错误部位', title: '错误部位',
labers, labers,
...@@ -729,6 +745,8 @@ export default { ...@@ -729,6 +745,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_level', chart_id: 'wrong_level',
print_id: 'wrong_level',
color: '#505F79', color: '#505F79',
title: '错误上下一级', title: '错误上下一级',
labers, labers,
...@@ -761,6 +779,8 @@ export default { ...@@ -761,6 +779,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_color', chart_id: 'wrong_color',
print_id: 'wrong_color',
color: '#99A9BF', color: '#99A9BF',
title: '错误颜色', title: '错误颜色',
labers, labers,
...@@ -793,6 +813,8 @@ export default { ...@@ -793,6 +813,8 @@ export default {
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_group', chart_id: 'wrong_group',
print_id: 'wrong_group',
color: '#529B2E', color: '#529B2E',
title: '错误组别', title: '错误组别',
labers, labers,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-03-28 10:34:24 * @Date: 2023-03-28 10:34:24
* @Last Modified by: AnthonyD * @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-21 13:49:45 * @Last Modified time: 2023-04-21 14:50:03
*/ */
</script> </script>
<template> <template>
...@@ -302,16 +302,17 @@ export default { ...@@ -302,16 +302,17 @@ export default {
this.request_params.val = ''; this.request_params.val = '';
this.getExaminationQuestionsDetail(); this.getExaminationQuestionsDetail();
}, },
btnClick(val) { btnClick(val, data = null) {
// console.log('右侧按钮'); // console.log('右侧按钮');
// console.log(val); console.log(val);
console.log(data);
if (val.val == 'add') this.addInformation(); if (val == 'add') this.addInformation();
if (val.val == 'template_download') this.templateDownload(val.data); if (val == 'template_download') this.templateDownload(data);
/* pictureBatchUpload */ /* pictureBatchUpload */
if (val.val == 'batch_upload') this.pictureBatchUpload(); if (val == 'batch_upload') this.pictureBatchUpload();
if (val.val == 'examination_download') this.createAnswerCard(); if (val == 'examination_download') this.createAnswerCard();
if (val.val == 'select_score') this.selectScoreData(val.data); if (val == 'select_score') this.selectScoreData(data);
}, },
init() { init() {
......
...@@ -3,17 +3,27 @@ ...@@ -3,17 +3,27 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-03-28 10:34:24 * @Date: 2023-03-28 10:34:24
* @Last Modified by: AnthonyD * @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-21 13:45:13 * @Last Modified time: 2023-04-21 17:26:42
*/ */
</script> </script>
<template> <template>
<div class="module_container"> <div class="module_container">
<div class="card_container"> <div class="card_container">
<el-card class="box-card"> <el-card class="box-card">
<table-head :head_data="head_data" @search="searchEvent" @resetting="resetting" @btnClick="btnClick" <table-head
@upload="sliderRequest"></table-head> :head_data="head_data"
@search="searchEvent"
@resetting="resetting"
@btnClick="btnClick"
@upload="sliderRequest"
></table-head>
<div class="table_container"> <div class="table_container">
<el-table v-loading="is_loading" :data="tableData" style="width: 100%;margin-bottom: 20px;" height="650"> <el-table
v-loading="is_loading"
:data="tableData"
style="width: 100%; margin-bottom: 20px"
height="650"
>
<el-table-column prop="id" label="编号" width="50"> <el-table-column prop="id" label="编号" width="50">
</el-table-column> </el-table-column>
<el-table-column prop="name" label="姓名" width="100"> <el-table-column prop="name" label="姓名" width="100">
...@@ -39,54 +49,105 @@ ...@@ -39,54 +49,105 @@
<el-table-column prop="status" label="状态" width="100"> <el-table-column prop="status" label="状态" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<div> <div>
<el-tag v-if="scope.row.status == 1" type="success">正常</el-tag> <el-tag v-if="scope.row.status == 1" type="success"
<el-tag v-if="scope.row.status == 2 || scope.row.status == 3" type="danger">禁止</el-tag> >正常</el-tag
>
<el-tag
v-if="scope.row.status == 2 || scope.row.status == 3"
type="danger"
>禁止</el-tag
>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="work_info" label="工作单位">
</el-table-column>
<el-table-column prop="remark" label="备注"> <el-table-column prop="remark" label="备注">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="remark_box" :title="scope.row.remark">{{ scope.row.remark }} <div class="remark_box" :title="scope.row.remark">
{{ scope.row.remark }}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="120"> <el-table-column label="操作" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" style="color: #000;" <el-button
@click="updateInformation(scope.row)">编辑</el-button> size="mini"
<el-button size="mini" type="text" style="color: #000;" @click="viewDetails(scope.row)">详情</el-button> type="text"
<el-button v-if="scope.row.status == 1" size="mini" type="text" style="color: #F56C6C;" style="color: #000"
@click="deleteInformation(scope.row)">禁用</el-button> @click="updateInformation(scope.row)"
>编辑</el-button
>
<el-button
size="mini"
type="text"
style="color: #000"
@click="viewDetails(scope.row)"
>详情</el-button
>
<el-button
v-if="scope.row.status == 1"
size="mini"
type="text"
style="color: #f56c6c"
@click="deleteInformation(scope.row)"
>禁用</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div style="text-align: right;"> <div style="text-align: right">
<el-pagination @current-change="handleCurrentChange" :current-page.sync="request_params.page" <el-pagination
:page-size="request_params.limit" layout="total, prev, pager, next" :total="request_params.total"> @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> </el-pagination>
</div> </div>
</el-card> </el-card>
</div> </div>
<el-dialog :title="is_updata_type == 'view' ? '查看学员' : (is_updata_type == 'add' ? '新增学员' : '修改学员')" <el-dialog
:visible.sync="is_dialogVisible" width="60%" :before-close="handleClose"> :title="
is_updata_type == 'view'
? '查看学员'
: is_updata_type == 'add'
? '新增学员'
: '修改学员'
"
:visible.sync="is_dialogVisible"
width="60%"
:before-close="handleClose"
>
<div> <div>
<el-form :model="detailed_information" :rules="rules" ref="ruleForm" label-width="100px"> <el-form
:model="detailed_information"
:rules="rules"
ref="ruleForm"
label-width="100px"
>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="姓名"> <el-form-item label="姓名">
<el-input v-model="detailed_information.name" placeholder="姓名" <el-input
:disabled="is_updata_type == 'view'"></el-input> v-model="detailed_information.name"
placeholder="姓名"
:disabled="is_updata_type == 'view'"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="性别"> <el-form-item label="性别">
<el-select v-model="detailed_information.sex" placeholder="请选择" :disabled="is_updata_type == 'view'"> <el-select
<el-option :label="'男'" :value="'男'"> v-model="detailed_information.sex"
</el-option> placeholder="请选择"
<el-option :label="'女'" :value="'女'"> :disabled="is_updata_type == 'view'"
</el-option> >
<el-option :label="'男'" :value="'男'"> </el-option>
<el-option :label="'女'" :value="'女'"> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -94,56 +155,87 @@ ...@@ -94,56 +155,87 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="年龄"> <el-form-item label="年龄">
<el-input v-model="detailed_information.age" placeholder="年龄" <el-input
:disabled="is_updata_type == 'view'"></el-input> v-model="detailed_information.age"
placeholder="年龄"
:disabled="is_updata_type == 'view'"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="籍贯"> <el-form-item label="籍贯">
<el-input v-model="detailed_information.native_place" placeholder="籍贯" type="textarea" :rows="2" <el-input
:disabled="is_updata_type == 'view'"></el-input> v-model="detailed_information.native_place"
placeholder="籍贯"
type="textarea"
:rows="2"
:disabled="is_updata_type == 'view'"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="省市区"> <el-form-item label="省市区">
<el-cascader v-if="province_list" :options="province_list" v-model="detailed_information.linkage_id" <el-cascader
:show-all-levels="false" @change="handleChange" clearable filterable v-if="province_list"
:disabled="is_updata_type == 'view'"></el-cascader> :options="province_list"
v-model="detailed_information.linkage_id"
:show-all-levels="false"
@change="handleChange"
clearable
filterable
:disabled="is_updata_type == 'view'"
></el-cascader>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工作单位"> <el-form-item label="工作单位">
<el-input v-model="detailed_information.work_info" placeholder="工作单位" <el-input
:disabled="is_updata_type == 'view'"></el-input> v-model="detailed_information.work_info"
placeholder="工作单位"
:disabled="is_updata_type == 'view'"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="证件号"> <el-form-item label="证件号">
<el-input v-model="detailed_information.idcard" placeholder="证件号" <el-input
:disabled="is_updata_type == 'view'"></el-input> v-model="detailed_information.idcard"
placeholder="证件号"
:disabled="is_updata_type == 'view'"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="手机号"> <el-form-item label="手机号">
<el-input v-model="detailed_information.phone" placeholder="手机号" type="number" <el-input
:disabled="is_updata_type == 'view'"></el-input> v-model="detailed_information.phone"
placeholder="手机号"
type="number"
:disabled="is_updata_type == 'view'"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="邮箱"> <el-form-item label="邮箱">
<el-input v-model="detailed_information.email" placeholder="邮箱" <el-input
:disabled="is_updata_type == 'view'"></el-input> v-model="detailed_information.email"
placeholder="邮箱"
:disabled="is_updata_type == 'view'"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="状态"> <el-form-item label="状态">
<el-radio-group v-model="detailed_information.status" :disabled="is_updata_type == 'view'"> <el-radio-group
v-model="detailed_information.status"
:disabled="is_updata_type == 'view'"
>
<el-radio :label="1">正常</el-radio> <el-radio :label="1">正常</el-radio>
<!-- <el-radio :label="2">禁用</el-radio> --> <!-- <el-radio :label="2">禁用</el-radio> -->
<el-radio :label="3">禁用</el-radio> <el-radio :label="3">禁用</el-radio>
...@@ -154,29 +246,46 @@ ...@@ -154,29 +246,46 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="开始工作时间"> <el-form-item label="开始工作时间">
<el-date-picker v-model="detailed_information.start_working" type="date" placeholder="选择日期" <el-date-picker
:disabled="is_updata_type == 'view'"> v-model="detailed_information.start_working"
type="date"
placeholder="选择日期"
:disabled="is_updata_type == 'view'"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="密码"> <el-form-item label="密码">
<el-input v-model="detailed_information.password" placeholder="密码" <el-input
:disabled="is_updata_type == 'view'"></el-input> v-model="detailed_information.password"
placeholder="密码"
:disabled="is_updata_type == 'view'"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="备注"> <el-form-item label="备注">
<el-input v-model="detailed_information.remark" placeholder="备注" type="textarea" :rows="2" <el-input
:disabled="is_updata_type == 'view'"></el-input> v-model="detailed_information.remark"
placeholder="备注"
type="textarea"
:rows="2"
:disabled="is_updata_type == 'view'"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="简介"> <el-form-item label="简介">
<el-input v-model="detailed_information.brief_introduction" placeholder="简介" type="textarea" :rows="2" <el-input
:disabled="is_updata_type == 'view'"></el-input> v-model="detailed_information.brief_introduction"
placeholder="简介"
type="textarea"
:rows="2"
:disabled="is_updata_type == 'view'"
></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -192,10 +301,19 @@ ...@@ -192,10 +301,19 @@
<script> <script>
import TableHead from '@/components/TableHead/index'; import TableHead from '@/components/TableHead/index';
import { get_province_list, get_student_list, add_student, delete_student, updat_student, get_student_detail, download_student_info, upload_student_info } from '@/api/student'; import {
get_province_list,
get_student_list,
add_student,
delete_student,
updat_student,
get_student_detail,
download_student_info,
upload_student_info,
} from '@/api/student';
import { exportText } from '@/utils/tool.js'; import { exportText } from '@/utils/tool.js';
const standard_template = { const standard_template = {
name: "", name: '',
password: '', password: '',
sex: null, sex: null,
age: null, age: null,
...@@ -205,14 +323,14 @@ const standard_template = { ...@@ -205,14 +323,14 @@ const standard_template = {
area: null, area: null,
work_info: null, work_info: null,
idcard: null, idcard: null,
phone: "", phone: '',
email: "", email: '',
remark: null, remark: null,
status: 1, status: 1,
start_working: null, start_working: null,
brief_introduction: "", brief_introduction: '',
linkage_id: [],//三级联动id linkage_id: [], //三级联动id
} };
export default { export default {
data() { data() {
return { return {
...@@ -220,7 +338,7 @@ export default { ...@@ -220,7 +338,7 @@ export default {
//头部按钮 //头部按钮
head_data: { head_data: {
is_search_show: true, is_search_show: true,
search_placeholder: "学员姓名/手机号", search_placeholder: '学员姓名/手机号',
right_buttons: [ right_buttons: [
{ {
text: '新增', text: '新增',
...@@ -256,12 +374,8 @@ export default { ...@@ -256,12 +374,8 @@ export default {
detailed_information: {}, detailed_information: {},
//表单校验 //表单校验
rules: { rules: {
name: [ name: [{ required: true, message: '请输入姓名名称', trigger: 'blur' }],
{ required: true, message: '请输入姓名名称', trigger: 'blur' },
],
}, },
}; };
}, },
...@@ -270,7 +384,7 @@ export default { ...@@ -270,7 +384,7 @@ export default {
computed: {}, computed: {},
mounted() { mounted() {
this.init() this.init();
}, },
methods: { methods: {
...@@ -289,8 +403,8 @@ export default { ...@@ -289,8 +403,8 @@ export default {
btnClick(val) { btnClick(val) {
console.log('右侧按钮'); console.log('右侧按钮');
console.log(val); console.log(val);
if (val.val == 'add') this.addInformation(); if (val == 'add') this.addInformation();
if (val.val == 'download') this.downloadFormwork(); if (val == 'download') this.downloadFormwork();
}, },
init() { init() {
...@@ -308,7 +422,7 @@ export default { ...@@ -308,7 +422,7 @@ export default {
console.log('要提交的数据'); console.log('要提交的数据');
console.log(params); console.log(params);
if (this.is_updata_type == 'add') { if (this.is_updata_type == 'add') {
add_student(params).then(res => { add_student(params).then((res) => {
console.log('新增回调'); console.log('新增回调');
console.log(res); console.log(res);
if (res.code == 200) { if (res.code == 200) {
...@@ -316,10 +430,10 @@ export default { ...@@ -316,10 +430,10 @@ export default {
this.is_dialogVisible = false; this.is_dialogVisible = false;
this.getListData(); this.getListData();
} }
}) });
} else { } else {
let id = this.detailed_information.id; let id = this.detailed_information.id;
updat_student(id, params).then(res => { updat_student(id, params).then((res) => {
console.log('修改回调'); console.log('修改回调');
console.log(res); console.log(res);
if (res.code == 200) { if (res.code == 200) {
...@@ -327,7 +441,7 @@ export default { ...@@ -327,7 +441,7 @@ export default {
this.is_dialogVisible = false; this.is_dialogVisible = false;
this.getListData(); this.getListData();
} }
}) });
} }
}, },
//获取省市区泪飙 //获取省市区泪飙
...@@ -339,30 +453,30 @@ export default { ...@@ -339,30 +453,30 @@ export default {
if (list[i].children.length == 0) { if (list[i].children.length == 0) {
delete list[i].children; delete list[i].children;
} else { } else {
removeNodeInTree(list[i].children) removeNodeInTree(list[i].children);
} }
} }
return list return list;
} };
get_province_list({ name_is_value: true }).then(res => { get_province_list({ name_is_value: true }).then((res) => {
if (res.length) { if (res.length) {
this.province_list = removeNodeInTree(res); this.province_list = removeNodeInTree(res);
} else { } else {
this.province_list = []; this.province_list = [];
} }
}) });
}, },
//获取列表数据 //获取列表数据
getListData() { getListData() {
let params = this.$removeProperty(this.request_params); let params = this.$removeProperty(this.request_params);
this.is_loading = true; this.is_loading = true;
get_student_list(params).then(res => { get_student_list(params).then((res) => {
console.log('列表数据'); console.log('列表数据');
console.log(res); console.log(res);
this.tableData = res.data || []; this.tableData = res.data || [];
this.request_params.total = res.total; this.request_params.total = res.total;
this.is_loading = false; this.is_loading = false;
}) });
}, },
//分页 //分页
handleCurrentChange(val) { handleCurrentChange(val) {
...@@ -380,23 +494,31 @@ export default { ...@@ -380,23 +494,31 @@ export default {
this.is_updata_type = 'edit'; this.is_updata_type = 'edit';
let id = item.id; let id = item.id;
//获取详情 //获取详情
get_student_detail(id).then(res => { get_student_detail(id).then((res) => {
console.log('详细信息'); console.log('详细信息');
console.log(res); console.log(res);
this.detailed_information = JSON.parse(JSON.stringify(res)) || {}; this.detailed_information = JSON.parse(JSON.stringify(res)) || {};
this.detailed_information['linkage_id'] = [res.province, res.city, res.area]; this.detailed_information['linkage_id'] = [
res.province,
res.city,
res.area,
];
this.is_dialogVisible = true; this.is_dialogVisible = true;
}) });
}, },
//查看详情 //查看详情
viewDetails(item) { viewDetails(item) {
let id = item.id; let id = item.id;
this.is_updata_type = 'view'; this.is_updata_type = 'view';
get_student_detail(id).then(res => { get_student_detail(id).then((res) => {
this.detailed_information = JSON.parse(JSON.stringify(res)) || {}; this.detailed_information = JSON.parse(JSON.stringify(res)) || {};
this.detailed_information['linkage_id'] = [res.province, res.city, res.area]; this.detailed_information['linkage_id'] = [
res.province,
res.city,
res.area,
];
this.is_dialogVisible = true; this.is_dialogVisible = true;
}) });
}, },
//删除 //删除
deleteInformation(item) { deleteInformation(item) {
...@@ -404,34 +526,36 @@ export default { ...@@ -404,34 +526,36 @@ export default {
this.$confirm('是否禁用此用户?', '提示', { this.$confirm('是否禁用此用户?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
}).then(() => { })
delete_student(id).then(res => { .then(() => {
if (res.code == 200) { delete_student(id).then((res) => {
this.$message.success(res.message); if (res.code == 200) {
this.init(); this.$message.success(res.message);
} this.init();
}
});
}) })
}).catch(() => { .catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消删除' message: '已取消删除',
});
}); });
});
}, },
//省市区选择监听 //省市区选择监听
handleChange(val) { handleChange(val) {
console.log('选择的值'); console.log('选择的值');
console.log(val); console.log(val);
if (val.length == 3) { if (val.length == 3) {
this.detailed_information.province = val[0];//省 this.detailed_information.province = val[0]; //省
this.detailed_information.city = val[1];//市 this.detailed_information.city = val[1]; //市
this.detailed_information.area = val[2];//区 this.detailed_information.area = val[2]; //区
} }
}, },
//下载 //下载
downloadFormwork() { downloadFormwork() {
download_student_info({ val: this.request_params.val }).then(res => { download_student_info({ val: this.request_params.val }).then((res) => {
console.log('下载模板'); console.log('下载模板');
console.log(res); console.log(res);
if (res.code == 200) { if (res.code == 200) {
...@@ -439,7 +563,7 @@ export default { ...@@ -439,7 +563,7 @@ export default {
let url = `${this.IP}${res.message}`; let url = `${this.IP}${res.message}`;
exportText(url, str[str.length - 1]); exportText(url, str[str.length - 1]);
} }
}) });
}, },
//上传类型的按钮回调 //上传类型的按钮回调
sliderRequest(upload) { sliderRequest(upload) {
...@@ -447,13 +571,13 @@ export default { ...@@ -447,13 +571,13 @@ export default {
console.log(upload); console.log(upload);
if (upload.btn_code == 'upload') { if (upload.btn_code == 'upload') {
const formData = new FormData(); const formData = new FormData();
formData.append('file', upload.file) formData.append('file', upload.file);
upload_student_info(formData).then(res => { upload_student_info(formData).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.$message.success(res.message); this.$message.success(res.message);
this.getListData(); this.getListData();
} }
}) });
} }
if (upload.btn_code == 'batch_reservation') { if (upload.btn_code == 'batch_reservation') {
console.log('批量上传'); console.log('批量上传');
...@@ -461,26 +585,24 @@ export default { ...@@ -461,26 +585,24 @@ export default {
}, },
//手机号加密 //手机号加密
phoneEncryption(phone_number) { phoneEncryption(phone_number) {
let tel = "" + phone_number; let tel = '' + phone_number;
if (tel.length == 11) { if (tel.length == 11) {
return tel.substr(0, 3) + "****" + tel.substr(7); return tel.substr(0, 3) + '****' + tel.substr(7);
} else { } else {
return phone_number return phone_number;
} }
}, },
//身份证加密 //身份证加密
idcardEncryption(id) { idcardEncryption(id) {
let tel = "" + id; let tel = '' + id;
if (tel.length == 18) { if (tel.length == 18) {
return tel.substr(0, 4) + "**********" + tel.substr(14); return tel.substr(0, 4) + '**********' + tel.substr(14);
} else { } else {
return id return id;
} }
}, },
}, },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.remark_box { .remark_box {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-03-29 17:06:03 * @Date: 2023-03-29 17:06:03
* @Last Modified by: AnthonyD * @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-19 10:34:19 * @Last Modified time: 2023-04-21 17:13:47
*/ */
</script> </script>
<template> <template>
...@@ -261,6 +261,7 @@ export default { ...@@ -261,6 +261,7 @@ export default {
chart_id: 'bar_chart1', chart_id: 'bar_chart1',
color: '#E6A23C', color: '#E6A23C',
title: '南北方正确/错误率', title: '南北方正确/错误率',
labers, labers,
keys, keys,
raw_data: datas, raw_data: datas,
...@@ -375,6 +376,7 @@ export default { ...@@ -375,6 +376,7 @@ export default {
type: 'table', type: 'table',
chart_id: 'wrong_group', chart_id: 'wrong_group',
color: '#529B2E', color: '#529B2E',
title: '错误组别', title: '错误组别',
labers, labers,
list, list,
...@@ -401,7 +403,8 @@ export default { ...@@ -401,7 +403,8 @@ export default {
}); });
return { return {
type: 'table', type: 'table',
chart_id: 'wrong_group', chart_id: 'wrong_groups',
color: '#529B2E', color: '#529B2E',
title: '错误正副组', title: '错误正副组',
labers, labers,
...@@ -460,7 +463,7 @@ export default { ...@@ -460,7 +463,7 @@ export default {
}); });
return { return {
type: 'eye_stability_table', type: 'eye_stability_table',
chart_id: 'wrong_group', chart_id: 'eye_stability',
color: '#E6A23C', color: '#E6A23C',
title: '眼光稳定性', title: '眼光稳定性',
labers, labers,
......
...@@ -203,7 +203,7 @@ export default { ...@@ -203,7 +203,7 @@ export default {
btnClick(val) { btnClick(val) {
console.log('右侧按钮'); console.log('右侧按钮');
console.log(val); console.log(val);
if (val.val == 'add') this.addInformation(); if (val == 'add') this.addInformation();
}, },
init() { init() {
......
...@@ -3,16 +3,26 @@ ...@@ -3,16 +3,26 @@
* @Author: AnthonyD * @Author: AnthonyD
* @Date: 2023-03-28 10:34:24 * @Date: 2023-03-28 10:34:24
* @Last Modified by: AnthonyD * @Last Modified by: AnthonyD
* @Last Modified time: 2023-04-21 13:58:02 * @Last Modified time: 2023-04-21 14:57:01
*/ */
</script> </script>
<template> <template>
<div class="module_container"> <div class="module_container">
<div class="card_container"> <div class="card_container">
<el-card class="box-card"> <el-card class="box-card">
<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"> <div class="table_container">
<el-table v-loading="is_loading" :data="tableData" style="width: 100%;margin-bottom: 20px;" height="650"> <el-table
v-loading="is_loading"
:data="tableData"
style="width: 100%; margin-bottom: 20px"
height="650"
>
<el-table-column prop="id" label="编号" width="50"> <el-table-column prop="id" label="编号" width="50">
</el-table-column> </el-table-column>
<el-table-column prop="grade" label="品种等级"> <el-table-column prop="grade" label="品种等级">
...@@ -21,40 +31,63 @@ ...@@ -21,40 +31,63 @@
<div>{{ scope.row.grade_name }}</div> <div>{{ scope.row.grade_name }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="appearance_characteristics" label="等级外观特征"> <el-table-column
prop="appearance_characteristics"
label="等级外观特征"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover placement="right" trigger="hover"> <el-popover placement="right" trigger="hover">
<div v-for="(item, key, index) in scope.row.appearance_characteristics" :key="index"> <div
v-for="(item, key, index) in scope.row
.appearance_characteristics"
:key="index"
>
<span>{{ key }}</span> : <span>{{ key }}</span> :
<span>{{ scope.row.appearance_characteristics[key] }}</span> <span>{{ scope.row.appearance_characteristics[key] }}</span>
</div> </div>
<el-button slot="reference" type="text" size="mini" title="点击查看">. . .</el-button> <el-button
slot="reference"
type="text"
size="mini"
title="点击查看"
>. . .</el-button
>
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="price1" label="一价区" width="100"> <el-table-column prop="price1" label="一价区" width="100">
<template slot-scope="scope"><span>¥{{ scope.row.price1 }}</span></template> <template slot-scope="scope"
><span>¥{{ scope.row.price1 }}</span></template
>
</el-table-column> </el-table-column>
<el-table-column prop="price2" label="二价区" width="100"> <el-table-column prop="price2" label="二价区" width="100">
<template slot-scope="scope"><span>¥{{ scope.row.price2 }}</span></template> <template slot-scope="scope"
><span>¥{{ scope.row.price2 }}</span></template
>
</el-table-column> </el-table-column>
<el-table-column prop="price3" label="三价区" width="100"> <el-table-column prop="price3" label="三价区" width="100">
<template slot-scope="scope"><span>¥{{ scope.row.price3 }}</span></template> <template slot-scope="scope"
</el-table-column> ><span>¥{{ scope.row.price3 }}</span></template
<el-table-column prop="grade2" label="组别"> >
</el-table-column>
<el-table-column prop="remark" label="备注">
</el-table-column> </el-table-column>
<el-table-column prop="grade2" label="组别"> </el-table-column>
<el-table-column prop="remark" label="备注"> </el-table-column>
<el-table-column prop="adjacent_grade" label="同组别紧邻等级"> <el-table-column prop="adjacent_grade" label="同组别紧邻等级">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-for="(item, index) in scope.row.adjacent_grade" :key="index"> <div
v-for="(item, index) in scope.row.adjacent_grade"
:key="index"
>
<span>{{ item }},</span> <span>{{ item }},</span>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="quality_adjacent" label="外观质量相邻等级"> <el-table-column prop="quality_adjacent" label="外观质量相邻等级">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-for="(item, index) in scope.row.quality_adjacent" :key="index"> <div
v-for="(item, index) in scope.row.quality_adjacent"
:key="index"
>
<span>{{ item }},</span> <span>{{ item }},</span>
</div> </div>
</template> </template>
...@@ -63,27 +96,51 @@ ...@@ -63,27 +96,51 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="120"> <el-table-column label="操作" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" style="color: #000;" <el-button
@click="editTobaccoGrades(scope.row)">编辑</el-button> size="mini"
<el-button size="mini" type="text" style="color: #F56C6C;" type="text"
@click="deleteTobaccoGrades(scope.row)">删除</el-button> style="color: #000"
@click="editTobaccoGrades(scope.row)"
>编辑</el-button
>
<el-button
size="mini"
type="text"
style="color: #f56c6c"
@click="deleteTobaccoGrades(scope.row)"
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div style="text-align: right;"> <div style="text-align: right">
<el-pagination @current-change="handleCurrentChange" :current-page.sync="request_params.page" <el-pagination
:page-size="request_params.limit" layout="total, prev, pager, next" :total="request_params.total"> @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> </el-pagination>
</div> </div>
</el-card> </el-card>
</div> </div>
<el-dialog :title="is_updata_type == 'add' ? '新增烟草等级' : '修改烟草等级'" :visible.sync="is_dialogVisible" width="60%" <el-dialog
top="50px" :before-close="handleClose"> :title="is_updata_type == 'add' ? '新增烟草等级' : '修改烟草等级'"
:visible.sync="is_dialogVisible"
width="60%"
top="50px"
:before-close="handleClose"
>
<div> <div>
<Dialog v-if="is_dialogVisible" :tobacco_grades_infos="tobacco_grades_info" @handleClose="handleClose" <Dialog
@submitData="submitData"></Dialog> v-if="is_dialogVisible"
:tobacco_grades_infos="tobacco_grades_info"
@handleClose="handleClose"
@submitData="submitData"
></Dialog>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
...@@ -92,27 +149,34 @@ ...@@ -92,27 +149,34 @@
<script> <script>
import TableHead from '@/components/TableHead/index'; import TableHead from '@/components/TableHead/index';
import Dialog from './components/dialog.vue'; import Dialog from './components/dialog.vue';
import { get_tobacco_grades_all, get_tobacco_grades_list, add_tobacco_grades, delete_tobacco_grades, updata_tobacco_grades, get_tobacco_grades_detail } from '@/api/student'; import {
get_tobacco_grades_all,
get_tobacco_grades_list,
add_tobacco_grades,
delete_tobacco_grades,
updata_tobacco_grades,
get_tobacco_grades_detail,
} from '@/api/student';
const standard_template = { const standard_template = {
grade_code: "", grade_code: '',
grade_name: "", grade_name: '',
grade: "", grade: '',
position: "", position: '',
color: "", color: '',
large_scale: "", large_scale: '',
grade2: "", grade2: '',
adjacent_grade: [], adjacent_grade: [],
quality_adjacent: [], quality_adjacent: [],
price1: "", price1: '',
price2: "", price2: '',
price3: "", price3: '',
price4: "", price4: '',
price_other: "", price_other: '',
appearance_characteristics: {}, appearance_characteristics: {},
appearance_characteristics_list: [], appearance_characteristics_list: [],
remark: "" remark: '',
} };
export default { export default {
data() { data() {
return { return {
...@@ -125,12 +189,12 @@ export default { ...@@ -125,12 +189,12 @@ export default {
text: '新增', text: '新增',
icon: 'el-icon-plus', icon: 'el-icon-plus',
event: 'add', event: 'add',
} },
], ],
}, },
//初始化请求参数 //初始化请求参数
request_params: { request_params: {
val: "", val: '',
page: 1, page: 1,
limit: 10, limit: 10,
total: null, total: null,
...@@ -143,7 +207,6 @@ export default { ...@@ -143,7 +207,6 @@ export default {
//烟草品级信息 //烟草品级信息
tobacco_grades_info: {}, tobacco_grades_info: {},
//全部烟草品级,用来选择 //全部烟草品级,用来选择
}; };
}, },
...@@ -152,7 +215,7 @@ export default { ...@@ -152,7 +215,7 @@ export default {
computed: {}, computed: {},
mounted() { mounted() {
this.init() this.init();
}, },
methods: { methods: {
...@@ -171,7 +234,7 @@ export default { ...@@ -171,7 +234,7 @@ export default {
btnClick(val) { btnClick(val) {
console.log('右侧按钮'); console.log('右侧按钮');
console.log(val); console.log(val);
if (val.val == 'add') this.addTobaccoGrades(); if (val == 'add') this.addTobaccoGrades();
}, },
init() { init() {
...@@ -189,7 +252,7 @@ export default { ...@@ -189,7 +252,7 @@ export default {
console.log(val); console.log(val);
let params = this.$handleParams(val); let params = this.$handleParams(val);
if (this.is_updata_type == 'add') { if (this.is_updata_type == 'add') {
add_tobacco_grades(params).then(res => { add_tobacco_grades(params).then((res) => {
console.log('新增'); console.log('新增');
console.log(res); console.log(res);
if (res.code == 200) { if (res.code == 200) {
...@@ -197,10 +260,10 @@ export default { ...@@ -197,10 +260,10 @@ export default {
this.is_dialogVisible = false; this.is_dialogVisible = false;
this.getTobaccoGradesList(); this.getTobaccoGradesList();
} }
}) });
} else { } else {
let id = val.id; let id = val.id;
updata_tobacco_grades(id, params).then(res => { updata_tobacco_grades(id, params).then((res) => {
console.log('修改'); console.log('修改');
console.log(res); console.log(res);
if (res.code == 200) { if (res.code == 200) {
...@@ -208,32 +271,32 @@ export default { ...@@ -208,32 +271,32 @@ export default {
this.is_dialogVisible = false; this.is_dialogVisible = false;
this.getTobaccoGradesList(); this.getTobaccoGradesList();
} }
}) });
} }
}, },
//获取全部烟草品级 //获取全部烟草品级
getTobaccoGradesAll() { getTobaccoGradesAll() {
get_tobacco_grades_all().then(res => { get_tobacco_grades_all().then((res) => {
console.log('全部烟草'); console.log('全部烟草');
console.log(res); console.log(res);
let list = res.map(item => { let list = res.map((item) => {
return { label: item.grade_name, value: item.grade_code } return { label: item.grade_name, value: item.grade_code };
}) });
console.log(list); console.log(list);
}) });
}, },
//获取列表 //获取列表
getTobaccoGradesList() { getTobaccoGradesList() {
this.is_loading = true; this.is_loading = true;
let params = this.$removeProperty(this.request_params); let params = this.$removeProperty(this.request_params);
get_tobacco_grades_list(params).then(res => { get_tobacco_grades_list(params).then((res) => {
console.log('烟草等级列表'); console.log('烟草等级列表');
console.log(res); console.log(res);
this.tableData = res.data || []; this.tableData = res.data || [];
this.request_params.total = res.total; this.request_params.total = res.total;
this.is_loading = false; this.is_loading = false;
}) });
}, },
//分页 //分页
handleCurrentChange(val) { handleCurrentChange(val) {
...@@ -250,17 +313,19 @@ export default { ...@@ -250,17 +313,19 @@ export default {
editTobaccoGrades(item) { editTobaccoGrades(item) {
this.is_updata_type = 'edit'; this.is_updata_type = 'edit';
let id = item.id; let id = item.id;
get_tobacco_grades_detail(id).then(res => { get_tobacco_grades_detail(id).then((res) => {
console.log('获取详情'); console.log('获取详情');
console.log(res); console.log(res);
this.tobacco_grades_info = { ...res }; this.tobacco_grades_info = { ...res };
this.tobacco_grades_info.appearance_characteristics_list = []; this.tobacco_grades_info.appearance_characteristics_list = [];
for (const key in res.appearance_characteristics) { for (const key in res.appearance_characteristics) {
this.tobacco_grades_info.appearance_characteristics_list.push({ label: key, value: res.appearance_characteristics[key] }) this.tobacco_grades_info.appearance_characteristics_list.push({
label: key,
value: res.appearance_characteristics[key],
});
} }
this.is_dialogVisible = true; this.is_dialogVisible = true;
}) });
}, },
//删除 //删除
deleteTobaccoGrades(item) { deleteTobaccoGrades(item) {
...@@ -268,23 +333,24 @@ export default { ...@@ -268,23 +333,24 @@ export default {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', { this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning',
}).then(() => { })
delete_tobacco_grades(id).then(res => { .then(() => {
if (res.code == 200) { delete_tobacco_grades(id).then((res) => {
this.$message.success(res.message); if (res.code == 200) {
this.init(); this.$message.success(res.message);
} this.init();
}
});
}) })
}).catch(() => { .catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消删除' message: '已取消删除',
});
}); });
});
}, },
}, },
} };
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
...@@ -236,7 +236,7 @@ export default { ...@@ -236,7 +236,7 @@ export default {
btnClick(val) { btnClick(val) {
console.log('右侧按钮'); console.log('右侧按钮');
console.log(val); console.log(val);
if (val.val == 'add') { if (val == 'add') {
this.addDepartment(null); this.addDepartment(null);
} }
}, },
......
...@@ -192,7 +192,7 @@ export default { ...@@ -192,7 +192,7 @@ export default {
btnClick(val) { btnClick(val) {
console.log('右侧按钮'); console.log('右侧按钮');
console.log(val); console.log(val);
if (val.val == 'add') this.addRoles(); if (val == 'add') this.addRoles();
}, },
init() { init() {
this.getPermissionBtnMenu(); this.getPermissionBtnMenu();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论