浏览代码

更改团组任务分配显示名称

wangh 2 年之前
父节点
当前提交
e9622889da
共有 1 个文件被更改,包括 16 次插入10 次删除
  1. 16 10
      src/components/OP/GroupsTaskAssignment.vue

+ 16 - 10
src/components/OP/GroupsTaskAssignment.vue

@@ -39,7 +39,7 @@
                 <div v-for="(  item, index  ) in   user  " :key="index"
                     style="margin-left: 5px;width: 200px;margin-top: 10px;">
                     <el-checkbox :label="item.id" :value="userStr.indexOf(item.id) != -1" border @change="check(item.id)">{{
-                        item.id
+                        item.name
                     }}</el-checkbox>
                 </div>
             </div>
@@ -108,28 +108,33 @@ export default {
                     that.userStr = res.data.data.userStr
                     that.TaskAssignment = res.data.data.taskAssignment
                     that.DelegationInfo = res.data.data.delegationInfo
+                } else {
+                    that.userStr = [];
+                    that.TaskAssignment = {};
+                    that.DelegationInfo = {}
                 }
             })
         },
         btn() {
             var id = 0
-            if (this.TaskAssignment.id != undefined) {
-                id = this.TaskAssignment.id;
+            var that = this;
+            if (that.TaskAssignment.id != undefined) {
+                id = that.TaskAssignment.id;
             }
             var url = "/api/Groups/GetTaskAssignmenOp";
             this.$axios({
                 method: 'post',
                 url: url,
                 data: {
-                    diId: id,
-                    ctId: this.ctId,
-                    uIdStr: this.userStr,
+                    diId: that.diId,
+                    ctId: that.ctId,
+                    uIdStr: that.userStr,
                     isEnable: 1,
-                    createUserId: this.userId,
+                    createUserId: that.userId,
                     remark: ""
                 },
                 headers: {
-                    Authorization: 'Bearer ' + this.token
+                    Authorization: 'Bearer ' + that.token
                 },
             }).then(function (res) {
                 if (res.data.code == 200) {
@@ -137,6 +142,8 @@ export default {
                         message: '保存成功!',
                         type: 'success'
                     });
+                } else {
+                    that.$message.error('保存失败!' + resp.data.msg);
                 }
             })
         },
@@ -151,9 +158,8 @@ export default {
         check(id) {
             var index = this.userStr.indexOf(id)
             if (index == -1) {
-                this.userStrAdd.push(id)
+                this.userStr.push(id)
             } else {
-
                 this.userStr = this.userStr.filter((x) => x !== id)
             }
         }