finish.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="mx3" style="padding-bottom: 100rpx">
  3. <view class="main-color-bg" style="height: 100rpx; margin: 0 -30rpx"></view>
  4. <view class="p3 bg-color-white" style="margin-top: -50rpx; border-radius: 20rpx">
  5. <u-form :model="form" ref="uForm" :label-width="150">
  6. <u-form-item label="上传图片" :label-width="150">
  7. <m-upload-img v-model="form.imgList" :maxSize="20"></m-upload-img>
  8. </u-form-item>
  9. <u-form-item label="上传文件" :label-width="150">
  10. <m-upload v-model="form.fileList"></m-upload>
  11. </u-form-item>
  12. <u-form-item label="检查结果" prop="checkContent">
  13. <u-input v-model="form.feedback" type="textarea" :height="50" />
  14. </u-form-item>
  15. </u-form>
  16. <view class="py3 border-bottom">
  17. <view class="f-size-30 text-color-3 w200">检查项目</view>
  18. <view class="f-size-28 text-color-3 border py2" v-for="(item, index) in requirementList" :key="index">
  19. <view class="d-flex text-color-6">
  20. <view class="w180">保养周期:</view>
  21. <view class="text-color-3">{{ item.period }}</view>
  22. </view>
  23. <view class="d-flex text-color-6">
  24. <view class="w180">管理项目:</view>
  25. <view class="text-color-3">{{ item.manageItem }}</view>
  26. </view>
  27. <view class="d-flex text-color-6">
  28. <view class="w180">检查项目:</view>
  29. <view class="text-color-3">{{ item.checkItem }}</view>
  30. </view>
  31. <view class="d-flex text-color-6">
  32. <view class="w160">方法工具:</view>
  33. <view class="text-color-3">{{ item.method }}</view>
  34. </view>
  35. <view class="d-flex text-color-6">
  36. <view class="w160">保养级别:</view>
  37. <view class="text-color-3">{{ item.checkLevel }}</view>
  38. </view>
  39. <view class="d-flex text-color-6">
  40. <view class="w160">标准类型:</view>
  41. <view class="text-color-3">{{ item.sbTypeName }}</view>
  42. </view>
  43. <view class="d-flex text-color-6">
  44. <view class="w160">内容:</view>
  45. <view class="text-color-3">{{ item.remark }}</view>
  46. </view>
  47. <view class="d-flex text-color-6 items-center">
  48. <view class="w160">填报信息:</view>
  49. <view class="text-color-3" style="flex: 1">
  50. <u-input v-if="item.type == 0" v-model="item.value" :border="true" />
  51. <view v-else class="select">
  52. <my-select style="width: 100%" v-model="item.value" :list="item.options" />
  53. </view>
  54. </view>
  55. </view>
  56. <view class="d-flex text-color-6 items-center" style="margin-top: 10rpx">
  57. <view class="w160">备注:</view>
  58. <view class="text-color-3" style="flex: 1">
  59. <u-input v-model="item.text" :border="true" />
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="p-fixed d-flex j-around a-center footer">
  65. <view class="main-color-bg text-color-white common" @tap="handleSubmit">提交</view>
  66. </view>
  67. </view>
  68. <u-toast ref="uToast" />
  69. </view>
  70. </template>
  71. <script>
  72. export default {
  73. data() {
  74. return {
  75. requirementList: [],
  76. displayTime: 0,
  77. form: {
  78. checkContent: '',
  79. imgList: [],
  80. fileList: []
  81. },
  82. rules: {}
  83. }
  84. },
  85. onLoad(options) {
  86. this.form = options
  87. this.$Http.fetchCheckStandard({ id: options.standardId }).then(res => {
  88. this.requirementList =
  89. res.data.requirementList &&
  90. res.data.requirementList.map((item, index) => {
  91. return {
  92. ...item,
  93. value: null,
  94. options:
  95. item.type == '1'
  96. ? item.scope.split('-').map(item => ({
  97. label: item,
  98. value: item
  99. }))
  100. : []
  101. }
  102. })
  103. this.$Http.timerAccumulatedTime({ referenceId: options.id }).then(res => {
  104. this.form.workHours = Math.floor(res.data / 60000)
  105. this.displayTime = res.data
  106. })
  107. })
  108. },
  109. onReady() {
  110. this.$refs.uForm.setRules(this.rules)
  111. },
  112. methods: {
  113. handleSubmit() {
  114. this.$refs.uForm.validate(valid => {
  115. if (valid) {
  116. let isReturn = false
  117. this.requirementList.forEach(item => {
  118. if (!item.value && item.type == 1) {
  119. isReturn = true
  120. }
  121. })
  122. if (isReturn) {
  123. this.confirmLoading = false
  124. this.$refs.uToast.show({
  125. title: '请填写检查结果'
  126. })
  127. return
  128. }
  129. this.form.conTask = JSON.stringify(
  130. this.requirementList
  131. )
  132. // 提交实际完成时间,保证已完成任务展示完成时间
  133. this.form.actualEndTime = this.$BaseTool.Date.formatter(new Date(), this.$BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
  134. this.$Http.finishJob(this.form).then(res => {
  135. this.$refs.uToast.show({
  136. title: '操作成功'
  137. })
  138. uni.navigateBack({
  139. delta: 1
  140. })
  141. this.$Http.timerStop({ referenceId: this.form.id, finalAccumulatedTime: this.displayTime })
  142. })
  143. }
  144. })
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="less">
  150. .footer {
  151. bottom: 0;
  152. left: 0;
  153. right: 0;
  154. background-color: #fff;
  155. z-index: 10000;
  156. border-top: 1rpx solid #f4f4f4;
  157. height: 100rpx;
  158. .common {
  159. padding: 15rpx 200rpx;
  160. border-radius: 30rpx;
  161. background-color: #0082ff;
  162. color: #fff;
  163. }
  164. }
  165. .select {
  166. width: 100%;
  167. height: 40px;
  168. border-radius: 4px;
  169. border: 1px solid #dcdfe6;
  170. display: flex;
  171. align-items: center;
  172. }
  173. .w160 {
  174. width: 160rpx;
  175. }
  176. .border {
  177. border: 1rpx solid #0082ff;
  178. border-radius: 10rpx;
  179. padding: 10rpx;
  180. margin-top: 10rpx;
  181. }
  182. </style>