123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <view class="content">
- <div class="bigtitle">
- <h2>
- {{indexTitle}}
- </h2>
- </div>
- <template>
- <cyChartVue>
-
- </cyChartVue>
- </template>
- <u-empty text="暂无数据" icon="../../static/data.png" v-if="!echartsData.length"></u-empty>
- </view>
- </template>
- <script>
- import {
- nowDate,
- timeToDate,
- getLastMonth,
- getLast3Month
- } from '../../utils/date.js'
- import cyChartVue from '../../components/ecahrts/cyChart.vue';
- export default {
- components: {
- cyChartVue
- },
- data() {
- return {
- indexTitle: '',
- queryParams: {
- page: 1,
- limit: 999
- },
- windowInfo: null,
- viewList: [],
- //图表数据
- echartsData: [],
- value: 3600000,
- startTime: null,
- clear: true,
- choiceTime: 0,
- choiceChildTime: 0,
- isShow: false,
- token: uni.getStorageSync('C_TOKEN'),
- chartHeight: 300,
- chartFirstTop: 120,
- chartMargin: 50
- }
- },
- created() {
- this.loadTitle();
- uni.getSystemInfo({
- success: (res) => {
- this.windowInfo = res;
- }
- });
- },
- onShow() {
- // console.log('onShow')
- },
- mounted() {
- this.initData()
- },
- onHide() {
- //this.clear = false
- },
- onPullDownRefresh() {
- this.loadTitle()
- this.initData()
- },
- onPageScroll() {
- },
- beforeDestroy() {
-
- },
- methods: {
- //获得首页标题
- loadTitle() {
- uni.$http.get('/dict/queryByDictKey?dictKeys=title').then(res => {
- const data = res.data
- if (data.code === 200) {
- this.indexTitle = data.data[0].dictValue;
- }
- })
- },
- initData() {
- uni.removeStorage('sTime')
- this.clear = true
- this.value = null
- this.choiceTime = 0
- this.startTime = timeToDate(new Date().getTime())
- this.temperature()
- },
- //用户图表数据
- temperature() {
- this.echartsData = []
- uni.$http.get('/chart/getAllOkChart', this.queryParams).then(res => {
- const data = res.data
- if (data.code === 200) {
- const {
- reportTableList
- } = data.data
- let array = []
- for (let i = 0; i < reportTableList.length; i++) {
- let websrc = '',thumbsrc=''
- if (reportTableList[i].chartType === 'line') {
- websrc =
- `/static/webview/line-wv.html?id=${reportTableList[i].id}&token=${this.token}`
- thumbsrc = '../../static/image/icon-action-chartline.png'
- } else if (reportTableList[i].chartType === 'bar') {
- websrc =
- `/static/webview/bar-wv.html?id=${reportTableList[i].id}&token=${this.token}`
- thumbsrc = '../../static/image/icon-action-chartbar.png'
- } else if (reportTableList[i].chartType === 'pie') {
- websrc =
- `/static/webview/pie-wv.html?id=${reportTableList[i].id}&token=${this.token}`
- thumbsrc = '../../static/image/icon-action-chartpie.png'
- } else if (reportTableList[i].chartType === 'table') {
- websrc =
- `/static/webview/table-wv.html?id=${reportTableList[i].id}&token=${this.token}`
- thumbsrc = '../../static/image/icon-action-charttable.png'
- }
- array.push({
- id: reportTableList[i].id,
- chartType: reportTableList[i].chartType,
- chartName: reportTableList[i].chartName,
- src:websrc,
- thumb:thumbsrc
- })
- }
- //console.log(array)
- this.echartsData = array
- }
- })
- uni.stopPullDownRefresh()
- },
- }
- };
- </script>
- <style scoped>
- .container {
- height: 100vh
- }
- .title {
- margin: 10rpx 0 10rpx 20rpx;
- font-size: 28rpx;
- color: #666666;
- }
- ::v-deep .uni-section-content {
- width: 50%;
- margin-bottom: 20rpx;
- }
- ::v-deep .uni-list-item__content-title {
- font-size: 36rpx;
- }
- .moreTime {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 80vw;
- margin: auto
- }
- .bigtitle {
- margin: auto;
- text-align: center;
- }
- .bigtitle h2 {}
- .bod {
- border-bottom: 3px solid #007AFF;
- }
- .box {
- border: 1px solid #007AFF !important;
- }
- .childTime {
- margin: 16rpx 60rpx 0 60rpx;
- }
- .childTime>div {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .childTime>div>div {
- width: 140rpx;
- padding: 10rpx;
- border: 1px solid #e6e6e6;
- border-radius: 16rpx;
- color: #7e7e7e;
- font-size: 26rpx;
- text-align: center;
- }
- </style>
|