detail.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996
  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">转派</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. })
  627. // post(this.apiUrl + '/workOrder/execute', {
  628. // workOrderCode: this.workOrderCode
  629. // }).then(res => {
  630. // if (res?.success) {
  631. // uni.showToast({
  632. // icon: 'success',
  633. // title: '操作成功!',
  634. // duration: 2000
  635. // })
  636. // this.getInfo()
  637. // }
  638. // })
  639. },
  640. //巡点检设备加载更多
  641. scrolltolower() {
  642. if (this.isEnd) return
  643. this.equipPage++
  644. this.getEquipList()
  645. },
  646. // 巡点检设备列表
  647. getEquipList() {
  648. const params = {
  649. planId: this.planId,
  650. status: this.equpStatus[this.typeActive].value,
  651. pageNum: 1,
  652. size: 9999
  653. }
  654. getDeviceList(params).then(data => {
  655. if (this.equipPage === 1) {
  656. this.euqiList = data.list
  657. } else {
  658. this.euqiList.push(...data.list)
  659. }
  660. this.isEnd = this.euqiList.length >= data.count
  661. })
  662. // post(this.apiUrl + `/workOrder/getEquipmentListApp?page=${this.equipPage}&size=10`, params, true).then(res => {
  663. // if (res?.success) {
  664. // if (this.equipPage === 1) {
  665. // this.euqiList = res.data.records
  666. // } else {
  667. // this.euqiList.push(...res.data.records)
  668. // }
  669. // this.isEnd = this.euqiList.length >= res.data.total
  670. // }
  671. // })
  672. },
  673. handleTabChange(value) {
  674. this.active = value
  675. if (value === 1) {
  676. this.typeChange(0)
  677. }
  678. },
  679. finishTime(start, end) {
  680. if (!end) return ''
  681. let dur = new Date(end).getTime() - new Date(start).getTime()
  682. return Math.ceil(dur / 1000 / 60) + '分钟'
  683. },
  684. // 设备状态切换
  685. typeChange(type) {
  686. this.typeActive = type
  687. this.equipPage = 1
  688. this.getEquipList()
  689. },
  690. handleCheck({
  691. id
  692. }) {
  693. // uni.navigateTo({
  694. // url: `/pages/tour_tally/check/index?id=${id}&equiName=${equiName}&equiCode=${equiCode}&workOrderId=${this.pageId}&workOrderCode=${this.workOrderCode}`
  695. // })
  696. uni.navigateTo({
  697. url: `/pages/tour_tally/check/index?id=${id}`
  698. })
  699. },
  700. checkDetail({
  701. id
  702. }) {
  703. uni.navigateTo({
  704. url: `/pages/tour_tally/check/detail?id=${id}`
  705. })
  706. },
  707. getInfo() {
  708. getWorkOrderDetail({
  709. workId: this.pageId
  710. }).then(data => {
  711. this.worksheetInfo = data
  712. this.getSparePartsApply(data.id)
  713. })
  714. getSpareParts({
  715. workOrderId: this.pageId
  716. }).then(data => {
  717. console.log('data-----------------------')
  718. console.log(data)
  719. let list = JSON.parse(JSON.stringify(data))
  720. this.repairInfoLogList = list.reverse()
  721. this.repairInfoLogList.forEach(item => {
  722. console.log('item.id-----------------')
  723. console.log(item.id)
  724. console.log(this.logs)
  725. this.logs[item.id] = {
  726. id: item.id,
  727. content: item.content,
  728. createTime: item.createTime,
  729. type: item.type,
  730. remark: item.remark,
  731. requestUserName: item.requestUserName
  732. }
  733. if (item.type === 'SPARE_PARTS_APPLY') {
  734. this.logs[item.id].content.infoList =
  735. this.logs[item.id].content && this.logs[item.id].content.infoList && this
  736. .logs[item.id].content.infoList.length > 0 ?
  737. this.logs[item.id].content.infoList.map(item => {
  738. return {
  739. ...JSON.parse(item.sparePartsList),
  740. sparePartsId: item.sparePartsId
  741. }
  742. }) : []
  743. }
  744. })
  745. })
  746. // return post(this.apiUrl + '/workOrder/getDetailsApp', {
  747. // workOrderCode: this.workOrderCode
  748. // }).then(res => {
  749. // if (res?.success) {
  750. // this.worksheetInfo = res.data
  751. // }
  752. // })
  753. },
  754. // 报修
  755. handLbx(item) {
  756. console.log('item', item)
  757. uni.navigateTo({
  758. 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}`
  759. })
  760. },
  761. handLbxDetail(item) {
  762. uni.navigateTo({
  763. url: `/pages/repair/detail/detail?id=${item.repairId}`
  764. })
  765. }
  766. }
  767. }
  768. </script>
  769. <style lang="scss" scoped>
  770. @import '@/components/submitted.scss';
  771. /deep/.u-subsection__item__text {
  772. font-size: 28rpx !important;
  773. }
  774. /deep/.u-cell__body {
  775. // {
  776. // font-size: 26rpx !important;
  777. // }
  778. // padding: 12rpx 12rpx;
  779. .u-cell__title-text,
  780. .input-value,
  781. .uni-input-wrapper {
  782. font-size: 26rpx !important;
  783. }
  784. }
  785. .list-cell {
  786. display: flex;
  787. align-items: center;
  788. justify-content: space-between;
  789. color: $uni-text-color-grey;
  790. padding: 5rpx 20rpx;
  791. }
  792. .font-sm {
  793. font-size: $uni-font-size-sm;
  794. }
  795. .font-text {
  796. color: $uni-text-color;
  797. }
  798. .btn-execute {
  799. background-color: $j-primary-border-green;
  800. width: 450rpx;
  801. margin-top: 5vh;
  802. }
  803. .btn-reassignment {
  804. color: $uni-color-primary;
  805. background-color: transparent;
  806. border: none;
  807. box-shadow: none;
  808. &::after {
  809. display: none;
  810. }
  811. }
  812. .tour-container {
  813. position: fixed;
  814. top: 0;
  815. bottom: 0;
  816. width: 100vw;
  817. display: flex;
  818. flex-direction: column;
  819. /deep/.u-popup {
  820. flex: none !important;
  821. }
  822. }
  823. .tour-wrapper {
  824. position: relative;
  825. flex: 1;
  826. }
  827. .tour_tally-content {
  828. // padding-top: 40rpx;
  829. box-sizing: border-box;
  830. // height: calc(100vh - 88rpx);
  831. position: absolute;
  832. top: 0;
  833. bottom: 0;
  834. left: 0;
  835. right: 0;
  836. display: flex;
  837. flex-direction: column;
  838. }
  839. .kd-cell {
  840. min-height: 90rpx;
  841. border-bottom: 1px dashed #dadada;
  842. display: flex;
  843. align-items: center;
  844. .kd-label {
  845. display: inline-block;
  846. width: 7em;
  847. font-weight: bold;
  848. }
  849. .kd-content {
  850. flex: 1;
  851. word-break: break-all;
  852. }
  853. }
  854. .kd-baseInfo {
  855. padding: 0 32rpx;
  856. font-size: 28rpx;
  857. }
  858. .kd-equipment {
  859. flex: 1;
  860. display: flex;
  861. flex-direction: column;
  862. overflow: hidden;
  863. .kd-type-box {
  864. text-align: center;
  865. padding: 26rpx 0;
  866. view {
  867. position: relative;
  868. display: inline-block;
  869. width: 120rpx;
  870. padding: 4rpx 0;
  871. color: #747474;
  872. margin: 0 20rpx;
  873. background-color: rgba(215, 215, 215, 0.5);
  874. &.type—active {
  875. background-color: #1e7f35;
  876. color: #fff;
  877. }
  878. .count {
  879. position: absolute;
  880. top: -9px;
  881. right: -9px;
  882. width: 18px;
  883. height: 18px;
  884. border-radius: 50%;
  885. font-size: 12px;
  886. background-color: red;
  887. color: #fff;
  888. }
  889. }
  890. }
  891. .kd-list-container {
  892. flex: 1;
  893. display: flex;
  894. flex-direction: column;
  895. overflow: hidden;
  896. padding: 12rpx 18rpx;
  897. background-color: $page-bg;
  898. .u-list {
  899. flex: 1;
  900. height: 100% !important;
  901. }
  902. }
  903. }
  904. .btn-sparepart {
  905. width: 450rpx;
  906. margin-top: 20rpx;
  907. }
  908. .spare-parts {
  909. flex: 1;
  910. overflow: hidden;
  911. overflow-y: auto;
  912. }
  913. .kd-card {
  914. background-color: #fff;
  915. margin-bottom: 20rpx;
  916. padding: 8rpx 0;
  917. font-size: 28rpx;
  918. word-break: break-all;
  919. .kd-card-wrapper {
  920. padding: 0 30rpx;
  921. border-bottom: 1px solid #dadada;
  922. }
  923. .kd-cell {
  924. line-height: 60rpx;
  925. }
  926. .kd-cell:last-of-type {
  927. border-bottom: none;
  928. }
  929. .status-box {
  930. margin-right: 16rpx;
  931. }
  932. .card-footer {
  933. display: flex;
  934. justify-content: flex-end;
  935. align-items: center;
  936. padding: 8rpx 0 20rpx;
  937. button {
  938. width: 180rpx;
  939. height: 56rpx;
  940. line-height: 56rpx;
  941. font-size: 28rpx;
  942. margin: 0 8rpx;
  943. }
  944. .primary-btn {
  945. background-color: $j-primary-border-green;
  946. }
  947. }
  948. }
  949. </style>