Преглед на файлове

报表,切换材料调差期数后,加载数据

MaiXinRong преди 3 години
родител
ревизия
d5351031b7
променени са 1 файла, в които са добавени 31 реда и са изтрити 4 реда
  1. 31 4
      app/public/report/js/rpt_custom.js

+ 31 - 4
app/public/report/js/rpt_custom.js

@@ -330,7 +330,6 @@ const rptCustomObj = (function () {
     };
 
     const reloadReportData = function (result) {
-        // hintBox.unWaitBox();
         let pageRst = result.data;
         if (result.signatureRelInfo && result.signatureRelInfo.length > 0) {
             CURRENT_ROLE_REL_ID = result.signatureRelInfo[0].id;
@@ -346,7 +345,6 @@ const rptCustomObj = (function () {
             CURRENT_ROLE_REL_ID = -1;
             ROLE_REL_LIST = [];
         }
-        // if (ROLE_REL_LIST)
         let canvas = zTreeOprObj.canvas;
         if (pageRst && pageRst.items && pageRst.items.length > 0) {
             zTreeOprObj.resetAfter(pageRst);
@@ -378,7 +376,6 @@ const rptCustomObj = (function () {
                 for (const k in result.debugInfo.key) {
                     console.log(k + ':', ...result.debugInfo.key[k]);
                 }
-                //console.log(result.debugInfo.key);
                 console.log('其他debug信息:');
                 for (const di of result.debugInfo.other) {
                     console.log(...di);
@@ -671,7 +668,7 @@ const rptCustomObj = (function () {
         for (const topItem of topTreeNodes) {
             _pushRptLine(topItem, 0);
         }
-    }
+    };
 
     const initTenderTree = function (tenders, category) {
         const gsSpread = SpreadJsObj.createNewSpread($('#gather-source-spread')[0]);
@@ -782,8 +779,38 @@ const rptCustomObj = (function () {
         }
     };
 
+    const postReportData = function (url, params, successCallback, errorCallBack, showWaiting = true) {
+        if (showWaiting) showWaitingView();
+        $.ajax({
+            type:"POST",
+            url: url,
+            data: {'params': JSON.stringify(params)},
+            dataType: 'json',
+            cache: false,
+            timeout: 60000,
+            beforeSend: function(xhr) {
+                let csrfToken = Cookies.get('csrfToken_j');
+                xhr.setRequestHeader('x-csrf-token', csrfToken);
+            },
+            success: function(result){
+                successCallback(result);
+                if (showWaiting) closeWaitingView();
+            },
+            error: function(jqXHR, textStatus, errorThrown){
+                toastr.error('error: ' + textStatus + " " + errorThrown);
+                if (errorCallBack) {
+                    errorCallBack();
+                }
+                if (showWaiting) closeWaitingView();
+            }
+        });
+    };
+
     const changeMaterial = function (obj) {
         $('#material-select').attr('m-order', $(obj).attr('m-order')).html(obj.innerText);
+        const data = {};
+        getCommonParams(data);
+        postReportData('/tender/report_api/getReport', data, reloadReportData);
     };
 
     return {