downhole_statistics_user.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. mine: this.mine
  36. }).then((res) => {
  37. console.log(res.data.data)
  38. this.list = res.data.data
  39. this.list.forEach((item, index) => {
  40. this.user_list.push(item.name + '-' + item.department + '-' + item.job)
  41. })
  42. console.log(this.list)
  43. console.log(this.user_list)
  44. this.choose_user()
  45. })
  46. },
  47. // 选择人员
  48. choose_user() {
  49. uni.showActionSheet({
  50. itemList: this.user_list,
  51. success: (res) => {
  52. console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
  53. console.log(this.list[res.tapIndex].people_code)
  54. this.people_num = this.list[res.tapIndex].people_code
  55. uni.showModal({
  56. title: '提示',
  57. content: '你选中的是:' + this.list[res.tapIndex].name + '-' + this.list[res
  58. .tapIndex].department + '-' + this.list[res.tapIndex].job +
  59. ";只能选择一次,是否确认",
  60. success: (res) => {
  61. if (res.confirm) {
  62. console.log('用户点击确定');
  63. this.$api.user_updateUserMessage({
  64. people_code: this.people_num
  65. }).then((res) => {
  66. console.log(res)
  67. })
  68. uni.setStorageSync('people_code', this.people_num)
  69. uni.redirectTo({
  70. url: "../../production/personnel_orientation/downhole_statistics/downhole_statistics?people_num=" +
  71. this.people_num + "&depart_name=" + this
  72. .depart_name + "&name=" + this.name +
  73. "&mine=" + this.mine
  74. })
  75. } else if (res.cancel) {
  76. this.choose_user()
  77. console.log('用户点击取消');
  78. }
  79. }
  80. });
  81. },
  82. fail: function(res) {
  83. console.log(res.errMsg);
  84. }
  85. });
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss">
  91. </style>