| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- 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()
- })
- }
- })
- }
- }
- })
|