cellrepot集成

image-20220729135757759

web_request({
'url':"http://localhost:5000/getrole"  //用你的地址替換這裏
,'method':'post'  //可用方法: get ,post
,'data':{'branch_no':'410000'}  //使用form提交,不需要的話,用null替換冒號後的內容
,'json':null      //使用json提交,json 和data 不能同時有值,至少有一個是null
,'headers':null   
});// 語句必須以逗號結束
var my_user_info=null;
function query_userinfo(){
  if(my_user_info==null){
    __env__.logger.Info( __page__.Cookies["access_token"] );//- 打印日誌
    var rst=web_request({
      'url':"http://localhost:5000/getrole"  //用你的地址替換這裏
      ,'method':'post'  //可用方法: get ,post
      ,'data':{'branch_no':'410000'}  //使用form提交,不需要的話,用null替換冒號後的內容
      ,'json':null      //使用json提交,json 和data 不能同時有值,至少有一個是null
      ,'headers':null   
      });// 語句必須以逗號結束
      my_user_info=eval("="+rst);
     __env__.logger.Info(rst);//- 打印日誌
  
  }
  return my_user_info
}
function before_exec() {
  query_userinfo();
  //其他判斷邏輯
}

function resetDefaultParam(name) {
    query_userinfo();
    if (name == 'projectcode')//如果參數名是dept_id,那麼缺省參數就是改wei xxxxx
    {
     return  my_user_info[projectcode];//'hlx-b2-jd';
    }
}


可以用 lastSetParam 函數,和resetDefaultParam 函數用法一樣。這個調用函數是在Gridoutput.cs 裏面。
-- 前端
append
<script>
    window.after_show_report_hook = function () {
        console.info("function report_after_show exec")
        $('form .el-form-item__content:last').append('<button id="btnExport" type="button" class="el-button form_query_button el-button--primary el-button--mini"><!----><!----><span>後臺導出</span></button>')
        $("#btnExport").click(function () {



            console.info(_this.result.form)
            var formData = {reportName:getUrlParam('reportName')}

            $.each(_this.result.form, function (i, e) {
                formData[e.name] = e.value;
            });


            const data = {
                "sourceSystem": "CellReport",
                "moudleName": "Export",
                "businessCode": "Export",
                "taskType": "api",
                "CreateBy": "yebiao",
                "IsExpire":true,
                "apiExportInfo": [{
                    "url": "http://192.168.103.102:8012/getdata",
                    "methodType": "post",
                    "formData": formData,
                    "pageName": "pageIndex",
                    "pageSizeName": "pageSize",
                    "pageSize": 10000
                }]
            }

            $.ajax({
                type: "POST",
                url: "http://192.168.103.115:10200/api/GenerateFile/AddAPIGenerateFile",
                contentType: "application/json;charset=utf-8",
                data: JSON.stringify(data),
                dataType: "json",
                success: function (message) {
                    alert("提交成功,請去下載中心查看導出數據");
                },
                error: function (message) {
                    alert("提交失敗" + JSON.stringify(message));
                }
            });

        })
    }

   //獲取url中的參數
  function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //構造一個含有目標參數的正則表達式對象
    var r = window.location.search.substr(1).match(reg);  //匹配目標參數
    if (r != null) return decodeURI (r[2]); return null; //返回參數值
  }

</script>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章