myCard.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="card_box">
  3. <view class="item_box rx-bc" v-for="(_item,i) in columns" :key="i">
  4. <view class="perce50" :class="val.className" :style="val.style" v-for="(val) in _item" :key="val.prop">
  5. <view class="item_box rx-sc" v-if="val.type=='title'">
  6. <view class="round" v-if='index'>{{index}}</view>
  7. <view class="orderId" :style="{marginLeft: index?'16rpx':''}">{{item[val.prop]||''}} </view>
  8. </view>
  9. <view class="item_one rx-sc" v-else-if="val.type=='action'">
  10. <view class="lable">{{val.label}}</view>
  11. <view class="text">
  12. <template v-for="(btn,bI) in btnList">
  13. <u-button :plain="true" :hairline="true" size='mini' :type="btn.btnType" v-if="judge(btn)"
  14. :text="btn.name" @click="action(btn)" :key="bI"></u-button>
  15. </template>
  16. </view>
  17. </view>
  18. <view class="item_one rx-sc kk" v-else>
  19. <view class="lable">{{val.label}}</view>
  20. <view class="text" v-if="val.formatter">{{val.formatter(item)||''}}</view>
  21. <view class="text" v-else-if="val.slot">
  22. <slot :name="val.slot"> </slot>
  23. </view>
  24. <view class="text" v-else>{{item[val.prop]||''}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. props: {
  33. btnList: {
  34. type: Array,
  35. default: () => []
  36. },
  37. item: {
  38. type: Object,
  39. default: () => ({})
  40. },
  41. columns: {
  42. type: Array,
  43. default: () => []
  44. },
  45. index: '',
  46. },
  47. computed: {
  48. judge() {
  49. return (item) => {
  50. if (item.judge) {
  51. let is = true
  52. item.judge.forEach(({
  53. key,
  54. value,
  55. authorities
  56. }) => {
  57. if (authorities) {
  58. is = this.$isAuthorities(authorities)
  59. }
  60. if (value && !value.includes(this.item[key])) {
  61. is = false
  62. }
  63. })
  64. return is
  65. } else {
  66. return true
  67. }
  68. }
  69. }
  70. },
  71. data() {
  72. return {
  73. }
  74. },
  75. methods: {
  76. action(item) {
  77. if (item.type == 1) {
  78. uni.navigateTo({
  79. url: item.pageUrl + '?id=' + this.item.id + (item.query || '')
  80. })
  81. } else {
  82. this.$emit(item.apiName)
  83. }
  84. },
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .card_box {
  90. width: 750rpx;
  91. padding: 16rpx 32rpx;
  92. box-sizing: border-box;
  93. border-bottom: 2rpx solid #E1E1E1;
  94. .rx-bc {
  95. align-items: start;
  96. flex-flow: row wrap;
  97. >view {
  98. margin-top: 8rpx;
  99. }
  100. }
  101. .rx-sc {
  102. align-items: start;
  103. }
  104. .item_box {
  105. // margin-top: 10rpx;
  106. .text {
  107. display: flex;
  108. // padding-right: 6rpx;
  109. flex: 1;
  110. uni-button:after {
  111. border: none;
  112. }
  113. ;
  114. uni-button {
  115. width: 100rpx;
  116. // height: 50rpx;
  117. margin-left: 10rpx;
  118. margin-right: 0;
  119. color: #fff !important;
  120. border: none;
  121. background: #157a2c;
  122. // border: none;
  123. // /deep/uni-text {
  124. // font-size: 26rpx !important;
  125. // }
  126. }
  127. }
  128. .kk .text {
  129. overflow: hidden;
  130. text-overflow: ellipsis;
  131. display: -webkit-box;
  132. -webkit-box-orient: vertical;
  133. -webkit-line-clamp: 2;
  134. word-break: break-word;
  135. }
  136. .round {
  137. width: 40rpx;
  138. height: 40rpx;
  139. line-height: 40rpx;
  140. border-radius: 50%;
  141. background: $theme-color;
  142. color: #fff;
  143. text-align: center;
  144. font-size: 20rpx;
  145. }
  146. .orderId {
  147. color: #000;
  148. font-family: PingFang HK;
  149. font-size: 28rpx;
  150. font-style: normal;
  151. font-weight: 600;
  152. }
  153. .item_one {
  154. width: 100%;
  155. font-size: 26rpx;
  156. font-style: normal;
  157. font-weight: 400;
  158. line-height: 38rpx;
  159. word-wrap: break-word;
  160. }
  161. .gylx {
  162. color: $theme-color;
  163. }
  164. .perce50 {
  165. min-width: 50%;
  166. }
  167. .perce100 {
  168. width: 100% !important;
  169. }
  170. }
  171. }
  172. /deep/.u-input {
  173. padding: 0 !important;
  174. height: 44rpx !important;
  175. font-size: 26rpx !important;
  176. }
  177. /deep/.u-input__content__field-wrapper__field {
  178. font-size: 26rpx !important;
  179. }
  180. /deep/.uni-date-editor--x .uni-date__icon-clear {
  181. border: none !important;
  182. }
  183. /deep/.uni-date__x-input,
  184. /deep/.uni-date-x {
  185. padding: 0 !important;
  186. height: 44rpx !important;
  187. font-size: 26rpx !important;
  188. }
  189. /deep/.input-value {
  190. font-size: 26rpx !important;
  191. height: 44rpx !important;
  192. uni-text {
  193. font-size: 26rpx !important;
  194. }
  195. }
  196. /deep/.u-textarea {
  197. padding: 2px !important;
  198. }
  199. /deep/.u-textarea__field {
  200. font-size: 26rpx !important;
  201. }
  202. </style>