order.vue 9.7 KB

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