CheckCard copy.vue 4.1 KB

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