downhole_statistics_user.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view>
  3. </view>
  4. </template>
  5. <script>
  6. export default {
  7. data() {
  8. return {
  9. mine: "",
  10. // 用户信息
  11. name: "",
  12. depart_name: "",
  13. // 用户id
  14. people_num: 0,
  15. // 重名人员 原始数据
  16. list: [],
  17. // 配置参数
  18. user_list: []
  19. };
  20. },
  21. onLoad(option) {
  22. console.log(option)
  23. this.mine = option.mine
  24. // 设置用户信息
  25. this.name = option.name
  26. this.depart_name = option.depart_name
  27. this.get_list()
  28. },
  29. methods: {
  30. // 获取重名人员列表参数
  31. get_list() {
  32. this.$api.user_getPersonnelListByName({
  33. name: this.name
  34. // name: "王文新"
  35. }).then((res) => {
  36. console.log(res.data.data)
  37. this.list = res.data.data
  38. this.list.forEach((item, index) => {
  39. this.user_list.push(item.name + '-' + item.department + '-' + item.job)
  40. })
  41. console.log(this.list)
  42. console.log(this.user_list)
  43. this.choose_user()
  44. })
  45. },
  46. // 选择人员
  47. choose_user() {
  48. uni.showActionSheet({
  49. itemList: this.user_list,
  50. success: (res) => {
  51. console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
  52. console.log(this.list[res.tapIndex].people_code)
  53. this.people_num = this.list[res.tapIndex].people_code
  54. uni.showModal({
  55. title: '提示',
  56. content: '你选中的是:' + this.list[res.tapIndex].name + '-' + this.list[res
  57. .tapIndex].department + '-' + this.list[res.tapIndex].job +
  58. ";只能选择一次,是否确认",
  59. success: (res) => {
  60. if (res.confirm) {
  61. console.log('用户点击确定');
  62. this.$api.user_updateUserMessage({
  63. people_code: this.people_num
  64. }).then((res) => {
  65. console.log(res)
  66. })
  67. uni.setStorageSync('people_code', this.people_num)
  68. uni.redirectTo({
  69. url: "../../production/personnel_orientation/downhole_statistics/downhole_statistics?people_num=" +
  70. this.people_num + "&depart_name=" + this
  71. .depart_name + "&name=" + this.name +
  72. "&mine=" + this.mine
  73. })
  74. } else if (res.cancel) {
  75. this.choose_user()
  76. console.log('用户点击取消');
  77. }
  78. }
  79. });
  80. },
  81. fail: function(res) {
  82. console.log(res.errMsg);
  83. }
  84. });
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss">
  90. </style>