package.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. MWF.xApplication.Organization = MWF.xApplication.Organization || {};
  2. MWF.xApplication.Organization.Selector = MWF.xApplication.Organization.Selector || {};
  3. MWF.xApplication.Organization.Selector.Selector = MWF.OrgSelector = new Class({
  4. Implements: [Options],
  5. options: {
  6. "type": "person", //单个选择时的类型
  7. "types" : [], //多重选择时的类型,可选值为 person, group, company, department, identity,其他未测试
  8. "count": 0,
  9. "title": "Select Person",
  10. "groups": [], //选person, group, role 时的范围
  11. "roles": [], //选选person, group, role 时的范围
  12. "companys": [], //选 company, department, duty, identity 时的范围
  13. "departments": [], //选 company, department, duty, identity 时的范围
  14. "values": [], //单个选择时的已选id
  15. "names": [], //单个选择时的已选名称
  16. "multipleValues" : {}, //多重选择时已选id, 和 groupValues,companyValues,departmentValues,identityValues,personValues 二选一, 样例 { "group" : ["xx群组id"], "department" : ["xx部门1id":"xx部门2id"] ... }
  17. "groupValues" : [], // 多重选择时group 的已选id
  18. "companyValues" : [], // 多重选择时company 的已选id
  19. "departmentValues" : [], // 多重选择时department 的已选id
  20. "identityValues" : [], // 多重选择时identity 的已选id
  21. "personValues" : [], // 多重选择时person 的已选id,
  22. "multipleNames": {}, //多重选择时的已选name, 和 groupNames,companyNames,departmentNames,identityNames,personNames 二选一, 样例 { "group" : ["xx群组"], "department" : ["xx部门1":"xx部门2"] ... }
  23. "groupNames" : [], // 多重选择时group 的已选选值
  24. "companyNames" : [], // 多重选择时company 的已选名称
  25. "departmentNames" : [], // 多重选择时department 的已选名称
  26. "identityNames" : [], // 多重选择时identity 的已选名称
  27. "personNames" : [], // 多重选择时person 的已选名称
  28. },
  29. initialize: function(container, options){
  30. MWF.xDesktop.requireApp("Organization", "Actions.RestActions", null, false);
  31. this.setOptions(options);
  32. this.container = container;
  33. var type;
  34. if( !this.options.types || this.options.types.length == 0 ){
  35. type = this.options.type.capitalize();
  36. }else if( this.options.types.length == 1 ){
  37. type = this.options.types[0].capitalize();
  38. }
  39. if ( type ){
  40. MWF.xDesktop.requireApp("Organization", "Selector."+type, function(){
  41. this.selector = new MWF.xApplication.Organization.Selector[type](this.container, options);
  42. this.selector.load();
  43. }.bind(this));
  44. }else{
  45. MWF.xDesktop.requireApp("Organization", "Selector.MultipleSelector", function() {
  46. this.selector = new MWF.xApplication.Organization.Selector.MultipleSelector(this.container, this.options );
  47. this.selector.load();
  48. }.bind(this));
  49. }
  50. }
  51. });