order.vue 8.8 KB

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