do-and-check.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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" 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" isMultiple="true" />
  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. computed:{
  83. placeholder(){
  84. return this.type === 'do' ? '**具体实施方式,What项目+When时间+Where地点+Who负责人+How如何做' : '**根据目标/对策/方案/计划检测执行成果,以图来呈现,须有具体数据做比'
  85. },
  86. },
  87. methods: {
  88. // 过程记录变化
  89. changeRecord(e, index) {
  90. let _recordList = [...this.recordList];
  91. _recordList[index].record = e.target.value;
  92. this.$emit('changeRecordList', _recordList);
  93. },
  94. // 日期时间改变
  95. changeDateTime(dateObj, pickType, index) {
  96. let _recordList = [...this.recordList];
  97. _recordList[index].date = dateObj.f4;
  98. this.$emit('changeRecordList', _recordList);
  99. },
  100. // 改善效果改变
  101. /**
  102. * @param {{
  103. files
  104. index,
  105. }} fileInfo
  106. files:文件集合
  107. index:当前编辑的下标
  108. */
  109. changeFilePaths({
  110. files,
  111. index
  112. }) {
  113. let _recordList = [...this.recordList];
  114. _recordList[index].filePath = files;
  115. this.$emit('changeRecordList', _recordList);
  116. },
  117. // 新增一条记录
  118. addRecord() {
  119. this.$emit('changeRecordList', [...this.recordList, {
  120. record: '',
  121. date: '',
  122. filePath: []
  123. }]);
  124. },
  125. // 删除记录
  126. delRecord(index) {
  127. this.$emit('changeRecordList', this.recordList.filter((item, i) => i != index));
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="less">
  133. .com-plan-content {
  134. height: 100%;
  135. padding-top: 35rpx;
  136. .title {
  137. line-height: 35rpx;
  138. padding: 0 25rpx;
  139. text {
  140. font-size: 35rpx;
  141. color: #292C33;
  142. }
  143. }
  144. .blue-text {
  145. font-size: 23.75rpx;
  146. color: #3377FF !important;
  147. .big {
  148. font-size: 28.75rpx;
  149. }
  150. }
  151. .item-view {
  152. .top-action {
  153. display: flex;
  154. align-items: center;
  155. justify-content: space-between;
  156. margin-top: 25rpx;
  157. margin-bottom: 15rpx;
  158. height: 22.5rpx;
  159. padding: 0 25rpx;
  160. text {
  161. font-size: 22.5rpx;
  162. color: #666F80;
  163. }
  164. }
  165. .main {
  166. background-color: #fff;
  167. .row {
  168. display: flex;
  169. border-bottom: 0.62rpx solid #DADEE6;
  170. padding-left: 25rpx;
  171. .label-view {
  172. width: 175rpx;
  173. line-height: 22.5rpx;
  174. padding: 31.25rpx 0;
  175. >text {
  176. font-size: 22.5rpx;
  177. color: #666F80;
  178. }
  179. }
  180. .content {
  181. flex: 1;
  182. padding: 25rpx 0;
  183. .textarea {
  184. width: 100%;
  185. min-height: 200rpx;
  186. padding: 0 25rpx;
  187. line-height: 38rpx;
  188. font-size: 22.5rpx;
  189. color: #525866;
  190. box-sizing: border-box;
  191. }
  192. >text {
  193. font-size: 22.5rpx;
  194. color: #B8BECC;
  195. }
  196. }
  197. .time-pick {
  198. flex: 1;
  199. }
  200. }
  201. .row-heigth {
  202. .label-view {
  203. line-height: 22.5rpx;
  204. padding: 31.25rpx 0;
  205. }
  206. }
  207. }
  208. }
  209. .add-btn {
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. height: 75rpx;
  214. background-color: #fff;
  215. border-top: 0.62rpx solid #DADEE6;
  216. }
  217. }
  218. </style>