myCard.vue 4.4 KB

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