Commit 3d910d09 authored by leon's avatar leon

Merge branch 'develop' into feature-retail

* develop:
  feat: login input componment
  feat: daily
  feat: add custom charts
  Revert "feat:remove phone call"
  feat:remove phone call
  feat: charts support x y double axis
  feat: tooltip position
  feat: login storage staffNo when is not null
  feat: detail new prev and next
  feat: xaxis formatter
  feat: modefy config
  Revert "Revert "feat: fullscreen page remove tabs""
  Revert "feat: fullscreen page remove tabs"
  fix: home report id

# Conflicts:
#	manifest.json
parents da1f7a4b 60654108
......@@ -71,11 +71,8 @@
let options = {
...this.elementInfo.option,
tooltip: {},
xAxis: this.$u.common.dealAxisFormatter(this.elementInfo.option.xAxis),
yAxis: {
...this.$u.common.dealAxisFormatter(this.elementInfo.option.yAxis),
data: this.dealSeriesData(series).categories
},
yAxis: that.$u.common.dealXAxis({...this.elementInfo.option.yAxis}, this.dealSeriesData(series)),
xAxis: that.$u.common.dealYAxis({...this.elementInfo.option.xAxis}),
dataZoom: this.elementInfo.dataZoom && this.elementInfo.dataZoom.show ? [{...this.elementInfo.dataZoom,...DATAZOOM_DEFAULT}] : [{show: false}],
series: {
id: 'associate',
......
<template>
<uni-ec-canvas class="uni-ec-canvas" id="custom-chart" ref="customChartCanvas" canvas-id="custom-chart"
:ec="ec"></uni-ec-canvas>
</template>
<script>
import uniEcCanvas from '@/uni-ec-canvas/uni-ec-canvas'
import echartElementData from '@/mixins/echartElementData.js'
import {
DATAZOOM_DEFAULT
} from '@/mixins/zoomConfig.js'
import {
svg
} from '@/mixins/svg.js'
import {
geoCoordMapList
} from '@/uni-ec-canvas/geoCoordMap.js'
let chart = null
let lastCount = 0 // 记录datazoom最后一次滑动的数值数量
export default {
mixins: [echartElementData],
data() {
return {
ec: {
lazyLoad: true,
option: {}
},
timers: [],
currentIndex: -1
}
},
components: {
uniEcCanvas
},
created() {},
mounted() {
this.$refs['customChartCanvas'].init(this.inited)
},
methods: {
inited(canvas, width, height, canvasDpr) {
chart = this.$echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: canvasDpr
})
canvas.setChart(chart)
const {
dataList
} = this.elementData
const seniorConfig = this.elementInfo.option.seniorConfig
this.ec.option = this.$u.common.converFunction(seniorConfig, dataList, geoCoordMapList)
chart.setOption(this.ec.option)
const that = this
chart.on('click', event => {
that.handleEchartsClick(event)
})
// 处理自动动态排序
const sort = that.elementInfo.option.sort
if (sort.enable && that.ec.option) {
if (sort.autoSort) {
that.autoSort()
} else {
const toolbox = that.ec.option.toolbox ? that.ec.option.toolbox : {}
that.ec.option.toolbox = {
...toolbox,
itemSize: 20,
show: true,
feature: {
mySort: {
show: true,
title: '开始',
icon: svg.playIcon,
onclick: () => {
that.autoSort()
}
}
}
}
chart.setOption(that.ec.option)
}
}
return chart
},
autoSort() {
const toolbox = this.ec.option.toolbox
if (toolbox && toolbox.feature && toolbox.feature.mySort) {
if (toolbox.feature.mySort.icon === svg.playIcon) {
toolbox.feature.mySort.title = '暂停'
toolbox.feature.mySort.icon = svg.pauseIcon
} else {
toolbox.feature.mySort.title = '开始'
toolbox.feature.mySort.icon = svg.playIcon
this.timers.forEach(timer => {
clearTimeout(timer)
})
this.timers = []
return
}
}
const sort = this.elementInfo.option.sort
const timeInterval = sort.timeInterval || 2000
var dataList = this.elementData.dataList
if (sort.sortConfig) {
dataList = this.$u.common.converFunction(sort.sortConfig, this.elementData.dataList, {})
}
const startIndex = this.currentIndex
dataList.forEach((value, index) => {
if (index > startIndex) {
const timer = setTimeout(() => {
this.ec.option.series[0].data = value.data;
if (value.categories) {
this.ec.option.yAxis.data = value.categories
}
if (value.title && this.ec.option.title) {
this.ec.option.title.text = value.title
}
this.currentIndex = index
if (index === dataList.length - 1) {
this.currentIndex = 0
toolbox.feature.mySort.title = '开始'
toolbox.feature.mySort.icon = svgIcon.playIcon
this.timers.forEach(timer => {
clearTimeout(timer)
})
this.timers = []
}
chart.setOption(this.ec.option)
}, timeInterval * (index - (startIndex === -1 ? 0 : startIndex + 1)))
this.timers.push(timer)
}
})
},
initChart() {
// 等待子组件完全挂载完成---chart初始化完成
this.$nextTick().then(() => {
// 重新setOption,使得设置的formatter生效
// chart.setOption({
// series: dealSeries
// })
})
},
}
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -51,11 +51,8 @@ export default {
const that = this
that.ec.option = {
...that.elementInfo.option,
xAxis: that.$u.common.dealAxisFormatter(that.elementInfo.option.xAxis),
yAxis: {
...that.$u.common.dealAxisFormatter(that.elementInfo.option.yAxis),
data: categories
},
yAxis: that.$u.common.dealXAxis({...that.elementInfo.option.yAxis}, that.elementData.dataList),
xAxis: that.$u.common.dealYAxis({...that.elementInfo.option.xAxis}),
tooltip: that.$u.common.dealTooltip(that.elementInfo.option.tooltip),
dataZoom:
that.elementInfo.dataZoom && that.elementInfo.dataZoom.show
......@@ -222,8 +219,8 @@ export default {
}
}
return {
...item,
...config
...config,
...item
}
})
return newData
......
......@@ -48,23 +48,10 @@
canvas.setChart(chart)
const {categories, series} = this.elementData.dataList
const that = this
let yAxis = [
that.$u.common.dealAxisFormatter({ ...that.elementInfo.option.yAxis, type: 'value' }),
that.$u.common.dealAxisFormatter({ ...that.elementInfo.option.yAxis, type: 'value' })
]
if (that.elementInfo.option.yAxis.showDouble) {
yAxis = [
that.$u.common.dealAxisFormatter({ ...that.elementInfo.option.yAxis, type: 'value' }),
that.$u.common.dealAxisFormatter({ ...that.elementInfo.option.yAxis, ...that.elementInfo.option.yAxis.second, type: 'value' })
]
}
that.ec.option = {
...that.elementInfo.option,
xAxis: {
...that.elementInfo.option.xAxis,
data: categories
},
yAxis: yAxis,
xAxis: that.$u.common.dealXAxis({...that.elementInfo.option.xAxis}, that.elementData.dataList),
yAxis: that.$u.common.dealYAxis({...that.elementInfo.option.yAxis, type: 'value'}),
tooltip: that.$u.common.dealTooltip(that.elementInfo.option.tooltip),
toolbox: {
...that.elementInfo.option.toolbox,
......@@ -180,18 +167,14 @@
}
} else if (item.type === 'line') {
config = {
yAxisIndex: 1,
...config,
...that.elementInfo.option.line,
...itemStyle
}
}
return {
...item,
...config
}
return { ...config, ...item}
})
return newData
return that.$u.common.dealAxisIndex(newData, that.elementInfo)
},
/**
* 响应dataZoom的滑动事件
......
......@@ -43,20 +43,10 @@
canvas.setChart(chart)
const { categories, series } = this.elementData.dataList
const that = this
var yAxis = that.$u.common.dealAxisFormatter({...that.elementInfo.option.yAxis})
if (yAxis.showDouble) {
yAxis = [
that.$u.common.dealAxisFormatter({ ...that.elementInfo.option.yAxis}),
that.$u.common.dealAxisFormatter({ ...that.elementInfo.option.yAxis, ...that.elementInfo.option.yAxis.second })
]
}
that.ec.option = {
...that.elementInfo.option,
xAxis: {
...that.elementInfo.option.xAxis,
data: categories
},
yAxis: yAxis,
xAxis: that.$u.common.dealXAxis({...that.elementInfo.option.xAxis}, that.elementData.dataList),
yAxis: that.$u.common.dealYAxis({...that.elementInfo.option.yAxis}),
tooltip: that.$u.common.dealTooltip(that.elementInfo.option.tooltip),
toolbox: {
...that.elementInfo.option.toolbox,
......@@ -157,16 +147,9 @@
}
}
}
if (that.elementInfo.option.yAxis.showDouble) {
const yAxisIndex = data.length - 1 === index ? 1 : 0
return { ...item, ...config, yAxisIndex: yAxisIndex}
}
return {
...item,
...config
}
return { ...config, ...item}
})
return newData
return that.$u.common.dealAxisIndex(newData, that.elementInfo)
},
/**
* 响应dataZoom的滑动事件
......
......@@ -42,20 +42,10 @@
canvas.setChart(chart)
const { categories = [], series = [] } = this.elementData.dataList
const that = this
var yAxis = that.$u.common.dealAxisFormatter({...that.elementInfo.option.yAxis})
if (yAxis.showDouble) {
yAxis = [
that.$u.common.dealAxisFormatter({ ...that.elementInfo.option.yAxis}),
that.$u.common.dealAxisFormatter({ ...that.elementInfo.option.yAxis, ...that.elementInfo.option.yAxis.second})
]
}
that.ec.option = {
...that.elementInfo.option,
xAxis: {
...that.elementInfo.option.xAxis,
data: categories
},
yAxis: yAxis,
xAxis: that.$u.common.dealXAxis({...that.elementInfo.option.xAxis}, that.elementData.dataList),
yAxis: that.$u.common.dealYAxis({...that.elementInfo.option.yAxis}),
tooltip: that.$u.common.dealTooltip(that.elementInfo.option.tooltip),
toolbox: {
...that.elementInfo.option.toolbox,
......@@ -158,16 +148,9 @@
},
}
}
if (that.elementInfo.option.yAxis.showDouble) {
const yAxisIndex = data.length - 1 === index ? 1 : 0
return { ...item, ...config, yAxisIndex: yAxisIndex}
}
return {
...item,
...config
}
return { ...config, ...item}
})
return newData
return that.$u.common.dealAxisIndex(newData, that.elementInfo)
},
/**
* 响应dataZoom的滑动事件
......
......@@ -32,11 +32,13 @@ export default {
*/
async handleDynamicData (value) {
const that = this
let { dataUrl, dataMethod, dataFormatter, dataProcessing, dataConfig } = { ...value }
let { dataUrl, dataMethod, dataFormatter, dataProcessing, dataConfig, queryProcessing } = { ...value }
if (!dataUrl.length) {
return
}
if (queryProcessing) {
dataFormatter = that.$u.common.converFunction(queryProcessing, dataFormatter, value.queryFormatter)
}
if(value.queryFormatter) dataFormatter = {...dataFormatter, ...value.queryFormatter}
dataUrl = dataUrl.replace(/^(\/(dashboardCharts|dashboardAPI))?/, '')
dataFormatter = that.$u.common.filterRequestParams({...dataFormatter})
......
export const svg = {
enterFull: "M285.866667 810.666667H384v42.666666H213.333333v-170.666666h42.666667v98.133333l128-128 29.866667 29.866667-128 128z m494.933333 0l-128-128 29.866667-29.866667 128 128V682.666667h42.666666v170.666666h-170.666666v-42.666666h98.133333zM285.866667 256l128 128-29.866667 29.866667-128-128V384H213.333333V213.333333h170.666667v42.666667H285.866667z m494.933333 0H682.666667V213.333333h170.666666v170.666667h-42.666666V285.866667l-128 128-29.866667-29.866667 128-128z",
exitFull: "M354.133333 682.666667H256v-42.666667h170.666667v170.666667H384v-98.133334L243.2 853.333333l-29.866667-29.866666L354.133333 682.666667z m358.4 0l140.8 140.8-29.866666 29.866666-140.8-140.8V810.666667h-42.666667v-170.666667h170.666667v42.666667h-98.133334zM354.133333 384L213.333333 243.2l29.866667-29.866667L384 354.133333V256h42.666667v170.666667H256V384h98.133333z m358.4 0H810.666667v42.666667h-170.666667V256h42.666667v98.133333L823.466667 213.333333l29.866666 29.866667L712.533333 384z"
exitFull: "M354.133333 682.666667H256v-42.666667h170.666667v170.666667H384v-98.133334L243.2 853.333333l-29.866667-29.866666L354.133333 682.666667z m358.4 0l140.8 140.8-29.866666 29.866666-140.8-140.8V810.666667h-42.666667v-170.666667h170.666667v42.666667h-98.133334zM354.133333 384L213.333333 243.2l29.866667-29.866667L384 354.133333V256h42.666667v170.666667H256V384h98.133333z m358.4 0H810.666667v42.666667h-170.666667V256h42.666667v98.133333L823.466667 213.333333l29.866666 29.866667L712.533333 384z",
playIcon: 'M909.892465 331.781731c-21.798121-51.476314-52.909055-97.631021-92.514092-137.236058-39.605037-39.605037-85.862083-70.818309-137.236058-92.514092-53.21607-22.514491-109.809314-33.976414-168.142315-33.976414S397.176094 79.414751 343.857685 102.031581c-51.476314 21.798121-97.631021 52.909055-137.236058 92.514092s-70.818309 85.862083-92.514092 137.236058c-22.514491 53.21607-33.976414 109.809314-33.976414 168.142315s11.461923 114.823906 33.976414 168.142315c21.798121 51.476314 52.909055 97.631021 92.514092 137.236058 39.605037 39.605037 85.862083 70.818309 137.236058 92.514092 53.21607 22.514491 109.809314 33.976414 168.142315 33.976414s114.823906-11.461923 168.142315-33.976414c51.476314-21.798121 97.631021-52.909055 137.236058-92.514092 39.605037-39.605037 70.818309-85.862083 92.514092-137.236058 22.514491-53.21607 33.976414-109.809314 33.976414-168.142315S932.509294 385.10014 909.892465 331.781731zM512 886.763942c-213.273636 0-386.839896-173.56626-386.839896-386.839896s173.56626-386.839896 386.839896-386.839896 386.839896 173.56626 386.839896 386.839896S725.273636 886.763942 512 886.763942zM641.355986 496.239856 458.681591 367.804917c-8.391765-5.8333-19.649011 0.102339-19.649011 10.336198l0 256.869878c0 10.23386 11.257246 16.169498 19.649011 10.336198l182.776734-128.434939C648.622027 511.897661 648.519688 501.254447 641.355986 496.239856z',
pauseIcon: 'M909.892465 331.781731c-21.798121-51.476314-52.909055-97.631021-92.514092-137.236058-39.605037-39.605037-85.862083-70.818309-137.236058-92.514092-53.21607-22.514491-109.809314-33.976414-168.142315-33.976414S397.176094 79.414751 343.857685 102.031581c-51.476314 21.798121-97.631021 52.909055-137.236058 92.514092s-70.818309 85.862083-92.514092 137.236058c-22.514491 53.21607-33.976414 109.809314-33.976414 168.142315s11.461923 114.823906 33.976414 168.142315c21.798121 51.476314 52.909055 97.631021 92.514092 137.236058 39.605037 39.605037 85.862083 70.818309 137.236058 92.514092 53.21607 22.514491 109.809314 33.976414 168.142315 33.976414s114.823906-11.461923 168.142315-33.976414c51.476314-21.798121 97.631021-52.909055 137.236058-92.514092 39.605037-39.605037 70.818309-85.862083 92.514092-137.236058 22.514491-53.21607 33.976414-109.809314 33.976414-168.142315S932.509294 385.10014 909.892465 331.781731zM512 886.763942c-213.273636 0-386.839896-173.56626-386.839896-386.839896s173.56626-386.839896 386.839896-386.839896 386.839896 173.56626 386.839896 386.839896S725.273636 886.763942 512 886.763942zM440.055966 369.442335c-12.485309 0-22.514491 10.029182-22.514491 22.514491l0 248.68279c0 12.485309 10.029182 22.514491 22.514491 22.514491s22.514491-10.029182 22.514491-22.514491L462.570458 391.956826C462.570458 379.471517 452.541275 369.442335 440.055966 369.442335zM570.025984 369.442335c-12.485309 0-22.514491 10.029182-22.514491 22.514491l0 248.68279c0 12.485309 10.029182 22.514491 22.514491 22.514491s22.514491-10.029182 22.514491-22.514491L592.540476 391.956826C592.540476 379.471517 582.511293 369.442335 570.025984 369.442335z'
}
\ No newline at end of file
<template>
<view class="viewport-wrapper" :style="[styleObject]">
<u-icon class="left-button" name="arrow-left" @click="handleLeftAction()"></u-icon>
<u-icon class="right-button" name="arrow-right" @click="handleRightAction()"></u-icon>
<view class="float-button" :style="{bottom: bottom + 'px'}" @click="showMenus()" :animation="animation">
<u-icon name="list" size="26" v-if="!isShow"></u-icon>
<u-icon name="plus" size="26" v-else></u-icon>
</view>
<view class="menu" :class="[menuClass(1)]" :style="{bottom: (bottom + 50) + 'px'}">
<u-icon name="arrow-left" size="24" @click="handleLeftAction()"></u-icon>
</view>
<view class="menu" :class="[menuClass(2)]" :style="{bottom: bottom + 'px'}">
<u-icon name="reload" size="24" @click="handleReolad()"></u-icon>
</view>
<view class="menu" :class="[menuClass(3)]" :style="{bottom: (bottom - 50) + 'px'}">
<u-icon name="arrow-right" size="24" @click="handleRightAction()"></u-icon>
</view>
<template v-for="(element, index) in reportInfo.list">
<view
class="view-element"
......@@ -56,6 +68,8 @@
<NormalTable v-if="element.type == 'NormalTable'" :elementInfo="element"></NormalTable>
<!-- <Table v-if="element.type == 'NormalTable'" :elementInfo="element"></Table> -->
<Folder v-if="element.type == 'folder'" :elementInfo="element"></Folder>
<!-- 自定义图表 -->
<CustomChart v-if="element.type == 'CustomChart'" :elementInfo="element"></CustomChart>
</view>
</template>
<ModelData
......@@ -68,7 +82,6 @@
></ModelData>
<MySelect></MySelect>
</view>
</template>
......@@ -88,8 +101,10 @@
popupShow: false,
popupData: [],
customRender: {},
currentIndex: 0
currentIndex: 0,
animation: '',
isShow: false,
bottom: 100
}
},
computed: {
......@@ -214,11 +229,15 @@
async getReportCharts() {
clearInterval(this.timename)
const that = this
let res = await that.$u.api.getReportCharts({id: that.detailId})
uni.stopPullDownRefresh()
uni.$emit('handlePullDownRefresh')
uni.showLoading({
title: '加载中...'
})
let res = await that.$u.api.getReportCharts({id: that.detailId})
const { Status, Result: { info, list } } = res.data
if (Status === 'true') {
uni.hideLoading()
if(info.dataUrl) {
that.getGlobalData(info, list)
if(info.dataPollingInterval) {
......@@ -241,7 +260,11 @@
}
that.reportInfo = res.data.Result
uni.setStorageSync('reportInfo', JSON.stringify(res.data.Result))
uni.setNavigationBarTitle({
title: info.name
})
that.getStickyTables()
}
},
/**
......@@ -304,11 +327,11 @@
* 点击向左切换按钮
*/
handleLeftAction() {
this.indexs--
if (this.indexs<0) {
this.indexs = 0
this.showMenus()
if (this.indexs === 0) {
return
}
this.indexs--
this.handlePage()
},
......@@ -316,11 +339,11 @@
* 点击向右切换按钮
*/
handleRightAction() {
this.indexs++
if (this.indexs>this.idList.length-1) {
this.indexs--
this.showMenus()
if (this.indexs>=this.idList.length-1) {
return
}
this.indexs++
this.handlePage()
},
......@@ -335,6 +358,33 @@
})
},
showMenus() {
var animation = uni.createAnimation({
duration: 200,
timingFunction: 'ease',
})
this.isShow = !this.isShow
var rotate = this.isShow ? 135 : 0
animation.rotate(rotate).step()
this.animation = animation.export()
},
menuClass(number) {
let num = this.isShow ? number : 0;
return 'menu' + num;
},
handleReolad () {
this.showMenus()
// 让list数据做下改变,下拉刷新后才能触发页面的渲染,让组件里面的接口调用
this.reportInfo.list = this.reportInfo.list.map(item => {
item.value = "2022"
return item
})
this.getReportCharts()
},
/**
* 请求下一页的列表id
*/
......@@ -361,6 +411,7 @@
}
}
},
onPullDownRefresh() {
// 让list数据做下改变,下拉刷新后才能触发页面的渲染,让组件里面的接口调用
this.reportInfo.list = this.reportInfo.list.map(item => {
......@@ -418,15 +469,64 @@
.left-button {
position: fixed;
bottom: 50%;
left: 10px;
left: 1px;
z-index: 99;
}
.right-button {
position: fixed;
bottom: 50%;
right: 10px;
right: 1px;
z-index: 99;
}
.float-button {
position: fixed;
z-index: 99;
width: 40px;
height: 40px;
bottom: 15%;
right: 10px;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.7);
justify-content: center;
align-content: center;
display: flex;
border: 1rpx solid #ccc;
}
.menu {
position: fixed;
z-index: 90;
width: 30px;
height: 30px;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.7);
justify-content: center;
align-content: center;
display: flex;
border: 1rpx solid #ccc;
}
.menu0 {
right: 10px;
opacity: 0;
transition: top 0.2s, right 0.2s, opacity 0.2s;
}
.menu1 {
right: 30px;
transition: top 0.2s, right 0.2s, opacity 0.2s;
}
.menu2 {
right: 60px;
transition: top 0.2s, right 0.2s, opacity 0.2s;
}
.menu3 {
right: 30px;
transition: top 0.2s, right 0.2s, opacity 0.2s;
}
</style>
......@@ -58,6 +58,8 @@
<NormalTable v-if="element.type == 'NormalTable'" :elementInfo="element"></NormalTable>
<!-- <Table v-if="element.type == 'NormalTable'" :elementInfo="element"></Table> -->
<Folder v-if="element.type == 'folder'" :elementInfo="element"></Folder>
<!-- 自定义图表 -->
<CustomChart v-if="element.type == 'CustomChart'" :elementInfo="element"></CustomChart>
</view>
</template>
......@@ -240,7 +242,7 @@
async getReportCharts() {
clearInterval(this.timename)
const that = this
let res = await that.$u.api.getReportCharts({id: '642a8dd3eab04c0001f889b8'})
let res = await that.$u.api.getReportCharts({id: '627a16644606332538b4633c'})
uni.stopPullDownRefresh()
uni.$emit('handlePullDownRefresh')
const { Status, Result: { info, list } } = res.data
......
......@@ -3,10 +3,12 @@
<view class="content">
<u-form ref="uForm" :model="params" :error-type="['toast']" :label-width="200">
<u-form-item label="用户名" prop="userName">
<u-input v-model="params.userName" placeholder="请输入用户名" type="text" />
<!-- <u-input v-model="params.userName" placeholder="请输入用户名" type="text" @blur="blurUsername()" /> -->
<input placeholder="请输入用户名" type="text" @input="changeUsername" />
</u-form-item>
<u-form-item label="密码" prop="password">
<u-input v-model="params.password" placeholder="请输入密码" type="password" :password-icon="true" />
<!-- <u-input v-model="params.password" placeholder="请输入密码" type="password" :password-icon="true" @blur="blurPassword()"/> -->
<input placeholder="请输入密码" type="text" :password="true" @input="changePassword"/>
</u-form-item>
<u-form-item label="员工号(选填)" prop="staffNo">
<u-input v-model="params.staffNo" placeholder="填写员工号可以更精确的获取权限" type="number" />
......@@ -57,6 +59,20 @@
}
},
methods: {
// submitDisabled() {
// console.log(this.params)
// return this.params.userName && this.params.password
// },
changeUsername(event) {
console.log(event)
this.params.userName = event.detail.value
},
changePassword(event) {
this.params.password = event.detail.value
console.log(event)
},
// 登录
submit(type) {
this.$refs.uForm.validate(async valid => {
......@@ -116,8 +132,10 @@
uni.setStorageSync('authorized', info.authorized);
uni.setStorageSync('admin', info.admin);
uni.setStorageSync('show', info.show);
if(info.staffNo) {
uni.setStorageSync('staffNo', info.staffNo);
}
}
},
onReady() {
......
......@@ -37,7 +37,7 @@
pageSize: 10,
totalPages: 0,
totals: 0,
folderId: '6360778db6a1ee00014a8bf4',
folderId: '62837a79bfa93100013596c1',
superAdmin: true
},
......
......@@ -34,7 +34,7 @@
"minifyWXML": true
},
"compileType": "miniprogram",
"libVersion": "2.21.0",
"libVersion": "trial",
"appid": "wx06342b31eebe8da7",
"projectname": "ec-report-refactor",
"debugOptions": {
......
......@@ -6,7 +6,8 @@ export default class WxCanvas {
this.isNew = isNew
if (isNew) {
this.canvasNode = canvasNode;
} else {
}
else {
this._initStyle(ctx);
}
......@@ -32,6 +33,10 @@ export default class WxCanvas {
this.chart = chart;
}
addEventListener() {
// noop
}
attachEvent() {
// noop
}
......@@ -52,23 +57,6 @@ export default class WxCanvas {
}
_initStyle(ctx) {
var styles = ['fillStyle', 'strokeStyle', 'globalAlpha',
'textAlign', 'textBaseAlign', 'shadow', 'lineWidth',
'lineCap', 'lineJoin', 'lineDash', 'miterLimit', 'fontSize'
];
styles.forEach(style => {
Object.defineProperty(ctx, style, {
set: value => {
if (style !== 'fillStyle' && style !== 'strokeStyle' ||
value !== 'none' && value !== null
) {
ctx['set' + style.charAt(0).toUpperCase() + style.slice(1)](value);
}
}
});
});
ctx.createRadialGradient = () => {
return ctx.createCircularGradient(arguments);
};
......@@ -89,13 +77,15 @@ export default class WxCanvas {
wxName: 'touchEnd',
ecName: 'click'
}];
eventNames.forEach(name => {
this.event[name.wxName] = e => {
const touch = e.touches[0];
this.chart.getZr().handler.dispatch(name.ecName, {
zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
zrY: name.wxName === 'tap' ? touch.clientY : touch.y
zrY: name.wxName === 'tap' ? touch.clientY : touch.y,
preventDefault: () => {},
stopImmediatePropagation: () => {},
stopPropagation: () => {}
});
};
});
......
......@@ -241,6 +241,29 @@ const install = (Vue, vm) => {
if (!tooltip) {
return
}
tooltip = {
...tooltip,
position(point, params, dom, rect, size) {
let x = point[0];
let y = point[1];
const {
contentSize,
viewSize
} = size;
const maxX = viewSize[0] - contentSize[0];
if (x > maxX) {
x -= contentSize[0];
}
const maxY = viewSize[1] - contentSize[1];
if (y > maxY) {
y -= contentSize[1];
}
if (y < 0) {
y = 0
}
return [x, y];
}
}
if (tooltip.formatter && tooltip.formatter.length) {
return {
...tooltip,
......@@ -255,6 +278,69 @@ const install = (Vue, vm) => {
trigger: "axis"
}
}
/**
*
* @param axis 表单的yAxis设置
*/
const dealYAxis = (axis) => {
if (!axis) {
return
}
if (axis.showDouble) {
return [
dealAxisFormatter({
...axis
}),
dealAxisFormatter({
...axis,
...axis.second
})
]
}
return dealAxisFormatter({
...axis
})
}
/**
*
* @param axis 表单的xAxis设置
*/
const dealXAxis = (axis, dataList) => {
if (!axis) {
return
}
if (!dataList) {
return
}
const categories = dataList.categories
if (axis.showDouble) {
let data = categories
if (dataList.secondCategories) {
data = dataList.secondCategories
}
return [{
...dealAxisFormatter({
...axis
}),
data: categories
},
{
...dealAxisFormatter({
...axis,
...axis.second
}),
data: data
}
]
}
return {
...dealAxisFormatter({
...axis
}),
data: categories
}
}
/**
*
......@@ -278,6 +364,44 @@ const install = (Vue, vm) => {
return axis
}
const dealAxisIndex = (datas, elementInfo) => {
const yShowDouble = elementInfo.option.yAxis.showDouble
let yflag = false
const xShowDouble = elementInfo.option.xAxis.showDouble
let xflag = false
const newData = datas.map((item, index) => {
let yAxisIndex = 0
if (yShowDouble) {
if (item.yAxisIndex) {
yAxisIndex = item.yAxisIndex
yflag = true
}
// 打开双轴的情况下,没有设置yAxisIndex的,默认数组最后的用右轴
if (datas.length > 1 && datas.length - 1 === index && !yflag) {
yAxisIndex = 1
}
}
let xAxisIndex = 0
if (xShowDouble) {
if (item.xAxisIndex) {
xAxisIndex = item.xAxisIndex
xflag = true
}
// 打开双轴的情况下,没有设置xAxisIndex的,默认数组最后的用顶轴
if (datas.length > 1 && datas.length - 1 === index && !xflag) {
xAxisIndex = 1
}
}
return {
...item,
yAxisIndex: yAxisIndex,
xAxisIndex: xAxisIndex
}
})
return newData
}
/**
* 图层关系关联 子组件获取到folderId
* @param {elements}
......@@ -287,7 +411,7 @@ const install = (Vue, vm) => {
if (element.type === 'folder') {
element.child.data.forEach(item => {
const index = elements.findIndex(ele => ele.id === item)
if(index != -1) {
if (index != -1) {
elements[index].folderId = element.id
elements[index].isChild = true
......@@ -309,7 +433,9 @@ const install = (Vue, vm) => {
getQueryFromString,
filterRequestParams,
dealTooltip,
dealAxisFormatter,
dealXAxis,
dealYAxis,
dealAxisIndex,
elementFolderId
}
}
......
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