Selaa lähdekoodia

前端:首页按赵要求调整优化

baichengfei 4 vuotta sitten
vanhempi
commit
23b412294b

+ 6 - 0
src/dashoo.cn/backend/api/business/oilsupplier/supplierStatistics/supplierStatistics.go

@@ -16,4 +16,10 @@ type OilSupplierStatistics struct {
 	RegCapital3        int
 	RegCapital4        int
 	RegCapitalBig      int
+	Year			   int
 }
+type TypeYearNum struct {
+	Year		       int
+	Type               string
+	Num 			   int
+}

+ 9 - 0
src/dashoo.cn/backend/api/business/oilsupplier/supplierStatistics/supplierStatisticsService.go

@@ -20,3 +20,12 @@ func (s *SupplierStatisticsService) GetStatisticsInfo() (model SupplierStatistic
 	s.GetEntity(&model, where)
 	return model
 }
+
+//查询数据列表
+func (s *SupplierStatisticsService) GetTypeNumByYear() (List []TypeYearNum) {
+	sql := "select click_date as Year, SupplierTypeCode as Type, count(*) as Num from " +
+		" (select SupplierTypeCode, AddinTime, DATE_FORMAT( AddinTime, '%Y' ) AS click_date  from `OilSupplierCert` where (AddinTime is not null and AddinTime != '')) c " +
+		"group by click_date, SupplierTypeCode"
+	s.DBE.Sql(sql).Find(&List)
+	return
+}

+ 43 - 8
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -4413,9 +4413,31 @@ func (this *OilSupplierController) StatisticalNum() {
 	if err != nil {
 		log.Println("统计更新首页数据失败")
 	}
+
+	typeNums := statisticService.GetTypeNumByYear()
+
+	for _, typeNum := range typeNums {
+		var typeCols []string
+		var updateNum supplierStatistics.OilSupplierStatistics
+		whereType := "Year = " + strconv.Itoa(typeNum.Year)
+		if typeNum.Type == "01" {
+			typeCols = append(typeCols, "GoodsNum")
+			updateNum.GoodsNum = typeNum.Num
+		} else if typeNum.Type == "02" {
+			typeCols = append(typeCols, "TecNum")
+			updateNum.TecNum = typeNum.Num
+		} else if typeNum.Type == "03" {
+			typeCols = append(typeCols, "BasNum")
+			updateNum.BasNum = typeNum.Num
+		}
+		err1 := statisticService.UpdateEntityBywheretbl("OilSupplierStatistics", &updateNum, typeCols, whereType)
+		if err1 != nil {
+			log.Println("统计更新首页数据失败")
+		}
+	}
 }
 
-// @Title 首页统计饼图
+// @Title 首页统计--饼图
 // @Description 首页统计饼图
 // @Success 200 {object}
 // @router /statistic [get]
@@ -4429,23 +4451,36 @@ func (this *OilSupplierController) StatisticalSupplierType() {
 	this.ServeJSON()
 }
 
-// @Title 首页统计待办
+// @Title 首页统计--折线数据-更多
+// @Description 首页统计饼图
+// @Success 200 {object}
+// @router /broken-line [get]
+func (this *OilSupplierController) BrokenLineDta() {
+	statisticsService := supplierStatistics.GetSupplierStatisticsService(utils.DBE)
+	var statisticalNums []supplierStatistics.OilSupplierStatistics
+	statisticsService.GetEntitiesByWhereOrder(&statisticalNums, "Year", "Year > 0")
+	data := statisticalNums[len(statisticalNums) -5:]
+	this.Data["json"] = &data
+	this.ServeJSON()
+}
+
+// @Title 首页统计--待办
 // @Description 首页统计图标
 // @Success 200 {object}
 // @router /todoNum [get]
 func (this *OilSupplierController) TodoNum() {
 	var todo supplier.TodoNum
-	todo.SupplierNum = this.GetTodoNum("1")
-	todo.AppendNum = this.GetTodoNum("2")
-	todo.AnnualNum = this.GetTodoNum("3")
-	todo.InfoChangeNum = this.GetTodoNum("4")
-	todo.EvaluationNum = this.GetTodoNum("10") // 业绩评价
+	todo.SupplierNum = this.getTodoNum("1")
+	todo.AppendNum = this.getTodoNum("2")
+	todo.AnnualNum = this.getTodoNum("3")
+	todo.InfoChangeNum = this.getTodoNum("4")
+	todo.EvaluationNum = this.getTodoNum("10") // 业绩评价
 
 	this.Data["json"] = &todo
 	this.ServeJSON()
 }
 
