|
@@ -1,99 +1,62 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
-
|
|
|
Page({
|
|
|
data: {
|
|
|
- radio: false, //是否为单选
|
|
|
- content: {
|
|
|
- "ownertable": "sa_itemgroup",
|
|
|
- "ownerid": 11,
|
|
|
- pageSize: 20,
|
|
|
- pageNumber: 1,
|
|
|
- pageTotal: 1,
|
|
|
- "where": {
|
|
|
- "condition": ""
|
|
|
- }
|
|
|
- },
|
|
|
- list: [],
|
|
|
- result: [],
|
|
|
+ ownertable: null,
|
|
|
+ ownerid: null,
|
|
|
+ active: 0,
|
|
|
+ copyTeams: [], //用来本地搜索
|
|
|
+ keyword: "", //搜索关键字
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- //是否为单选
|
|
|
- if (options.radio) this.setData({
|
|
|
- radio: true
|
|
|
- })
|
|
|
- if (options.ownertable) {
|
|
|
+ if (options.item) {
|
|
|
+ let item = JSON.parse(options.item);
|
|
|
this.setData({
|
|
|
- "content.ownertable": options.ownertable,
|
|
|
- "content.ownerid": options.ownerid,
|
|
|
+ ...item
|
|
|
});
|
|
|
- this.getList();
|
|
|
- console.log(this.data.content)
|
|
|
- };
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onInput({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ let list = this.data.copyTeams[this.data.active];
|
|
|
+ if (detail.value) list = list.filter(v => v.position.includes(detail.value) || v.name.includes(detail.value));
|
|
|
+ this.setData({
|
|
|
+ [`teams[${this.data.active}].team`]: list
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 取消搜索 */
|
|
|
+ cancelTheSearch() {
|
|
|
+ this.setData({
|
|
|
+ keyword: "",
|
|
|
+ [`teams[${this.data.active}].team`]: this.data.copyTeams[this.data.active]
|
|
|
+ })
|
|
|
},
|
|
|
- submit() {
|
|
|
- let result = this.data.result;
|
|
|
- if (result.length == 0) return;
|
|
|
- console.log(result)
|
|
|
+ /* 切换tabs */
|
|
|
+ onChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ active: detail.index
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取列表
|
|
|
+ getList() {
|
|
|
_Http.basic({
|
|
|
- "id": 20220930103601,
|
|
|
+ "id": 20220930103501,
|
|
|
"content": {
|
|
|
- "ownertable": this.data.content.ownertable,
|
|
|
- "ownerid": this.data.content.ownerid,
|
|
|
- "userids": result
|
|
|
+ "ownertable": this.data.ownertable,
|
|
|
+ "ownerid": this.data.ownerid
|
|
|
}
|
|
|
}).then(res => {
|
|
|
+ console.log("团队成员列表", res)
|
|
|
if (res.msg != '成功') return wx.showToast({
|
|
|
title: res.data,
|
|
|
icon: "none"
|
|
|
- });
|
|
|
- wx.showToast({
|
|
|
- title: '保存成功',
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- const pages = getCurrentPages();
|
|
|
- pages[pages.length - 2].selectComponent("#Group").getList();
|
|
|
- wx.navigateBack();
|
|
|
- }, 300)
|
|
|
- })
|
|
|
- },
|
|
|
- /* 选中 */
|
|
|
- onChange(e) {
|
|
|
- const userid = e.currentTarget.dataset.item.userid + "";
|
|
|
- if (!userid) return;
|
|
|
- if (this.data.radio) {
|
|
|
- this.setData({
|
|
|
- result: [userid]
|
|
|
- })
|
|
|
- } else {
|
|
|
- let result = this.data.result;
|
|
|
- if (result.some(v => v == userid)) {
|
|
|
- result = result.filter(v => v != userid)
|
|
|
- } else {
|
|
|
- result.push(userid)
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- result
|
|
|
})
|
|
|
- }
|
|
|
- },
|
|
|
- //获取列表
|
|
|
- getList(init = false) {
|
|
|
- let content = this.data.content;
|
|
|
- if (init) {
|
|
|
- content.pageTotal = 1
|
|
|
- content.pageNumber = 1
|
|
|
- }
|
|
|
- if (content.pageNumber > content.pageTotal) return;
|
|
|
- _Http.basic({
|
|
|
- "id": 20221018122201,
|
|
|
- content
|
|
|
- }).then(res => {
|
|
|
- console.log("数据团队列表", res)
|
|
|
this.setData({
|
|
|
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
|
|
|
- "content.pageTotal": res.pageTotal,
|
|
|
- "content.pageNumber": res.pageNumber + 1,
|
|
|
+ teams: res.data,
|
|
|
+ copyTeams: res.data.map(v => v.team)
|
|
|
})
|
|
|
})
|
|
|
},
|