|
@@ -3,6 +3,7 @@ const _Http = getApp().globalData.http;
|
|
|
Page({
|
|
|
data: {
|
|
|
radio: false, //是否为单选
|
|
|
+ obj: false, //是否返回数组对象
|
|
|
content: {
|
|
|
ownertable: null,
|
|
|
ownerid: null,
|
|
@@ -16,11 +17,15 @@ Page({
|
|
|
list: [],
|
|
|
result: []
|
|
|
},
|
|
|
- onLoad(options) {
|
|
|
+ async onLoad(options) {
|
|
|
//是否为单选
|
|
|
if (options.radio) this.setData({
|
|
|
radio: true
|
|
|
- })
|
|
|
+ });
|
|
|
+ //是否返回数组对象
|
|
|
+ if (options.obj) this.setData({
|
|
|
+ obj: true
|
|
|
+ });
|
|
|
if (options.data) {
|
|
|
let {
|
|
|
ownertable,
|
|
@@ -30,14 +35,21 @@ Page({
|
|
|
"content.ownertable": ownertable,
|
|
|
"content.ownerid": ownerid,
|
|
|
});
|
|
|
- this.getList();
|
|
|
+ await this.getList();
|
|
|
+ //是否有默认选项
|
|
|
+ if (options.result) {
|
|
|
+ this.setData({
|
|
|
+ result: [options.result]
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
submit() {
|
|
|
let result = this.data.result;
|
|
|
if (result.length == 0) return;
|
|
|
let pages = getCurrentPages();
|
|
|
- pages[pages.length - 2].handelSubmit(result);
|
|
|
+ let list = this.data.obj ? result.map(id => this.data.list.find(v => v.userid == id)) : result
|
|
|
+ pages[pages.length - 2].handelSubmit(list);
|
|
|
},
|
|
|
/* 选中 */
|
|
|
onChange(e) {
|