var EditLineWidth = function (parent) {
    this.Parent = parent;
    this.Dialog = $('#edit-line-width-dialog');
    this.Config = {};

    this.Setup = function () {
        $("#width-sure-btn").on("click", this.OnSureButtonClick.bind(this));
        $("#width-cancel-btn").on("click", this.HideDialog.bind(this));
        $("#width-close").on("click", this.HideDialog.bind(this));
    };

    this.Show = function (data) {
        this.Dialog.show();
        this.Config = data;
        $("#width").textbox('setValue', data.Value);
    };

    this.OnSureButtonClick = function () {
        this.validation();
    };

    this.validation = function () {
        if ($("#width").textbox('getValue').trim() === '' || $("#width").textbox('getValue').trim === null) {
            alert('请输入宽度值');
            return
        } else {
            this.Config.Value = $('#width').textbox('getValue');
            this.UpdateLineWidth();
            this.Dialog.hide();
            this.Parent.DisabledEvent();
        }
    };

    this.UpdateLineWidth = function () {
        $.ajax({
            type: "POST",
            dataType: 'text',
            url: '/ConfigManagement/Update',
            data: this.Config,
            success: function () {
                this.Parent.ReLoadTableData();
            }.bind(this)
        });
    };

    this.HideDialog = function () {
        this.Dialog.hide();
    };
};