index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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
  52. class="neironganniuqu"
  53. v-if="tab && ['WAIT'].includes(item.status) && item.masterWorkerId !== userInfo.workerNumber"
  54. >
  55. <u-button type="primary" text="确认" @click="queding(item, index)"></u-button>
  56. </view>
  57. </view>
  58. <Loading :loadStatus="loadStatus" :dataList="dataList" />
  59. </view>
  60. </zj-page-layout>
  61. </zj-page-fill>
  62. <view class="quanjuanniu">
  63. <u-button type="primary" text="创建组别" @click="quchuangjian"></u-button>
  64. </view>
  65. </zj-page-container>
  66. </view>
  67. </template>
  68. <script>
  69. import zjPageContainer from '@/components/zj-page-container/zj-page-container.vue'
  70. import zjPageFill from '@/components/zj-page-container/zj-page-fill.vue'
  71. import { getStorage } from '@/common/utils/storage.js'
  72. export default {
  73. components: {
  74. zjPageContainer,
  75. zjPageFill
  76. },
  77. data() {
  78. return {
  79. tab: 0,
  80. pageNum: 1,
  81. dataList: [],
  82. refresherTriggered: false,
  83. getBool: true,
  84. loadStatus: 0,
  85. tongjishuju: {}
  86. }
  87. },
  88. onLoad() {
  89. this.tabQiehuan(this.tab)
  90. uni.$on('shuaxianliebiao', this.aaaa)
  91. },
  92. onUnload() {
  93. uni.$off('shuaxianliebiao', this.aaaa)
  94. },
  95. computed: {
  96. userInfo() {
  97. return getStorage('user')
  98. }
  99. },
  100. methods: {
  101. aaaa() {
  102. this.tabQiehuan(this.tab, 2)
  103. },
  104. quchuangjian() {
  105. this.$navToPage({
  106. url: '/packageMine/pages/masterGroup/createGroup'
  107. })
  108. },
  109. tabQiehuan(index, tin = 1) {
  110. this.tab = index
  111. this.getBool = true
  112. this.pageNum = tin
  113. this.dataList = []
  114. this.getList()
  115. },
  116. queding(item, index) {
  117. this.$api
  118. .post('/worker/team/confirm', {
  119. id: item.id,
  120. status: 'OK'
  121. })
  122. .then(res => {
  123. this.dataList.splice(index, 1, {
  124. ...item,
  125. status: 'OK'
  126. })
  127. })
  128. },
  129. getList() {
  130. this.$api.post('/worker/team/count').then(res1 => {
  131. this.tongjishuju = res1.data
  132. })
  133. if (!this.getBool) {
  134. return
  135. }
  136. this.loadStatus = 1
  137. this.$api
  138. .post(this.tab ? '/worker/team/page' : '/worker/team/manage/page', {
  139. pageNum: this.pageNum,
  140. pageSize: 20
  141. })
  142. .then(res => {
  143. let list = res.data.records
  144. if (list.length < 20) {
  145. this.loadStatus = 2
  146. this.getBool = false
  147. } else {
  148. this.loadStatus = 0
  149. }
  150. this.dataList = this.dataList.concat(list)
  151. })
  152. .catch(() => {
  153. this.loadStatus = 2
  154. })
  155. .finally(res => {
  156. this.refresherTriggered = false
  157. })
  158. },
  159. // 滚动到底部
  160. scrolltolower(e) {
  161. if (this.loadStatus === 0) {
  162. this.pageNum++
  163. this.getList()
  164. }
  165. },
  166. // 触发下拉刷新
  167. async refresherrefresh(e) {
  168. this.refresherTriggered = true
  169. this.getBool = true
  170. this.pageNum = 1
  171. this.dataList = []
  172. this.getList()
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .quanjuanniu {
  179. width: 100%;
  180. height: auto;
  181. padding: 30rpx;
  182. box-sizing: border-box;
  183. }
  184. .neirongquyu {
  185. width: 100%;
  186. height: auto;
  187. padding: 30rpx 30rpx 15rpx 30rpx;
  188. box-sizing: border-box;
  189. .zhegeshineirong {
  190. width: 100%;
  191. height: auto;
  192. padding: 30rpx;
  193. box-sizing: border-box;
  194. background: #fff;
  195. border-radius: 20rpx;
  196. margin-bottom: 30rpx;
  197. .neirongbiaot {
  198. width: 100%;
  199. height: auto;
  200. display: flex;
  201. align-items: center;
  202. justify-content: space-between;
  203. box-sizing: border-box;
  204. margin-bottom: 40rpx;
  205. text {
  206. font-size: 32rpx;
  207. font-weight: 700;
  208. }
  209. }
  210. .neironglieju {
  211. width: 100%;
  212. height: auto;
  213. display: flex;
  214. align-items: center;
  215. justify-content: flex-start;
  216. box-sizing: border-box;
  217. margin-bottom: 30rpx;
  218. text {
  219. font-size: 28rpx;
  220. }
  221. }
  222. .neironghengxin {
  223. width: 100%;
  224. border-bottom: 1rpx solid #aaa;
  225. margin-bottom: 30rpx;
  226. }
  227. .neironganniuqu {
  228. widows: 100%;
  229. text-align: right;
  230. }
  231. }
  232. }
  233. .toubuyangs {
  234. width: 100%;
  235. height: auto;
  236. box-sizing: border-box;
  237. padding: 30rpx 30rpx 15rpx 30rpx;
  238. .toubuyangsTab {
  239. width: 100%;
  240. height: auto;
  241. padding: 30rpx;
  242. box-sizing: border-box;
  243. background: #fff;
  244. border-radius: 20rpx;
  245. display: flex;
  246. align-items: center;
  247. justify-content: space-around;
  248. .toubuyangsTabItem {
  249. box-sizing: border-box;
  250. font-size: 32rpx;
  251. display: flex;
  252. align-items: center;
  253. justify-content: center;
  254. flex-direction: column;
  255. .hengxian {
  256. margin-top: 20rpx;
  257. width: 100rpx;
  258. }
  259. .xuanzhong {
  260. border-bottom: 4rpx solid #000;
  261. }
  262. }
  263. }
  264. }
  265. </style>