travelItem.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="travel-item">
  3. <view v-for="(value, index) in item.value" :key="index">
  4. <view class="container-header">
  5. <image :src="$static('images/oa/travel.png')" alt class="img" />
  6. <text>{{ item.name }}{{ index+1 }}</text>
  7. </view>
  8. <view class="container-body">
  9. <view v-for="(field, i) in formList" :key="i" class="container-remark-row">
  10. <text class="label">
  11. {{ field.text }}:
  12. </text>
  13. <text>{{ $isEmpty(value[field.name]) ? '--' : value[field.name] }}</text>
  14. </view>
  15. <wk-image-content
  16. v-if="value.img.length > 0"
  17. :list="value.img"
  18. class="image-content" />
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. name: 'TravelItem',
  26. props: {
  27. item: {
  28. type: Object,
  29. required: true
  30. }
  31. },
  32. data() {
  33. return {
  34. // 出差的表单选项
  35. businessCause: [
  36. {text: '交通工具', name: 'vehicle'},
  37. {text: '单程往返', name: 'trip'},
  38. {text: '出发城市', name: 'startAddress'},
  39. {text: '目的城市', name: 'endAddress'},
  40. {text: '开始时间', name: 'startTime'},
  41. {text: '结束时间', name: 'endTime'},
  42. {text: '时长(天)', name: 'duration'},
  43. {text: '备注', name: 'description'},
  44. ],
  45. // 出差报销选项
  46. examineCause: [
  47. {text: '出发城市', name: 'startAddress'},
  48. {text: '目的城市', name: 'endAddress'},
  49. {text: '开始时间', name: 'startTime', type: 'date'},
  50. {text: '结束时间', name: 'endTime', type: 'date'},
  51. {text: '交通费(元)', name: 'traffic'},
  52. {text: '住宿费(元)', name: 'stay'},
  53. {text: '餐饮费(元)', name: 'diet'},
  54. {text: '其他费用(元)', name: 'other'},
  55. {text: '费用明细描述', name: 'description'},
  56. ]
  57. }
  58. },
  59. computed: {
  60. formList() {
  61. if (this.item.formType === 'business_cause') {
  62. return this.businessCause
  63. } else if (this.item.formType === 'examine_cause') {
  64. return this.examineCause
  65. }
  66. return []
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .travel-item {
  73. background-color: #fbfbfb;
  74. border-radius: 6rpx;
  75. margin-top: 10rpx;
  76. .container-header {
  77. background-color: #f5f5f5;
  78. padding: 0 20rpx;
  79. font-size: 28rpx;
  80. height: 72rpx;
  81. @include left;
  82. .img {
  83. width: 34rpx;
  84. height: 36rpx;
  85. margin-right: 20rpx;
  86. }
  87. }
  88. .container-body {
  89. padding: 15rpx 20rpx;
  90. .container-remark-row {
  91. display: flex;
  92. font-size: 28rpx;
  93. line-height: 50rpx;
  94. color: $dark;
  95. .label {
  96. color: $light;
  97. padding-right: 10rpx;
  98. @include left;
  99. }
  100. }
  101. ::v-deep .image-content {
  102. .file-item {
  103. width: 140rpx;
  104. height: 140rpx;
  105. }
  106. }
  107. }
  108. }
  109. </style>