提交后刷新本页面与移除本页面的JS写法

@section script {
    <script src="/res/js/webuploader.nolog.js" type="text/javascript"></script>
    <link href="/res/css/webuploader.css" rel="stylesheet" type="text/css" />
    <script>

        var myDate = new Date(new Date().getTime() - 300000);//初始化时间为当前时间的5分钟前

        function BtnSubmit_Click() {
            F.ui.btnIndexSubmit.disable();//禁用该按钮控件
           
            postBack();
        }


    function onOperationClick(data) {
                        parent.RefreshFlow(F.ui.TMsgID.getText());
                        new F.MessageBox({
                            message: data,
                            title: '提交成功',
                            closable: false,
                            buttons: [{
                                buttonId: 'ok',
                                text: '再次立项'
                            }, {
                                buttonId: 'cancel',
                                text: '退出'
                            }],
                            handler: function (event, buttonId) {
                                if (buttonId === 'ok') {
                                    window.location.reload();//刷新本页面
                                }
                                else {
                                    parent.removeTab();
                                }
                            }
                        })
        }



        function onFinishClick(data) {
            //console.log(55);
            parent.RefreshFlow(F.ui.TMsgID.getText());
            new F.MessageBox({
                message: data,
                title: '提交成功',
                closable: false,
                buttons: [{
                    buttonId: 'ok',
                    text: '确定'
                }],
                handler: function (event, buttonId) {
                    if (buttonId === 'ok') {
                        //window.location.reload();//刷新本页面
                        parent.removeTab();
                    } else {
                        parent.removeTab();
                    }
                }
            })
        }

            //点了保存按钮会触发的事件
            function postBack(isupdate) {
                if (isupdate == 0) {
                    F.doPostBack({
                        url: '@Url.Action("btnUpdateParentGrid_Click")',
                        fields: 'MainPanel',
                        params: {
                            //FormFileds: getFields(F.ui.form1),
                            // ISSuccess: true,
                            //  GridUpLoader_Data: F.toJSON(F.ui.GridUpLoader.getMergedData()),
                            // GridOrderItem_Data: F.ui.GridOrderItem ? F.toJSON(F.ui.GridOrderItem.getMergedData()) : null
                        },
                        complete: function (data) {
                            // F.ui.btnIndexSubmit.enable();//启用该按钮控件

                            F.activeWindow.hide();

                        }
                    });
                } else {                  
                                 F.doPostBack({
                            url: '@Url.Action("UpdateSaleAfterDTID")',
                                     fields: 'MainForm1',
                            params: {
                                isupdate: '1',
                            },
                              complete: function (data) {
                             
                                  //F.activeWindow.hide();

                            }
                        });
                }

        };

        // 打开窗体
        function openWindow(rowData) {
            rowData = "测试数据";
            // IFrame/GridIFrameReload/IFrameWindow?id=104&name=刘国
            var iframeWindowUrl = '@Url.Content("~/IFrame/GridIFrameReload/IFrameWindow")';
            //var iframeUrl = iframeWindowUrl + '?id=' + rowData.id + '&name=' + encodeURIComponent(rowData.text);

            // 显示窗体
            F.ui.Window1.show(iframeUrl, '详细信息 - ' + rowData.text);
        }
        function onWindow1Close(event) {

        }

        function openWAddSaleAfterDTID() {
            //打开一个窗口
            openWindow();
        }
        function Item_no_TextChanged(data) {
           // alert(data);324075
           // alert(F.ui.FNRID.getValue());373
          //  return;
            var TMID = F.ui.TMID.getValue();

            if (TMID == null || TMID == '' || TMID == 0) {
                // 触发后台事件
                F.doPostBack({
                    url: '@Url.Action("Item_no_TextChanged")',
                    params: {
                        OrderID: data,
                        FNRID: F.ui.FNRID.getValue()
                    },
                    fields: 'GridOrderItem'
                })
            } else { showMessage("已发起的流程不允许重新参考项目"); }
        }




         F.ready(function () {

             F.ui.ReasonClass.on('change', function () {
                 if (F(this).getValue()=='外部原因') {
                     F.ui.ResponsibilityProcess.setValue('客户');
                     F.ui.ResponsibilityProcess.setText('客户');
                     F.ui.ResponsibilityDepartment.setText('客户');
                     F.ui.ResponsibilityDepartment.setValue('客户');
                 } else if(F(this).getValue() == '内部原因'){
                     F.ui.ResponsibilityProcess.setValue('');
                     F.ui.ResponsibilityProcess.setText('');
                     F.ui.ResponsibilityDepartment.setText('');
                     F.ui.ResponsibilityDepartment.setValue('');
                 }

             });


        });

    </script>
}

  

posted @ 2019-12-27 08:52  咖啡无眠  阅读(532)  评论(0编辑  收藏  举报