index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view style="width: 100%; height: 100vh; background: rgb(247, 248, 255)">
  3. <zj-page-container>
  4. <view class="toubuyangs">
  5. <view class="toubuyangsTab">
  6. <view class="toubuyangsTabItem" @click="tabQiehuan(0)">
  7. <view>已组队({{ tongjishuju.teamCount || 0 }})</view>
  8. <view :class="{ hengxian: true, xuanzhong: tab == 0 }"> </view>
  9. </view>
  10. <view class="toubuyangsTabItem" @click="tabQiehuan(1)">
  11. <view>待确认({{ tongjishuju.applyCount || 0 }})</view>
  12. <view :class="{ hengxian: true, xuanzhong: tab == 1 }"></view>
  13. </view>
  14. </view>
  15. </view>
  16. <zj-page-fill>
  17. <zj-page-layout
  18. :isScroll="true"
  19. :refresherTriggered="refresherTriggered"
  20. @refresherrefresh="refresherrefresh"
  21. @scrolltolower="scrolltolower"
  22. >
  23. <view class="neirongquyu">
  24. <view class="zhegeshineirong" v-for="(item, index) in dataList" :key="index">
  25. <view class="neirongbiaot">
  26. <text>小组1</text>
  27. <text v-if="true" style="color: blue">{{
  28. tab
  29. ? { WAIT: '待确认', OK: '通过', FAIL: '失败' }[item.status]
  30. : { ON: '启用', OFF: '禁用' }[item.status]
  31. }}</text>
  32. <text v-else style="color: red">待确认</text>
  33. </view>
  34. <view class="neironglieju">
  35. <text>网点名称:</text>
  36. <text>({{ item.websitId }}){{ item.websitName }}</text>
  37. </view>
  38. <view class="neironglieju">
  39. <text>大工名称:</text>
  40. <text>{{ item.masterWorkerName }}</text>
  41. </view>
  42. <view class="neironglieju">
  43. <text>小工名称:</text>
  44. <text>{{ item.assistantWorkerName }}</text>
  45. </view>
  46. <view class="neironglieju">
  47. <text>创建时间:</text>
  48. <text>{{ item.createTime }}</text>
  49. </view>
  50. <view class="neironghengxin" v-if="tab"></view>
  51. <view class="neironganniuqu" v-if="tab && ['WAIT'].includes(item.status)">
  52. <u-button type="primary" text="确认" @click="queding(item, index)"></u-button>
  53. </view>
  54. </view>
  55. <Loading :loadStatus="loadStatus" :dataList="dataList" />
  56. </view>
  57. </zj-page-layout>
  58. </zj-page-fill>
  59. <view class="quanjuanniu">
  60. <u-button type="primary" text="创建组别" @click="quchuangjian"></u-button>
  61. </view>
  62. </zj-page-container>
  63. </view>
  64. </template>
  65. <script>
  66. import zjPageContainer from '@/components/zj-page-container/zj-page-container.vue'
  67. import zjPageFill from '@/components/zj-page-container/zj-page-fill.vue'
  68. export default {
  69. components: {
  70. zjPageContainer,
  71. zjPageFill
  72. },
  73. data() {
  74. return {
  75. tab: 0,
  76. pageNum: 1,
  77. dataList: [],
  78. refresherTriggered: false,
  79. getBool: true,
  80. loadStatus: 0,
  81. tongjishuju: {}
  82. }
  83. },
  84. onLoad() {
  85. this.tabQiehuan(this.tab)
  86. uni.$on('shuaxianliebiao', this.aaaa)
  87. },
  88. onUnload() {
  89. uni.$off('shuaxianliebiao', this.aaaa)
  90. },
  91. methods: {
  92. aaaa() {
  93. this.tabQiehuan(this.tab, 2)
  94. },
  95. quchuangjian() {
  96. this.$navToPage({
  97. url: '/packageMine/pages/masterGroup/createGroup'
  98. })
  99. },
  100. tabQiehuan(index, tin = 1) {
  101. this.tab = index
  102. this.getBool = true
  103. this.pageNum = tin
  104. this.dataList = []
  105. this.getList()
  106. },
  107. queding(item, index) {
  108. this.$api
  109. .post('/worker/team/confirm', {
  110. id: item.id,
  111. status: 'OK'
  112. })
  113. .then(res => {
  114. this.dataList.splice(index, 1, {
  115. ...item,
  116. status: 'OK'
  117. })
  118. })
  119. },
  120. getList() {
  121. this.$api.post('/worker/team/count').then(res1 => {
  122. this.tongjishuju = res1.data
  123. })
  124. if (!this.getBool) {
  125. return
  126. }
  127. this.loadStatus = 1
  128. this.$api
  129. .post(this.tab ? '/worker/team/page' : '/worker/team/manage/page', {
  130. pageNum: this.pageNum,
  131. pageSize: 20
  132. })
  133. .then(res => {
  134. let list = res.data.records
  135. if (list.length < 20) {
  136. this.loadStatus = 2
  137. this.getBool = false
  138. } else {
  139. this.loadStatus = 0
  140. }
  141. this.dataList = this.dataList.concat(list)
  142. })
  143. .catch(() => {
  144. this.loadStatus = 2
  145. })
  146. .finally(res => {
  147. this.refresherTriggered = false
  148. })
  149. },
  150. // 滚动到底部
  151. scrolltolower(e) {
  152. if (this.loadStatus === 0) {
  153. this.pageNum++
  154. this.getList()
  155. }
  156. },
  157. // 触发下拉刷新
  158. async refresherrefresh(e) {
  159. this.refresherTriggered = true
  160. this.getBool = true
  161. this.pageNum = 1
  162. this.dataList = []
  163. this.getList()
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. .quanjuanniu {
  170. width: 100%;
  171. height: auto;
  172. padding: 30rpx;
  173. box-sizing: border-box;
  174. }
  175. .neirongquyu {
  176. width: 100%;
  177. height: auto;
  178. padding: 30rpx 30rpx 15rpx 30rpx;
  179. box-sizing: border-box;
  180. .zhegeshineirong {
  181. width: 100%;
  182. height: auto;
  183. padding: 30rpx;
  184. box-sizing: border-box;
  185. background: #fff;
  186. border-radius: 20rpx;
  187. margin-bottom: 30rpx;
  188. .neirongbiaot {
  189. width: 100%;
  190. height: auto;
  191. display: flex;
  192. align-items: center;
  193. justify-content: space-between;
  194. box-sizing: border-box;
  195. margin-bottom: 40rpx;
  196. text {
  197. font-size: 32rpx;
  198. font-weight: 700;
  199. }
  200. }
  201. .neironglieju {
  202. width: 100%;
  203. height: auto;
  204. display: flex;
  205. align-items: center;
  206. justify-content: flex-start;
  207. box-sizing: border-box;
  208. margin-bottom: 30rpx;
  209. text {
  210. font-size: 28rpx;
  211. }
  212. }
  213. .neironghengxin {
  214. width: 100%;
  215. border-bottom: 1rpx solid #aaa;
  216. margin-bottom: 30rpx;
  217. }
  218. .neironganniuqu {
  219. widows: 100%;
  220. text-align: right;
  221. }
  222. }
  223. }
  224. .toubuyangs {
  225. width: 100%;
  226. height: auto;
  227. box-sizing: border-box;
  228. padding: 30rpx 30rpx 15rpx 30rpx;
  229. .toubuyangsTab {
  230. width: 100%;
  231. height: auto;
  232. padding: 30rpx;
  233. box-sizing: border-box;
  234. background: #fff;
  235. border-radius: 20rpx;
  236. display: flex;
  237. align-items: center;
  238. justify-content: space-around;
  239. .toubuyangsTabItem {
  240. box-sizing: border-box;
  241. font-size: 32rpx;
  242. display: flex;
  243. align-items: center;
  244. justify-content: center;
  245. flex-direction: column;
  246. .hengxian {
  247. margin-top: 20rpx;
  248. width: 100rpx;
  249. }
  250. .xuanzhong {
  251. border-bottom: 4rpx solid #000;
  252. }
  253. }
  254. }
  255. }
  256. </style>