list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. <template>
  2. <view class="content">
  3. <view class="topbar" v-show="isIphone">
  4. </view>
  5. <view class="status_bar">
  6. <view class="left2" @click="goBack">
  7. <u-icon name="arrow-left"></u-icon>返回
  8. </view>
  9. <span style="font-size: 36rpx;">医废收集</span>
  10. <view class="right2">
  11. <span>
  12. <u-icon @click="scanCode" style="margin-right: 10px;" name="scan" color="#fff" size="35rpx">
  13. </u-icon>
  14. </span>
  15. <span @click="filterShow = true">筛选</span>
  16. </view>
  17. </view>
  18. <view class="status_tabs">
  19. <u-tabs bg-color="#5976ba" active-color="#fff" inactive-color="#fff" :list="tabList" :is-scroll="false"
  20. :current="current" @change="tabChange"></u-tabs>
  21. </view>
  22. <view class="search_bar">
  23. <u-search @custom="clearSearch" :show-action="false" @search="onRefresh" placeholder="请输入打包人姓名/暂存点名称查询"
  24. v-model="keyword">
  25. </u-search>
  26. </view>
  27. <scroll-view :style="{paddingBottom: current == 1 ? '60px' : '10px'}" scroll-y class="scroll-box mainCont"
  28. @scrolltolower="handleLoadMore" @scroll="scroll" :refresher-enabled="scroll_refresher_enabled"
  29. :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white"
  30. @refresherrefresh="onRefresh" @refresherrestore="onRestore">
  31. <view class="pcTop" v-show="current == 1 && tableList.length">{{ zyzText }}<span
  32. style="float: right">{{ zyzWeight }}kg</span>
  33. </view>
  34. <view class="card"
  35. @click="goInfo(item.packageId ? item.packageId : item.id, `${item.collectDate} ${item.batchName}(${item.packageNo})`, item.collectWeight)"
  36. v-for="(item, index) in tableList" :key="index">
  37. <view class="top">
  38. <view class="left" v-show="current != 2">{{ item.packCode }}</view>
  39. <view class="left" v-show="current == 2">{{ item.collectDate }} {{ item.batchName }}
  40. ({{ item.packageNo }})</view>
  41. <view class="right" v-show="current == 0" style="color: #FF6600">待收集</view>
  42. <view class="right" v-show="current == 1" style="color: #00CC00">转运中</view>
  43. <view class="right" v-show="current == 2 && item.batchState == '2'" style="color: #1890FF">待验收
  44. </view>
  45. <view class="right" v-show="current == 2 && item.batchState == '3'"
  46. style="float: right; color: #BCBCBC">已完成</view>
  47. </view>
  48. <view class="bottom">
  49. <view v-show="current != 2">科&emsp;&emsp;室:{{ item.positionName }}<span
  50. style="float: right">{{ item.packWeight }}kg</span></view>
  51. <view v-show="current != 2">医废分类:{{ item.rubbishCategoryStr }}</view>
  52. <view v-show="current != 2">暂&ensp;存&ensp;点:{{ item.provisionalName }}</view>
  53. <view v-show="current != 2">打&ensp;包&ensp;人:{{ item.createUserName }}<span
  54. style="float: right">{{ item.createTime }}</span>
  55. </view>
  56. <view v-show="current == 0 && item.timeoutInfo" style="color: red">{{ item.timeoutInfo }}
  57. </view>
  58. <view v-show="current == 2">重&emsp;&emsp;量:{{ item.collectWeight }}kg</view>
  59. <view v-show="current == 2">验&ensp;收&ensp;人:{{ item.checkUserName }}</view>
  60. <view class="bButton" v-show="current == 0">
  61. <!-- <span @click.stop="doCollect()">收集</span> -->
  62. <span>收集</span>
  63. </view>
  64. </view>
  65. </view>
  66. <view style="margin-top: 100px;text-align: center;" v-show="!tableList.length">暂无数据</view>
  67. </scroll-view>
  68. <view class="bottomButtons" v-show="current == 1">
  69. <view @click="goLine" style="background-color: #fff;color: rgba(89, 118, 186, 1)">查看线路</view>
  70. <view @click="checkOutLine" style="background-color: rgba(89, 118, 186, 1);color: #fff;">转运完成</view>
  71. </view>
  72. <u-popup v-model="filterShow" mode="bottom" height="300px">
  73. <view class="status_bar" style="height: 40px;line-height: 40px;">
  74. <view class="left" @click="filterShow = false">取消</view>
  75. <span @click='filterClear'>清空筛选</span>
  76. <view class="right" @click="filterDo">确定</view>
  77. </view>
  78. <view class="filterCont">
  79. <view class="left">
  80. <view @click="filterLChange(item.name, index)" :key="index" v-for="(item, index) in filterItem"
  81. :class="{active: active == item.name}">
  82. {{ item.name }}
  83. </view>
  84. </view>
  85. <scroll-view scroll-y class="right">
  86. <view @click="filterRChange(item.value, index)" v-for="(item, index) in selectItems" :key="index"
  87. :class="{active: filterItem[activeIndex].value == item.value}">
  88. {{ item.label }}
  89. <span v-show="filterItem[activeIndex].value == item.value" style="float: right">✔</span>
  90. </view>
  91. </scroll-view>
  92. </view>
  93. </u-popup>
  94. <u-modal ref="uModal" async-close v-model="notShow" @cancel="" @confirm="checkComplete" show-cancel-button
  95. title="提示">
  96. <view class="slot-content">
  97. <view style="width: 80%;text-align: center;margin: 15px auto;">
  98. <p style="margin-bottom: 10px;">您在转运过程中未按照规定路线转运,请说明原因后提交</p>
  99. <u-input placeholder="请输入原因" v-model="reason" type="text" border />
  100. </view>
  101. </view>
  102. </u-modal>
  103. <u-toast ref="uToast" />
  104. </view>
  105. </template>
  106. <script>
  107. const NET = require('@/utils/request')
  108. const API = require('@/config/api')
  109. export default {
  110. data() {
  111. return {
  112. current: 0,
  113. tabList: [{
  114. name: '待收集'
  115. }, {
  116. name: '转运中'
  117. }, {
  118. name: '已完成'
  119. }],
  120. scroll_refresher_enabled: true,
  121. zyzText: "",
  122. zyzSl: "",
  123. zyzWeight: "",
  124. buildingId: "",
  125. triggered: false,
  126. isOver: false,
  127. keyword: "",
  128. tableList: [],
  129. isIphone: false,
  130. pageIndex: 1,
  131. loading: false,
  132. loading1: false,
  133. filterShow: false,
  134. notShow: false,
  135. reason: "",
  136. filterItem: [{
  137. name: '科室',
  138. label: 'room',
  139. value: '',
  140. item: []
  141. }, {
  142. name: '时间段',
  143. label: 'time',
  144. value: '',
  145. item: [{
  146. label: '05:00-07:30',
  147. value: '05:00-07:30'
  148. }, {
  149. label: '07:30-10:00',
  150. value: '07:30-10:00'
  151. }, {
  152. label: '10:00-12:30',
  153. value: '10:00-12:30'
  154. }, {
  155. label: '12:30-15:00',
  156. value: '12:30-15:00'
  157. }, {
  158. label: '15:00-17:30',
  159. value: '15:00-17:30'
  160. }]
  161. }],
  162. active: '科室',
  163. activeIndex: 0,
  164. selectItems: [],
  165. }
  166. },
  167. onLoad() {
  168. uni.getSystemInfo({
  169. success: (res) => {
  170. console.log(res)
  171. if (res.model == 'iPhone') {
  172. this.isIphone = true;
  173. }
  174. },
  175. fail: (err) => {
  176. console.log(err)
  177. }
  178. })
  179. // this.tabList[0].name = '待收集(0)'
  180. // this.tabList[1].name = '转运中(0)'
  181. // this.tabList[2].name = '已完成(0)'
  182. },
  183. onReady() {
  184. if (this.isIphone) {
  185. document.getElementsByClassName('mainCont')[0].style.height = document.getElementsByClassName('mainCont')[
  186. 0].clientHeight - 25 + 'px'
  187. }
  188. },
  189. onShow() {
  190. NET.request(API.getUserInfoById, {}).then(res => {
  191. this.buildingId = res.data.buildingId
  192. NET.request(API.getOfficeBoxInfo, {
  193. buildingId: res.data.buildingId,
  194. }).then(res => {
  195. for (let i in res.data) {
  196. res.data[i].label = res.data[i].positionName
  197. res.data[i].value = res.data[i].id
  198. }
  199. this.filterItem[0].item = res.data
  200. this.selectItems = res.data
  201. }).catch(error => {
  202. this.$refs.uToast.show({
  203. title: error.msg,
  204. type: 'warning',
  205. })
  206. })
  207. }).catch(error => {
  208. this.$refs.uToast.show({
  209. title: error.msg,
  210. type: 'warning',
  211. })
  212. })
  213. let date = new Date;
  214. //获取年份
  215. let yy = date.getFullYear();
  216. //获取月份
  217. let mm = date.getMonth() + 1;
  218. //如果月份小于10 前面加0
  219. mm = (mm < 10 ? "0" + mm : mm);
  220. let dd = date.getDate();
  221. dd = (dd < 10 ? "0" + dd : dd);
  222. //返回日期
  223. this.time = `${yy}-${mm}-${dd}`
  224. this.tabList[0].name = '待收集(0)'
  225. this.tabList[1].name = '转运中(0)'
  226. this.tabList[2].name = '已完成(0)'
  227. this.onRefresh();
  228. },
  229. methods: {
  230. goBack() {
  231. try {
  232. EbeiPlugins.onBackKeyDown();
  233. } catch (error) {}
  234. },
  235. scanCode() {
  236. console.log('asdasdasd')
  237. let that = this
  238. EbeiPlugins.scanQRCode((string) => {
  239. NET.request(API.batchSignIn, {
  240. positionId: string
  241. }, 'POST').then(res => {
  242. this.$refs.uToast.show({
  243. title: res.msg,
  244. type: 'success',
  245. })
  246. }).catch(error => {
  247. this.$refs.uToast.show({
  248. title: error.msg,
  249. type: 'warning',
  250. })
  251. })
  252. }, () => {
  253. that.showTips('扫码失败')
  254. })
  255. },
  256. tabChange(index) {
  257. this.current = index;
  258. this.onRefresh()
  259. },
  260. clearSearch() {
  261. this.keyword = "";
  262. },
  263. scroll(e) {
  264. if (e.detail.scrollTop <= 60) {
  265. this.scroll_refresher_enabled = true
  266. } else {
  267. this.scroll_refresher_enabled = false
  268. }
  269. },
  270. getNums() {
  271. if (this.loading1) {
  272. return false;
  273. }
  274. let postData = {
  275. buildingId: this.buildingId,
  276. pageIndex: this.pageIndex,
  277. pageSize: 10,
  278. // packState: 1,
  279. date: this.time,
  280. }
  281. if (this.filterItem[0].value) {
  282. postData.positionId = this.filterItem[0].value
  283. }
  284. if (this.filterItem[1].value) {
  285. postData.startDate = this.filterItem[1].value.split("-")[0]
  286. postData.endDate = this.filterItem[1].value.split("-")[1]
  287. }
  288. this.loading1 = true;
  289. NET.request(API.needCollectNo, postData, 'POST').then(res => {
  290. this.tabList[0].name = `待收集(${res.data[1]})`
  291. this.tabList[1].name = `转运中(${res.data[2] == 0 ? 0 : 1})`
  292. this.zyzSl = res.data[2] ? res.data[2] : 0
  293. this.loading1 = false;
  294. NET.request(API.getMovingBatchData).then(res => {
  295. this.zyzText = `${res.data.collectDate}${res.data.batchName}(${this.zyzSl})`
  296. this.zyzWeight = res.data.collectWeight
  297. }).catch(error => {
  298. this.$refs.uToast.show({
  299. title: error.msg,
  300. type: 'warning',
  301. })
  302. })
  303. }).catch(error => {
  304. this.$refs.uToast.show({
  305. title: error.msg,
  306. type: 'warning',
  307. })
  308. })
  309. let postData2 = {
  310. date: this.time,
  311. buildingId: this.buildingId,
  312. }
  313. NET.request(API.completeNo, postData, 'POST').then(res => {
  314. this.tabList[2].name = `已完成(${res.data})`
  315. }).catch(error => {
  316. this.$refs.uToast.show({
  317. title: error.msg,
  318. type: 'warning',
  319. })
  320. })
  321. },
  322. getTableList() {
  323. if (this.loading || this.isOver) {
  324. return false;
  325. }
  326. this.loading = true;
  327. let postData = {
  328. pageIndex: this.pageIndex,
  329. pageSize: 10,
  330. packState: this.current + 1,
  331. date: this.time,
  332. // data: '2021-07-22'
  333. }
  334. if (this.filterItem[0].value) {
  335. postData.positionId = this.filterItem[0].value
  336. }
  337. if (this.filterItem[1].value) {
  338. postData.startDate = this.filterItem[1].value.split("-")[0]
  339. postData.endDate = this.filterItem[1].value.split("-")[1]
  340. }
  341. if (this.current == 2) {
  342. postData.batchState = '23'
  343. }
  344. if (this.current != 2) {
  345. NET.request(API.queryPackageList, postData, 'POST').then(res => {
  346. this.triggered = false;
  347. this.loading = false;
  348. if (res.data.records.length < 10) {
  349. this.isOver = true
  350. }
  351. for (let i in res.data.records) {
  352. this.tableList.push(res.data.records[i])
  353. }
  354. }).catch(error => {
  355. this.$refs.uToast.show({
  356. title: error.msg,
  357. type: 'warning',
  358. })
  359. })
  360. } else {
  361. NET.request(API.queryBatchList, postData, 'POST').then(res => {
  362. this.triggered = false;
  363. this.loading = false;
  364. if (res.data.length < 10) {
  365. this.isOver = true
  366. }
  367. for (let i in res.data) {
  368. this.tableList.push(res.data[i])
  369. }
  370. }).catch(error => {
  371. this.$refs.uToast.show({
  372. title: error.msg,
  373. type: 'warning',
  374. })
  375. })
  376. }
  377. },
  378. // 下拉刷新
  379. onRefresh() {
  380. this.triggered = true
  381. this.isOver = false
  382. this.pageIndex = 1
  383. this.tableList = []
  384. this.getTableList()
  385. this.getNums()
  386. },
  387. // 重置下拉刷新状态
  388. onRestore() {
  389. this.triggered = 'restore'
  390. this.triggered = false
  391. },
  392. //获取更多数据
  393. handleLoadMore() {
  394. if (this.isOver) {
  395. } else if (this.loading) {
  396. } else {
  397. this.pageIndex++;
  398. this.getTableList()
  399. }
  400. },
  401. filterLChange(name, index) {
  402. this.active = name;
  403. this.activeIndex = index;
  404. this.selectItems = this.filterItem[index].item
  405. },
  406. filterRChange(value, index) {
  407. this.filterItem[this.activeIndex].value = value;
  408. },
  409. filterDo() {
  410. this.filterShow = false;
  411. this.onRefresh()
  412. console.log(this.filterItem)
  413. },
  414. filterClear() {
  415. this.filterShow = false;
  416. for (let i in this.filterItem) {
  417. this.filterItem[i].value = ""
  418. }
  419. this.onRefresh()
  420. },
  421. checkComplete() {
  422. if (!this.reason) {
  423. this.$refs.uToast.show({
  424. title: '请填写原因',
  425. type: 'warning',
  426. })
  427. this.$refs.uModal.clearLoading();
  428. return false
  429. } else {
  430. this.notShow = false;
  431. this.completeCollect(this.reason);
  432. }
  433. },
  434. completeCollect(reason) {
  435. let postData = {}
  436. if (reason) {
  437. postData = {
  438. pathReason: reason
  439. }
  440. } else {
  441. }
  442. NET.request(API.completeMove, postData, 'POST').then(res => {
  443. this.reason = ""
  444. this.$refs.uToast.show({
  445. title: res.msg,
  446. type: 'success',
  447. })
  448. this.onRefresh()
  449. }).catch(error => {
  450. this.$refs.uToast.show({
  451. title: error.msg,
  452. type: 'warning',
  453. })
  454. })
  455. },
  456. checkOutLine() {
  457. NET.request(API.checkoutPathResult).then(res => {
  458. if (!res.data.pathResult) {
  459. this.notShow = true
  460. } else {
  461. this.completeCollect()
  462. }
  463. }).catch(error => {
  464. this.$refs.uToast.show({
  465. title: error.msg,
  466. type: 'warning',
  467. })
  468. })
  469. },
  470. doCollect() {
  471. },
  472. goInfo(id, text, weight) {
  473. if (this.current == 0 || this.current == 1) {
  474. uni.navigateTo({
  475. url: `/collection/infor?id=${id}`
  476. });
  477. } else if (this.current == 2) {
  478. uni.navigateTo({
  479. url: `/collection/list2?id=${id}&text=${text}&weight=${weight}`
  480. });
  481. }
  482. },
  483. goLine() {
  484. uni.navigateTo({
  485. url: '/collection/line?id=asd'
  486. });
  487. }
  488. }
  489. }
  490. </script>
  491. <style lang="scss">
  492. .search_bar {
  493. padding: 0 10px;
  494. height: 100rpx;
  495. background: #fff;
  496. line-height: 100rpx;
  497. }
  498. .mainCont {
  499. height: calc(100% - 80rpx - 80rpx - 100rpx);
  500. padding: 10px 0 10px 0;
  501. box-sizing: border-box;
  502. }
  503. .pcTop {
  504. width: calc(100% - 20px);
  505. padding: 0 10px;
  506. height: 20px;
  507. line-height: 20px;
  508. margin: 0 auto;
  509. margin-bottom: 10px;
  510. position: relative;
  511. &:after {
  512. content: '';
  513. position: absolute;
  514. height: 20px;
  515. top: 0;
  516. left: 0;
  517. width: 2px;
  518. background-color: #6aa0f7;
  519. }
  520. }
  521. .bottomButtons {
  522. box-shadow: 0px -5px 5px #d0cece;
  523. position: fixed;
  524. display: flex;
  525. justify-content: space-between;
  526. width: 100%;
  527. height: 40px;
  528. line-height: 40px;
  529. bottom: 0;
  530. left: 0;
  531. view {
  532. width: 50%;
  533. height: 40px;
  534. line-height: 40px;
  535. text-align: center;
  536. }
  537. }
  538. .filterCont {
  539. width: 100%;
  540. height: calc(100% - 40px);
  541. display: flex;
  542. justify-content: space-between;
  543. .left {
  544. height: 100%;
  545. overflow-y: scroll;
  546. width: 30%;
  547. background-color: #fafafa;
  548. view {
  549. height: 40px;
  550. line-height: 40px;
  551. text-align: center;
  552. &.active {
  553. background-color: #fff;
  554. }
  555. }
  556. }
  557. .right {
  558. height: 100%;
  559. overflow-y: scroll;
  560. width: 70%;
  561. view {
  562. width: calc(100% - 20px);
  563. margin: 0 auto;
  564. padding: 0 20px;
  565. // height: 39px;
  566. line-height: 39px;
  567. border-bottom: 1px solid #f2f2f2;
  568. }
  569. }
  570. }
  571. /deep/ .uni-scroll-view-refresher {
  572. background-color: #f5f5f9 !important;
  573. }
  574. </style>