downhole_statistics_user.vue 2.3 KB

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