order.vue 8.5 KB

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