Commit 18854792 authored by 姬鋆屾's avatar 姬鋆屾

推,预约数据分析接口对接,调整日期搜索的显示文本和时间范围

parent 5e8a5879
......@@ -4,7 +4,7 @@
<script>
import { deepClone } from "@/utils/js/common.js";
import lodash from "lodash";
import{getStatisticAges} from '@/api/dataAdmin.js'
import { getStatisticAges } from "@/api/dataAdmin.js";
export default {
props: {
info: {
......@@ -12,7 +12,7 @@ export default {
default: () => [
{
value: 200,
name: "20",
name: "20",
},
{
value: 400,
......@@ -40,16 +40,30 @@ export default {
type: Object,
default: () => {},
},
day: {
type: String,
default: () => "0",
},
},
watch: {
day(newval, oldval) {
newval ? this.getData() : "";
},
},
async mounted() {
let res = await getStatisticAges()
if (res.code != 1) return
let label = res.data.map(item=> item.age_area)
let value = res.data.map(item=> item.nums)
this._initEcharts(label,value);
this.getData();
},
methods: {
_initEcharts(label,value) {
async getData() {
let res = await getStatisticAges({
selected: this.day == 5 ? null : this.day,
});
if (res.code != 1) return;
let label = res.data.map((item) => item.age_area);
let value = res.data.map((item) => item.nums);
this._initEcharts(label, value);
},
_initEcharts(label, value) {
const myChart = this.$echarts.init(this.$el);
const echarts = this.$echarts;
let option = {
......@@ -72,9 +86,9 @@ export default {
xAxis: {
type: "category",
data: label,
axisTick:{
show:false
}
axisTick: {
show: false,
},
},
yAxis: {
type: "value",
......@@ -105,4 +119,4 @@ export default {
},
},
};
</script>
\ No newline at end of file
</script>
......@@ -4,7 +4,7 @@
<script>
import { deepClone } from "@/utils/js/common.js";
import lodash from "lodash";
import{getStatisticSexual} from '@/api/dataAdmin.js'
import { getStatisticSexual } from "@/api/dataAdmin.js";
export default {
props: {
info: {
......@@ -24,14 +24,31 @@ export default {
type: Object,
default: () => {},
},
day: {
type: String,
default: () => "0",
},
},
watch: {
day(newval, oldval) {
newval ? this.getData() : "";
},
},
async mounted() {
let res = await getStatisticSexual()
if (res.code != 1) return
let value = res.data.map(({idcard_Sex,nums})=>({name:idcard_Sex,value:nums}))
this._initEcharts(value);
mounted() {
this.getData();
},
methods: {
async getData() {
let res = await getStatisticSexual({
selected: this.day == 5 ? null : this.day,
});
if (res.code != 1) return;
let value = res.data.map(({ idcard_Sex, nums }) => ({
name: idcard_Sex,
value: nums,
}));
this._initEcharts(value);
},
_initEcharts(value) {
const myChart = this.$echarts.init(this.$el);
const echarts = this.$echarts;
......@@ -87,13 +104,13 @@ export default {
rich_green: {
color: "#50CCCB",
},
}
},
},
label: {
normal: {
formatter: "{d}%", //自定义显示格式(b:name, c:value, d:百分比)
},
},
label: {
normal: {
formatter: '{d}%' //自定义显示格式(b:name, c:value, d:百分比)
}
},
labelLine: {
length: 10,
length2: 60,
......@@ -119,4 +136,4 @@ export default {
},
},
};
</script>
\ No newline at end of file
</script>
......@@ -15,9 +15,9 @@
<a-select-option value="0"> 今天 </a-select-option>
<a-select-option value="1"> 近7天 </a-select-option>
<a-select-option value="2"> 近30天 </a-select-option>
<a-select-option value="3">90天 </a-select-option>
<a-select-option value="4"> 近180天 </a-select-option>
<a-select-option value="5"> 自定义 </a-select-option>
<a-select-option value="3">3月 </a-select-option>
<a-select-option value="4"> 本年度 </a-select-option>
<!-- <a-select-option value="5"> 自定义 </a-select-option> -->
</a-select>
<a-button type="primary" class="addclass" @click="getData">搜索</a-button>
......
......@@ -8,23 +8,25 @@
class="range_picker_style"
@change="rangePickerChange"
v-model="BegindAndEndTime"
v-if="day == 5"
v-if="day == 5"
>
</a-range-picker>
<a-select v-model="day">
<a-select-option value="0"> 今天 </a-select-option>
<a-select-option value="1"> 近7天 </a-select-option>
<a-select-option value="2"> 近30天 </a-select-option>
<a-select-option value="3"> 近90天 </a-select-option>
<a-select-option value="4"> 近180天 </a-select-option>
<a-select-option value="5"> 自定义 </a-select-option>
<a-select-option value="2"> 近30天 </a-select-option>
<a-select-option value="3"> 近3月 </a-select-option>
<a-select-option value="4"> 本年度 </a-select-option>
<!-- <a-select-option value="5"> 自定义 </a-select-option> -->
</a-select>
<a-button type="primary" class="addclass" @click="getData">搜索</a-button>
<a-button type="primary" class="addclass" @click="getData"
>搜索</a-button
>
</template>
</Head>
<div class="echarts">
<Brokenline :info="chartsData" v-if="chartsData"/>
<Brokenline :info="chartsData" v-if="chartsData" />
</div>
</div>
<div class="fx">
......@@ -36,11 +38,13 @@
:pagination="false"
:columns="tableHeaders"
:dataSource="tableSourceData"
:scroll="{ y: 590 }"
:scroll="{ y: 590 }"
>
</a-table>
<p class="updateTime">
<i class="fa fa-info-circle"></i>数据更新时间:{{date}},受数据波动影响,可能会有延迟。
<i class="fa fa-info-circle"></i>数据更新时间:{{
date
}},受数据波动影响,可能会有延迟。
</p>
</div>
</div>
......@@ -50,16 +54,16 @@
<script>
import Head from "./components/header.vue";
import Brokenline from "./components/line.vue";
import {getTrend} from '@/api/dataAdmin.js'
import moment from 'moment'
import { getTrend } from "@/api/dataAdmin.js";
import moment from "moment";
export default {
name: "PortalAdminVueMakeDataAnalyse",
data() {
return {
day:'0',
date:'',
day: "0",
date: "",
BegindAndEndTime: [],
chartsData:null,
chartsData: null,
tableSourceData: [],
tableHeaders: [
{
......@@ -99,33 +103,33 @@ export default {
Head,
Brokenline,
},
watch:{
day(val){
if (val != 5) this.BegindAndEndTime = []
}
watch: {
day(val) {
if (val != 5) this.BegindAndEndTime = [];
},
},
mounted() {
this.date = moment().format('yyyy-MM-DD hh:mm:ss')
this.getData()
this.date = moment().format("yyyy-MM-DD hh:mm:ss");
this.getData();
},
methods: {
getData(){
getTrend({
selected:this.day == 5 ? null : this.day,
time:this.BegindAndEndTime
}).then(res=>{
this.chartsData = res.data.list
this.tableSourceData.push({
研究对象: `预约次数`,
预约总量: res.data.orderAll,
开放预约天数: res.data.openday,
预约日均值: res.data.prev_num,
整体同比: res.data.tbi,
整体环比: res.data.hbi,
});
})
},
getData() {
getTrend({
selected: this.day == 5 ? null : this.day,
time: this.BegindAndEndTime,
}).then((res) => {
this.chartsData = res.data.list;
this.tableSourceData.push({
研究对象: `预约次数`,
预约总量: res.data.orderAll,
开放预约天数: res.data.openday,
预约日均值: res.data.prev_num,
整体同比: res.data.tbi,
整体环比: res.data.hbi,
});
});
},
rangePickerChange(val) {
console.log(val);
},
......@@ -234,4 +238,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment