|
@@ -18,8 +18,22 @@
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
|
|
+ <el-button type="primary" size="mini" @click="handleQuery">
|
|
|
|
+ <template #icon>
|
|
|
|
+ <el-icon><Search /></el-icon>
|
|
|
|
+ </template>
|
|
|
|
+ <template #default>
|
|
|
|
+ 搜索
|
|
|
|
+ </template>
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button size="mini" @click="resetQuery">
|
|
|
|
+ <template #icon>
|
|
|
|
+ <el-icon><RefreshRight /></el-icon>
|
|
|
|
+ </template>
|
|
|
|
+ <template #default>
|
|
|
|
+ 重置
|
|
|
|
+ </template>
|
|
|
|
+ </el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
@@ -34,25 +48,33 @@
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-button
|
|
<el-button
|
|
|
|
+ type="primary"
|
|
size="mini"
|
|
size="mini"
|
|
@click="handleUpdate(scope.row)"
|
|
@click="handleUpdate(scope.row)"
|
|
>
|
|
>
|
|
<template #icon>
|
|
<template #icon>
|
|
- <el-icon-edit/>
|
|
|
|
|
|
+ <el-icon><TrendCharts /></el-icon>
|
|
</template>
|
|
</template>
|
|
- 修改
|
|
|
|
|
|
+ 详情
|
|
</el-button>
|
|
</el-button>
|
|
<el-popconfirm
|
|
<el-popconfirm
|
|
- confirm-button-text="Yes"
|
|
|
|
- cancel-button-text="No"
|
|
|
|
|
|
+ confirm-button-text="确定"
|
|
|
|
+ cancel-button-text="取消"
|
|
:icon="InfoFilled"
|
|
:icon="InfoFilled"
|
|
icon-color="#626AEF"
|
|
icon-color="#626AEF"
|
|
- title="Are you sure to delete this?"
|
|
|
|
|
|
+ title="确定删除这个分析的图表结果吗"
|
|
@confirm="handleDelete(scope.row)"
|
|
@confirm="handleDelete(scope.row)"
|
|
@cancel="cancelEvent"
|
|
@cancel="cancelEvent"
|
|
>
|
|
>
|
|
<template #reference>
|
|
<template #reference>
|
|
- <el-button>Delete</el-button>
|
|
|
|
|
|
+ <el-button type="danger">
|
|
|
|
+ <template #icon>
|
|
|
|
+ <el-icon><Remove /></el-icon>
|
|
|
|
+ </template>
|
|
|
|
+ <template #default>
|
|
|
|
+ 删除
|
|
|
|
+ </template>
|
|
|
|
+ </el-button>
|
|
</template>
|
|
</template>
|
|
</el-popconfirm>
|
|
</el-popconfirm>
|
|
</template>
|
|
</template>
|
|
@@ -70,21 +92,45 @@
|
|
@current-change="getList"
|
|
@current-change="getList"
|
|
/>
|
|
/>
|
|
|
|
|
|
- <!-- 添加或修改图表管理对话框 -->
|
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
- </el-form>
|
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <!-- 显示图表和结论详情的对话框 -->
|
|
|
|
+ <el-dialog v-model="open" width="60%" center append-to-body>
|
|
|
|
+ <template #header>数据分析详情</template>
|
|
|
|
+ <template #default>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-card>
|
|
|
|
+ <template #header>数据图表</template>
|
|
|
|
+ <template #default>
|
|
|
|
+ <div ref="chart" style="height:50vh"/>
|
|
|
|
+ </template>
|
|
|
|
+ </el-card>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-card>
|
|
|
|
+ <template #header>分析结论</template>
|
|
|
|
+ <template #default>
|
|
|
|
+ <div style="height:50vh">
|
|
|
|
+ <el-text type="primary" size="large" style="margin-top: 20px">
|
|
|
|
+ {{analysisConclusion}}
|
|
|
|
+ </el-text>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-card>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ </template>
|
|
|
|
+ <template #footer class="dialog-footer">
|
|
|
|
+
|
|
|
|
+ </template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { listChart, getChart, delChart, addChart, updateChart } from "@/common/api/chart";
|
|
|
|
|
|
+import { listChart, delChart } from "@/common/api/chart";
|
|
import {ElMessage} from "element-plus";
|
|
import {ElMessage} from "element-plus";
|
|
|
|
+import * as echarts from 'echarts';
|
|
|
|
+
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "Chart",
|
|
name: "Chart",
|
|
@@ -104,24 +150,49 @@ export default {
|
|
total: 0,
|
|
total: 0,
|
|
// 图表管理表格数据
|
|
// 图表管理表格数据
|
|
chartList: [],
|
|
chartList: [],
|
|
- // 弹出层标题
|
|
|
|
- title: "",
|
|
|
|
// 是否显示弹出层
|
|
// 是否显示弹出层
|
|
open: false,
|
|
open: false,
|
|
// 查询参数
|
|
// 查询参数
|
|
queryParams: {
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
- pageSize: 5,
|
|
|
|
|
|
+ pageSize: 10,
|
|
name: null,
|
|
name: null,
|
|
analysisTarget: null,
|
|
analysisTarget: null,
|
|
chartType: null,
|
|
chartType: null,
|
|
userId: null,
|
|
userId: null,
|
|
},
|
|
},
|
|
- // 表单参数
|
|
|
|
- form: {},
|
|
|
|
- // 表单校验
|
|
|
|
- rules: {
|
|
|
|
- }
|
|
|
|
|
|
+ //图表的配置对象
|
|
|
|
+ option:{
|
|
|
|
+ xAxis: {
|
|
|
|
+ type: 'category',
|
|
|
|
+ data: ['2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19'],
|
|
|
|
+ boundaryGap: true,
|
|
|
|
+ axisLabel:{
|
|
|
|
+ interval:0,
|
|
|
|
+ rotate : 50
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ yAxis: {
|
|
|
|
+ type: 'value'
|
|
|
|
+ },
|
|
|
|
+ series: [{
|
|
|
|
+ name:'增长人数',
|
|
|
|
+ type:'line',
|
|
|
|
+ data:[34.0, 34.0, 3.0, 3.0, 43.0, 34.0, 43.0, 34.0, 34.0, 12.0, 12.0, 12.0, 12.0, 32.0, 12.0, 32.0, 32.0, 32.0, 32.0],
|
|
|
|
+ markPoint: {
|
|
|
|
+ data: [
|
|
|
|
+ {type: 'max', name: '最大值'},
|
|
|
|
+ {type: 'min', name: '最小值'}
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ markLine: {data: [
|
|
|
|
+ {type: 'average', name: '平均值'}
|
|
|
|
+ ]},
|
|
|
|
+ smooth: true
|
|
|
|
+ }]
|
|
|
|
+ },
|
|
|
|
+ analysisConclusion:'',
|
|
|
|
+ chart:undefined
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -134,7 +205,6 @@ export default {
|
|
listChart(this.queryParams).then(response => {
|
|
listChart(this.queryParams).then(response => {
|
|
this.chartList = response.data.records;
|
|
this.chartList = response.data.records;
|
|
this.total = response.data.total;
|
|
this.total = response.data.total;
|
|
- console.log(this.total)
|
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -176,41 +246,20 @@ export default {
|
|
this.single = selection.length!==1
|
|
this.single = selection.length!==1
|
|
this.multiple = !selection.length
|
|
this.multiple = !selection.length
|
|
},
|
|
},
|
|
- /** 新增按钮操作 */
|
|
|
|
- handleAdd() {
|
|
|
|
- this.reset();
|
|
|
|
- this.open = true;
|
|
|
|
- this.title = "添加图表管理";
|
|
|
|
- },
|
|
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
this.reset();
|
|
this.reset();
|
|
- const id = row.id || this.ids
|
|
|
|
- getChart(id).then(response => {
|
|
|
|
- this.form = response.data;
|
|
|
|
- this.open = true;
|
|
|
|
- this.title = "修改图表管理";
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- /** 提交按钮 */
|
|
|
|
- submitForm() {
|
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
|
- if (valid) {
|
|
|
|
- if (this.form.id != null) {
|
|
|
|
- updateChart(this.form).then(response => {
|
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
|
- this.open = false;
|
|
|
|
- this.getList();
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- addChart(this.form).then(response => {
|
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
|
- this.open = false;
|
|
|
|
- this.getList();
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ this.analysisConclusion = row.analysisConclusion;
|
|
|
|
+ let generatedChartData = row.generatedChartData;
|
|
|
|
+ let optionJson = eval("(" +generatedChartData+ ")");
|
|
|
|
+ //返回格式不稳定,有可能会多封装一层option,需要判断一下
|
|
|
|
+ if (optionJson.option === undefined || optionJson.option === null){
|
|
|
|
+ this.option = optionJson;
|
|
|
|
+ }else{
|
|
|
|
+ this.option = optionJson.option;
|
|
|
|
+ }
|
|
|
|
+ this.open = true;
|
|
|
|
+ this.refreshChart();
|
|
},
|
|
},
|
|
/** 删除按钮操作 */
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
handleDelete(row) {
|
|
@@ -241,6 +290,18 @@ export default {
|
|
// this.$modal.msgSuccess("删除成功");
|
|
// this.$modal.msgSuccess("删除成功");
|
|
// }).catch(() => {});
|
|
// }).catch(() => {});
|
|
},
|
|
},
|
|
|
|
+ //更新图表
|
|
|
|
+ refreshChart(){
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
+ if (this.chart === undefined){
|
|
|
|
+ this.chart = echarts.init(this.$refs.chart);
|
|
|
|
+ }
|
|
|
|
+ this.chart.clear();
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
+ this.chart.setOption(this.option);
|
|
|
|
+ },500)
|
|
|
|
+ },500);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|