CheckCard.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="kd-check-card">
  3. <view class="title">
  4. <text class="label">{{ index + 1 }}</text>
  5. <text>{{ item.name }}</text>
  6. </view>
  7. <view class="card-cell">
  8. <text class="label">内容</text>
  9. <text class="cell-content">{{ item.content }}</text>
  10. </view>
  11. <view class="card-cell">
  12. <text class="label">标准</text>
  13. <text class="cell-content">{{ item.norm }}</text>
  14. </view>
  15. <view class="card-cell">
  16. <text class="label">结果</text>
  17. <view class="cell-content">
  18. <view class="content-status" v-if="type == 'view'">
  19. <!-- {{ item.isNormal?'正常':'缺陷' }} -->
  20. <div v-if="item.isNormal" style="color: green">正常</div>
  21. <div v-else-if="item.isNormal === 0" style="color: red">缺陷</div>
  22. </view>
  23. <textarea
  24. v-if="type !== 'view'"
  25. placeholder="请输入"
  26. v-model="item.resultText"
  27. />
  28. <view class="result-text" v-else>{{ item.resultText }}</view>
  29. <view class="radio-wrapper" v-if="type !== 'view'">
  30. <div
  31. v-for="(it, ind) in statusList"
  32. :key="ind"
  33. class="wrapper-box"
  34. @click="changeStatus(item, it)"
  35. :style="
  36. item.isNormal == it.isNormal && item.isNormal == 0
  37. ? 'color:red;border: 1rpx solid red'
  38. : item.isNormal == it.isNormal && item.isNormal == 1
  39. ? 'color:green;border: 1rpx solid green'
  40. : ''
  41. "
  42. >
  43. {{ it.label }}
  44. </div>
  45. <!-- <u-radio-group
  46. v-model="item.isNormal"
  47. placement="row"
  48. v-if="type !== 'view'"
  49. :size="28"
  50. >
  51. <u-radio
  52. :customStyle="{ marginRight: '20px' }"
  53. :labelSize="30"
  54. label="正常"
  55. :name="1"
  56. >
  57. </u-radio>
  58. <u-radio :customStyle="{}" :labelSize="30" label="缺陷" :name="0">
  59. </u-radio>
  60. </u-radio-group>
  61. <view
  62. :class="item.isNormal === 0 ? 'text-danger' : ''"
  63. v-else
  64. style="min-height: 1em"
  65. >
  66. {{ ['缺陷', '正常'][item.isNormal] }}
  67. </view> -->
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. props: {
  76. item: {
  77. type: Object,
  78. default: () => ({})
  79. },
  80. index: Number,
  81. type: {
  82. type: String,
  83. default: 'edit'
  84. }
  85. },
  86. data () {
  87. return {
  88. statusList: [
  89. { label: '正常', isNormal: 1 },
  90. { label: '缺陷', isNormal: 0 }
  91. ]
  92. }
  93. },
  94. methods: {
  95. changeStatus (item, it) {
  96. item.isNormal = it.isNormal
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. $border-color: #f2f2f2;
  103. .kd-check-card {
  104. font-size: 28rpx;
  105. border: 1rpx solid $border-color;
  106. .label {
  107. display: inline-block;
  108. width: 80rpx;
  109. text-align: center;
  110. border-right: 1px solid $border-color;
  111. justify-content: center;
  112. }
  113. .title {
  114. line-height: 72rpx;
  115. font-weight: bold;
  116. background-color: #f2f2f2;
  117. }
  118. .card-cell {
  119. min-height: 72rpx;
  120. display: flex;
  121. align-items: stretch;
  122. border: 1px solid $border-color;
  123. text {
  124. display: flex;
  125. align-items: center;
  126. }
  127. }
  128. .cell-content {
  129. flex: 1;
  130. .content-status {
  131. width: 100%;
  132. height: 50rpx;
  133. line-height: 50rpx;
  134. text-indent: 10rpx;
  135. border-bottom: 1rpx solid #f2f2f2;
  136. }
  137. }
  138. .radio-wrapper {
  139. padding: 10rpx 20rpx;
  140. border-bottom: 1px solid $border-color;
  141. margin-left: -8rpx;
  142. }
  143. /deep/uni-textarea {
  144. width: 100%;
  145. box-sizing: border-box;
  146. }
  147. .result-text {
  148. min-height: 100rpx;
  149. padding: 10rpx;
  150. }
  151. .cell-content {
  152. padding-left: 8rpx;
  153. }
  154. .radio-wrapper {
  155. display: flex;
  156. align-items: center;
  157. justify-content: space-around;
  158. }
  159. .wrapper-box {
  160. width: 45%;
  161. height: 80rpx;
  162. line-height: 80rpx;
  163. text-align: center;
  164. border: 1rpx solid #000;
  165. color: #000;
  166. border-radius: 15rpx;
  167. }
  168. }
  169. </style>