order.vue 8.1 KB

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