Commit 865c4297 by 胡悦

提交年份切换的问题

1 parent b4c9bfff
...@@ -75,19 +75,10 @@ function getBarLineOptions(obj) { ...@@ -75,19 +75,10 @@ function getBarLineOptions(obj) {
color: function(params) { color: function(params) {
const colorList = [ const colorList = [
['#22D8FF', '#5C56FF'], ['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'],
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'],
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'],
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'],
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'],
['#22D8FF', '#5C56FF'],
['#2AD190', '#00B7DF'] ['#2AD190', '#00B7DF']
] ]
var colorItem = colorList[params.dataIndex] var colorItem = []
colorItem = params.dataIndex % 2 === 0 ? colorList[0] : colorList[1]
return new echarts.graphic.LinearGradient( return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始 0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色 offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
...@@ -117,19 +108,10 @@ function getBarLineOptions(obj) { ...@@ -117,19 +108,10 @@ function getBarLineOptions(obj) {
color: function(params) { color: function(params) {
const colorList = [ const colorList = [
['#11627A', '#282F7A'], ['#11627A', '#282F7A'],
['#145F4E', '#035972'],
['#11627A', '#282F7A'],
['#145F4E', '#035972'],
['#11627A', '#282F7A'],
['#145F4E', '#035972'],
['#11627A', '#282F7A'],
['#145F4E', '#035972'],
['#11627A', '#282F7A'],
['#145F4E', '#035972'],
['#11627A', '#282F7A'],
['#145F4E', '#035972'] ['#145F4E', '#035972']
] ]
var colorItem = colorList[params.dataIndex] var colorItem = []
colorItem = params.dataIndex % 2 === 0 ? colorList[0] : colorList[1]
return new echarts.graphic.LinearGradient( return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始 0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色 offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26 * @Date: 2022-10-25 10:12:26
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-14 18:15:03 * @LastEditTime: 2023-07-17 11:47:03
* @FilePath: \dj-data-view\src\components\ViewTitle.vue * @FilePath: \dj-data-view\src\components\ViewTitle.vue
* @Description: 页面头部组件 * @Description: 页面头部组件
--> -->
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<div class="merchant-name">{{ firstTab[dataListObj.labelName] }}</div> <div class="merchant-name">{{ firstTab[dataListObj.labelName] }}</div>
<img class="arrow-down" src="@/assets/images/title-arrow.png" alt=""> <img class="arrow-down" src="@/assets/images/title-arrow.png" alt="">
</div> </div>
<SelectBox :isShow="isShow" :defaultValue="firstTab[dataListObj.valueName]" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'23.33vw'" isObject @selectVal="selectVal" :labelName="dataListObj.labelName" :valueName="dataListObj.valueName"> <SelectBox :isShow="isShow" :defaultValue="firstTab[dataListObj.valueName]" @clickOutside="clickOutside" :dataList="merchantList" :boxWidth="'23.33vw'" isObject @selectVal="selectVal" :labelName="dataListObj.labelName" :valueName="dataListObj.valueName">
<div slot="search" class="search"> <div slot="search" class="search">
<input type="text" class="search-input" v-model="search" @input="handleInput"> <input type="text" class="search-input" v-model="search" @input="handleInput">
<img class="icon-search" src="@/assets/images/icon-search.png" @click="searchMerchant" alt=""> <img class="icon-search" src="@/assets/images/icon-search.png" @click="searchMerchant" alt="">
...@@ -54,10 +54,16 @@ export default { ...@@ -54,10 +54,16 @@ export default {
default: () => {} default: () => {}
} }
}, },
watch: {
'dataList'(val) {
console.log(val)
this.merchantList = utils.deepClone(this.dataList)
}
},
data() { data() {
return { return {
isShow: false, isShow: false,
merchantList: utils.deepClone(this.dataList), merchantList: [],
firstTab: this.tabObject, // 存储第一个tab下的子菜单对象 firstTab: this.tabObject, // 存储第一个tab下的子菜单对象
now: new Date().format('yyyy-MM-dd hh:mm:ss'), now: new Date().format('yyyy-MM-dd hh:mm:ss'),
currentMenu: 'home', // 标记当前是哪个tab菜单 currentMenu: 'home', // 标记当前是哪个tab菜单
...@@ -68,6 +74,7 @@ export default { ...@@ -68,6 +74,7 @@ export default {
}, },
mounted() { mounted() {
this.timer() this.timer()
console.log(this.merchantList)
}, },
methods: { methods: {
timer() { timer() {
...@@ -85,30 +92,17 @@ export default { ...@@ -85,30 +92,17 @@ export default {
this.openSelect() this.openSelect()
this.search = '' this.search = ''
}, },
searchMerchant() { async searchMerchant() {
// this.merchantList = [ const _searchData = await this.api.solar.getMerchant({})
// { const _dataList = _searchData.data.dataList
// merchantname: '广东省深圳市宝安区XXXXXXXXX广东省深圳市宝安区XXXXXXXXX', _dataList.forEach(item => {
// merchantid: '1' item.merchantname = item.merchantName
// }, })
// { this.merchantList = _dataList
// merchantname: '广东省XXXXXXXXX服务商1',
// merchantid: '2'
// },
// {
// merchantname: '广东省XXXXXXXXX服务商2',
// merchantid: '3'
// },
// {
// merchantname: '广东省XXXXXXXXX服务商3',
// merchantid: '4'
// }
// ]
this.merchantList = []
}, },
handleInput: utils.throttle(function(e) { handleInput: utils.throttle(function(e) {
this.searchMerchant() this.searchMerchant()
}, 1000 / 60), }, 2000 / 25),
clickOutside() { clickOutside() {
this.isShow = false this.isShow = false
} }
......
...@@ -72,6 +72,11 @@ export default { ...@@ -72,6 +72,11 @@ export default {
empty: '暂无数据' empty: '暂无数据'
} }
}, },
watch: {
'dataList'(val) {
console.log(val)
}
},
mounted() { mounted() {
const { valueName, isObject, dataList, defaultValue } = this const { valueName, isObject, dataList, defaultValue } = this
console.log(defaultValue) console.log(defaultValue)
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-05 10:35:43 * @Date: 2023-07-05 10:35:43
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-17 10:56:11 * @LastEditTime: 2023-07-17 15:19:21
--> -->
<template> <template>
<div class="view-date">统计年份: <div class="view-date">统计年份:
<div class="year-plugin"> <div class="year-plugin">
<div class="year" @click.stop="switchYear"> <div class="year" @click.stop="switchYear">
{{defaultYear || $store.state.app.solarYear}} {{$store.state.app.solarYear}}
<img class="arrow-down" src="@/assets/images/arrow-down.png" alt=""> <img class="arrow-down" src="@/assets/images/arrow-down.png" alt="">
</div> </div>
<SelectBox :isShow="isShow" :defaultValue="defaultYear" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'8.61vw'" @selectVal="selectVal"></SelectBox> <SelectBox :isShow="isShow" :defaultValue="defaultYear" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'8.61vw'" @selectVal="selectVal"></SelectBox>
...@@ -43,6 +43,8 @@ export default { ...@@ -43,6 +43,8 @@ export default {
} }
}, },
mounted() { mounted() {
const { defaultYear } = this
if (defaultYear) this.setSolarYear(defaultYear)
// this.year = this.$store.state.app.solarYear // this.year = this.$store.state.app.solarYear
}, },
methods: { methods: {
......
<!--
* @Description:
* @Author: huyue
* @Date: 2023-07-07 17:34:48
* @LastEditors: huyue
* @LastEditTime: 2023-07-17 14:29:07
-->
<template> <template>
<div class="purchase-progress-box"> <div class="purchase-progress-box">
<box-title title="商城采购进度分析"></box-title> <box-title title="商城采购进度分析"></box-title>
...@@ -54,7 +61,7 @@ export default { ...@@ -54,7 +61,7 @@ export default {
}, },
// 获取商品采购进度占比 // 获取商品采购进度占比
getBugProgress() { getBugProgress() {
this.api.solar.getBugProgress({ year: 2023 }).then(res => { this.api.solar.getBugProgress({ year: this.$store.state.app.solarYear }).then(res => {
console.log(res, '000') console.log(res, '000')
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取采购进度占比失败') this.openMessage('获取采购进度占比失败')
......
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
}, },
// 获取商品采购占比 // 获取商品采购占比
getAllGoodsRatio() { getAllGoodsRatio() {
this.api.solar.getAllGoodsRatio({ year: 2023 }).then(res => { this.api.solar.getAllGoodsRatio({ year: this.$store.state.app.solarYear }).then(res => {
console.log(res, '000') console.log(res, '000')
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取商品采购占比失败') this.openMessage('获取商品采购占比失败')
......
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
}, },
// 获取各类商品采购额排名 // 获取各类商品采购额排名
getAllRanking() { getAllRanking() {
this.api.solar.getAllRanking({ year: 2023 }).then(res => { this.api.solar.getAllRanking({ year: this.$store.state.app.solarYear }).then(res => {
console.log(res, '000') console.log(res, '000')
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取商品采购额排名失败') this.openMessage('获取商品采购额排名失败')
......
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
}, },
// 获取所有门店入库 // 获取所有门店入库
getUsedWarehousing() { getUsedWarehousing() {
this.api.solar.getUsedWarehousing({ year: 2023 }).then(res => { this.api.solar.getUsedWarehousing({ year: this.$store.state.app.solarYear }).then(res => {
console.log(res, '000') console.log(res, '000')
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取所有门店入库失败') this.openMessage('获取所有门店入库失败')
......
...@@ -185,6 +185,9 @@ export default { ...@@ -185,6 +185,9 @@ export default {
businessTime: '' businessTime: ''
} }
}, },
mounted() {
this.getYears(this.$route.query.merchantid)
},
methods: { methods: {
async init() { async init() {
this.tabObject = this.$route.query this.tabObject = this.$route.query
...@@ -194,14 +197,13 @@ export default { ...@@ -194,14 +197,13 @@ export default {
const _merchantList = await this.getAllRanking(purchaseType) const _merchantList = await this.getAllRanking(purchaseType)
this.merchantList = _merchantList this.merchantList = _merchantList
console.log(this.merchantList, 'this.merchantList') console.log(this.merchantList, 'this.merchantList')
this.getMerchantGoodsRatio(year, merchantid) this.getMerchantGoodsRatio(merchantid)
this.getMerchantPurchase(year, merchantid) this.getMerchantPurchase(merchantid)
this.getMerchantPurchaseTrend(year, merchantid) this.getMerchantPurchaseTrend(merchantid)
this.getYears(merchantid)
}, },
// 获取门店的商品采购占比(商城、自采) // 获取门店的商品采购占比(商城、自采)
getMerchantGoodsRatio(year, merchantid) { getMerchantGoodsRatio(merchantid) {
this.api.solar.getMerchantGoodsRatio({ year: year, MerchantId: merchantid }).then(res => { this.api.solar.getMerchantGoodsRatio({ year: this.$store.state.app.solarYear, MerchantId: merchantid }).then(res => {
console.log(res) console.log(res)
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败') this.openMessage('获取门店商品采购占比失败')
...@@ -212,8 +214,8 @@ export default { ...@@ -212,8 +214,8 @@ export default {
}) })
}, },
// 获取每个门店的 总采购额(总计、本月) 、商城采购额(总计、本月) 、自采采购额(总计、本月) // 获取每个门店的 总采购额(总计、本月) 、商城采购额(总计、本月) 、自采采购额(总计、本月)
getMerchantPurchase(year, merchantid) { getMerchantPurchase(merchantid) {
this.api.solar.getMerchantPurchase({ year: year, MerchantId: merchantid }).then(res => { this.api.solar.getMerchantPurchase({ year: this.$store.state.app.solarYear, MerchantId: merchantid }).then(res => {
console.log(res) console.log(res)
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败') this.openMessage('获取门店商品采购占比失败')
...@@ -228,30 +230,30 @@ export default { ...@@ -228,30 +230,30 @@ export default {
}) })
}, },
// 获取每个门店的商城采购额(占比)、自采采购额(占比) 趋势 // 获取每个门店的商城采购额(占比)、自采采购额(占比) 趋势
getMerchantPurchaseTrend(year, merchantid) { getMerchantPurchaseTrend(merchantid) {
this.dataList = [] this.api.solar.getMerchantPurchaseTrend({ year: this.$store.state.app.solarYear, MerchantId: merchantid }).then(res => {
this.api.solar.getMerchantPurchaseTrend({ year: year, MerchantId: merchantid }).then(res => {
console.log(res) console.log(res)
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败') this.openMessage('获取门店商品采购占比失败')
return return
} }
const _dataList = res.data.dataList const _dataList = res.data.dataList
_dataList.forEach(item => { _dataList.forEach((item, index) => {
this.dataList.push({ this.dataList[index] = {
month: item.statDate, month: item.statDate,
data1: item.shopamount, data1: item.shopamount,
data2: item.selfamount, data2: item.selfamount,
data3: item.shopratio data3: item.shopratio
}) }
}) })
console.log(this.dataList, 'p-0-0-0-')
this.$refs.purchaseTrend.drawBarLine() this.$refs.purchaseTrend.drawBarLine()
}) })
}, },
getAllRanking(purchaseType) { getAllRanking(purchaseType) {
return new Promise(resolve => { return new Promise(resolve => {
let _merchantList let _merchantList
this.api.solar.getAllRanking({ year: 2023 }).then(res => { this.api.solar.getAllRanking({ year: this.$store.state.app.solarYear }).then(res => {
console.log(res, '000') console.log(res, '000')
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取商品采购额排名失败') this.openMessage('获取商品采购额排名失败')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!