| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- active: 0,
- content: {
- sys_enterpriseid: "",
- nocache: true,
- pageNumber: 1,
- pageSize: 20,
- pageTotal: 1,
- total: 0,
- where: {
- "condition": "",
- }
- },
- list: [],
- },
- getList(init = false) {
- const content = this.data.content;
- if (init) content.pageNumber = 1;
- if (content.pageNumber > content.pageTotal) return;
- _Http.basic({
- id: this.data.active == 0 ? 20221219161202 : 20221219193002,
- content
- }).then(res => {
- console.log("通讯录列表", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- content.pageNumber = res.pageNumber + 1;
- content.pageTotal = res.pageTotal;
- content.total = res.total;
- this.setData({
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- content
- })
- })
- },
- onChange(e) {
- this.setData({
- active: e.detail.index
- });
- this.getList(true);
- },
- onLoad(options) {
- if (options.sys_enterpriseid) this.setData({
- 'content.sys_enterpriseid': options.sys_enterpriseid
- });
- this.getList();
- },
- /* 默认添加 */
- created() {
- wx.redirectTo({
- url: '/packageA/setclient/modules/contacts/add/index?sys_enterpriseid=' + this.data.content.sys_enterpriseid,
- })
- },
- onClick(e) {
- const {
- item
- } = e.currentTarget.dataset;
- delete(item.tag1)
- wx.redirectTo({
- url: `/packageA/setclient/modules/contacts/add/index?sys_enterpriseid=${this.data.content.sys_enterpriseid}&data=${JSON.stringify(item)}`,
- })
- },
- onSearch({
- detail
- }) {
- this.setData({
- 'parems.content.where.condition': detail ? detail : ""
- });
- this.getList(true);
- },
- onClear() {
- this.setData({
- 'parems.content.where.condition': ""
- });
- this.getList(true);
- },
- onReachBottom() {
- this.getList();
- },
- })
|