2
3
Просмотр исходного кода

前后:不良行为查询loading,分页

dubch 5 лет назад
Родитель
Сommit
9431f876d7

+ 19 - 0
src/dashoo.cn/backend/api/business/oilsupplier/badrecord/badrecordservice.go

@@ -116,6 +116,25 @@ func (s *BadRecordService) GetName(tableName string, where ...string) (total int
 	return total
 }
 
+func (s *BadRecordService) GetCounts(where string) (total int64) {
+	var err error
+	var resultsSlice []map[string][]byte
+
+	sql := "select count(*) from OilSupplierCertSub a LEFT JOIN OilSupplierPauseReason b ON b.Id=( SELECT Id FROM OilSupplierPauseReason t WHERE t.CertSubId=a.Id ORDER BY t.Id DESC LIMIT 1) where(" + where + ")"
+	resultsSlice, err = s.DBE.Query(sql)
+
+	//LogError(err)
+	if len(resultsSlice) > 0 {
+		results := resultsSlice[0]
+		for _, value := range results {
+			total, err = strconv.ParseInt(string(value), 10, 64)
+			LogError(err)
+			break
+		}
+	}
+	return total
+}
+
 func (s *BadRecordService) DeleteById(tableName string, id string) (err error) {
 	where := "id=" + id
 	error := s.DeleteEntityBytbl(tableName, where) //删除表头表数据

+ 3 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/badrecord.go

@@ -489,11 +489,11 @@ func (this *BadRecordController) SerachGoodsCertByCompany() {
 	sql = sql + " where a.SupplierId='"+companyId+"' and a.SupplierTypeCode='01' "+ sqlAdd +" order by a.CertSubStatus desc,a.Id asc limit "+ye+","+size+""
 	goodslist, _ = svc.DBE.QueryString(sql)
 
-	//goodsTotal,_:=svc.GetCount(tempEntity,"SupplierId='"+companyId+"' and SupplierTypeCode='01' "+ cwhere +"")
-	goodsTotal := len(goodslist)
+	goodsTotal :=svc.GetCounts("a.SupplierId='"+companyId+"' and SupplierTypeCode='01' "+ sqlAdd)
+	//goodsTotal := len(goodslist)
 	var datainfo DataInfo
 	datainfo.Items = goodslist
-	datainfo.CurrentItemCount = int64(goodsTotal)
+	datainfo.CurrentItemCount = goodsTotal
 	this.Data["json"] = &datainfo
 	this.ServeJSON()
 

+ 19 - 3
src/dashoo.cn/frontend_web/src/pages/select/badrecordselect/index.vue

@@ -75,6 +75,7 @@
                 border
                 highlight-current-row stripe
                 height="calc(100vh - 243px)"
+                v-loading="supplierLoading"
                 style="width: 100%">
         <!--内框表格剩余栏显示-->
         <el-table-column label="企业名称"
@@ -513,6 +514,7 @@
                         :data="goodsList"
                         border
                         height="300px"
+                        v-loading="goodsLoading"
                        >
                 <el-table-column prop="Code"
                                  label="编码"
@@ -570,6 +572,7 @@
                         :data="basisList"
                         border
                         height="300px"
+                        v-loading="goodsLoading"
                        >
                 <el-table-column prop="Code"
                                  label="编码"
@@ -627,6 +630,7 @@
                         :data="tcList"
                         border
                         height="300px"
+                        v-loading="goodsLoading"
                        >
                 <el-table-column prop="Code"
                                  label="编码"
@@ -1062,6 +1066,8 @@ export default {
       dataList: [],
       addshow: false,
       editshow: false,
+      goodsLoading: false,
+      supplierLoading: false,
       editId: '',
       // 定义列表数据
       entityList: [],
@@ -1402,6 +1408,8 @@ export default {
     },
 
     serachGoodsCertByCompany (event) {
+      this.goodsLoading = true
+      console.log(event, this.currentGoodsPage, 'this.currentGoodsPage')
       if (event != null) {
         this.currentGoodsPage = 1
       }
@@ -1422,12 +1430,14 @@ export default {
           } else {
             this.currentGoodsItemCount = 0
           }
+          this.goodsLoading = false
         })
         .catch(err => {
           console.error(err)
         })
     },
     serachBasisCertByCompany (event) {
+      this.goodsLoading = true
       if (event != null) {
         this.currentBasisPage = 1
       }
@@ -1448,12 +1458,14 @@ export default {
           } else {
             this.currentBasisItemCount = 0
           }
+          this.goodsLoading = false
         })
         .catch(err => {
           console.error(err)
         })
     },
     serachTCCertByCompany (event) {
+      this.goodsLoading = true
       if (event != null) {
         this.currentTCPage = 1
       }
@@ -1473,6 +1485,7 @@ export default {
           } else {
             this.currentTCItemCount = 0
           }
+          this.goodsLoading = false
         })
         .catch(err => {
           console.error(err)
@@ -1610,9 +1623,10 @@ export default {
       //   this.basisSize = 10
       //   this.tcSize = 10
 
-      //   this.currentGoodsPage = 1
-      //   this.currentBasisPage = 1
-      //   this.currentTCPage = 1
+      this.currentGoodsPage = 1
+      console.log(this.currentGoodsPage, 'currentGoodsPage')
+      this.currentBasisPage = 1
+      this.currentTCPage = 1
 
       //   this.currentGoodsItemCount = 0
       //   this.currentBasisItemCount = 0
@@ -1788,6 +1802,7 @@ export default {
       if (event != null) {
         this.currentPage = 1
       }
+      this.supplierLoading = true
 
       let myCreateOn = []
       // 解析时间
@@ -1810,6 +1825,7 @@ export default {
         .then(res => {
           this.entityList = res.data.items
           this.currentItemCount = res.data.currentItemCount
+          this.supplierLoading = false
         })
         .catch(err => {
           console.error(err)