瀏覽代碼

report time

scorpio 2 年之前
父節點
當前提交
9ee431e287
共有 4 個文件被更改,包括 92 次插入12 次删除
  1. 11 0
      src/api/task/index.js
  2. 21 3
      src/views/task/component/task.vue
  3. 3 3
      src/views/task/component/tasker.vue
  4. 57 6
      src/views/task/index.vue

+ 11 - 0
src/api/task/index.js

@@ -72,5 +72,16 @@ export default {
       '/blade-project-manage-v2/task-management/v2/move-file',
       params
     )
+  },
+  /**
+   * 用户列表
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  userList(params) {
+    return fetch(
+      '/blade-project-manage-v2/task-management/v2/get-user-list',
+      params
+    )
   }
 }

+ 21 - 3
src/views/task/component/task.vue

@@ -22,7 +22,7 @@
             :data="status"
             :status="form.taskStatus"
             @change="changeStatus($event, 1)"
-            :disabled="false"
+            :disabled="isFinish"
           />
         </div>
 
@@ -120,11 +120,16 @@
               type="textarea"
               :rows="5"
               v-model="form.taskProcess"
+              :disabled="isFinish"
             ></el-input>
           </div>
           <div class="flex flex-justify-start mt-10 full-width">
             <div class="title mr-10">成果文件:</div>
-            <upload-office @success="uploadResult" :max="1" />
+            <upload-office
+              @success="uploadResult"
+              :max="1"
+              v-if="isFinish === false"
+            />
           </div>
           <div class="full-width flex flex-justify-start">
             <div class="title mr-10" />
@@ -201,6 +206,7 @@ export default {
   },
   data() {
     return {
+      isFinish: false,
       showDialog: false,
       fileList: [],
       loading: false,
@@ -315,6 +321,9 @@ export default {
     show(type) {
       if (type !== 1) {
         this.form = this.task
+        if (this.task.taskStatus === 3 || this.task.taskStatus === 4) {
+          this.isFinish = true
+        }
         this.init(this.task)
       } else {
         this.form.taskStatus = 0
@@ -350,11 +359,19 @@ export default {
         this.saveResultFile()
       }
 
-      if (this.form.taskStatus === 3 && this.isMove === false) {
+      if (
+        this.form.taskStatus === 3 &&
+        this.isMove === false &&
+        this.isFinish === false
+      ) {
         // 已完成 需要转移文件
         this.$refs.move.showDialog()
         return
       }
+      if (this.isFinish) {
+        this.showDialog = false
+        return
+      }
       // 从项目详情,添加任务
       if (this.projectId !== undefined && this.projectId.length > 0) {
         this.form.projectId = this.projectId
@@ -428,6 +445,7 @@ export default {
       this.showDialog = false
       this.editResult = false
       this.isMove = false
+      this.isFinish = false
     },
     /**
      * 文件移动成功

+ 3 - 3
src/views/task/component/tasker.vue

@@ -58,7 +58,7 @@
                 ></el-avatar>
                 <div class="ml-5">{{ i.name }}</div>
               </div>
-              <el-tag>出差中</el-tag>
+              <el-tag v-if="i.workStatus.length > 0">{{ i.workStatus }}</el-tag>
             </div>
           </div>
         </div>
@@ -115,8 +115,8 @@ export default {
   },
   methods: {
     getUser() {
-      const data = { realName: this.keyword, deptId: this.user.info.deptId }
-      this.$api.role.userList(data).then(res => {
+      const data = { account: '', name: this.keyword }
+      this.$api.task.userList(data).then(res => {
         if (res.code === 200) {
           this.list = res.data.map(ele => {
             ele.avatar = ele.avatar

+ 57 - 6
src/views/task/index.vue

@@ -2,18 +2,45 @@
   <el-card shadow="hover" class="margin">
     <div class="full-width flex flex-center flex-justify-start">
       <el-button-group>
-        <el-button type="primary" icon="el-icon-edit">全部任务</el-button>
-        <el-button type="primary" plain icon="el-icon-share"
+        <el-button
+          type="primary"
+          :plain="type !== 1"
+          icon="el-icon-edit"
+          @click="changeType(1)"
+          >全部任务
+        </el-button>
+        <el-button
+          type="primary"
+          :plain="type !== 2"
+          icon="el-icon-share"
+          @click="changeType(2)"
           >我创建的
         </el-button>
-        <el-button type="primary" plain icon="el-icon-delete"
+        <el-button
+          type="primary"
+          :plain="type !== 3"
+          icon="el-icon-delete"
+          @click="changeType(3)"
           >我执行的
         </el-button>
       </el-button-group>
     </div>
-    <div class="flex flex-center flex-justify-start flex-col full-width">
+    <div class="flex flex-center flex-justify-end flex-col full-width mt-20">
       <div class="full-width flex flex-justify-start">
-        <span>按时间排序</span>
+        <el-dropdown @command="dropDown">
+          <span class="flex flex-center">
+            按时间排序
+            <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-menu>
+          </template>
+        </el-dropdown>
       </div>
       <div class="full-width">
         <task-table
@@ -24,6 +51,16 @@
           @refresh="getTaskList"
         ></task-table>
       </div>
+      <el-divider />
+      <div class="flex flex-center flex-justify-end full-width">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          :total="total"
+          v-model:current-page="page.curren"
+          @current-change="pageChange"
+        />
+      </div>
       <task type="view" ref="task" :task="task"></task>
     </div>
   </el-card>
@@ -44,6 +81,11 @@ export default {
   components: { Task, TaskTable },
   data() {
     return {
+      page: {
+        current: 1,
+        size: 10
+      },
+      type: 1,
       data: [],
       task: [],
       taskId: '',
@@ -83,8 +125,13 @@ export default {
     this.getTaskList()
   },
   methods: {
+    changeType(type) {
+      this.type = type
+      this.getTaskList()
+    },
     getTaskList() {
-      this.$api.task.taskList({}).then(res => {
+      const data = { type: this.type, ...this.page }
+      this.$api.task.taskList(data).then(res => {
         if (res.code === 200) {
           this.data = res.data.records
           this.total = res.data.total
@@ -93,6 +140,10 @@ export default {
     },
     rowClick(res) {
       this.taskId = res.id
+    },
+    pageChange(current) {
+      this.page.current = current
+      this.getTaskList()
     }
   }
 }