index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="kd-card">
  3. <view class="card-title">
  4. <view class="">
  5. <text v-if="orderTitle" class="orderTitle">{{ orderTitle }}</text>
  6. <text>{{ title }}</text>
  7. </view>
  8. <text
  9. v-if="status"
  10. class="status"
  11. :class="statusList[item.status && item.status.descp]"
  12. >
  13. {{ item.status && item.status.descp }}
  14. </text>
  15. </view>
  16. <view @click="handleDetail">
  17. <view class="card-body">
  18. <view class="card-col" v-for="itm in colOptions">
  19. <text class="label">{{ itm.label }}</text>
  20. <text class="content" v-if="itm.formatter">{{
  21. itm.formatter(item[itm.key])
  22. }}</text>
  23. <text class="content" v-else>{{ item[itm.key] }}</text>
  24. </view>
  25. <view class="asset" :style="dictOpt.asset[item.assetDict]">
  26. {{ getDictValue('物品类型', item.assetDict) }}
  27. </view>
  28. </view>
  29. <view class="card-footer">
  30. 查看详情 <u-icon name="arrow-right"></u-icon>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import itemConfig from './config.js'
  37. import dictMixins from '@/mixins/dictMixins'
  38. export default {
  39. mixins: [dictMixins],
  40. props: {
  41. title: String,
  42. orderTitle: String,
  43. item: {
  44. type: Object,
  45. default: () => ({})
  46. },
  47. type: {
  48. type: String,
  49. required: true
  50. },
  51. status: {
  52. type: Boolean,
  53. default: false
  54. }
  55. },
  56. data () {
  57. return {
  58. statusList: {
  59. 待接收: 'text-danger',
  60. 待执行: 'text-danger',
  61. 执行中: 'text-warning',
  62. 未修复: 'text-normal'
  63. },
  64. dictOpt: {
  65. asset: {
  66. 1: {
  67. color: '#027DB4',
  68. backgroundColor: '#def5ff'
  69. },
  70. 2: {
  71. color: '#B8741A',
  72. backgroundColor: '#fef1e8'
  73. },
  74. 3: {
  75. color: '#A30014',
  76. backgroundColor: '#f9e5e7'
  77. },
  78. 4: {
  79. color: 'green',
  80. backgroundColor: '#67C23A'
  81. },
  82. 5: {
  83. color: '#a30014',
  84. backgroundColor: '#F56C6C'
  85. },
  86. 6: {
  87. color: '#f56c6c',
  88. backgroundColor: '#fbc4c4'
  89. },
  90. 7: {
  91. color: '#e6a23c',
  92. backgroundColor: '#fdf6ec'
  93. }
  94. }
  95. }
  96. }
  97. },
  98. created () {
  99. // this.requestDict('物品类型')
  100. },
  101. computed: {
  102. colOptions () {
  103. return (
  104. itemConfig[this.type] || [
  105. { label: '单号', key: 'workOrderCode' },
  106. { label: '申请人', key: 'applicantName' },
  107. { label: '申请时间', key: 'createTime' }
  108. ]
  109. )
  110. }
  111. },
  112. methods: {
  113. handleDetail () {
  114. this.$emit('handleDetail', this.item)
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .kd-card {
  121. font-size: 28rpx;
  122. color: #333;
  123. background-color: #fff;
  124. border-radius: 8rpx;
  125. word-break: break-all;
  126. .status {
  127. font-weight: normal;
  128. }
  129. .card-title {
  130. font-weight: bold;
  131. }
  132. .card-footer,
  133. .card-title {
  134. display: flex;
  135. justify-content: space-between;
  136. padding: 12rpx 16rpx;
  137. }
  138. .card-body {
  139. padding: 0 28rpx;
  140. border-top: 1rpx solid #f2f2f2;
  141. border-bottom: 1rpx solid #f2f2f2;
  142. position: relative;
  143. .asset {
  144. position: absolute;
  145. top: 5rpx;
  146. padding: 4rpx 8rpx;
  147. right: 20rpx;
  148. }
  149. .card-col {
  150. padding: 8rpx 0;
  151. display: flex;
  152. // line-height: ;
  153. .label {
  154. display: inline-block;
  155. width: 6em;
  156. color: #555;
  157. text-align: right;
  158. margin-right: 14rpx;
  159. }
  160. .content {
  161. flex: 1;
  162. }
  163. }
  164. }
  165. }
  166. .orderTitle {
  167. color: #4b7902;
  168. margin-right: 10rpx;
  169. }
  170. </style>