|
@@ -17,19 +17,19 @@
|
|
<el-select v-model="queryParams.area" @change="changeEcharts()" clearable placeholder="请选择地区">
|
|
<el-select v-model="queryParams.area" @change="changeEcharts()" clearable placeholder="请选择地区">
|
|
<el-option
|
|
<el-option
|
|
v-for="item in areaList"
|
|
v-for="item in areaList"
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value">
|
|
|
|
|
|
+ :key="item"
|
|
|
|
+ :label="item"
|
|
|
|
+ :value="item">
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="公司" v-if="type == 1">
|
|
|
|
|
|
+ <el-form-item label="公司" v-if="type == 3">
|
|
<el-select v-model="queryParams.companyName" @change="changeEcharts()" clearable placeholder="请选择公司">
|
|
<el-select v-model="queryParams.companyName" @change="changeEcharts()" clearable placeholder="请选择公司">
|
|
<el-option
|
|
<el-option
|
|
v-for="item in companyList"
|
|
v-for="item in companyList"
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value">
|
|
|
|
|
|
+ :key="item"
|
|
|
|
+ :label="item"
|
|
|
|
+ :value="item">
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -52,9 +52,8 @@
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
- <component v-if="type == 1" :is="component" :ref="components" :domId="components" :NewForm="form" @form="getForm"></component>
|
|
|
|
|
|
+ <component v-if="type == 3" :is="component" :ref="components" :domId="components" :NewForm="form" @form="getForm"></component>
|
|
<component :is='component' :ref="component" :NewForm="form" @form="getForm"></component>
|
|
<component :is='component' :ref="component" :NewForm="form" @form="getForm"></component>
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
<el-drawer
|
|
<el-drawer
|
|
title="图表配置"
|
|
title="图表配置"
|
|
@@ -95,7 +94,7 @@ export default {
|
|
label:{
|
|
label:{
|
|
x:'marketDate',
|
|
x:'marketDate',
|
|
xStr:'时间',
|
|
xStr:'时间',
|
|
- y:'saleTotalMoney',
|
|
|
|
|
|
+ y:'saleMoneyTotal',
|
|
yStr:'销售额'
|
|
yStr:'销售额'
|
|
},
|
|
},
|
|
value:1
|
|
value:1
|
|
@@ -113,14 +112,17 @@ export default {
|
|
timeList:[
|
|
timeList:[
|
|
{
|
|
{
|
|
value:0,
|
|
value:0,
|
|
|
|
+ groupValue:'groupMonthTime',
|
|
label:'月'
|
|
label:'月'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
value:1,
|
|
value:1,
|
|
|
|
+ groupValue:'groupSeasonTime',
|
|
label:'季度'
|
|
label:'季度'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
value:2,
|
|
value:2,
|
|
|
|
+ groupValue:'groupYearTime',
|
|
label:'年'
|
|
label:'年'
|
|
},
|
|
},
|
|
],
|
|
],
|
|
@@ -156,15 +158,15 @@ export default {
|
|
return i.value == this.queryParams.relation
|
|
return i.value == this.queryParams.relation
|
|
})
|
|
})
|
|
var name = this.name + (this.type==3?'产品类别':'产品') + '趋势图'
|
|
var name = this.name + (this.type==3?'产品类别':'产品') + '趋势图'
|
|
- if(this.type==1){
|
|
|
|
|
|
+ if(this.type==3){
|
|
this.$refs[this.components].open(this.chartData.filter(item=>{
|
|
this.$refs[this.components].open(this.chartData.filter(item=>{
|
|
- return item.productId==0
|
|
|
|
|
|
+ return !item.productId
|
|
}),'趋势总图',relation.label,this.queryParams.timeUnit)
|
|
}),'趋势总图',relation.label,this.queryParams.timeUnit)
|
|
this.$refs[this.component].open(this.chartData.filter(item=>{
|
|
this.$refs[this.component].open(this.chartData.filter(item=>{
|
|
return item.productId!=0
|
|
return item.productId!=0
|
|
}),name,relation.label,this.queryParams.timeUnit)
|
|
}),name,relation.label,this.queryParams.timeUnit)
|
|
}else{
|
|
}else{
|
|
- this.$refs[this.component].open([this.chartData],name,relation.label,this.queryParams.timeUnit)
|
|
|
|
|
|
+ this.$refs[this.component].open(this.chartData,name,relation.label,this.queryParams.timeUnit)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async changeEcharts(){
|
|
async changeEcharts(){
|
|
@@ -175,57 +177,51 @@ export default {
|
|
|
|
|
|
},
|
|
},
|
|
async init(){
|
|
async init(){
|
|
- const [chartData,areaList] = await Promise.allSettled([this.getData(),this.getAreaList()])
|
|
|
|
|
|
+ const [chartData,companyAndArea] = await Promise.allSettled([this.getData(),this.getAllCompanyAndArea()])
|
|
this.chartData = chartData.status =='fulfilled'?chartData.value:[]
|
|
this.chartData = chartData.status =='fulfilled'?chartData.value:[]
|
|
- this.areaList= areaList.status =='fulfilled'?areaList.value.map(item=>{
|
|
|
|
- return {
|
|
|
|
- value:item,
|
|
|
|
- label:item
|
|
|
|
- }
|
|
|
|
- }):[]
|
|
|
|
- if(this.type == 3){
|
|
|
|
- this.getCompanyList()
|
|
|
|
- }
|
|
|
|
|
|
+ this.areaList= companyAndArea.status =='fulfilled'?companyAndArea.value.saleAreas:[]
|
|
|
|
+ this.companyList= companyAndArea.status =='fulfilled'?companyAndArea.value.companyNames:[]
|
|
this.changeRelation()
|
|
this.changeRelation()
|
|
|
|
|
|
|
|
|
|
},
|
|
},
|
|
async getData(){
|
|
async getData(){
|
|
- if(this.type == 3){
|
|
|
|
- this.queryParams.categoryId = this.id
|
|
|
|
- this.queryParams.categoryArea = this.queryParams.area
|
|
|
|
- return await this.$api.showTrend(this.queryParams)
|
|
|
|
- .then( async response=>await response.data)
|
|
|
|
- }else if(this.type == 2){
|
|
|
|
- this.queryParams.productId = this.id
|
|
|
|
- this.queryParams.saleArea = this.queryParams.area
|
|
|
|
- return await this.$api.ProductShowTrend(this.queryParams).then( async response=>await response.data)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ var params= {
|
|
|
|
+ saleArea:this.queryParams.area,
|
|
|
|
+ companyName:this.queryParams.companyName,
|
|
|
|
+ }
|
|
|
|
+ if(this.type == 3){
|
|
|
|
+ params.categoryId = this.id
|
|
|
|
+ }else{
|
|
|
|
+ params.productId = this.id
|
|
|
|
+ }
|
|
|
|
+ var queryParams = {
|
|
|
|
+ size:99999,
|
|
|
|
+ current:1,
|
|
|
|
+ searchQuery:this.$commonJS.objectToString(params),
|
|
|
|
+ groupBy:this.timeList.find(item=>{
|
|
|
|
+ return item.value == this.queryParams.timeUnit
|
|
|
|
+ }).groupValue,
|
|
|
|
+ orderDTOList:[
|
|
|
|
+ {
|
|
|
|
+ "orderBy": "saleTime",
|
|
|
|
+ "orderType": 0
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ return await this.$api.groupProductMarketData(queryParams).then( async response=>await response.data.data.values)
|
|
},
|
|
},
|
|
- getAreaList(){
|
|
|
|
|
|
+ //获取所有公司和地区
|
|
|
|
+ getAllCompanyAndArea(){
|
|
var params = {}
|
|
var params = {}
|
|
- if(this.type == 1){
|
|
|
|
|
|
+ if(this.type == 3){
|
|
params.categoryId = this.id
|
|
params.categoryId = this.id
|
|
}else{
|
|
}else{
|
|
params.productId = this.id
|
|
params.productId = this.id
|
|
}
|
|
}
|
|
- return this.$api.getAreaList(params).then(response=> response.data)
|
|
|
|
|
|
+ return this.$api.getAllCompanyAndArea(params).then(response=> response.data)
|
|
},
|
|
},
|
|
- getCompanyList(){
|
|
|
|
- this.$api.getCompanyList({id:this.id}).then(response=>{
|
|
|
|
- if(response.code == 200){
|
|
|
|
- this.companyList=response.data?response.data.map(item=>{
|
|
|
|
- return {
|
|
|
|
- value:item,
|
|
|
|
- label:item
|
|
|
|
- }
|
|
|
|
- }):[]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|