/**
 *  view/delivery/appointment_docker/appointment.ftl
 *  工厂码头
 */
let el = {
    form: '#form',
    factoryCode: "#factoryCode",
    factoryName: "#factoryName",
    dockerCode: "#dockerCode",
    dockerName: "#dockerName",
    urgentNum: "#urgentNum",
};

$(function () {
    //获取下拉框数据
    initNecessaryDatas("pc/sys/factory/rest/listAll");

    $(el.factoryCode).combobox({
        valueField: 'code',
        textField: 'codeWithDesc',
        data: getNecessaryDataList("pc/sys/factory/rest/listAll"),
        prompt: '--- 请选择 ---',
        editable: false,
        panelHeight: 'auto',
        onSelect: function (value) {
            $(el.factoryName).textbox('setValue', value.name);
        }
    });

});

/**
 * 表单提交warehouseCode
 */
function submitForm(callback) {
    if ($(el.form).form('validate')) {
        let data = $(el.form).serializeJson();
        parent.layer.load(1);
        $.post(g.ctx+'pc/order/appointmentDocker/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');
        })
    }
}



