Przeglądaj źródła

修复期附件翻页bug

laiguoran 5 lat temu
rodzic
commit
e51f3d979c
2 zmienionych plików z 5 dodań i 5 usunięć
  1. 4 4
      app/public/js/stage.js
  2. 1 1
      app/service/stage_att.js

+ 4 - 4
app/public/js/stage.js

@@ -2823,14 +2823,14 @@ $(document).ready(() => {
 
     // 切换页数
     $('.page-select').on('click', function () {
-        const totalPageNum = $('#totalPage').text();
-        const lastPageNum = $('#currentPage').text();
+        const totalPageNum = parseInt($('#totalPage').text());
+        const lastPageNum = parseInt($('#currentPage').text());
         const status = $(this).attr('content');
         if (status === 'pre' && lastPageNum > 1) {
-            getAllList(parseInt(lastPageNum)-1);
+            getAllList(lastPageNum-1);
             $('#showAttachment').hide();
         } else if (status === 'next' && lastPageNum < totalPageNum) {
-            getAllList(parseInt(lastPageNum)+1);
+            getAllList(lastPageNum+1);
             $('#showAttachment').hide();
         }
     });

+ 1 - 1
app/service/stage_att.js

@@ -65,7 +65,7 @@ module.exports = app => {
             const sql = 'SELECT att.id, att.lid, att.uid, att.filename, att.fileext, att.filesize, att.remark, att.in_time,' +
                 ' pa.name as `username`, leg.name as `lname`, leg.code as `code`, leg.b_code as `b_code`' +
                 ' FROM ?? AS att,?? AS pa,?? AS leg' +
-                ' WHERE leg.id = att.lid AND pa.id = att.uid AND att.tid = ? AND att.sid = ? ORDER BY att.in_time DESC';
+                ' WHERE leg.id = att.lid AND pa.id = att.uid AND att.tid = ? AND att.sid = ? ORDER BY att.id DESC';
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, this.ctx.service.ledger.tableName, tid, sid];
             return await this.db.query(sql, sqlParam);
         }