Переглянути джерело

Merge remote-tracking branch 'origin/develop' into develop

scorpioyq 2 роки тому
батько
коміт
1e95f40f98

+ 3 - 49
src/api/task/index.js

@@ -13,58 +13,12 @@ export default {
       'json'
     )
   },
-  taskList(params) {
-    //任务列表
-    return fetch('/blade-project-manage-v2/task-management/v2/page', params)
-  },
-  issuedRecords(params) {
-    return fetch('/blade-project-manage-v2/userTask/v2/record', params)
-  },
-  detail(params) {
-    return fetch('/blade-project-manage-v2/userTask/v2/detail', params)
-  },
   /**
-   * 任务完成详情
+   * 任务列表
    * @param params
    * @returns {Promise | Promise<unknown>}
    */
-  confirmDetail(params) {
-    return fetch('/blade-project-manage-v2/userTask/v2/confirmDetail', params)
-  },
-  taskConfirm(params) {
-    return fetch('/blade-project-manage-v2/userTask/v2/confirm', params)
-  },
-  taskRemove(params) {
-    return fetch('/blade-project-manage-v2/folder/v2/remove', params, 'post')
-  },
-  /**
-   * 根据文件夹id 获取下级文件
-   * @param params
-   * @returns {Promise | Promise<unknown>}
-   */
-  fileList(params) {
-    return fetch(
-      '/blade-project-manage-v2/userTask/v2/getListByParentId',
-      params
-    )
-  },
-  /**
-   * 上传文件任务
-   */
-  uploadFile(params) {
-    return fetch(
-      '/blade-project-manage-v2/userTask/v2/uploadFile',
-      params,
-      'post',
-      'json'
-    )
-  },
-  /**
-   * 完成任务提交
-   * @param params
-   * @returns {Promise<unknown>}
-   */
-  completeTask(params) {
-    return fetch('/blade-project-manage-v2/userTask/v2/commit', params)
+  taskList(params) {
+    return fetch('/blade-project-manage-v2/task-management/v2/page', params)
   }
 }

+ 81 - 0
src/views/home/component/params/params8.vue

