All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.modules.sys.optinfo.ctrl.optinfo.edit.js Maven / Gradle / Ivy

There is a newer version: 5.0.2101
Show newest version
define(function (require) {
  var Config = require('config');
  var Core = require('core/core');
  var OptInfoAdd = require('../ctrl/optinfo.add');

  var OptInfoEdit = OptInfoAdd.extend(function () {
    var _self = this;

    // @override
    this.load = function (panel, data) {
      var form = panel.find('form');

      Core.ajax(Config.ContextPath + 'system/optinfo/' + data.id, {
        type: 'json',
        method: 'get'
      }).then(function (data) {
        _self.data = data;

        form.form('disableValidation')
          .form('load', data)
          .form('readonly', 'optId')
          .form('focus');
      });
    };

    // @override
    this.submit = function (panel, data, closeCallback) {
      var form = panel.find('form');

      // 开启校验
      form.form('enableValidation');
      var isValid = form.form('validate');

      if (isValid) {
        this.newObject = form.form('value');

        form.form('ajax', {
          url: Config.ContextPath + 'system/optinfo/' + data.optId,
          method: 'put',
          data: data
        }).then(closeCallback);
      }

      return false;
    };

  });

  return OptInfoEdit;
});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy