From c832bf2e80ac465e71b7a1c1f7a59d4252030989 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 05 Aug 2025 17:33:08 +0800
Subject: [PATCH] feat:事件工单滚动条

---
 src/views/odm/task.vue |  292 +++++++++++++++++++++++++++-------------------------------
 1 files changed, 137 insertions(+), 155 deletions(-)

diff --git a/src/views/odm/task.vue b/src/views/odm/task.vue
index a6d1744..6dbe74c 100644
--- a/src/views/odm/task.vue
+++ b/src/views/odm/task.vue
@@ -1,25 +1,9 @@
 <template>
   <basic-container>
-    <avue-crud
-      :option="option"
-      :table-loading="loading"
-      :data="data"
-      v-model:page="page"
-      ref="crud"
-      @row-del="rowDel"
-      v-model="form"
-      :permission="permissionList"
-      @row-update="rowUpdate"
-      @row-save="rowSave"
-      :before-open="beforeOpen"
-      @search-change="searchChange"
-      @search-reset="searchReset"
-      @selection-change="selectionChange"
-      @current-change="currentChange"
-      @size-change="sizeChange"
-      @refresh-change="refreshChange"
-      @on-load="onLoad"
-    >
+    <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" ref="crud" @row-del="rowDel"
+      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
+      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
+      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
       <template #menu-left>
         <!-- <el-button
           type="danger"
@@ -37,21 +21,13 @@
         {{ formatSeconds(row.processingTime) }}
       </template>
       <template #menu="scope">
-        <el-button
-          type="primary"
-          text
-          icon="el-icon-guide"
+        <el-button type="primary" text icon="el-icon-guide"
           v-if="permission.odm_task_handle && scope.row.taskId == null"
-          @click.stop="atHandle(scope.row, scope.index)"
-          >立即启动
+          @click.stop="atHandle(scope.row, scope.index)">立即启动
         </el-button>
-        <el-button
-          type="primary"
-          text
-          icon="el-icon-refresh-right"
+        <el-button type="primary" text icon="el-icon-refresh-right"
           v-if="(permission.odm_task_handle && scope.row.status == 30) || scope.row.status == 50"
-          @click.stop="restartHandle(scope.row, scope.index)"
-          >重新启动
+          @click.stop="restartHandle(scope.row, scope.index)">重新启动
         </el-button>
       </template>
     </avue-crud>
@@ -59,12 +35,12 @@
 </template>
 
 <script>
