|
|
@@ -0,0 +1,144 @@
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
+
|
|
|
+Component({
|
|
|
+ options: {
|
|
|
+ addGlobalClass: true
|
|
|
+ },
|
|
|
+ properties: {
|
|
|
+ list: {
|
|
|
+ type: Array
|
|
|
+ },
|
|
|
+ disabled: {
|
|
|
+ type: Boolean
|
|
|
+ },
|
|
|
+ sa_workorderid: {
|
|
|
+ type: [String, Number]
|
|
|
+ },
|
|
|
+ projectleader: {
|
|
|
+ type: [String, Number]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ lifetimes: {
|
|
|
+ attached: function () {
|
|
|
+ getApp().globalData.Language.getLanguagePackage(this)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ showTeams: false
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ selectTeams(e) {
|
|
|
+ const {
|
|
|
+ userid
|
|
|
+ } = e.currentTarget.dataset.item;
|
|
|
+ let teams = this.data.teams;
|
|
|
+ let i = teams.findIndex(v => v == userid);
|
|
|
+ if (i != -1) {
|
|
|
+ teams = teams.filter(v => v != userid)
|
|
|
+ } else {
|
|
|
+ teams.push(userid)
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ teams
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addUser() {
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20220930103603,
|
|
|
+ "content": {
|
|
|
+ ownertable: 'sa_workorder',
|
|
|
+ ownerid: this.data.sa_workorderid,
|
|
|
+ "userids": this.data.teams,
|
|
|
+ "justuserids": 1
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("添加成员", res)
|
|
|
+ wx.showToast({
|
|
|
+ title: res.code == '1' ? getApp().globalData.Language.getMapText('修改成功') : res.msg,
|
|
|
+ icon: "none",
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ if (res.code == '1') {
|
|
|
+ this.showTeamDialog()
|
|
|
+ getCurrentPages().find(v => v.__route__ == 'E-service/workOrder/detail').getDetail()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showTeamDialog() {
|
|
|
+ if (!this.data.workers) _Http.basic({
|
|
|
+ "id": "20230213143003",
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ this.setData({
|
|
|
+ workers: res.data
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ showTeams: !this.data.showTeams,
|
|
|
+ teams: this.data.list.map(v => v.userid)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ callPhone(e) {
|
|
|
+ wx.makePhoneCall({
|
|
|
+ phoneNumber: e.currentTarget.dataset.number
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changeLeader(e) {
|
|
|
+ const {
|
|
|
+ detail
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ wx.showModal({
|
|
|
+ title: getApp().globalData.Language.getMapText('提示'),
|
|
|
+ content: getApp().globalData.Language.getMapText(`是否确认选择`) + getApp().globalData.Language.getMapText(detail.name) + getApp().globalData.Language.getMapText(`执行工单`) + '?',
|
|
|
+ confirmBtn: getApp().globalData.Language.getMapText('确定'),
|
|
|
+ cancelBtn: getApp().globalData.Language.getMapText('取消'),
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "content": {
|
|
|
+ "sa_workorderid": this.data.sa_workorderid,
|
|
|
+ "userid": detail.userid
|
|
|
+ },
|
|
|
+ "id": 2026012714183302,
|
|
|
+ }).then(res => {
|
|
|
+ getApp().globalData.Language.showToast(res.code == '1' ? "操作成功" : res.msg)
|
|
|
+ if (res.code == 1) getCurrentPages().find(v => v.__route__ == 'E-service/workOrder/detail').getDetail()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ deleteUser(e) {
|
|
|
+ const {
|
|
|
+ item
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ wx.showModal({
|
|
|
+ title: getApp().globalData.Language.getMapText('提示'),
|
|
|
+ content: getApp().globalData.Language.getMapText(`是否确认移除`) + '“' + item.name + '”' + getApp().globalData.Language.getMapText(`团队成员`) + '?',
|
|
|
+ confirmBtn: getApp().globalData.Language.getMapText('确定'),
|
|
|
+ cancelBtn: getApp().globalData.Language.getMapText('取消'),
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "id": 20220930103803,
|
|
|
+ "content": {
|
|
|
+ "ownertable": "sa_workorder",
|
|
|
+ "ownerid": this.data.sa_workorderid,
|
|
|
+ "userids": [item.userid]
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ getApp().globalData.Language.showToast(res.code == '1' ? "操作成功" : res.msg)
|
|
|
+ if (res.code == 1) getCurrentPages().find(v => v.__route__ == 'E-service/workOrder/detail').getDetail()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|