flow.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <div class="flow-index">
  3. <div class="flow" v-if="type === 'insert'">
  4. <div class="flow-button">
  5. <el-button size="medium" type="primary" @click="visible = true">
  6. <i class="iconfont huifont-xinzeng"></i>添加审核人员
  7. </el-button>
  8. </div>
  9. <div class="flow-box">
  10. <div class="flow-item" v-for="(item,index) in list" :key="index">
  11. <div class="user-avatar">
  12. <avatar :user="item" :size="12"></avatar>
  13. </div>
  14. <div class="user-name">
  15. <div>{{item.name}}</div>
  16. <p>{{item.partName}}</p>
  17. </div>
  18. <div class="user-line" v-if="index < list.length-1"></div>
  19. </div>
  20. </div>
  21. <el-dialog title="审核人选择" :visible.sync="visible" width="880px" :append-to-body="true">
  22. <select-user @callback="callBack" v-if="visible" :list="list"></select-user>
  23. </el-dialog>
  24. </div>
  25. <div class="flow-list" v-else>
  26. <div class="flow-box">
  27. <div class="flow-item" v-for="(item,index) in flowlist" :key="index">
  28. <div class="user-avatar-box">
  29. <div class="user-avatar">
  30. <avatar :user="item" :size="12"></avatar>
  31. </div>
  32. <div :class="'user-avatar-status '+ returnStatus(item.status).className">
  33. <i :class="'iconfont '+returnStatus(item.status).icon"></i>
  34. </div>
  35. </div>
  36. <div class="flow-content">
  37. <div class="user-name">
  38. <div>{{item.name}}</div>
  39. <p><span>{{item.partName}}</span><span>{{item.date}}</span></p>
  40. </div>
  41. <div class="user-content" v-if="item.remark">
  42. <div class="remark">
  43. {{item.remark}}
  44. </div>
  45. <div class="remark-file" v-if="item.file && item.file.length > 0">
  46. <upload :list="item.file" type="preview"></upload>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="user-line" v-if="index < flowlist.length-1"></div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import selectUser from '@/components/common/selectUser'
  58. import avatar from '@/components/common/avatar'
  59. import upload from '@/components/common/upload'
  60. export default {
  61. props: ['type', 'flowlist'],
  62. data() {
  63. return {
  64. list: [],
  65. visible: false
  66. }
  67. },
  68. created() {
  69. if (!!this.flowlist && this.type == 'insert') this.list = this.flowlist;
  70. },
  71. methods: {
  72. callBack(data) {
  73. this.visible = false;
  74. if (data) this.list = data;
  75. },
  76. returnStatus(state) {
  77. let className = '',
  78. icon = '';
  79. switch (state) {
  80. case 0:
  81. className = 'info';
  82. icon = 'huifont-jinhangzhong';
  83. break;
  84. case 1:
  85. className = 'success'
  86. icon = 'huifont-tongguo';
  87. break;
  88. case 2:
  89. className = 'failed'
  90. icon = 'huifont-a-butongguojujue';
  91. break;
  92. case 3:
  93. className = 'waiting'
  94. icon = 'huifont-jinhangzhong';
  95. break;
  96. default:
  97. className = 'info'
  98. icon = 'huifont-jinhangzhong';
  99. break;
  100. }
  101. return {
  102. className: className,
  103. icon: icon
  104. };
  105. }
  106. },
  107. watch: {
  108. flowlist() {
  109. if (!!this.flowlist && this.type == 'insert') this.list = this.flowlist;
  110. }
  111. },
  112. components: {
  113. selectUser,
  114. avatar,
  115. upload
  116. },
  117. }
  118. </script>
  119. <style lang="scss">
  120. .flow-index {
  121. width: 100%;
  122. height: 100%;
  123. .flow-list {
  124. padding: 10px 20px;
  125. .flow-item {
  126. position: relative;
  127. display: flex;
  128. .user-avatar-box {
  129. position: relative;
  130. .user-avatar {
  131. width: 32px;
  132. height: 32px;
  133. background: #4958de;
  134. border-radius: 50%;
  135. margin-right: 10px;
  136. margin-top: 8px;
  137. display: flex;
  138. align-items: center;
  139. justify-content: center;
  140. overflow: hidden;
  141. i {
  142. font-size: 20px;
  143. }
  144. }
  145. .user-avatar-status {
  146. width: 12px;
  147. height: 12px;
  148. border-radius: 50%;
  149. border: 1px solid #fff;
  150. position: absolute;
  151. top: 30px;
  152. right: 10px;
  153. display: flex;
  154. align-items: center;
  155. justify-content: center;
  156. i {
  157. font-size: 8px;
  158. color: #fff;
  159. }
  160. }
  161. .user-avatar-status.success {
  162. background: $--color-green;
  163. }
  164. .user-avatar-status.failed {
  165. background: $--color-red;
  166. }
  167. .user-avatar-status.waiting {
  168. background: $--color-orange;
  169. }
  170. .user-avatar-status.info {
  171. background: #4C4F59;
  172. }
  173. }
  174. .flow-content {
  175. flex: 1;
  176. width: 0;
  177. .user-name {
  178. height: 48px;
  179. display: flex;
  180. flex-direction: column;
  181. justify-content: center;
  182. p {
  183. font-size: 12px;
  184. opacity: 0.6;
  185. display: flex;
  186. align-items: center;
  187. justify-content: space-between;
  188. }
  189. }
  190. .user-content {
  191. background: rgba(50, 56, 68, 0.2);
  192. border-radius: 8px;
  193. padding: 13px;
  194. .remark {
  195. font-size: 12px;
  196. line-height: 17px;
  197. }
  198. .remark-file {
  199. margin-top: 12px;
  200. }
  201. }
  202. }
  203. .user-line {
  204. width: 1px;
  205. border-left: 1px dashed #374156;
  206. position: absolute;
  207. top: 40px;
  208. bottom: -8px;
  209. left: 15px;
  210. }
  211. }
  212. }
  213. .flow {
  214. width: 100%;
  215. height: 100%;
  216. display: flex;
  217. flex-direction: column;
  218. .flow-button {
  219. padding: 0 20px 10px 20px;
  220. .el-button {
  221. padding-left: 12px;
  222. span {
  223. display: flex;
  224. align-items: center;
  225. }
  226. .huifont-xinzeng {
  227. padding-right: 10px;
  228. }
  229. }
  230. }
  231. .flow-box {
  232. flex: 1;
  233. height: 0;
  234. padding: 10px 20px 0px 20px;
  235. overflow-y: auto;
  236. }
  237. .flow-item {
  238. height: 48px;
  239. display: flex;
  240. align-items: center;
  241. position: relative;
  242. .user-avatar {
  243. width: 32px;
  244. height: 32px;
  245. background: #4958de;
  246. border-radius: 50%;
  247. margin-right: 10px;
  248. display: flex;
  249. align-items: center;
  250. justify-content: center;
  251. overflow: hidden;
  252. i {
  253. font-size: 20px;
  254. }
  255. }
  256. .user-name {
  257. flex: 1;
  258. width: 0;
  259. p {
  260. font-size: 12px;
  261. opacity: 0.6;
  262. }
  263. }
  264. .user-line {
  265. width: 2px;
  266. background-color: #374156;
  267. position: absolute;
  268. top: 40px;
  269. bottom: -8px;
  270. left: 15px;
  271. }
  272. }
  273. }
  274. }
  275. </style>