order.vue 7.9 KB

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