qinzhipeng_v@didiglobal.com 4 年之前
父节点
当前提交
fefe2ea206

+ 8 - 1
src/views/projectManage/components/demand.vue

@@ -80,7 +80,7 @@
               </span>
               <el-popover v-if="scope.row.isDirectlyFromDpm === -1" placement="bottom" title="关联望岳任务" width="400" trigger="click">
                 <div class="blueStr" />
-                <div v-for="(item, index) in dplOption" :key="index" class="Layout_space_between involveApp-top-bottom cursorPo" @click="setRelation(item, scope.row.id)">
+                <div v-for="(item, index) in dplOption" :key="index" class="Layout_space_between involveApp-top-bottom cursorPo" @click="throttle(item, scope.row.id)">
                   <span class="item-detail">{{ item.moduleInfoName }}</span>
                   <span class="item-details">{{ item.name }}</span>
                   <span class="item-detail">{{ item.taskId }}</span>
@@ -168,6 +168,7 @@
   </div>
 </template>
 <script>
+import _ from 'lodash'
 import { listByRequire, taskListAvailableDpmTask, taskSetTaskRelated, taskDeleteRelationship, taskShowRelatedDpmTask, taskSyncScheduleToDpm } from '@/api/requirement.js'
 import scheduleList from '@/views/projectManage/components/scheduleList.vue'
 import '@/styles/PublicStyle/index.scss' // 通用css
@@ -370,6 +371,12 @@ export default {
     jump(url) {
       window.open(url, '_blank')
     },
+    throttle: _.throttle(function() {
+      this.setRelation(...arguments)
+    }, 5000, {
+      leading: true,
+      trailing: false
+    }),
     async setRelation(item, taskId) { // 关联望月任务
       const res = await taskSetTaskRelated(taskId, item.id)
       if (res.code === 200) {

+ 4 - 1
src/views/projectManage/dialog_vue.vue

@@ -278,7 +278,10 @@ export default {
     },
     throttleTask: _.throttle(function() {
       this.create_task(...arguments)
-    }, 10000),
+    }, 5000, {
+      leading: true,
+      trailing: false
+    }),
     create_task(e) { // 创建任务(保存)
       this.$refs['task_form'].validate((valid) => {
         if (valid) {

+ 7 - 1
src/views/projectManage/taskList/taskViewDetail.vue

@@ -27,7 +27,7 @@
               <el-popover v-if="form_query.isDirectlyFromDpm === -1" placement="bottom" title="关联望岳任务" width="400" trigger="click" popper-class="synchronize">
                 <div class="blueStr" />
                 <div class="task-object-list">
-                  <div v-for="(item, index) in dplOption" :key="index" class="task-item" @click="synchronize(item.id)">
+                  <div v-for="(item, index) in dplOption" :key="index" class="task-item" @click="throttle(item.id)">
                     <span>{{ item.moduleInfoName }}</span>
                     <span class="item-name">{{ item.name }}</span>
                     <span class="item-id">{{ item.taskId }}</span>
@@ -815,6 +815,12 @@ export default {
         this.dplOption = res.data
       }
     },
+    throttle: _.throttle(function() {
+      this.synchronize(...arguments)
+    }, 5000, {
+      leading: true,
+      trailing: false
+    }),
     async synchronize(id) { // 关联至望岳
       const res = await taskSetTaskRelated(this.taskId, id)
       if (res.code === 200) {