Bladeren bron

2022.4.14拖拽调整

山水共长天一色 3 jaren geleden
bovenliggende
commit
6f0183d7b8

+ 6 - 0
fhKeeper/formulahousekeeper/timesheet/index.html

@@ -70,6 +70,12 @@
     </head>
     <body>
         <div id="app"></div>
+        <script>
+            document.body.ondrop = function(event) {
+            event.preventDefault()
+            event.stopPropagation()
+            }
+        </script>
         <!-- 引入Vue.js -->
         <script src="https://cdn.staticfile.org/vue/2.6.10/vue.min.js"></script>
         <!-- 引入vuex.js -->

+ 7 - 14
fhKeeper/formulahousekeeper/timesheet/src/views/project/projectInside.vue

@@ -109,15 +109,8 @@
                             <!--每个阶段的拖拽 -->
                             <!-- <transition-group > -->
                                 <v-flex class="taskStage"  v-for="stage in stageList" :key="stage.id" :style="'height:'+stageListHeight+'px;'">
-                                    <draggable group="task"
-                                    
-                                    class="taskList" 
-                                    :id="stage.id"
-                                    dragClass="dragClass"
-                                    ghostClass="ghost"
-                                    @start="drag=true" @end="drag=false" 
-                                    @update="onChange" @add="onChange"
-                                    draggable=".taskCard">
+                                    <div :id="stage.id"
+                                    class="taskList" >
                                         
                                         <!--头部显示阶段名称,操作 -->
                                         <div slot="header" style="margin:10px 0px;cursor:move;width:300px" role="task">
@@ -138,7 +131,7 @@
                                             </el-dropdown>
                                         </div>
 
-                                        <div class="taskListin" :style="'max-height:' + taskListinH + 'px;'">
+                                        <draggable class="taskListin" :style="'max-height:' + taskListinH + 'px;'" @start="drag=true" @end="drag=false" draggable=".taskCard" ghostClass="ghost" @update="onChange" @add="onChange" group="task1" :id="stage.id">
                                             <div v-for="element in stage.taskList" :id="element.id" :key="element.id" class="taskCard" ref="tasks" @click="editTask(element)" :style="element.taskStatus==0?'':'background:#eFeFeF;'">
                                                 <!--任务卡片内容显示 -->
                                                 <div>
@@ -169,9 +162,9 @@
                                                     </el-tooltip>
                                                 </div>
                                             </div>
-                                        </div>
+                                        </draggable>
                                         <el-button slot="footer" role="people" @click="addTask(stage)" style="width:300px;" size="small" icon="el-icon-plus"></el-button>
-                                    </draggable>
+                                    </div>
                                 </v-flex>
                             <!-- </transition-group > -->
                             <el-button slot="footer" v-if="selectedGroup != null" @click="addStage" class="taskList" icon="el-icon-plus" style="margin-top:30px;">新建任务列表</el-button>
@@ -1408,8 +1401,8 @@
             onChange(e) {
                 var data = {
                     id:e.item.id,
-                    oldIndex: e.oldIndex -1, 
-                    newIndex: e.newIndex -1,
+                    oldIndex: e.oldIndex , 
+                    newIndex: e.newIndex ,
                     oldStagesId: e.from.id,
                     newStagesId: e.to.id};
                 this.http.post('/task/changeOrder',data,