do-and-check.vue 4.9 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" v-if="!disabled" @click="delRecord(i)">
  13. 删除
  14. </text>
  15. </view>
  16. <view class="main">
  17. <view class="row">
  18. <view class="label-view">
  19. <text>过程记录</text>
  20. </view>
  21. <view class="content">
  22. <textarea class="textarea" :key="type" placeholder="请输入" placeholder-style="color: #B8BECC"
  23. :maxlength="500" auto-height :value="item.record" :disabled="disabled"
  24. @input="changeRecord($event, i)" />
  25. </view>
  26. </view>
  27. <view class="row row-heigth">
  28. <view class="label-view">
  29. <text>计划日期</text>
  30. </view>
  31. <view class="time-pick">
  32. <date-time-picker :height="140" :pickIndex="i" :defaultValue="item.date"
  33. :disabled="disabled" @change="changeDateTime" />
  34. </view>
  35. </view>
  36. <template v-if="showUploadImg">
  37. <tm-upload-img label="改善效果" :filePaths="item.filePath" :disabled="disabled"
  38. @changeFilePaths="changeFilePaths" />
  39. </template>
  40. </view>
  41. </view>
  42. </template>
  43. <view class="add-btn" @click="addRecord" v-if="!disabled">
  44. <text class="blue-text">
  45. <text class="big">+</text>
  46. 增加一条记录
  47. </text>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. // 执行过程记录(Do)和 改善确认(Check)
  53. export default {
  54. props: {
  55. // 多行文本框标题
  56. type: {
  57. type: String,
  58. default: 'do'
  59. },
  60. // 是否展示上传图片行
  61. showUploadImg: {
  62. type: Boolean,
  63. default: false
  64. },
  65. // 是否禁用
  66. disabled: {
  67. type: Boolean,
  68. default: false
  69. },
  70. // 控制记录列表数组
  71. recordList: {
  72. type: Array,
  73. default: () => {
  74. return [{
  75. record: '',
  76. date: '',
  77. filePath: []
  78. }]
  79. }
  80. },
  81. },
  82. methods: {
  83. // 过程记录变化
  84. changeRecord(e, index) {
  85. let _recordList = [...this.recordList];
  86. _recordList[index].record = e.target.value;
  87. this.$emit('changeRecordList', _recordList);
  88. },
  89. // 日期时间改变
  90. changeDateTime(dateObj, pickType, index) {
  91. let _recordList = [...this.recordList];
  92. _recordList[index].date = dateObj.f4;
  93. this.$emit('changeRecordList', _recordList);
  94. },
  95. // 改善效果改变
  96. /**
  97. * @param {{
  98. files
  99. index,
  100. }} fileInfo
  101. files:文件集合
  102. index:当前编辑的下标
  103. */
  104. changeFilePaths({
  105. files,
  106. index
  107. }) {
  108. let _recordList = [...this.recordList];
  109. _recordList[index].filePath = files;
  110. this.$emit('changeRecordList', _recordList);
  111. },
  112. // 新增一条记录
  113. addRecord() {
  114. this.$emit('changeRecordList', [...this.recordList, {
  115. record: '',
  116. date: '',
  117. filePath: []
  118. }]);
  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>