无人机管理后台前端(已迁走)
罗广辉
2025-10-11 02409bfbe15f22fc3b5dccadabfd860a660a49d9
src/views/odm/task.vue
@@ -12,6 +12,7 @@
      @row-update="rowUpdate"
      @row-save="rowSave"
      :before-open="beforeOpen"
      :before-close="beforeClose"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
@@ -45,13 +46,22 @@
          @click.stop="atHandle(scope.row, scope.index)"
          >立即启动
        </el-button>
        <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)"
          >重新启动
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
import { getList, remove, update, add,createOdmTask } from '@/api/odm/task';
import { getList, remove, update, add, createOdmTask, restartOdmTask } from '@/api/odm/task';
import { tourStrategies } from 'element-plus';
import { mapGetters } from 'vuex';
export default {
@@ -67,8 +77,6 @@
      },
      selectionList: [],
      option: {
        height: 'auto',
        calcHeight: 32,
        dialogWidth: 950,
        tip: false,
        searchShow: true,
@@ -83,11 +91,20 @@
        dialogClickModal: false,
        grid: false,
        menuWidth: 260,
        height: 'auto',
        calcHeight: 20,
        column: [
          {
            label: '任务名称',
            prop: 'taskName',
            search: true,
            labelWidth: 130,
            searchSpan: 4,
            searchLabelWidth: 100,
            //labelWidth: 130,
            searchPlaceholder: '任务名称',
            rules: [
              {
                required: true,
@@ -97,9 +114,10 @@
            ],
          },
          {
            label: '任务编号',
            prop: 'taskId',
            hide: true,
            label: '地块编号',
            prop: 'dkbh',
            labelWidth: 130,
            // hide:true,
            rules: [
              {
                required: true,
@@ -109,11 +127,37 @@
            ],
          },
          {
            label: '任务编号',
            prop: 'taskId',
            hide: true,
            labelWidth: 130,
            rules: [
              {
                required: true,
                message: '请输入任务编号',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '飞行任务编号',
            prop: 'waylineJobId',
            addDisplay: false,
            editDisplay: false,
            hide: true,
            labelWidth: 130,
            width: 160,
          },
          {
            label: '任务类型',
            prop: 'waylineType',
            type: 'select',
            search: true,
            searchSpan: 4,
            searchLabelWidth: 100,
            //width: 100,
            labelWidth: 130,
            searchPlaceholder: '任务类型',
            dicData: [
              {
                label: '航测',
@@ -124,25 +168,35 @@
                value: 4,
              },
            ],
            change: value => {
              this.searchChange({ ...this.query, waylineType: value.value }, () => {});
            },
          },
          {
            label: '所在机场名称',
            label: '机场名称',
            prop: 'airportName',
            searchSpan: 4,
            searchLabelWidth: 100,
            labelWidth: 130,
            //search: true,
          },
          {
            label: '图片数量',
            prop: 'imageCount',
            width:100,
            labelWidth: 130,
            width: 90,
          },
          {
            label: '拼图耗时',
            prop: 'processingTime',
            width:100,
            width: 90,
            labelWidth: 130,
          },
          {
            label: '进度',
            prop: 'runningProgress',
            width: 100,
            labelWidth: 130,
          },
          {
            label: '任务状态',
@@ -150,33 +204,21 @@
            type: 'select',
            search: true,
            searchSpan: 4,
            width:100,
            searchLabelWidth: 100,
            searchPlaceholder: '任务状态',
            labelWidth: 130,
            width: 90,
            dicData: [
              {
                label: '待启动',
                value: 0,
              },
              {
                label: '待处理',
                value: 10,
              },
              {
                label: '处理中',
                value: 20,
              },
              {
                label: '失败',
                value: 30,
              },
              {
                label: '已完成',
                value: 40,
              },
              {
                label: '已取消',
                value: 50,
              },
              { label: '待启动', value: 0 },
              { label: '待处理', value: 10 },
              { label: '处理中', value: 20 },
              { label: '失败', value: 30 },
              { label: '已完成', value: 40 },
              { label: '已取消', value: 50 },
            ],
            change: value => {
              this.searchChange({ ...this.query, status: value.value }, () => {});
            },
          },
          {
@@ -189,10 +231,28 @@
            width: 160,
            format: 'YYYY-MM-DD HH:mm:ss',
            // valueFormat: 'YYYY-MM-DD HH:mm:ss',
          }
          },
          {
            label: '完成时间',
            prop: 'completedTime',
            type: 'date',
            addDisplay: false,
            editDisplay: false,
            searchPlaceholder: '任务完成时间',
            labelWidth: 130,
            search: true,
            searchSpan: 4,
            searchLabelWidth: 100,
            //valueFormat: 'YYYY-MM-DD',
            width: 160,
            change: value => {
              this.searchChange({ ...this.query, completedTime: value.value }, () => {});
            },
          },
        ],
      },
      data: [],
      isClickSearch: true,
    };
  },
  computed: {
@@ -215,8 +275,31 @@
  methods: {
    // 立即处理
    atHandle(row) {
      console.log(row, 888);
      createOdmTask(row.waylineJobId).then(
      createOdmTask(row.waylineJobId, row.gsd).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          done();
        },
        error => {
          window.console.log(error);
          loading();
        }
      );
    },
    // 重启启动
    restartHandle(row) {
      if (!row.taskName) {
        this.$message({
          type: 'error',
          message: '该航线任务已删除,无法进行重启启动!',
        });
        return;
      }
      restartOdmTask(row.taskId).then(
        () => {
          this.onLoad(this.page);
          this.$message({
@@ -312,6 +395,8 @@
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      if (!this.isClickSearch) return;
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
@@ -352,8 +437,17 @@
      //     this.form = res.data.data;
      //   });
      // }
      this.isClickSearch = false;
      done();
    },
    beforeClose(done, type) {
      this.isClickSearch = true;
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
@@ -365,6 +459,7 @@
    },
    onLoad(page, params = {}) {
      const { releaseTimeRange } = this.query;
      let values = {
        ...params,
        ...this.query,
@@ -390,4 +485,4 @@
};
</script>
<style></style>
<style scoped lang="scss"></style>