Elswitch.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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.Elswitch = MWF.FCElswitch = new Class({
  4. Extends: MWF.FCElinput,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_process_FormDesigner/Module/Elswitch/elswitch.html"
  9. },
  10. _initModuleType: function(){
  11. this.className = "Elswitch";
  12. this.moduleType = "element";
  13. this.moduleName = "elswitch";
  14. },
  15. _createElementHtml: function(){
  16. //var html = "<el-input placeholder=\"请输入内容\"></el-input>";
  17. var html = "<el-switch v-model=\""+this.json.id+"\"";
  18. // if (this.json.description) html += " placeholder=\""+this.json.description+"\"";
  19. // if (this.json.width) html += " width=\""+(this.json.width||40)+"\"";
  20. // if (this.json.activeText) html += " active-text=\""+this.json.activeText+"\"";
  21. // if (this.json.inactiveText) html += " inactive-text=\""+this.json.inactiveText+"\"";
  22. // if (this.json.activeColor) html += " active-color=\""+(this.json.activeColor||"#409EFF")+"\"";
  23. // if (this.json.inactiveColor) html += " inactive-color=\""+(this.json.inactiveColor||"#C0CCDA")+"\"";
  24. // if (this.json.activeIconClass) html += " active-icon-class=\""+this.json.activeIconClass+"\"";
  25. // if (this.json.inactiveIconClass) html += " inactive-icon-class=\""+this.json.inactiveIconClass+"\"";
  26. html += " :width=\"width\"";
  27. html += " :active-text=\"activeText\"";
  28. html += " :inactive-text=\"inactiveText\"";
  29. html += " :active-color=\"activeColor\"";
  30. html += " :inactive-color=\"inactiveColor\"";
  31. html += " :active-icon-class=\"activeIconClass\"";
  32. html += " :inactive-icon-class=\"inactiveIconClass\"";
  33. html += " :style=\"tmpElStyles\"";
  34. html += "></el-switch>";
  35. return html;
  36. },
  37. _createVueData: function(){
  38. //var data = this.json;
  39. return function(){
  40. this.json[this.json.id] = true;
  41. this.setElStyles();
  42. return Object.assign(this.json, this.tmpVueData||{});
  43. }.bind(this);
  44. },
  45. _setEditStyle_custom: function(name){
  46. switch (name){
  47. case "name": this.setPropertyName(); break;
  48. case "id": this.setPropertyId(); break;
  49. case "width":
  50. this.json.width = this.json.width.toFloat();
  51. if (this.isPropertyLoaded) if (this.vm) this.resetElement(); break;
  52. default: ;
  53. }
  54. },
  55. setPropertyName: function(){},
  56. setPropertyId: function(){}
  57. });