preload.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. function All() {}
  2. All.prototype = {
  3. timer: '',
  4. arrToStr(arr: any) {
  5. if (arr) {
  6. return arr
  7. .map((item: any) => {
  8. return item.subjectName
  9. })
  10. .toString()
  11. }
  12. },
  13. toggleClass(arr: any, elem: any, key = 'id') {
  14. return arr.some((item: any) => {
  15. return item[key] == elem[key]
  16. })
  17. },
  18. toChecked(arr: any, elem: any, key = 'id') {
  19. const isIncludes = this.toggleClass(arr, elem, key)
  20. !isIncludes ? arr.push(elem) : this.removeEle(arr, elem, key)
  21. },
  22. removeEle(arr: any, elem: any, key = 'id') {
  23. let includesIndex
  24. arr.map((item: any, index: any) => {
  25. if (item[key] == elem[key]) {
  26. includesIndex = index
  27. }
  28. })
  29. arr.splice(includesIndex, 1)
  30. },
  31. setApproverStr(nodeConfig: any) {
  32. if (nodeConfig.settype == 1 || nodeConfig.settype == 3) {
  33. if (nodeConfig.subjects.length == 1) {
  34. return nodeConfig.subjects[0].subjectName
  35. } else if (nodeConfig.subjects.length > 1) {
  36. if (nodeConfig.examineMode == 1) {
  37. return this.arrToStr(nodeConfig.subjects)
  38. } else if (nodeConfig.examineMode == 2) {
  39. return nodeConfig.subjects.length + '人会签'
  40. }
  41. }
  42. } else if (nodeConfig.settype == 2) {
  43. const level = nodeConfig.directorLevel == 1 ? '直接主管' : '第' + nodeConfig.directorLevel + '级主管'
  44. if (nodeConfig.examineMode == 1) {
  45. return level
  46. } else if (nodeConfig.examineMode == 2) {
  47. return level + '会签'
  48. }
  49. } else if (nodeConfig.settype == 4) {
  50. if (nodeConfig.selectRange == 1) {
  51. return '发起人自选'
  52. } else {
  53. if (nodeConfig.subjects.length > 0) {
  54. if (nodeConfig.selectRange == 2) {
  55. return '发起人自选'
  56. } else {
  57. return '发起人从' + nodeConfig.subjects[0].name + '中自选'
  58. }
  59. } else {
  60. return ''
  61. }
  62. }
  63. } else if (nodeConfig.settype == 5) {
  64. return '发起人自己'
  65. }
  66. },
  67. dealStr(str: any, obj: any) {
  68. const arr = ref<any>([])
  69. const list = str.split(',')
  70. for (var elem in obj) {
  71. list.map((item: any) => {
  72. if (item == elem) {
  73. arr.push(obj[elem].value)
  74. }
  75. })
  76. }
  77. return arr.join('或')
  78. },
  79. conditionStr(nodeConfig: any, index: any) {
  80. const { condGroup, subjects } = nodeConfig.conditionNodes[index]
  81. if (condGroup.items.length == 0) {
  82. return index == nodeConfig.conditionNodes.length - 1 && nodeConfig.conditionNodes[0].condGroup.items.length != 0
  83. ? '其他条件进入此流程'
  84. : '请设置条件'
  85. } else {
  86. const str = '已设置条件'
  87. return str ? str : '请设置条件'
  88. }
  89. },
  90. copyerStr(nodeConfig: any) {
  91. if (nodeConfig.copyTo.length != 0) {
  92. return this.arrToStr(nodeConfig.copyTo)
  93. } else {
  94. if (nodeConfig.ccSelfSelectFlag == 1) {
  95. return '发起人自选'
  96. }
  97. }
  98. },
  99. toggleStrClass(item: any, key: any) {
  100. const a = item.zdy1 ? item.zdy1.split(',') : []
  101. return a.some((item: any) => {
  102. return item == key
  103. })
  104. }
  105. }
  106. export default new (All as any)()