myCard.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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" 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" 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. .round {
  129. width: 40rpx;
  130. height: 40rpx;
  131. line-height: 40rpx;
  132. border-radius: 50%;
  133. background: $theme-color;
  134. color: #fff;
  135. text-align: center;
  136. font-size: 20rpx;
  137. }
  138. .orderId {
  139. color: #000;
  140. font-family: PingFang HK;
  141. font-size: 28rpx;
  142. font-style: normal;
  143. font-weight: 600;
  144. }
  145. .item_one {
  146. width: 100%;
  147. font-size: 26rpx;
  148. font-style: normal;
  149. font-weight: 400;
  150. line-height: 38rpx;
  151. word-wrap: break-word;
  152. }
  153. .gylx {
  154. color: $theme-color;
  155. }
  156. .perce50 {
  157. min-width: 50%;
  158. }
  159. .perce100 {
  160. width: 100% !important;
  161. }
  162. }
  163. }
  164. /deep/.u-input {
  165. padding: 0 !important;
  166. height: 38rpx !important;
  167. font-size: 26rpx !important;
  168. }
  169. /deep/.u-input__content__field-wrapper__field {
  170. font-size: 26rpx !important;
  171. }
  172. /deep/.uni-date-editor--x .uni-date__icon-clear {
  173. border: none !important;
  174. }
  175. /deep/.uni-date__x-input,
  176. /deep/.uni-date-x {
  177. padding: 0 !important;
  178. height: 38rpx !important;
  179. font-size: 26rpx !important;
  180. }
  181. /deep/.input-value {
  182. font-size: 26rpx !important;
  183. height: 38rpx !important;
  184. uni-text {
  185. font-size: 26rpx !important;
  186. }
  187. }
  188. /deep/.u-textarea {
  189. padding: 2px !important;
  190. }
  191. /deep/.u-textarea__field {
  192. font-size: 26rpx !important;
  193. }
  194. </style>