processDialog.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <u-popup
  3. :show="visible"
  4. mode="bottom"
  5. :round="10"
  6. :closeOnClickOverlay="false"
  7. @close="cancel"
  8. class="process-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></view
  14. >
  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. ref="formRef"
  23. >
  24. <u-form-item label="事故事件名称" borderBottom
  25. ><u--input
  26. v-model="form.acdntName"
  27. disabled
  28. border="none"
  29. inputAlign="right"
  30. /></u-form-item>
  31. <u-form-item label="责任单位" borderBottom
  32. ><u--input
  33. v-model="form.dutyUnitName"
  34. disabled
  35. border="none"
  36. inputAlign="right"
  37. /></u-form-item>
  38. </u--form>
  39. </view>
  40. <!-- 四个模块 -->
  41. <view
  42. class="card-section"
  43. v-for="section in sections"
  44. :key="section.key"
  45. >
  46. <view class="section-title">{{ section.title }}</view>
  47. <u--form
  48. labelPosition="left"
  49. labelWidth="200rpx"
  50. :model="form"
  51. ref="formRef"
  52. >
  53. <u-form-item :label="section.statusLabel" borderBottom>
  54. <u-radio-group
  55. v-model="form[section.statusKey]"
  56. placement="row"
  57. >
  58. <u-radio :name="1" :labelSize="24"
  59. >已{{ section.statusLabel.replace("是否", "") }}</u-radio
  60. >
  61. <u-radio :name="0" :labelSize="24"
  62. >未{{ section.statusLabel.replace("是否", "") }}</u-radio
  63. >
  64. </u-radio-group>
  65. </u-form-item>
  66. <u-form-item label="备注" borderBottom>
  67. <u--textarea
  68. v-model="form[section.noteKey]"
  69. placeholder="请输入"
  70. height="100rpx"
  71. />
  72. </u-form-item>
  73. <u-form-item label="相关材料" borderBottom>
  74. <fileMain v-model="form[section.materialKey]" type="add" />
  75. </u-form-item>
  76. </u--form>
  77. </view>
  78. </view>
  79. </scroll-view>
  80. <view class="popup-footer">
  81. <u-button type="default" @click="cancel">取消</u-button>
  82. <u-button type="primary" @click="save" :loading="loading"
  83. >保存</u-button
  84. >
  85. </view>
  86. </view>
  87. <u-toast ref="uToast" />
  88. </u-popup>
  89. </template>
  90. <script>
  91. import fileMain from '@/pages/doc/index.vue';
  92. import { getById, updatePartial } from "@/api/accidentReport/index.js";
  93. const defForm = {
  94. acdntName: "",
  95. dutyUnitName: "",
  96. ascertainedStatus: 0,
  97. ascertainedNote: "",
  98. ascertainedMaterials: [],
  99. responsibilityStatus: 0,
  100. responsibilityNote: "",
  101. responsibilityMaterials: [],
  102. correctiveMeasuresStatus: 0,
  103. correctiveMeasuresNote: "",
  104. correctiveMeasuresMaterials: [],
  105. personnelEducationStatus: 0,
  106. personnelEducationNote: "",
  107. personnelEducationMaterials: [],
  108. };
  109. export default {
  110. components: { fileMain },
  111. data() {
  112. return {
  113. visible: false,
  114. loading: false,
  115. form: JSON.parse(JSON.stringify(defForm)),
  116. sections: [
  117. {
  118. key: "ascertained",
  119. title: "事故查明情况",
  120. statusLabel: "是否查清",
  121. statusKey: "ascertainedStatus",
  122. noteKey: "ascertainedNote",
  123. materialKey: "ascertainedMaterials",
  124. },
  125. {
  126. key: "responsibility",
  127. title: "责任人员处理",
  128. statusLabel: "是否处理",
  129. statusKey: "responsibilityStatus",
  130. noteKey: "responsibilityNote",
  131. materialKey: "responsibilityMaterials",
  132. },
  133. {
  134. key: "corrective",
  135. title: "整改措施落实",
  136. statusLabel: "是否落实",
  137. statusKey: "correctiveMeasuresStatus",
  138. noteKey: "correctiveMeasuresNote",
  139. materialKey: "correctiveMeasuresMaterials",
  140. },
  141. {
  142. key: "education",
  143. title: "相关人员教育",
  144. statusLabel: "是否教育",
  145. statusKey: "personnelEducationStatus",
  146. noteKey: "personnelEducationNote",
  147. materialKey: "personnelEducationMaterials",
  148. },
  149. ],
  150. };
  151. },
  152. methods: {
  153. async open(row) {
  154. this.visible = true;
  155. const data = await getById(row.id);
  156. this.form = { ...JSON.parse(JSON.stringify(defForm)), ...data };
  157. },
  158. cancel() {
  159. this.visible = false;
  160. this.form = JSON.parse(JSON.stringify(defForm));
  161. },
  162. async save() {
  163. this.loading = true;
  164. try {
  165. await updatePartial(this.form);
  166. this.$refs.uToast.show({ type: "success", message: "处理成功" });
  167. this.cancel();
  168. this.$emit("reload");
  169. } catch (e) {
  170. this.$refs.uToast.show({ type: "error", message: e.message });
  171. } finally {
  172. this.loading = false;
  173. }
  174. },
  175. },
  176. };
  177. </script>
  178. <style lang="scss" scoped>
  179. .process-popup {
  180. /deep/ .u-popup__content {
  181. border-radius: 32rpx 32rpx 0 0;
  182. overflow: hidden;
  183. }
  184. }
  185. .popup-content {
  186. height: calc(100vh - 100px);
  187. display: flex;
  188. flex-direction: column;
  189. background: #eff2f7;
  190. }
  191. .popup-header {
  192. display: flex;
  193. justify-content: space-between;
  194. align-items: center;
  195. padding: 30rpx 32rpx;
  196. background: #fff;
  197. border-bottom: 2rpx solid #eef2f6;
  198. flex-shrink: 0;
  199. .popup-title {
  200. font-size: 36rpx;
  201. font-weight: bold;
  202. color: #1f2b3c;
  203. }
  204. .close-btn {
  205. width: 60rpx;
  206. height: 60rpx;
  207. display: flex;
  208. align-items: center;
  209. justify-content: center;
  210. font-size: 52rpx;
  211. color: #8e9aae;
  212. }
  213. }
  214. .popup-body {
  215. flex: 1;
  216. overflow-y: auto;
  217. padding: 24rpx;
  218. }
  219. .card-a {
  220. background: #fff;
  221. border-radius: 48rpx;
  222. box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.05);
  223. overflow: hidden;
  224. }
  225. .card-section {
  226. padding: 30rpx 32rpx;
  227. &:not(:last-child) {
  228. border-bottom: 2rpx solid #f0f2f5;
  229. }
  230. }
  231. .section-title {
  232. font-size: 30rpx;
  233. font-weight: 700;
  234. color: #1f2a44;
  235. margin-bottom: 24rpx;
  236. padding-left: 16rpx;
  237. border-left: 6rpx solid #4caf50;
  238. }
  239. /deep/ .u-form-item {
  240. .u-form-item__body__left__label {
  241. font-size: 26rpx !important;
  242. color: #6c7a91 !important;
  243. }
  244. .u-radio-group .u-radio {
  245. margin-right: 24rpx;
  246. }
  247. }
  248. .popup-footer {
  249. display: flex;
  250. padding: 16rpx 24rpx;
  251. background: #fff;
  252. border-top: 2rpx solid #eef2f6;
  253. gap: 16rpx;
  254. flex-shrink: 0;
  255. /deep/ .u-button {
  256. flex: 1;
  257. border-radius: 48rpx;
  258. height: 72rpx;
  259. }
  260. }
  261. </style>