turn_send_user.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view>
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="转派" @clickLeft="back">
  4. <template slot="right">
  5. <text class="btn-right" @click="submitReassign">确定</text>
  6. </template>
  7. </uni-nav-bar>
  8. <TurnSendInfo :list="list" @inputChange="changeUserData" @radioChange="getUserData"></TurnSendInfo>
  9. </view>
  10. </template>
  11. <script>
  12. import TurnSendInfo from '@/components/TurnSendInfo.vue'
  13. import {
  14. postJ
  15. } from "@/utils/api.js"
  16. let [page, size, isEnd] = [1, 20, true];
  17. export default {
  18. components:{
  19. TurnSendInfo
  20. },
  21. data() {
  22. return {
  23. pageId:'',
  24. executorId:'',
  25. executorName:'',
  26. list:[],
  27. searchForm: {deptCode:''} //筛选条件
  28. }
  29. },
  30. onLoad(option) {
  31. console.log(option)
  32. this.searchForm.deptCode = option.code;
  33. this.getList();
  34. },
  35. onReachBottom: function() {
  36. if (isEnd) {
  37. return;
  38. }
  39. // 显示加载图标
  40. // uni.showLoading({
  41. // title: "数据加载中"
  42. // });
  43. // this.getMoreLists();
  44. },
  45. methods: {
  46. //获取第一次数据
  47. getFirstList: function() {
  48. page = 1;
  49. isEnd = true;
  50. uni.showLoading({
  51. title: "数据加载中"
  52. });
  53. this.getList();
  54. },
  55. getMoreLists: function() {
  56. //获取更多数据
  57. page++;
  58. this.getList();
  59. },
  60. //获取列表数据
  61. getList() {
  62. postJ(this.apiUrl + "/main/user/users", this.searchForm).then(res => {
  63. this.list = res.data;
  64. // let pageTotal = res.data.pageTotal;
  65. // if (page === 1) {
  66. // data.forEach(el => {
  67. // el.num = 0
  68. // })
  69. // this.list = data;
  70. // } else {
  71. // data.forEach(element => {
  72. // element.num = 0;
  73. // this.list.push(element);
  74. // });
  75. // }
  76. // page < pageTotal ? (isEnd = false) : (isEnd = true);
  77. }).then(() => {
  78. uni.hideLoading()
  79. })
  80. },
  81. //筛选-重新获取数据
  82. changeUserData(data){
  83. this.searchForm = {
  84. name: data.name || ''
  85. };
  86. this.getFirstList();
  87. },
  88. //获取选中信息
  89. getUserData(data){
  90. this.executorId = data.executorId;
  91. this.executorName = data.executorName;
  92. },
  93. //确定
  94. submitReassign(){
  95. if(!this.executorId){
  96. uni.showToast({
  97. title:'请选择转派人员',
  98. icon:'none'
  99. })
  100. return
  101. }
  102. let data = {
  103. executorId: this.executorId,
  104. executorName: this.executorName
  105. }
  106. this.$store.dispatch("maintenance/setExecutor", data);
  107. this.back()
  108. },
  109. }
  110. }
  111. </script>
  112. <style scoped lang="scss">
  113. </style>