zerenchushi.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view style="background-color: #fff;padding-bottom: 110rpx;">
  3. <u-checkbox-group v-model="checkboxValue1" placement="column" iconPlacement="right" @change="checkboxChange">
  4. <u-collapse accordion @open="open">
  5. <u-collapse-item v-for="item in arrChushi" :title="item" :name="item" :key="item">
  6. <view style="color: #2979ff;">
  7. <view v-for=" i in chushiList" :key="i[0].deptName" v-if="item == i[0].deptName">
  8. <view class="checkitem" v-for="v in i" :key="v.userName">
  9. <u-checkbox :label="v.userName" :name="v.userName" size="24" @change="change2(v)">
  10. {{v.userName}}
  11. </u-checkbox>
  12. </view>
  13. </view>
  14. </view>
  15. </u-collapse-item>
  16. </u-collapse>
  17. </u-checkbox-group>
  18. <view
  19. style="position: fixed;bottom: 0;left: 0;width: 100%;height: 100rpx;background-color: #fff;box-sizing: border-box;padding: 20rpx;">
  20. <u-button type="primary" text="确认" @click="submit"></u-button>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. chushiList: {},
  29. arrChushi: {},
  30. checkboxValue1: [],
  31. userList: [],
  32. deptList: [],
  33. allUserList: [],
  34. nameList: [],
  35. idList: [],
  36. ywList: []
  37. }
  38. },
  39. onLoad(options) {
  40. this.getchishi()
  41. if (options.zaici == '1') {
  42. this.nameList = []
  43. this.checkboxValue1 = []
  44. this.ywList = []
  45. } else {
  46. console.log('587', getApp().globalData.ywListZR)
  47. if (getApp().globalData.ywListZR.length != 0) {
  48. this.ywList = getApp().globalData.ywListZR
  49. this.checkboxValue1 = this.ywList.map(item => item.nickName)
  50. this.nameList = getApp().globalData.zerenList.split(',')
  51. console.log(this.nameList)
  52. console.log('checkboxValue1', this.checkboxValue1)
  53. console.log(this.ywList)
  54. }
  55. }
  56. },
  57. onNavigationBarButtonTap(e) {
  58. },
  59. methods: {
  60. //获取下一节点接收人信息
  61. getchishi() {
  62. let deptId = null
  63. uni.$u.http.get(`/system/user/getNormalUserDept/` + deptId).then((res) => {
  64. console.log('res', res.data)
  65. this.chushiList = {
  66. ...res.data
  67. }
  68. this.arrChushi = {
  69. ...Object.keys(this.chushiList)
  70. }
  71. console.log('arrChushi', this.arrChushi)
  72. })
  73. },
  74. //选择人员
  75. checkboxChange(e) {
  76. // console.log('checkboxChange', e)
  77. },
  78. //折叠面板打开
  79. open(e) {
  80. // console.log(e)
  81. },
  82. change2(e) {
  83. // console.log('eeeeeeee', e)
  84. let fullName = e.deptName + '--' + e.userName;
  85. if (this.nameList.indexOf(fullName) === -1) {
  86. this.nameList.push(fullName);
  87. } else {
  88. this.nameList.splice(this.nameList.indexOf(fullName), 1);
  89. }
  90. console.log('nameList', this.nameList)
  91. let obj = {
  92. userName: e.nickName,
  93. userId: e.userId,
  94. nickName: e.userName,
  95. };
  96. let index = this.ywList.findIndex(item => item.userName === obj.userName);
  97. if (index === -1) {
  98. this.ywList.push(obj);
  99. } else {
  100. this.ywList.splice(index, 1);
  101. }
  102. // console.log('ywList', this.ywList)
  103. },
  104. submit() {
  105. if (this.checkboxValue1.length == 0) {
  106. uni.showToast({
  107. title: "请选择人员",
  108. icon: "none"
  109. })
  110. } else {
  111. // getApp().globalData.peoList = this.nameList.join(",")
  112. // getApp().globalData.peoIdList = this.checkboxValue1.join(",")
  113. // getApp().globalData.peoDeptList = this.idList.join(",")
  114. getApp().globalData.zerenList = this.nameList.join(",")
  115. getApp().globalData.ywListZR = this.ywList
  116. // getApp().globalData.peoIdList = this.checkboxValue1.join(",")
  117. // getApp().globalData.nickNameList = this.idList.join(",")
  118. uni.$emit('query', {
  119. a: 'two'
  120. })
  121. uni.navigateBack()
  122. }
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .checkitem {
  129. // display: flex;
  130. // align-items: center;
  131. // justify-content: space-between;
  132. font-size: 32rpx;
  133. padding: 20rpx 0;
  134. border-bottom: 1px solid #eaeaea;
  135. }
  136. ::v-deep .u-collapse-item__content__text {
  137. background-color: #f7f7f7;
  138. }
  139. ::v-deep .u-cell__title-text {
  140. font-size: 32rpx;
  141. }
  142. </style>