|
|
@@ -2,39 +2,55 @@ const _Http = getApp().globalData.http,
|
|
|
getHeight = require("../../../utils/getRheRemainingHeight");
|
|
|
Page({
|
|
|
data: {
|
|
|
- content: {
|
|
|
- nocache: true,
|
|
|
- "type": 0,
|
|
|
- "pageNumber": 1,
|
|
|
- "pageSize": 20,
|
|
|
- "isExport": 0,
|
|
|
- "where": {
|
|
|
- "condition": "",
|
|
|
- }
|
|
|
- },
|
|
|
+ item: {},
|
|
|
result: [],
|
|
|
- radio: true,
|
|
|
+ params: {},
|
|
|
+ radio: false,
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
+ console.log(options)
|
|
|
+ if (options.item) {
|
|
|
+ let item = JSON.parse(options.item);
|
|
|
+ this.setData({
|
|
|
+ item,
|
|
|
+ params: item.params
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (options.params) this.setData({
|
|
|
+ params: JSON.parse(options.params)
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ radio: options.radio ? true : false
|
|
|
+ })
|
|
|
this.getList()
|
|
|
},
|
|
|
submit() {
|
|
|
- let pages = getCurrentPages();
|
|
|
- let list = this.data.result.map(v => this.data.list.find(value => value.sa_projectid == v));
|
|
|
- console.log(this.data.result)
|
|
|
- console.log(list)
|
|
|
+ let pages = getCurrentPages(),
|
|
|
+ item = this.data.item,
|
|
|
+ result = this.data.result,
|
|
|
+ list = this.data.result.map(v => this.data.list.find(value => value.sa_projectid == v));
|
|
|
+ try {
|
|
|
+ let page = pages[pages.length - 2].selectComponent(item.model || "#Form");
|
|
|
+ if (page) {
|
|
|
+ item.value = this.data.radio ? [list[0].projectname, result] : [list.map(v => v.projectname), result];
|
|
|
+ page.handleRoute(item);
|
|
|
+ } else {
|
|
|
+ pages[pages.length - 2].handleSelectProject(this.data.result, list)
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '操作失败',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
getList(init = false) {
|
|
|
//init 用于初始化分页
|
|
|
if (init.detail != undefined) init = init.detail;
|
|
|
- if (init) this.setData({
|
|
|
- ['content.pageNumber']: 1
|
|
|
- })
|
|
|
- if (this.data.content.pageNumber > this.data.content.pageTotal) return;
|
|
|
- _Http.basic({
|
|
|
- "id": 20221020143502,
|
|
|
- content: this.data.content
|
|
|
- }).then(res => {
|
|
|
+ let params = this.data.params;
|
|
|
+ if (init) params.content.pageNumber = 1
|
|
|
+ if (params.content.pageNumber > params.content.pageTotal) return;
|
|
|
+ _Http.basic(params).then(res => {
|
|
|
console.log("选择项目列表", res)
|
|
|
this.selectComponent('#ListBox').RefreshToComplete();
|
|
|
if (res.msg != '成功') return wx.showToast({
|
|
|
@@ -42,9 +58,9 @@ Page({
|
|
|
icon: "none"
|
|
|
})
|
|
|
this.setData({
|
|
|
- 'content.pageNumber': res.pageNumber + 1,
|
|
|
- 'content.pageTotal': res.pageTotal,
|
|
|
- 'content.total': res.total,
|
|
|
+ 'params.content.pageNumber': res.pageNumber + 1,
|
|
|
+ 'params.content.pageTotal': res.pageTotal,
|
|
|
+ 'params.content.total': res.total,
|
|
|
list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
|
|
|
})
|
|
|
this.getTags();
|