Bladeren bron

Merge branch 'dev' of http://gogs.gzzzyd.com/xiaowenhua/vueDataV into dev

xuyunhui 5 maanden geleden
bovenliggende
commit
a4f9201957
2 gewijzigde bestanden met toevoegingen van 182 en 5 verwijderingen
  1. 4 0
      README.md
  2. 178 5
      mm/mm.config.js

+ 4 - 0
README.md

@@ -89,6 +89,10 @@ yarn build
   - https://echarts.zhangmuchen.top/#/detail?cid=xjHG-ufzOD
   - https://echarts.zhangmuchen.top/#/detail?cid=xbmSYGhnhK
   - https://echarts.zhangmuchen.top/#/detail?cid=xMQNuAkUYq
+- 数据下载
+  - https://github.com/TangSY/echarts-map-demo
+  - https://datav.aliyun.com/portal/school/atlas/area_selector
+  - https://geojson.cn/
 
 - [(上)Vue+Echarts构建可视化大数据平台实战项目分享](https://54web3.cc/blog/induction-tutorial/vue-echarts-prev-section)
 - [(下)Vue+Echarts构建大数据可视化酷炫展示公司品牌实战项目分享](https://54web3.cc/blog/induction-tutorial/vue-echarts-next-section)

+ 178 - 5
mm/mm.config.js

@@ -31,6 +31,7 @@ module.exports = async (util) => {
               util.libObj.mockjs.mock({
                 data: {
                   温度: `@integer(0, 40)`,
+                  时间: `@now()`,
                   天气: `@pick(多云, 少云, 晴, 雨, 雪, 雾, 暴雨)`,
                 },
               })
@@ -76,15 +77,23 @@ module.exports = async (util) => {
         },
       }),
       'get /api/weatherForecast': util.side({
-        tags: [`综合总览`],
-        summary: `天气预报`,
+        tags: [`综合总览`, `种值分析详情`],
+        summary: `天气预报, 实时天气`,
         async action(req, res) {
           res.json(
             wrapApiData(
               util.libObj.mockjs.mock({
                 'data|24': [
                   {
-                    '时间|+1': 0,
+                    'index|+1': 0,
+                    时间() {
+                      return util.libObj.mockjs.Random.now(
+                        `yyyy-MM-mm ${String(this.index).padStart(
+                          2,
+                          `0`
+                        )}:00:00`
+                      )
+                    },
                     温度: `@integer(0, 40)`,
                     天气: `@pick(多云, 少云, 晴, 雨, 雪, 雾, 暴雨)`,
                   },
@@ -136,8 +145,8 @@ module.exports = async (util) => {
         },
       }),
       'get /api/transplantTrendAnalysis': util.side({
-        tags: [`综合总览`],
-        summary: `移栽趋势分析`,
+        tags: [`综合总览`, `种值分析详情`],
+        summary: `移栽趋势分析, 月度移栽趋势`,
         async action(req, res) {
           res.json(
             wrapApiData(
@@ -145,9 +154,117 @@ module.exports = async (util) => {
                 'data|31': [
                   {
                     '时间|+1': 1,
+                    今年: `@integer(0, 2000)`,
+                    去年: `@integer(0, 2000)`,
+                    较上日: `@integer(0, 100)`,
+                    较去年: `@integer(0, 100)`,
+                  },
+                ],
+              })
+            )
+          )
+        },
+      }),
+      'get /base': util.side({
+        tags: [`增删改查`],
+        summary: `基地 crud`,
+        schema: {
+          query: joi
+            .object({
+              _sort: joi.string().default(`比率`).description(`排序字段`),
+              _order: joi
+                .string()
+                .default(`desc`)
+                .description(`排序方式, asc | desc`),
+              q: joi.string().description(`模糊搜索`),
+            })
+            .description(`搜索项`),
+        },
+        async action(req, res, next) {
+          next()
+        },
+      }),
+      'get /holePunchingMachine': util.side({
+        tags: [`增删改查`],
+        summary: `打孔机 crud`,
+        schema: {
+          query: joi
+            .object({
+              q: joi.string().description(`模糊搜索`),
+            })
+            .description(`搜索项`),
+        },
+        async action(req, res, next) {
+          next()
+        },
+      }),
+      'get /transplantAreaInEachRegion2': util.side({
+        tags: [`种植分析`],
+        summary: `各区域移栽面积`,
+        async action(req, res, next) {
+          res.json(
+            wrapApiData(
+              util.libObj.mockjs.mock({
+                'data|10': [
+                  {
                     名称: `@county`,
+                    已移载: `@integer(9, 9e4)`,
+                    未移栽: `@integer(9, 9e4)`,
+                    比率() {
+                      return (this.已移载 / (this.已移载 + this.未移栽)) * 100
+                    },
+                  },
+                ],
+              })
+            )
+          )
+        },
+      }),
+      'get /trendOfTransplantQuantityThisMonth': util.side({
+        tags: [`种植分析`, `种值分析详情`],
+        summary: `本月移栽数量趋势, 月度移栽面积分析`,
+        async action(req, res, next) {
+          res.json(
+            wrapApiData(
+              util.libObj.mockjs.mock({
+                'data|31': [
+                  {
+                    'index|+1': 1,
+                    时间() {
+                      return util.libObj.mockjs.Random.now(
+                        `yyyy-MM-${String(this.index).padStart(2, `0`)}`
+                      )
+                    },
+                    今年: `@integer(0, 2000)`,
+                    去年: `@integer(0, 2000)`,
+                    较上日: `@integer(0, 100)`,
+                    较去年: `@integer(0, 100)`,
+                  },
+                ],
+              })
+            )
+          )
+        },
+      }),
+      'get /thisYearsTransplantingDataTrend': util.side({
+        tags: [`种植分析`, `种值分析详情`],
+        summary: `本年移栽数据趋势, 年度移栽趋势, 年度移栽面积分析`,
+        async action(req, res, next) {
+          res.json(
+            wrapApiData(
+              util.libObj.mockjs.mock({
+                'data|12': [
+                  {
+                    'index|+1': 1,
+                    时间() {
+                      return util.libObj.mockjs.Random.now(
+                        `yyyy-${String(this.index).padStart(2, `0`)}`
+                      )
+                    },
                     今年: `@integer(0, 2000)`,
                     去年: `@integer(0, 2000)`,
+                    较上日: `@integer(0, 100)`,
+                    较去年: `@integer(0, 100)`,
                   },
                 ],
               })
@@ -155,6 +272,24 @@ module.exports = async (util) => {
           )
         },
       }),
+      'get /api/transplantData': util.side({
+        tags: [`种值分析详情`],
+        summary: `移栽数据`,
+        async action(req, res) {
+          res.json(
+            wrapApiData(
+              util.libObj.mockjs.mock({
+                data: {
+                  处理率: `@integer(0, 100)`,
+                  今日种植数: `@integer(9, 9e4)`,
+                  目标移栽数: `@integer(9, 9e4)`,
+                  累计移栽: `@integer(9, 9e4)`,
+                },
+              })
+            )
+          )
+        },
+      }),
       // 当为基本数据类型时, 直接返回数据, 这个接口返回 {"msg":"ok"}
       '/api/1': { msg: `ok` },
 
@@ -195,6 +330,44 @@ module.exports = async (util) => {
       },
     },
     static: [],
+    dbCover: true,
+    db: util.libObj.mockjs.mock({
+      'base|10': [
+        {
+          'id|+1': 1,
+          名称: `@county()@ctitle()基地`,
+          温度: `@integer(0, 40)`,
+          管理人员: `@cname`,
+          联系电话: `@phone`,
+          简介: `<p>@cparagraph()</p><p>@cparagraph()</p><p>@cparagraph()</p><p>@cparagraph()</p><p>@cparagraph()</p><p>@cparagraph()</p>`,
+          面积: `@integer(9e3, 9e4)`,
+          烟农数量: `@integer(10, 999)`,
+          天气: `@pick(多云, 少云, 晴, 雨, 雪, 雾, 暴雨)`,
+          已种植: `@integer(9, 9e4)`,
+          未种植: `@integer(9, 9e4)`,
+          地址: `@county()@ctitle()`,
+          '图片|1-5': [`@image`],
+          完成率() {
+            return (this.已种植 / (this.已种植 + this.未种植)) * 100
+          },
+        },
+      ],
+      'holePunchingMachine|10': [
+        {
+          'id|+1': 1,
+          名称: `@county()@ctitle()基地打孔机`,
+          管理人员: `@cname`,
+          ip: `@ip`,
+          投入时间: `@date`,
+          联系电话: `@phone`,
+          '图片|1-5': [`@image`],
+          状态: `@pick(运行中, 待机, 故障)`,
+          完成率() {
+            return (this.已种植 / (this.已种植 + this.未种植)) * 100
+          },
+        },
+      ],
+    }),
     resHandleReplay: ({ req, res }) => wrapApiData({ code: 200, data: {} }),
     resHandleJsonApi: ({ req, res: { statusCode: code }, data }) =>
       wrapApiData({ code, data }),