Elselect.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.Elinput", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.Elselect = MWF.FCElselect = new Class({
  4. Extends: MWF.FCElinput,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_process_FormDesigner/Module/Elselect/elselect.html"
  9. },
  10. _initModuleType: function(){
  11. this.className = "Elselect";
  12. this.moduleType = "element";
  13. this.moduleName = "elselect";
  14. },
  15. _createElementHtml: function(){
  16. //var html = "<el-input placeholder=\"请输入内容\"></el-input>";
  17. var html = "<el-select";
  18. // if (this.json.description) html += " placeholder=\""+this.json.description+"\"";
  19. // if (this.json.size && this.json.size!=="default") html += " size=\""+this.json.size+"\"";
  20. // if (this.json.clearable) html += " clearable";
  21. // if (this.json.popperClass) html += " popper-class=\""+this.json.popperClass+"\"";
  22. // if (this.json.multiple ) html += " multiple";
  23. // if (this.json.collapseTags) html += " collapse-tags";
  24. // if (this.json.multipleLimit) html += " multiple-limit=\""+this.json.multipleLimit+"\"";
  25. // if (this.json.filterable) html += " filterable";
  26. // if (this.json.allowCreate) html += " allow-create";
  27. // if (this.json.noMatchText) html += " no-match-text=\""+this.json.noMatchText+"\"";
  28. // if (this.json.noDataText) html += " no-data-text=\""+this.json.noDataText+"\"";
  29. // if (this.json.filterRemote) html += " remote";
  30. // if (this.json.loadingText) html += " loading-text=\""+this.json.loadingText+"\"";
  31. // html += " :fetch-suggestions=\"$fetchSuggestions\"";
  32. // html += " v-model=\"id\"";
  33. // html += " :placeholder=\"description\"";
  34. html += " :size=\"size\"";
  35. html += " :clearable=\"clearable\"";
  36. html += " :popper-class=\"popperClass\"";
  37. html += " :multiple=\"multiple\"";
  38. html += " :collapse-tags=\"collapseTags\"";
  39. html += " :multiple-limit=\"multipleLimit\"";
  40. html += " :filterable=\"filterable\"";
  41. html += " :allow-create=\"allowCreate\"";
  42. html += " :no-match-text=\"noMatchText\"";
  43. html += " :no-data-text=\"noDataText\"";
  44. html += " :remote=\"remote\"";
  45. html += " :loading-text=\"loadingText\"";
  46. html += " :style=\"tmpElStyles\"";
  47. html += " value=\"\"";
  48. html += " :placeholder=\"id\">";
  49. //html += ">";
  50. html += "<el-option label=\"\" value=\"\"></el-option>";
  51. if (this.json.vueSlot) html += this.json.vueSlot;
  52. html += "</el-select>";
  53. return html;
  54. },
  55. _createVueData: function(){
  56. //var data = this.json;
  57. return function(){
  58. // this.json[this.json.id] = "";
  59. this.setElStyles();
  60. return Object.assign(this.json, this.tmpVueData||{});
  61. }.bind(this)
  62. },
  63. _setEditStyle_custom: function(name){
  64. // switch (name){
  65. // case "name": this.setPropertyName(); break;
  66. // case "id": this.setPropertyId(); break;
  67. // default: if (this.isPropertyLoaded) if (this.vm) this.resetElement();
  68. // }
  69. },
  70. _afterMounted: function(el, callback){
  71. this.node = el;
  72. this.node.store("module", this);
  73. this._loadVueCss();
  74. if (callback) callback();
  75. //window.setTimeout(function(){
  76. this.node.getElement("input").addEvent("click", function(e){
  77. this.selected();
  78. e.stopPropagation();
  79. }.bind(this));
  80. this.node.getElement(".el-select").addEvent("click", function(e){
  81. this.selected();
  82. e.stopPropagation();
  83. }.bind(this));
  84. },
  85. });