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

META-INF.resources.modules.sys.deptpow.ctrl.deptpow.user.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 Page = require('core/page');
	
	// 编辑机构用户
	var DeptPowUserEdit = Page.extend(function() {
		var _self = this;
		
		// @override
		this.load = function(panel, data) {
			
			// 保存原始信息
			this.oldData = data;
			
			var form = panel.find('form');
			Core.ajax(Config.ContextPath+'system/userunit/'+data.unitCode+'/'+data.userCode, {
				data: {
					userStation: data.userStation,
	                userRank: data.userRank
				},
				method: 'get'
			}).then(function(data) {
				_self.data = data;
				
				form.form('disableValidation')
					.form('load', data)
					.form('readonly', 'userCode')
					.form('focus');
			});
		};
		
		// @override
		this.submit = function(panel, data, closeCallback) {
			var form = panel.find('form');
			
			form.form('enableValidation');
			var isValid = form.form('validate');
			
			if (isValid) {
				// 原始职位和岗位
				data.oldUserStation = this.oldData.userStation;
				data.oldUserRank = this.oldData.userRank;
			
				form.form('ajax', {
					url: Config.ContextPath+'system/userunit/'+data.unitCode+'/'+data.userCode,
					method: 'put',
					data: data
				}).then(closeCallback);
			}
			
			return false;
		};
		
		// @override
		this.onClose = function(table) {
			table.datagrid('reload');
		};
	});
	
	return DeptPowUserEdit;
});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy