DocList.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="" v-if="list.length">
  3. <view class="doc-list" v-if="modelValue">
  4. <checkbox-group @change="checkboxChange" @click.stop>
  5. <label class="item-label" v-for="(item,index) in list" :key="index">
  6. <view class="u-flex item-label-left u-line-1" @click.stop="goDetail(item)">
  7. <view class="doc-icon">
  8. <u-image :src="getRecordImg(item.fileExtension)" width="74" height="74" />
  9. </view>
  10. <view class="text">
  11. <p class="u-m-l-10 u-m-b-8 u-font-28 name u-line-1">{{item.fullName}}</p>
  12. <p class="u-m-l-10 u-m-t-8 u-font-24 time">
  13. {{item.time ? $u.timeFormat(item.time, 'yyyy-mm-dd hh:MM:ss'):''}}
  14. </p>
  15. </view>
  16. </view>
  17. <checkbox :value="item.id" :checked="item.checked" activeBackgroundColor="#0177FF" iconColor="#fff"
  18. style="transform:scale(0.7)" />
  19. </label>
  20. </checkbox-group>
  21. </view>
  22. <view class="u-flex u-p-l-20 u-p-r-20 doc-list2 u-p-t-20" v-else>
  23. <checkbox-group @change="checkboxChange" @click.stop class="checkbox-group">
  24. <label class="group-label" v-for="(item,index) in list" :key="index">
  25. <view class="u-flex-col doc-list-inner" @click.stop="goDetail(item)">
  26. <view class="doc-icon u-flex">
  27. <u-image :src="getRecordImg(item.fileExtension)" width="84" height="84" />
  28. </view>
  29. <view class="u-flex doc-name" @click.stop>
  30. <view class="u-line-1 name">{{item.fullName}}</view>
  31. <checkbox :value="item.id" :checked="item.checked" activeBackgroundColor="#0177FF"
  32. iconColor="#fff" style="transform:scale(0.7)" />
  33. </view>
  34. </view>
  35. </label>
  36. </checkbox-group>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import mixin from "../mixin.js"
  42. export default {
  43. name: 'DocList',
  44. mixins: [mixin],
  45. props: {
  46. modelValue: {
  47. type: Boolean,
  48. default: true
  49. },
  50. documentList: {
  51. type: Array,
  52. default: () => []
  53. }
  54. },
  55. data() {
  56. return {
  57. list: []
  58. }
  59. },
  60. watch: {
  61. documentList: {
  62. handler(val) {
  63. this.list = val
  64. },
  65. immediate: true,
  66. deep: true
  67. }
  68. },
  69. methods: {
  70. goDetail(item) {
  71. this.$emit('goDetail', item)
  72. },
  73. checkboxChange(e) {
  74. this.$emit('checkboxChange', e.detail.value)
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss">
  80. .doc-list {
  81. background-color: #FFFFFF;
  82. position: relative;
  83. width: 100%;
  84. display: flex;
  85. flex-direction: column;
  86. padding: 0 20rpx;
  87. .item-label {
  88. position: relative;
  89. display: flex;
  90. flex-direction: row;
  91. align-items: center;
  92. border-bottom: 1rpx solid #f0f2f6;
  93. height: 126rpx;
  94. .item-label-left {
  95. flex: 1;
  96. .doc-icon {
  97. width: 74rpx;
  98. height: 74rpx;
  99. img {
  100. width: 100%;
  101. height: 100%;
  102. }
  103. }
  104. .text {
  105. width: 80%;
  106. .name {
  107. color: #303133;
  108. }
  109. .time {
  110. color: #909399;
  111. }
  112. }
  113. }
  114. .uni-checkbox-wrapper {
  115. .uni-checkbox-input {
  116. margin: 0 !important;
  117. }
  118. }
  119. }
  120. }
  121. .doc-list2 {
  122. background-color: #fff;
  123. .doc-list-inner {
  124. width: 100%;
  125. background-color: #f2f3f7;
  126. padding: 12rpx 12rpx 0 12rpx;
  127. margin-bottom: 20rpx;
  128. border-radius: 8rpx;
  129. .doc-icon {
  130. width: 100%;
  131. background-color: #FFFFFF;
  132. border-radius: 8rpx;
  133. height: 160rpx;
  134. justify-content: center;
  135. }
  136. .doc-name {
  137. width: 100%;
  138. height: 73rpx;
  139. .name {
  140. text-align: left;
  141. flex: 1;
  142. }
  143. ::v-deep .uni-checkbox-wrapper {
  144. .uni-checkbox-input {
  145. margin: 0;
  146. }
  147. }
  148. }
  149. }
  150. }
  151. .checkbox-group {
  152. display: flex;
  153. flex-wrap: wrap;
  154. width: 100%;
  155. justify-content: space-between;
  156. .group-label {
  157. width: 48%;
  158. }
  159. ::v-deep .uni-label-pointer {
  160. width: 48%;
  161. display: flex;
  162. text-align: center;
  163. }
  164. }
  165. </style>