Bläddra i källkod

工作台审核功能修改

yanshichao 1 år sedan
förälder
incheckning
171a22d2a9
2 ändrade filer med 18 tillägg och 4 borttagningar
  1. 16 2
      src/views/dashboard/index.vue
  2. 2 2
      src/views/task/components/taskDetail.vue

+ 16 - 2
src/views/dashboard/index.vue

@@ -83,7 +83,7 @@
     <el-dialog :title="detailForm.taskName" :visible.sync="auditOpen" width="900px" class="i-audit-dialog"
                append-to-body
                :close-on-click-modal="false">
-      <el-carousel trigger="click" height="630px"  :autoplay="false"
+      <el-carousel ref="auditCarousel" trigger="click" height="630px" :autoplay="false" indicator-position="none"
                    @change="auditTaskChange">
         <el-carousel-item v-for="item in carouselNum" :key="item">
           <task-detail :detail-form="detailForm"></task-detail>
@@ -155,6 +155,7 @@ export default {
       enforceRemindCount: 0,
 
       carouselNum: 0,
+      currentCarouselIndex: 0,
       detailForm: {},
       auditForm: {},
       auditOpen: false,
@@ -261,7 +262,7 @@ export default {
         return
       }
       this.carouselNum = this.auditTasks.length
-      let auditTask = this.auditTasks[0];
+      let auditTask = this.auditTasks[this.currentCarouselIndex];
       getTask(auditTask.id).then(res => {
         this.detailForm = res.data;
         this.auditForm = {
@@ -287,6 +288,13 @@ export default {
         refs[key].resetFields()
         refs[key].clearValidate()
       }
+
+      let abs = Math.abs(currIndex - oldIndex);
+      if (abs != 1 && abs != this.auditTasks.length) {
+        this.$refs.auditCarousel.setActiveItem(this.currentCarouselIndex)
+        return
+      }
+
       let auditTask = this.auditTasks[currIndex];
       getTask(auditTask.id).then(res => {
         this.detailForm = res.data;
@@ -307,6 +315,11 @@ export default {
           auditTask(this.auditForm).then(res => {
             this.$message.success("操作成功");
             this.auditTasks.splice(index - 1, 1)
+            this.currentCarouselIndex = index - 1
+            if (index - 1 === this.auditTasks.length) {
+              this.currentCarouselIndex = 0
+            }
+            this.$refs.auditCarousel.setActiveItem(this.currentCarouselIndex)
             this.handleAudit();
           })
         }
@@ -316,6 +329,7 @@ export default {
     // 取消按钮(详情/审核)
     auditCancel() {
       // this.detailForm = {};
+      this.currentCarouselIndex = 0
       this.auditForm = {
         taskId: undefined,
         auditResult: undefined,

+ 2 - 2
src/views/task/components/taskDetail.vue

@@ -293,12 +293,12 @@ export default {
 
 .description {
   margin-top: -13px;
-  max-height: 300px;
+  max-height: 270px;
   overflow: auto;
 }
 
 .footer {
-  margin-top: 20px;
+  margin-top: 10px;
   margin-left: 10px;
   display: flex;
   justify-content: start;