| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- <template>
- <view>
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="巡点检工单" @clickLeft="back"></uni-nav-bar>
- <!-- <template>
- <view class="tab-title">
- <view v-for="(item, index) in tabList" :key="index" class="tab-item" :class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)">
- {{ item.label }}
- <text v-if="item.number > 0" class="title-red">{{ item.number }}</text>
- </view>
- </view>
- <view class="tab-title__placeholder"></view>
- </template> -->
- <view class="top-wrapper">
- <view class="tab_box rx-sc">
- <view class="tab_item" v-for="(item,index) in tabList" :key="index"
- :class="{active: pickTabIndex == index}">
- <view @click="changeChartsTab(index)">
- {{item.label}}
- </view>
- </view>
- </view>
- </view>
- <OrderTask v-for="(item, index) in tabList" :key="index" v-show="index === pickTabIndex" :list="item.list"
- :type="tabList.value"></OrderTask>
- </view>
- </template>
- <script>
- import {
- getWorkOrderList
- } from '@/api/myTicket'
- import OrderTask from './OrderTask.vue'
- import {
- post,
- postJ
- } from '@/utils/api.js'
- let [page, size, isEnd] = [1, 10, false]
- export default {
- components: {
- OrderTask
- },
- data() {
- return {
- tabList: [{
- value: 0,
- label: '待接收',
- list: [],
- number: 0
- },
- {
- value: 2,
- label: '执行中',
- list: [],
- number: 0
- },
- {
- value: 3,
- label: '已完成',
- list: [],
- number: 0
- }
- ],
- pickTabIndex: 0,
- qrContent: null,
- barType: 0
- }
- },
- onShow() {
- this.getFirstList()
- this.getStatus()
- },
- onReachBottom: function() {
- if (isEnd) {
- return
- }
- // 显示加载图标
- uni.showLoading({
- title: '数据加载中'
- })
- this.getMoreLists()
- },
- methods: {
- getStatus() {
- getWorkOrderList({
- orderStatus: [0],
- type: 1,
- pageNum: 1,
- size: 1
- }).then(res => {
- console.log(res,'res ===')
- this.tabList[0].number = res.count
- })
- getWorkOrderList({
- orderStatus: [2],
- type: 1,
- pageNum: 1,
- size: 1
- }).then(res => {
- this.tabList[1].number = res.count
- })
- getWorkOrderList({
- orderStatus: [3],
- type: 1,
- pageNum: 1,
- size: 1
- }).then(res => {
- this.tabList[2].number = res.count
- })
- getWorkOrderList({
- orderStatus: [4],
- type: 1,
- pageNum: 1,
- size: 1
- }).then(res => {
- this.tabList[3].number = res.count
- })
- },
- getCount() {
- statistics().then(data => {
- console.log('onsole.log(data)-----------')
- console.log(data)
- this.tabList = this.tabList.map(item => {
- switch (item.value) {
- case '0':
- return {
- ...item, badge: {
- value: data.maintenanceNum
- }
- }
- case '2':
- return {
- ...item, badge: {
- value: data.patrolInspection
- }
- }
- case '3':
- return {
- ...item, badge: {
- value: data.quantityNum
- }
- }
- case '4':
- return {
- ...item, badge: {
- value: data.repairsNum
- }
- }
- }
- })
- })
- },
- getFirstList: function() {
- page = 1
- // isEnd = true
- isEnd = false
- this.getList()
- },
- getMoreLists: function() {
- //获取更多数据
- page++
- this.getList()
- },
- getList() {
- uni.showLoading({
- title: '数据加载中'
- })
- let params = {
- orderStatus: [this.tabList[this.pickTabIndex].value],
- type: 1,
- pageNum: page,
- size
- }
- getWorkOrderList(params)
- .then(res => {
- // this.tabList[this.pickTabIndex].list = res.list
- // isEnd = this.tabList[this.pickTabIndex].list >= res.count
- if(page == 1){
- this.tabList[this.pickTabIndex].list = res.list;
- }else{
- this.tabList[this.pickTabIndex].list.push(...res.list);
- }
- isEnd = this.tabList[this.pickTabIndex].list.length >= res.count;
- uni.hideLoading();
- })
- .catch(() => {
- uni.hideLoading();
- })
- },
- changeChartsTab(index) {
- this.pickTabIndex = index;
- this.getFirstList();
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .top-wrapper {
- display: flex;
- align-items: center;
- background-color: #fff;
- position: relative;
- .tab_box {
- width: 100%;
- height: 68rpx;
- .tab_item {
- height: 68rpx;
- line-height: 68rpx;
- padding: 0 20rpx;
- font-size: 32rpx;
- // color: #979C9E;
- }
- .active {
- box-sizing: border-box;
- border-bottom: 6rpx solid $theme-color;
- color: $theme-color;
- }
- }
- }
- .tab-title {
- position: fixed;
- z-index: 99;
- width: 100%;
- padding: 10rpx;
- // display: flex;
- // justify-content: space-between;
- height: $tab-height;
- line-height: $tab-height;
- background-color: #ffffff;
- border-bottom: 1px solid #f2f2f2;
- // box-sizing: border-box;
- white-space: nowrap;
- overflow: auto hidden;
- display: flex;
- &::-webkit-scrollbar {
- /*滚动条整体样式*/
- width: 10px;
- /*高宽分别对应横竖滚动条的尺寸*/
- height: 1px;
- }
- &::-webkit-scrollbar-thumb {
- /*滚动条里面小方块*/
- border-radius: 10px;
- -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
- background: #535353;
- }
- &::-webkit-scrollbar-track {
- /*滚动条里面轨道*/
- -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
- border-radius: 10px;
- background: #ededed;
- }
- .tab-item {
- flex: 1;
- text-align: center;
- display: inline-block;
- font-size: 32rpx;
- color: $uni-text-color-grey;
- }
- .tab-item.active {
- color: $j-primary-border-green;
- border-bottom: 1px solid $j-primary-border-green;
- }
- .title-num {
- font-size: 26rpx;
- }
- .title-red {
- display: inline-block;
- font-size: 22rpx;
- padding: 0 10rpx;
- border-radius: 50rpx;
- color: #ffffff;
- background: red;
- line-height: 38rpx;
- position: absolute;
- top: 10rpx;
- min-width: 18rpx;
- }
- }
- </style>
|