processDialog.vue 6.9 KB

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