order.vue 9.5 KB

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