|
@@ -2,6 +2,7 @@ const _Http = getApp().globalData.http;
|
|
|
|
|
|
Page({
|
|
|
data: {
|
|
|
+ radio: false, //是否为单选
|
|
|
content: {
|
|
|
"ownertable": "sa_itemgroup",
|
|
|
"ownerid": 11,
|
|
@@ -16,7 +17,6 @@ Page({
|
|
|
result: [],
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- console.log(options)
|
|
|
if (options.ownertable) {
|
|
|
this.setData({
|
|
|
content: {
|
|
@@ -25,20 +25,29 @@ Page({
|
|
|
});
|
|
|
this.getList();
|
|
|
console.log(this.data.content)
|
|
|
- }
|
|
|
+ };
|
|
|
+ if (options.radio) this.setData({
|
|
|
+ radio: true
|
|
|
+ })
|
|
|
},
|
|
|
onChange(e) {
|
|
|
const userid = e.currentTarget.dataset.item.userid + "";
|
|
|
if (!userid) return;
|
|
|
- let result = this.data.result;
|
|
|
- if (result.some(v => v == userid)) {
|
|
|
- result = result.filter(v => v != userid)
|
|
|
+ if (this.data.radio) {
|
|
|
+ this.setData({
|
|
|
+ result: [userid]
|
|
|
+ })
|
|
|
} else {
|
|
|
- result.push(userid)
|
|
|
+ let result = this.data.result;
|
|
|
+ if (result.some(v => v == userid)) {
|
|
|
+ result = result.filter(v => v != userid)
|
|
|
+ } else {
|
|
|
+ result.push(userid)
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ result
|
|
|
+ })
|
|
|
}
|
|
|
- this.setData({
|
|
|
- result
|
|
|
- })
|
|
|
},
|
|
|
getList(init = false) {
|
|
|
let content = this.data.content;
|