autostruct.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import request from '@/router/axios';
  2. export const getList = (current, size, params) => {
  3. return request({
  4. url: '/api/bank/autostruct/list',
  5. method: 'get',
  6. params: {
  7. ...params,
  8. current,
  9. size,
  10. }
  11. })
  12. }
  13. export const getDetail = (id) => {
  14. return request({
  15. url: '/api/bank/autostruct/detail',
  16. method: 'get',
  17. params: {
  18. id
  19. }
  20. })
  21. }
  22. export const remove = (ids) => {
  23. return request({
  24. url: '/api/bank/autostruct/remove',
  25. method: 'post',
  26. params: {
  27. ids,
  28. }
  29. })
  30. }
  31. export const add = (row) => {
  32. return request({
  33. url: '/api/bank/autostruct/submit',
  34. method: 'post',
  35. data: row
  36. })
  37. }
  38. export const update = (row) => {
  39. return request({
  40. url: '/api/bank/autostruct/submit',
  41. method: 'post',
  42. data: row
  43. })
  44. }
  45. export const opStr2opObj = (optionStr) => {
  46. optionStr = optionStr.replace(/(s*?{s*?|s*?,s*?)(['"])?([a-zA-Z0-9]+)(['"])?:/g, '$1"$3":');
  47. optionStr = optionStr.replace(/\'/ig,"\"")
  48. optionStr = optionStr.replace(/>/ig,">")
  49. optionStr = optionStr.replace(/\s*/g, '')
  50. // str.replace(/\s*/g,"")
  51. let optionObj = JSON.parse(optionStr, (k,v)=>{
  52. if(k == 'change'){
  53. return eval('"' + v + '"')
  54. }
  55. return v
  56. })
  57. return optionObj;
  58. }