Browse Source

fix(首页图表):新增及转换项目添加月份下拉

wanglj 2 năm trước cách đây
mục cha
commit
26416e543b
1 tập tin đã thay đổi với 12 bổ sung5 xóa
  1. 12 5
      src/views/index/index.vue

+ 12 - 5
src/views/index/index.vue

@@ -1,8 +1,8 @@
 <!--
  * @Author: wanglj 471442253@qq.com
  * @Date: 2022-12-13 10:28:33
- * @LastEditors: niezch@dashoo.cn
- * @LastEditTime: 2023-04-03 09:28:45
+ * @LastEditors: wanglj
+ * @LastEditTime: 2023-06-09 16:01:18
  * @Description: file content
  * @FilePath: \opms_frontend\src\views\index\index.vue
 -->
@@ -98,6 +98,12 @@
                 <el-radio-button label="week">周</el-radio-button>
                 <el-radio-button label="month">月</el-radio-button>
               </el-radio-group>
+              <el-select
+                v-show="!editFlag && item.i == 20010 && item.searchType == 'month'"
+                v-model="item.month"
+                style="width: 100px">
+                <el-option v-for="i in 12" :key="i" :label="i" :value="i" />
+              </el-select>
               <el-select
                 v-show="!editFlag && item.i == 20009"
                 v-model="item.searchType"
@@ -460,6 +466,7 @@
                 }
                 // item.id != 20006 && item.id != 20007 ? 'year' : '0'
               })(),
+              month: new Date().getMonth() + 1,
             }
           })
         }
@@ -501,7 +508,7 @@
         } else if (item.i == 20009) {
           this.getTable(item.i, index, item.searchType)
         } else if (item.i == 20010) {
-          this.drawProjectTrans(item.i, index, item.searchType)
+          this.drawProjectTrans(item.i, index, item.searchType, item.month)
         } else if (item.i == 20011) {
           this.drawMoneyAmount(item.i, index, item.searchType)
         } else if (item.i == 20012) {
@@ -639,8 +646,8 @@
         chartBar.setOption(option)
         this.charts[i] = chartBar
       },
-      async drawProjectTrans(id, i, searchType = 'week') {
-        const [err, res] = await to(indexApi.getHomeDataReportData({ id, Params: { searchType } }))
+      async drawProjectTrans(id, i, searchType = 'week', month = new Date().getMonth() + 1) {
+        const [err, res] = await to(indexApi.getHomeDataReportData({ id, Params: { searchType, month } }))
         if (err) return
         const arr = res.data.data || []
         const chartBar = echarts.init(document.getElementById(id))