order.vue 8.2 KB

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