|
@@ -55,10 +55,10 @@
|
|
|
</div>
|
|
|
<div class="cost-content">
|
|
|
<div class="cost-left">
|
|
|
- <cost-pie></cost-pie>
|
|
|
+ <cost-pie :data="costPieData"></cost-pie>
|
|
|
</div>
|
|
|
<div class="cost-right">
|
|
|
- <cost-histogram></cost-histogram>
|
|
|
+ <cost-histogram :data="costHisData"></cost-histogram>
|
|
|
</div>
|
|
|
</div>
|
|
|
<h3 class="label">成本分析</h3>
|
|
@@ -95,7 +95,17 @@
|
|
|
<!-- 销售情况 -->
|
|
|
<div class="sales">
|
|
|
<div class="sales-condition">
|
|
|
- <x-form :formItems="salesFormItems" :day="salesDay" @setDay="salesSetDay" @onClickType="salesOnClickType"></x-form>
|
|
|
+ <!-- <x-form :formItems="salesFormItems" :day="salesDay" @setDay="salesSetDay" @onClickType="salesOnClickType"></x-form> -->
|
|
|
+ <el-date-picker
|
|
|
+ v-model="getSalesDates"
|
|
|
+ type="datetimerange"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ align="right"
|
|
|
+ size="small">
|
|
|
+ </el-date-picker>
|
|
|
</div>
|
|
|
<div class="sales-content">
|
|
|
<div class="sales-left">
|
|
@@ -123,7 +133,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="sales-right">
|
|
|
- <sales-chart></sales-chart>
|
|
|
+ <sales-chart :data="salesChartData"></sales-chart>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -179,16 +189,16 @@ import ProductionItems from './analysis/ProductionItems.vue'
|
|
|
import CostPie from './analysis/CostPie.vue'
|
|
|
import CostHistogram from './analysis/CostHistogram.vue'
|
|
|
import ImportantLine from './analysis/ImportantLine.vue'
|
|
|
-import XForm from "components/XForm";
|
|
|
+// import XForm from "components/XForm";
|
|
|
import SalesChart from './analysis/SalesChart.vue'
|
|
|
import TableFooter from "../../components/TableFooter"
|
|
|
|
|
|
import { tableItems, tableShows } from './analysis/table.config'
|
|
|
import { yingshouTableItems, yingshouTableShows } from './analysis/yingshouTable.config'
|
|
|
import { safetyTableItems, safetyTableShows } from './analysis/safetyTable.config'
|
|
|
-import { formItems } from './analysis/salesXForm.config'
|
|
|
+// import { formItems } from './analysis/salesXForm.config'
|
|
|
|
|
|
-import { getInventoryLines, getInventoryAndProduct } from 'utils/api'
|
|
|
+import { getInventoryLines, getInventoryAndProduct, getSalesChange, getSalesChart, getCosts, getYingShou, getYingFu } from 'utils/api'
|
|
|
|
|
|
export default {
|
|
|
name: "Analysis",
|
|
@@ -204,7 +214,7 @@ export default {
|
|
|
CostPie,
|
|
|
CostHistogram,
|
|
|
ImportantLine,
|
|
|
- XForm,
|
|
|
+ // XForm,
|
|
|
SalesChart,
|
|
|
TableFooter
|
|
|
},
|
|
@@ -259,17 +269,48 @@ export default {
|
|
|
// 经营分析
|
|
|
costOptions: [],
|
|
|
costValue: '',
|
|
|
+ costPieData: [], // 经营分析 - 成本分析环形图
|
|
|
+ costHisData: [], // 经营分析 - 柱状图
|
|
|
// 重要指标
|
|
|
importantOptions: [],
|
|
|
importantValue: '',
|
|
|
importantDates: [],
|
|
|
// 销售额
|
|
|
- salesFormItems: [],
|
|
|
+ // salesFormItems: [],
|
|
|
salesDay: 2, //默认选择本周
|
|
|
weekSales: 1545252,
|
|
|
weekSalesChange: 10,
|
|
|
weekSalesVolume: 1000,
|
|
|
weekSalesVolumeChange: -10,
|
|
|
+ getSalesDates: [], // 销售图的时间选择
|
|
|
+ pickerOptions: { // 快捷选项
|
|
|
+ shortcuts: [{
|
|
|
+ text: '最近一周',
|
|
|
+ onClick(picker) {
|
|
|
+ const end = new Date();
|
|
|
+ const start = new Date();
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
|
|
+ picker.$emit('pick', [start, end]);
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ text: '最近一个月',
|
|
|
+ onClick(picker) {
|
|
|
+ const end = new Date();
|
|
|
+ const start = new Date();
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
|
|
+ picker.$emit('pick', [start, end]);
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ text: '最近三个月',
|
|
|
+ onClick(picker) {
|
|
|
+ const end = new Date();
|
|
|
+ const start = new Date();
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
|
|
+ picker.$emit('pick', [start, end]);
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ salesChartData: {}, // 销售图的数据
|
|
|
// 应收排名
|
|
|
yingshouTableItems: [],
|
|
|
yingshouTableShows: {},
|
|
@@ -286,7 +327,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.salesFormItems = formItems
|
|
|
+ // this.salesFormItems = formItems
|
|
|
this.tableItems = tableItems
|
|
|
this.tableShows = tableShows
|
|
|
this.yingshouTableItems = yingshouTableItems
|
|
@@ -296,6 +337,11 @@ export default {
|
|
|
/** 获取网络请求数据 */
|
|
|
this.initInventoryLines()
|
|
|
this.initInventoryAndProduct()
|
|
|
+ this.initSalesChange()
|
|
|
+ this.initSalesChart()
|
|
|
+ this.initCosts()
|
|
|
+ this.initYingShou()
|
|
|
+ this.initYingFu()
|
|
|
},
|
|
|
methods: {
|
|
|
handleWorkInfoClick(item) {
|
|
@@ -323,6 +369,7 @@ export default {
|
|
|
// 销售额选中日期
|
|
|
salesSetDay(data) {
|
|
|
this.salesDay = data;
|
|
|
+ console.log(this.salesDay)
|
|
|
},
|
|
|
// 销售额选中日周月
|
|
|
salesOnClickType(data) {
|
|
@@ -366,8 +413,79 @@ export default {
|
|
|
// }
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ // 经营分析 - 销售改变
|
|
|
+ initSalesChange() {
|
|
|
+ getSalesChange({}).then(res => {
|
|
|
+ if (res.code === 10000) {
|
|
|
+ this.weekSales = res.data.quantityAll
|
|
|
+ this.weekSalesChange = res.data.quantityType? res.data.quantityPercentage: -res.data.quantityPercentage
|
|
|
+ this.weekSalesVolume = res.data.saleAll
|
|
|
+ this.weekSalesVolumeChange = res.data.saleType? res.data.salePercentage: -res.data.salePercentage
|
|
|
+ } else {
|
|
|
+ this.weekSales = 0
|
|
|
+ this.weekSalesChange = 0
|
|
|
+ this.weekSalesVolume = 0
|
|
|
+ this.weekSalesVolumeChange = 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 经营分析 - 销售情况图
|
|
|
+ initSalesChart() {
|
|
|
+ const params = {
|
|
|
+ beginDate: this.getSalesDates[0] || '',
|
|
|
+ endDate: this.getSalesDates[1] || ''
|
|
|
+ }
|
|
|
+ console.log('我要放参数了', params)
|
|
|
+ getSalesChart(params).then(res => {
|
|
|
+ if (res.code === 10000) {
|
|
|
+ this.salesChartData = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 经营分析 - 成本分析
|
|
|
+ initCosts() {
|
|
|
+ getCosts({}).then(res => {
|
|
|
+ if (res.code === 10000) {
|
|
|
+ this.costPieData = []
|
|
|
+ res.data.forEach(item => {
|
|
|
+ this.costPieData.push({
|
|
|
+ name: item.costName,
|
|
|
+ value: item.costRate
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.costHisData = []
|
|
|
+ res.data.forEach(item => {
|
|
|
+ this.costHisData.push(item.costVal)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 应收排名
|
|
|
+ initYingShou() {
|
|
|
+ getYingShou({}).then(res => {
|
|
|
+ console.log('应收', res)
|
|
|
+ if (res.code === 10000) {
|
|
|
+ this.yingshouTableData = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 应付排名
|
|
|
+ initYingFu() {
|
|
|
+ getYingFu({}).then(res => {
|
|
|
+ console.log('应付', res)
|
|
|
+ if (res.code === 10000) {
|
|
|
+ this.yingfuTableData = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ getSalesDates(newValue) {
|
|
|
+ this.getSalesDates = newValue
|
|
|
+ this.initSalesChart()
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -426,6 +544,9 @@ export default {
|
|
|
padding: 20px;
|
|
|
padding-bottom: 0;
|
|
|
}
|
|
|
+.sales-condition {
|
|
|
+ margin-left: 250px;
|
|
|
+}
|
|
|
.sales-content {
|
|
|
padding-top: 20px;
|
|
|
width: 100%;
|