sd-create-process.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div :class="$style.process">
  3. <a-row :class="[$style.header, { [$style.flexHeader]: quickEnterList.length >= 6 }]">
  4. <a-col
  5. v-for="(item, i) in quickEnterList"
  6. :key="i"
  7. :span="4"
  8. :title="item.text"
  9. @click="openDraft(item)"
  10. >
  11. <div :class="$style.processEnter">
  12. <span :class="$style.circle">{{
  13. item.props.appName && item.props.appName.substr(0, 2)
  14. }}</span>
  15. <span :class="$style.text">{{ item.text }}</span>
  16. </div>
  17. </a-col>
  18. </a-row>
  19. <div :class="$style.bottomCate">
  20. <sd-process-all
  21. :category-list="items"
  22. :first-category="firstCategory"
  23. :active-tab="activeTab"
  24. :loading="loading"
  25. @searchVal="getSearchVal"
  26. @changeTabActive="changeTabActive"
  27. ></sd-process-all>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import flowService from '@/webflow/flow-service'
  33. import eventBus from '@/common/services/event-bus'
  34. import navMenuService from '../frame/nav-menu-service'
  35. import components from './_import-components/sd-create-process-import'
  36. export default {
  37. name: 'SdCreateProcess',
  38. metaInfo: {
  39. title: '新建流程',
  40. },
  41. components,
  42. data() {
  43. return {
  44. loading: true,
  45. search: '',
  46. activeTab: 0,
  47. quickEnterList: [],
  48. categoryList: [],
  49. firstCategory: [],
  50. }
  51. },
  52. computed: {
  53. // 筛选指定字段
  54. items: function() {
  55. const depositArr = []
  56. if (this.search) {
  57. // 筛选数据
  58. this.categoryList.forEach((itemfs) => {
  59. const filterArr = itemfs.children.filter((item, index) => {
  60. return (
  61. item.text.toLowerCase().indexOf(this.search.toLowerCase()) !== -1 // 转小写再搜索一遍
  62. )
  63. // 在数据中 找到返回搜索文字的item项 成新的数组 arr1
  64. })
  65. if (filterArr.length > 0) {
  66. const copyitemfs = { ...itemfs }
  67. copyitemfs.children = filterArr
  68. depositArr.push(copyitemfs)
  69. }
  70. })
  71. } else {
  72. return this.categoryList
  73. }
  74. return depositArr
  75. },
  76. },
  77. created() {
  78. this.getQuickEnterList()
  79. this.getFirstCategoryBusinessType()
  80. },
  81. methods: {
  82. // 子组件获取的搜索值
  83. getSearchVal(val) {
  84. this.search = val
  85. },
  86. changeTab(i) {
  87. this.activeTab = Number(i)
  88. },
  89. changeTabActive(data) {
  90. this.openDraft(data)
  91. },
  92. getQuickEnterList() {
  93. navMenuService.getQuickEnterList().then((res) => {
  94. this.quickEnterList = res.data.slice(0, 6)
  95. })
  96. },
  97. getFirstCategoryBusinessType() {
  98. navMenuService.getFirstCategoryBusinessType().then((res) => {
  99. this.categoryList = res.data
  100. this.loading = false
  101. res.data.forEach((item) => {
  102. this.firstCategory.push({ id: item.id, text: item.text })
  103. })
  104. })
  105. },
  106. openDraft(item) {
  107. return eventBus.emit('sdNewProcessItemClick', item).then((evt) => {
  108. if (evt.defaultPrevented) return
  109. flowService.startProcessByBusinessTypeId(
  110. item.id,
  111. {},
  112. {
  113. srcTrustId: item.props.srcTrustId,
  114. }
  115. )
  116. })
  117. },
  118. },
  119. }
  120. </script>
  121. <style module lang="scss">
  122. @use '@/common/design' as *;
  123. $bg-color-a: #76a0ed;
  124. $bg-color-b: #72bb64;
  125. $bg-color-c: #5b8df0;
  126. $bg-color-d: #779fc7;
  127. $bg-color-e: #eaa32c;
  128. $bg-color-f: #7674f7;
  129. $font-size-xs: 14px;
  130. .process {
  131. height: 100%;
  132. .header {
  133. &.flex-header {
  134. display: flex;
  135. justify-content: space-between;
  136. }
  137. padding-bottom: $padding-lg;
  138. :global(.ant-col) {
  139. display: flex;
  140. flex: 1;
  141. align-items: center;
  142. height: 80px;
  143. margin-right: 10px;
  144. overflow: hidden;
  145. text-overflow: ellipsis;
  146. white-space: nowrap;
  147. cursor: pointer;
  148. .process-enter {
  149. display: flex;
  150. flex: auto;
  151. align-items: center;
  152. width: 100%;
  153. height: 100%;
  154. padding: 0 20px;
  155. transition: 0.3s;
  156. &:hover {
  157. background: rgba(0, 0, 0, 0.2);
  158. }
  159. }
  160. &:last-child {
  161. margin-right: 0;
  162. }
  163. &:first-child {
  164. background: $bg-color-a;
  165. .circle {
  166. border: 1px solid $white;
  167. }
  168. }
  169. &:nth-child(2) {
  170. background: $bg-color-b;
  171. .circle {
  172. border: 1px solid $white;
  173. }
  174. }
  175. &:nth-child(3) {
  176. background: $bg-color-c;
  177. .circle {
  178. border: 1px solid $white;
  179. }
  180. }
  181. &:nth-child(4) {
  182. background: $bg-color-d;
  183. .circle {
  184. border: 1px solid $white;
  185. }
  186. }
  187. &:nth-child(5) {
  188. background: $bg-color-e;
  189. .circle {
  190. border: 1px solid $white;
  191. }
  192. }
  193. &:nth-child(6) {
  194. background: $bg-color-f;
  195. .circle {
  196. border: 1px solid $white;
  197. }
  198. }
  199. .circle {
  200. display: flex;
  201. align-items: center;
  202. justify-content: center;
  203. width: 52px;
  204. height: 52px;
  205. margin-right: 10px;
  206. overflow: hidden;
  207. font-size: $font-size-xs;
  208. text-overflow: ellipsis;
  209. white-space: nowrap;
  210. border-radius: 50%;
  211. }
  212. span {
  213. color: $white;
  214. }
  215. .text {
  216. width: calc(100% - 62px);
  217. overflow: hidden;
  218. text-overflow: ellipsis;
  219. white-space: nowrap;
  220. }
  221. }
  222. }
  223. .bottom-cate {
  224. display: flex;
  225. flex-direction: column;
  226. align-items: flex-end;
  227. justify-content: space-between;
  228. height: calc(100% - 100px);
  229. }
  230. }
  231. </style>