Utils.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import $ from 'jquery'
  2. import { Message } from 'element-ui'
  3. //默认5种布局
  4. export const layout = {
  5. l1 : {tr1:[{colspan:1, rowspan:1, width:100, height:100, id:1}]},
  6. l2 : {tr1:[{colspan:1, rowspan:1, width:50, height:100, id:1},{colspan:1, rowspan:1, width:50, height:100, id:2}]},
  7. l3: {tr1:[{colspan:2, rowspan:1, width:100, height:50, id:1}],tr2:[{colspan:1, rowspan:1, width:50, height:50, id:2},{colspan:1, rowspan:1, width:50, height:50, id:3}]},
  8. l4: {tr1:[{colspan:2, rowspan:1, width:100, height:33, id:1}],tr2:[{colspan:1, rowspan:1, width:50, height:33, id:2},{colspan:1, rowspan:1, width:50, height:33, id:3}], tr3:[{colspan:2, rowspan:1, width:100, height:33, id:4}]},
  9. l5:{tr1:[{colspan:2, rowspan:1, width:100, height:20, id:1}],tr2:[{colspan:1, rowspan:1, width:50, height:20, id:2},{colspan:1, rowspan:1, width:50, height:20, id:3}], tr3:[{colspan:2, rowspan:1, width:100, height:20, id:4}],tr4:[{colspan:1, rowspan:1, width:50, height:20, id:5},{colspan:1, rowspan:1, width:50, height:20, id:6}],tr5:[{colspan:2, rowspan:1, width:100, height:20, id:7}]}
  10. }
  11. export const msginfo = (msg, type)=>{
  12. if(!type || type === 'error'){
  13. Message.error({message:msg, type:"error",showClose: true});
  14. }else{
  15. Message.success({message:msg, type:"success",showClose: true});
  16. }
  17. }
  18. export const findParamById = (pageInfo, id, retIndex) => {
  19. var ret = null;
  20. for(let i=0; pageInfo.params&&i<pageInfo.params.length; i++){
  21. var p = pageInfo.params[i];
  22. if(p.id == id){
  23. if(retIndex){
  24. ret = i;
  25. }else{
  26. ret = p;
  27. }
  28. }
  29. }
  30. return ret;
  31. }
  32. export const getParamTypeDesc = (paramType)=>{
  33. var tpname = "";
  34. if(paramType == "text"){
  35. tpname = "输入框";
  36. }else if(paramType == "radio"){
  37. tpname = "单选框";
  38. }else if(paramType == "checkbox"){
  39. tpname = "多选框";
  40. }else if(paramType == "dateselect"){
  41. tpname = "日历框";
  42. }else if(paramType == "monthselect"){
  43. tpname = "月份框";
  44. }else if(paramType == "yearselect"){
  45. tpname = "年份框";
  46. }
  47. return tpname;
  48. }