tb.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. var app = getApp();
  2. var that;
  3. var animation;
  4. Page({
  5. data: {
  6. tbList: [{
  7. id: 1,
  8. name: '仅同步指定部门内的人员信息(可多选)',
  9. kam: '该选择不会包含子部门人员,请确保选中需要同步的人员的直属部门',
  10. checked: true
  11. },
  12. {
  13. id: 2,
  14. name: '仅同步部门信息和上下级关系',
  15. kam: '仅同步所有部门名称和上下级所属关系,但不同步人员信息'
  16. },
  17. {
  18. id: 3,
  19. name: '同步全部部门和人员信息 ',
  20. kam: '同步全部信息所需时间较长,请关注同步成功后推送的工作通知'
  21. },
  22. ],
  23. defaultSection:[],
  24. popupCx: '',
  25. dept_ids:[],
  26. selectTbIndex:1,
  27. },
  28. onLoad(e) {
  29. that = this;
  30. dd.setNavigationBar({
  31. title: "钉钉通讯录同步"
  32. });
  33. },
  34. onShow() {
  35. animation = dd.createAnimation({
  36. duration: 200,
  37. timeFunction: "linear",
  38. });
  39. },
  40. //抢任务
  41. formSubmit() {
  42. this.setData({ disabled: true })
  43. app.$post("api/integral/task", { task_id: this.data.dataDetail.id }).then((res) => {
  44. app.globalData.showToast('抢单成功!');
  45. setTimeout(() => {
  46. dd.navigateBack({ delta: 1 })
  47. }, 1000);
  48. }).finally(() => {
  49. that.setData({ disabled: false })
  50. });
  51. },
  52. radioChange(e) {
  53. this.setData({
  54. selectTbIndex:e.detail.value
  55. })
  56. },
  57. //选择弹窗
  58. openSelect(e) {
  59. animation.translateY(0).step();
  60. that.setData({
  61. isShowType: 1,
  62. popupCx: 'container__mask',
  63. animationInfo: animation.export()
  64. });
  65. },
  66. //关闭规则
  67. onClose() {
  68. animation.translateY(1200).step();
  69. that.setData({
  70. isShowType: '',
  71. popupCx: '',
  72. animationInfo: animation.export()
  73. });
  74. },
  75. //选择部门
  76. onSelectSection(e) {
  77. var arr = [];
  78. if (e.length > 0) {
  79. let names='';
  80. e.forEach(user => {
  81. arr.push(user.id);
  82. names+=(user.name+',')
  83. })
  84. that.setData({
  85. defaultSection: e,
  86. dept_ids: arr,
  87. deptNames:names
  88. })
  89. } else {
  90. that.setData({
  91. defaultSection: [],
  92. dept_ids: [],
  93. deptNames:''
  94. })
  95. }
  96. },
  97. });