| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 | var app = getApp();var that;var animation;Page({  data: {    tbList: [{        id: 4,        name: '仅同步指定部门内的人员信息(可多选)',        kam: '该选择不会包含子部门人员,请确保选中需要同步的人员的直属部门',        checked: true      },      {        id: 3,        name: '仅同步部门信息和上下级关系',        kam: '仅同步所有部门名称和上下级所属关系,但不同步人员信息'      },      {        id: 1,        name: '同步全部部门和人员信息 ',        kam: '同步全部信息所需时间较长,请关注同步成功后推送的工作通知'      },    ],    defaultSection:[],    popupCx: '',    dept_ids:[],    selectTbIndex:4,  },  onLoad(e) {    that = this;    dd.setNavigationBar({      title: "钉钉通讯录同步"    });  },  onShow() {    animation = dd.createAnimation({      duration: 200,      timeFunction: "linear",    });  },    //抢任务  formSubmit() {            let data={        type:this.data.selectTbIndex,        dept_list:this.data.dept_ids.toString(),      }      if(this.data.selectTbIndex==4&&this.data.dept_ids.length==0){        app.globalData.showToast('请选择指定部门');        return false      }      this.setData({ disabled: true })      app.$post("api/ding/site_sync", data).then((res) => {        app.globalData.showToast('同步中,成功后将发送工作通知');        setTimeout(() => {          dd.navigateBack({ delta: 1 })        }, 500);      }).finally(() => {        that.setData({ disabled: false })      });    },  radioChange(e) {    this.setData({      selectTbIndex:e.detail.value    })  },  //选择弹窗  openSelect(e) {    if(this.data.selectTbIndex!=4){      return false    }    animation.translateY(0).step();    that.setData({      isShowType: 1,      popupCx: 'container__mask',      animationInfo: animation.export()    });  },  //关闭规则  onClose() {    animation.translateY(1200).step();    that.setData({      isShowType: '',      popupCx: '',      animationInfo: animation.export()    });  },  //选择部门  onSelectSection(e) {    var arr = [];    if (e.length > 0) {      let names='';      e.forEach(user => {        arr.push(user.id);        names+=(user.name+',')      })      that.setData({        defaultSection: e,        dept_ids: arr,        deptNames:names      })    } else {      that.setData({        defaultSection: [],        dept_ids: [],        deptNames:''      })    }  },});
 |