Personfield.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. MWF.xDesktop.requireApp("process.Xform", "Personfield", null, false);
  2. MWF.xApplication.cms.Xform.Personfield = MWF.CMSPersonfield = new Class({
  3. Extends: MWF.APPPersonfield,
  4. //getDepartments: function(){
  5. // if (this.json.range=="depart"){
  6. // return this.getRange();
  7. // }
  8. // if (this.json.range=="currentdepart"){
  9. // return [this.form.businessData.document.creatorUnitName];
  10. // }
  11. // return [];
  12. //},
  13. //getCompanys: function(){
  14. // if (this.json.range=="company"){
  15. // var comp = "";
  16. // //if (this.json.rangeKey){
  17. // return this.getRange();
  18. // //}
  19. // }
  20. // if (this.json.range=="currentcompany"){
  21. // return [this.form.businessData.document.creatorTopUnitName];
  22. // }
  23. // return [];
  24. //}
  25. getSelectRange: function(){
  26. if (this.json.range==="unit"){
  27. return this.getScriptSelectUnit();
  28. }
  29. if (this.json.range==="draftUnit"){
  30. return this.getNextSelectUnit(this.form.businessData.document.creatorIdentity);
  31. }
  32. if (this.json.range==="currentUnit"){
  33. //目前无效 return this.getNextSelectUnit(this.form.app.currentTask.identity);
  34. }
  35. return [];
  36. },
  37. clickSelect: function(){
  38. //var names = (nameValue) ? this.getInputData().split(MWF.splitStr) : [];
  39. var values = this.getInputData();
  40. var count = (this.json.count) ? this.json.count : 0;
  41. switch (this.json.range){
  42. case "":
  43. }
  44. var selectUnits = this.getSelectRange();
  45. if (this.json.selectType=="identity"){
  46. var selectDutys = this.getSelectRangeDuty();
  47. }
  48. if (this.json.range!=="all"){
  49. if (!selectUnits.length){
  50. this.form.notice(MWF.xApplication.process.Xform.LP.noSelectRange, "error", this.node);
  51. return false;
  52. }
  53. }
  54. //if (this.json.dutyRange!=="all"){
  55. // if (!selectDutys.length){
  56. // this.form.notice(MWF.xApplication.process.Xform.LP.noSelectRange, "error", this.node);
  57. // return false;
  58. // }
  59. //}
  60. var options = {
  61. "type": this.json.selectType,
  62. "unitType": (this.json.selectUnitType==="all") ? "" : this.json.selectUnitType,
  63. "values": values,
  64. "count": count,
  65. "units": selectUnits,
  66. "dutys": (this.json.selectType=="identity") ? selectDutys : [],
  67. "onComplete": function(items){
  68. var values = [];
  69. items.each(function(item){
  70. values.push(MWF.org.parseOrgData(item.data));
  71. }.bind(this));
  72. this.setData(values);
  73. //this._setBusinessData(values);
  74. this.validationMode();
  75. this.validation()
  76. }.bind(this),
  77. "onCancel": function(){
  78. this.validation();
  79. }.bind(this),
  80. "onLoad": function(){
  81. if (this.descriptionNode) this.descriptionNode.setStyle("display", "none");
  82. }.bind(this),
  83. "onClose": function(){
  84. v = this._getBusinessData();
  85. if (!v || !v.length) if (this.descriptionNode) this.descriptionNode.setStyle("display", "block");
  86. }.bind(this)
  87. };
  88. var selector = new MWF.O2Selector(this.form.app.content, options);
  89. }
  90. });