check.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <view class="container">
  3. <!-- 筛选区域 -->
  4. <picker @change="bindPickerChange" :value="currentIndex" :range="array" range-key="text">
  5. <view class="search">
  6. <view>
  7. {{ array[currentIndex].text }}
  8. </view>
  9. </view>
  10. </picker>
  11. <!-- 选择年级区域 -->
  12. <view class="grade">
  13. <uni-data-picker
  14. placeholder="请选择班级"
  15. popup-title="请选择班级"
  16. :map="{ text: 'name', value: 'classId' }"
  17. :clear-icon="false"
  18. :localdata="dataTree_student"
  19. v-model="classes_student"
  20. @nodeclick="onchange_student"
  21. ></uni-data-picker>
  22. </view>
  23. <!-- 列表区域 -->
  24. <view class="list">
  25. <!-- 每一个资料区域 -->
  26. <view class="list_item" v-for="item in dataList" :key="item.id">
  27. <!-- 标题区域 -->
  28. <view class="item_title">
  29. <view class="title_text">入学登记</view>
  30. {{ item.createTime }}
  31. </view>
  32. <!-- 信息区域 -->
  33. <view class="item_body">
  34. <view class="type check" v-if="item.status == 0">待审批</view>
  35. <view class="type pass" v-if="item.status == 1">已通过</view>
  36. <view class="type reject" v-if="item.status == 2">已拒绝</view>
  37. <view class="box">孩子姓名:{{ item.name }}</view>
  38. <view class="box">性别:{{ item.sexId == 1 ? '男' : '女' }}</view>
  39. <view class="box">
  40. 照片:
  41. <image
  42. v-if="!item.headImage"
  43. class="box_img"
  44. src="https://wanzai-1306339220.cos.ap-shanghai.myqcloud.com/excelModel/nupp7VVnHWpVa413437dba82ce85374b2a4ee1a6b973.png"
  45. mode="aspectFill"
  46. ></image>
  47. <image v-else class="box_img" :src="item.headImage" mode="aspectFill" @click="clickImg(item.headImage)"></image>
  48. </view>
  49. <view class="box">年级:{{ item.gradeName }}</view>
  50. <view class="box">班级:{{ item.schoolClassName }}</view>
  51. <!-- 家属数组区域 -->
  52. <view v-for="(ele, index) in item.list" :key="index">
  53. <view class="box">家属{{ index + 1 }}:{{ ele.name }}</view>
  54. <view class="box">手机号码:{{ ele.phone }}</view>
  55. <view class="box">家属与本人的关系:{{ ele.ship }}</view>
  56. </view>
  57. <view class="btns" v-if="item.status == 0">
  58. <view class="btn reject" @click="clickBtn(item.id, 2)">拒绝</view>
  59. <view class="btn agree" @click="clickBtn(item.id, 1)">同意</view>
  60. </view>
  61. </view>
  62. </view>
  63. <NoData v-if="!dataList.length" />
  64. </view>
  65. </view>
  66. </template>
  67. <script setup>
  68. import { onLoad, onReachBottom } from '@dcloudio/uni-app'
  69. import { ref } from 'vue'
  70. import { myRequest } from '@/utils/api.js'
  71. import { decryptDes } from '@/utils/des.js'
  72. import NoData from '@/components/noData.vue'
  73. // 当前激活索引
  74. const currentIndex = ref(0)
  75. // 状态数组
  76. const array = ref([
  77. {
  78. text: '全部',
  79. value: ''
  80. },
  81. {
  82. text: '待审批',
  83. value: 0
  84. },
  85. {
  86. text: '已通过',
  87. value: 1
  88. },
  89. {
  90. text: '已拒绝',
  91. value: 2
  92. }
  93. ])
  94. // 当前页
  95. const currentPage = ref(1)
  96. // 总条数
  97. const total = ref(0)
  98. // 资料审批数组
  99. const dataList = ref([])
  100. // 班级数组
  101. const dataTree_student = ref([])
  102. // 选择的班级
  103. const classes_student = ref()
  104. // 选择的年级
  105. const grade_student = ref()
  106. onLoad(() => {
  107. const id = uni.getStorageSync('userInfo').id
  108. getManageClass(id)
  109. })
  110. // 页面下拉刷新回调
  111. onReachBottom(() => {
  112. if (total.value > dataList.value.length) {
  113. currentPage.value++
  114. getData()
  115. } else {
  116. uni.showToast({
  117. title: '没有更多数据了~',
  118. icon: 'none'
  119. })
  120. }
  121. })
  122. // 获取管理的班级数组
  123. const getManageClass = async (id) => {
  124. const res = await myRequest({
  125. url: '/wanzai/api/smartUser/getManageClass',
  126. data: {
  127. id
  128. }
  129. })
  130. // console.log(res)
  131. const result = JSON.parse(decryptDes(res.data))
  132. // console.log(result)
  133. dataTree_student.value = result
  134. classes_student.value = result[0].classId
  135. grade_student.value = result[0].gradeId
  136. getData()
  137. }
  138. // 获取资料审批数组
  139. const getData = async () => {
  140. const res = await myRequest({
  141. url: '/wanzai/api/smartEnrollmentUser/list',
  142. data: {
  143. currentPage: currentPage.value,
  144. pageCount: 4,
  145. status: array.value[currentIndex.value].value,
  146. grade: grade_student.value,
  147. schoolClass: classes_student.value
  148. }
  149. })
  150. // console.log(res)
  151. const result = JSON.parse(decryptDes(res.data))
  152. console.log(result)
  153. dataList.value = [...dataList.value, ...result.list]
  154. total.value = result.totalCount
  155. }
  156. // 切换状态时的回调
  157. const bindPickerChange = (e) => {
  158. // console.log(e.detail.value)
  159. if (e.detail.value != currentIndex.value) {
  160. currentIndex.value = e.detail.value
  161. currentPage.value = 1
  162. dataList.value = []
  163. getData()
  164. }
  165. }
  166. // 学生部门筛选框选择时的回调
  167. const onchange_student = (e) => {
  168. // console.log(e)
  169. classes_student.value = e.classId
  170. grade_student.value = e.gradeId
  171. currentPage.value = 1
  172. dataList.value = []
  173. getData()
  174. }
  175. // 点击同意拒绝按钮回调
  176. const clickBtn = (id, type) => {
  177. uni.showModal({
  178. title: '提示',
  179. content: `确定${type == 1 ? '同意' : '拒绝'}该审批吗?`,
  180. success: (res) => {
  181. if (res.confirm) {
  182. clickBtnReq(id, type)
  183. }
  184. }
  185. })
  186. }
  187. // 审批请求
  188. const clickBtnReq = async (id, type) => {
  189. const res = await myRequest({
  190. url: '/wanzai/api/smartEnrollmentUser/examine',
  191. method: 'post',
  192. data: {
  193. id: id,
  194. status: type
  195. }
  196. })
  197. // console.log(res)
  198. if (res.code == 200) {
  199. uni.showToast({
  200. title: res.message,
  201. icon: 'success'
  202. })
  203. setTimeout(() => {
  204. currentPage.value = 1
  205. dataList.value = []
  206. getData()
  207. }, 1500)
  208. }
  209. }
  210. // 点击图片回调
  211. const clickImg = (url) => {
  212. uni.previewImage({
  213. urls: [url],
  214. current: 1
  215. })
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. .container {
  220. box-sizing: border-box;
  221. padding: 30rpx 20rpx;
  222. height: 100vh;
  223. background: linear-gradient(180deg, #f2f7ff 0%, #f2f7ff 100%);
  224. .search {
  225. display: flex;
  226. align-items: center;
  227. justify-content: space-between;
  228. box-sizing: border-box;
  229. padding: 0 30rpx;
  230. width: 284rpx;
  231. height: 80rpx;
  232. font-size: 28rpx;
  233. border-radius: 55rpx;
  234. background-color: #fff;
  235. }
  236. .grade {
  237. margin-top: 20rpx;
  238. height: 70rpx;
  239. }
  240. .list {
  241. margin-top: 30rpx;
  242. .list_item {
  243. margin-bottom: 30rpx;
  244. border-radius: 8rpx;
  245. background-color: #fff;
  246. .item_title {
  247. display: flex;
  248. align-items: center;
  249. justify-content: space-between;
  250. padding: 0 30rpx;
  251. height: 90rpx;
  252. color: #808080;
  253. font-size: 24rpx;
  254. border-bottom: 2rpx solid #e6e6e6;
  255. .title_text {
  256. font-size: 28rpx;
  257. font-weight: bold;
  258. color: #000;
  259. }
  260. }
  261. .item_body {
  262. position: relative;
  263. padding: 25rpx 30rpx;
  264. .type {
  265. position: absolute;
  266. top: 16rpx;
  267. right: 30rpx;
  268. font-size: 28rpx;
  269. }
  270. .check {
  271. color: #ff8d1a;
  272. }
  273. .pass {
  274. color: #0061ff;
  275. }
  276. .reject {
  277. color: #d43030;
  278. }
  279. .box {
  280. display: flex;
  281. margin-bottom: 20rpx;
  282. font-size: 28rpx;
  283. color: #383838;
  284. .box_img {
  285. width: 116rpx;
  286. height: 155rpx;
  287. border-radius: 4rpx;
  288. }
  289. }
  290. .btns {
  291. display: flex;
  292. align-items: center;
  293. justify-content: flex-end;
  294. .btn {
  295. display: flex;
  296. justify-content: center;
  297. align-items: center;
  298. margin-left: 28rpx;
  299. width: 146rpx;
  300. height: 80rpx;
  301. font-size: 28rpx;
  302. color: #fff;
  303. border-radius: 10rpx;
  304. }
  305. .reject {
  306. background-color: #d43030;
  307. }
  308. .agree {
  309. background-color: #0061ff;
  310. }
  311. }
  312. }
  313. }
  314. }
  315. }
  316. </style>