|
@@ -1,5 +1,6 @@
|
|
|
import api from '../api/api';
|
|
|
-const _Http = getApp().globalData.http
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
+let deleteUsers = [];
|
|
|
Page({
|
|
|
data: {
|
|
|
stopClick: '',
|
|
@@ -39,12 +40,15 @@ Page({
|
|
|
"id": "20230209091103",
|
|
|
"version": 1,
|
|
|
"content": {
|
|
|
+ nocache: true,
|
|
|
"sa_workorderid": this.data.sa_workorderid,
|
|
|
"sa_workorder_nodeid": this.data.sa_workorder_nodeid
|
|
|
}
|
|
|
})
|
|
|
+ console.log("详情", res.data)
|
|
|
this.setData({
|
|
|
mainData: res.data[0],
|
|
|
+ teams: res.data[0].team.map(v => v.userid),
|
|
|
titems: res.data[0].titems
|
|
|
})
|
|
|
this.setDefaultData()
|
|
@@ -209,7 +213,6 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad(options) {
|
|
|
- console.log(options)
|
|
|
this.data.bindContractData.ownerid = options.id
|
|
|
this.data.bindNormalData.ownerid = options.id
|
|
|
this.data.bindSignNameData.ownerid = options.id
|
|
@@ -237,16 +240,12 @@ Page({
|
|
|
SignName: false
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 开始添加成员或者取消添加
|
|
|
*/
|
|
|
showTeamDialog() {
|
|
|
this.setData({
|
|
|
- showTeams: !this.data.showTeams,
|
|
|
- teams: this.data.mainData.team.map(v => {
|
|
|
- return v.isleader == 1 ? 0 : v.userid
|
|
|
- })
|
|
|
+ showTeams: !this.data.showTeams
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
@@ -257,9 +256,9 @@ Page({
|
|
|
userid
|
|
|
} = e.currentTarget.dataset.item;
|
|
|
let teams = this.data.teams;
|
|
|
- let i = teams.findIndex(v => v == userid);
|
|
|
- if (i != -1) {
|
|
|
+ if (teams.some(v => v == userid)) {
|
|
|
teams = teams.filter(v => v != userid)
|
|
|
+ deleteUsers.push(userid);
|
|
|
} else {
|
|
|
teams.push(userid)
|
|
|
}
|
|
@@ -269,23 +268,34 @@ Page({
|
|
|
},
|
|
|
addUser(init = true) {
|
|
|
api._post({
|
|
|
- "id": 20220930103603,
|
|
|
+ "id": 20220930103803,
|
|
|
"content": {
|
|
|
ownertable: 'sa_workorder_node',
|
|
|
ownerid: this.data.mainData.sa_workorder_nodeid,
|
|
|
- "userids": this.data.teams
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("添加成员", res)
|
|
|
- wx.showToast({
|
|
|
- title: res.msg == '成功' ? '修改成功' : res.msg,
|
|
|
- icon: "none",
|
|
|
- mask: true
|
|
|
- });
|
|
|
- if (res.msg == '成功') {
|
|
|
- this.nodeDetail();
|
|
|
- if (init) this.showTeamDialog();
|
|
|
+ "userids": deleteUsers
|
|
|
}
|
|
|
+ }).then(s => {
|
|
|
+ console.log("先删除", s)
|
|
|
+ deleteUsers = [];
|
|
|
+ api._post({
|
|
|
+ "id": 20220930103603,
|
|
|
+ "content": {
|
|
|
+ ownertable: 'sa_workorder_node',
|
|
|
+ ownerid: this.data.mainData.sa_workorder_nodeid,
|
|
|
+ "userids": this.data.teams
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("添加成员", res)
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg == '成功' ? '修改成功' : res.msg,
|
|
|
+ icon: "none",
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ if (res.msg == '成功') {
|
|
|
+ this.nodeDetail();
|
|
|
+ if (init) this.showTeamDialog();
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
},
|