nodes.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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" :status='status' :nodes="item.child"
  13. :prefix="(prefix ? prefix + '-' : '') + item.rowindex" />
  14. <block v-else>
  15. <view class="images" v-if="item.attinfos.length">
  16. <view class="image" hover-class="navigator-hover" v-for="(img, index) in item.attinfos"
  17. :key="img.attachmentid" @click.stop="preview(index, item.attinfos)">
  18. <up-image :show-loading="true" :src="$Http.getSpecifiedImage(img)" width="80px" height="80px" />
  19. </view>
  20. </view>
  21. <view class="stuta">
  22. <view class="tag" style="background-color: #E64D55;" v-if="item.status == '0'">未完成</view>
  23. <view class="tag" style="background-color: #06A971;" v-if="item.status == '1'">已完成</view>
  24. <view class="tag" style="background-color: #70B603;" v-if="item.status == '2'">进行中</view>
  25. </view>
  26. </block>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup>
  31. import { getCurrentInstance } from 'vue';
  32. const { $Http } = getCurrentInstance().proxy;
  33. import { defineProps } from 'vue';
  34. import node from "./nodes.vue";
  35. const props = defineProps({
  36. nodes: {
  37. type: Array
  38. },
  39. prefix: {
  40. type: [String, Number],
  41. },
  42. status: {
  43. type: String,
  44. }
  45. });
  46. function toWork(item) {
  47. try {
  48. if (item.child.length) return;
  49. } catch (error) {
  50. item.child = [];
  51. }
  52. if (item.child.length) return;
  53. item.title = (props.prefix ? props.prefix + '-' : '') + item.rowindex + '. ' + item.workpresetjson.workname;
  54. item.status1 = props.status;
  55. $Http.data = item;
  56. uni.navigateTo({
  57. url: '/pages/workOrder/work',
  58. })
  59. }
  60. function preview(index, imgs) {
  61. wx.previewImage({
  62. urls: imgs.filter(v => isImage(v.postfix)).map(item => item.url),
  63. current: imgs[index].url,
  64. })
  65. }
  66. function isImage(postfix) {
  67. const imageTypes = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
  68. return imageTypes.includes(postfix.toLowerCase());
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .node {
  73. display: flex;
  74. padding: 10rpx;
  75. margin-top: 10rpx;
  76. font-family: Microsoft YaHei, Microsoft YaHei;
  77. border-radius: 8rpx;
  78. .label,
  79. .number {
  80. font-size: 32rpx;
  81. }
  82. .number {
  83. margin-right: 10rpx;
  84. }
  85. .stuta {
  86. margin-top: 20rpx;
  87. display: flex;
  88. .tag {
  89. border-radius: 8rpx;
  90. padding: 8rpx 12rpx;
  91. font-size: 24rpx;
  92. color: #fff;
  93. }
  94. }
  95. .images {
  96. display: flex;
  97. flex-wrap: wrap;
  98. .image {
  99. margin-top: 20rpx;
  100. margin-right: 20rpx;
  101. }
  102. }
  103. }
  104. .child {
  105. margin-left: -55rpx;
  106. width: calc(100% + 65rpx);
  107. transform: scale(0.9);
  108. .label,
  109. .number {
  110. color: #333;
  111. }
  112. }
  113. </style>