From ec7140ff25ebe85a21f0bdc7bbc927cd82ea08e9 Mon Sep 17 00:00:00 2001
From: ldz <1262327911@qq.com>
Date: Mon, 19 Oct 2020 18:00:51 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E8=A3=85=E6=B8=B2=E6=9F=93=E5=87=BD?=
=?UTF-8?q?=E6=95=B0=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=89=80=E6=9C=89=E5=9B=BE?=
=?UTF-8?q?=E8=A1=A8=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 172 ++++----
src/common/{echarts => echart}/index.vue | 21 +-
src/common/{echarts => echart}/theme.json | 0
.../echart/bottom/bottomLeftChart.vue | 266 ------------
.../echart/bottom/bottomLeftChart/chart.vue | 156 +++++++
.../echart/bottom/bottomLeftChart/index.vue | 141 ++++++
.../echart/bottom/bottomRightChart.vue | 403 ------------------
.../echart/bottom/bottomRightChart/chart.vue | 361 ++++++++++++++++
.../echart/bottom/bottomRightChart/index.vue | 91 ++++
.../echart/center/centerChartRate.vue | 102 -----
.../echart/center/centerChartRate/index.vue | 104 +++++
.../centerLeft/centerLeft1Chart/chart.vue | 81 ++++
.../centerLeft/centerLeft1Chart/index.vue | 36 ++
.../centerLeft/centerLeft2Chart/chart.vue | 115 +++++
.../centerLeft/centerLeft2Chart/index.vue | 121 ++++++
.../echart/centerLeft/centreLeft1Chart.vue | 82 ----
.../echart/centerLeft/centreLeft2Chart.vue | 200 ---------
.../echart/centerRight/centerRight2Chart.vue | 164 -------
.../centerRight/centerRightChart/chart.vue | 134 ++++++
.../centerRight/centerRightChart/index.vue | 62 +++
src/utils/resizeMixins.js | 9 +-
src/views/bottomRight.vue | 2 +-
src/views/centerLeft1.vue | 2 +-
src/views/centerLeft2.vue | 4 +-
src/views/centerRight2.vue | 2 +-
25 files changed, 1518 insertions(+), 1313 deletions(-)
rename src/common/{echarts => echart}/index.vue (69%)
rename src/common/{echarts => echart}/theme.json (100%)
delete mode 100644 src/components/echart/bottom/bottomLeftChart.vue
create mode 100644 src/components/echart/bottom/bottomLeftChart/chart.vue
create mode 100644 src/components/echart/bottom/bottomLeftChart/index.vue
delete mode 100644 src/components/echart/bottom/bottomRightChart.vue
create mode 100644 src/components/echart/bottom/bottomRightChart/chart.vue
create mode 100644 src/components/echart/bottom/bottomRightChart/index.vue
delete mode 100644 src/components/echart/center/centerChartRate.vue
create mode 100644 src/components/echart/center/centerChartRate/index.vue
create mode 100644 src/components/echart/centerLeft/centerLeft1Chart/chart.vue
create mode 100644 src/components/echart/centerLeft/centerLeft1Chart/index.vue
create mode 100644 src/components/echart/centerLeft/centerLeft2Chart/chart.vue
create mode 100644 src/components/echart/centerLeft/centerLeft2Chart/index.vue
delete mode 100644 src/components/echart/centerLeft/centreLeft1Chart.vue
delete mode 100644 src/components/echart/centerLeft/centreLeft2Chart.vue
delete mode 100644 src/components/echart/centerRight/centerRight2Chart.vue
create mode 100644 src/components/echart/centerRight/centerRightChart/chart.vue
create mode 100644 src/components/echart/centerRight/centerRightChart/index.vue
diff --git a/README.md b/README.md
index d83742d..14c4098 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,18 @@
## 一、项目描述
- [**React 版本请点击这里查看,全新界面超级好看!!!(o ゚ v ゚)ノ**](https://gitee.com/MTrun/react-big-screen)
-- 一个基于 vue、datav、Echart 框架的 " **数据大屏项目** ",通过 vue 组件实现数据动态刷新渲染,内部图表可实现自由替换。部分图表使用 DataV 自带组件,可进行更改,详情请点击下方 DataV 文档。
+- 一个基于 Vue、Datav、Echart 框架的 " **数据大屏项目** ",通过 Vue 组件实现数据动态刷新渲染,内部图表可实现自由替换。部分图表使用 DataV 自带组件,可进行更改,详情请点击下方 DataV 文档。
- 项目需要全屏展示(按 F11)。
-- 项目部分区域使用了全局注册方式,增加了打包体积,在实际运用中请使用**按需引入**。
+- 项目部分区域使用了全局注册方式,增加了打包体积,在实际运用中请使用 **按需引入**。
- 拉取项目之后,建议按照自己的功能区域重命名文件,现以简单的位置进行区分。
-- 项目环境:vue-cli-3.0、webpack-4.0、npm-6.13、node-v12.16。
+- 项目环境:Vue-cli-3.0、Webpack-4.0、Npm-6.13、Node-v12.16。
- 请拉取 master 分支的代码,其余是开发分支。
友情链接:
1. [Vue 官方文档](https://cn.vuejs.org/v2/guide/instance.html)
2. [DataV 官方文档](http://datav.jiaminghi.com/guide/)
-3. [echarts 实例](https://echarts.apache.org/examples/zh/index.html),[echarts API文档](https://echarts.apache.org/zh/api.html#echarts)
+3. [echarts 实例](https://echarts.apache.org/examples/zh/index.html),[echarts API 文档](https://echarts.apache.org/zh/api.html#echarts)
4. [项目 gitee 地址(国内速度快)](https://gitee.com/MTrun/big-screen-vue-datav)
项目展示
@@ -20,89 +20,91 @@
## 二、主要文件介绍
-| 文件 | 作用/功能 |
-| ------------------- | --------------------------------------------------- |
-| main.js | 主目录文件,引入Echart/DataV等文件 |
-| utils | 工具函数与 mixins 函数等 |
-| views/ index.vue | 项目主结构 |
-| views/其余文件 | 界面各个区域组件(按照位置来命名)ajax 接口请求位置 |
-| assets | 静态资源目录,放置 logo 与背景图片 |
-| assets / style.scss | 通用 CSS 文件,全局项目快捷样式调节 |
-| assets / index.scss | Index 界面的 CSS 文件 |
-| components/echart | 所有 echart 图表(按照位置来命名) |
-| common/flexible.js | flexible 插件代码(适配屏幕尺寸,定制化修改) |
+| 文件 | 作用/功能 |
+| ------------------- | --------------------------------------------------------------------- |
+| main.js | 主目录文件,引入 Echart/DataV 等文件 |
+| utils | 工具函数与 mixins 函数等 |
+| views/ index.vue | 项目主结构 |
+| views/其余文件 | 界面各个区域组件(按照位置来命名) |
+| assets | 静态资源目录,放置 logo 与背景图片 |
+| assets / style.scss | 通用 CSS 文件,全局项目快捷样式调节 |
+| assets / index.scss | Index 界面的 CSS 文件 |
+| components/echart | 所有 echart 图表(按照位置来命名) |
+| common/... | 全局封装的 ECharts 和 flexible 插件代码(适配屏幕尺寸,可定制化修改) |
## 三、使用介绍
### 启动项目
-需要提前安装好`nodejs`与`npm`,下载项目后在项目主目录下运行`npm/cnpm install`拉取依赖包,然后使用 `vue-cli` 或者直接使用命令`npm run serve`,就可以启动项目,启动项目后需要手动全屏(按 F11)。
+需要提前安装好 `nodejs` 与 `npm`,下载项目后在项目主目录下运行 `npm/cnpm install` 拉取依赖包。安装完依赖包之后然后使用 `vue-cli` 或者直接使用命令`npm run serve`,就可以启动项目,启动项目后需要手动全屏(按 F11)。如果编译项目的时候提示没有 DataV 框架的依赖,输入 `npm install @jiaminghi/data-view` 或者 `yarn add @jiaminghi/data-view` 进行手动安装。
-### 请求数据
+### 封装组件渲染图表
- 现在的项目未使用前后端数据请求,建议使用 axios 进行数据请求,在 main.js 位置进行全局配置,在 views/xx.vue 文件里进行前后端数据请求。
+所有的 ECharts 图表都是基于 `common/echart/index.vue` 封装组件创建的,已经对数据和屏幕改动进行了监听,能够动态渲染图表数据和大小。在监听窗口小大的模块,使用了节流函数来节约浏览器性能。
-- axios 的 main.js 配置参考范例(因人而异)
+项目配置了默认的 ECharts 图表样式,文件地址:`common/echart/theme.json`。
-```js
-import axios from 'axios';
+封装的渲染图表组件支持传入以下参数,可根据业务需求自行添加/删除。
-//把方法放到vue的原型上,这样就可以全局使用了
-Vue.prototype.$http = axios.create({
- //设置20秒超时时间
- timeout: 20000,
- baseURL: 'http://172.0.0.1:80080', //这里写后端地址
-});
-```
+参数名称 | 类型 | 作用/功能 |
+| -------------------| --------- | ------------------------------|
+| id | String | 唯一 id,渲染图表的节点 |
+| className | String | class样式名称 |
+| options | Object | ECharts 配置 |
+| height | String | 图表高度 |
+| width | String | 图表宽度 |
-- 在 vue 页面中调用 axios 方法并通过 props 传给 echarts 图表子组件
+### 动态渲染图表
-```js
+动态渲染图表案例为 `components` 目录下各个图表组件,index 文件负责数据获取和处理,chart 文件负责监听和数据渲染。
+
+chart 文件的主要逻辑为:
+
+```html
+
+