myCard.vue 4.6 KB

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