-import { getList, remove, update, add, createOdmTask, restartOdmTask } from '@/api/odm/task';
-import { tourStrategies } from 'element-plus';
-import { mapGetters } from 'vuex';
+import { getList, remove, update, add, createOdmTask, restartOdmTask } from '@/api/odm/task'
+import { tourStrategies } from 'element-plus'
+import { mapGetters } from 'vuex'
 
 export default {
-  data() {
+  data () {
     return {
       form: {},
       query: {},
@@ -76,8 +52,6 @@
       },
       selectionList: [],
       option: {
-        height: 'auto',
-        calcHeight: 32,
         dialogWidth: 950,
         tip: false,
         searchShow: true,
@@ -92,14 +66,19 @@
         dialogClickModal: false,
         grid: false,
         menuWidth: 260,
+
+        height: 'auto',
+        calcHeight: 20,
+
         column: [
           {
             label: '任务名称',
             prop: 'taskName',
             search: true,
-            searchSpan:4,
-            labelWidth: 130,
-            searchPlaceholder:"任务名称",
+            searchSpan: 4,
+            searchLabelWidth: 100,
+            //labelWidth: 130,
+            searchPlaceholder: "任务名称",
             rules: [
               {
                 required: true,
@@ -139,7 +118,7 @@
             prop: 'waylineJobId',
             addDisplay: false,
             editDisplay: false,
-            hide:true,
+            hide: true,
             labelWidth: 130,
             width: 160,
           },
@@ -148,10 +127,11 @@
             prop: 'waylineType',
             type: 'select',
             search: true,
-            searchSpan: 3,
-            width: 100,
+            searchSpan: 4,
+            searchLabelWidth: 100,
+            //width: 100,
             labelWidth: 130,
-            searchPlaceholder:"任务类型",
+            searchPlaceholder: "任务类型",
             dicData: [
               {
                 label: '航测',
@@ -166,9 +146,9 @@
           {
             label: '机场名称',
             prop: 'airportName',
-            labelWidth: 130,
-            search: true,
             searchSpan: 4,
+            searchLabelWidth: 100,
+            //search: true,
           },
           {
             label: '图片数量',
@@ -193,9 +173,11 @@
             prop: 'status',
             type: 'select',
             search: true,
-            searchSpan: 3,
-            labelWidth: 130,
-            searchPlaceholder:"任务状态",
+            searchSpan: 4,
+            searchLabelWidth: 100,
+            //labelWidth: 130,
+            
+            searchPlaceholder: "任务状态",
             width: 90,
             dicData: [
               {
@@ -237,180 +219,180 @@
             // valueFormat: 'YYYY-MM-DD HH:mm:ss',
           },
           {
-            label: '飞行任务完成时间',
+            label: '完成时间',
             prop: 'completedTime',
-            type:"date",
+            type: "date",
             addDisplay: false,
             editDisplay: false,
-            searchPlaceholder:"任务完成时间",
+            searchPlaceholder: "任务完成时间",
             labelWidth: 130,
-            search:true,
-            searchSpan:4,
-            searchLabelWidth:130,
-            valueFormat: 'YYYY-MM-DD',
+            search: true,
+            searchSpan: 4,
+            searchLabelWidth: 100,
+            //valueFormat: 'YYYY-MM-DD',
             width: 160,
           },
         ],
       },
       data: [],
-    };
+    }
   },
   computed: {
     ...mapGetters(['permission']),
-    permissionList() {
+    permissionList () {
       return {
         viewBtn: this.validData(this.permission.odm_task_view, true),
         delBtn: this.validData(this.permission.odm_task_delete, true),
         // editBtn: this.validData(this.permission.workspace_edit, true),
-      };
+      }
     },
-    ids() {
-      let ids = [];
+    ids () {
+      let ids = []
       this.selectionList.forEach(ele => {
-        ids.push(ele.id);
-      });
-      return ids.join(',');
+        ids.push(ele.id)
+      })
+      return ids.join(',')
     },
   },
   methods: {
     // 立即处理
-    atHandle(row) {
-      createOdmTask(row.waylineJobId,row.gsd).then(
+    atHandle (row) {
+      createOdmTask(row.waylineJobId, row.gsd).then(
         () => {
-          this.onLoad(this.page);
+          this.onLoad(this.page)
           this.$message({
             type: 'success',
             message: '操作成功!',
-          });
-          done();
+          })
+          done()
         },
         error => {
-          window.console.log(error);
-          loading();
+          window.console.log(error)
+          loading()
         }
-      );
+      )
     },
     // 重启启动
-    restartHandle(row) {
+    restartHandle (row) {
       if (!row.taskName) {
         this.$message({
           type: 'error',
           message: '该航线任务已删除,无法进行重启启动!',
-        });
-        return;
+        })
+        return
       }
       restartOdmTask(row.taskId).then(
         () => {
-          this.onLoad(this.page);
+          this.onLoad(this.page)
           this.$message({
             type: 'success',
             message: '操作成功!',
-          });
-          done();
+          })
+          done()
         },
         error => {
-          window.console.log(error);
-          loading();
+          window.console.log(error)
+          loading()
         }
-      );
+      )
     },
     // 时间格式化
-    formatSeconds(value) {
+    formatSeconds (value) {
       // 如果value不是数字或者小于0,则直接返回'00:00:00'
       if (isNaN(value) || value < 0) {
-        return '00:00:00';
+        return '00:00:00'
       }
 
       // 计算小时、分钟和秒
-      let seconds = Math.floor(value / 1000);
-      let minutes = Math.floor(seconds / 60);
-      let hours = Math.floor(minutes / 60);
+      let seconds = Math.floor(value / 1000)
+      let minutes = Math.floor(seconds / 60)
+      let hours = Math.floor(minutes / 60)
 
       // 格式化为两位数字的字符串
-      seconds %= 60;
-      minutes %= 60;
+      seconds %= 60
+      minutes %= 60
 
       const formattedTime = `${this.padZero(hours)}:${this.padZero(minutes)}:${this.padZero(
         seconds
-      )}`;
+      )}`
 
       // 返回格式化后的时间字符串
-      return formattedTime;
+      return formattedTime
     },
     // 函数用于在数字不足两位数时,在前面补零
-    padZero(value) {
-      return String(value).padStart(2, '0');
+    padZero (value) {
+      return String(value).padStart(2, '0')
     },
-    rowSave(row, done, loading) {
+    rowSave (row, done, loading) {
       add(row).then(
         () => {
-          this.onLoad(this.page);
+          this.onLoad(this.page)
           this.$message({
             type: 'success',
             message: '操作成功!',
-          });
-          done();
+          })
+          done()
         },
         error => {
-          window.console.log(error);
-          loading();
+          window.console.log(error)
+          loading()
         }
-      );
+      )
     },
-    rowUpdate(row, index, done, loading) {
+    rowUpdate (row, index, done, loading) {
       update(row).then(
         () => {
-          this.onLoad(this.page);
+          this.onLoad(this.page)
           this.$message({
             type: 'success',
             message: '操作成功!',
-          });
-          done();
+          })
+          done()
         },
         error => {
-          window.console.log(error);
-          loading();
+          window.console.log(error)
+          loading()
         }
-      );
+      )
     },
-    rowDel(row) {
+    rowDel (row) {
       this.$confirm('确定将选择数据删除?', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning',
       })
         .then(() => {
-          return remove(row.id);
+          return remove(row.id)
         })
         .then(() => {
-          this.onLoad(this.page);
+          this.onLoad(this.page)
           this.$message({
             type: 'success',
             message: '操作成功!',
-          });
-        });
+          })
+        })
     },
-    searchReset() {
-      this.query = {};
-      this.onLoad(this.page);
+    searchReset () {
+      this.query = {}
+      this.onLoad(this.page)
     },
-    searchChange(params, done) {
-      this.query = params;
-      this.page.currentPage = 1;
-      this.onLoad(this.page, params);
-      done();
+    searchChange (params, done) {
+      this.query = params
+      this.page.currentPage = 1
+      this.onLoad(this.page, params)
+      done()
     },
-    selectionChange(list) {
-      this.selectionList = list;
+    selectionChange (list) {
+      this.selectionList = list
     },
-    selectionClear() {
-      this.selectionList = [];
-      this.$refs.crud.toggleSelection();
+    selectionClear () {
+      this.selectionList = []
+      this.$refs.crud.toggleSelection()
     },
-    handleDelete() {
+    handleDelete () {
       if (this.selectionList.length === 0) {
-        this.$message.warning('请选择至少一条数据');
-        return;
+        this.$message.warning('请选择至少一条数据')
+        return
       }
       this.$confirm('确定将选择数据删除?', {
         confirmButtonText: '确定',
@@ -418,59 +400,59 @@
         type: 'warning',
       })
         .then(() => {
-          return remove(this.ids);
+          return remove(this.ids)
         })
         .then(() => {
-          this.onLoad(this.page);
+          this.onLoad(this.page)
           this.$message({
             type: 'success',
             message: '操作成功!',
-          });
-          this.$refs.crud.toggleSelection();
-        });
+          })
+          this.$refs.crud.toggleSelection()
+        })
     },
-    beforeOpen(done, type) {
+    beforeOpen (done, type) {
       // if (['edit', 'view'].includes(type)) {
       //   getDetail(this.form.id).then(res => {
       //     this.form = res.data.data;
       //   });
       // }
-      done();
+      done()
     },
-    currentChange(currentPage) {
-      this.page.currentPage = currentPage;
+    currentChange (currentPage) {
+      this.page.currentPage = currentPage
     },
-    sizeChange(pageSize) {
-      this.page.pageSize = pageSize;
+    sizeChange (pageSize) {
+      this.page.pageSize = pageSize
     },
-    refreshChange() {
-      this.onLoad(this.page, this.query);
+    refreshChange () {
+      this.onLoad(this.page, this.query)
     },
-    onLoad(page, params = {}) {
-      const { releaseTimeRange } = this.query;
+    onLoad (page, params = {}) {
+      const { releaseTimeRange } = this.query
       let values = {
         ...params,
         ...this.query,
-      };
+      }
       if (releaseTimeRange) {
         values = {
           ...values,
           releaseTime_datege: releaseTimeRange[0],
           releaseTime_datelt: releaseTimeRange[1],
-        };
-        values.releaseTimeRange = null;
+        }
+        values.releaseTimeRange = null
       }
-      this.loading = true;
+      this.loading = true
       getList(page.currentPage, page.pageSize, values).then(res => {
-        const data = res.data.data;
-        this.page.total = data.total;
-        this.data = data.records;
-        this.loading = false;
-        this.selectionClear();
-      });
+        const data = res.data.data
+        this.page.total = data.total
+        this.data = data.records
+        this.loading = false
+        this.selectionClear()
+      })
     },
   },
-};
+}
 </script>
 
-<style></style>
+<style scoped lang="scss"></style>

--
Gitblit v1.9.3