MonthlyReportAdd.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. <template>
  2. <div class="monthly-report-add">
  3. <el-form
  4. ref="formRef"
  5. :model="reportInfo"
  6. :rules="formRules"
  7. label-width="auto"
  8. class="report-form">
  9. <!-- 1. 基本信息 -->
  10. <el-card class="form-section" shadow="hover">
  11. <template #header>
  12. <div class="section-header">
  13. <Icon icon="ep:document" class="mr-5px" />
  14. <span>基本信息</span>
  15. </div>
  16. </template>
  17. <el-row :gutter="16">
  18. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  19. <el-form-item label="部门名称" prop="deptId">
  20. <el-tree-select
  21. clearable
  22. v-model="reportInfo.deptId"
  23. :data="deptList2"
  24. :props="defaultProps"
  25. :check-strictly="false"
  26. node-key="id"
  27. filterable
  28. disabled
  29. placeholder="请选择所属队伍" />
  30. </el-form-item>
  31. </el-col>
  32. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  33. <el-form-item label="月报标题" prop="title">
  34. <el-input disabled v-model="reportInfo.title" placeholder="请输入月报标题" />
  35. </el-form-item>
  36. </el-col>
  37. </el-row>
  38. <el-row :gutter="16">
  39. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  40. <el-form-item label="年月" prop="yearMonths">
  41. <el-date-picker
  42. v-model="reportInfo.yearMonths"
  43. type="month"
  44. placeholder="选择年月"
  45. disabled
  46. format="YYYY-MM"
  47. value-format="YYYY-MM"
  48. style="width: 100%" />
  49. </el-form-item>
  50. </el-col>
  51. </el-row>
  52. </el-card>
  53. <!-- 2. 人工时和安全行驶公里数 -->
  54. <el-card class="form-section" shadow="hover">
  55. <template #header>
  56. <div class="section-header">
  57. <Icon icon="ep:user" class="mr-5px" />
  58. <span>人工时和安全行驶公里数</span>
  59. </div>
  60. </template>
  61. <el-row :gutter="16">
  62. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  63. <el-form-item label="员工人数" prop="employee">
  64. <el-input-number
  65. v-model="reportInfo.employee"
  66. :min="0"
  67. :precision="0"
  68. controls-position="right"
  69. style="width: 100%" />
  70. </el-form-item>
  71. </el-col>
  72. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  73. <el-form-item label="分包商人数" prop="subcontractors">
  74. <el-input-number
  75. v-model="reportInfo.subcontractors"
  76. :min="0"
  77. :precision="0"
  78. controls-position="right"
  79. style="width: 100%" />
  80. </el-form-item>
  81. </el-col>
  82. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  83. <el-form-item label="安全行驶里程数(公里)" prop="drivingMileage">
  84. <el-input-number
  85. v-model="reportInfo.drivingMileage"
  86. :min="0"
  87. :precision="2"
  88. controls-position="right"
  89. style="width: 100%" />
  90. </el-form-item>
  91. </el-col>
  92. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  93. <el-form-item label="总人工时数(小时)" prop="totalManHours">
  94. <el-input-number
  95. v-model="reportInfo.totalManHours"
  96. :min="0"
  97. :precision="2"
  98. controls-position="right"
  99. style="width: 100%" />
  100. </el-form-item>
  101. </el-col>
  102. </el-row>
  103. </el-card>
  104. <!-- 3. QHSE被动性指标统计 -->
  105. <el-card class="form-section" shadow="hover">
  106. <template #header>
  107. <div class="section-header">
  108. <Icon icon="ep:warning" class="mr-5px" />
  109. <span>QHSE被动性指标统计</span>
  110. </div>
  111. </template>
  112. <el-row :gutter="16">
  113. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  114. <el-form-item label="无事故累计天数" prop="withoutAccident">
  115. <el-input-number
  116. v-model="reportInfo.withoutAccident"
  117. :min="0"
  118. :precision="0"
  119. controls-position="right"
  120. style="width: 100%" />
  121. </el-form-item>
  122. </el-col>
  123. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  124. <el-form-item label="死亡事故(起)" prop="fatality">
  125. <el-input-number
  126. v-model="reportInfo.fatality"
  127. :min="0"
  128. :precision="0"
  129. controls-position="right"
  130. style="width: 100%" />
  131. </el-form-item>
  132. </el-col>
  133. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  134. <el-form-item label="损失工时事故(起)" prop="injury">
  135. <el-input-number
  136. v-model="reportInfo.injury"
  137. :min="0"
  138. :precision="0"
  139. controls-position="right"
  140. style="width: 100%" />
  141. </el-form-item>
  142. </el-col>
  143. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  144. <el-form-item label="工作受限事件(起)" prop="restrictedCase">
  145. <el-input-number
  146. v-model="reportInfo.restrictedCase"
  147. :min="0"
  148. :precision="0"
  149. controls-position="right"
  150. style="width: 100%" />
  151. </el-form-item>
  152. </el-col>
  153. </el-row>
  154. <el-row :gutter="16">
  155. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  156. <el-form-item label="医疗处理事件(起)" prop="medicalCase">
  157. <el-input-number
  158. v-model="reportInfo.medicalCase"
  159. :min="0"
  160. :precision="0"
  161. controls-position="right"
  162. style="width: 100%" />
  163. </el-form-item>
  164. </el-col>
  165. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  166. <el-form-item label="急救箱事件(起)" prop="firstAidCase">
  167. <el-input-number
  168. v-model="reportInfo.firstAidCase"
  169. :min="0"
  170. :precision="0"
  171. controls-position="right"
  172. style="width: 100%" />
  173. </el-form-item>
  174. </el-col>
  175. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  176. <el-form-item label="交通事故(起)" prop="vehicleAccident">
  177. <el-input-number
  178. v-model="reportInfo.vehicleAccident"
  179. :min="0"
  180. :precision="0"
  181. controls-position="right"
  182. style="width: 100%" />
  183. </el-form-item>
  184. </el-col>
  185. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  186. <el-form-item label="未遂事件(起)" prop="nearMiss">
  187. <el-input-number
  188. v-model="reportInfo.nearMiss"
  189. :min="0"
  190. :precision="0"
  191. controls-position="right"
  192. style="width: 100%" />
  193. </el-form-item>
  194. </el-col>
  195. </el-row>
  196. <el-row :gutter="16">
  197. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  198. <el-form-item label="泄漏事件(起)" prop="spill">
  199. <el-input-number
  200. v-model="reportInfo.spill"
  201. :min="0"
  202. :precision="0"
  203. controls-position="right"
  204. style="width: 100%" />
  205. </el-form-item>
  206. </el-col>
  207. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  208. <el-form-item label="违反保命规则的次数(次)" prop="lifeSavingRules">
  209. <el-input-number
  210. v-model="reportInfo.lifeSavingRules"
  211. :min="0"
  212. :precision="0"
  213. controls-position="right"
  214. style="width: 100%" />
  215. </el-form-item>
  216. </el-col>
  217. </el-row>
  218. </el-card>
  219. <!-- 4. QHSE主动性指标统计 -->
  220. <el-card class="form-section" shadow="hover">
  221. <template #header>
  222. <div class="section-header">
  223. <Icon icon="ep:checked" class="mr-5px" />
  224. <span>QHSE主动性指标统计</span>
  225. </div>
  226. </template>
  227. <el-row :gutter="16">
  228. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  229. <el-form-item label="班前会(次)" prop="toolboxTalk">
  230. <el-input-number
  231. v-model="reportInfo.toolboxTalk"
  232. :min="0"
  233. :precision="0"
  234. controls-position="right"
  235. style="width: 100%" />
  236. </el-form-item>
  237. </el-col>
  238. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  239. <el-form-item label="QHSE管理委员会会议(次)" prop="committeeMeeting">
  240. <el-input-number
  241. v-model="reportInfo.committeeMeeting"
  242. :min="0"
  243. :precision="0"
  244. controls-position="right"
  245. style="width: 100%" />
  246. </el-form-item>
  247. </el-col>
  248. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  249. <el-form-item label="QHSE月度例会(次)" prop="monthlyMeeting">
  250. <el-input-number
  251. v-model="reportInfo.monthlyMeeting"
  252. :min="0"
  253. :precision="0"
  254. controls-position="right"
  255. style="width: 100%" />
  256. </el-form-item>
  257. </el-col>
  258. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  259. <el-form-item label="公司级隐患排查(次)" prop="companyHazard">
  260. <el-input-number
  261. v-model="reportInfo.companyHazard"
  262. :min="0"
  263. :precision="0"
  264. controls-position="right"
  265. style="width: 100%" />
  266. </el-form-item>
  267. </el-col>
  268. </el-row>
  269. <el-row :gutter="16">
  270. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  271. <el-form-item label="QHSE检查(次)" prop="qhseInspection">
  272. <el-input-number
  273. v-model="reportInfo.qhseInspection"
  274. :min="0"
  275. :precision="0"
  276. controls-position="right"
  277. style="width: 100%" />
  278. </el-form-item>
  279. </el-col>
  280. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  281. <el-form-item label="安全观察卡(张)" prop="socCards">
  282. <el-input-number
  283. v-model="reportInfo.socCards"
  284. :min="0"
  285. :precision="0"
  286. controls-position="right"
  287. disabled
  288. style="width: 100%" />
  289. </el-form-item>
  290. </el-col>
  291. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  292. <el-form-item label="工作许可审核(份)" prop="ptwAudit">
  293. <el-input-number
  294. v-model="reportInfo.ptwAudit"
  295. :min="0"
  296. :precision="0"
  297. disabled
  298. controls-position="right"
  299. style="width: 100%" />
  300. </el-form-item>
  301. </el-col>
  302. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  303. <el-form-item label="工作安全分析(次)" prop="jsa">
  304. <el-input-number
  305. v-model="reportInfo.jsa"
  306. :min="0"
  307. :precision="0"
  308. disabled
  309. controls-position="right"
  310. style="width: 100%" />
  311. </el-form-item>
  312. </el-col>
  313. </el-row>
  314. <el-row :gutter="16">
  315. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  316. <el-form-item label="演练次数" prop="drills">
  317. <el-input-number
  318. v-model="reportInfo.drills"
  319. :min="0"
  320. :precision="0"
  321. controls-position="right"
  322. style="width: 100%" />
  323. </el-form-item>
  324. </el-col>
  325. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  326. <el-form-item label="QHSE培训次数" prop="training">
  327. <el-input-number
  328. v-model="reportInfo.training"
  329. :min="0"
  330. :precision="0"
  331. controls-position="right"
  332. style="width: 100%" />
  333. </el-form-item>
  334. </el-col>
  335. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  336. <el-form-item label="QHSE培训人次" prop="participantsTraining">
  337. <el-input-number
  338. v-model="reportInfo.participantsTraining"
  339. :min="0"
  340. :precision="0"
  341. controls-position="right"
  342. style="width: 100%" />
  343. </el-form-item>
  344. </el-col>
  345. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  346. <el-form-item label="QHSE培训学时数(小时)" prop="trainingsHours">
  347. <el-input-number
  348. v-model="reportInfo.trainingsHours"
  349. :min="0"
  350. :precision="2"
  351. controls-position="right"
  352. style="width: 100%" />
  353. </el-form-item>
  354. </el-col>
  355. </el-row>
  356. </el-card>
  357. <!-- 5. 环境数据 -->
  358. <el-card class="form-section" shadow="hover">
  359. <template #header>
  360. <div class="section-header">
  361. <Icon icon="ep:sunrise" class="mr-5px" />
  362. <span>环境数据</span>
  363. </div>
  364. </template>
  365. <el-row :gutter="16">
  366. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  367. <el-form-item label="水消耗(吨)" prop="waterConsumption">
  368. <el-input-number
  369. v-model="reportInfo.waterConsumption"
  370. :min="0"
  371. :precision="2"
  372. controls-position="right"
  373. style="width: 100%" />
  374. </el-form-item>
  375. </el-col>
  376. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  377. <el-form-item label="柴油消耗(升)" prop="dieselConsumption">
  378. <el-input-number
  379. v-model="reportInfo.dieselConsumption"
  380. :min="0"
  381. :precision="2"
  382. controls-position="right"
  383. style="width: 100%" />
  384. </el-form-item>
  385. </el-col>
  386. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  387. <el-form-item label="用电量(千瓦·小时)" prop="electricityConsumption">
  388. <el-input-number
  389. v-model="reportInfo.electricityConsumption"
  390. :min="0"
  391. :precision="2"
  392. controls-position="right"
  393. style="width: 100%" />
  394. </el-form-item>
  395. </el-col>
  396. <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  397. <el-form-item label="天然气消耗量(立方米)" prop="naturalGasConsumption">
  398. <el-input-number
  399. v-model="reportInfo.naturalGasConsumption"
  400. :min="0"
  401. :precision="2"
  402. controls-position="right"
  403. style="width: 100%" />
  404. </el-form-item>
  405. </el-col>
  406. </el-row>
  407. </el-card>
  408. <!-- 6. 其他信息 -->
  409. <el-card class="form-section" shadow="hover">
  410. <template #header>
  411. <div class="section-header">
  412. <Icon icon="ep:info-filled" class="mr-5px" />
  413. <span>其他信息</span>
  414. </div>
  415. </template>
  416. <!-- <el-row :gutter="16">
  417. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  418. <el-form-item label="工单填报人" prop="dutyPerson">
  419. <el-select
  420. v-model="reportInfo.dutyPerson"
  421. filterable
  422. clearable
  423. placeholder="请选择填报人"
  424. style="width: 100%">
  425. <el-option
  426. v-for="item in userList"
  427. :key="item.id"
  428. :label="item.nickname"
  429. :value="item.id" />
  430. </el-select>
  431. </el-form-item>
  432. </el-col>
  433. </el-row> -->
  434. <el-row :gutter="16">
  435. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  436. <el-form-item label="备注" prop="remark">
  437. <el-input
  438. v-model="reportInfo.remark"
  439. type="textarea"
  440. :rows="4"
  441. placeholder="请输入备注信息" />
  442. </el-form-item>
  443. </el-col>
  444. </el-row>
  445. </el-card>
  446. <!-- 操作按钮 -->
  447. <div class="form-actions">
  448. <el-button @click="handleCancel">取消</el-button>
  449. <el-button type="primary" @click="handleSubmit" :loading="submitLoading"> 提交 </el-button>
  450. </div>
  451. </el-form>
  452. </div>
  453. </template>
  454. <script setup lang="ts">
  455. import { reactive, ref } from 'vue'
  456. import { useRouter, useRoute } from 'vue-router'
  457. import { FormInstance, FormRules } from 'element-plus'
  458. import { QhseMonthReportApi } from '@/api/pms/qhse'
  459. import { handleTree, defaultProps } from '@/utils/tree'
  460. import * as DeptApi from '@/api/system/dept'
  461. import * as UserApi from '@/api/system/user'
  462. import { getUserProfile } from '@/api/system/user/profile'
  463. import { useTagsViewStore } from '@/store/modules/tagsView'
  464. const { delView } = useTagsViewStore()
  465. defineOptions({ name: 'MonthlyReportAdd' })
  466. const router = useRouter()
  467. const route = useRoute()
  468. const message = useMessage()
  469. const deptList2 = ref<Tree[]>([]) // 树形结构
  470. const userList = ref<any[]>([])
  471. // 表单引用
  472. const formRef = ref<FormInstance>()
  473. const submitLoading = ref(false)
  474. // 表单数据
  475. let reportInfo = reactive({
  476. title: '',
  477. yearMonths: '',
  478. deptId: 0,
  479. employee: '0',
  480. subcontractors: '0',
  481. drivingMileage: '0',
  482. totalManHours: '0',
  483. withoutAccident: '0',
  484. fatality: '0',
  485. injury: '0',
  486. restrictedCase: '0',
  487. medicalCase: '0',
  488. firstAidCase: '0',
  489. vehicleAccident: '0',
  490. nearMiss: '0',
  491. spill: '0',
  492. lifeSavingRules: '0',
  493. toolboxTalk: '0',
  494. committeeMeeting: '0',
  495. monthlyMeeting: '0',
  496. companyHazard: '0',
  497. qhseInspection: '0',
  498. socCards: '0',
  499. ptwAudit: '0',
  500. jsa: '0',
  501. drills: '0',
  502. training: '0',
  503. participantsTraining: '0',
  504. trainingsHours: '0',
  505. waterConsumption: '0',
  506. dieselConsumption: '0',
  507. electricityConsumption: '0',
  508. naturalGasConsumption: '0',
  509. dutyPerson: 0,
  510. remark: ''
  511. })
  512. // 表单校验规则
  513. const formRules = reactive<FormRules>({
  514. title: [{ required: true, message: '月报标题不能为空', trigger: 'blur' }],
  515. yearMonth: [{ required: true, message: '年月不能为空', trigger: 'change' }],
  516. deptId: [{ required: true, message: '部门不能为空', trigger: 'change' }],
  517. dutyPerson: [{ required: true, message: '工单填报人不能为空', trigger: 'change' }],
  518. employee: [{ required: true, message: '员工数不能为空', trigger: 'blur' }],
  519. subcontractors: [{ required: true, message: '分包商人数不能为空', trigger: 'blur' }],
  520. drivingMileage: [{ required: true, message: '行驶里程不能为空', trigger: 'blur' }],
  521. totalManHours: [{ required: true, message: '总工时不能为空', trigger: 'blur' }],
  522. withoutAccident: [{ required: true, message: '无事故累计天数不能为空', trigger: 'blur' }],
  523. fatality: [{ required: true, message: '死亡不能为空', trigger: 'blur' }],
  524. injury: [{ required: true, message: '损失工时事故不能为空', trigger: 'blur' }],
  525. restrictedCase: [{ required: true, message: '受限事件不能为空', trigger: 'blur' }],
  526. medicalCase: [{ required: true, message: '医疗事件不能为空', trigger: 'blur' }],
  527. firstAidCase: [{ required: true, message: '急救事件不能为空', trigger: 'blur' }],
  528. vehicleAccident: [{ required: true, message: '车辆事故不能为空', trigger: 'blur' }],
  529. nearMiss: [{ required: true, message: '未遂事件次数不能为空', trigger: 'blur' }],
  530. spill: [{ required: true, message: '泄漏事件次数不能为空', trigger: 'blur' }],
  531. lifeSavingRules: [{ required: true, message: '违反保命规则的次数不能为空', trigger: 'blur' }],
  532. toolboxTalk: [{ required: true, message: '班前会次不能为空', trigger: 'blur' }],
  533. committeeMeeting: [{ required: true, message: '委员会会议不能为空', trigger: 'blur' }],
  534. monthlyMeeting: [{ required: true, message: '月度会议不能为空', trigger: 'blur' }],
  535. companyHazard: [{ required: true, message: '隐患排查次数不能为空', trigger: 'blur' }],
  536. qhseInspection: [{ required: true, message: '请填写QHSE检查次数', trigger: 'blur' }],
  537. socCards: [{ required: true, message: 'SOC 卡片不能为空', trigger: 'blur' }],
  538. ptwAudit: [{ required: true, message: 'PTW 审核不能为空', trigger: 'blur' }],
  539. jsa: [{ required: true, message: 'JSA 不能为空', trigger: 'blur' }],
  540. drills: [{ required: true, message: '演练次数不能为空', trigger: 'blur' }],
  541. training: [{ required: true, message: '培训次数不能为空', trigger: 'blur' }],
  542. participantsTraining: [{ required: true, message: 'QHSE培训人次不能为空', trigger: 'blur' }],
  543. waterConsumption: [{ required: true, message: '水耗不能为空', trigger: 'blur' }],
  544. dieselConsumption: [{ required: true, message: '柴油耗能不能为空', trigger: 'blur' }],
  545. electricityConsumption: [{ required: true, message: '电耗不能为空', trigger: 'blur' }],
  546. naturalGasConsumption: [{ required: true, message: '天然气耗不能为空', trigger: 'blur' }],
  547. trainingsHours: [{ required: true, message: '培训课时不能为空', trigger: 'blur' }],
  548. yearMonths: [{ required: true, message: '年月不能为空', trigger: 'change' }]
  549. })
  550. // 部门名称显示
  551. const deptName = ref('')
  552. /** 提交表单 */
  553. const handleSubmit = async () => {
  554. if (!formRef.value) return
  555. // 校验表单
  556. const valid = await formRef.value.validate()
  557. if (!valid) return
  558. reportInfo.dutyPerson = userInfo.value.id
  559. submitLoading.value = true
  560. try {
  561. await QhseMonthReportApi.updateQhseMonthReport(reportInfo)
  562. message.success('提交成功')
  563. // 返回列表页或上一页
  564. delView(unref(router.currentRoute))
  565. router.push({ name: 'QhseMonthlyReport', params: {} })
  566. } catch (error) {
  567. console.error('提交失败:', error)
  568. } finally {
  569. submitLoading.value = false
  570. }
  571. }
  572. /** 取消 */
  573. const handleCancel = () => {
  574. delView(unref(router.currentRoute))
  575. router.push({ name: 'QhseMonthlyReport', params: {} })
  576. }
  577. const userInfo = ref<any>({})
  578. onMounted(async () => {
  579. const users = await getUserProfile()
  580. userInfo.value = users
  581. deptList2.value = handleTree(await DeptApi.getSimpleDeptList())
  582. userList.value = await UserApi.selectedDeptsEmployee({
  583. deptIds: userInfo.value.dept.id
  584. })
  585. const res = await QhseMonthReportApi.getQhseMonthReport(route.params.id)
  586. const data = (res as any)?.data ?? res ?? {}
  587. Object.assign(reportInfo, data)
  588. })
  589. </script>
  590. <style scoped lang="scss">
  591. .monthly-report-add {
  592. padding: 12px;
  593. min-height: 100vh;
  594. background-color: #f5f7fa;
  595. .report-form {
  596. max-width: 1400px;
  597. margin: 0 auto;
  598. .form-section {
  599. margin-bottom: 16px;
  600. border-radius: 8px;
  601. :deep(.el-card__header) {
  602. padding: 12px 16px;
  603. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  604. color: white;
  605. border-radius: 8px 8px 0 0;
  606. }
  607. :deep(.el-card__body) {
  608. padding: 16px;
  609. }
  610. .section-header {
  611. display: flex;
  612. align-items: center;
  613. font-size: 15px;
  614. font-weight: 600;
  615. }
  616. :deep(.el-form-item) {
  617. margin-bottom: 16px;
  618. }
  619. :deep(.el-form-item__label) {
  620. font-size: 14px;
  621. line-height: 1.5;
  622. }
  623. :deep(.el-input),
  624. :deep(.el-input-number),
  625. :deep(.el-date-editor) {
  626. width: 100%;
  627. }
  628. :deep(.el-input-number) {
  629. .el-input__inner {
  630. text-align: left;
  631. }
  632. }
  633. }
  634. .form-actions {
  635. display: flex;
  636. justify-content: center;
  637. gap: 12px;
  638. padding: 16px 0;
  639. margin-top: 16px;
  640. background: white;
  641. border-radius: 8px;
  642. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  643. position: sticky;
  644. bottom: 0;
  645. z-index: 10;
  646. .el-button {
  647. min-width: 100px;
  648. flex: 1;
  649. max-width: 150px;
  650. height: 44px;
  651. font-size: 15px;
  652. }
  653. }
  654. }
  655. }
  656. // 移动端优化
  657. @media screen and (max-width: 768px) {
  658. .monthly-report-add {
  659. padding: 8px;
  660. .report-form {
  661. .form-section {
  662. margin-bottom: 12px;
  663. :deep(.el-card__header) {
  664. padding: 10px 12px;
  665. }
  666. :deep(.el-card__body) {
  667. padding: 12px;
  668. }
  669. .section-header {
  670. font-size: 14px;
  671. }
  672. :deep(.el-form-item__label) {
  673. font-size: 13px;
  674. padding-right: 8px;
  675. }
  676. :deep(.el-input__inner),
  677. :deep(.el-textarea__inner) {
  678. font-size: 14px;
  679. min-height: 40px;
  680. }
  681. :deep(.el-input-number) {
  682. .el-input-number__decrease,
  683. .el-input-number__increase {
  684. width: 32px;
  685. height: 40px;
  686. line-height: 40px;
  687. }
  688. .el-input__inner {
  689. height: 40px;
  690. line-height: 40px;
  691. }
  692. }
  693. :deep(.el-date-editor) {
  694. .el-input__inner {
  695. height: 40px;
  696. line-height: 40px;
  697. }
  698. }
  699. }
  700. .form-actions {
  701. padding: 12px;
  702. gap: 10px;
  703. position: fixed;
  704. bottom: 0;
  705. left: 0;
  706. right: 0;
  707. margin: 0;
  708. border-radius: 0;
  709. box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  710. .el-button {
  711. height: 44px;
  712. font-size: 15px;
  713. }
  714. }
  715. }
  716. }
  717. }
  718. // 超小屏幕优化
  719. @media screen and (max-width: 480px) {
  720. .monthly-report-add {
  721. padding: 6px;
  722. .report-form {
  723. .form-section {
  724. :deep(.el-card__body) {
  725. padding: 10px;
  726. }
  727. :deep(.el-form-item) {
  728. margin-bottom: 12px;
  729. }
  730. :deep(.el-form-item__label) {
  731. font-size: 12px;
  732. }
  733. :deep(.el-input__inner),
  734. :deep(.el-textarea__inner) {
  735. font-size: 13px;
  736. }
  737. }
  738. }
  739. }
  740. }
  741. </style>