order.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view>
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="维修工单" @clickLeft="back"></uni-nav-bar>
  4. <!-- <template>
  5. <view class="tab-title">
  6. <view v-for="(item, index) in tabList" :key="index" class="tab-item" :class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)">
  7. {{ item.label }}
  8. <text v-if="item.number > 0" class="title-red">{{ item.number }}</text>
  9. </view>
  10. </view>
  11. <view class="tab-title__placeholder"></view>
  12. </template> -->
  13. <view class="top-wrapper">
  14. <view class="tab_box rx-sc">
  15. <view class="tab_item" v-for="(item,index) in tabList" :key="index"
  16. :class="{active: pickTabIndex == index}">
  17. <view @click="changeChartsTab(index)">
  18. {{item.label}}
  19. <!-- <text v-if="item.number > 0" class="title-red">{{ item.number }}</text> -->
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <OrderTask v-for="(item, index) in tabList" :key="index" v-show="index === pickTabIndex" :list="item.list"
  25. :type="tabList.value" :ParentIndex="pickTabIndex"></OrderTask>
  26. </view>
  27. </template>
  28. <script>
  29. import {
  30. getWorkOrderList,
  31. getAssistList
  32. } from '@/api/myTicket'
  33. import OrderTask from './OrderTask.vue'
  34. import {
  35. post,
  36. postJ
  37. } from '@/utils/api.js'
  38. let [page, size, isEnd] = [1, 10, true]
  39. export default {
  40. components: {
  41. OrderTask
  42. },
  43. data() {
  44. return {
  45. tabList: [{
  46. value: 0,
  47. label: '待接收',
  48. list: [],
  49. number: 0
  50. },
  51. {
  52. value: 2,
  53. label: '执行中',
  54. list: [],
  55. number: 0
  56. },
  57. {
  58. value: 3,
  59. label: '待验收',
  60. list: [],
  61. number: 0
  62. },
  63. {
  64. value: 4,
  65. label: '已验收',
  66. list: [],
  67. number: 0
  68. },
  69. {
  70. value: 5,
  71. label: '协助工单',
  72. list: [],
  73. number: 0
  74. }
  75. ],
  76. pickTabIndex: 0,
  77. qrContent: null,
  78. barType: 0
  79. }
  80. },
  81. onShow() {
  82. this.getFirstList()
  83. this.getStatus()
  84. },
  85. onReachBottom: function() {
  86. if (isEnd) {
  87. return
  88. }
  89. // 显示加载图标
  90. uni.showLoading({
  91. title: '数据加载中'
  92. })
  93. this.getMoreLists()
  94. },
  95. methods: {
  96. getStatus() {
  97. getWorkOrderList({
  98. orderStatus: [0],
  99. type: 3,
  100. pageNum: 1,
  101. size: 1
  102. }).then(res => {
  103. this.tabList[0].number = res.count
  104. })
  105. getWorkOrderList({
  106. orderStatus: [2],
  107. type: 3,
  108. pageNum: 1,
  109. size: 1
  110. }).then(res => {
  111. this.tabList[1].number = res.count
  112. })
  113. getWorkOrderList({
  114. orderStatus: [3],
  115. type: 3,
  116. pageNum: 1,
  117. size: 1
  118. }).then(res => {
  119. this.tabList[2].number = res.count
  120. })
  121. getWorkOrderList({
  122. orderStatus: [4],
  123. type: 3,
  124. pageNum: 1,
  125. size: 1
  126. }).then(res => {
  127. this.tabList[3].number = res.count
  128. })
  129. // /eam/PdaWorkOrder/assistList
  130. },
  131. getCount() {
  132. statistics().then(data => {
  133. console.log('onsole.log(data)-----------')
  134. console.log(data)
  135. this.tabList = this.tabList.map(item => {
  136. switch (item.value) {
  137. case '0':
  138. return {
  139. ...item, badge: {
  140. value: data.maintenanceNum
  141. }
  142. }
  143. case '2':
  144. return {
  145. ...item, badge: {
  146. value: data.patrolInspection
  147. }
  148. }
  149. case '3':
  150. return {
  151. ...item, badge: {
  152. value: data.quantityNum
  153. }
  154. }
  155. case '4':
  156. return {
  157. ...item, badge: {
  158. value: data.repairsNum
  159. }
  160. }
  161. }
  162. })
  163. })
  164. },
  165. getFirstList: function() {
  166. page = 1
  167. isEnd = true
  168. this.getList()
  169. },
  170. getMoreLists: function() {
  171. //获取更多数据
  172. page++
  173. this.getList()
  174. },
  175. getList() {
  176. uni.showLoading({
  177. title: '数据加载中'
  178. })
  179. let params = {
  180. orderStatus: [this.tabList[this.pickTabIndex].value],
  181. type: 3,
  182. pageNum: page,
  183. size
  184. }
  185. getWorkOrderList(params)
  186. .then(res => {
  187. this.tabList[this.pickTabIndex].list = res.list
  188. isEnd = this.tabList[this.pickTabIndex].list >= res.count
  189. uni.hideLoading()
  190. })
  191. .catch(() => {
  192. uni.hideLoading()
  193. })
  194. },
  195. changeChartsTab(index) {
  196. this.pickTabIndex = index
  197. if (index == 4) {
  198. this.getAList()
  199. } else {
  200. this.getFirstList()
  201. }
  202. },
  203. async getAList() {
  204. uni.showLoading({
  205. title: '数据加载中'
  206. })
  207. getAssistList({
  208. type: 3,
  209. pageNum: page,
  210. size
  211. }).then(res => {
  212. this.tabList[this.pickTabIndex].list = res.list
  213. isEnd = this.tabList[this.pickTabIndex].list >= res.count
  214. uni.hideLoading()
  215. })
  216. .catch(() => {
  217. uni.hideLoading()
  218. })
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss" scoped>
  224. .top-wrapper {
  225. display: flex;
  226. align-items: center;
  227. background-color: #fff;
  228. position: relative;
  229. .tab_box {
  230. width: 100%;
  231. height: 68rpx;
  232. .tab_item {
  233. height: 68rpx;
  234. line-height: 68rpx;
  235. padding: 0 20rpx;
  236. font-size: 32rpx;
  237. // color: #979C9E;
  238. }
  239. .active {
  240. box-sizing: border-box;
  241. border-bottom: 6rpx solid $theme-color;
  242. color: $theme-color;
  243. }
  244. }
  245. }
  246. // .tab-title {
  247. // position: fixed;
  248. // z-index: 99;
  249. // width: 100%;
  250. // padding: 10rpx;
  251. // // display: flex;
  252. // // justify-content: space-between;
  253. // height: $tab-height;
  254. // line-height: $tab-height;
  255. // background-color: #ffffff;
  256. // border-bottom: 1px solid #f2f2f2;
  257. // // box-sizing: border-box;
  258. // white-space: nowrap;
  259. // overflow: auto hidden;
  260. // display: flex;
  261. // &::-webkit-scrollbar {
  262. // /*滚动条整体样式*/
  263. // width: 10px;
  264. // /*高宽分别对应横竖滚动条的尺寸*/
  265. // height: 1px;
  266. // }
  267. // &::-webkit-scrollbar-thumb {
  268. // /*滚动条里面小方块*/
  269. // border-radius: 10px;
  270. // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  271. // background: #535353;
  272. // }
  273. // &::-webkit-scrollbar-track {
  274. // /*滚动条里面轨道*/
  275. // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  276. // border-radius: 10px;
  277. // background: #ededed;
  278. // }
  279. // .tab-item {
  280. // flex: 1;
  281. // text-align: center;
  282. // display: inline-block;
  283. // font-size: 32rpx;
  284. // color: $uni-text-color-grey;
  285. // }
  286. // .tab-item.active {
  287. // color: $j-primary-border-green;
  288. // border-bottom: 1px solid $j-primary-border-green;
  289. // }
  290. // .title-num {
  291. // font-size: 26rpx;
  292. // }
  293. // .title-red {
  294. // display: inline-block;
  295. // font-size: 22rpx;
  296. // padding: 0 10rpx;
  297. // border-radius: 50rpx;
  298. // color: #ffffff;
  299. // background: red;
  300. // line-height: 38rpx;
  301. // position: absolute;
  302. // top: 10rpx;
  303. // min-width: 18rpx;
  304. // }
  305. // }
  306. </style>