RepairDetailsDialog.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <template>
  2. <!-- 维修工单弹框 -->
  3. <el-dialog
  4. :title="dialogTitle"
  5. :visible.sync="equipmentdialog"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. :close-on-press-escape="false"
  9. width="60%"
  10. >
  11. <el-tabs
  12. v-model="detailsTabsActiveName"
  13. type="border-card"
  14. v-if="row.title == '工单详情'"
  15. >
  16. <el-tab-pane :label="tabLabel" name="keepInRepair">
  17. <WorkOrderTab
  18. :repairInfoLogList="repairInfoLogs"
  19. :workOrderInfo="workOrderInfo"
  20. :planInfo="planInfo"
  21. :equipmentInfo="equipmentInfo"
  22. v-if="tabLabel === '工单信息'"
  23. />
  24. <RepairNotesTab
  25. :repairInfoLogList="repairInfoLogs"
  26. v-if="tabLabel === '维修信息'"
  27. />
  28. </el-tab-pane>
  29. <el-tab-pane label="设备信息" name="equipment">
  30. <el-row class="repair_row">
  31. <el-col :span="12" class="repair_column">
  32. <span>设备编码:</span>
  33. <span>{{ equipmentInfo ? equipmentInfo.code : '' }}</span>
  34. </el-col>
  35. <el-col :span="12" class="repair_column">
  36. <span>权属部门:</span>
  37. <span>{{
  38. equipmentInfo ? equipmentInfo.ownershipGroupName : ''
  39. }}</span>
  40. </el-col>
  41. </el-row>
  42. <el-row class="repair_row">
  43. <el-col :span="12" class="repair_column">
  44. <span>设备名称:</span>
  45. <span>{{ equipmentInfo ? equipmentInfo.name : '' }}</span>
  46. </el-col>
  47. <el-col :span="12" class="repair_column">
  48. <span>权属人:</span>
  49. <span>{{
  50. equipmentInfo ? equipmentInfo.ownershipUserName : ''
  51. }}</span>
  52. </el-col>
  53. </el-row>
  54. <el-row class="repair_row">
  55. <el-col :span="12" class="repair_column">
  56. <span>设备分类:</span>
  57. <span>{{
  58. equipmentInfo.category
  59. ? equipmentInfo.category.category.categoryLevelPath
  60. : ''
  61. }}</span>
  62. </el-col>
  63. <el-col :span="12" class="repair_column">
  64. <span>权属人电话:</span>
  65. <span>{{
  66. equipmentInfo ? equipmentInfo.ownershipUserMobile : ''
  67. }}</span>
  68. </el-col>
  69. </el-row>
  70. <el-row class="repair_row">
  71. <el-col :span="12" class="repair_column">
  72. <span>固定资产编码:</span>
  73. <span>{{ equipmentInfo ? equipmentInfo.fixCode : '' }}</span>
  74. </el-col>
  75. <el-col :span="12" class="repair_column">
  76. <span>设备位置:</span>
  77. <span>{{
  78. equipmentInfo.deviceLocationName +
  79. '-' +
  80. equipmentInfo.deviceDetailAddress
  81. }}</span>
  82. </el-col>
  83. </el-row>
  84. <el-row class="repair_row">
  85. <el-col :span="12" class="repair_column">
  86. <span>规格型号:</span>
  87. <span>
  88. {{
  89. equipmentInfo.category &&
  90. equipmentInfo.category.category.specification
  91. }}|{{
  92. equipmentInfo.category &&
  93. equipmentInfo.category.category.modelType
  94. }}
  95. </span>
  96. </el-col>
  97. </el-row>
  98. </el-tab-pane>
  99. <el-tab-pane label="报修信息" name="repairApplication">
  100. <el-row class="repair_row">
  101. <el-col :span="12" class="repair_column">
  102. <span>编号:</span>
  103. <span>{{ infoData ? infoData.code : '' }}</span>
  104. </el-col>
  105. <el-col :span="12" class="repair_column">
  106. <span>报修时间:</span>
  107. <span>{{ infoData ? infoData.createTime : '' }}</span>
  108. </el-col>
  109. </el-row>
  110. <el-row class="repair_row">
  111. <el-col :span="12" class="repair_column">
  112. <span>来源:</span>
  113. <span>{{
  114. infoData && infoData.sourceType ? infoData.sourceType : ''
  115. }}</span>
  116. </el-col>
  117. <el-col :span="12" class="repair_column">
  118. <span>来源编码:</span>
  119. <span>{{ infoData ? infoData.sourceCode : '' }}</span>
  120. </el-col>
  121. </el-row>
  122. <el-row class="repair_row">
  123. <el-col :span="12" class="repair_column">
  124. <span>报修部门:</span>
  125. <span>{{ infoData ? infoData.requestDeptName : '' }}</span>
  126. </el-col>
  127. <el-col :span="12" class="repair_column">
  128. <span>报修人:</span>
  129. <span>{{ infoData ? infoData.requestUserName : '' }}</span>
  130. </el-col>
  131. </el-row>
  132. <el-row class="repair_row">
  133. <el-col :span="12" class="repair_column">
  134. <span>报修人电话:</span>
  135. <span>{{ infoData ? infoData.requestUserPhone : '' }}</span>
  136. </el-col>
  137. <el-col :span="12" class="repair_column">
  138. <span>期望完成时间:</span>
  139. <span>{{ infoData ? infoData.expectedTime : '' }}</span>
  140. </el-col>
  141. </el-row>
  142. <el-row class="repair_row">
  143. <el-col :span="24" class="repair_column">
  144. <span>故障描述:</span>
  145. <span>{{ infoData ? infoData.remark : '' }}</span>
  146. </el-col>
  147. </el-row>
  148. <el-row class="repair_row">
  149. <el-col :span="24" class="repair_column">
  150. <span>图片:</span>
  151. <el-image
  152. v-for="(item, index) in infoData.repairsImg"
  153. :key="index"
  154. style="width: 100px; height: 100px; margin-right: 5px"
  155. :src="item.url"
  156. :preview-src-list="[item.url]"
  157. />
  158. </el-col>
  159. </el-row>
  160. </el-tab-pane>
  161. <el-tab-pane label="备品备件申请单" name="sparePartsApply">
  162. <editd :id="workOrderInfo.id" />
  163. </el-tab-pane>
  164. </el-tabs>
  165. <el-tabs v-model="detailsTabsActiveName" type="border-card" v-else>
  166. <el-tab-pane label="报修信息" name="repairApplication">
  167. <el-row class="repair_row">
  168. <el-col :span="12" class="repair_column">
  169. <span>编号:</span>
  170. <span>{{ infoData ? infoData.code : '' }}</span>
  171. </el-col>
  172. <el-col :span="12" class="repair_column">
  173. <span>报修时间:</span>
  174. <span>{{ infoData ? infoData.createTime : '' }}</span>
  175. </el-col>
  176. </el-row>
  177. <el-row class="repair_row">
  178. <el-col :span="12" class="repair_column">
  179. <span>来源:</span>
  180. <span>{{
  181. infoData ? getDictValue('报修来源', infoData.sourceType) : ''
  182. }}</span>
  183. </el-col>
  184. <el-col :span="12" class="repair_column">
  185. <span>来源编码:</span>
  186. <span>{{ infoData ? infoData.sourceCode : '' }}</span>
  187. </el-col>
  188. </el-row>
  189. <el-row class="repair_row">
  190. <el-col :span="12" class="repair_column">
  191. <span>报修部门:</span>
  192. <span>{{ infoData ? infoData.requestDeptName : '' }}</span>
  193. </el-col>
  194. <el-col :span="12" class="repair_column">
  195. <span>报修人:</span>
  196. <span>{{ infoData ? infoData.requestUserName : '' }}</span>
  197. </el-col>
  198. </el-row>
  199. <el-row class="repair_row">
  200. <el-col :span="12" class="repair_column">
  201. <span>报修人电话:</span>
  202. <span>{{ infoData ? infoData.repairsDeptPhone : '' }}</span>
  203. </el-col>
  204. <el-col :span="12" class="repair_column">
  205. <span>期望完成时间:</span>
  206. <span>{{ infoData ? infoData.expectedTime : '' }}</span>
  207. </el-col>
  208. </el-row>
  209. <el-row class="repair_row">
  210. <el-col :span="24" class="repair_column">
  211. <span>故障描述:</span>
  212. <span>{{ infoData ? infoData.remark : '' }}</span>
  213. </el-col>
  214. </el-row>
  215. <!-- <el-row class="repair_row">
  216. <el-col :span="24" class="repair_column">
  217. <span>图片:</span>
  218. <el-image
  219. v-for="(item, index) in infoData.repairsImg"
  220. :key="index"
  221. style="width: 100px; height: 100px; margin-right: 5px"
  222. :src="item.url"
  223. :preview-src-list="[item.url]"
  224. />
  225. </el-col>
  226. </el-row> -->
  227. <!-- <el-row class="repair_row">
  228. <el-col :span="24" class="repair_column">
  229. <span class="label">视频:</span>
  230. <span>{{ infoData ? infoData.repairsVideo : '' }}</span>
  231. </el-col>
  232. </el-row> -->
  233. </el-tab-pane>
  234. <el-tab-pane label="设备信息" name="equipment">
  235. <el-row class="repair_row">
  236. <el-col :span="12" class="repair_column">
  237. <span>设备编码:</span>
  238. <span>{{ equipmentInfo ? equipmentInfo.code : '' }}</span>
  239. </el-col>
  240. <el-col :span="12" class="repair_column">
  241. <span>权属部门:</span>
  242. <span>{{
  243. equipmentInfo ? equipmentInfo.ownershipGroupName : ''
  244. }}</span>
  245. </el-col>
  246. </el-row>
  247. <el-row class="repair_row">
  248. <el-col :span="12" class="repair_column">
  249. <span>设备名称:</span>
  250. <span>{{ equipmentInfo ? equipmentInfo.name : '' }}</span>
  251. </el-col>
  252. <el-col :span="12" class="repair_column">
  253. <span>权属人:</span>
  254. <span>{{
  255. equipmentInfo ? equipmentInfo.ownershipUserName : ''
  256. }}</span>
  257. </el-col>
  258. </el-row>
  259. <el-row class="repair_row">
  260. <el-col :span="12" class="repair_column">
  261. <span>设备分类:</span>
  262. <span>{{
  263. equipmentInfo.category
  264. ? equipmentInfo.category.categoryLevelPath
  265. : ''
  266. }}</span>
  267. </el-col>
  268. <el-col :span="12" class="repair_column">
  269. <span>权属人电话:</span>
  270. <span>{{
  271. equipmentInfo ? equipmentInfo.ownershipUserMobile : ''
  272. }}</span>
  273. </el-col>
  274. </el-row>
  275. <el-row class="repair_row">
  276. <el-col :span="12" class="repair_column">
  277. <span>固定资产编码:</span>
  278. <span>{{ equipmentInfo ? equipmentInfo.fixCode : '' }}</span>
  279. </el-col>
  280. <el-col :span="12" class="repair_column">
  281. <span>设备位置:</span>
  282. <span>{{ equipmentInfo.position }}</span>
  283. </el-col>
  284. </el-row>
  285. <el-row class="repair_row">
  286. <el-col :span="12" class="repair_column">
  287. <span>规格型号:</span>
  288. <span>
  289. {{
  290. equipmentInfo.category && equipmentInfo.category.specification
  291. }}|{{
  292. equipmentInfo.category && equipmentInfo.category.modelType
  293. }}
  294. </span>
  295. </el-col>
  296. </el-row>
  297. </el-tab-pane>
  298. <el-tab-pane :label="tabLabel" name="keepInRepair">
  299. <WorkOrderTab
  300. :repairInfoLogList="repairInfoLogs"
  301. :workOrderInfo="workOrderInfo"
  302. :planInfo="planInfo"
  303. v-if="tabLabel === '工单信息'"
  304. />
  305. <RepairNotesTab
  306. :repairInfoLogList="repairInfoLogs"
  307. v-if="tabLabel === '维修信息'"
  308. />
  309. </el-tab-pane>
  310. </el-tabs>
  311. <div class="btnbox" v-if="row.isshow">
  312. <el-button class="confirm-btn" type="danger" plain @click="reject"
  313. >驳回</el-button
  314. >
  315. <el-button
  316. :loading="passLoading"
  317. class="confirm-btn"
  318. type="success"
  319. plain
  320. @click="pass"
  321. >验收</el-button
  322. >
  323. <el-button class="cancel-btn" @click="handleClose">关闭</el-button>
  324. </div>
  325. <div class="textbox" v-if="showtext">
  326. <el-input
  327. type="textarea"
  328. placeholder="请输入驳回原因"
  329. v-model="cause"
  330. maxlength="30"
  331. rows="5"
  332. show-word-limit
  333. >
  334. </el-input>
  335. <div class="textbtnbox">
  336. <el-button size="small" round @click="cancelreject">取消</el-button>
  337. <el-button
  338. :loading="errorLoading"
  339. size="small"
  340. round
  341. @click="surereject"
  342. >提交</el-button
  343. >
  344. </div>
  345. </div>
  346. <div slot="footer" v-if="!row.isshow">
  347. <el-button size="small" @click="handleClose">关闭</el-button>
  348. </div>
  349. </el-dialog>
  350. </template>
  351. <script>
  352. import RepairNotesTab from './RepairNotesTab.vue';
  353. import WorkOrderTab from './WorkOrderTab.vue';
  354. import { getAssetInfo } from '@/api/ledgerAssets';
  355. import { getRepairById } from '@/api/maintenance/repair_report';
  356. import { getWorkOrderDetail } from '@/api/maintenance/repair';
  357. import dictMixins from '@/mixins/dictMixins';
  358. import editd from '@/views/sparePartsApply/components/editd';
  359. export default {
  360. mixins: [dictMixins],
  361. props: {},
  362. components: { RepairNotesTab, WorkOrderTab, editd },
  363. data() {
  364. return {
  365. errorLoading: false,
  366. passLoading: false,
  367. equipmentdialog: false,
  368. detailsTabsActiveName: 'repairApplication',
  369. workOrderInfo: {},
  370. planInfo: {},
  371. infoData: {},
  372. equipmentInfo: {},
  373. repairInfoLogs: [],
  374. tabLabel: '',
  375. dialogTitle: '',
  376. row: {},
  377. cause: '',
  378. showtext: false
  379. };
  380. },
  381. created() {
  382. this.requestDict('报修来源');
  383. this.requestDict('报修状态');
  384. },
  385. methods: {
  386. handleClose() {
  387. this.equipmentdialog = false;
  388. if (this.row.title === '工单详情') {
  389. this.detailsTabsActiveName = 'keepInRepair';
  390. } else {
  391. this.detailsTabsActiveName = 'repairApplication';
  392. }
  393. },
  394. async init(row) {
  395. this.row = row;
  396. console.log('row----------------------------------');
  397. console.log(row);
  398. this.equipmentdialog = true;
  399. this.dialogTitle = row.title;
  400. this.tabLabel = row.tabLabel;
  401. if (row.title === '工单详情') {
  402. this.detailsTabsActiveName = 'keepInRepair';
  403. }
  404. if (row.title === '报修记录详情') {
  405. this.getSbinfo(this.row.deviceId);
  406. const res = await getRepairById(row.id);
  407. console.log('报修记录详情', res);
  408. this.infoData = res ? res : {};
  409. this.repairInfoLogs = res.repairLogVOList.reverse();
  410. // 处理图片
  411. // if (this.infoData && this.infoData.repairsImg) {
  412. // const repairsImg = this.infoData.repairsImg
  413. // this.infoData.repairsImg = []
  414. // repairsImg.split(',').map(item => {
  415. // imageView(item).then(res => {
  416. // this.infoData.repairsImg.push({
  417. // name: item.substring('/download/'.length),
  418. // url: res
  419. // })
  420. // })
  421. // console.log(this.infoData.repairsImg)
  422. // return
  423. // })
  424. // }
  425. } else if (row.title === '消息信息详情') {
  426. this.getSbinfo(this.row.deviceId);
  427. const res = await getRepairById(row.id);
  428. this.infoData = res ? res : {};
  429. this.repairInfoLogs = res.repairLogVOList.reverse();
  430. // 处理图片
  431. // if (this.infoData && this.infoData.repairsImg) {
  432. // const repairsImg = this.infoData.repairsImg
  433. // this.infoData.repairsImg = []
  434. // repairsImg.split(',').map(item => {
  435. // imageView(item).then(res => {
  436. // this.infoData.repairsImg.push({
  437. // name: item.substring('/download/'.length),
  438. // url: res
  439. // })
  440. // })
  441. // return
  442. // })
  443. // }
  444. } else {
  445. console.log('----------');
  446. console.log(row);
  447. const res = await getWorkOrderDetail(row.code);
  448. console.log(res, 'resresresresres');
  449. this.workOrderInfo = res.ticketsInfoResponse;
  450. this.infoData = res.repairRequestResponse;
  451. this.getSbinfo(res.ticketsInfoResponse.deviceId);
  452. // this.planInfo = res.data.planInfo;
  453. // this.planInfo.executeUserName = res.data.executeUserName;
  454. // this.planInfo.executorDeptName = res.data.executorDeptName;
  455. // this.infoData = res.data.repairInfo ? res.data.repairInfo : {};
  456. // // 处理图片
  457. // if (this.infoData && this.infoData.repairsImg) {
  458. // const repairsImg = this.infoData.repairsImg;
  459. // this.infoData.repairsImg = [];
  460. // repairsImg.split(',').map((item) => {
  461. // imageView(item).then((res) => {
  462. // this.infoData.repairsImg.push({
  463. // name: item.substring('/download/'.length),
  464. // url: res
  465. // });
  466. // });
  467. // return;
  468. // });
  469. // }
  470. let repairInfoLogs =
  471. res.ticketsInfoResponse.repairLogVOS?.length > 0
  472. ? res.ticketsInfoResponse.repairLogVOS.map((item) => {
  473. return {
  474. ...item,
  475. requestUserName: res.repairRequestResponse.requestUserName,
  476. remark: res.repairRequestResponse.remark
  477. };
  478. })
  479. : [];
  480. this.repairInfoLogs = repairInfoLogs.reverse();
  481. }
  482. },
  483. getSbinfo(params) {
  484. getAssetInfo(params).then((res) => {
  485. if (res) {
  486. this.equipmentInfo = res;
  487. this.$set(
  488. this.equipmentInfo,
  489. 'position',
  490. res.positionList?.length > 0 && res.positionList[0].pathName
  491. ? res.positionList[0].pathName
  492. : ''
  493. );
  494. }
  495. });
  496. },
  497. //通过按钮事件
  498. pass() {
  499. this.passLoading = true;
  500. let params = {
  501. id: this.row.id,
  502. checked: true,
  503. myHandleId: this.row.dbid,
  504. handleType: 1,
  505. type: 1,
  506. cause: ''
  507. };
  508. sendAudit(params).then((res) => {
  509. if (res.success) {
  510. this.$message.success('验收成功!');
  511. this.$emit('refesh');
  512. this.passLoading = false;
  513. this.equipmentdialog = false;
  514. }
  515. });
  516. },
  517. //驳回按钮事件
  518. reject() {
  519. this.showtext = true;
  520. let ele = document.getElementsByClassName('el-dialog__wrapper');
  521. let bodyscrollHeight = document.body.scrollHeight;
  522. this.$nextTick(() => {
  523. ele.forEach((element) => {
  524. if (element.style.display !== 'none') {
  525. element.scrollTop = bodyscrollHeight;
  526. }
  527. });
  528. });
  529. },
  530. cancelreject() {
  531. this.showtext = false;
  532. this.cause = '';
  533. },
  534. surereject() {
  535. if (!this.cause) {
  536. this.$message.info('请填写驳回原因!');
  537. } else {
  538. this.errorLoading = true;
  539. let params = {
  540. id: this.row.id,
  541. checked: false,
  542. myHandleId: this.row.dbid,
  543. handleType: 1,
  544. type: 1,
  545. cause: this.cause
  546. };
  547. sendAudit(params).then((res) => {
  548. if (res.success) {
  549. this.$message.success('驳回成功!');
  550. this.$emit('refesh');
  551. this.errorLoading = false;
  552. this.equipmentdialog = false;
  553. }
  554. });
  555. }
  556. }
  557. },
  558. watch: {
  559. equipmentdialog(nVal, oVal) {
  560. if (!nVal) {
  561. this.cause = '';
  562. this.showtext = false;
  563. }
  564. }
  565. }
  566. };
  567. </script>
  568. <style lang="scss" scoped>
  569. .repair_row {
  570. margin-bottom: 15px;
  571. .repair_column {
  572. display: flex;
  573. > span {
  574. &:first-child {
  575. font-weight: 700;
  576. text-align: right;
  577. width: 120px;
  578. }
  579. }
  580. }
  581. }
  582. .btnbox {
  583. display: flex;
  584. justify-content: center;
  585. margin-top: 10px;
  586. }
  587. ::v-deep .el-button {
  588. padding: 10px 20px;
  589. margin-right: 10px;
  590. }
  591. .textbox {
  592. margin-top: 10px;
  593. }
  594. .textbtnbox {
  595. margin-top: 10px;
  596. display: flex;
  597. justify-content: center;
  598. }
  599. </style>