|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="editor-page" id="box">
|
|
|
+ <div class="crossVariety-edit-page" id="box">
|
|
|
<span
|
|
|
class="slide-icon slide-right"
|
|
|
@click="isSlideLeft = !isSlideLeft"
|
|
@@ -29,11 +29,11 @@
|
|
|
<div class="list" v-if="varietyOptions.length">
|
|
|
<el-tag
|
|
|
size="small"
|
|
|
- class="tag"
|
|
|
+ :class="['tag',{'act':checkedVarietys.includes(item.ChartVarietyId)}]"
|
|
|
v-for="item in varietyOptions"
|
|
|
- :key="item.label"
|
|
|
+ :key="item.ChartVarietyId"
|
|
|
@click="checkVarietyHandle(item)"
|
|
|
- >{{item.label}}</el-tag>
|
|
|
+ >{{item.ChartVarietyName}}</el-tag>
|
|
|
</div>
|
|
|
|
|
|
<tableNoData v-else text="暂无品种" size="mini"/>
|
|
@@ -51,9 +51,9 @@
|
|
|
size="small"
|
|
|
class="tag"
|
|
|
v-for="item in tagOptions"
|
|
|
- :key="item.label"
|
|
|
+ :key="item.ChartTagId"
|
|
|
@click="setTagRelationOpen(item)"
|
|
|
- >{{item.label}}</el-tag>
|
|
|
+ >{{item.ChartTagName}}</el-tag>
|
|
|
</div>
|
|
|
|
|
|
<tableNoData text="暂无标签" size="mini" v-else/>
|
|
@@ -78,7 +78,7 @@
|
|
|
<div
|
|
|
class="chart-min-cont"
|
|
|
>
|
|
|
- <div class="chart-wrapper">
|
|
|
+ <div class="chart-wrapper" v-if="options.series&&options.series.length">
|
|
|
<div class="chart-show-cont" v-if="!chartInfo.WarnMsg">
|
|
|
<div style="position:relative;">
|
|
|
<h2 class="chart-title">{{ chartInfo.ChartName }}</h2>
|
|
@@ -97,6 +97,8 @@
|
|
|
style="width: 60px; display: block"
|
|
|
size="mini"
|
|
|
type="number"
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
placeholder="上限"
|
|
|
v-model="chartLimit.max"
|
|
|
@change="changeLimit"
|
|
@@ -105,6 +107,8 @@
|
|
|
class="min-data-input"
|
|
|
size="mini"
|
|
|
type="number"
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
placeholder="下限"
|
|
|
v-model="chartLimit.min"
|
|
|
@change="changeLimit"
|
|
@@ -116,6 +120,8 @@
|
|
|
class="left"
|
|
|
size="mini"
|
|
|
type="number"
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
placeholder="下限"
|
|
|
v-model="chartLimit.x_min"
|
|
|
@change="changeLimit"
|
|
@@ -124,6 +130,8 @@
|
|
|
class="left"
|
|
|
size="mini"
|
|
|
type="number"
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
placeholder="上限"
|
|
|
v-model="chartLimit.x_max"
|
|
|
@change="changeLimit"
|
|
@@ -138,15 +146,18 @@
|
|
|
<p class="error-tip" style="min-height: 400px;" v-if="chartInfo.WarnMsg">{{chartInfo.WarnMsg}}</p>
|
|
|
</div>
|
|
|
|
|
|
+ <div class="nodata" v-else>
|
|
|
+ <tableNoData text="暂无信息"/>
|
|
|
+ </div>
|
|
|
+
|
|
|
<!-- 图表相关配置 -->
|
|
|
<chartFormSection
|
|
|
:tagList="tagOptions"
|
|
|
+ :chartInfo="chartInfo"
|
|
|
+ ref="chartFormRef"
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
- <!-- <div class="nodata" v-else>
|
|
|
- <tableNoData text="暂无信息"/>
|
|
|
- </div> -->
|
|
|
</div>
|
|
|
|
|
|
<!-- 管理弹窗 -->
|
|
@@ -159,6 +170,8 @@
|
|
|
<!-- 标签指标配置 -->
|
|
|
<tagRelationDialog
|
|
|
:isShow.sync="isShowTagRelationDia"
|
|
|
+ :varietyList="varietyOptions"
|
|
|
+ :info="tagRelationInfo"
|
|
|
/>
|
|
|
|
|
|
<!-- 操作说明 -->
|
|
@@ -172,6 +185,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { crossVarietyInterface } from '@/api/modules/chartRelevanceApi';
|
|
|
+import { dataBaseInterface } from '@/api/api';
|
|
|
import { chartSetMixin } from '@/views/dataEntry_manage/mixins/chartPublic';
|
|
|
import Chart from '@/views/dataEntry_manage/components/chart';
|
|
|
import ExplainDialog from '../components/explainDialog.vue';
|
|
@@ -219,21 +233,31 @@ export default {
|
|
|
isSlideLeft: false,
|
|
|
chartInfo: {
|
|
|
ChartName:'图表标题',
|
|
|
+ Source: 10,
|
|
|
+ CalculateValue: '',
|
|
|
+ CalculateUnit: '天',
|
|
|
+ TagX: '',
|
|
|
+ TagY: '',
|
|
|
+ DateConfigList: [
|
|
|
+ { DateType: 1,Num: 0 },
|
|
|
+ ],
|
|
|
SysUserRealName: '还真'
|
|
|
},
|
|
|
|
|
|
showExplain: false,
|
|
|
|
|
|
- checkedVariety: [], //选中的品种
|
|
|
+ checkedVarietys: [], //选中的品种
|
|
|
varietyOptions: [],
|
|
|
-
|
|
|
tagOptions: [],
|
|
|
|
|
|
isShowSetDia: false,//管理弹窗
|
|
|
dialogType: '',
|
|
|
|
|
|
isShowTagRelationDia: false,//标签指标管理弹窗
|
|
|
- tagRelation: ''
|
|
|
+ tagRelationInfo: {
|
|
|
+ tagName:'',
|
|
|
+ id: 0
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -243,21 +267,66 @@ export default {
|
|
|
|
|
|
},
|
|
|
|
|
|
+ checkParmas(type='') {
|
|
|
+ if(!this.checkedVarietys.length || !this.$refs.chartFormRef.form.CalculateValue || !this.$refs.chartFormRef.form.TagX ||!this.$refs.chartFormRef.form.TagY||!this.$refs.chartFormRef.form.DateConfigList.length){
|
|
|
+ type && this.$message.warning(message)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+
|
|
|
/* 获取标签列表 */
|
|
|
async getTagList() {
|
|
|
- // let res = await crossVarietyInterface.getTagListApi()
|
|
|
+ let res = await crossVarietyInterface.getTagList()
|
|
|
+
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+ this.tagOptions = res.Data.List || []
|
|
|
},
|
|
|
|
|
|
async getVarietyList() {
|
|
|
- // let res = await crossVarietyInterface.getVarietyListApi()
|
|
|
+ let res = await crossVarietyInterface.getVarietyList()
|
|
|
+
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+ this.varietyOptions = res.Data.List || []
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 预览数据 */
|
|
|
+ async getChartPreviewData() {
|
|
|
+ if(!this.checkParmas()) return;
|
|
|
+
|
|
|
+ let params = {
|
|
|
+ VarietyList: this.checkedVarietys,
|
|
|
+ ...this.$refs.chartFormRef.form
|
|
|
+ }
|
|
|
+ let res = await crossVarietyInterface.chartPreview(params)
|
|
|
+
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+
|
|
|
+ this.chartLimit = {
|
|
|
+ min: Number(res.Data.YMinValue),
|
|
|
+ max: Number(res.Data.YMaxValue),
|
|
|
+ x_min: Number(res.Data.XMinValue),
|
|
|
+ x_max: Number(res.Data.XMaxValue)
|
|
|
+ }
|
|
|
+ this.crossVarietyChartData = res.Data;
|
|
|
+ this.setCrossVarietyChart()
|
|
|
},
|
|
|
|
|
|
/* 选择品种 */
|
|
|
checkVarietyHandle(item) {
|
|
|
+ this.checkedVarietys.includes(item.ChartVarietyId)
|
|
|
+ ? this.checkedVarietys.splice(this.checkedVarietys.indexOf(item.ChartVarietyId),1)
|
|
|
+ : this.checkedVarietys.push(item.ChartVarietyId)
|
|
|
+
|
|
|
+ this.getChartPreviewData();
|
|
|
},
|
|
|
|
|
|
/* 打开标签关联弹窗 */
|
|
|
setTagRelationOpen(item) {
|
|
|
+ this.tagRelationInfo = {
|
|
|
+ tagName: item.ChartTagName,
|
|
|
+ id: item.ChartTagId
|
|
|
+ }
|
|
|
this.isShowTagRelationDia = true;
|
|
|
},
|
|
|
|
|
@@ -268,7 +337,51 @@ export default {
|
|
|
},
|
|
|
|
|
|
/* 保存图表 */
|
|
|
- saveChartHandle() {
|
|
|
+ async saveChartHandle() {
|
|
|
+ let { min,max,x_min,x_max } = this.chartLimit;
|
|
|
+ let params = {
|
|
|
+ VarietyList: this.checkedVarietys,
|
|
|
+ ...this.$refs.chartFormRef.form,
|
|
|
+ XMinValue: String(x_min),
|
|
|
+ XMaxValue: String(x_max),
|
|
|
+ YMinValue: String(min),
|
|
|
+ YMaxValue: String(max),
|
|
|
+ }
|
|
|
+ let res = this.chart_code
|
|
|
+ ? await crossVarietyInterface.chartEdit({...params,ChartInfoId: this.chartInfo.ChartInfoId})
|
|
|
+ : await crossVarietyInterface.chartAdd(params)
|
|
|
+
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+ this.setChartImage(res.Data);
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 设置图表封面图片 */
|
|
|
+ setChartImage(data) {
|
|
|
+ let svg = this.$refs.chartRef.chart.getSVG({
|
|
|
+ chart: {
|
|
|
+ width: 340,
|
|
|
+ height: 230,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let form = new FormData();
|
|
|
+ form.append('Img', svg);
|
|
|
+ this.setImageHandle(form,data);
|
|
|
+ },
|
|
|
+ async setImageHandle(form,{ UniqueCode,ChartInfoId }) {
|
|
|
+ let { Data } = await dataBaseInterface.uploadImgSvg(form);
|
|
|
+ await dataBaseInterface.setChartImage({
|
|
|
+ ChartInfoId: ChartInfoId,
|
|
|
+ ImageUrl: Data.ResourceUrl,
|
|
|
+ });
|
|
|
+
|
|
|
+ this.$message.success('保存成功');
|
|
|
+ this.$router.replace({
|
|
|
+ path: '/crossVarietyChartList',
|
|
|
+ query: {
|
|
|
+ code: UniqueCode,
|
|
|
+ id: ChartInfoId
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
|
|
@@ -281,6 +394,8 @@ export default {
|
|
|
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.getVarietyList();
|
|
|
+ this.getTagList();
|
|
|
this.getChartDetail();
|
|
|
window.addEventListener('resize', this.reloadRightWid);
|
|
|
},
|
|
@@ -298,7 +413,7 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-.editor-page {
|
|
|
+.crossVariety-edit-page {
|
|
|
$font-small: 12px;
|
|
|
$font-normal: 14px;
|
|
|
display: flex;
|
|
@@ -365,7 +480,7 @@ export default {
|
|
|
flex-wrap: wrap;
|
|
|
max-height: 200px;
|
|
|
overflow-y: auto;
|
|
|
- gap: 8px;
|
|
|
+ gap: 10px;
|
|
|
.tag {
|
|
|
color: #333;
|
|
|
background: #fff;
|
|
@@ -410,12 +525,12 @@ export default {
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
.chart-wrapper {
|
|
|
- padding: 20px;
|
|
|
+ padding: 30px 0;
|
|
|
width: 100%;
|
|
|
/* =================== */
|
|
|
.chart-show-cont {
|
|
|
min-height: 400px;
|
|
|
- padding: 0 0 50px 100px;
|
|
|
+ padding: 0 100px 50px;
|
|
|
position: relative;
|
|
|
.chart-title {
|
|
|
font-size: 16px;
|
|
@@ -427,8 +542,8 @@ export default {
|
|
|
font-size: 14px;
|
|
|
color: #333;
|
|
|
position: absolute;
|
|
|
- bottom: 20px;
|
|
|
- right: 50px;
|
|
|
+ bottom: -50px;
|
|
|
+ right: -70px;
|
|
|
}
|
|
|
.range-cont {
|
|
|
position: absolute;
|
|
@@ -438,7 +553,7 @@ export default {
|
|
|
display: block;
|
|
|
}
|
|
|
&.left {
|
|
|
- left: -80px;
|
|
|
+ left: -70px;
|
|
|
}
|
|
|
&.bottom {
|
|
|
width: 100%;
|
|
@@ -446,7 +561,7 @@ export default {
|
|
|
justify-content: space-between;
|
|
|
top: auto;
|
|
|
right: 0;
|
|
|
- bottom: -5%;
|
|
|
+ bottom: -4%;
|
|
|
.left {
|
|
|
width: 60px;
|
|
|
display: block;
|
|
@@ -464,24 +579,31 @@ export default {
|
|
|
|
|
|
@media screen and (min-width: 1711px) {
|
|
|
.min-data-input {
|
|
|
- margin-top: 360px;
|
|
|
+ margin-top: 290px;
|
|
|
}
|
|
|
}
|
|
|
@media screen and (max-width: 1710px) {
|
|
|
.min-data-input {
|
|
|
- margin-top: 290px;
|
|
|
+ margin-top: 250px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
.nodata {
|
|
|
- height: calc(100vh - 120px);
|
|
|
background-color: #fff;
|
|
|
text-align: center;
|
|
|
font-size: 16px;
|
|
|
color: #666;
|
|
|
+ width: 100%;
|
|
|
padding: 100px 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
+<style lang="scss">
|
|
|
+.crossVariety-edit-page {
|
|
|
+ .el-input--mini .el-input__inner {
|
|
|
+ padding: 0 0 0 4px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|