do-and-check.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. console.log('日期时间', dateObj.f4, index);
  107. this.$emit('changeRecordList', _recordList);
  108. },
  109. // 改善效果改变
  110. changeFilePaths(filePaths, index) {
  111. let _recordList = [...this.recordList];
  112. _recordList[index].filePath = filePaths;
  113. console.log('改善效果', filePaths, index);
  114. this.$emit('changeRecordList', _recordList);
  115. },
  116. // 新增一条记录
  117. addRecord() {
  118. this.$emit('changeRecordList', [...this.recordList, {record: '', date: '', filePath: [] }]);
  119. },
  120. // 删除记录
  121. delRecord(index) {
  122. this.$emit('changeRecordList', this.recordList.filter((item, i) => i != index));
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="less">
  128. .com-plan-content {
  129. height: 100%;
  130. padding-top: 35rpx;
  131. .title {
  132. line-height: 35rpx;
  133. padding: 0 25rpx;
  134. text {
  135. font-size: 35rpx;
  136. color: #292C33;
  137. }
  138. }
  139. .blue-text {
  140. font-size: 23.75rpx;
  141. color: #3377FF !important;
  142. .big {
  143. font-size: 28.75rpx;
  144. }
  145. }
  146. .item-view {
  147. .top-action {
  148. display: flex;
  149. align-items: center;
  150. justify-content: space-between;
  151. margin-top: 25rpx;
  152. margin-bottom: 15rpx;
  153. height: 22.5rpx;
  154. padding: 0 25rpx;
  155. text {
  156. font-size: 22.5rpx;
  157. color: #666F80;
  158. }
  159. }
  160. .main {
  161. background-color: #fff;
  162. .row {
  163. display: flex;
  164. border-bottom: 0.62rpx solid #DADEE6;
  165. padding-left: 25rpx;
  166. .label-view {
  167. width: 175rpx;
  168. line-height: 22.5rpx;
  169. padding: 31.25rpx 0;
  170. >text {
  171. font-size: 22.5rpx;
  172. color: #666F80;
  173. }
  174. }
  175. .content {
  176. flex: 1;
  177. padding: 25rpx 0;
  178. .textarea {
  179. width: 100%;
  180. min-height: 200rpx;
  181. padding: 0 25rpx;
  182. line-height: 38rpx;
  183. font-size: 22.5rpx;
  184. color: #525866;
  185. box-sizing: border-box;
  186. }
  187. >text {
  188. font-size: 22.5rpx;
  189. color: #B8BECC;
  190. }
  191. }
  192. .time-pick {
  193. flex: 1;
  194. }
  195. }
  196. .row-heigth {
  197. .label-view {
  198. line-height: 22.5rpx;
  199. padding: 31.25rpx 0;
  200. }
  201. }
  202. }
  203. }
  204. .add-btn {
  205. display: flex;
  206. justify-content: center;
  207. align-items: center;
  208. height: 75rpx;
  209. background-color: #fff;
  210. border-top: 0.62rpx solid #DADEE6;
  211. }
  212. }
  213. </style>