qinzhipeng_v vor 5 Jahren
Ursprung
Commit
bede0d38bd

+ 1 - 1
src/styles/PublicStyle/index.scss

@@ -126,7 +126,7 @@
   }
 
   .scroll { // 添加滚动条(记得设置height)
-    overflow:scroll;
+    overflow: scroll;
     overflow-x: hidden;
   }
 

+ 35 - 6
src/views/projectManage/iteration/components/PlanningIteration.vue

@@ -11,7 +11,7 @@
           </div>
           <el-divider />
           <el-container>
-            <el-main class="scroll" style="height: calc(100vh - 279px);">
+            <el-main class="scroll" style="height: calc(100vh - 279px);" @scroll.native="getScroll($event)">
               <el-checkbox-group v-if="citiesLeft.length>0" v-model="checkedCitiesLeft" @change="handleCheckedCitiesChange1">
                 <el-checkbox v-for="item in citiesLeft" :key="item.id" :label="item" class="Layout_flex_start" style="margin: 10px 0;">
                   <span
@@ -38,8 +38,8 @@
                 </div>
               </div>
             </el-main>
-            <el-footer style="text-align: center; height: 35px;">
-              <div v-if="citiesLeft.length > 15" class="solt public_Jump" @click="LoadMore">加载更多 </div>
+            <el-footer v-show="scrollBottom === 0" style="text-align: center; height: 35px;">
+              <el-button class="solt public_Jump" type="text" :loading="loadingBtn" :disabled="Load === '没有更多了'" @click="LoadMore">{{ Load }}</el-button>
             </el-footer>
           </el-container>
         </div>
@@ -61,7 +61,7 @@
           </div>
           <el-divider />
           <el-container>
-            <el-main class="scroll" style="height: calc(100vh - 279px);">
+            <el-main class="scroll" style="height: calc(100vh - 279px);" @scroll.native="getScrollTow($event)">
               <el-checkbox-group v-if="cities.length>0" v-model="checkedCities" @change="handleCheckedCitiesChange">
                 <el-checkbox v-for="item in cities" :key="item.id" :label="item" class="Layout_flex_start" style="margin: 10px 0;">
                   <span
@@ -88,8 +88,8 @@
                 </div>
               </div>
             </el-main>
-            <el-footer style="text-align: center; height: 35px;">
-              <div v-if="cities.length > 15" class="solt public_Jump" @click="LoadMore">加载更多 </div>
+            <el-footer v-show="scrollBottomRight === 0" style="text-align: center; height: 35px;">
+              <el-button class="solt public_Jump" type="text" :loading="loadingBtn" :disabled="LoadTow === '没有更多了'" @click="LoadMore">{{ LoadTow }}</el-button>
             </el-footer>
           </el-container>
         </div>
@@ -134,9 +134,16 @@ export default {
       checkedLeft: '',
       visibleplanning: this.show,
       value1: '',
+      Load: '加载更多',
+      LoadTow: '加载更多',
       iterationData: {}, // 当前迭代数据
       leftArray: [],
       rightArray: [],
+      scrollBottom: '', // 滚动条(左)
+      scrollBottomRight: '', // 滚动条(右)
+      loadingBtn: false, // 更多loading
+      citiesLeftTotal: '', // 左total
+      citiesTotal: '', // 右total
       reqRight: [],
       size: 50,
       bizId: localStorage.getItem('bizId')
@@ -163,7 +170,9 @@ export default {
       const iterationRequireList = iterationRequire({ id: this.iterationId, curIndex: 1, pageSize: 50, bizId: this.bizId })
       const iterationRequireRes = await iterationRequireList
       this.citiesLeft = iterationRequireRes.data.left.list // 无归属需求
+      this.citiesLeftTotal = iterationRequireRes.data.left.total
       this.cities = iterationRequireRes.data.right.list // 迭代下需求
+      this.citiesTotal = iterationRequireRes.data.right.total // 迭代下需求total
     },
 
     handleCheckAllChange(val) { // 迭代下需求全选
@@ -222,6 +231,23 @@ export default {
       this.checkedCitiesLeft = []
       this.checkedCities = []
     },
+
+    getScroll(event) { // 左侧滚动条监控
+      const scrollBottom = event.target.scrollHeight - event.target.scrollTop - event.target.clientHeight // 滚动条距离底部的距离scrollBottom
+      this.scrollBottom = scrollBottom
+      if (this.scrollBottom === 0) {
+        this.citiesLeft.length === this.citiesLeftTotal ? this.Load = '没有更多了' : ''
+      }
+    },
+
+    getScrollTow(event) { // 右侧滚动条监控
+      const scrollBottom = event.target.scrollHeight - event.target.scrollTop - event.target.clientHeight // 滚动条距离底部的距离scrollBottom
+      this.scrollBottomRight = scrollBottom
+      if (this.scrollBottomRight === 0) {
+        this.cities.length === this.citiesTotal ? this.LoadTow = '没有更多了' : ''
+      }
+    },
+
     addRequired() { // 保存迭代下需求
       const requirementIds = []
       const requiredArr = []
@@ -238,15 +264,18 @@ export default {
       iterationUpdateBelongingIteration(data).then(res => {
         if (res.code === 200) {
           this.$emit('update:show', false)
+          this.$emit('iteratioFilter')
           this.$message({ showClose: true, message: '保存成功', type: res.msg })
         }
       })
     },
 
     LoadMore() { // 加载更多
+      this.loadingBtn = true
       requirementQueryRequirementInfoList({ name: '', curIndex: 1, pageSize: this.size + 50, iterationId: -1, bizId: this.bizId }).then(res => {
         this.citiesLeft = res.data.list
         this.size = this.size + 50
+        this.loadingBtn = false
       })
     },
 

+ 3 - 4
src/views/projectManage/iteration/components/requiredTable.vue

@@ -297,14 +297,13 @@ export default {
           const currRow = _this.RequirementSet.splice(oldIndex, 1)[0]
           _this.RequirementSet.splice(newIndex, 0, currRow)
           const obj = {
-            id: [],
-            iterationId: ''
+            id: []
           }
           _this.RequirementSet.map(item => {
-            obj.iterationId = item.iterationId
             obj.id.push(item.id)
           })
-          iterationOrder(obj.id, obj.iterationId).then(res => {
+          console.log(_this.iterationId, 'cdcscdsc')
+          iterationOrder(obj.id, _this.iterationId).then(res => {
             if (res.code === 200) {
               _this.$message.success(res.msg)
               _this.iteratioFilter()

+ 2 - 1
src/views/projectManage/iteration/details/iterationDetails.vue

@@ -35,7 +35,7 @@
     </el-header>
     <el-main class="public_main">
       <!-- 需求 table -->
-      <required-table :iteration-id="iterationId" />
+      <required-table ref="requiredTable" :iteration-id="iterationId" />
     </el-main>
     <el-footer class="public_footer" />
     <!-- 删除 dialog -->
@@ -99,6 +99,7 @@ export default {
       const status = configShowIterationListEnum()
       const responseStatus = await status
       this.statusArr = responseStatus.data.iterationStatus
+      this.$refs.requiredTable.iteratioFilter()
     },
     changeIterationStatus(e) { // 修改状态
       iterationUpdate({ status: e, id: this.iterationData.id, name: this.iterationData.name, bizId: this.bizId }).then(res => {