index.vue 3.8 KB

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