repairReportingWork.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <template>
  2. <!-- 报工 -->
  3. <el-dialog :visible.sync="visible" title="报工" width="80%">
  4. <el-form
  5. ref="ruleForm"
  6. :model="formData"
  7. :rules="rules"
  8. label-width="110px"
  9. >
  10. <el-form-item label="实际起始时间" prop="time">
  11. <el-date-picker
  12. v-model="formData.time"
  13. type="datetimerange"
  14. value-format="yyyy-MM-dd HH:mm:ss"
  15. range-separator="至"
  16. start-placeholder="实际开始日期"
  17. end-placeholder="实际结束日期"
  18. >
  19. </el-date-picker>
  20. </el-form-item>
  21. <div class="page">
  22. <div class="content-detail">
  23. <div class="maintain_equipment_info">
  24. <HeaderTitle title="报修设备" size="16px"></HeaderTitle>
  25. <div class="maintain_equipment_info_content">
  26. <div
  27. class="equipment_item"
  28. v-for="item in infoData.planDeviceList"
  29. :key="item.id"
  30. >
  31. <div class="equipment_info" v-if="item.substance">
  32. <div class="item_info">
  33. <span class="item_label">设备编码</span>
  34. <span class="item_value">{{ item.substance.code }}</span>
  35. </div>
  36. <div class="item_info">
  37. <span class="item_label">设备名称</span>
  38. <span class="item_value">{{ item.substance.name }}</span>
  39. </div>
  40. <div class="item_info">
  41. <span class="item_label">设备型号</span>
  42. <span class="item_value">{{ item.substance.model }}</span>
  43. </div>
  44. <div class="item_info">
  45. <span class="item_label">工单编号</span>
  46. <span class="item_value">{{ workCode }}</span>
  47. </div>
  48. <div class="item_info">
  49. <span class="item_label">设备位置</span>
  50. <span class="item_value">{{
  51. item.substance.positionNames
  52. }}</span>
  53. </div>
  54. <div class="item_info">
  55. <span class="item_label">固资编码</span>
  56. <span class="item_value">{{ item.substance.fixCode }}</span>
  57. </div>
  58. <div class="item_info">
  59. <span class="item_label">编号</span>
  60. <span class="item_value">{{
  61. item.substance.extInfo.codeNumber
  62. }}</span>
  63. </div>
  64. </div>
  65. <p>操作事项</p>
  66. <div class="ruleMatters_box">
  67. <el-table :data="item.workItems" border>
  68. <el-table-column label="序号" width="50">
  69. <template slot-scope="scope">
  70. <span>{{ scope.$index + 1 }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="事项" prop="name" width="100">
  74. <template slot-scope="scope">
  75. <div>
  76. <span>{{ scope.row.name }}</span>
  77. </div>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="内容" prop="content" width="300">
  81. <template slot-scope="scope">
  82. <div>
  83. <span>{{ scope.row.content }}</span>
  84. </div>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="操作指导" prop="operationGuide">
  88. <template slot-scope="scope">
  89. <div class="operationGuide_box">
  90. <div class="left_content">
  91. <template v-if="scope.row.operationGuide">
  92. <div
  93. v-for="(item, index) in scope.row.operationGuide
  94. .toolList"
  95. :key="item.id"
  96. >{{ index + 1 }}.{{ item.name }}</div
  97. >
  98. </template>
  99. </div>
  100. <div class="line"></div>
  101. <div class="right_content">
  102. <template v-if="scope.row.operationGuide">
  103. <div
  104. v-for="(item, index) in scope.row.operationGuide
  105. .procedureList"
  106. :key="item.id"
  107. >{{ index + 1 }}.{{ item.content }}</div
  108. >
  109. </template>
  110. </div>
  111. </div>
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="标准" prop="norm" width="100">
  115. <template slot-scope="scope">
  116. <div>
  117. <span>{{ scope.row.norm }}</span>
  118. </div>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="" prop="status" width="150">
  122. <template slot-scope="scope">
  123. <template>
  124. <el-select
  125. v-model="scope.row.status"
  126. placeholder="请选择"
  127. >
  128. <el-option
  129. v-for="item in options"
  130. :label="item.label"
  131. :value="item.value"
  132. :key="item.value"
  133. >
  134. </el-option>
  135. </el-select>
  136. </template>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="结果" prop="result" width="250">
  140. <template slot-scope="scope">
  141. <el-input
  142. v-model="scope.row.result"
  143. placeholder="请输入内容"
  144. ></el-input>
  145. </template>
  146. </el-table-column>
  147. </el-table>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. <el-row>
  155. <el-form-item label="附件:" prop="attachments">
  156. <fileMain v-model="formData.attachments"></fileMain>
  157. </el-form-item>
  158. </el-row>
  159. <el-row>
  160. <el-form-item label="处理说明:" prop="reason">
  161. <el-input
  162. type="textarea"
  163. placeholder="请输入内容"
  164. v-model="formData.reason"
  165. >
  166. </el-input>
  167. </el-form-item>
  168. </el-row>
  169. </el-form>
  170. <div slot="footer" class="footer">
  171. <el-button @click="cancel">返回</el-button>
  172. <el-button :loading="btnLoading" type="primary" @click="submit('1')"
  173. >非完成报工</el-button
  174. >
  175. <el-button :loading="btnLoading" type="primary" @click="submit('2')"
  176. >报工</el-button
  177. >
  178. </div>
  179. <redeployOther
  180. ref="redeployOtherRef"
  181. @refresh="onClose"
  182. @confirm="onConfirm"
  183. />
  184. </el-dialog>
  185. </template>
  186. <script>
  187. import { report, loseReport } from '@/api/equipment/work.js';
  188. import {
  189. getById,
  190. getRepairInfoById
  191. } from '@/api/maintenance/patrol_maintenance';
  192. import fileMain from '@/components/addDoc/index.vue';
  193. import redeployOther from '@/views/maintenance/components/redeployOther2.vue';
  194. export default {
  195. components: {
  196. fileMain,
  197. redeployOther
  198. },
  199. data() {
  200. return {
  201. formData: {
  202. time: [],
  203. reason: '',
  204. attachments: []
  205. },
  206. btnLoading: false,
  207. options: [
  208. {
  209. label: '正常',
  210. value: 0
  211. },
  212. {
  213. label: '缺陷',
  214. value: -1
  215. }
  216. ],
  217. visible: false,
  218. infoData: {},
  219. workCode: '',
  220. rules: {
  221. reason: [
  222. { required: true, message: '请输入处理说明', trigger: 'blur' }
  223. ],
  224. time: [
  225. { required: true, message: '请选择实际起始时间', trigger: 'blur' }
  226. ]
  227. },
  228. rowData: {},
  229. acceptUserId: '',
  230. hasClickOnce: false
  231. };
  232. },
  233. methods: {
  234. open(row, isRepaire) {
  235. this.formData = {
  236. time: [],
  237. reason: '',
  238. attachments: []
  239. };
  240. this.rowData = row;
  241. this.getInfo(row, isRepaire);
  242. this.hasClickOnce = false;
  243. this.visible = true;
  244. },
  245. cancel() {
  246. this.visible = false;
  247. },
  248. onClose() {
  249. this.$refs.redeployOtherRef.visible = false;
  250. this.getInfo(this.rowData);
  251. },
  252. onConfirm(val) {
  253. this.acceptUserId = val;
  254. },
  255. async submit(val) {
  256. if (val == '1') {
  257. if (
  258. !this.hasClickOnce ||
  259. this.formData.time.length < 1 ||
  260. this.formData.reason == ''
  261. ) {
  262. this.$refs.redeployOtherRef.open(this.rowData, 'noFinishSubmit');
  263. this.hasClickOnce = true;
  264. } else {
  265. this.submitForm(val);
  266. }
  267. } else {
  268. this.submitForm(val);
  269. }
  270. },
  271. async submitForm(val) {
  272. this.$refs.ruleForm.validate(async (valid) => {
  273. if (valid) {
  274. // if (this.formData.time.length > 0) {
  275. this.infoData.acceptTime = this.formData.time[0];
  276. this.infoData.finishTime = this.formData.time[1];
  277. this.infoData.deviceList = this.infoData.planDeviceList;
  278. this.infoData.reason = this.formData.reason;
  279. this.infoData.attachments = this.formData.attachments;
  280. this.btnLoading = true;
  281. let deviceList = this.infoData.deviceList
  282. .map((item) => {
  283. return item.workItems;
  284. })
  285. .flat();
  286. let boolen = deviceList.every((item) => item.status > -1);
  287. this.infoData.isAbnormal = boolen ? 1 : 0;
  288. this.infoData.acceptUserId = this.acceptUserId;
  289. if (val == '1') {
  290. loseReport(this.infoData).then((res) => {
  291. if (res.code == 0) {
  292. // this.$message.success('非报工成功');
  293. this.visible = false;
  294. this.btnLoading = false;
  295. this.$emit('refresh');
  296. }
  297. });
  298. } else {
  299. report(this.infoData).then((res) => {
  300. if (res.code == 0) {
  301. this.$message.success('报工成功');
  302. this.visible = false;
  303. this.btnLoading = false;
  304. this.$emit('refresh');
  305. }
  306. });
  307. }
  308. // } else {
  309. // this.$message.error('请选择实际起始时间');
  310. // }
  311. } else {
  312. console.log('error submit!!');
  313. return false;
  314. }
  315. });
  316. },
  317. // 表格数据
  318. async getInfo(row, isRepaire) {
  319. let res = null;
  320. if (isRepaire) {
  321. res = await getRepairInfoById({
  322. id: row.planId,
  323. workOrderId: row.id
  324. });
  325. } else {
  326. res = await getById(row.planId);
  327. }
  328. console.log(row);
  329. this.workCode = row.code;
  330. this.infoData = res.data;
  331. this.infoData.workOrderId = row.id;
  332. }
  333. }
  334. };
  335. </script>
  336. <style lang="scss" scoped>
  337. .control {
  338. display: flex;
  339. > span {
  340. width: 80px;
  341. }
  342. }
  343. .page {
  344. // padding: 10px;
  345. }
  346. .page-title {
  347. background: #fff;
  348. font-size: 18px;
  349. padding: 6px 20px;
  350. font-weight: 500;
  351. .page-title-div {
  352. margin: 5px 0;
  353. height: 30px;
  354. line-height: 30px;
  355. border-bottom: 1px solid #eaeefb;
  356. .title-div-no {
  357. margin-left: 10px;
  358. font-weight: 400;
  359. color: #909090;
  360. font-size: 14px;
  361. }
  362. }
  363. }
  364. .page-data {
  365. padding-top: 10px;
  366. }
  367. .content-detail {
  368. background: #fff;
  369. // padding: 20px;
  370. }
  371. .flows {
  372. .flow-left {
  373. width: 156px;
  374. height: 70px;
  375. border: 1px dashed #ccc;
  376. padding: 10px;
  377. }
  378. .row {
  379. margin-top: 13px;
  380. }
  381. }
  382. .basic-details-title {
  383. margin-bottom: 12px;
  384. margin-top: 20px;
  385. border-bottom: 1px solid #157a2c;
  386. padding-bottom: 8px;
  387. display: flex;
  388. justify-content: space-between;
  389. }
  390. .basic-details-title .border-span {
  391. height: 18px;
  392. font-size: 16px;
  393. border-left: 4px solid #157a2c;
  394. padding-left: 8px;
  395. font-weight: 500;
  396. }
  397. .heade-right {
  398. // float: right;
  399. .heade-right-content {
  400. margin-right: 12px;
  401. font-size: 14px;
  402. display: inline-block;
  403. .content-key {
  404. color: #3e3e3e;
  405. margin-right: 12px;
  406. font-weight: 500;
  407. }
  408. .content-value {
  409. color: #000;
  410. }
  411. }
  412. }
  413. .list-title {
  414. font-size: 14px;
  415. color: #3e3e3e;
  416. margin: 10px 0px;
  417. }
  418. .goods {
  419. background: #a30014;
  420. border: 1px solid #a30014;
  421. }
  422. .details-title {
  423. display: inline-block;
  424. color: #6e6e6e;
  425. font-size: 14px;
  426. font-weight: bold;
  427. margin-right: 13px;
  428. width: 70px;
  429. text-align: right;
  430. }
  431. .details-con {
  432. color: #3e3e3e;
  433. font-size: 14px;
  434. }
  435. .detailed-tab {
  436. margin-left: 10px;
  437. margin-top: 10px;
  438. }
  439. .maintain_equipment_info_content {
  440. padding: 0 30px;
  441. .equipment_item {
  442. border: 1px solid #ccc;
  443. font-size: 14px;
  444. padding: 15px;
  445. margin-bottom: 30px;
  446. .equipment_info {
  447. display: flex;
  448. flex-wrap: wrap;
  449. border: 1px solid #ddd;
  450. .item_info {
  451. width: 33.33%;
  452. height: 24px;
  453. line-height: 24px;
  454. display: flex;
  455. .item_label {
  456. width: 90px;
  457. text-align: center;
  458. background-color: #f2f2f2;
  459. font-weight: 700;
  460. }
  461. .item_value {
  462. border-bottom: 1px solid #f2f2f2;
  463. flex: 1;
  464. padding-left: 5px;
  465. }
  466. }
  467. }
  468. > p {
  469. margin-top: 20px;
  470. color: #797979;
  471. }
  472. .matter_info {
  473. ::v-deep .el-table {
  474. th.el-table__cell {
  475. background-color: #f2f2f2;
  476. padding: 0;
  477. }
  478. td.el-table__cell {
  479. padding: 0;
  480. }
  481. }
  482. }
  483. .ruleMatters_box {
  484. flex: 3;
  485. height: 100%;
  486. display: flex;
  487. flex-direction: column;
  488. .divider {
  489. flex: 0 0 50px;
  490. .title {
  491. height: 35px;
  492. }
  493. }
  494. .el-table {
  495. overflow: auto;
  496. .operationGuide_box {
  497. width: 100%;
  498. display: flex;
  499. position: relative;
  500. .left_content {
  501. width: 30%;
  502. padding: 10px;
  503. margin-right: 10px;
  504. overflow-y: auto;
  505. }
  506. .line {
  507. position: absolute;
  508. top: -10px;
  509. left: 30%;
  510. bottom: -10px;
  511. height: 110%;
  512. width: 1px;
  513. background-color: #ededed;
  514. }
  515. .right_content {
  516. flex: 1;
  517. padding: 10px;
  518. overflow-y: auto;
  519. }
  520. }
  521. }
  522. }
  523. }
  524. }
  525. ::v-deep .el-form-item--medium .el-form-item__label {
  526. color: #6e6e6e;
  527. font-size: 14px;
  528. font-weight: bold;
  529. }
  530. .warehouse {
  531. display: block;
  532. border-bottom: 1px solid #eaeefb;
  533. padding: 10px 0;
  534. }
  535. .box-card {
  536. .store-box {
  537. width: 80%;
  538. .store-box-span {
  539. display: inline-block;
  540. font-size: 14px;
  541. height: 50px;
  542. width: 50px;
  543. text-align: center;
  544. line-height: 50px;
  545. color: #fff;
  546. margin: 2px;
  547. }
  548. }
  549. }
  550. .vacant {
  551. background: #3196fb;
  552. }
  553. .inUse {
  554. background: #157a2c;
  555. }
  556. .invalid {
  557. background: #cccccc;
  558. }
  559. .full {
  560. background: #cc3300;
  561. }
  562. .map {
  563. display: inline-block;
  564. position: absolute;
  565. right: 4%;
  566. top: 15%;
  567. width: 380px;
  568. height: 200px;
  569. background-color: #b12492;
  570. }
  571. .mapTitle {
  572. display: inline-block;
  573. position: absolute;
  574. transform: translate(-50%, -50%);
  575. right: 11%;
  576. top: 39%;
  577. }
  578. .equipment {
  579. position: relative;
  580. width: 100%;
  581. min-height: 200px;
  582. .equipment-icon {
  583. text-align: center;
  584. line-height: 30px;
  585. width: 30px;
  586. height: 30px;
  587. border-radius: 15px;
  588. border: 2px solid #000;
  589. }
  590. .equipment-step {
  591. position: absolute;
  592. left: 15px;
  593. border-left: 2px solid #000;
  594. width: 2px;
  595. height: 85%;
  596. }
  597. .equipment-arrows {
  598. position: absolute;
  599. bottom: -8px;
  600. left: 8px;
  601. border: 8px solid rgb(255, 255, 255);
  602. border-top-color: #000;
  603. width: 0;
  604. height: 0;
  605. }
  606. .equipment-title {
  607. position: absolute;
  608. top: 3%;
  609. left: 3%;
  610. }
  611. .equipment-details {
  612. position: absolute;
  613. top: 3%;
  614. left: 25%;
  615. span {
  616. margin-right: 70px;
  617. }
  618. }
  619. .equipment-content {
  620. display: flex;
  621. .equipment-content-span1 {
  622. width: 150px;
  623. margin: 20px 70px 5px 47px;
  624. }
  625. .equipment-content-span2 {
  626. width: 350px;
  627. margin: 20px 70px 5px 120px;
  628. }
  629. }
  630. }
  631. .btnbox {
  632. display: flex;
  633. justify-content: center;
  634. }
  635. ::v-deep .el-button {
  636. padding: 10px 20px;
  637. margin-right: 10px;
  638. }
  639. .textbox {
  640. margin-top: 10px;
  641. }
  642. .execute_info {
  643. margin: 30px 0;
  644. .execute_info_title {
  645. border-bottom: 1px solid #157a2c;
  646. padding-bottom: 3px;
  647. margin-bottom: 20px;
  648. display: flex;
  649. justify-content: space-between;
  650. > span:first-child {
  651. line-height: 16px;
  652. border-left: 6px solid #157a2c;
  653. padding-left: 6px;
  654. }
  655. }
  656. .execute_row {
  657. padding: 0 30px;
  658. .column {
  659. display: flex;
  660. font-size: 14px;
  661. margin-bottom: 20px;
  662. .label {
  663. // width: 110px;
  664. text-align: center;
  665. font-weight: 700;
  666. }
  667. }
  668. }
  669. }
  670. </style>