|
@@ -2,13 +2,31 @@
|
|
<div id="card-1">
|
|
<div id="card-1">
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="24" class="main">
|
|
<el-col :span="24" class="main">
|
|
- <div id="card_fou" style="width: 70vw; height: 30vw"></div>
|
|
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-button type="primary" size="mini" @click="totime('day')">本日</el-button>
|
|
|
|
+ <el-button type="primary" size="mini" @click="totime('week')">本周</el-button>
|
|
|
|
+ <el-button type="primary" size="mini" @click="totime('monthDay')">本月</el-button>
|
|
|
|
+ <el-button type="primary" size="mini" @click="totime('yearMonth')">本年</el-button>
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="time"
|
|
|
|
+ type="daterange"
|
|
|
|
+ range-separator="至"
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
|
+ style="margin: 0 12px"
|
|
|
|
+ >
|
|
|
|
+ </el-date-picker>
|
|
|
|
+ <el-button type="primary" size="mini" @click="totime(time, 1)">查询</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <div id="card_one" style="width: 70vw; height: 30vw; margin: 40px 0 0 0"></div>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+var myChart;
|
|
import * as echarts from 'echarts';
|
|
import * as echarts from 'echarts';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
const { mapActions } = createNamespacedHelpers('todo');
|
|
const { mapActions } = createNamespacedHelpers('todo');
|
|
@@ -20,21 +38,22 @@ export default {
|
|
return {
|
|
return {
|
|
xAxisList: [],
|
|
xAxisList: [],
|
|
seriesList: [],
|
|
seriesList: [],
|
|
|
|
+ time: '',
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState(['user']),
|
|
...mapState(['user']),
|
|
},
|
|
},
|
|
- mounted() {},
|
|
|
|
- async created() {
|
|
|
|
|
|
+ async mounted() {
|
|
await this.search();
|
|
await this.search();
|
|
},
|
|
},
|
|
|
|
+ async created() {},
|
|
methods: {
|
|
methods: {
|
|
...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
|
|
...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
|
|
- async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
|
- let res = await this.query({ skip, limit, ...info });
|
|
|
|
|
|
+ async search({ skip = 0, limit = 10 } = {}) {
|
|
|
|
+ let res = await this.query({ skip, limit, status: '2', type: info.time, start: info.start, end: info.end });
|
|
if (this.$checkRes(res)) {
|
|
if (this.$checkRes(res)) {
|
|
- let list = res.data.sMarkOrder;
|
|
|
|
|
|
+ let list = res.data.sAfterSale;
|
|
let xAxisList = [];
|
|
let xAxisList = [];
|
|
let seriesList = [];
|
|
let seriesList = [];
|
|
for (const p1 of list) {
|
|
for (const p1 of list) {
|
|
@@ -43,12 +62,22 @@ export default {
|
|
}
|
|
}
|
|
this.$set(this, 'xAxisList', xAxisList);
|
|
this.$set(this, 'xAxisList', xAxisList);
|
|
this.$set(this, 'seriesList', seriesList);
|
|
this.$set(this, 'seriesList', seriesList);
|
|
- this.getEchartData();
|
|
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ totime(time, e) {
|
|
|
|
+ if (e == '1') {
|
|
|
|
+ let start = time[0];
|
|
|
|
+ let end = time[1];
|
|
|
|
+ this.search({ start, end, time: 'custom' });
|
|
|
|
+ } else {
|
|
|
|
+ this.search({ time });
|
|
}
|
|
}
|
|
},
|
|
},
|
|
getEchartData(data) {
|
|
getEchartData(data) {
|
|
- var chartDom = document.getElementById('card_fou');
|
|
|
|
- var myChart = echarts.init(chartDom);
|
|
|
|
|
|
+ if (myChart != null && myChart != '' && myChart != undefined) {
|
|
|
|
+ myChart.dispose(); //销毁
|
|
|
|
+ }
|
|
|
|
+ myChart = echarts.init(document.getElementById('card_fou'));
|
|
var option;
|
|
var option;
|
|
option = {
|
|
option = {
|
|
title: {
|
|
title: {
|
|
@@ -85,9 +114,11 @@ export default {
|
|
return { title: this.$route.meta.title };
|
|
return { title: this.$route.meta.title };
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
- list: {
|
|
|
|
|
|
+ seriesList: {
|
|
deep: true,
|
|
deep: true,
|
|
- handler(val) {},
|
|
|
|
|
|
+ handler(val) {
|
|
|
|
+ this.getEchartData();
|
|
|
|
+ },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|