scorpio 2 years ago
parent
commit
052ad8f2b9
2 changed files with 31 additions and 11 deletions
  1. 21 7
      src/views/dash/compoents/profile.vue
  2. 10 4
      src/views/task/index.vue

+ 21 - 7
src/views/dash/compoents/profile.vue

@@ -16,6 +16,7 @@
       <el-input
         :placeholder="placeholder"
         size="large"
+        maxlength="6"
         v-model="status"
         class="input"
       ></el-input>
@@ -27,6 +28,7 @@
           :key="icon.value"
           :src="icon.icon"
           class="icon-task"
+          @click="changeWorkStatus(icon)"
         />
       </div>
     </div>
@@ -57,6 +59,7 @@ export default {
     return {
       status: '',
       placeholder: '请填写状态(最长6个字符)',
+      id: '',
       icons: [
         {
           icon: new URL('../../../assets/svg/task/work.svg', import.meta.url)
@@ -93,19 +96,30 @@ export default {
       this.$api.dash.workInfo().then(res => {
         if (res.code === 200) {
           this.placeholder = res.data.workStatusDescribe
+            ? res.data.workStatusDescribe
+            : '请填写状态(最长6个字符)'
+          this.id = res.data.id === -1 ? '' : res.data.id
         } else {
           console.log(res)
         }
       })
     },
     update() {
-      this.$api.dash.submit({ workStatusDescribe: this.status }).then(res => {
-        if (res.code === 200) {
-          console.log(res)
-        } else {
-          console.log(res)
-        }
-      })
+      if (this.status.length === 0) {
+        return
+      }
+      this.$api.dash
+        .submit({ id: this.id, workStatusDescribe: this.status })
+        .then(res => {
+          if (res.code === 200) {
+            console.log(res)
+          } else {
+            console.log(res)
+          }
+        })
+    },
+    changeWorkStatus(res) {
+      this.status = res.tips
     }
   }
 }

+ 10 - 4
src/views/task/index.vue

@@ -29,15 +29,15 @@
       <div class="full-width flex flex-justify-start">
         <el-dropdown @command="dropDown">
           <span class="flex flex-center">
-            按时间排序
+            {{ isGroup === 0 ? '按时间排序' : '按项目排序' }}
             <el-icon class="el-icon--right">
               <arrow-down />
             </el-icon>
           </span>
           <template #dropdown>
             <el-dropdown-menu>
-              <el-dropdown-item command="info">按时间排序</el-dropdown-item>
-              <el-dropdown-item command="logout">按项目排序</el-dropdown-item>
+              <el-dropdown-item command="0">按时间排序</el-dropdown-item>
+              <el-dropdown-item command="1">按项目排序</el-dropdown-item>
             </el-dropdown-menu>
           </template>
         </el-dropdown>
@@ -93,6 +93,7 @@ export default {
       task: [],
       taskId: '',
       total: 0,
+      isGroup: 0,
       option: {
         showCheckBox: false,
         folderChecked: true,
@@ -134,7 +135,7 @@ export default {
       this.getTaskList()
     },
     getTaskList() {
-      const data = { type: this.type, ...this.page }
+      const data = { type: this.type, isGroup: this.isGroup, ...this.page }
       this.$api.task.taskList(data).then(res => {
         if (res.code === 200) {
           this.data = res.data.records
@@ -148,6 +149,11 @@ export default {
     pageChange(current) {
       this.page.current = current
       this.getTaskList()
+    },
+    dropDown(res) {
+      this.isGroup = res
+      this.page.current = 1
+      this.getTaskList()
     }
   }
 }