teacher.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="filebox">
  3. <!-- 老师有 -->
  4. <view class="stutop">
  5. <view class="search flexc">
  6. <image :src="searchimg" class="img"></image>
  7. <input placeholder="输入教职工姓名进行搜索" v-model="name" class="flex1 input"/>
  8. <view class="btn" @click="getSearch">搜索</view>
  9. </view>
  10. <view class="stutoa flexcj mt12" v-if="choseroles=='school'">
  11. <!-- <view class="flex1">
  12. <picker :value="className" range-key="className" :range="classlist" @change="bindDateChange" >
  13. <view class="flexc">
  14. <view class=" f15 co16 f500" >{{className||'请选择班级'}}</view>
  15. <image :src="upimg"></image>
  16. </view>
  17. </picker>
  18. </view> -->
  19. <view class="stutoar flex0">
  20. 本校教职工共有<text>{{total}}</text>名
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 列表 -->
  25. <view class="flex1 workbox">
  26. <view class="workboxr">
  27. <scroll-view scroll-y class="scroll-view" lower-threshold="40" @scrolltolower="reach_btn">
  28. <da-list :datalist="list" :wtdt="wtdt" datype="2" @getDetail="getDetail"></da-list>
  29. <view style="height: 100rpx;"></view>
  30. </scroll-view>
  31. </view>
  32. </view>
  33. <view class="addbtn" @click="getAdd" v-if="checkPermi(['teacher:info:add'])">添加教职工档案</view>
  34. </view>
  35. </template>
  36. <script>
  37. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  38. import daList from "@/mine/components/list/list.vue"
  39. import {getteaListFn} from "@/api/mine/files.js"
  40. export default {
  41. data(){
  42. return{
  43. enter:require("@/mine/static/score/enter.png"),
  44. searchimg: require("@/mine/static/score/search.png"),
  45. upimg:require("@/mine/static/score/up.png"),
  46. classlist:[],
  47. list:[],
  48. pageSize: 10,
  49. pageNum: 1,
  50. reachflag:true,
  51. wtdt:'',
  52. total:0,
  53. className:'',
  54. name:'',
  55. choseroles:''
  56. }
  57. },
  58. components:{
  59. daList
  60. },
  61. onUnload(){
  62. uni.$off('refreshdalist')
  63. },
  64. onLoad: function() {
  65. uni.$on('refreshdalist',(e) => {
  66. this.reachflag=true;
  67. this.pageNum=1;
  68. this.list=[];
  69. this.getDataFn();
  70. })
  71. this.choseroles=this.$store.state.user.choseroles
  72. this.getDataFn();
  73. },
  74. methods:{
  75. checkPermi,checkRole,
  76. reach_btn() {
  77. if (this.reachflag) {
  78. this.pageNum++
  79. this.getDataFn()
  80. }
  81. },
  82. getAdd(){
  83. this.$tab.navigateTo('/mine/pages/files/addteacher?type=add')
  84. },
  85. init(){
  86. // 职称
  87. getDictionaryFn('political_outlook').then(res=>{
  88. if(res.code==200){
  89. this.outlook = res.data.map(v => {
  90. return {
  91. dictLabel: v.dictLabel,
  92. dictValue: v.dictValue
  93. }
  94. })
  95. }
  96. })
  97. },
  98. getDataFn(a){
  99. var params={
  100. pageSize:this.pageSize,
  101. pageNum: this.pageNum,
  102. }
  103. if(this.name){
  104. params.name=this.name
  105. }
  106. // if(this.classId){
  107. // params.classId=this.classId
  108. // }
  109. params['params[role]']=this.$store.state.user.choseroles
  110. getteaListFn(params).then(res=>{
  111. if(res.code==200){
  112. this.total=res.total;
  113. var data=res.rows;
  114. data.forEach((ite)=>{
  115. if(ite.identificationPhoto&&ite.identificationPhoto.length>0){
  116. var narr=ite.identificationPhoto.split(',')
  117. ite.identificationPhoto=narr[0]
  118. }
  119. })
  120. if (res.rows.length < this.pageSize) {
  121. this.reachflag = false
  122. this.wtdt = '到底了~';
  123. } else {
  124. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  125. if (num < res.total) {
  126. this.reachflag = true
  127. this.wtdt = '上拉加载更多'
  128. } else {
  129. this.reachflag = false
  130. this.wtdt = '到底了~';
  131. }
  132. }
  133. if (this.pageNum == 1) {
  134. this.list = data;
  135. } else {
  136. this.list = this.list.concat(data)
  137. }
  138. }else{
  139. this.$toast(res.msg)
  140. }
  141. })
  142. },
  143. bindDateChange(e){
  144. var idx=e.detail.value;
  145. this.classId=this.classlist[idx].classId;
  146. this.className=this.classlist[idx].className;
  147. this.pageNum=1;
  148. this.list=[];
  149. this.reachflag=true;
  150. this.getDataFn()
  151. },
  152. getSearch(){
  153. this.pageNum=1;
  154. this.list=[];
  155. this.reachflag=true;
  156. this.getDataFn()
  157. },
  158. getDetail(id){
  159. this.$tab.navigateTo('/mine/pages/files/teacherdetail?id='+id)
  160. }
  161. },
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .filebox{height: 100vh;background-color: #FFFFFF;display: flex;flex-direction: column;overflow: hidden;}
  166. .stutop{
  167. padding: 28rpx 38rpx 2rpx;background-color: #FFFFFF;flex: 0 0 auto;
  168. }
  169. // 防溺水 心理健康, 记录体重每次信息
  170. .stutoa{font-size: 28rpx;font-weight: bold;color: #666666;
  171. text{color: #4775EA;padding: 0 8rpx;}
  172. image{width: 22rpx;height: 12rpx;margin-left: 24rpx;}
  173. .stutoap{flex: 1;padding: 16rpx 0;}
  174. }
  175. .stutoar{
  176. text{color: #4775EA;padding: 0 8rpx;}
  177. }
  178. .search{height: 80rpx;background: #F2F5FB;border-radius: 40rpx;padding-left: 40rpx;
  179. .img{width: 30rpx;height: 32rpx;flex:0 0 auto;margin-right: 30rpx;}
  180. .btn{width: 120rpx;height: 80rpx;background: #1f57e6;border-radius: 40rpx;font-size: 30rpx;font-weight: 500;
  181. color: #FFFFFF;text-align: center;line-height: 80rpx;flex:0 0 auto}
  182. .input{font-size: 30rpx;color: #161616;line-height: 80rpx;}
  183. }
  184. .workbox{overflow: auto;
  185. .workboxr{height: 100%;display: flex;}
  186. .scroll-view{width: 100%;height: 100%;box-sizing: border-box;}
  187. }
  188. .addbtn{width:100%;
  189. height: 100rpx;
  190. background: #1f57e6;position: fixed;left: 0;right: 0;bottom: 0;z-index: 1;font-size: 34rpx;font-weight: 500;
  191. color: #FFFFFF;display: flex;align-items: center;justify-content: center;}
  192. </style>