scorpioyq %!s(int64=2) %!d(string=hai) anos
pai
achega
304ac36984

+ 40 - 28
src/views/task/component/task-table.vue

@@ -44,7 +44,7 @@
               class="full-width full-height flex flex-justify-start flex-align-center"
             >
               <div class="level" />
-              <wt-tag :data="data" />
+              <wt-tag :data="status" @change="changeStatus()" />
               {{ row[column.prop] }}
             </div>
           </div>
@@ -112,10 +112,23 @@ export default {
       default: null
     }
   },
+  // watch: {
+  //   data: {
+  //     handler(val) {
+  //       if (val) {
+  //         this.status = this.fetchIndex(this.status, val[0].taskStatus)
+  //       }
+  //     },
+  //     immediate: true
+  //   }
+  // },
   data() {
     return {
       task: null,
-      data: [
+      info: {
+        taskStatus: ''
+      },
+      status: [
         {
           title: '待确认',
           value: 0,
@@ -146,36 +159,21 @@ export default {
           color: '#C72A29',
           checked: false
         }
-      ],
-      data1: [
-        {
-          title: 'P1',
-          value: 0,
-          color: '#C72A29',
-          checked: true
-        },
-        {
-          title: 'P2',
-          value: 1,
-          color: '#E89D42',
-          checked: false
-        },
-        {
-          title: 'P3',
-          value: 2,
-          color: '#47A6EA',
-          checked: false
-        },
-        {
-          title: 'P4',
-          value: 3,
-          color: '#A0A0A0',
-          checked: false
-        }
       ]
     }
   },
   methods: {
+    fetchIndex(list, key) {
+      const index = list.findIndex(ele => ele.value === key)
+      if (index > -1) {
+        list.map(ele => {
+          ele.checked = false
+          return ele
+        })
+        list[index].checked = true
+      }
+      return list
+    },
     addTask() {
       this.$refs.task.show()
     },
@@ -183,6 +181,20 @@ export default {
       this.$emit('rowClick', item)
       this.task = item
       this.$refs.task.show()
+    },
+    changeStatus(res) {
+      this.info.taskStatus = res.value
+      this.submit()
+    },
+    submit() {
+      this.$api.task.addTask(this.info).then(res => {
+        this.showDialog = false
+        if (res.code === 200) {
+          this.$message.success(res.msg)
+        } else {
+          this.$message.error(res.msg)
+        }
+      })
     }
   }
 }

+ 6 - 6
src/views/task/component/task.vue

@@ -10,12 +10,12 @@
       <div class="mt-10">
         <div class="flex flex-center flex-justify-start">
           <span class="mr-10 title flex flex-justify-start">状态:</span>
-          <wt-tag :data="data" @change="changeStatus($event, 1)" />
+          <wt-tag :data="status" @change="changeStatus($event, 1)" />
         </div>
 
         <div class="mt-10 flex flex-center flex-justify-start">
           <span class="mr-10 title flex flex-justify-start">优先级:</span>
-          <wt-tag :data="data1" @change="changeStatus($event, 2)" />
+          <wt-tag :data="level" @change="changeStatus($event, 2)" />
         </div>
 
         <div class="mt-10 flex flex-center flex-justify-start">
@@ -126,8 +126,8 @@ export default {
       handler(val) {
         if (val) {
           this.form = val
-          this.data = this.fetchIndex(this.data, this.form.taskStatus)
-          this.data1 = this.fetchIndex(this.data1, this.form.level)
+          this.status = this.fetchIndex(this.status, this.form.taskStatus)
+          this.level = this.fetchIndex(this.level, this.form.level)
           if (val.files !== undefined && val.files.length > 0) {
             this.fileList = val.files.map(ele => {
               return {
@@ -156,7 +156,7 @@ export default {
         tags: '',
         taskProcess: ''
       },
-      data: [
+      status: [
         {
           title: '待确认',
           value: 0,
@@ -188,7 +188,7 @@ export default {
           checked: false
         }
       ],
-      data1: [
+      level: [
         {
           title: 'P1',
           value: 0,

+ 1 - 2
src/views/task/component/wt-tag.vue

@@ -47,7 +47,6 @@ export default {
       handler(val) {
         if (val && val.length > 0) {
           this.current = val.find(e => e.checked)
-          console.log(this.current)
         }
       },
       immediate: true
@@ -55,7 +54,7 @@ export default {
   },
   data() {
     return {
-      current: { color: '#D7D7D7', title: '待确认' }
+      current: {}
     }
   },
   methods: {

+ 1 - 8
src/views/task/index.vue

@@ -42,14 +42,7 @@ export default {
   components: { Task, TaskTable },
   data() {
     return {
-      data: [
-        {
-          title: '项目建议书编1写,需要快点'
-        },
-        {
-          title: '项目建议书编写,需要快点'
-        }
-      ],
+      data: [],
       task: [],
       taskId: '',
       option: {