Browse Source

口头,延迟报告代码优化(下拉刷新数据展示)

lidie 1 year ago
parent
commit
f894f022a6

+ 15 - 8
src/views/platform/bpmn/report/delayReport.vue

@@ -279,6 +279,8 @@ export default {
       */
         async loadData() {
             this.loading = true
+            this.noData = false
+            this.footText = false
             await this.getPositionobj()
             let page = 0
             if (this.current === 0) {
@@ -289,23 +291,28 @@ export default {
             const key = this.subject
             const sql = `select t_ycbgjlb.*,(case t_ycbgjlb.fu_jian_ when '' then '空' else t_ycbgjlb.fu_jian_ END) as aa,g.bianzhibumen,g.bianzhiren,g.shenheren,g.jieshouzhe from t_ycbgjlb LEFT JOIN (select e.*,f.jieshouzhe from (select c.*,d.shenheren from (select a.*,b.bianzhiren from (select t.id_ ,group_concat(u.name_ order by find_in_set(u.id_,t.bian_zhi_bu_men_)) as bianzhibumen  from t_ycbgjlb as t inner join ibps_party_position as u on find_in_set(u.id_,t.bian_zhi_bu_men_)>0 group by t.id_ ORDER BY  t.create_time_ DESC) as a LEFT JOIN (select t.id_ ,u.NAME_ as bianzhiren from t_ycbgjlb as t inner join ibps_party_employee as u on find_in_set(u.id_,t.bian_zhi_ren_)>0 group by t.id_ ORDER BY  t.create_time_ DESC) as b on a.id_ = b.id_) as c LEFT JOIN (select t.id_ ,u.NAME_ as shenheren from t_ycbgjlb as t inner join ibps_party_employee as u on find_in_set(u.id_,t.shen_he_ren_)>0 group by t.id_ ORDER BY  t.create_time_ DESC) as d on c.id_ = d.id_) as e LEFT JOIN (select t.id_ ,group_concat(u.name_ order by find_in_set(u.id_,t.jie_shou_zhe_)) as jieshouzhe from t_ycbgjlb as t inner join ibps_party_employee as u on find_in_set(u.id_,t.jie_shou_zhe_)>0 group by t.id_ ORDER BY  t.create_time_ DESC) as f on e.id_ = f.id_)as g on t_ycbgjlb.id_ =g.id_ where find_in_set(t_ycbgjlb.bian_zhi_bu_men_,'${this.positionObj}') and t_ycbgjlb.yang_pin_hao_ like'%` + key + `%' ORDER BY t_ycbgjlb.create_time_ DESC LIMIT ${page},10`
             this.$common.request('sql', sql).then(res => {
-                if (this.current === 0 && res.variables.data.length === 0) {
+                if (res.variables.data.length === 0) {
+                    if (this.current === 0) {
+                        this.noData = true
+                    } else {
+                        this.footText = true
+                    }
                     this.finished = true
-                    this.noData = true
-                    this.footText = false
+                    this.loading = false
+                    this.refreshing = false
                     return
                 }
-                ActionUtils.handleListData(this, res.variables)
-                const data = res.variables.data
-                this.listData.push(...data)
-                if (this.listData.length !== 0 && (this.listData.length) % 10 !== 0) {
+                this.listData.push(...res.variables.data)
+                // 判断是否还有更多数据
+                if ((this.listData.length) % 10 !== 0) {
                     this.footText = true
-                    this.noData = false
                     this.finished = true
                 } else {
                     this.current++
                 }
+
                 this.loading = false
+                this.refreshing = false
             })
         },
         // 获取positionobj数据

+ 17 - 9
src/views/platform/bpmn/report/oralReport.vue

@@ -306,6 +306,8 @@ export default {
       */
         async loadData() {
             this.loading = true
+            this.noData = false
+            this.footText = false
             await this.getPositionobj()
             let page = 0
             if (this.current === 0) {
@@ -316,24 +318,30 @@ export default {
             const key = this.subject
             const sql = `select t_ktbglcjgjlb.*,(case t_ktbglcjgjlb.fu_jian_ when '' then '空' else t_ktbglcjgjlb.fu_jian_ END) as aa,c.bianzhibumen,c.bianzhiren from t_ktbglcjgjlb LEFT JOIN (select a.*,b.bianzhiren from(select t.id_ ,group_concat(u.name_ order by find_in_set(u.id_,t.bian_zhi_bu_men_)) as bianzhibumen  from t_ktbglcjgjlb as t inner join ibps_party_position as u on find_in_set(u.id_,t.bian_zhi_bu_men_)>0 group by t.id_ ORDER BY  t.create_time_ DESC) as a LEFT JOIN(select t.id_ ,u.NAME_ as bianzhiren from t_ktbglcjgjlb as t inner join ibps_party_employee as u on find_in_set(u.id_,t.bian_zhi_ren_)>0 group by t.id_ ORDER BY  t.create_time_ DESC) as b on a.id_ = b.id_) as c on c.id_ =t_ktbglcjgjlb.id_ where find_in_set(t_ktbglcjgjlb.bian_zhi_bu_men_,'${this.positionObj}') and t_ktbglcjgjlb.xing_ming_ like'%` + key + `%' ORDER BY  t_ktbglcjgjlb.create_time_ DESC LIMIT ${page},10`
             this.$common.request('sql', sql).then(res => {
-                if (this.current === 0 && res.variables.data.length === 0) {
+                if (res.variables.data.length === 0) {
+                    if (this.current === 0) {
+                        this.noData = true
+                    } else {
+                        this.footText = true
+                    }
                     this.finished = true
-                    this.noData = true
-                    this.footText = false
+                    this.loading = false
+                    this.refreshing = false
                     return
                 }
-                // console.log("res获取到的数据", res);
-                ActionUtils.handleListData(this, res.variables)
-                const data = res.variables.data
-                this.listData.push(...data)
-                if (this.listData.length !== 0 && (this.listData.length) % 10 !== 0) {
+
+                this.listData.push(...res.variables.data)
+
+                // 判断是否还有更多数据
+                if ((this.listData.length) % 10 !== 0) {
                     this.footText = true
                     this.finished = true
-                    this.noData = false
                 } else {
                     this.current++
                 }
+
                 this.loading = false
+                this.refreshing = false
             })
         },
         // 获取positionobj数据