@@ -0,0 +1,81 @@
+<template>
+  <div
+    class="flex flex-center full-width flex-justify-between mt-10 mb-10 flex-col"
+  >
+    <span class="full-width text-left bold mt-20 mb-10">编制任务</span>
+    <div style="width: 92%">
+      <task-table
+        :option="option"
+        :data="data"
+        :project-id="detail.id"
+      ></task-table>
+    </div>
+  </div>
+</template>
+
+<script>
+import TaskTable from '@/views/task/component/task-table.vue'
+
+export default {
+  components: { TaskTable },
+  props: {
+    detail: {
+      type: Object,
+      default: null
+    }
+  },
+  watch: {
+    detail: {
+      handler(val) {
+        if (val !== null && val !== undefined) {
+          this.list()
+        }
+      },
+      immediate: true
+    }
+  },
+  data() {
+    return {
+      data: [{ title: '33' }],
+      task: {},
+      option: {
+        showCheckBox: false,
+        folderChecked: true,
+        column: [
+          {
+            label: '共20个任务',
+            prop: 'title',
+            display: false,
+            width: 400
+          },
+          {
+            label: '标签',
+            prop: 'createUserName'
+          },
+          {
+            label: '时间',
+            prop: 'createUserName'
+          },
+          {
+            label: '执行人',
+            prop: 'createTime'
+          }
+        ]
+      }
+    }
+  },
+  methods: {
+    list() {
+      this.$api.task
+        .taskList({ projectId: this.detail.id, level: 1 })
+        .then(res => {
+          if (res.code === 200) {
+            this.data = res.data.records
+          }
+        })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 3 - 0
src/views/home/pro_detail.vue

@@ -24,6 +24,7 @@
         <basic-container v-for="(item, index) in resultList" :key="item.id">
           <div class="full-width padding-top" :id="`header` + (index + 1)">
             <params1 v-if="item.dictKey === '1'" :info="item" :detail="data" />
+            <params8 v-if="item.dictKey === '1'" :info="item" :detail="data" />
             <params2 v-if="item.dictKey === '2'" :info="item" :detail="data" />
             <params7 v-if="item.dictKey === '3'" :info="item" :detail="data" />
             <params4 v-if="item.dictKey === '4'" :info="item" :detail="data" />
@@ -64,6 +65,7 @@ import params4 from '@/views/home/component/params/params4.vue'
 import params5 from '@/views/home/component/params/params5.vue'
 import params6 from '@/views/home/component/params/params6.vue'
 import params7 from '@/views/home/component/params/params7.vue'
+import params8 from '@/views/home/component/params/params8.vue'
 import inspect1 from '@/views/home/component/inspect/Inspect1.vue'
 import dispatch from '@/views/home/component/dispatch.vue'
 
@@ -80,6 +82,7 @@ export default {
     params5,
     params6,
     params7,
+    params8,
     dispatch
   },
   data() {

+ 25 - 2
src/views/task/component/task-table.vue

@@ -1,5 +1,10 @@
 <template>
   <div>
+    <div class="full-width flex flex-center flex-justify-start">
+      <el-button type="primary" icon="el-icon-plus" @click="addTask"
+        >新增任务</el-button
+      >
+    </div>
     <div class="header flex flex-justify-between full-width">
       <div
         v-for="(item, index) in option.column"
@@ -9,6 +14,7 @@
         <div
           v-if="index === 0"
           class="flex-child-shrink flex flex-justify-start first"
+          :style="`width:` + item.width + 'px'"
         >
           {{ item.label }}
         </div>
@@ -31,7 +37,8 @@
         >
           <div
             v-if="index === 0"
-            class="first full-height flex flex-center flex-justify-start"
+            class="full-height flex flex-center flex-justify-start"
+            :style="`width:` + column.width + 'px'"
           >
             <div
               class="full-width full-height flex flex-justify-start flex-align-center"
@@ -74,15 +81,21 @@
         </div>
       </div>
     </div>
+    <task ref="task" :task="task" :project-id="projectId"></task>
   </div>
 </template>
 
 <script>
 import WtTag from '@/views/task/component/wt-tag.vue'
+import Task from '@/views/task/component/task.vue'
 
 export default {
-  components: { WtTag },
+  components: { Task, WtTag },
   props: {
+    projectId: {
+      type: String,
+      default: ''
+    },
     data: {
       type: Array,
       default: []
@@ -92,9 +105,19 @@ export default {
       default: null
     }
   },
+  data() {
+    return {
+      task: null
+    }
+  },
   methods: {
+    addTask() {
+      this.$refs.task.show()
+    },
     rowClick(item) {
       this.$emit('rowClick', item)
+      this.task = item
+      this.$refs.task.show()
     }
   }
 }

+ 103 - 23
src/views/task/component/task.vue

@@ -1,37 +1,41 @@
 <template>
-  <el-dialog v-model="showDialog">
+  <el-dialog v-model="showDialog" width="800">
     <template #header>
       <div class="full-width flex flex-center flex-justify-between">
         <h4>任务详情</h4>
       </div>
     </template>
     <div>
-      <el-input v-model="form.title"></el-input>
+      <el-input v-model="form.title" placeholder="请输入任务名称"></el-input>
       <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" />
+          <wt-tag :data="data" @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" />
+          <wt-tag :data="data1" @change="changeStatus($event, 2)" />
         </div>
 
         <div class="mt-10 flex flex-center flex-justify-start">
           <span class="mr-10 title flex flex-justify-start">时间:</span>
           <div class="flex flex-center">
             <el-date-picker
-              v-model="value1"
+              v-model="form.startTime"
               type="date"
               placeholder="设置开始日期"
+              format="YYYY-MM-DD"
+              value-format="YYYY-MM-DD"
             >
             </el-date-picker>
             <div class="ml-5 mr-5">至</div>
             <el-date-picker
-              v-model="value1"
+              v-model="form.endTime"
               type="date"
               placeholder="设置截止日期"
+              format="YYYY-MM-DD"
+              value-format="YYYY-MM-DD"
             >
             </el-date-picker>
           </div>
@@ -45,24 +49,32 @@
         </div>
         <div class="mt-10 flex flex-align-start flex-justify-start">
           <span class="mr-10 title flex flex-justify-start">备注:</span>
-          <el-input type="textarea" :rows="5"></el-input>
+          <el-input type="textarea" :rows="5" v-model="form.remark"></el-input>
         </div>
 
         <div class="mt-10 flex flex-align-start flex-justify-start flex-col">
           <div class="flex flex-center flex-justify-start">
             <span class="mr-10 title flex flex-justify-start">关联附件:</span>
-            <filepicker project-id="" />
+            <filepicker :project-id="projectId" @submit="selection" />
           </div>
           <div class="flex flex-center flex-justify-start full-width mt-10">
             <div class="title mr-10"></div>
-            <el-input type="textarea" :rows="5"></el-input>
+            <div>
+              <div v-for="item in fileList" :key="item.id">
+                {{ item.title }}
+              </div>
+            </div>
           </div>
         </div>
 
         <div class="flex flex-justify-start full-width flex-col">
           <div class="mt-10 flex flex-align-start flex-justify-start">
             <span class="mr-10 title flex flex-justify-start">任务进展:</span>
-            <el-input type="textarea" :rows="5"></el-input>
+            <el-input
+              type="textarea"
+              :rows="5"
+              v-model="form.taskProcess"
+            ></el-input>
           </div>
           <div class="flex flex-justify-start flex-center mt-10 full-width">
             <div class="title mr-10" />
@@ -75,7 +87,7 @@
       </div>
       <div class="flex flex-justify-end full-width">
         <el-button type="primary" plain>取 消</el-button>
-        <el-button type="primary">确 定</el-button>
+        <el-button type="primary" @click="submit">确 定</el-button>
       </div>
     </div>
   </el-dialog>
@@ -89,15 +101,31 @@ import filepicker from '@/components/filepicker/index.vue'
 export default {
   components: { Tasker, WtTag, filepicker },
   props: {
+    projectId: {
+      type: String,
+      default: ''
+    },
     task: {
       type: Object,
-      default: {}
+      default: () => {
+        return null
+      }
     }
   },
   watch: {
     task: {
       handler(val) {
-        this.form = 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.fileList = val.files.map(ele => {
+            return {
+              fileId: ele.id,
+              title: ele.title
+            }
+          })
+        }
       },
       immediate: true
     }
@@ -105,61 +133,112 @@ export default {
   data() {
     return {
       showDialog: false,
-      form: null,
+      fileList: [],
+      form: {
+        title: ''
+      },
       data: [
         {
           title: '待确认',
           value: 0,
-          color: '#D7D7D7'
+          color: '#D7D7D7',
+          checked: true
         },
         {
           title: '进行中',
           value: 1,
-          color: '#47A6EA'
+          color: '#47A6EA',
+          checked: false
         },
         {
           title: '已完成',
           value: 2,
-          color: '#80B336'
+          color: '#80B336',
+          checked: false
         },
         {
           title: '已关闭',
           value: 3,
-          color: '#ECAB56'
+          color: '#ECAB56',
+          checked: false
         },
         {
           title: '已取消',
           value: 4,
-          color: '#C72A29'
+          color: '#C72A29',
+          checked: false
         }
       ],
       data1: [
         {
           title: 'P1',
           value: 0,
-          color: '#C72A29'
+          color: '#C72A29',
+          checked: true
         },
         {
           title: 'P2',
           value: 1,
-          color: '#E89D42'
+          color: '#E89D42',
+          checked: false
         },
         {
           title: 'P3',
           value: 2,
-          color: '#47A6EA'
+          color: '#47A6EA',
+          checked: false
         },
         {
           title: 'P4',
           value: 3,
-          color: '#A0A0A0'
+          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
+    },
     show() {
       this.showDialog = true
+    },
+    changeStatus(res, type) {
+      if (type === 1) {
+        this.form.taskStatus = res.value
+      } else {
+        this.form.level = res.value
+      }
+    },
+    submit() {
+      this.form.projectId = this.projectId
+      this.form.relatedIds = this.fileList.map(ele => ele.fileId).join(',')
+      this.$api.task.addTask(this.form).then(res => {
+        if (res.code === 200) {
+          this.showDialog = false
+          this.$message.success(res.msg)
+        } else {
+          this.$message.error(res.msg)
+        }
+      })
+    },
+    selection(list) {
+      this.fileList = list.map(ele => {
+        return {
+          fileId: ele.id,
+          title: ele.title
+        }
+      })
+      console.log(this.fileList)
     }
   }
 }
@@ -174,6 +253,7 @@ export default {
   box-shadow: none;
   font-weight: bold;
   font-size: 16px;
+  background-color: #eeeeee;
 }
 
 :deep(.el-input__wrapper:hover) {

+ 4 - 3
src/views/task/component/wt-tag.vue

@@ -45,8 +45,9 @@ export default {
   watch: {
     data: {
       handler(val) {
-        if (val && val.length > 1) {
-          this.current = val[0]
+        if (val && val.length > 0) {
+          this.current = val.find(e => e.checked)
+          console.log(this.current)
         }
       },
       immediate: true
@@ -59,8 +60,8 @@ export default {
   },
   methods: {
     dropDown(res) {
-      console.log(res)
       this.current = res
+      this.$emit('change', this.current)
     }
   }
 }

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

@@ -61,7 +61,7 @@ export default {
             label: '共20个任务',
             prop: 'title',
             display: false,
-            width: 400
+            width: 600
           },
           {
             label: '标签',