/**
 *
 * @author BOGON
 * @version 1.0
 */

var bidComm = {
    dialogElement: {},
    closeDialog: function () {
        bidComm.dialogElement.dialog('close');
        page.dataGrid.datagrid("reload")
    },
    openDetailDialog: function (type, id, tenderId) {
        var btn = [];
        switch (type) {
            //投标保存
            case 1:
                btn.push({
                    text: buttonI18n.save,
                    handler: function () {
                        topWin.frames['supplierInfoDialog'].page.saveDetail();
                    }
                });
                break;
            case 2:
                //议价
                btn.push({
                    text: tenderTxt.bargaining,
                    handler: function () {
                        topWin.frames['supplierInfoDialog'].page.bargaining(bidComm.closeDialog);
                    }
                });
                break;
            default:
                break;
        }

        btn.push({
            text: buttonI18n.close,
            handler: function () {
                bidComm.closeDialog();
            }
        });
        var url = "";
        url = g.ctx + "pc/tender/bid/page/detail?id=" + id + "&type=" + type + "&tenderId=" + tenderId;

        bidComm.dialogElement = openDialog("supplierInfoDialog", url, {
            title: tenderBtns.bid,
            width: '100%',
            height: '100%',
            cache: false,
            modal: true,
            border: false,
            draggable: false,
            shadow: false,
            onClose: function () {
                bidComm.dialogElement.dialog('destroy');
            },
            buttons: btn
        });
    }
}