authen.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="car">
  3. <!-- 列表 -->
  4. <view class="carlists">
  5. <car-list :datainfo="list" :ygztList="ygztList" :yglbList="yglbList" :wtdt="wtdt" type='staff' @getDetail="getDetail" @getDelFn="getDelFn" @getShFn="getShFn"></car-list>
  6. </view>
  7. <block>
  8. <view style="height: 100rpx;"></view>
  9. <view class="rfbtn" @click="getAddFn">添加认证信息</view>
  10. </block>
  11. <loading></loading>
  12. </view>
  13. </template>
  14. <script>
  15. import config from '@/config'
  16. const baseUrl = config.baseUrl
  17. import carList from "@/people/components/car/list.vue"
  18. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  19. import {staffDel,listAuthentication} from "@/api/work/people.js"
  20. import {getDictionaryFn} from "@/api/system/user.js"
  21. export default{
  22. components:{carList},
  23. data(){
  24. return{
  25. reset:require('@/car/static/car/reset.png'),
  26. up:require('@/car/static/car/up.png'),
  27. car:require('@/car/static/car/car.png'),
  28. cara:require('@/car/static/car/cara.png'),
  29. carb:require('@/car/static/car/carb.png'),
  30. search:require('@/car/static/car/search.png'),
  31. sfxx:"",
  32. sfxxid:'',
  33. text:'',
  34. yglbList:[],
  35. ygztList:[],
  36. list:[],
  37. pageSize: 10,
  38. pageNum: 1,
  39. reachflag: true,
  40. wtdt:'',
  41. userId:this.$store.state.user.userId,
  42. }
  43. },
  44. onUnload() {
  45. uni.$off('refStaffList')
  46. },
  47. onLoad: function() {
  48. uni.$on('refStaffList',(res)=>{
  49. this.getrefreshData()
  50. })
  51. this.init();
  52. this.getDataFn();
  53. },
  54. // 上拉触底加载更多触发事件
  55. onReachBottom() {
  56. if (this.reachflag) {
  57. this.pageNum++
  58. this.getDataFn()
  59. }
  60. },
  61. methods:{
  62. checkPermi, checkRole,
  63. getTabFn(val){
  64. this.tabval=val;
  65. this.getrefreshData()
  66. },
  67. init(){
  68. // 员工类别
  69. getDictionaryFn('yaungong').then(res=>{
  70. if(res.code==200){
  71. this.yglbList = res.data.map(v => {
  72. return {
  73. dictLabel: v.dictLabel,
  74. dictValue: v.dictValue
  75. }
  76. })
  77. }
  78. })
  79. //状态
  80. getDictionaryFn('technician_status').then(res=>{
  81. if(res.code==200){
  82. this.ygztList = res.data.map(v => {
  83. return {
  84. dictLabel: v.dictLabel,
  85. dictValue: v.dictValue
  86. }
  87. })
  88. }
  89. })
  90. },
  91. getShFn(data){
  92. var that=this;
  93. var info=JSON.parse(JSON.stringify(data))
  94. var ite=JSON.parse(JSON.stringify(info.ite))
  95. var params={
  96. staffId:ite.staffId,
  97. userId:ite.userId,
  98. examine:info.sh
  99. }
  100. // params.examine=info.sh;
  101. examineStaff(params).then(res=>{
  102. if(res.code==200){
  103. this.$toast('审核成功')
  104. setTimeout(function(){
  105. that.getrefreshData()
  106. },1200)
  107. }
  108. })
  109. },
  110. getAddFn(){
  111. var type='rzadd';
  112. this.$tab.navigateTo(`/people/pages/people/staffadd?type=${type}`)
  113. },
  114. getDetail(e){
  115. this.$tab.navigateTo("/people/pages/people/staffadd?id="+e)
  116. },
  117. getConfirm(){
  118. this.getrefreshData()
  119. },
  120. getReset(){
  121. this.sfxx='';
  122. this.text='';
  123. this.getrefreshData()
  124. },
  125. getrefreshData(){
  126. this.pageNum=1;
  127. this.list=[];
  128. this.reachflag=true;
  129. this.getDataFn()
  130. },
  131. bindDateChangea(e){
  132. var val=e.detail.value;
  133. this.sfxx=this.yglbList[val].dictLabel;
  134. this.sfxxid=this.yglbList[val].dictValue;
  135. this.getrefreshData()
  136. },
  137. getDataFn(){
  138. var params={
  139. pageSize:this.pageSize,
  140. pageNum: this.pageNum,
  141. userId:this.userId
  142. }
  143. if(this.text){
  144. params.staffName=this.text
  145. }
  146. if(this.sfxx){
  147. params.staffCategory=this.sfxxid
  148. }
  149. listAuthentication(params).then(res=>{
  150. if(res.code==200){
  151. if (res.rows.length < this.pageSize) {
  152. this.reachflag = false
  153. this.wtdt = '到底了~';
  154. } else {
  155. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  156. if (num < res.total) {
  157. this.reachflag = true
  158. this.wtdt = ''
  159. } else {
  160. this.reachflag = false
  161. this.wtdt = '到底了~';
  162. }
  163. }
  164. var arr=JSON.parse(JSON.stringify((res.rows)))
  165. arr.forEach(ite=>{
  166. ite.hideflag=true;
  167. if(ite.phoneNumber){
  168. ite.phoneNumbera=this.HideType(ite.phoneNumber)
  169. }
  170. if(ite.idCard){
  171. ite.idCarda=this.HideType(ite.idCard)
  172. }
  173. })
  174. if (this.pageNum == 1) {
  175. this.list = arr;
  176. } else {
  177. this.list = this.list.concat(arr)
  178. }
  179. }else{
  180. this.$toast(res.msg)
  181. }
  182. })
  183. },
  184. getDelFn(data){
  185. var that=this;
  186. var info=JSON.parse(JSON.stringify(data))
  187. var params={
  188. staffId:info.staffId,
  189. userId:info.userId,
  190. tenantId:info.tenantId,
  191. }
  192. staffDel(params).then(res=>{
  193. if(res.code==200){
  194. this.$toast("删除成功");
  195. setTimeout(function(){
  196. that.getrefreshData()
  197. },1500)
  198. }
  199. })
  200. },
  201. HideType(data,flag,type){
  202. const firstPart = data.slice(0, 1);
  203. // 生成中间8位的星号
  204. const middlePart = '*'.repeat(data.length-2);
  205. // 获取后4位
  206. const lastPart = data.slice(data.length-1);
  207. var s= firstPart + middlePart + lastPart;
  208. return s
  209. },
  210. }
  211. }
  212. </script>
  213. <style>
  214. page{background: #F3F3F0;}
  215. </style>
  216. <style lang="scss" scoped>
  217. .car{padding: 12rpx 0 10rpx;}
  218. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  219. .topa{padding: 20rpx 20rpx 32rpx;
  220. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  221. .chekt{width: 150rpx;overflow: hidden;
  222. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  223. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  224. }
  225. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  226. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  227. input{flex: 1;font-size: 26rpx;color: #272727;}
  228. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  229. font-size: 26rpx;
  230. color: #FFFFFF;}
  231. }
  232. }
  233. .tablst{background: #F3F3F0;padding:24rpx 16rpx 26rpx 30rpx;overflow: auto;
  234. .tabs{height: 48rpx;background: #DADADA;border-radius: 24rpx;margin-right: 30rpx;font-weight: 500;display: flex;align-items: center;justify-content: center;padding: 0 24rpx;font-size: 26rpx;box-sizing: border-box;flex: 0 0 auto;color: #666666;
  235. &.act{border: 2rpx solid #0256FD;background: #FFFFFF;color: #0256FD;}
  236. }
  237. }
  238. }
  239. .carlists{padding: 0 6rpx;}
  240. </style>