workOrderReportAcceptanceDialog.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <u-popup
  3. :show="visible"
  4. mode="bottom"
  5. :round="10"
  6. :closeOnClickOverlay="false"
  7. @close="cancel"
  8. class="acceptance-popup"
  9. >
  10. <view class="popup-content">
  11. <view class="popup-header">
  12. <text class="popup-title">验收</text>
  13. <view class="close-btn" @click="cancel">×</view>
  14. </view>
  15. <scroll-view class="popup-body" scroll-y>
  16. <view class="card-a">
  17. <view class="card-section">
  18. <u--form
  19. labelPosition="left"
  20. labelWidth="200rpx"
  21. :model="form"
  22. :rules="rules"
  23. ref="formRef"
  24. >
  25. <u-form-item label="演练效果和总结评价" prop="drillEvaluation" borderBottom required>
  26. <u--textarea
  27. v-model="form.drillEvaluation"
  28. placeholder="请输入"
  29. border="none"
  30. height="120rpx"
  31. />
  32. </u-form-item>
  33. <u-form-item label="存在的问题及整改措施" prop="drillEvaluationMeasure" borderBottom>
  34. <u--textarea
  35. v-model="form.drillEvaluationMeasure"
  36. placeholder="请输入"
  37. border="none"
  38. height="120rpx"
  39. />
  40. </u-form-item>
  41. <u-form-item label="整改情况" prop="inspectionRecordRectification" borderBottom>
  42. <u--textarea
  43. v-model="form.inspectionRecordRectification"
  44. placeholder="请输入"
  45. border="none"
  46. height="120rpx"
  47. />
  48. </u-form-item>
  49. <u-form-item label="验收结果" prop="inspectionResult" borderBottom required>
  50. <u--input
  51. v-model="form.inspectionResult"
  52. placeholder="请输入"
  53. border="none"
  54. inputAlign="right"
  55. />
  56. </u-form-item>
  57. <u-form-item label="验收人" prop="inspectorName" borderBottom>
  58. <u--input v-model="form.inspectorName" disabled border="none" inputAlign="right" />
  59. </u-form-item>
  60. <u-form-item label="附件" prop="inspectionRecordAttachment" borderBottom>
  61. <fileMain v-model="form.inspectionRecordAttachment" />
  62. </u-form-item>
  63. </u--form>
  64. </view>
  65. </view>
  66. </scroll-view>
  67. <view class="popup-footer">
  68. <u-button type="default" @click="cancel">取消</u-button>
  69. <u-button type="primary" @click="save" :loading="loading">提交</u-button>
  70. </view>
  71. </view>
  72. <u-toast ref="uToast" />
  73. </u-popup>
  74. </template>
  75. <script>
  76. import fileMain from '@/pages/doc/index.vue';
  77. import { evaluate } from '@/api/emergencyDrill/workOrder.js';
  78. export default {
  79. components: { fileMain },
  80. data() {
  81. return {
  82. visible: false,
  83. loading: false,
  84. form: {
  85. id: '',
  86. drillEvaluation: '',
  87. drillEvaluationMeasure: '',
  88. inspectionRecordRectification: '',
  89. inspectionResult: '',
  90. inspectorName: '',
  91. inspector: '',
  92. inspectionRecordAttachment: []
  93. },
  94. rules: {
  95. drillEvaluation: { type: 'string', required: true, message: '请输入演练效果和总结评价', trigger: ['blur', 'change'] },
  96. inspectionResult: { type: 'string', required: true, message: '请输入验收结果', trigger: ['blur', 'change'] }
  97. }
  98. };
  99. },
  100. methods: {
  101. open(row) {
  102. this.visible = true;
  103. const userInfo = uni.getStorageSync('userInfo') || {};
  104. this.form = {
  105. id: row.id,
  106. drillEvaluation: '',
  107. drillEvaluationMeasure: '',
  108. inspectionRecordRectification: '',
  109. inspectionResult: '',
  110. inspectorName: userInfo.name || '',
  111. inspector: userInfo.userId || '',
  112. inspectionRecordAttachment: []
  113. };
  114. this.$nextTick(() => {
  115. if (this.$refs.formRef) {
  116. this.$refs.formRef.setRules(this.rules);
  117. }
  118. });
  119. },
  120. cancel() {
  121. this.visible = false;
  122. this.form = {
  123. id: '',
  124. drillEvaluation: '',
  125. drillEvaluationMeasure: '',
  126. inspectionRecordRectification: '',
  127. inspectionResult: '',
  128. inspectorName: '',
  129. inspector: '',
  130. inspectionRecordAttachment: []
  131. };
  132. },
  133. async save() {
  134. try {
  135. if (this.$refs.formRef) {
  136. await this.$refs.formRef.validate();
  137. }
  138. this.loading = true;
  139. await evaluate(this.form);
  140. this.$refs.uToast.show({ type: 'success', message: '验收成功' });
  141. this.cancel();
  142. this.$emit('reload');
  143. } catch (e) {
  144. if (e && e.message) {
  145. this.$refs.uToast.show({ type: 'error', message: e.message });
  146. }
  147. } finally {
  148. this.loading = false;
  149. }
  150. }
  151. }
  152. };
  153. </script>
  154. <style lang="scss" scoped>
  155. .acceptance-popup {
  156. /deep/ .u-popup__content {
  157. border-radius: 32rpx 32rpx 0 0;
  158. overflow: hidden;
  159. }
  160. .popup-content {
  161. height: calc(100vh - 100px);
  162. display: flex;
  163. flex-direction: column;
  164. background: #eff2f7;
  165. }
  166. .popup-header {
  167. display: flex;
  168. justify-content: space-between;
  169. align-items: center;
  170. padding: 30rpx 32rpx;
  171. background: #fff;
  172. border-bottom: 2rpx solid #eef2f6;
  173. flex-shrink: 0;
  174. .popup-title {
  175. font-size: 36rpx;
  176. font-weight: bold;
  177. color: #1f2b3c;
  178. }
  179. .close-btn {
  180. width: 60rpx;
  181. height: 60rpx;
  182. display: flex;
  183. align-items: center;
  184. justify-content: center;
  185. font-size: 52rpx;
  186. color: #8e9aae;
  187. line-height: 1;
  188. }
  189. }
  190. .popup-body {
  191. flex: 1;
  192. overflow-y: auto;
  193. padding: 24rpx;
  194. }
  195. .card-a {
  196. background: #ffffff;
  197. border-radius: 48rpx;
  198. box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.05);
  199. overflow: hidden;
  200. }
  201. .card-section {
  202. padding: 30rpx 32rpx;
  203. }
  204. /deep/ .u-form-item {
  205. padding: 12rpx 0;
  206. .u-form-item__body__left__label {
  207. font-size: 26rpx !important;
  208. color: #6c7a91 !important;
  209. }
  210. .u-textarea__field {
  211. font-size: 26rpx !important;
  212. min-height: 100rpx;
  213. }
  214. .u-input__content__field-wrapper__field {
  215. font-size: 26rpx !important;
  216. text-align: right;
  217. }
  218. }
  219. .popup-footer {
  220. display: flex;
  221. padding: 16rpx 24rpx;
  222. background: #fff;
  223. border-top: 2rpx solid #eef2f6;
  224. gap: 16rpx;
  225. flex-shrink: 0;
  226. /deep/ .u-button {
  227. flex: 1;
  228. border-radius: 48rpx;
  229. height: 72rpx;
  230. }
  231. }
  232. }
  233. </style>