nodes.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="node" :class="prefix ? 'child' : ''"
  3. :hover-class="!prefix && item.child.length ? '' : 'navigator-hover'" v-for="item in nodes"
  4. :key="item.sa_workorder_nodeid" @click.stop="toWork(item)">
  5. <view class="number">
  6. {{ (prefix ? prefix + '-' : '') + item.rowindex }}.
  7. </view>
  8. <view style="flex: 1;">
  9. <view class="label">
  10. {{ item.workpresetjson.workname }}
  11. </view>
  12. <node v-if="!prefix && item.child.length" :nodes="item.child"
  13. :prefix="(prefix ? prefix + '-' : '') + item.rowindex" />
  14. <view v-else class="stuta">
  15. <view class="tag" style="background-color: #E64D55;" v-if="item.status == '0'">未完成</view>
  16. <view class="tag" style="background-color: #06A971;" v-if="item.status == '1'">已完成</view>
  17. <view class="tag" style="background-color: #70B603;" v-if="item.status == '2'">进行中</view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script setup>
  23. import { getCurrentInstance } from 'vue';
  24. const { $Http } = getCurrentInstance().proxy;
  25. import { defineProps } from 'vue';
  26. import node from "./nodes.vue";
  27. const props = defineProps({
  28. nodes: {
  29. type: Array
  30. },
  31. prefix: {
  32. type: [String, Number],
  33. }
  34. });
  35. function toWork(item) {
  36. try {
  37. if (item.child.length) return;
  38. } catch (error) {
  39. item.child = [];
  40. }
  41. if (item.child.length) return;
  42. item.title = (props.prefix ? props.prefix + '-' : '') + item.rowindex + '. ' + item.workpresetjson.workname;
  43. $Http.data = item;
  44. wx.navigateTo({
  45. url: '/pages/workOrder/work',
  46. })
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. .node {
  51. display: flex;
  52. padding: 10rpx;
  53. margin-top: 10rpx;
  54. font-family: Microsoft YaHei, Microsoft YaHei;
  55. border-radius: 8rpx;
  56. .label,
  57. .number {
  58. font-size: 32rpx;
  59. }
  60. .number {
  61. margin-right: 10rpx;
  62. }
  63. .stuta {
  64. margin-top: 20rpx;
  65. display: flex;
  66. .tag {
  67. border-radius: 8rpx;
  68. padding: 8rpx 12rpx;
  69. font-size: 24rpx;
  70. color: #fff;
  71. }
  72. }
  73. }
  74. .child {
  75. margin-left: -55rpx;
  76. width: calc(100% + 65rpx);
  77. transform: scale(0.9);
  78. .label,
  79. .number {
  80. color: #333;
  81. }
  82. }
  83. </style>