| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- list: [],
- loading: false,
- content: {
- nocache: true,
- pageNumber: 1,
- pageSize: 20,
- pageTotal: 1,
- total: null,
- where: {
- condition: "",
- tablefilter: {
- taskname: null,
- name: null,
- year: null,
- status: null,
- createby: null
- }
- }
- }
- },
- onLoad() {
- this.getList(true);
- },
- onShow() {
- if (this.data._loaded) {
- this.getList(true);
- }
- this.setData({ _loaded: true });
- },
- onPullDownRefresh() {
- this.getList(true);
- wx.stopPullDownRefresh();
- },
- onReachBottom() {
- if (this.data.content.pageNumber <= this.data.content.pageTotal) {
- this.getList(false);
- }
- },
- onSearch(e) {
- const keyword = typeof e.detail === 'string' ? e.detail : (e.detail.value || "");
- this.setData({
- "content.where.condition": keyword,
- "content.pageNumber": 1
- });
- this.getList(true);
- },
- getList(init) {
- if (init.detail != undefined) init = init.detail;
- let content = this.data.content;
- if (init) {
- content.pageNumber = 1;
- this.setData({ loading: true });
- }
- if (content.pageNumber > content.pageTotal) return;
- _Http.basic({
- "id": "2026041309474202",
- content
- }).then(res => {
- this.setData({ loading: false });
- console.log("合同任务列表", res);
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.msg !== '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- });
- this.setData({
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- "content.pageNumber": res.pageNumber + 1,
- "content.pageSize": res.pageSize,
- "content.pageTotal": res.pageTotal,
- "content.total": res.total
- });
- }).catch(() => {
- this.setData({ loading: false });
- this.selectComponent('#ListBox').RefreshToComplete();
- wx.showToast({ title: '加载失败', icon: 'none' });
- });
- },
- goToCreate() {
- wx.navigateTo({
- url: '/CRM/contract/create'
- });
- }
- });
|