
/**
 * 显示面谈模板框
 * @param {*} currentPeriod 
 * @param {*} categoryNumber I
* @param {*} hrorg 
 * @returns 
 */
function showInterviewDialog(currentPeriod, categoryNumber, hrorg) {
    $(document.body).append(interviewDialogHtml(isOrg));
    //消息模板
    var messageTemplate_f7_json = { id: "messageTemplate", name: "messageTemplate", value: getDefaultTemplateAction(categoryNumber, hrorg) };
    messageTemplate_f7_json.subWidgetName = 'specialPromptGrid';
    messageTemplate_f7_json.subWidgetOptions = {
        title: jsBizMultLan.perfweb_evaResultManagerList_keymsf_i18n_titel,
        uipk: "com.kingdee.shr.perfweb.app.base.notice.MessageTemplate.available.F7",
        query: "",
        isHRBaseItem: true,
        f7ReKeyValue: "BaseInfo.id:BaseInfo.longName",
        currentHrOrgUnitId: hrorg,
        filter: "hrOrgUse.id = '" + hrorg + "' and busiCategory.number = '" + categoryNumber + "'",
        bizFilterFieldsValues: "bizFilterFields=undefined:" + encodeURIComponent(hrorg),
        filterConfig: [{ name: '', value: true, alias: '', widgetType: 'no' }],
        validate: '{required:true}'
    };
    $('#messageTemplate').shrPromptBox(messageTemplate_f7_json);
    $('#messageTemplateForm').shrForm({ id: "messageTemplateForm" });//包裹一个form, 为了提供validate功能
    // $('#messageTemplate').shrPromptBox('addRules', {required:true});//style="height: 296px; width: auto; min-height: 0px; max-height: none;"
    $('#messageTemplate').shrPromptBox('option', { height: '30px' });
    $("#interviewDialog").dialog({
        autoOpen: true,
        show: "blind",
        width: 610,
        height: $('iframe', parent.document).height() > 400 ? 400 : $('iframe', parent.document).height(),
        title: "推送面谈通知",
        resizable: true,
        position: ['center', 'center'],
        modal: true,
        buttons: [{
            text: jsBizMultLan.perfweb_evaResultManagerList_1585548352752_i18n_18,
            click: function () {
                var msgTempID = $('#messageTemplate_el').val(); //消息模板id
                if (!msgTempID || msgTempID == '') {
                    shr.showWarning({
                        message: "请选择面谈通知模板",
                        hideAfter: 3
                    });
                    return;
                }
                //审核操作
                that.doRemoteWithBatchExtendAction({
                    method: "sendInterviewNotice",
                    type: '600', //列表页签类型-未审核
                    period: currentPeriod,
                    messageService: '面谈通知', //考核结果通知
                    SMSType: "NOSEND",
                    emailType: "NOSEND",
                    portalType: "SEND",
                    yzjMsgType: "NOSEND",
                    msgTempID: msgTempID,
                    isCharger: 1,
                });
                $(this).dialog('close');
            }
        }, {
            text: jsBizMultLan.perfweb_evaResultManagerList_1585548352752_i18n_17,
            click: function () {
                $(this).dialog('close');
            }
        }],
        close: function () {
            $('#interviewDialog').remove();
        }
    });
    //监听动态元素，使用live ，change 为动态元素监听事件
    $('#messageTemplate').live("change", function () {
        var selectedValue = $('#messageTemplate').shrPromptBox("getValue")['BaseInfo.name'];
        $('#messageTemplate').val(selectedValue);
        if ($('#messageTemplate').val()) {
            $('label[for="messageTemplate"]').remove();
        }
    });
}
/**
 *面谈通知弹出框
 * @returns
 */
function interviewDialogHtml() {
    var html = '<div id="interviewDialog" class="dialog">' +
        '<div class="dialogtitle">' +
        '<span class="icon_i_b"></span>' +
        '<span>给对应考核责任人发送sHR系统消息' +
        '</span>' +
        '</div>' +
        '<br/>' +
        '<div class="ways-box-wrap">' +
        '<span class="span_name">请选择面谈消息模板</span>'
        + '<form id="messageTemplateForm" action="messageTemplateForm"   class = "col-lg-14 ">'
        + '<input type="text" id="messageTemplate"  name="messageTemplate" class="bg_lightblue " style="border-width: 0px;height: 25px;">'
        + '<input id="messageTemplateHiddenText" type="text" style="display:none;height: 25px;" />'
        + '</form>' +
        '</div>' +
        '</div>';
    return $(html);
}
