order.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  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. })
  182. let params = {
  183. orderStatus: [this.tabList[this.pickTabIndex].value],
  184. type: 2,
  185. pageNum: this.page,
  186. size: this.size,
  187. ...this.searchForm
  188. }
  189. if (!this.showTab) {
  190. delete params.orderStatus
  191. }
  192. getWorkOrderList(params)
  193. .then(res => {
  194. if (this.page == 1) {
  195. this.tabList[this.pickTabIndex].list = res.list
  196. } else {
  197. this.tabList[this.pickTabIndex].list.push(...res.list);
  198. }
  199. this.page += 1
  200. this.isEnd = this.tabList[this.pickTabIndex].list.length >= res.count
  201. uni.hideLoading()
  202. })
  203. .catch(() => {
  204. uni.hideLoading()
  205. })
  206. },
  207. changeChartsTab(index) {
  208. this.pickTabIndex = index
  209. this.getFirstList()
  210. },
  211. async getRuleList() {
  212. let params = {
  213. status: 1,
  214. type: 1,
  215. pageNum: 1,
  216. size: -1
  217. }
  218. const res = await getRuleList(params)
  219. this.formItems.find(item => item.prop === 'ruleId').props.localdata = res
  220. },
  221. clearSearch() {
  222. this.searchForm.code = ''
  223. this.doSearch()
  224. },
  225. doSearch() {
  226. this.isEnd = false;
  227. this.page = 1;
  228. this.showTab = isObjectEmpty(this.searchForm)
  229. this.getList();
  230. },
  231. showSearch() {
  232. this.searchShow = true
  233. },
  234. confirmSearch(e) {
  235. console.log(e);
  236. let data = JSON.parse(JSON.stringify(e))
  237. this.searchForm = {
  238. ...this.searchForm,
  239. ...data
  240. }
  241. console.log(this.searchForm);
  242. this.doSearch()
  243. },
  244. }
  245. }
  246. </script>
  247. <style lang="scss" scoped>
  248. .top-wrapper {
  249. display: flex;
  250. align-items: center;
  251. background-color: #fff;
  252. position: relative;
  253. .tab_box {
  254. width: 100%;
  255. height: 68rpx;
  256. .tab_item {
  257. height: 68rpx;
  258. line-height: 68rpx;
  259. padding: 0 20rpx;
  260. font-size: 32rpx;
  261. // color: #979C9E;
  262. }
  263. .active {
  264. box-sizing: border-box;
  265. border-bottom: 6rpx solid $theme-color;
  266. color: $theme-color;
  267. }
  268. }
  269. }
  270. .badge-c {
  271. position: relative;
  272. }
  273. /deep/.u-badge {
  274. top: 0;
  275. right: 0;
  276. transform: translate(90%, 20%);
  277. }
  278. // .tab-title {
  279. // position: fixed;
  280. // z-index: 99;
  281. // width: 100%;
  282. // padding: 10rpx;
  283. // // display: flex;
  284. // // justify-content: space-between;
  285. // height: $tab-height;
  286. // line-height: $tab-height;
  287. // background-color: #ffffff;
  288. // border-bottom: 1px solid #f2f2f2;
  289. // // box-sizing: border-box;
  290. // white-space: nowrap;
  291. // overflow: auto hidden;
  292. // display: flex;
  293. // &::-webkit-scrollbar {
  294. // /*滚动条整体样式*/
  295. // width: 10px;
  296. // /*高宽分别对应横竖滚动条的尺寸*/
  297. // height: 1px;
  298. // }
  299. // &::-webkit-scrollbar-thumb {
  300. // /*滚动条里面小方块*/
  301. // border-radius: 10px;
  302. // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  303. // background: #535353;
  304. // }
  305. // &::-webkit-scrollbar-track {
  306. // /*滚动条里面轨道*/
  307. // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  308. // border-radius: 10px;
  309. // background: #ededed;
  310. // }
  311. // .tab-item {
  312. // flex: 1;
  313. // text-align: center;
  314. // display: inline-block;
  315. // font-size: 32rpx;
  316. // color: $uni-text-color-grey;
  317. // }
  318. // .tab-item.active {
  319. // color: $j-primary-border-green;
  320. // border-bottom: 1px solid $j-primary-border-green;
  321. // }
  322. // .title-num {
  323. // font-size: 26rpx;
  324. // }
  325. // }
  326. // .title-red {
  327. // display: inline-block;
  328. // font-size: 22rpx;
  329. // padding: 0 10rpx;
  330. // border-radius: 50rpx;
  331. // color: #ffffff;
  332. // background: red;
  333. // line-height: 38rpx;
  334. // position: absolute;
  335. // top: 10rpx;
  336. // min-width: 18rpx;
  337. // }
  338. .search-box {
  339. background-color: #fff;
  340. display: flex;
  341. width: 750rpx;
  342. height: 88rpx;
  343. padding: 16rpx 32rpx;
  344. align-items: center;
  345. gap: 16rpx;
  346. justify-content: space-between;
  347. /deep/.uni-section {
  348. margin-top: 0px;
  349. }
  350. /deep/.uni-section-header {
  351. padding: 0px;
  352. }
  353. .search_btn {
  354. width: 120rpx;
  355. height: 70rpx;
  356. line-height: 70rpx;
  357. padding: 0 24rpx;
  358. background: $theme-color;
  359. font-size: 32rpx;
  360. color: #fff;
  361. margin: 0;
  362. margin-left: 26rpx;
  363. }
  364. .menu_icon {
  365. width: 44rpx;
  366. height: 44rpx;
  367. margin-left: 14rpx;
  368. }
  369. }
  370. </style>