order.vue 8.7 KB

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