detail.vue 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. <template>
  2. <view class="tour-container">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="巡点检工单详情" @clickLeft="back"
  4. @clickRight="HandlScanCode"></uni-nav-bar>
  5. <view class="tour-wrapper">
  6. <view class="tour_tally-content">
  7. <!-- <KdTabs v-model="active" @change="handleTabChange" :list="['基本信息', '巡点检设备', '备品备件']" /> -->
  8. <u-subsection :list="tabList" :current="active" @change="handleTabChange"
  9. active-color="#157a2c"></u-subsection>
  10. <view class="kd-baseInfo" v-show="active === 0">
  11. <view class="kd-cell">
  12. <text class="kd-label">工单编号</text>
  13. {{ worksheetInfo.code }}
  14. </view>
  15. <view class="kd-cell">
  16. <text class="kd-label">计划名称</text>
  17. <text class="kd-content">{{ worksheetInfo.planName }}</text>
  18. </view>
  19. <!-- <view class="kd-cell">
  20. <text class="kd-label">巡点检周期</text>
  21. <text class="kd-content"
  22. >{{ worksheetInfo.cycleValue
  23. }}{{ cycleOptObj[worksheetInfo.cycleType] }}</text
  24. >
  25. </view> -->
  26. <view class="kd-cell">
  27. <text class="kd-label">设备分类</text>
  28. <text class="kd-content">{{ worksheetInfo.categoryName }}</text>
  29. </view>
  30. <view class="kd-cell">
  31. <text class="kd-label">巡检设备总数</text>
  32. <text
  33. class="kd-content text-warning">{{ worksheetInfo.finishNum }}/{{ worksheetInfo.total }}</text>
  34. </view>
  35. <view class="kd-cell">
  36. <text class="kd-label">计划完成时长</text>
  37. {{ worksheetInfo.duration }}分钟
  38. </view>
  39. <view class="kd-cell">
  40. <text class="kd-label">实际完成时长</text>
  41. {{ finishTime(worksheetInfo.acceptTime, worksheetInfo.finishTime) }}
  42. </view>
  43. <view class="kd-cell">
  44. <text class="kd-label">实际开始时间</text>
  45. {{ worksheetInfo.acceptTime }}
  46. </view>
  47. <view class="kd-cell">
  48. <text class="kd-label">实际完成时间</text>
  49. {{ worksheetInfo.finishTime }}
  50. </view>
  51. <!-- <u-button type="primary" size="large" text="开始执行"></u-button> -->
  52. <template>
  53. <template v-if="worksheetInfo.orderStatus === 0">
  54. <button class="btn-execute" type="primary" @click="handleExecute">开始执行</button>
  55. <button class="btn-sparepart" type="warning" @click="handlbpbj">申请备品备件</button>
  56. <button class="btn-reassignment" type="primary" @click="handleAssign">转派</button>
  57. </template>
  58. <template v-else-if="worksheetInfo.orderStatus === 2">
  59. <button class="btn-execute" type="primary" @click="handleReport">报工</button>
  60. <button class="btn-sparepart" type="warning" @click="handlbpbj">申请备品备件</button>
  61. <button class="btn-reassignment" type="primary" @click="handleAssign" v-if="worksheetInfo.isGroup != 1">转派</button>
  62. </template>
  63. <button v-else-if="worksheetInfo.orderStatus === 3" :disabled="true" class="btn-execute"
  64. type="primary">已报工</button>
  65. </template>
  66. </view>
  67. <view class="kd-equipment" v-show="active === 1">
  68. <view class="kd-type-box">
  69. <view :class="{ 'type—active': typeActive === index }" v-for="(item, index) in equpStatus"
  70. :key="index" @click="typeChange(index)">
  71. {{ item.name }}
  72. <text v-if="item.count > 0" class="count">{{ item.count }}</text>
  73. </view>
  74. </view>
  75. <view class="kd-list-container">
  76. <u-list @scrolltolower="scrolltolower">
  77. <u-list-item v-for="(item, index) in euqiList" :key="index">
  78. <view class="kd-card">
  79. <view class="kd-card-wrapper">
  80. <view class="kd-cell">
  81. <text class="kd-label">设备编码</text>
  82. {{ item.code }}
  83. </view>
  84. <view class="kd-cell">
  85. <text class="kd-label">设备名称</text>
  86. {{ item.name }}
  87. </view>
  88. <view class="kd-cell">
  89. <text class="kd-label">设备型号</text>
  90. {{ item.model }}
  91. </view>
  92. <view class="kd-cell">
  93. <text class="kd-label">设备位置</text>
  94. {{ item.deviceLocationName.pathName }}
  95. </view>
  96. <view class="kd-cell">
  97. <text class="kd-label">执行结果</text>
  98. <text class="status-box text-warning"
  99. v-if="item.executeStatus === 0">待检</text>
  100. <text class="status-box text-primary"
  101. v-else-if="item.executeStatus === 1">已检</text>
  102. <text class="status-box text-danger"
  103. v-else-if="item.executeStatus === 2">异常</text>
  104. <text class="status-box text-primary"
  105. v-else-if="item.executeStatus === 3">已报修</text>
  106. </view>
  107. </view>
  108. <view class="card-footer">
  109. <button v-if="item.orderStatus == 2 && item.executeStatus == 0" type="primary"
  110. class="primary-btn" @click="handleCheck(item)">检查</button>
  111. <template v-if="item.orderStatus && item.orderStatus === 3">
  112. <button type="default" v-if="item.resultStatus === 3"
  113. @click="handLbxDetail(item)">报修详情</button>
  114. <button type="default" v-else-if="item.resultStatus === 2"
  115. @click="handLbx(item)">报修</button>
  116. </template>
  117. <button type="default"
  118. v-if="[0, 2, 3].includes(item.orderStatus) && item.executeStatus != 0"
  119. @click="checkDetail(item)">检查详情</button>
  120. </view>
  121. </view>
  122. </u-list-item>
  123. </u-list>
  124. </view>
  125. </view>
  126. <!-- <view class="spare-parts" v-show="active === 2">
  127. <Step>
  128. <StepItem v-for="(item, index) in repairInfoLogList" :key="index" :active="index == 0" :hideContent="Boolean(item.content)">
  129. <template v-slot:header>
  130. <view class="step-title">
  131. <view class="s1">{{ typeOptions[item.type] }}</view>
  132. <view class="s2">
  133. {{ item.createTime }}
  134. </view>
  135. </view>
  136. </template>
  137. <template v-slot:content v-if="item.content">
  138. <view class="list-xs" v-if="item.type == 'CREATE'">
  139. <view class="list-xs-item">
  140. <view class="label">报修人</view>
  141. <view class="value">
  142. {{ logs[item.id] ? logs[item.id].content.requestUserName : '' }}
  143. </view>
  144. </view>
  145. <view class="list-xs-item">
  146. <view class="label">故障描述</view>
  147. <view class="value">
  148. {{ logs[item.id] ? logs[item.id].content.remark : '' }}
  149. </view>
  150. </view>
  151. </view>
  152. <view class="list-xs" v-else-if="item.type == 'SPARE_PARTS_APPLY'">
  153. <view class="list-xs-item">
  154. <view class="label">申领清单</view>
  155. <view class="value bjsymx" @click="handlbjsymx('备件明细', item.content.infoList)">备件使用明细</view>
  156. </view>
  157. </view>
  158. <view class="list-xs" v-else-if="item.type == 'ACCEPTANCE_CHEK'">
  159. <view class="list-xs-item">
  160. <view class="label">验收人</view>
  161. <view class="value">
  162. {{ logs[item.id] ? logs[item.id].content.userName : '' }}
  163. </view>
  164. </view>
  165. <view class="list-xs-item">
  166. <view class="label">验收结果</view>
  167. <view class="value">
  168. {{ logs[item.id] ? (logs[item.id].content.orderStatus == 4 ? '通过' : '驳回') : '' }}
  169. </view>
  170. </view>
  171. </view>
  172. <view class="list-xs" v-else-if="item.type == 'WORK_REPORT'">
  173. <view class="list-xs-item">
  174. <view class="label">处理说明</view>
  175. <view class="value">
  176. {{ logs[item.id] ? logs[item.id].content.reason : '' }}
  177. </view>
  178. </view>
  179. </view>
  180. </template>
  181. </StepItem>
  182. </Step>
  183. <PopSparePart ref="PopSparePart" :workOrderCode="workOrderCode" :noRequest="true"></PopSparePart>
  184. </view> -->
  185. <!-- 备品备件 sparePartsApply-->
  186. <view class="spare-parts" v-if="active == 2">
  187. <pickCard :list="sparePartsApply" />
  188. </view>
  189. </view>
  190. <uni-popup ref="inputDialog" type="dialog">
  191. <uni-popup-dialog ref="inputClose" mode="input" title="您当前已超出计划完成时间,请填写原因" placeholder="请输入内容"
  192. :before-close="true" @close="handleClose" @confirm="timeoutCauseConfirm"></uni-popup-dialog>
  193. </uni-popup>
  194. </view>
  195. <u-modal :show="modalShow" title="提示" @confirm="modalShow = false">
  196. <view>
  197. 您还有
  198. <text class="text-warning">{{ worksheetInfo.awaitInspectSum }}</text>
  199. 台设备待检,不可报工
  200. </view>
  201. </u-modal>
  202. <Assign ref="assignRef" @success="assignSuccess" />
  203. <!-- <ScanCode @scancodedate="scancodedate"></ScanCode> -->
  204. </view>
  205. </template>
  206. <script>
  207. import Step from '@/components/Step/Step.vue'
  208. import StepItem from '@/components/Step/StepItem.vue'
  209. import PopSparePart from '../../maintenanceWorkorder/components/PopSparePart.vue'
  210. import {
  211. getWorkOrderDetail,
  212. getDeviceList,
  213. startExecuting,
  214. signingWork,
  215. devicestatistics
  216. } from '@/api/myTicket/index.js'
  217. import {
  218. getSpareParts,
  219. getSparePartsApply,
  220. getWordOrderDetail
  221. } from '@/api/repair'
  222. import {
  223. get,
  224. post,
  225. postJ
  226. } from '@/utils/api.js'
  227. import Assign from '@/components/Assign.vue'
  228. import CellInfo from '@/components/CellInfo.vue'
  229. import KdTabs from '@/components/KdTabs.vue'
  230. import ScanCode from '@/components/ScanCode.vue'
  231. import pickCard from '@/pages/maintenanceWorkorder/components/pickCard.vue'
  232. export default {
  233. components: {
  234. CellInfo,
  235. KdTabs,
  236. Assign,
  237. ScanCode,
  238. Step,
  239. StepItem,
  240. PopSparePart,
  241. pickCard
  242. },
  243. data() {
  244. return {
  245. tabList: ['基本信息', '巡点检设备', '备品备件'],
  246. typeOptions: {
  247. CREATE: '生成工单',
  248. SPARE_PARTS_APPLY: '备品备件申请',
  249. ACCEPTANCE_CHEK: '验收',
  250. WORK_REPORT: '报工'
  251. },
  252. repairInfoLogList: [],
  253. sparePartsApply: [],
  254. modalShow: false,
  255. active: 0,
  256. typeActive: 0,
  257. statusList: {
  258. 0: '待接收',
  259. 1: '执行中',
  260. 3: '已完成'
  261. },
  262. pageId: '',
  263. planId: '',
  264. workOrderCode: '',
  265. worksheetInfo: {
  266. equiList: [],
  267. workOrder: {}
  268. },
  269. logs: {},
  270. equpStatus: [
  271. // {
  272. // name: '全部',
  273. // value: []
  274. // },
  275. {
  276. name: '全部',
  277. value: -1
  278. },
  279. {
  280. name: '待检',
  281. value: 0
  282. },
  283. {
  284. name: '已检',
  285. value: 1
  286. },
  287. {
  288. name: '异常',
  289. value: 2
  290. }
  291. ],
  292. euqiList: [],
  293. equipPage: 1,
  294. isEnd: false,
  295. cycleOptObj: {
  296. 1: '时/次',
  297. 2: '天/次',
  298. 3: '周/次',
  299. 4: '月/次',
  300. 5: '年/次',
  301. 11: '次/天',
  302. 12: '次/周',
  303. 13: '次/月',
  304. 14: '次/年'
  305. },
  306. barType: 0,
  307. qrContent: null,
  308. chooseTab: false
  309. }
  310. },
  311. async onLoad(options) {
  312. console.log('onLoad--------')
  313. console.log('options------------', options)
  314. // this.workOrderCode = options.workOrderCode
  315. this.pageId = options.id
  316. this.planId = options.planId
  317. // this.chooseTab = options.chooseTab
  318. this.getInfo()
  319. // 设备台账跳转详情
  320. // if (options.qrContent) {
  321. // this.qrContent = options.qrContent
  322. // await this.getInfo()
  323. // this.cbScancodedate({
  324. // code: this.qrContent
  325. // })
  326. // }
  327. },
  328. onShow() {
  329. console.log('onShow--------')
  330. this.getInfo()
  331. this.getCount()
  332. if (this.chooseTab) {
  333. this.active = 1
  334. this.typeChange(2)
  335. } else {
  336. this.typeChange(0)
  337. }
  338. // let _this = this
  339. // uni.$off('scancodedate') // 每次进来先 移除全局自定义事件监听器
  340. // uni.$on('scancodedate', function (data) {
  341. // _this.cbScancodedate(data)
  342. // })
  343. },
  344. onUnload() {
  345. uni.$off('scancodedate')
  346. },
  347. onHide() {
  348. uni.$off('scancodedate')
  349. },
  350. methods: {
  351. // 备件使用明细
  352. handlbjsymx(title, list) {
  353. this.$refs.PopSparePart.open(title, list)
  354. },
  355. // 跳转备品备件
  356. async handlbpbj() {
  357. let data = await getWordOrderDetail(this.worksheetInfo.id);
  358. data.deviceList = data.deviceList.map((item) => {
  359. return item.substance;
  360. });
  361. data['pageType'] = 'add'
  362. uni.navigateTo({
  363. url: `/pages/maintenanceWorkorder/sparepart/sparepart?data=${JSON.stringify(data)}`
  364. })
  365. },
  366. //获取备品备件
  367. async getSparePartsApply(id) {
  368. const list = await getSparePartsApply(id)
  369. this.sparePartsApply = list
  370. },
  371. getCount() {
  372. devicestatistics({
  373. planId: this.planId
  374. }).then(data => {
  375. this.equpStatus = this.equpStatus.map(item => {
  376. switch (item.name) {
  377. case '全部':
  378. return {
  379. ...item, count: data.total
  380. }
  381. case '待检':
  382. return {
  383. ...item, count: data.isInspectedNum
  384. }
  385. case '已检':
  386. return {
  387. ...item, count: data.checkedNum
  388. }
  389. case '异常':
  390. return {
  391. ...item, count: data.abnormalNum
  392. }
  393. }
  394. })
  395. })
  396. },
  397. // 扫码枪扫码
  398. cbScancodedate(data) {
  399. this.Scancodedate(data.code)
  400. },
  401. // 相机扫码
  402. HandlScanCode() {
  403. let _this = this
  404. uni.scanCode({
  405. onlyFromCamera: true,
  406. success: function(res) {
  407. _this.Scancodedate(res.result)
  408. }
  409. })
  410. },
  411. Scancodedate(code) {
  412. let _this = this
  413. if (this.worksheetInfo.status.code === 0) {
  414. uni.showModal({
  415. title: '提示',
  416. content: '工单未开启执行,不可进行巡点检操作,请先点击“开始执行”!',
  417. confirmText: '开始执行', //这块是确定按钮的文字
  418. cancelText: '取消', //这块是取消的文字
  419. success: function(res) {
  420. if (res.confirm) {
  421. _this.handleExecute() // 执行确认后的操作
  422. } else {
  423. // 执行取消后的操作
  424. }
  425. }
  426. })
  427. return
  428. }
  429. this.qrContent = code.trim()
  430. this.barType = this.setBarType(this.qrContent)
  431. _this.getData()
  432. },
  433. // 设置barType
  434. setBarType(val) {
  435. let index = val.indexOf('@_@')
  436. let result = 0
  437. if (index !== -1) {
  438. let item = val.substr(index + 3, 1)
  439. if (item) {
  440. result = Number(item)
  441. }
  442. }
  443. return result
  444. },
  445. // 根据条码请求设备数据
  446. getData() {
  447. let par = {
  448. barType: this.barType,
  449. qrContent: this.qrContent
  450. }
  451. uni.showLoading({
  452. title: '加载中',
  453. mask: true
  454. })
  455. postJ(this.apiUrl + '/scan/getAssetInfo', par)
  456. .then(res => {
  457. let data = res.data
  458. this.matchEquipment(data)
  459. })
  460. .finally(() => {
  461. uni.hideLoading()
  462. })
  463. },
  464. matchEquipment(data) {
  465. let par = {
  466. assetCode: data.assetCode,
  467. workOrderId: this.worksheetInfo.id
  468. }
  469. console.log('par', par)
  470. post(this.apiUrl + '/workOrder/scanMatching', par).then(res => {
  471. let data = res.data
  472. if (!data) {
  473. uni.showModal({
  474. title: '提示',
  475. content: '本工单中,无此设备!',
  476. confirmText: '好的', //这块是确定按钮的文字
  477. showCancel: false,
  478. success: function(res) {
  479. if (res.confirm) {
  480. // 执行确认后的操作
  481. } else {
  482. // 执行取消后的操作
  483. }
  484. }
  485. })
  486. } else {
  487. // 未报工
  488. if (this.worksheetInfo.status.code === 1) {
  489. this.handleCheck(data)
  490. }
  491. // 已报工
  492. if (this.worksheetInfo.status.code === 3) {
  493. this.checkDetail(data)
  494. }
  495. }
  496. })
  497. },
  498. handleAssign() {
  499. console.log(this.worksheetInfo)
  500. this.$refs.assignRef.open(this.worksheetInfo.id)
  501. },
  502. assignSuccess() {
  503. this.back()
  504. },
  505. // 报工
  506. handleReport() {
  507. if (this.worksheetInfo.finishNum !== this.worksheetInfo.total) {
  508. uni.showToast({
  509. title: '请完成巡检设备检查',
  510. icon: 'none'
  511. })
  512. } else {
  513. if (new Date(this.worksheetInfo.acceptTime).getTime() + this.worksheetInfo.duration * 60 * 1000 <
  514. new Date().getTime()) {
  515. this.$refs.inputDialog.open()
  516. return
  517. }
  518. this._report()
  519. }
  520. },
  521. handleClose() {
  522. this.$refs.inputDialog.close()
  523. },
  524. timeoutCauseConfirm(value) {
  525. if (!value) {
  526. uni.showToast({
  527. title: '请输入超时原因',
  528. icon: 'none'
  529. })
  530. return
  531. }
  532. this.$refs.inputDialog.close()
  533. this._report(value)
  534. },
  535. _report(timeoutCause = '') {
  536. signingWork({
  537. id: this.pageId,
  538. timeoutCause: timeoutCause
  539. }).then(() => {
  540. uni.showToast({
  541. icon: 'success',
  542. title: '操作成功!',
  543. duration: 2000
  544. })
  545. this.getInfo()
  546. })
  547. // post(
  548. // this.apiUrl + '/workOrder/reportWork',
  549. // {
  550. // workOrderId: this.pageId,
  551. // timeoutCause
  552. // },
  553. // true,
  554. // false
  555. // )
  556. // .then(res => {
  557. // let _this = this
  558. // if (res?.success) {
  559. // let data = res.data
  560. // if (data.length) {
  561. // uni.showModal({
  562. // title: '提示',
  563. // content: `有${data.length}台设备被标记为缺陷,是否要报修?`,
  564. // cancelText: '取消', // 取消按钮的文字
  565. // confirmText: '报修', // 确认按钮的文字
  566. // showCancel: true, // 是否显示取消按钮,默认为 true
  567. // success: res => {
  568. // if (res.confirm) {
  569. // if (data.length > 1) {
  570. // uni.navigateTo({
  571. // url: `/pages/tour_tally/detail/detail?workOrderCode=${this.workOrderCode}&id=${this.pageId}&chooseTab=true`
  572. // })
  573. // } else {
  574. // uni.navigateTo({
  575. // url: `/pages/repair/repair/index?source=5&workOrderCode=${this.workOrderCode}&equiCode=${data[0].equiCode}&equiId=${data[0].equiId}&workOrderId=${this.pageId}&equiName=${data[0].equiName}&equiModel=${data[0].equiModel}&equiLocation=${data[0].equiLocation}`
  576. // })
  577. // }
  578. // } else {
  579. // _this.getInfo()
  580. // }
  581. // }
  582. // })
  583. // } else {
  584. // uni.showToast({
  585. // icon: 'success',
  586. // title: '操作成功!',
  587. // duration: 2000
  588. // })
  589. // this.getInfo()
  590. // }
  591. // }
  592. // /* if (res?.success) {
  593. // uni.showToast({
  594. // icon: "success",
  595. // title: "操作成功!",
  596. // duration: 2000,
  597. // });
  598. // this.getInfo();
  599. // } */
  600. // })
  601. // .catch(res => {
  602. // if (res.code === '4444') {
  603. // this.$refs.inputDialog.open()
  604. // } else if (res.code === '5555') {
  605. // this.modalShow = true
  606. // // uni.showModal({
  607. // // title: '提示',
  608. // // content: `您还有 ${this.worksheetInfo.awaitInspectSum} 台设备待检,不可报工`,
  609. // // success: function (res) {},
  610. // // showCancel: false
  611. // // })
  612. // }
  613. // })
  614. },
  615. // 执行工单
  616. handleExecute() {
  617. startExecuting({
  618. id: this.pageId
  619. }).then(() => {
  620. uni.showToast({
  621. icon: 'success',
  622. title: '操作成功!',
  623. duration: 2000
  624. })
  625. this.getInfo()
  626. if(this.euqiList.length){
  627. this.handleCheck(this.euqiList[0])
  628. }
  629. })
  630. // post(this.apiUrl + '/workOrder/execute', {
  631. // workOrderCode: this.workOrderCode
  632. // }).then(res => {
  633. // if (res?.success) {
  634. // uni.showToast({
  635. // icon: 'success',
  636. // title: '操作成功!',
  637. // duration: 2000
  638. // })
  639. // this.getInfo()
  640. // }
  641. // })
  642. },
  643. //巡点检设备加载更多
  644. scrolltolower() {
  645. if (this.isEnd) return
  646. this.equipPage++
  647. this.getEquipList()
  648. },
  649. // 巡点检设备列表
  650. getEquipList() {
  651. const params = {
  652. planId: this.planId,
  653. status: this.equpStatus[this.typeActive].value,
  654. pageNum: 1,
  655. size: 9999
  656. }
  657. getDeviceList(params).then(data => {
  658. if (this.equipPage === 1) {
  659. this.euqiList = data.list
  660. } else {
  661. this.euqiList.push(...data.list)
  662. }
  663. this.isEnd = this.euqiList.length >= data.count
  664. })
  665. // post(this.apiUrl + `/workOrder/getEquipmentListApp?page=${this.equipPage}&size=10`, params, true).then(res => {
  666. // if (res?.success) {
  667. // if (this.equipPage === 1) {
  668. // this.euqiList = res.data.records
  669. // } else {
  670. // this.euqiList.push(...res.data.records)
  671. // }
  672. // this.isEnd = this.euqiList.length >= res.data.total
  673. // }
  674. // })
  675. },
  676. handleTabChange(value) {
  677. this.active = value
  678. if (value === 1) {
  679. this.typeChange(0)
  680. }
  681. },
  682. finishTime(start, end) {
  683. if (!end) return ''
  684. let dur = new Date(end).getTime() - new Date(start).getTime()
  685. return Math.ceil(dur / 1000 / 60) + '分钟'
  686. },
  687. // 设备状态切换
  688. typeChange(type) {
  689. this.typeActive = type
  690. this.equipPage = 1
  691. this.getEquipList()
  692. },
  693. handleCheck({
  694. id
  695. }) {
  696. // uni.navigateTo({
  697. // url: `/pages/tour_tally/check/index?id=${id}&equiName=${equiName}&equiCode=${equiCode}&workOrderId=${this.pageId}&workOrderCode=${this.workOrderCode}`
  698. // })
  699. uni.navigateTo({
  700. url: `/pages/tour_tally/check/index?id=${id}`
  701. })
  702. },
  703. checkDetail({
  704. id
  705. }) {
  706. uni.navigateTo({
  707. url: `/pages/tour_tally/check/detail?id=${id}`
  708. })
  709. },
  710. getInfo() {
  711. getWorkOrderDetail({
  712. workId: this.pageId
  713. }).then(data => {
  714. this.worksheetInfo = data
  715. this.getSparePartsApply(data.id)
  716. })
  717. getSpareParts({
  718. workOrderId: this.pageId
  719. }).then(data => {
  720. console.log('data-----------------------')
  721. console.log(data)
  722. let list = JSON.parse(JSON.stringify(data))
  723. this.repairInfoLogList = list.reverse()
  724. this.repairInfoLogList.forEach(item => {
  725. console.log('item.id-----------------')
  726. console.log(item.id)
  727. console.log(this.logs)
  728. this.logs[item.id] = {
  729. id: item.id,
  730. content: item.content,
  731. createTime: item.createTime,
  732. type: item.type,
  733. remark: item.remark,
  734. requestUserName: item.requestUserName
  735. }
  736. if (item.type === 'SPARE_PARTS_APPLY') {
  737. this.logs[item.id].content.infoList =
  738. this.logs[item.id].content && this.logs[item.id].content.infoList && this
  739. .logs[item.id].content.infoList.length > 0 ?
  740. this.logs[item.id].content.infoList.map(item => {
  741. return {
  742. ...JSON.parse(item.sparePartsList),
  743. sparePartsId: item.sparePartsId
  744. }
  745. }) : []
  746. }
  747. })
  748. })
  749. // return post(this.apiUrl + '/workOrder/getDetailsApp', {
  750. // workOrderCode: this.workOrderCode
  751. // }).then(res => {
  752. // if (res?.success) {
  753. // this.worksheetInfo = res.data
  754. // }
  755. // })
  756. },
  757. // 报修
  758. handLbx(item) {
  759. console.log('item', item)
  760. uni.navigateTo({
  761. url: `/pages/repair/repair/index?source=5&workOrderCode=${this.workOrderCode}&equiCode=${item.equiCode}&equiId=${item.equiId}&workOrderId=${this.pageId}&equiName=${item.equiName}&equiModel=${item.equiModel}&equiLocation=${item.equiLocation}`
  762. })
  763. },
  764. handLbxDetail(item) {
  765. uni.navigateTo({
  766. url: `/pages/repair/detail/detail?id=${item.repairId}`
  767. })
  768. }
  769. }
  770. }
  771. </script>
  772. <style lang="scss" scoped>
  773. @import '@/components/submitted.scss';
  774. /deep/.u-subsection__item__text {
  775. font-size: 28rpx !important;
  776. }
  777. /deep/.u-cell__body {
  778. // {
  779. // font-size: 26rpx !important;
  780. // }
  781. // padding: 12rpx 12rpx;
  782. .u-cell__title-text,
  783. .input-value,
  784. .uni-input-wrapper {
  785. font-size: 26rpx !important;
  786. }
  787. }
  788. .list-cell {
  789. display: flex;
  790. align-items: center;
  791. justify-content: space-between;
  792. color: $uni-text-color-grey;
  793. padding: 5rpx 20rpx;
  794. }
  795. .font-sm {
  796. font-size: $uni-font-size-sm;
  797. }
  798. .font-text {
  799. color: $uni-text-color;
  800. }
  801. .btn-execute {
  802. background-color: $j-primary-border-green;
  803. width: 450rpx;
  804. margin-top: 5vh;
  805. }
  806. .btn-reassignment {
  807. color: $uni-color-primary;
  808. background-color: transparent;
  809. border: none;
  810. box-shadow: none;
  811. &::after {
  812. display: none;
  813. }
  814. }
  815. .tour-container {
  816. position: fixed;
  817. top: 0;
  818. bottom: 0;
  819. width: 100vw;
  820. display: flex;
  821. flex-direction: column;
  822. /deep/.u-popup {
  823. flex: none !important;
  824. }
  825. }
  826. .tour-wrapper {
  827. position: relative;
  828. flex: 1;
  829. }
  830. .tour_tally-content {
  831. // padding-top: 40rpx;
  832. box-sizing: border-box;
  833. // height: calc(100vh - 88rpx);
  834. position: absolute;
  835. top: 0;
  836. bottom: 0;
  837. left: 0;
  838. right: 0;
  839. display: flex;
  840. flex-direction: column;
  841. }
  842. .kd-cell {
  843. min-height: 90rpx;
  844. border-bottom: 1px dashed #dadada;
  845. display: flex;
  846. align-items: center;
  847. .kd-label {
  848. display: inline-block;
  849. width: 7em;
  850. font-weight: bold;
  851. }
  852. .kd-content {
  853. flex: 1;
  854. word-break: break-all;
  855. }
  856. }
  857. .kd-baseInfo {
  858. padding: 0 32rpx;
  859. font-size: 28rpx;
  860. }
  861. .kd-equipment {
  862. flex: 1;
  863. display: flex;
  864. flex-direction: column;
  865. overflow: hidden;
  866. .kd-type-box {
  867. text-align: center;
  868. padding: 26rpx 0;
  869. view {
  870. position: relative;
  871. display: inline-block;
  872. width: 120rpx;
  873. padding: 4rpx 0;
  874. color: #747474;
  875. margin: 0 20rpx;
  876. background-color: rgba(215, 215, 215, 0.5);
  877. &.type—active {
  878. background-color: #1e7f35;
  879. color: #fff;
  880. }
  881. .count {
  882. position: absolute;
  883. top: -9px;
  884. right: -9px;
  885. width: 18px;
  886. height: 18px;
  887. border-radius: 50%;
  888. font-size: 12px;
  889. background-color: red;
  890. color: #fff;
  891. }
  892. }
  893. }
  894. .kd-list-container {
  895. flex: 1;
  896. display: flex;
  897. flex-direction: column;
  898. overflow: hidden;
  899. padding: 12rpx 18rpx;
  900. background-color: $page-bg;
  901. .u-list {
  902. flex: 1;
  903. height: 100% !important;
  904. }
  905. }
  906. }
  907. .btn-sparepart {
  908. width: 450rpx;
  909. margin-top: 20rpx;
  910. }
  911. .spare-parts {
  912. flex: 1;
  913. overflow: hidden;
  914. overflow-y: auto;
  915. }
  916. .kd-card {
  917. background-color: #fff;
  918. margin-bottom: 20rpx;
  919. padding: 8rpx 0;
  920. font-size: 28rpx;
  921. word-break: break-all;
  922. .kd-card-wrapper {
  923. padding: 0 30rpx;
  924. border-bottom: 1px solid #dadada;
  925. }
  926. .kd-cell {
  927. line-height: 60rpx;
  928. }
  929. .kd-cell:last-of-type {
  930. border-bottom: none;
  931. }
  932. .status-box {
  933. margin-right: 16rpx;
  934. }
  935. .card-footer {
  936. display: flex;
  937. justify-content: flex-end;
  938. align-items: center;
  939. padding: 8rpx 0 20rpx;
  940. button {
  941. width: 180rpx;
  942. height: 56rpx;
  943. line-height: 56rpx;
  944. font-size: 28rpx;
  945. margin: 0 8rpx;
  946. }
  947. .primary-btn {
  948. background-color: $j-primary-border-green;
  949. }
  950. }
  951. }
  952. </style>