Преглед изворни кода

前后:考察报告图片显示;合同两个结果

MAC пре 5 година
родитељ
комит
c3302c1032

+ 9 - 0
src/dashoo.cn/backend/api/business/oilcontract/contractSumScore/contractSumScore.go

@@ -129,3 +129,12 @@ type OilContractComputeSumScoreVo struct {
 	B8  	  string    `json:"B8"`
 	Evaluate 	  string    `json:"Evaluate"`
 }
+
+type OilContractSumScoreResult struct {
+	Id    		  int       `json:"Id"`
+	SupplierId    int       `json:"SupplierId"`
+	SupplierName  string    `json:"SupplierName"`
+	Amount 		  string    `json:"Amount"`
+	Result1 	  string    `json:"Result1"`
+	Result2 	  string    `json:"Result2"`
+}

+ 13 - 0
src/dashoo.cn/backend/api/business/oilcontract/contractSumScore/contractSumScoreService.go

@@ -124,4 +124,17 @@ func (s *OilContractSumScoreService) GetPagingComputeEntitiesWithOrderBytbl(page
 	}
 	return total
 }
+func (s *OilContractSumScoreService) GetSumListEntitiesWithOrderBytbl(entitiesPtr interface{}, where string) {
 
+	var sql string
+	sql =  `select contract.Id,contract.SupplierId,contract.SupplierName,contract.Amount, `
+	sql += ` ROUND(sum(case when items.ParentId = 0 AND items.Type = 1 then items.Score else 0 end)/sum(case when items.SequenceNo in  ('1') AND items.Type = 1 then 1 else 0 end),2)  Result1, `
+	sql += ` (case when items.Type = 2 AND items.Value = 0 then 0 else 1 end)  Result2 `
+	sql += ` from ` + controllers.OilContractReviewName + ` review `
+	sql += ` left join ` + controllers.OilContractName + ` contract on review.ContractId = contract.Id `
+	sql += ` left join ` + controllers.OilContractEvaluationItemsName + ` items on items.ContentReviewId = review.Id `
+	sql += ` where ` + where
+	sql += ` group by contract.Id `
+
+	s.DBE.SQL(sql).Find(entitiesPtr)
+}

+ 5 - 0
src/dashoo.cn/backend/api/controllers/base.go

@@ -314,6 +314,11 @@ type SelectIdNameModel struct {
 	Name string `json:"name"`
 }
 
+type Result struct {
+	Result1   string    `json:"Result1"`
+	Result2   string    `json:"Result2"`
+}
+
 func (this *BaseController) Prepare() {
 	find := false
 

+ 39 - 0
src/dashoo.cn/backend/api/controllers/oilcontract/contractSumScore.go

@@ -288,6 +288,45 @@ func (this *OilContractSumScoreController) GetEntity() {
 	this.ServeJSON()
 }
 
+// @Title 获取评价结果
+// @Description 获取评价结果
+// @Success 200 {object} contractSumScore.OilContractSumScore
+// @router /getresult/:supplierid [get]
+func (this *OilContractSumScoreController) GetResultEntity() {
+	Id := this.Ctx.Input.Param(":supplierid")
+	var errinfo ErrorInfo
+	if Id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+	var list []contractSumScore.OilContractSumScoreResult
+	svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
+	where := " contract.SupplierId = " + Id
+	svc.GetSumListEntitiesWithOrderBytbl(&list, where)
+	sum := 0
+	amountSum := 0
+	isResult := "1"
+	if len(list) > 0 {
+		for _, value := range list {
+			amount, _ := strconv.Atoi(value.Amount)
+			result, _ := strconv.Atoi(value.Result1)
+			sum += amount * result
+			amountSum += amount
+			if value.Result2 == "0" {
+				isResult = "0"
+			}
+		}
+	}
+	var result Result
+	result.Result1 = string(sum)
+	result.Result2 = isResult
+	this.Data["json"] = &result
+	this.ServeJSON()
+}
+
 // @Title 添加
 // @Description 新增
 // @Param 	body body contractSumScore.OilContractSumScore

+ 29 - 22
src/dashoo.cn/frontend_web/src/api/oilcontract/contractSumScore.js

@@ -1,17 +1,17 @@
-export default {
-    GetComputeList(CreateOn, params,myAxios){  //  计算列表
-        return myAxios({
-            url: '/contract-score/compute-list?CreateOn='+ CreateOn,
-            method: 'GET',
-            params: params
-          });
-    },
-    addEntity(formData, myAxios) {   // 新增年度审核
-        return myAxios({
-          url: '/contract-score/add',
-          method: 'post',
-          data: formData
-        })
+export default {
+    GetComputeList(CreateOn, params,myAxios){  //  计算列表
+        return myAxios({
+            url: '/contract-score/compute-list?CreateOn='+ CreateOn,
+            method: 'GET',
+            params: params
+          });
+    },
+    addEntity(formData, myAxios) {   // 新增年度审核
+        return myAxios({
+          url: '/contract-score/add',
+          method: 'post',
+          data: formData
+        })
       },
     updateEntity(entityId,formData, myAxios) {//编辑
       return myAxios({
@@ -35,13 +35,20 @@ export default {
         method: 'GET',
       })
     },
-
-    getList(CreateOn, params, myAxios) {
-      return myAxios({
-        url: '/contract-score/list?CreateOn='+ CreateOn,
-        method: 'GET',
-        params: params
-      });
+
+    GetResultEntity(entityId, myAxios) {
+      return myAxios({
+        url: '/contract-score/getresult/'+entityId,
+        method: 'GET',
+      })
+    },
+
+    getList(CreateOn, params, myAxios) {
+      return myAxios({
+        url: '/contract-score/list?CreateOn='+ CreateOn,
+        method: 'GET',
+        params: params
+      });
     },
     deleteEntity(entityId, myAxios) {
       return myAxios({
@@ -66,5 +73,5 @@ export default {
       })
     },
 
-
+
 }

+ 5 - 4
src/dashoo.cn/frontend_web/src/components/oilsupplier/goodsinfo.vue

@@ -1292,16 +1292,17 @@ export default {
     //   }
     // },
     imgFormat (fileurl) {
-      if (fileurl != null && fileurl != undefined && fileurl != '') {
-        let Format = fileurl.split('.')
+      let url = fileurl.split('|')
+      if (url[1] != null && url[1] != undefined && url[1] != '') {
+        let Format = url[1].split('.')
         if (Format[1] != null && Format[1] != '' && Format[1] != undefined) {
           let pictureFormat = Format[1]
           if (pictureFormat == 'jpg' || pictureFormat == 'bmp' || pictureFormat == 'png' || pictureFormat == 'gif' || pictureFormat == 'jpeg') {
-            return true
+            return false
           }
         }
       }
-      return false
+      return true
     },
     fileurlcut (val, index) {
       // let fileurlall = val.split('$')[index]

+ 9 - 0
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-service-year/_opera/operation.vue

@@ -318,6 +318,15 @@
     },
     created() {
       console.log('接受操作',this.$route.query.item)
+      if (this.$route.query.item.SupplierId > 0) {
+        api.GetResultEntity(this.$route.query.item.SupplierId, this.$axios).then(res => {
+          console.log('结果',res)
+          this.evaluateData.Result1 = res.Result1
+          this.evaluateData.Result2 = res.Result2
+        }).catch(err => {
+          console.error(err)
+        });
+      }
       this.serviceId  = this.$route.params.opera;
       if(this.serviceId != 'add' && this.serviceId>0){  //编辑进入
          this.formData.Id = this.serviceId