do-and-check.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="com-plan-content">
  3. <view class="title">
  4. <text>
  5. {{ type === 'do' ? '执行过程记录(Do)' : '改善确认(Check)'}}
  6. </text>
  7. </view>
  8. <template v-for="(item, i) in recordList">
  9. <view class="item-view" :key="type + i">
  10. <view class="top-action">
  11. <text>改善确认({{ i + 1 }})</text>
  12. <text class="blue-text"
  13. v-if="!disabled"
  14. @click="delRecord(i)" >
  15. 删除
  16. </text>
  17. </view>
  18. <view class="main">
  19. <view class="row">
  20. <view class="label-view">
  21. <text>过程记录</text>
  22. </view>
  23. <view class="content">
  24. <textarea class="textarea"
  25. :key="type"
  26. placeholder="请输入"
  27. placeholder-style="color: #B8BECC"
  28. :maxlength="-1"
  29. auto-height
  30. :value="item.record"
  31. :disabled="disabled"
  32. @input="changeRecord($event, i)"
  33. />
  34. </view>
  35. </view>
  36. <view class="row row-heigth">
  37. <view class="label-view">
  38. <text>计划日期</text>
  39. </view>
  40. <view class="time-pick">
  41. <date-time-picker
  42. :height="140"
  43. :pickIndex="i"
  44. :defaultValue="item.date"
  45. :disabled="disabled"
  46. @change="changeDateTime" />
  47. </view>
  48. </view>
  49. <template v-if="showUploadImg">
  50. <tm-upload-img
  51. label="改善效果"
  52. :filePaths="item.filePath"
  53. :disabled="disabled"
  54. @changeFilePaths="changeFilePaths"
  55. />
  56. </template>
  57. </view>
  58. </view>
  59. </template>
  60. <view class="add-btn" @click="addRecord" v-if="!disabled">
  61. <text class="blue-text">
  62. <text class="big">+</text>
  63. 增加一条记录
  64. </text>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. // 执行过程记录(Do)和 改善确认(Check)
  70. export default {
  71. props: {
  72. // 多行文本框标题
  73. type: {
  74. type: String,
  75. default: 'do'
  76. },
  77. // 是否展示上传图片行
  78. showUploadImg: {
  79. type: Boolean,
  80. default: false
  81. },
  82. // 是否禁用
  83. disabled: {
  84. type: Boolean,
  85. default: false
  86. },
  87. // 控制记录列表数组
  88. recordList: {
  89. type: Array,
  90. default: () => {
  91. return [{record: '', date: '', filePath: [] }]
  92. }
  93. },
  94. },
  95. methods: {
  96. // 过程记录变化
  97. changeRecord(e, index) {
  98. let _recordList = [...this.recordList];
  99. _recordList[index].record = e.target.value;
  100. this.$emit('changeRecordList', _recordList);
  101. },
  102. // 日期时间改变
  103. changeDateTime(dateObj, pickType, index) {
  104. let _recordList = [...this.recordList];
  105. _recordList[index].date = dateObj.f4;
  106. this.$emit('changeRecordList', _recordList);
  107. },
  108. // 改善效果改变
  109. changeFilePaths(filePaths, index) {
  110. let _recordList = [...this.recordList];
  111. _recordList[index].filePath = filePaths;
  112. this.$emit('changeRecordList', _recordList);
  113. },
  114. // 新增一条记录
  115. addRecord() {
  116. this.$emit('changeRecordList', [...this.recordList, {record: '', date: '', filePath: [] }]);
  117. },
  118. // 删除记录
  119. delRecord(index) {
  120. this.$emit('changeRecordList', this.recordList.filter((item, i) => i != index));
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="less">
  126. .com-plan-content {
  127. height: 100%;
  128. padding-top: 35rpx;
  129. .title {
  130. line-height: 35rpx;
  131. padding: 0 25rpx;
  132. text {
  133. font-size: 35rpx;
  134. color: #292C33;
  135. }
  136. }
  137. .blue-text {
  138. font-size: 23.75rpx;
  139. color: #3377FF !important;
  140. .big {
  141. font-size: 28.75rpx;
  142. }
  143. }
  144. .item-view {
  145. .top-action {
  146. display: flex;
  147. align-items: center;
  148. justify-content: space-between;
  149. margin-top: 25rpx;
  150. margin-bottom: 15rpx;
  151. height: 22.5rpx;
  152. padding: 0 25rpx;
  153. text {
  154. font-size: 22.5rpx;
  155. color: #666F80;
  156. }
  157. }
  158. .main {
  159. background-color: #fff;
  160. .row {
  161. display: flex;
  162. border-bottom: 0.62rpx solid #DADEE6;
  163. padding-left: 25rpx;
  164. .label-view {
  165. width: 175rpx;
  166. line-height: 22.5rpx;
  167. padding: 31.25rpx 0;
  168. >text {
  169. font-size: 22.5rpx;
  170. color: #666F80;
  171. }
  172. }
  173. .content {
  174. flex: 1;
  175. padding: 25rpx 0;
  176. .textarea {
  177. width: 100%;
  178. min-height: 200rpx;
  179. padding: 0 25rpx;
  180. line-height: 38rpx;
  181. font-size: 22.5rpx;
  182. color: #525866;
  183. box-sizing: border-box;
  184. }
  185. >text {
  186. font-size: 22.5rpx;
  187. color: #B8BECC;
  188. }
  189. }
  190. .time-pick {
  191. flex: 1;
  192. }
  193. }
  194. .row-heigth {
  195. .label-view {
  196. line-height: 22.5rpx;
  197. padding: 31.25rpx 0;
  198. }
  199. }
  200. }
  201. }
  202. .add-btn {
  203. display: flex;
  204. justify-content: center;
  205. align-items: center;
  206. height: 75rpx;
  207. background-color: #fff;
  208. border-top: 0.62rpx solid #DADEE6;
  209. }
  210. }
  211. </style>