/**
 *  view/delivery/appointment_dayoff/detail.js
 *  法定节假日
 */

let el = {
    form: '#form',
    day: "#day",
    type: "#type",
    viewType:'#viewType'
};

$(function () {
    if ($(el.viewType).val() === '1') {
        laydate.render({
            elem: el.day
        });
    }


    $(el.type).combobox({
        valueField: 'value',
        textField: 'label',
        data: [
            {label: '法定节假日', value: 1},
            {label: '周末', value: 2}
        ],
        editable: false,
        panelHeight: 'auto',
    });

});

/**
 * 表单提交warehouseCode
 */
function submitForm(callback) {
    if ($(el.form).form('validate')) {
        let data = $(el.form).serializeJson();
        parent.layer.load(1);
        $.post(g.ctx+'pc/order/appointmentDayOff/rest/save', {data: JSON.stringify(data)}, function () {
            parent.layer.msg('保存成功');
            callback();
        }).error(function (data) {
            let msg = JSON.parse(data['responseText'])['message'];
            layer.msg('保存失败！ ' + msg);
        }).complete(function () {
            parent.layer.closeAll('loading');
        })
    }
}



