| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- const _Http = getApp().globalData.http;
- Component({
- options: {
- addGlobalClass: true
- },
- lifetimes: {
- attached: function () {
- getApp().globalData.Language.getLanguagePackage(this)
- }
- },
- properties: {
- mode: {
- type: String
- }
- },
- data: {
- dateTypes: ["全部", "本年"],
- showList: false,
- list: [],
- dateType: "本年", //联系人用
- "isAll": 0, //客户和项目用 1全部 0本年 99时间范围
- "content": {
- "nocache": true,
- "pageNumber": 1,
- "pageTotal": 1,
- "total": null,
- "where": {
- begdate: "",
- enddate: "",
- }
- }
- },
- methods: {
- getList(id, init) {
- let content = this.data.content;
- if (init) {
- content.pageNumber = 1;
- content.total = null;
- }
- if (!this.data.showList && content.total != null) return;
- if (content.pageNumber > content.pageTotal) return;
- const types = {
- 客户: {
- id: 20230713104404,
- idName: "sa_customersid"
- },
- 项目: {
- id: 20230716151004,
- idName: "sa_projectid"
- }
- },
- mode = this.data.mode;
- content[types[mode].idName] = id;
- content.isAll = this.data.isAll;
- _Http.basic({
- "id": types[mode].id,
- content
- }).then(res => {
- console.log(this.data.mode + "服务", res)
- if (res.code != '1') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- content.pageNumber = res.pageNumber + 1;
- content.pageSize = res.pageSize;
- content.pageTotal = res.pageTotal;
- content.total = res.total;
- this.setData({
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- content,
- id: id,
- });
- this.selectComponent("#TimeRange").onCancel()
- })
- },
- changeDate({
- detail
- }) {
- this.setData({
- dateType: detail.dateType,
- isAll: detail.isAll,
- "content.where.begdate": detail.begdate || "",
- "content.where.enddate": detail.enddate || ""
- })
- this.getList(this.data.id, true)
- },
- shrinkChange({
- detail
- }) {
- this.setData({
- showList: detail
- })
- }
- }
- })
|