-func (this *OilSupplierController) GetTodoNum(stype string) int {
+func (this *OilSupplierController) getTodoNum(stype string) int {
 	wfNames := ""
 	//wfNames = workflow.OIL_ENUSER_SUPPLIER_APPLY  + "," + workflow.OIL_ENUSER_APPEND_APPLY + "," + workflow.OIL_INFO_CHANGE + "," + workflow.OIL_AUDIT_APPLY + "," + workflow.OIL_SUPPLIER_VERIFY+ "," + workflow.OIL_DAILY_CONTRACT_EVALUATION+ "," + workflow.OIL_ANNUAL_CONTRACT_EVALUATION+ "," + workflow.OIL_Catalog+ "," + workflow.OIL_REGISTER_APPLY
 	if stype == "1" {

+ 29 - 13
src/dashoo.cn/frontend_web/src/pages/index.vue

@@ -102,6 +102,8 @@
         RegCapital3: 0,
         RegCapital4: 0,
         RegCapitalBig: 0,
+        // 折线数据
+        LineTypeRecentFive: [],
         supplierTypeOptions: null,
         accessTypeOptions: null,
         supplierLevelOptions: null,
@@ -117,8 +119,12 @@
       }
     },
     created () {
+      // 获取待办任务数
       this.getToDoNumList()
+      // 获取饼图数据
       this.getSupplierChart()
+      // 获取折线图数据--type
+      this.getBrokenLineType()
     },
     computed: mapGetters({
       authUser: 'authUser'
@@ -143,12 +149,13 @@
                 label: {
                   connectorAllowed: false
                 },
-                pointStart: 2016
+                pointStart: this.LineTypeRecentFive[0].Year
               }
             },
             series: [{
               name: '供应商',
               color: '#4A4AFF',
+              // data: [this.LineTypeRecentFive[0].GoodsNum, this.LineTypeRecentFive[1].GoodsNum, this.LineTypeRecentFive[2].GoodsNum, this.LineTypeRecentFive[3].GoodsNum, this.LineTypeRecentFive[4].GoodsNum]
               data: [0, 0, 0, 0, 0, this.GoodsNum]
             }, {
               name: '服务商',
@@ -204,7 +211,7 @@
                 label: {
                   connectorAllowed: false
                 },
-                pointStart: 2016
+                pointStart: this.LineTypeRecentFive[0].Year
               }
             },
             series: [{
@@ -265,7 +272,7 @@
                 label: {
                   connectorAllowed: false
                 },
-                pointStart: 2016
+                pointStart: this.LineTypeRecentFive[0].Year
               }
             },
             series: [{
@@ -326,7 +333,7 @@
                 label: {
                   connectorAllowed: false
                 },
-                pointStart: 2016
+                pointStart: this.LineTypeRecentFive[0].Year
               }
             },
             series: [{
@@ -442,10 +449,10 @@
             },
             plotOptions: {
               pie: {
-                size: '100%', // 饼图大小
+                size: '70%', // 饼图大小
                 allowPointSelect: false, // 设置饼图不可点击选择
                 cursor: 'pointer',
-                depth: 30, // 饼图的厚度
+                depth: 60, // 饼图的厚度
                 dataLabels: {
                   enabled: false, // 隐藏连线提示
                   format: '{point.name}'
@@ -532,10 +539,10 @@
             },
             plotOptions: {
               pie: {
-                size: '100%', // 饼图大小
+                size: '70%', // 饼图大小
                 allowPointSelect: false, // 设置饼图不可点击选择
                 cursor: 'pointer',
-                depth: 30, // 饼图的厚度
+                depth: 60, // 饼图的厚度
                 dataLabels: {
                   enabled: false, // 隐藏连线提示
                   format: '{point.name}'
@@ -617,10 +624,10 @@
             },
             plotOptions: {
               pie: {
-                size: '100%', // 饼图大小
+                size: '70%', // 饼图大小
                 allowPointSelect: false, // 设置饼图不可点击选择
                 cursor: 'pointer',
-                depth: 30, // 饼图的厚度
+                depth: 60, // 饼图的厚度
                 dataLabels: {
                   enabled: false, // 隐藏连线提示
                   format: '{point.name}'
@@ -704,7 +711,7 @@
                 size: '100%', // 饼图大小
                 allowPointSelect: false, // 设置饼图不可点击选择
                 cursor: 'pointer',
-                depth: 30, // 饼图的厚度
+                depth: 60, // 饼图的厚度
                 dataLabels: {
                   enabled: false, // 隐藏连线提示
                   format: '{point.name}'
@@ -778,6 +785,15 @@
           })
           this.downloading = false
         })
+      },
+      getBrokenLineType () {
+        this.$axios.get('/supplier/broken-line', {}).then(res => {
+          // this.GoodsNum = res.data.GoodsNum
+          // this.BasNum = res.data.BasNum
+          // this.TecNum = res.data.TecNum
+          this.LineTypeRecentFive = res.data
+          console.log('近五年zheixan :' + res.data[0].GoodsNum)
+        })
       }
     }
   }
@@ -801,7 +817,7 @@
     flex-direction: column;
     .todo-box {
       display: flex;
-      height: 25%;
+      height: 20%;
       padding-top: 0;
       margin-bottom: 1%;
       .todo-box-item {
@@ -826,7 +842,7 @@
     }
     .chart-box {
       width: 100%;
-      height: 75%;
+      height: 80%;
       padding-top: 0;
       margin-bottom: 1%;
       .chart-box-row {