order.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <view>
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="维修工单" @clickLeft="back"></uni-nav-bar>
  4. <view class="search-box">
  5. <uni-section>
  6. <uni-easyinput @clear="clearSearch" prefixIcon="search" style="width: 460rpx" v-model="searchForm.code"
  7. placeholder="工单编号">
  8. </uni-easyinput>
  9. </uni-section>
  10. <button class="search_btn" @click="doSearch">搜索</button>
  11. <!-- <image class="menu_icon" @click="showSearch" src="~@/static/pda/menu.svg"></image> -->
  12. </view>
  13. <view v-show="showTab">
  14. <view class="top-wrapper">
  15. <view class="tab_box rx-sc">
  16. <view class="tab_item" v-for="(item,index) in tabList" :key="index"
  17. :class="{active: pickTabIndex == index}">
  18. <view @click="changeChartsTab(index)" class="badge-c">
  19. {{item.label}}
  20. <u-badge max="99" :value="item.number" absolute></u-badge>
  21. <!-- <text v-if="item.number > 0" class="title-red">{{ item.number }}</text> -->
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <OrderTask v-for="(item, index) in tabList" :key="index" v-show="index === pickTabIndex" :list="item.list"
  28. :type="tabList.value" :ParentIndex="pickTabIndex"></OrderTask>
  29. <u-toast ref="uToast"></u-toast>
  30. <MySearch :show.sync="searchShow" :formItems="formItems" @search="confirmSearch" ref="mySearchRef"></MySearch>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. isObjectEmpty
  36. } from '@/utils/utils.js'
  37. import {
  38. getWorkOrderList,
  39. getAssistList,
  40. getRuleList
  41. } from '@/api/myTicket'
  42. import OrderTask from './OrderTask.vue'
  43. import {
  44. post,
  45. postJ
  46. } from '@/utils/api.js'
  47. export default {
  48. components: {
  49. OrderTask
  50. },
  51. data() {
  52. return {
  53. showTab: true,
  54. page: 1,
  55. size: 10,
  56. isEnd: false,
  57. tabList: [{
  58. value: 0,
  59. label: '待接收',
  60. list: [],
  61. number: 0
  62. },
  63. {
  64. value: 2,
  65. label: '执行中',
  66. list: [],
  67. number: 0
  68. },
  69. {
  70. value: 3,
  71. label: '待验收',
  72. list: [],
  73. number: 0
  74. },
  75. {
  76. value: 4,
  77. label: '已验收',
  78. list: [],
  79. number: 0
  80. },
  81. {
  82. value: 5,
  83. label: '协助工单',
  84. list: [],
  85. number: 0
  86. }
  87. ],
  88. pickTabIndex: 0,
  89. qrContent: null,
  90. barType: 0,
  91. searchShow: false,
  92. searchForm: {
  93. code: ''
  94. },
  95. formItems: [{
  96. label: '规则名称:',
  97. prop: 'ruleId',
  98. component: 'MySelect',
  99. props: {
  100. localdata: [],
  101. dataKey: 'name',
  102. dataValue: 'id'
  103. }
  104. },
  105. {
  106. label: '时间:',
  107. prop: 'startEndTime',
  108. component: 'MyDateRange',
  109. props: {
  110. type: 'daterange',
  111. }
  112. }
  113. ]
  114. }
  115. },
  116. onLoad() {
  117. this.getRuleList()
  118. },
  119. onShow() {
  120. this.changeChartsTab(this.pickTabIndex)
  121. this.getStatus()
  122. },
  123. onReachBottom() {
  124. if (this.pickTabIndex === 4) {
  125. this.getAList()
  126. return
  127. }
  128. this.getList()
  129. },
  130. methods: {
  131. getStatus() {
  132. getWorkOrderList({
  133. orderStatus: [0],
  134. type: 3,
  135. pageNum: 1,
  136. size: 1
  137. }).then(res => {
  138. console.log(res);
  139. this.tabList
  140. this.tabList[0].number = res.count
  141. })
  142. getWorkOrderList({
  143. orderStatus: [2],
  144. type: 3,
  145. pageNum: 1,
  146. size: 1
  147. }).then(res => {
  148. this.tabList[1].number = res.count
  149. })
  150. },
  151. getCount() {
  152. statistics().then(data => {
  153. console.log('onsole.log(data)-----------')
  154. console.log(data)
  155. this.tabList = this.tabList.map(item => {
  156. switch (item.value) {
  157. case '0':
  158. return {
  159. ...item, badge: {
  160. value: data.maintenanceNum
  161. }
  162. }
  163. case '2':
  164. return {
  165. ...item, badge: {
  166. value: data.patrolInspection
  167. }
  168. }
  169. case '3':
  170. return {
  171. ...item, badge: {
  172. value: data.quantityNum
  173. }
  174. }
  175. case '4':
  176. return {
  177. ...item, badge: {
  178. value: data.repairsNum
  179. }
  180. }
  181. }
  182. })
  183. })
  184. },
  185. getFirstList: function() {
  186. this.page = 1
  187. this.isEnd = false
  188. this.getList()
  189. },
  190. getList() {
  191. if (this.isEnd) {
  192. this.$refs.uToast.show({
  193. message: "暂无更多数据",
  194. duration: 1000
  195. })
  196. return
  197. }
  198. uni.showLoading({
  199. title: '加载中'
  200. })
  201. let params = {
  202. orderStatus: [this.tabList[this.pickTabIndex].value],
  203. type: 3,
  204. pageNum: this.page,
  205. size: this.size,
  206. ...this.searchForm
  207. }
  208. if (!this.showTab) {
  209. delete params.orderStatus
  210. }
  211. getWorkOrderList(params)
  212. .then(res => {
  213. if (this.page === 1) {
  214. this.tabList[this.pickTabIndex].list = res.list
  215. } else {
  216. this.tabList[this.pickTabIndex].list.push(...res.list)
  217. }
  218. this.page += 1
  219. this.isEnd = this.tabList[this.pickTabIndex].list.length >= res.count;
  220. uni.hideLoading()
  221. })
  222. .catch(() => {
  223. uni.hideLoading()
  224. })
  225. },
  226. changeChartsTab(index) {
  227. this.pickTabIndex = index;
  228. this.page = 1;
  229. this.isEnd = false;
  230. if (index == 4) {
  231. this.getAList();
  232. } else {
  233. this.getFirstList();
  234. }
  235. },
  236. async getAList() {
  237. if (this.isEnd) {
  238. this.$refs.uToast.show({
  239. message: "暂无更多数据",
  240. duration: 1000
  241. })
  242. return
  243. }
  244. uni.showLoading({
  245. title: '加载中'
  246. })
  247. getAssistList({
  248. type: 3,
  249. pageNum: this.page,
  250. size: this.size,
  251. ...this.searchForm
  252. }).then(res => {
  253. // this.tabList[this.pickTabIndex].list = res.list
  254. // isEnd = this.tabList[this.pickTabIndex].list >= res.count
  255. if (this.page === 1) {
  256. this.tabList[this.pickTabIndex].list = res.list
  257. } else {
  258. this.tabList[this.pickTabIndex].list.push(...res.list)
  259. }
  260. this.page += 1
  261. this.isEnd = this.tabList[this.pickTabIndex].list.length >= res.count;
  262. uni.hideLoading()
  263. })
  264. .catch(() => {
  265. uni.hideLoading()
  266. })
  267. },
  268. async getRuleList() {
  269. let params = {
  270. status: 1,
  271. type: 1,
  272. pageNum: 1,
  273. size: -1
  274. }
  275. const res = await getRuleList(params)
  276. this.formItems.find(item => item.prop === 'ruleId').props.localdata = res
  277. },
  278. clearSearch() {
  279. this.searchForm.code = ''
  280. this.doSearch()
  281. },
  282. doSearch() {
  283. this.isEnd = false;
  284. this.page = 1;
  285. this.showTab = isObjectEmpty(this.searchForm)
  286. this.getList();
  287. },
  288. showSearch() {
  289. this.searchShow = true
  290. },
  291. confirmSearch(e) {
  292. console.log(e);
  293. let data = JSON.parse(JSON.stringify(e))
  294. this.searchForm = {
  295. ...this.searchForm,
  296. ...data
  297. }
  298. console.log(this.searchForm);
  299. this.doSearch()
  300. },
  301. }
  302. }
  303. </script>
  304. <style lang="scss" scoped>
  305. .top-wrapper {
  306. display: flex;
  307. align-items: center;
  308. background-color: #fff;
  309. position: relative;
  310. .tab_box {
  311. width: 100%;
  312. height: 68rpx;
  313. .tab_item {
  314. height: 68rpx;
  315. line-height: 68rpx;
  316. padding: 0 20rpx;
  317. font-size: 32rpx;
  318. // color: #979C9E;
  319. }
  320. .active {
  321. box-sizing: border-box;
  322. border-bottom: 6rpx solid $theme-color;
  323. color: $theme-color;
  324. }
  325. }
  326. }
  327. .badge-c {
  328. position: relative;
  329. }
  330. /deep/.u-badge {
  331. top: 0;
  332. right: 0;
  333. transform: translate(90%, 20%);
  334. }
  335. .search-box {
  336. background-color: #fff;
  337. display: flex;
  338. width: 750rpx;
  339. height: 88rpx;
  340. padding: 16rpx 32rpx;
  341. align-items: center;
  342. gap: 16rpx;
  343. justify-content: space-between;
  344. /deep/.uni-section {
  345. margin-top: 0px;
  346. }
  347. /deep/.uni-section-header {
  348. padding: 0px;
  349. }
  350. .search_btn {
  351. width: 120rpx;
  352. height: 70rpx;
  353. line-height: 70rpx;
  354. padding: 0 24rpx;
  355. background: $theme-color;
  356. font-size: 32rpx;
  357. color: #fff;
  358. margin: 0;
  359. margin-left: 26rpx;
  360. }
  361. .menu_icon {
  362. width: 44rpx;
  363. height: 44rpx;
  364. margin-left: 14rpx;
  365. }
  366. }
  367. // .tab-title {
  368. // position: fixed;
  369. // z-index: 99;
  370. // width: 100%;
  371. // padding: 10rpx;
  372. // // display: flex;
  373. // // justify-content: space-between;
  374. // height: $tab-height;
  375. // line-height: $tab-height;
  376. // background-color: #ffffff;
  377. // border-bottom: 1px solid #f2f2f2;
  378. // // box-sizing: border-box;
  379. // white-space: nowrap;
  380. // overflow: auto hidden;
  381. // display: flex;
  382. // &::-webkit-scrollbar {
  383. // /*滚动条整体样式*/
  384. // width: 10px;
  385. // /*高宽分别对应横竖滚动条的尺寸*/
  386. // height: 1px;
  387. // }
  388. // &::-webkit-scrollbar-thumb {
  389. // /*滚动条里面小方块*/
  390. // border-radius: 10px;
  391. // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  392. // background: #535353;
  393. // }
  394. // &::-webkit-scrollbar-track {
  395. // /*滚动条里面轨道*/
  396. // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  397. // border-radius: 10px;
  398. // background: #ededed;
  399. // }
  400. // .tab-item {
  401. // flex: 1;
  402. // text-align: center;
  403. // display: inline-block;
  404. // font-size: 32rpx;
  405. // color: $uni-text-color-grey;
  406. // }
  407. // .tab-item.active {
  408. // color: $j-primary-border-green;
  409. // border-bottom: 1px solid $j-primary-border-green;
  410. // }
  411. // .title-num {
  412. // font-size: 26rpx;
  413. // }
  414. // .title-red {
  415. // display: inline-block;
  416. // font-size: 22rpx;
  417. // padding: 0 10rpx;
  418. // border-radius: 50rpx;
  419. // color: #ffffff;
  420. // background: red;
  421. // line-height: 38rpx;
  422. // position: absolute;
  423. // top: 10rpx;
  424. // min-width: 18rpx;
  425. // }
  426. // }
  427. </style>