nodes.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view v-if="nodes.length">
  3. <view class="label">进度</view>
  4. <view class="step-box">
  5. <view class="workorder" v-for="(item, index) in nodes" :key="item.sa_workorder_nodeid">
  6. <view class="workorder-title" :hover-class="item.child.length == 0 ? 'navigator-hover' : ''"
  7. @click="item.child.length == 0 ? onClick(item) : ''">
  8. {{ index + 1 }}.{{ item.workpresetjson.workname }}
  9. </view>
  10. <view class="child-result" v-if="item.child.length == 0">
  11. <view class="have-not-begun tag" v-if="item.status == 0">
  12. 未开始
  13. </view>
  14. <block v-else>
  15. <view class="time">{{ item.changedate }}</view>
  16. <block v-if="item.status == 1">
  17. <view class="done tag">
  18. 完成
  19. </view>
  20. <view class="underway tag">
  21. {{ item.finishby }}
  22. </view>
  23. </block>
  24. <view class="underway tag" v-else>
  25. 进行中
  26. </view>
  27. </block>
  28. </view>
  29. <navigator url="#" class="child" v-for="(child, childIndex) in item.child" @click="onClick(child)"
  30. :key="child.sa_workorder_nodeid">
  31. <view class="child-title">
  32. {{ index + 1 }}-{{ childIndex + 1 }}.{{ child.workpresetjson.workname }}
  33. </view>
  34. <view class="child-result">
  35. <view class="have-not-begun tag" v-if="child.status == 0">
  36. 未开始
  37. </view>
  38. <block v-else>
  39. <view class="time">{{ child.changedate }}</view>
  40. <block v-if="child.status == 1">
  41. <view class="done tag">
  42. 完成
  43. </view>
  44. <view class="underway tag">
  45. {{ child.finishby }}
  46. </view>
  47. </block>
  48. <view class="underway tag" v-else>
  49. 进行中
  50. </view>
  51. </block>
  52. </view>
  53. </navigator>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. name: "nodes",
  61. props: {
  62. nodes: {
  63. type: Array,
  64. default: []
  65. },
  66. nodeClick: {
  67. type: Function
  68. }
  69. },
  70. data() {
  71. return {
  72. onClick(e) {
  73. this.$emit("nodeClick", e)
  74. },
  75. }
  76. },
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .label {
  81. margin: 15px 0 10px 10px;
  82. font-size: 13px;
  83. color: #fff;
  84. }
  85. .step-box {
  86. width: 355px;
  87. margin: 0 auto;
  88. background: #fff;
  89. box-sizing: border-box;
  90. border-radius: 4px;
  91. padding: 10px;
  92. padding-top: 0;
  93. .workorder {
  94. width: 100%;
  95. padding-bottom: 4px;
  96. border-bottom: 1px dashed #ddd;
  97. &-title {
  98. font-size: 16px;
  99. padding-top: 10px;
  100. margin-bottom: 4px;
  101. }
  102. .child {
  103. padding: 6px;
  104. border-radius: 4px;
  105. overflow: hidden;
  106. &-title {
  107. font-size: 14px;
  108. }
  109. }
  110. .child-result {
  111. margin-top: 4px;
  112. display: flex;
  113. align-items: center;
  114. .have-not-begun {
  115. background: #E34D59;
  116. }
  117. .done {
  118. background: #4BA574;
  119. }
  120. .underway {
  121. background: #2151D1;
  122. }
  123. .tag {
  124. font-size: 10px;
  125. padding: 4px;
  126. border-radius: 4px;
  127. color: #fff;
  128. margin-left: 6px;
  129. }
  130. .time {
  131. font-size: 14px;
  132. color: #999;
  133. }
  134. }
  135. }
  136. .workorder:last-child {
  137. padding-bottom: 0px;
  138. border: 0;
  139. }
  140. }
  141. </style>