commitc6612d254b
Merge:26ee39e
f4d737e
Author: 闵 年泽 <627844378@qq.com> Date: Fri Jan 17 16:37:10 2025 +0800 Merge branch 'ldeyun' into 'master' Ldeyun See merge request cxcxt/cxc-szcx-uniapp!6 commitf4d737e827
Merge:90584ed
26ee39e
Author: 闵 年泽 <627844378@qq.com> Date: Fri Jan 17 16:36:27 2025 +0800 Merge remote-tracking branch 'remotes/origin/master' into ldeyun # Conflicts: # .env.development # .gitignore # api/renyuan.js # bpm/leaveApplication/index.vue # package-lock.json # package.json # pages.json # pages/views/renliziyuan/renyuanxinxi/index.vue # pages/views/renliziyuan/renyuanxinxi/taizhang.vue # uni_modules/trq-depart-select/components/trq-depart-select/trq-depart-select.vue commit90584edaf9
Author: 闵 年泽 <627844378@qq.com> Date: Fri Jan 17 16:29:01 2025 +0800 Squashed commit of the following: commit26ee39e9e0
Author: yangzhq68909 <993367776@qq.com> Date: Fri Jan 17 13:48:45 2025 +0800 首页值班跳转路径 commit0eb5fa4f51
Author: yangzhq68909 <993367776@qq.com> Date: Mon Jan 13 08:44:08 2025 +0800 修改流程节点开始结束中文 commitd11c9c13f2
Merge:5be34bd
f5e9d1e
Author: yangzhq68909 <993367776@qq.com> Date: Mon Jan 13 08:38:33 2025 +0800 Merge remote-tracking branch 'remotes/origin/master' into yzqUniapp # Conflicts: # .gitignore # App.vue # bpm/leaveApplication/index.vue # bpm/supervise.vue # pages.json # uni_modules/uni-data-picker/changelog.md # uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.uvue # uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue # uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.uts # uni_modules/uni-data-picker/package.json # uni_modules/uni-datetime-picker/changelog.md # uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue # uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue # uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue # uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js # uni_modules/uni-datetime-picker/package.json # uni_modules/uni-load-more/changelog.md # uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue # uni_modules/uni-load-more/package.json # uni_modules/uni-popup/changelog.md # uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue # uni_modules/uni-popup/components/uni-popup/uni-popup.vue # uni_modules/uni-popup/package.json commit5be34bd578
Author: yangzhq68909 <993367776@qq.com> Date: Mon Jan 13 08:24:57 2025 +0800 将流程信息开始结束节点改成中文 commitf5e9d1e611
Author: ldeyun <ldeyun@163.com> Date: Sun Jan 12 18:49:20 2025 +0800 添加uni-modules组件,departSelect commit23e4f9f409
Author: yangzhq68909 <993367776@qq.com> Date: Tue Jan 7 09:44:59 2025 +0800 1 commita472d67520
Author: yangzhq68909 <993367776@qq.com> Date: Mon Jan 6 10:44:29 2025 +0800 请假有效日期范围限制 commit6054db8315
Author: yangzhq68909 <993367776@qq.com> Date: Mon Dec 16 11:40:20 2024 +0800 1 commit157249f2c6
Merge:ed007cb
20ba06b
Author: yangzhq68909 <993367776@qq.com> Date: Fri Dec 6 09:03:09 2024 +0800 Merge remote-tracking branch 'remotes/origin/master' into yzqUniapp # Conflicts: # .env.development # .gitignore # manifest.json # pages/login/login.vue # unpackage/cache/apk/apkurl # unpackage/cache/apk/cmManifestCache.json # unpackage/cache/wgt/__UNI__9F097F0/pages/leave/application.css # unpackage/cache/wgt/__UNI__9F097F0/pages/tab/index.css # unpackage/cache/wgt/__UNI__F0AFD30/app-service.js # unpackage/cache/wgt/__UNI__F0AFD30/manifest.json # unpackage/dist/build/app-plus/app-service.js # unpackage/dist/build/app-plus/manifest.json # unpackage/dist/build/app-plus/pages/leave/application.css # unpackage/dist/build/app-plus/pages/login/login.css # unpackage/dist/build/app-plus/pages/tab/index.css # unpackage/dist/build/app-plus/pages/useredit/useredit.css # unpackage/dist/cache/.vite/deps/_metadata.json # unpackage/dist/cache/.vite/deps/base-64.js # unpackage/dist/cache/.vite/deps/base-64.js.map # unpackage/dist/dev/app-plus/app-service.js # unpackage/dist/dev/app-plus/manifest.json commited007cbaf6
Author: yangzhq68909 <993367776@qq.com> Date: Fri Dec 6 09:00:15 2024 +0800 请假获取部门修改 commit20ba06b4f1
Merge:fe7a52c
af4b1b6
Author: jiang <358254771@qq.com> Date: Wed Dec 4 17:04:09 2024 +0800 Merge branch 'master' of 10.75.166.171:cxcxt/cxc-szcx-uniapp commitfe7a52cfef
Author: jiang <358254771@qq.com> Date: Wed Dec 4 17:00:37 2024 +0800 忽略打包文件 commit3794abbafc
Author: jiang <358254771@qq.com> Date: Wed Dec 4 16:52:44 2024 +0800 和 commitaf4b1b6c0a
Merge:1ca340b
ecc98b1
Author: 闵 年泽 <627844378@qq.com> Date: Wed Dec 4 15:37:30 2024 +0800 Merge branch 'minUniapp' into 'master' Min uniapp See merge request cxcxt/cxc-szcx-uniapp!2 commitecc98b14a2
Author: mnz <627844378@qq.com> Date: Wed Dec 4 11:10:13 2024 +0800 修改h5 commit4c1f42de56
Author: mnz <627844378@qq.com> Date: Wed Dec 4 11:05:49 2024 +0800 1.修改app h5 commitc9ad71fe35
Author: jiang <358254771@qq.com> Date: Tue Dec 3 14:08:45 2024 +0800 发布 commitba291f2d61
Author: yangzhq68909 <993367776@qq.com> Date: Tue Dec 3 10:52:17 2024 +0800 denglu commit1ca340b23c
Merge:27c1637
c1a1127
Author: jiang wen <358254771@qq.com> Date: Tue Nov 26 08:45:17 2024 +0800 Merge branch 'yzqUniapp' into 'master' Yzq uniapp See merge request cxcxt/cxc-szcx-uniapp!1 commit0e7e8f3a8d
Author: yangzhq68909 <993367776@qq.com> Date: Tue Nov 26 08:39:05 2024 +0800 忽略unpackage文件,jiang commita252f9b88b
Author: yangzhq68909 <993367776@qq.com> Date: Tue Nov 12 16:16:01 2024 +0800 修改请假页面 commitb2664417e3
Author: yangzhq68909 <993367776@qq.com> Date: Tue Nov 12 14:42:02 2024 +0800 1 commitc1a112754c
Author: yangzhq68909 <993367776@qq.com> Date: Fri Nov 8 14:17:40 2024 +0800 1 commitccfa6e4f11
Author: yangzhq68909 <993367776@qq.com> Date: Thu Oct 31 16:38:07 2024 +0800 页面修改 commitf27c6e4ef0
Author: yangzhq68909 <993367776@qq.com> Date: Tue Oct 29 15:34:31 2024 +0800 1 commitba4d6ac0dd
Author: yangzhq68909 <993367776@qq.com> Date: Tue Oct 29 08:23:20 2024 +0800 1 commit6308621789
Author: yangzhq68909 <993367776@qq.com> Date: Fri Oct 25 11:26:14 2024 +0800 1 commit4bf243f42b
Author: yangzhq68909 <993367776@qq.com> Date: Fri Oct 25 11:02:31 2024 +0800 增加流程取回、流程作废功能 commit60e6f2bd2f
Author: yangzhq68909 <993367776@qq.com> Date: Thu Oct 24 11:15:16 2024 +0800 流程签收功能 取消组任务 commit72e1f6c02f
Author: yangzhq68909 <993367776@qq.com> Date: Tue Oct 15 08:38:47 2024 +0800 1 commite88ce332ed
Author: yangzhq68909 <993367776@qq.com> Date: Mon Oct 14 15:46:55 2024 +0800 1 commit1e857671cb
Author: yangzhq68909 <993367776@qq.com> Date: Mon Oct 14 15:22:41 2024 +0800 上传附件及回显 commit6202ab0f4c
Author: yangzhq68909 <993367776@qq.com> Date: Mon Oct 14 08:51:28 2024 +0800 1 commite73c24ff15
Author: yangzhq68909 <993367776@qq.com> Date: Sat Oct 12 09:14:27 2024 +0800 11 commit646c801665
Author: yangzhq68909 <993367776@qq.com> Date: Sat Oct 12 08:53:10 2024 +0800 1 commit767c647d4a
Author: yangzhq68909 <993367776@qq.com> Date: Thu Oct 10 16:52:10 2024 +0800 1 commit9a9e8327f6
Author: yangzhq68909 <993367776@qq.com> Date: Thu Oct 10 15:32:42 2024 +0800 1 commitc3eb02f522
Author: yangzhq68909 <993367776@qq.com> Date: Sun Sep 29 10:44:16 2024 +0800 icon修改 修改头像接口修改 commit33666985b6
Author: yangzhq68909 <993367776@qq.com> Date: Fri Sep 27 11:03:07 2024 +0800 1 commit8809cc1975
Author: yangzhq68909 <993367776@qq.com> Date: Thu Sep 26 12:06:47 2024 +0800 本地登录页面 请假类型选择 commitf9432900bd
Author: yangzhq68909 <993367776@qq.com> Date: Tue Sep 24 17:23:37 2024 +0800 1 commitc9a320ddfd
Author: yangzhq68909 <993367776@qq.com> Date: Tue Sep 24 17:21:34 2024 +0800 请假流程2.0 commite7bcd4328d
Author: yangzhq68909 <993367776@qq.com> Date: Thu Sep 19 16:13:33 2024 +0800 修改接口 commit267ba082f0
Author: yangzhq68909 <993367776@qq.com> Date: Thu Sep 19 15:12:58 2024 +0800 修改api接口路径 commit27c163736d
Author: jiang <358254771@qq.com> Date: Sat Sep 14 10:26:50 2024 +0800 数智产销APP第一版。 commit14d9997160
Author: jiang wen <358254771@qq.com> Date: Sat Sep 14 10:24:54 2024 +0800 Update README.md # Conflicts: # .env.development # .gitignore # api/renyuan.js # bpm/leaveApplication/index.vue # package-lock.json # package.json # pages.json # pages/tab/index.vue # pages/views/renliziyuan/renyuanxinxi/index.vue # pages/views/renliziyuan/renyuanxinxi/taizhang.vue # uni_modules/trq-depart-select/components/trq-depart-select/trq-depart-select.vue commit42adfc83d0
Author: ldeyun <ldeyun@163.com> Date: Mon Jan 13 10:49:20 2025 +0800 人员统计图表页面 commit26ee39e9e0
Author: yangzhq68909 <993367776@qq.com> Date: Fri Jan 17 13:48:45 2025 +0800 首页值班跳转路径 commit0eb5fa4f51
Author: yangzhq68909 <993367776@qq.com> Date: Mon Jan 13 08:44:08 2025 +0800 修改流程节点开始结束中文 commitd11c9c13f2
Merge:5be34bd
f5e9d1e
Author: yangzhq68909 <993367776@qq.com> Date: Mon Jan 13 08:38:33 2025 +0800 Merge remote-tracking branch 'remotes/origin/master' into yzqUniapp # Conflicts: # .gitignore # App.vue # bpm/leaveApplication/index.vue # bpm/supervise.vue # pages.json # uni_modules/uni-data-picker/changelog.md # uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.uvue # uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue # uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.uts # uni_modules/uni-data-picker/package.json # uni_modules/uni-datetime-picker/changelog.md # uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue # uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue # uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue # uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js # uni_modules/uni-datetime-picker/package.json # uni_modules/uni-load-more/changelog.md # uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue # uni_modules/uni-load-more/package.json # uni_modules/uni-popup/changelog.md # uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue # uni_modules/uni-popup/components/uni-popup/uni-popup.vue # uni_modules/uni-popup/package.json commit5be34bd578
Author: yangzhq68909 <993367776@qq.com> Date: Mon Jan 13 08:24:57 2025 +0800 将流程信息开始结束节点改成中文 commit23e4f9f409
Author: yangzhq68909 <993367776@qq.com> Date: Tue Jan 7 09:44:59 2025 +0800 1 commita472d67520
Author: yangzhq68909 <993367776@qq.com> Date: Mon Jan 6 10:44:29 2025 +0800 请假有效日期范围限制 commit6054db8315
Author: yangzhq68909 <993367776@qq.com> Date: Mon Dec 16 11:40:20 2024 +0800 1 commit157249f2c6
Merge:ed007cb
20ba06b
Author: yangzhq68909 <993367776@qq.com> Date: Fri Dec 6 09:03:09 2024 +0800 Merge remote-tracking branch 'remotes/origin/master' into yzqUniapp # Conflicts: # .env.development # .gitignore # manifest.json # pages/login/login.vue # unpackage/cache/apk/apkurl # unpackage/cache/apk/cmManifestCache.json # unpackage/cache/wgt/__UNI__9F097F0/pages/leave/application.css # unpackage/cache/wgt/__UNI__9F097F0/pages/tab/index.css # unpackage/cache/wgt/__UNI__F0AFD30/app-service.js # unpackage/cache/wgt/__UNI__F0AFD30/manifest.json # unpackage/dist/build/app-plus/app-service.js # unpackage/dist/build/app-plus/manifest.json # unpackage/dist/build/app-plus/pages/leave/application.css # unpackage/dist/build/app-plus/pages/login/login.css # unpackage/dist/build/app-plus/pages/tab/index.css # unpackage/dist/build/app-plus/pages/useredit/useredit.css # unpackage/dist/cache/.vite/deps/_metadata.json # unpackage/dist/cache/.vite/deps/base-64.js # unpackage/dist/cache/.vite/deps/base-64.js.map # unpackage/dist/dev/app-plus/app-service.js # unpackage/dist/dev/app-plus/manifest.json commited007cbaf6
Author: yangzhq68909 <993367776@qq.com> Date: Fri Dec 6 09:00:15 2024 +0800 请假获取部门修改 commit20ba06b4f1
Merge:fe7a52c
af4b1b6
Author: jiang <358254771@qq.com> Date: Wed Dec 4 17:04:09 2024 +0800 Merge branch 'master' of 10.75.166.171:cxcxt/cxc-szcx-uniapp commitfe7a52cfef
Author: jiang <358254771@qq.com> Date: Wed Dec 4 17:00:37 2024 +0800 忽略打包文件 commit3794abbafc
Author: jiang <358254771@qq.com> Date: Wed Dec 4 16:52:44 2024 +0800 和 commitaf4b1b6c0a
Merge:1ca340b
ecc98b1
Author: 闵 年泽 <627844378@qq.com> Date: Wed Dec 4 15:37:30 2024 +0800 Merge branch 'minUniapp' into 'master' Min uniapp See merge request cxcxt/cxc-szcx-uniapp!2 commitecc98b14a2
Author: mnz <627844378@qq.com> Date: Wed Dec 4 11:10:13 2024 +0800 修改h5 commit4c1f42de56
Author: mnz <627844378@qq.com> Date: Wed Dec 4 11:05:49 2024 +0800 1.修改app h5 commitc9ad71fe35
Author: jiang <358254771@qq.com> Date: Tue Dec 3 14:08:45 2024 +0800 发布 commitba291f2d61
Author: yangzhq68909 <993367776@qq.com> Date: Tue Dec 3 10:52:17 2024 +0800 denglu commit1ca340b23c
Merge:27c1637
c1a1127
Author: jiang wen <358254771@qq.com> Date: Tue Nov 26 08:45:17 2024 +0800 Merge branch 'yzqUniapp' into 'master' Yzq uniapp See merge request cxcxt/cxc-szcx-uniapp!1 commit0e7e8f3a8d
Author: yangzhq68909 <993367776@qq.com> Date: Tue Nov 26 08:39:05 2024 +0800 忽略unpackage文件,jiang commita252f9b88b
Author: yangzhq68909 <993367776@qq.com> Date: Tue Nov 12 16:16:01 2024 +0800 修改请假页面 commitb2664417e3
Author: yangzhq68909 <993367776@qq.com> Date: Tue Nov 12 14:42:02 2024 +0800 1 commitc1a112754c
Author: yangzhq68909 <993367776@qq.com> Date: Fri Nov 8 14:17:40 2024 +0800 1 commitccfa6e4f11
Author: yangzhq68909 <993367776@qq.com> Date: Thu Oct 31 16:38:07 2024 +0800 页面修改 commitf27c6e4ef0
Author: yangzhq68909 <993367776@qq.com> Date: Tue Oct 29 15:34:31 2024 +0800 1 commitba4d6ac0dd
Author: yangzhq68909 <993367776@qq.com> Date: Tue Oct 29 08:23:20 2024 +0800 1 commit6308621789
Author: yangzhq68909 <993367776@qq.com> Date: Fri Oct 25 11:26:14 2024 +0800 1 commit4bf243f42b
Author: yangzhq68909 <993367776@qq.com> Date: Fri Oct 25 11:02:31 2024 +0800 增加流程取回、流程作废功能 commit60e6f2bd2f
Author: yangzhq68909 <993367776@qq.com> Date: Thu Oct 24 11:15:16 2024 +0800 流程签收功能 取消组任务 commit72e1f6c02f
Author: yangzhq68909 <993367776@qq.com> Date: Tue Oct 15 08:38:47 2024 +0800 1 commite88ce332ed
Author: yangzhq68909 <993367776@qq.com> Date: Mon Oct 14 15:46:55 2024 +0800 1 commit1e857671cb
Author: yangzhq68909 <993367776@qq.com> Date: Mon Oct 14 15:22:41 2024 +0800 上传附件及回显 commit6202ab0f4c
Author: yangzhq68909 <993367776@qq.com> Date: Mon Oct 14 08:51:28 2024 +0800 1 commite73c24ff15
Author: yangzhq68909 <993367776@qq.com> Date: Sat Oct 12 09:14:27 2024 +0800 11 commit646c801665
Author: yangzhq68909 <993367776@qq.com> Date: Sat Oct 12 08:53:10 2024 +0800 1 commit767c647d4a
Author: yangzhq68909 <993367776@qq.com> Date: Thu Oct 10 16:52:10 2024 +0800 1 commit9a9e8327f6
Author: yangzhq68909 <993367776@qq.com> Date: Thu Oct 10 15:32:42 2024 +0800 1 commitc3eb02f522
Author: yangzhq68909 <993367776@qq.com> Date: Sun Sep 29 10:44:16 2024 +0800 icon修改 修改头像接口修改 commit33666985b6
Author: yangzhq68909 <993367776@qq.com> Date: Fri Sep 27 11:03:07 2024 +0800 1 commit8809cc1975
Author: yangzhq68909 <993367776@qq.com> Date: Thu Sep 26 12:06:47 2024 +0800 本地登录页面 请假类型选择 commitf9432900bd
Author: yangzhq68909 <993367776@qq.com> Date: Tue Sep 24 17:23:37 2024 +0800 1 commitc9a320ddfd
Author: yangzhq68909 <993367776@qq.com> Date: Tue Sep 24 17:21:34 2024 +0800 请假流程2.0 commite7bcd4328d
Author: yangzhq68909 <993367776@qq.com> Date: Thu Sep 19 16:13:33 2024 +0800 修改接口 commit267ba082f0
Author: yangzhq68909 <993367776@qq.com> Date: Thu Sep 19 15:12:58 2024 +0800 修改api接口路径 commit27c163736d
Author: jiang <358254771@qq.com> Date: Sat Sep 14 10:26:50 2024 +0800 数智产销APP第一版。 commit14d9997160
Author: jiang wen <358254771@qq.com> Date: Sat Sep 14 10:24:54 2024 +0800 Update README.md
531 lines
13 KiB
Vue
531 lines
13 KiB
Vue
<template>
|
||
<view class="lime-echart" :style="[customStyle]" v-if="canvasId" ref="limeEchart" :aria-label="ariaLabel">
|
||
<!-- #ifndef APP-NVUE -->
|
||
<canvas
|
||
class="lime-echart__canvas"
|
||
v-if="use2dCanvas"
|
||
type="2d"
|
||
:id="canvasId"
|
||
:style="canvasStyle"
|
||
:disable-scroll="isDisableScroll"
|
||
@touchstart="touchStart"
|
||
@touchmove="touchMove"
|
||
@touchend="touchEnd"
|
||
/>
|
||
<canvas
|
||
class="lime-echart__canvas"
|
||
v-else
|
||
:width="nodeWidth"
|
||
:height="nodeHeight"
|
||
:style="canvasStyle"
|
||
:canvas-id="canvasId"
|
||
:id="canvasId"
|
||
:disable-scroll="isDisableScroll"
|
||
@touchstart="touchStart"
|
||
@touchmove="touchMove"
|
||
@touchend="touchEnd"
|
||
/>
|
||
<view class="lime-echart__mask"
|
||
v-if="isPC"
|
||
@mousedown="touchStart"
|
||
@mousemove="touchMove"
|
||
@mouseup="touchEnd"
|
||
@touchstart="touchStart"
|
||
@touchmove="touchMove"
|
||
@touchend="touchEnd">
|
||
</view>
|
||
<canvas v-if="isOffscreenCanvas" :style="offscreenStyle" :canvas-id="offscreenCanvasId"></canvas>
|
||
<!-- #endif -->
|
||
<!-- #ifdef APP-NVUE -->
|
||
<web-view
|
||
class="lime-echart__canvas"
|
||
:id="canvasId"
|
||
:style="canvasStyle"
|
||
:webview-styles="webviewStyles"
|
||
ref="webview"
|
||
src="/uni_modules/lime-echart/static/uvue.html?v=1"
|
||
@pagefinish="finished = true"
|
||
@onPostMessage="onMessage"
|
||
></web-view>
|
||
<!-- #endif -->
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
// @ts-nocheck
|
||
// #ifndef APP-NVUE
|
||
import {Canvas, setCanvasCreator, dispatch} from './canvas';
|
||
import {wrapTouch, convertTouchesToArray, devicePixelRatio ,sleep, canIUseCanvas2d, getRect, getDeviceInfo} from './utils';
|
||
// #endif
|
||
// #ifdef APP-NVUE
|
||
import { base64ToPath, sleep } from './utils';
|
||
import {Echarts} from './nvue'
|
||
// #endif
|
||
const charts = {}
|
||
const echartsObj = {}
|
||
|
||
|
||
/**
|
||
* LimeChart 图表
|
||
* @description 全端兼容的eCharts
|
||
* @tutorial https://ext.dcloud.net.cn/plugin?id=4899
|
||
|
||
* @property {String} customStyle 自定义样式
|
||
* @property {String} type 指定 canvas 类型
|
||
* @value 2d 使用canvas 2d,部分小程序支持
|
||
* @value '' 使用原生canvas,会有层级问题
|
||
* @value bottom right 不缩放图片,只显示图片的右下边区域
|
||
* @property {Boolean} isDisableScroll
|
||
* @property {number} beforeDelay = [30] 延迟初始化 (毫秒)
|
||
* @property {Boolean} enableHover PC端使用鼠标悬浮
|
||
|
||
* @event {Function} finished 加载完成触发
|
||
*/
|
||
export default {
|
||
name: 'lime-echart',
|
||
props: {
|
||
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
||
type: {
|
||
type: String,
|
||
default: '2d'
|
||
},
|
||
// #endif
|
||
// #ifdef APP-NVUE
|
||
webviewStyles: Object,
|
||
// hybrid: Boolean,
|
||
// #endif
|
||
customStyle: String,
|
||
isDisableScroll: Boolean,
|
||
isClickable: {
|
||
type: Boolean,
|
||
default: true
|
||
},
|
||
enableHover: Boolean,
|
||
beforeDelay: {
|
||
type: Number,
|
||
default: 30
|
||
},
|
||
landscape: Boolean
|
||
},
|
||
data() {
|
||
return {
|
||
// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-ALIPAY
|
||
use2dCanvas: true,
|
||
// #endif
|
||
// #ifndef MP-WEIXIN || MP-TOUTIAO || MP-ALIPAY
|
||
use2dCanvas: false,
|
||
// #endif
|
||
ariaLabel: '图表',
|
||
width: null,
|
||
height: null,
|
||
nodeWidth: null,
|
||
nodeHeight: null,
|
||
// canvasNode: null,
|
||
config: {},
|
||
inited: false,
|
||
finished: false,
|
||
file: '',
|
||
platform: '',
|
||
isPC: false,
|
||
isDown: false,
|
||
isOffscreenCanvas: false,
|
||
offscreenWidth: 0,
|
||
offscreenHeight: 0,
|
||
};
|
||
},
|
||
computed: {
|
||
rootStyle() {
|
||
if(this.landscape) {
|
||
return `transform: translate(-50%,-50%) rotate(90deg); top:50%; left:50%;`
|
||
}
|
||
},
|
||
canvasId() {
|
||
return `lime-echart${this._ && this._.uid || this._uid}`
|
||
},
|
||
offscreenCanvasId() {
|
||
return `${this.canvasId}_offscreen`
|
||
},
|
||
offscreenStyle() {
|
||
return `width:${this.offscreenWidth}px;height: ${this.offscreenHeight}px; position: fixed; left: 99999px; background: red`
|
||
},
|
||
canvasStyle() {
|
||
return this.rootStyle + (this.width && this.height ? ('width:' + this.width + 'px;height:' + this.height + 'px') : '')
|
||
}
|
||
},
|
||
// #ifndef VUE3
|
||
beforeDestroy() {
|
||
this.clear()
|
||
this.dispose()
|
||
// #ifdef H5
|
||
if(this.isPC) {
|
||
document.removeEventListener('mousewheel', this.mousewheel)
|
||
}
|
||
// #endif
|
||
},
|
||
// #endif
|
||
// #ifdef VUE3
|
||
beforeUnmount() {
|
||
this.clear()
|
||
this.dispose()
|
||
// #ifdef H5
|
||
if(this.isPC) {
|
||
document.removeEventListener('mousewheel', this.mousewheel)
|
||
}
|
||
// #endif
|
||
},
|
||
// #endif
|
||
created() {
|
||
// #ifdef H5
|
||
if(!('ontouchstart' in window)) {
|
||
this.isPC = true
|
||
document.addEventListener('mousewheel', this.mousewheel)
|
||
}
|
||
// #endif
|
||
// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-ALIPAY
|
||
// const { platform } = uni.getSystemInfoSync();
|
||
const { platform } = getDeviceInfo();
|
||
this.isPC = /windows/i.test(platform)
|
||
// #endif
|
||
this.use2dCanvas = this.type === '2d' && canIUseCanvas2d()
|
||
},
|
||
mounted() {
|
||
this.$nextTick(() => {
|
||
this.$emit('finished')
|
||
})
|
||
},
|
||
methods: {
|
||
// #ifdef APP-NVUE
|
||
onMessage(e) {
|
||
const detail = e?.detail?.data[0] || null;
|
||
const data = detail?.data
|
||
const key = detail?.event
|
||
const options = data?.options
|
||
const event = data?.event
|
||
const file = detail?.file
|
||
if (key == 'log' && data) {
|
||
console.log(data)
|
||
}
|
||
if(event) {
|
||
this.chart.dispatchAction(event.replace(/"/g,''), options)
|
||
}
|
||
if(file) {
|
||
thie.file = file
|
||
}
|
||
},
|
||
// #endif
|
||
setChart(callback) {
|
||
if(!this.chart) {
|
||
console.warn(`组件还未初始化,请先使用 init`)
|
||
return
|
||
}
|
||
if(typeof callback === 'function' && this.chart) {
|
||
callback(this.chart);
|
||
}
|
||
// #ifdef APP-NVUE
|
||
if(typeof callback === 'function') {
|
||
this.$refs.webview.evalJs(`setChart(${JSON.stringify(callback.toString())}, ${JSON.stringify(this.chart.options)})`);
|
||
}
|
||
// #endif
|
||
},
|
||
setOption() {
|
||
if (!this.chart || !this.chart.setOption) {
|
||
console.warn(`组件还未初始化,请先使用 init`)
|
||
return
|
||
}
|
||
this.chart.setOption(...arguments);
|
||
},
|
||
showLoading() {
|
||
if(this.chart) {
|
||
this.chart.showLoading(...arguments)
|
||
}
|
||
},
|
||
hideLoading() {
|
||
if(this.chart) {
|
||
this.chart.hideLoading()
|
||
}
|
||
},
|
||
clear() {
|
||
if(this.chart) {
|
||
this.chart.clear()
|
||
}
|
||
},
|
||
dispose() {
|
||
if(this.chart) {
|
||
this.chart.dispose()
|
||
}
|
||
},
|
||
resize(size) {
|
||
if(size && size.width && size.height) {
|
||
this.height = size.height
|
||
this.width = size.width
|
||
if(this.chart) {this.chart.resize(size)}
|
||
} else {
|
||
this.$nextTick(() => {
|
||
uni.createSelectorQuery()
|
||
.in(this)
|
||
.select(`.lime-echart`)
|
||
.boundingClientRect()
|
||
.exec(res => {
|
||
if (res) {
|
||
let { width, height } = res[0];
|
||
this.width = width = width || 300;
|
||
this.height = height = height || 300;
|
||
this.chart.resize({width, height})
|
||
}
|
||
});
|
||
})
|
||
|
||
}
|
||
|
||
},
|
||
canvasToTempFilePath(args = {}) {
|
||
// #ifndef APP-NVUE
|
||
const { use2dCanvas, canvasId } = this;
|
||
return new Promise((resolve, reject) => {
|
||
const copyArgs = Object.assign({
|
||
canvasId,
|
||
success: resolve,
|
||
fail: reject
|
||
}, args);
|
||
if (use2dCanvas) {
|
||
delete copyArgs.canvasId;
|
||
copyArgs.canvas = this.canvasNode;
|
||
}
|
||
uni.canvasToTempFilePath(copyArgs, this);
|
||
});
|
||
// #endif
|
||
// #ifdef APP-NVUE
|
||
this.file = ''
|
||
this.$refs.webview.evalJs(`canvasToTempFilePath()`);
|
||
return new Promise((resolve, reject) => {
|
||
this.$watch('file', async (file) => {
|
||
if(file) {
|
||
const tempFilePath = await base64ToPath(file)
|
||
resolve(args.success({tempFilePath}))
|
||
} else {
|
||
reject(args.fail({error: ``}))
|
||
}
|
||
})
|
||
})
|
||
// #endif
|
||
},
|
||
async init(echarts, ...args) {
|
||
// #ifndef APP-NVUE
|
||
if(args && args.length == 0 && !echarts) {
|
||
console.error('缺少参数:init(echarts, theme?:string, opts?: object, callback?: function)')
|
||
return
|
||
}
|
||
// #endif
|
||
let theme=null,opts={},callback;
|
||
|
||
Array.from(arguments).forEach(item => {
|
||
if(typeof item === 'function') {
|
||
callback = item
|
||
}
|
||
if(['string'].includes(typeof item)) {
|
||
theme = item
|
||
}
|
||
if(typeof item === 'object') {
|
||
opts = item
|
||
}
|
||
})
|
||
|
||
if(this.beforeDelay) {
|
||
await sleep(this.beforeDelay)
|
||
}
|
||
let config = await this.getContext();
|
||
// #ifndef APP-NVUE
|
||
setCanvasCreator(echarts, config)
|
||
try {
|
||
this.chart = echarts.init(config.canvas, theme, Object.assign({}, config, opts))
|
||
if(typeof callback === 'function') {
|
||
callback(this.chart)
|
||
} else {
|
||
return this.chart
|
||
}
|
||
} catch(e) {
|
||
console.error(e.messges)
|
||
return null
|
||
}
|
||
// #endif
|
||
// #ifdef APP-NVUE
|
||
this.chart = new Echarts(this.$refs.webview)
|
||
this.$refs.webview.evalJs(`init(null, null, ${JSON.stringify(opts)}, ${theme})`)
|
||
if(callback) {
|
||
callback(this.chart)
|
||
} else {
|
||
return this.chart
|
||
}
|
||
// #endif
|
||
},
|
||
getContext() {
|
||
// #ifdef APP-NVUE
|
||
if(this.finished) {
|
||
return Promise.resolve(this.finished)
|
||
}
|
||
return new Promise(resolve => {
|
||
this.$watch('finished', (val) => {
|
||
if(val) {
|
||
resolve(this.finished)
|
||
}
|
||
})
|
||
})
|
||
// #endif
|
||
// #ifndef APP-NVUE
|
||
return getRect(`#${this.canvasId}`, {context: this, type: this.use2dCanvas ? 'fields': 'boundingClientRect'}).then(res => {
|
||
if(res) {
|
||
let dpr = devicePixelRatio
|
||
let {width, height, node} = res
|
||
let canvas;
|
||
this.width = width = width || 300;
|
||
this.height = height = height || 300;
|
||
if(node) {
|
||
const ctx = node.getContext('2d');
|
||
canvas = new Canvas(ctx, this, true, node);
|
||
this.canvasNode = node
|
||
} else {
|
||
// #ifdef MP-TOUTIAO
|
||
dpr = !this.isPC ? devicePixelRatio : 1// 1.25
|
||
// #endif
|
||
// #ifndef MP-ALIPAY || MP-TOUTIAO
|
||
dpr = this.isPC ? devicePixelRatio : 1
|
||
// #endif
|
||
// #ifdef MP-ALIPAY || MP-LARK
|
||
dpr = devicePixelRatio
|
||
// #endif
|
||
// #ifdef WEB
|
||
dpr = 1
|
||
// #endif
|
||
this.rect = res
|
||
this.nodeWidth = width * dpr;
|
||
this.nodeHeight = height * dpr;
|
||
const ctx = uni.createCanvasContext(this.canvasId, this);
|
||
canvas = new Canvas(ctx, this, false);
|
||
}
|
||
|
||
return { canvas, width, height, devicePixelRatio: dpr, node };
|
||
} else {
|
||
return {}
|
||
}
|
||
})
|
||
// #endif
|
||
},
|
||
// #ifndef APP-NVUE
|
||
getRelative(e, touches) {
|
||
let { clientX, clientY } = e
|
||
if(!(clientX && clientY) && touches && touches[0]) {
|
||
clientX = touches[0].clientX
|
||
clientY = touches[0].clientY
|
||
}
|
||
return {x: clientX - this.rect.left, y: clientY - this.rect.top, wheelDelta: e.wheelDelta || 0}
|
||
},
|
||
getTouch(e, touches) {
|
||
const {x} = touches && touches[0] || {}
|
||
const touch = x ? touches[0] : this.getRelative(e, touches);
|
||
if(this.landscape) {
|
||
[touch.x, touch.y] = [touch.y, this.height - touch.x]
|
||
}
|
||
return touch;
|
||
},
|
||
touchStart(e) {
|
||
this.isDown = true
|
||
const next = () => {
|
||
const touches = convertTouchesToArray(e.touches)
|
||
if(this.chart) {
|
||
const touch = this.getTouch(e, touches)
|
||
this.startX = touch.x
|
||
this.startY = touch.y
|
||
this.startT = new Date()
|
||
const handler = this.chart.getZr().handler;
|
||
dispatch.call(handler, 'mousedown', touch)
|
||
dispatch.call(handler, 'mousemove', touch)
|
||
handler.processGesture(wrapTouch(e), 'start');
|
||
clearTimeout(this.endTimer);
|
||
}
|
||
|
||
}
|
||
if(this.isPC) {
|
||
getRect(`#${this.canvasId}`, {context: this}).then(res => {
|
||
this.rect = res
|
||
next()
|
||
})
|
||
return
|
||
}
|
||
next()
|
||
},
|
||
touchMove(e) {
|
||
if(this.isPC && this.enableHover && !this.isDown) {this.isDown = true}
|
||
const touches = convertTouchesToArray(e.touches)
|
||
if (this.chart && this.isDown) {
|
||
const handler = this.chart.getZr().handler;
|
||
dispatch.call(handler, 'mousemove', this.getTouch(e, touches))
|
||
handler.processGesture(wrapTouch(e), 'change');
|
||
}
|
||
|
||
},
|
||
touchEnd(e) {
|
||
this.isDown = false
|
||
if (this.chart) {
|
||
const touches = convertTouchesToArray(e.changedTouches)
|
||
const {x} = touches && touches[0] || {}
|
||
const touch = (x ? touches[0] : this.getRelative(e, touches)) || {};
|
||
if(this.landscape) {
|
||
[touch.x, touch.y] = [touch.y, this.height - touch.x]
|
||
}
|
||
const handler = this.chart.getZr().handler;
|
||
const isClick = Math.abs(touch.x - this.startX) < 10 && new Date() - this.startT < 200;
|
||
dispatch.call(handler, 'mouseup', touch)
|
||
handler.processGesture(wrapTouch(e), 'end');
|
||
if(isClick) {
|
||
dispatch.call(handler, 'click', touch)
|
||
} else {
|
||
this.endTimer = setTimeout(() => {
|
||
dispatch.call(handler, 'mousemove', {x: 999999999,y: 999999999});
|
||
dispatch.call(handler, 'mouseup', {x: 999999999,y: 999999999});
|
||
},50)
|
||
}
|
||
}
|
||
},
|
||
// #endif
|
||
// #ifdef H5
|
||
mousewheel(e){
|
||
if(this.chart) {
|
||
// dispatch.call(this.chart.getZr().handler, 'mousewheel', this.getTouch(e))
|
||
}
|
||
}
|
||
// #endif
|
||
}
|
||
};
|
||
</script>
|
||
<style>
|
||
.lime-echart {
|
||
position: relative;
|
||
/* #ifndef APP-NVUE */
|
||
width: 100%;
|
||
height: 100%;
|
||
/* #endif */
|
||
/* #ifdef APP-NVUE */
|
||
flex: 1;
|
||
/* #endif */
|
||
}
|
||
.lime-echart__canvas {
|
||
/* #ifndef APP-NVUE */
|
||
width: 100%;
|
||
height: 100%;
|
||
/* #endif */
|
||
/* #ifdef APP-NVUE */
|
||
flex: 1;
|
||
/* #endif */
|
||
}
|
||
/* #ifndef APP-NVUE */
|
||
.lime-echart__mask {
|
||
position: absolute;
|
||
width: 100%;
|
||
height: 100%;
|
||
left: 0;
|
||
top: 0;
|
||
z-index: 1;
|
||
}
|
||
/* #endif */
|
||
</style>
|